commit e65ed63b59477ceccfbe851ddb105e5e08c0f64e Author: CatFoolYou Date: Tue Jan 28 17:42:43 2025 +0000 Upload source diff --git a/.gradle/8.0/checksums/checksums.lock b/.gradle/8.0/checksums/checksums.lock new file mode 100644 index 0000000..cd13ea4 Binary files /dev/null and b/.gradle/8.0/checksums/checksums.lock differ diff --git a/.gradle/8.0/checksums/sha1-checksums.bin b/.gradle/8.0/checksums/sha1-checksums.bin new file mode 100644 index 0000000..3d92cbd Binary files /dev/null and b/.gradle/8.0/checksums/sha1-checksums.bin differ diff --git a/.gradle/8.0/dependencies-accessors/dependencies-accessors.lock b/.gradle/8.0/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..6446ac6 Binary files /dev/null and b/.gradle/8.0/dependencies-accessors/dependencies-accessors.lock differ diff --git a/.gradle/8.0/dependencies-accessors/gc.properties b/.gradle/8.0/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/8.0/executionHistory/executionHistory.bin b/.gradle/8.0/executionHistory/executionHistory.bin new file mode 100644 index 0000000..25ef1e5 Binary files /dev/null and b/.gradle/8.0/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.0/executionHistory/executionHistory.lock b/.gradle/8.0/executionHistory/executionHistory.lock new file mode 100644 index 0000000..dd45dbf Binary files /dev/null and b/.gradle/8.0/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.0/fileChanges/last-build.bin b/.gradle/8.0/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/.gradle/8.0/fileChanges/last-build.bin differ diff --git a/.gradle/8.0/fileHashes/fileHashes.bin b/.gradle/8.0/fileHashes/fileHashes.bin new file mode 100644 index 0000000..7558db3 Binary files /dev/null and b/.gradle/8.0/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.0/fileHashes/fileHashes.lock b/.gradle/8.0/fileHashes/fileHashes.lock new file mode 100644 index 0000000..981db04 Binary files /dev/null and b/.gradle/8.0/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.0/fileHashes/resourceHashesCache.bin b/.gradle/8.0/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..6d194c8 Binary files /dev/null and b/.gradle/8.0/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/8.0/gc.properties b/.gradle/8.0/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..35f04e3 Binary files /dev/null and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..462df4a --- /dev/null +++ b/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Tue Nov 12 08:53:21 EST 2024 +gradle.version=8.0 diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..9400079 Binary files /dev/null and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe new file mode 100644 index 0000000..8985c31 Binary files /dev/null and b/.gradle/file-system.probe differ diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..fe82c4a --- /dev/null +++ b/build.gradle @@ -0,0 +1,41 @@ +plugins { + id "java" + id "application" +} + +sourceSets { + main { + java { + srcDir 'src/main/java' + srcDir 'src/lwjgl/java' + } + } +} + +repositories { + mavenCentral() +} + +tasks.withType(JavaCompile) { + options.warnings = false + options.compilerArgs << "-Xmaxerrs" << "1000" +} + +dependencies { + implementation fileTree(dir: './lwjgl-rundir/', include: '*.jar') +} + +distributions { + main { + contents { + from file("$projectDir/lwjgl-rundir/resources/assets") + into('/') + } + } + +} + +application { + mainClass = 'net.minecraft.client.main.Main' + applicationDefaultJvmArgs = ['-Djava.library.path=lwjgl-rundir'] +} diff --git a/build/classes/java/main/Start.class b/build/classes/java/main/Start.class new file mode 100644 index 0000000..2ae02ef Binary files /dev/null and b/build/classes/java/main/Start.class differ diff --git a/build/classes/java/main/net/minecraft/client/ClientBrandRetriever.class b/build/classes/java/main/net/minecraft/client/ClientBrandRetriever.class new file mode 100644 index 0000000..e6c0396 Binary files /dev/null and b/build/classes/java/main/net/minecraft/client/ClientBrandRetriever.class differ diff --git a/build/classes/java/main/net/minecraft/client/main/Main.class b/build/classes/java/main/net/minecraft/client/main/Main.class new file mode 100644 index 0000000..0c47ba7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/client/main/Main.class differ diff --git a/build/classes/java/main/net/minecraft/server/MinecraftServer.class b/build/classes/java/main/net/minecraft/server/MinecraftServer.class new file mode 100644 index 0000000..b248156 Binary files /dev/null and b/build/classes/java/main/net/minecraft/server/MinecraftServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/AABBLocalPool.class b/build/classes/java/main/net/minecraft/src/AABBLocalPool.class new file mode 100644 index 0000000..d1aa86f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AABBLocalPool.class differ diff --git a/build/classes/java/main/net/minecraft/src/AABBPool.class b/build/classes/java/main/net/minecraft/src/AABBPool.class new file mode 100644 index 0000000..8b4cc96 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AABBPool.class differ diff --git a/build/classes/java/main/net/minecraft/src/AbstractClientPlayer.class b/build/classes/java/main/net/minecraft/src/AbstractClientPlayer.class new file mode 100644 index 0000000..7dbebc5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AbstractClientPlayer.class differ diff --git a/build/classes/java/main/net/minecraft/src/AbstractResourcePack.class b/build/classes/java/main/net/minecraft/src/AbstractResourcePack.class new file mode 100644 index 0000000..6614e25 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AbstractResourcePack.class differ diff --git a/build/classes/java/main/net/minecraft/src/AbstractTexture.class b/build/classes/java/main/net/minecraft/src/AbstractTexture.class new file mode 100644 index 0000000..ad5288e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AbstractTexture.class differ diff --git a/build/classes/java/main/net/minecraft/src/Achievement.class b/build/classes/java/main/net/minecraft/src/Achievement.class new file mode 100644 index 0000000..e6ddbd5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Achievement.class differ diff --git a/build/classes/java/main/net/minecraft/src/AchievementList.class b/build/classes/java/main/net/minecraft/src/AchievementList.class new file mode 100644 index 0000000..3926369 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AchievementList.class differ diff --git a/build/classes/java/main/net/minecraft/src/AchievementMap.class b/build/classes/java/main/net/minecraft/src/AchievementMap.class new file mode 100644 index 0000000..36f0d6c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AchievementMap.class differ diff --git a/build/classes/java/main/net/minecraft/src/ActiveRenderInfo.class b/build/classes/java/main/net/minecraft/src/ActiveRenderInfo.class new file mode 100644 index 0000000..4da485a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ActiveRenderInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/AnimalChest.class b/build/classes/java/main/net/minecraft/src/AnimalChest.class new file mode 100644 index 0000000..26ea84a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AnimalChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/AnimationFrame.class b/build/classes/java/main/net/minecraft/src/AnimationFrame.class new file mode 100644 index 0000000..f2e64bf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AnimationFrame.class differ diff --git a/build/classes/java/main/net/minecraft/src/AnimationMetadataSection.class b/build/classes/java/main/net/minecraft/src/AnimationMetadataSection.class new file mode 100644 index 0000000..709c949 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AnimationMetadataSection.class differ diff --git a/build/classes/java/main/net/minecraft/src/AnimationMetadataSectionSerializer.class b/build/classes/java/main/net/minecraft/src/AnimationMetadataSectionSerializer.class new file mode 100644 index 0000000..6e664ad Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AnimationMetadataSectionSerializer.class differ diff --git a/build/classes/java/main/net/minecraft/src/AnvilChunkLoader.class b/build/classes/java/main/net/minecraft/src/AnvilChunkLoader.class new file mode 100644 index 0000000..7c80730 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AnvilChunkLoader.class differ diff --git a/build/classes/java/main/net/minecraft/src/AnvilChunkLoaderPending.class b/build/classes/java/main/net/minecraft/src/AnvilChunkLoaderPending.class new file mode 100644 index 0000000..a707cc0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AnvilChunkLoaderPending.class differ diff --git a/build/classes/java/main/net/minecraft/src/AnvilConverterData.class b/build/classes/java/main/net/minecraft/src/AnvilConverterData.class new file mode 100644 index 0000000..0e4ef7b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AnvilConverterData.class differ diff --git a/build/classes/java/main/net/minecraft/src/AnvilConverterException.class b/build/classes/java/main/net/minecraft/src/AnvilConverterException.class new file mode 100644 index 0000000..b5c04b5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AnvilConverterException.class differ diff --git a/build/classes/java/main/net/minecraft/src/AnvilSaveConverter.class b/build/classes/java/main/net/minecraft/src/AnvilSaveConverter.class new file mode 100644 index 0000000..fd092f6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AnvilSaveConverter.class differ diff --git a/build/classes/java/main/net/minecraft/src/AnvilSaveConverterFileFilter.class b/build/classes/java/main/net/minecraft/src/AnvilSaveConverterFileFilter.class new file mode 100644 index 0000000..66a516a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AnvilSaveConverterFileFilter.class differ diff --git a/build/classes/java/main/net/minecraft/src/AnvilSaveHandler.class b/build/classes/java/main/net/minecraft/src/AnvilSaveHandler.class new file mode 100644 index 0000000..6ff6715 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AnvilSaveHandler.class differ diff --git a/build/classes/java/main/net/minecraft/src/Attribute.class b/build/classes/java/main/net/minecraft/src/Attribute.class new file mode 100644 index 0000000..4446185 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Attribute.class differ diff --git a/build/classes/java/main/net/minecraft/src/AttributeInstance.class b/build/classes/java/main/net/minecraft/src/AttributeInstance.class new file mode 100644 index 0000000..47a9b96 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AttributeInstance.class differ diff --git a/build/classes/java/main/net/minecraft/src/AttributeModifier.class b/build/classes/java/main/net/minecraft/src/AttributeModifier.class new file mode 100644 index 0000000..cc79237 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AttributeModifier.class differ diff --git a/build/classes/java/main/net/minecraft/src/AxisAlignedBB.class b/build/classes/java/main/net/minecraft/src/AxisAlignedBB.class new file mode 100644 index 0000000..ac7843c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/AxisAlignedBB.class differ diff --git a/build/classes/java/main/net/minecraft/src/Backup.class b/build/classes/java/main/net/minecraft/src/Backup.class new file mode 100644 index 0000000..eccac6f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Backup.class differ diff --git a/build/classes/java/main/net/minecraft/src/BackupList.class b/build/classes/java/main/net/minecraft/src/BackupList.class new file mode 100644 index 0000000..9cff6fd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BackupList.class differ diff --git a/build/classes/java/main/net/minecraft/src/BanEntry.class b/build/classes/java/main/net/minecraft/src/BanEntry.class new file mode 100644 index 0000000..9c9c4d7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BanEntry.class differ diff --git a/build/classes/java/main/net/minecraft/src/BanList.class b/build/classes/java/main/net/minecraft/src/BanList.class new file mode 100644 index 0000000..442e32b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BanList.class differ diff --git a/build/classes/java/main/net/minecraft/src/BaseAttribute.class b/build/classes/java/main/net/minecraft/src/BaseAttribute.class new file mode 100644 index 0000000..2121521 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BaseAttribute.class differ diff --git a/build/classes/java/main/net/minecraft/src/BaseAttributeMap.class b/build/classes/java/main/net/minecraft/src/BaseAttributeMap.class new file mode 100644 index 0000000..327fb59 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BaseAttributeMap.class differ diff --git a/build/classes/java/main/net/minecraft/src/BaseMetadataSectionSerializer.class b/build/classes/java/main/net/minecraft/src/BaseMetadataSectionSerializer.class new file mode 100644 index 0000000..5695525 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BaseMetadataSectionSerializer.class differ diff --git a/build/classes/java/main/net/minecraft/src/BehaviorDefaultDispenseItem.class b/build/classes/java/main/net/minecraft/src/BehaviorDefaultDispenseItem.class new file mode 100644 index 0000000..7a8d07d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BehaviorDefaultDispenseItem.class differ diff --git a/build/classes/java/main/net/minecraft/src/BehaviorDispenseArmor.class b/build/classes/java/main/net/minecraft/src/BehaviorDispenseArmor.class new file mode 100644 index 0000000..4695a07 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BehaviorDispenseArmor.class differ diff --git a/build/classes/java/main/net/minecraft/src/BehaviorDispenseItemProvider.class b/build/classes/java/main/net/minecraft/src/BehaviorDispenseItemProvider.class new file mode 100644 index 0000000..b3ecd9e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BehaviorDispenseItemProvider.class differ diff --git a/build/classes/java/main/net/minecraft/src/BehaviorDispenseMinecart.class b/build/classes/java/main/net/minecraft/src/BehaviorDispenseMinecart.class new file mode 100644 index 0000000..cc43090 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BehaviorDispenseMinecart.class differ diff --git a/build/classes/java/main/net/minecraft/src/BehaviorProjectileDispense.class b/build/classes/java/main/net/minecraft/src/BehaviorProjectileDispense.class new file mode 100644 index 0000000..f127a94 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BehaviorProjectileDispense.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeCache.class b/build/classes/java/main/net/minecraft/src/BiomeCache.class new file mode 100644 index 0000000..01ceb98 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeCache.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeCacheBlock.class b/build/classes/java/main/net/minecraft/src/BiomeCacheBlock.class new file mode 100644 index 0000000..b8d398f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeCacheBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeDecorator.class b/build/classes/java/main/net/minecraft/src/BiomeDecorator.class new file mode 100644 index 0000000..ecc775d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeDecorator.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeEndDecorator.class b/build/classes/java/main/net/minecraft/src/BiomeEndDecorator.class new file mode 100644 index 0000000..e08807b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeEndDecorator.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenBase.class b/build/classes/java/main/net/minecraft/src/BiomeGenBase.class new file mode 100644 index 0000000..271b781 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenBeach.class b/build/classes/java/main/net/minecraft/src/BiomeGenBeach.class new file mode 100644 index 0000000..ae8342b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenBeach.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenDesert.class b/build/classes/java/main/net/minecraft/src/BiomeGenDesert.class new file mode 100644 index 0000000..d8d85a1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenDesert.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenEnd.class b/build/classes/java/main/net/minecraft/src/BiomeGenEnd.class new file mode 100644 index 0000000..a04523d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenEnd.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenForest.class b/build/classes/java/main/net/minecraft/src/BiomeGenForest.class new file mode 100644 index 0000000..3a66d71 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenForest.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenHell.class b/build/classes/java/main/net/minecraft/src/BiomeGenHell.class new file mode 100644 index 0000000..1b3bdac Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenHell.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenHills.class b/build/classes/java/main/net/minecraft/src/BiomeGenHills.class new file mode 100644 index 0000000..c097d89 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenHills.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenJungle.class b/build/classes/java/main/net/minecraft/src/BiomeGenJungle.class new file mode 100644 index 0000000..a9b6be0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenJungle.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenMushroomIsland.class b/build/classes/java/main/net/minecraft/src/BiomeGenMushroomIsland.class new file mode 100644 index 0000000..8b1ffd6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenMushroomIsland.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenOcean.class b/build/classes/java/main/net/minecraft/src/BiomeGenOcean.class new file mode 100644 index 0000000..8ff73ab Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenOcean.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenPlains.class b/build/classes/java/main/net/minecraft/src/BiomeGenPlains.class new file mode 100644 index 0000000..313c60d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenPlains.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenRiver.class b/build/classes/java/main/net/minecraft/src/BiomeGenRiver.class new file mode 100644 index 0000000..7e1f605 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenRiver.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenSnow.class b/build/classes/java/main/net/minecraft/src/BiomeGenSnow.class new file mode 100644 index 0000000..467a643 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenSnow.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenSwamp.class b/build/classes/java/main/net/minecraft/src/BiomeGenSwamp.class new file mode 100644 index 0000000..e34411e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenSwamp.class differ diff --git a/build/classes/java/main/net/minecraft/src/BiomeGenTaiga.class b/build/classes/java/main/net/minecraft/src/BiomeGenTaiga.class new file mode 100644 index 0000000..1563983 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BiomeGenTaiga.class differ diff --git a/build/classes/java/main/net/minecraft/src/Block.class b/build/classes/java/main/net/minecraft/src/Block.class new file mode 100644 index 0000000..78ea0ce Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Block.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockAnvil.class b/build/classes/java/main/net/minecraft/src/BlockAnvil.class new file mode 100644 index 0000000..5d86ac5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockAnvil.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockBasePressurePlate.class b/build/classes/java/main/net/minecraft/src/BlockBasePressurePlate.class new file mode 100644 index 0000000..90c7a2e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockBasePressurePlate.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockBaseRailLogic.class b/build/classes/java/main/net/minecraft/src/BlockBaseRailLogic.class new file mode 100644 index 0000000..ddd2f9c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockBaseRailLogic.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockBeacon.class b/build/classes/java/main/net/minecraft/src/BlockBeacon.class new file mode 100644 index 0000000..c6a28e5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockBeacon.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockBed.class b/build/classes/java/main/net/minecraft/src/BlockBed.class new file mode 100644 index 0000000..e36d725 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockBed.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockBookshelf.class b/build/classes/java/main/net/minecraft/src/BlockBookshelf.class new file mode 100644 index 0000000..b4f8444 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockBookshelf.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockBreakable.class b/build/classes/java/main/net/minecraft/src/BlockBreakable.class new file mode 100644 index 0000000..f386692 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockBreakable.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockBrewingStand.class b/build/classes/java/main/net/minecraft/src/BlockBrewingStand.class new file mode 100644 index 0000000..f43ecd0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockBrewingStand.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockButton.class b/build/classes/java/main/net/minecraft/src/BlockButton.class new file mode 100644 index 0000000..2820c23 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockButton.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockButtonStone.class b/build/classes/java/main/net/minecraft/src/BlockButtonStone.class new file mode 100644 index 0000000..86366fb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockButtonStone.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockButtonWood.class b/build/classes/java/main/net/minecraft/src/BlockButtonWood.class new file mode 100644 index 0000000..f956c45 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockButtonWood.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockCactus.class b/build/classes/java/main/net/minecraft/src/BlockCactus.class new file mode 100644 index 0000000..d866c93 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockCactus.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockCake.class b/build/classes/java/main/net/minecraft/src/BlockCake.class new file mode 100644 index 0000000..ad1a0d1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockCake.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockCarpet.class b/build/classes/java/main/net/minecraft/src/BlockCarpet.class new file mode 100644 index 0000000..7fbe571 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockCarpet.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockCarrot.class b/build/classes/java/main/net/minecraft/src/BlockCarrot.class new file mode 100644 index 0000000..0b7b028 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockCarrot.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockCauldron.class b/build/classes/java/main/net/minecraft/src/BlockCauldron.class new file mode 100644 index 0000000..faf6a8a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockCauldron.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockChest.class b/build/classes/java/main/net/minecraft/src/BlockChest.class new file mode 100644 index 0000000..35701c4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockClay.class b/build/classes/java/main/net/minecraft/src/BlockClay.class new file mode 100644 index 0000000..86394a5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockClay.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockCocoa.class b/build/classes/java/main/net/minecraft/src/BlockCocoa.class new file mode 100644 index 0000000..fece6c6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockCocoa.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockColored.class b/build/classes/java/main/net/minecraft/src/BlockColored.class new file mode 100644 index 0000000..f57c6be Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockColored.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockCommandBlock.class b/build/classes/java/main/net/minecraft/src/BlockCommandBlock.class new file mode 100644 index 0000000..a08a9a7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockCommandBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockComparator.class b/build/classes/java/main/net/minecraft/src/BlockComparator.class new file mode 100644 index 0000000..c416d3c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockComparator.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockContainer.class b/build/classes/java/main/net/minecraft/src/BlockContainer.class new file mode 100644 index 0000000..fed5f00 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockContainer.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockCrops.class b/build/classes/java/main/net/minecraft/src/BlockCrops.class new file mode 100644 index 0000000..a2fa298 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockCrops.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockDaylightDetector.class b/build/classes/java/main/net/minecraft/src/BlockDaylightDetector.class new file mode 100644 index 0000000..9b0c3b3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockDaylightDetector.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockDeadBush.class b/build/classes/java/main/net/minecraft/src/BlockDeadBush.class new file mode 100644 index 0000000..8a7a067 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockDeadBush.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockDetectorRail.class b/build/classes/java/main/net/minecraft/src/BlockDetectorRail.class new file mode 100644 index 0000000..a9cc617 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockDetectorRail.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockDirectional.class b/build/classes/java/main/net/minecraft/src/BlockDirectional.class new file mode 100644 index 0000000..d2ba1ca Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockDirectional.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockDirt.class b/build/classes/java/main/net/minecraft/src/BlockDirt.class new file mode 100644 index 0000000..06480b8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockDirt.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockDispenser.class b/build/classes/java/main/net/minecraft/src/BlockDispenser.class new file mode 100644 index 0000000..e9c4581 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockDispenser.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockDoor.class b/build/classes/java/main/net/minecraft/src/BlockDoor.class new file mode 100644 index 0000000..9b0c7ce Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockDoor.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockDragonEgg.class b/build/classes/java/main/net/minecraft/src/BlockDragonEgg.class new file mode 100644 index 0000000..b0a530b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockDragonEgg.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockDropper.class b/build/classes/java/main/net/minecraft/src/BlockDropper.class new file mode 100644 index 0000000..9f9f443 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockDropper.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockEnchantmentTable.class b/build/classes/java/main/net/minecraft/src/BlockEnchantmentTable.class new file mode 100644 index 0000000..51eb413 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockEnchantmentTable.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockEndPortal.class b/build/classes/java/main/net/minecraft/src/BlockEndPortal.class new file mode 100644 index 0000000..7d67777 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockEndPortal.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockEndPortalFrame.class b/build/classes/java/main/net/minecraft/src/BlockEndPortalFrame.class new file mode 100644 index 0000000..92c3d55 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockEndPortalFrame.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockEnderChest.class b/build/classes/java/main/net/minecraft/src/BlockEnderChest.class new file mode 100644 index 0000000..40c2e7a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockEnderChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockEventData.class b/build/classes/java/main/net/minecraft/src/BlockEventData.class new file mode 100644 index 0000000..9a6ce91 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockEventData.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockFarmland.class b/build/classes/java/main/net/minecraft/src/BlockFarmland.class new file mode 100644 index 0000000..1f8349e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockFarmland.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockFence.class b/build/classes/java/main/net/minecraft/src/BlockFence.class new file mode 100644 index 0000000..c58f93a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockFence.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockFenceGate.class b/build/classes/java/main/net/minecraft/src/BlockFenceGate.class new file mode 100644 index 0000000..43296f1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockFenceGate.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockFire.class b/build/classes/java/main/net/minecraft/src/BlockFire.class new file mode 100644 index 0000000..1100781 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockFire.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockFlower.class b/build/classes/java/main/net/minecraft/src/BlockFlower.class new file mode 100644 index 0000000..5ee60ef Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockFlower.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockFlowerPot.class b/build/classes/java/main/net/minecraft/src/BlockFlowerPot.class new file mode 100644 index 0000000..8837fb7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockFlowerPot.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockFlowing.class b/build/classes/java/main/net/minecraft/src/BlockFlowing.class new file mode 100644 index 0000000..4491ba4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockFlowing.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockFluid.class b/build/classes/java/main/net/minecraft/src/BlockFluid.class new file mode 100644 index 0000000..73be772 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockFluid.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockFurnace.class b/build/classes/java/main/net/minecraft/src/BlockFurnace.class new file mode 100644 index 0000000..797b3c9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockFurnace.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockGlass.class b/build/classes/java/main/net/minecraft/src/BlockGlass.class new file mode 100644 index 0000000..0ca005d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockGlass.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockGlowStone.class b/build/classes/java/main/net/minecraft/src/BlockGlowStone.class new file mode 100644 index 0000000..52a6719 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockGlowStone.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockGrass.class b/build/classes/java/main/net/minecraft/src/BlockGrass.class new file mode 100644 index 0000000..880845e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockGrass.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockGravel.class b/build/classes/java/main/net/minecraft/src/BlockGravel.class new file mode 100644 index 0000000..695b5b5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockGravel.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockHalfSlab.class b/build/classes/java/main/net/minecraft/src/BlockHalfSlab.class new file mode 100644 index 0000000..d0b1495 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockHalfSlab.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockHay.class b/build/classes/java/main/net/minecraft/src/BlockHay.class new file mode 100644 index 0000000..8897cb5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockHay.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockHopper.class b/build/classes/java/main/net/minecraft/src/BlockHopper.class new file mode 100644 index 0000000..1ea1060 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockHopper.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockIce.class b/build/classes/java/main/net/minecraft/src/BlockIce.class new file mode 100644 index 0000000..4fc4c07 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockIce.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockJukeBox.class b/build/classes/java/main/net/minecraft/src/BlockJukeBox.class new file mode 100644 index 0000000..8e97472 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockJukeBox.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockLadder.class b/build/classes/java/main/net/minecraft/src/BlockLadder.class new file mode 100644 index 0000000..c674e3e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockLadder.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockLeaves.class b/build/classes/java/main/net/minecraft/src/BlockLeaves.class new file mode 100644 index 0000000..4282998 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockLeaves.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockLeavesBase.class b/build/classes/java/main/net/minecraft/src/BlockLeavesBase.class new file mode 100644 index 0000000..4c70d2e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockLeavesBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockLever.class b/build/classes/java/main/net/minecraft/src/BlockLever.class new file mode 100644 index 0000000..1d9a8ca Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockLever.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockLilyPad.class b/build/classes/java/main/net/minecraft/src/BlockLilyPad.class new file mode 100644 index 0000000..34c096c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockLilyPad.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockLockedChest.class b/build/classes/java/main/net/minecraft/src/BlockLockedChest.class new file mode 100644 index 0000000..6d31d52 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockLockedChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockLog.class b/build/classes/java/main/net/minecraft/src/BlockLog.class new file mode 100644 index 0000000..ee50d08 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockLog.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockMelon.class b/build/classes/java/main/net/minecraft/src/BlockMelon.class new file mode 100644 index 0000000..397942d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockMelon.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockMobSpawner.class b/build/classes/java/main/net/minecraft/src/BlockMobSpawner.class new file mode 100644 index 0000000..5bdecd6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockMobSpawner.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockMushroom.class b/build/classes/java/main/net/minecraft/src/BlockMushroom.class new file mode 100644 index 0000000..901bd53 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockMushroom.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockMushroomCap.class b/build/classes/java/main/net/minecraft/src/BlockMushroomCap.class new file mode 100644 index 0000000..6348871 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockMushroomCap.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockMycelium.class b/build/classes/java/main/net/minecraft/src/BlockMycelium.class new file mode 100644 index 0000000..b51b190 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockMycelium.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockNetherStalk.class b/build/classes/java/main/net/minecraft/src/BlockNetherStalk.class new file mode 100644 index 0000000..9ca9b25 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockNetherStalk.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockNetherrack.class b/build/classes/java/main/net/minecraft/src/BlockNetherrack.class new file mode 100644 index 0000000..0b1bd7b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockNetherrack.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockNote.class b/build/classes/java/main/net/minecraft/src/BlockNote.class new file mode 100644 index 0000000..bcbcb9c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockNote.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockObsidian.class b/build/classes/java/main/net/minecraft/src/BlockObsidian.class new file mode 100644 index 0000000..cef503a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockObsidian.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockOre.class b/build/classes/java/main/net/minecraft/src/BlockOre.class new file mode 100644 index 0000000..d387ae7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockOre.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockOreStorage.class b/build/classes/java/main/net/minecraft/src/BlockOreStorage.class new file mode 100644 index 0000000..8118092 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockOreStorage.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockPane.class b/build/classes/java/main/net/minecraft/src/BlockPane.class new file mode 100644 index 0000000..8d71220 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockPane.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockPistonBase.class b/build/classes/java/main/net/minecraft/src/BlockPistonBase.class new file mode 100644 index 0000000..1abe870 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockPistonBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockPistonExtension.class b/build/classes/java/main/net/minecraft/src/BlockPistonExtension.class new file mode 100644 index 0000000..88521cc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockPistonExtension.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockPistonMoving.class b/build/classes/java/main/net/minecraft/src/BlockPistonMoving.class new file mode 100644 index 0000000..04f2247 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockPistonMoving.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockPortal.class b/build/classes/java/main/net/minecraft/src/BlockPortal.class new file mode 100644 index 0000000..6ab8266 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockPortal.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockPotato.class b/build/classes/java/main/net/minecraft/src/BlockPotato.class new file mode 100644 index 0000000..5ac790c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockPotato.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockPoweredOre.class b/build/classes/java/main/net/minecraft/src/BlockPoweredOre.class new file mode 100644 index 0000000..2c40931 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockPoweredOre.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockPressurePlate.class b/build/classes/java/main/net/minecraft/src/BlockPressurePlate.class new file mode 100644 index 0000000..784ba7b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockPressurePlate.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockPressurePlateWeighted.class b/build/classes/java/main/net/minecraft/src/BlockPressurePlateWeighted.class new file mode 100644 index 0000000..d79a92b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockPressurePlateWeighted.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockPumpkin.class b/build/classes/java/main/net/minecraft/src/BlockPumpkin.class new file mode 100644 index 0000000..c74f4e0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockPumpkin.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockQuartz.class b/build/classes/java/main/net/minecraft/src/BlockQuartz.class new file mode 100644 index 0000000..353fde0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockQuartz.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockRail.class b/build/classes/java/main/net/minecraft/src/BlockRail.class new file mode 100644 index 0000000..0f9eab0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockRail.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockRailBase.class b/build/classes/java/main/net/minecraft/src/BlockRailBase.class new file mode 100644 index 0000000..578de3a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockRailBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockRailPowered.class b/build/classes/java/main/net/minecraft/src/BlockRailPowered.class new file mode 100644 index 0000000..142b186 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockRailPowered.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockRedstoneLight.class b/build/classes/java/main/net/minecraft/src/BlockRedstoneLight.class new file mode 100644 index 0000000..c2e6d86 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockRedstoneLight.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockRedstoneLogic.class b/build/classes/java/main/net/minecraft/src/BlockRedstoneLogic.class new file mode 100644 index 0000000..d9fc9a4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockRedstoneLogic.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockRedstoneOre.class b/build/classes/java/main/net/minecraft/src/BlockRedstoneOre.class new file mode 100644 index 0000000..f178aba Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockRedstoneOre.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockRedstoneRepeater.class b/build/classes/java/main/net/minecraft/src/BlockRedstoneRepeater.class new file mode 100644 index 0000000..e0e1657 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockRedstoneRepeater.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockRedstoneTorch.class b/build/classes/java/main/net/minecraft/src/BlockRedstoneTorch.class new file mode 100644 index 0000000..7902bca Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockRedstoneTorch.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockRedstoneWire.class b/build/classes/java/main/net/minecraft/src/BlockRedstoneWire.class new file mode 100644 index 0000000..667d62f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockRedstoneWire.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockReed.class b/build/classes/java/main/net/minecraft/src/BlockReed.class new file mode 100644 index 0000000..5e281a6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockReed.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockRotatedPillar.class b/build/classes/java/main/net/minecraft/src/BlockRotatedPillar.class new file mode 100644 index 0000000..4224a33 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockRotatedPillar.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockSand.class b/build/classes/java/main/net/minecraft/src/BlockSand.class new file mode 100644 index 0000000..b75c6d5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockSand.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockSandStone.class b/build/classes/java/main/net/minecraft/src/BlockSandStone.class new file mode 100644 index 0000000..9e0236a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockSandStone.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockSapling.class b/build/classes/java/main/net/minecraft/src/BlockSapling.class new file mode 100644 index 0000000..89d9fc1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockSapling.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockSign.class b/build/classes/java/main/net/minecraft/src/BlockSign.class new file mode 100644 index 0000000..24ef3db Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockSign.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockSilverfish.class b/build/classes/java/main/net/minecraft/src/BlockSilverfish.class new file mode 100644 index 0000000..7c99b30 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockSilverfish.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockSkull.class b/build/classes/java/main/net/minecraft/src/BlockSkull.class new file mode 100644 index 0000000..a2e2561 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockSkull.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockSnow.class b/build/classes/java/main/net/minecraft/src/BlockSnow.class new file mode 100644 index 0000000..9f57445 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockSnow.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockSnowBlock.class b/build/classes/java/main/net/minecraft/src/BlockSnowBlock.class new file mode 100644 index 0000000..ef53809 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockSnowBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockSoulSand.class b/build/classes/java/main/net/minecraft/src/BlockSoulSand.class new file mode 100644 index 0000000..293b6a8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockSoulSand.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockSourceImpl.class b/build/classes/java/main/net/minecraft/src/BlockSourceImpl.class new file mode 100644 index 0000000..49e7891 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockSourceImpl.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockSponge.class b/build/classes/java/main/net/minecraft/src/BlockSponge.class new file mode 100644 index 0000000..956592b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockSponge.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockStairs.class b/build/classes/java/main/net/minecraft/src/BlockStairs.class new file mode 100644 index 0000000..e24a4a2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockStairs.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockStationary.class b/build/classes/java/main/net/minecraft/src/BlockStationary.class new file mode 100644 index 0000000..2ec163d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockStationary.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockStem.class b/build/classes/java/main/net/minecraft/src/BlockStem.class new file mode 100644 index 0000000..9eee3d8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockStem.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockStep.class b/build/classes/java/main/net/minecraft/src/BlockStep.class new file mode 100644 index 0000000..44c6630 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockStep.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockStone.class b/build/classes/java/main/net/minecraft/src/BlockStone.class new file mode 100644 index 0000000..def1fdf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockStone.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockStoneBrick.class b/build/classes/java/main/net/minecraft/src/BlockStoneBrick.class new file mode 100644 index 0000000..ff2202d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockStoneBrick.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockTNT.class b/build/classes/java/main/net/minecraft/src/BlockTNT.class new file mode 100644 index 0000000..42e85da Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockTNT.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockTallGrass.class b/build/classes/java/main/net/minecraft/src/BlockTallGrass.class new file mode 100644 index 0000000..5ba18ce Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockTallGrass.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockTorch.class b/build/classes/java/main/net/minecraft/src/BlockTorch.class new file mode 100644 index 0000000..0f713f6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockTorch.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockTrapDoor.class b/build/classes/java/main/net/minecraft/src/BlockTrapDoor.class new file mode 100644 index 0000000..604b677 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockTrapDoor.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockTripWire.class b/build/classes/java/main/net/minecraft/src/BlockTripWire.class new file mode 100644 index 0000000..f14eeff Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockTripWire.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockTripWireSource.class b/build/classes/java/main/net/minecraft/src/BlockTripWireSource.class new file mode 100644 index 0000000..3ff274b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockTripWireSource.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockVine.class b/build/classes/java/main/net/minecraft/src/BlockVine.class new file mode 100644 index 0000000..62da0c3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockVine.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockWall.class b/build/classes/java/main/net/minecraft/src/BlockWall.class new file mode 100644 index 0000000..b9b498b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockWall.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockWeb.class b/build/classes/java/main/net/minecraft/src/BlockWeb.class new file mode 100644 index 0000000..b5a9aa8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockWeb.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockWood.class b/build/classes/java/main/net/minecraft/src/BlockWood.class new file mode 100644 index 0000000..a7fbb4e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockWood.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockWoodSlab.class b/build/classes/java/main/net/minecraft/src/BlockWoodSlab.class new file mode 100644 index 0000000..de6a21c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockWoodSlab.class differ diff --git a/build/classes/java/main/net/minecraft/src/BlockWorkbench.class b/build/classes/java/main/net/minecraft/src/BlockWorkbench.class new file mode 100644 index 0000000..300ed62 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BlockWorkbench.class differ diff --git a/build/classes/java/main/net/minecraft/src/BossStatus.class b/build/classes/java/main/net/minecraft/src/BossStatus.class new file mode 100644 index 0000000..e4b3c7f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/BossStatus.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableBlockDataValue.class b/build/classes/java/main/net/minecraft/src/CallableBlockDataValue.class new file mode 100644 index 0000000..2aaa86c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableBlockDataValue.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableBlockLocation.class b/build/classes/java/main/net/minecraft/src/CallableBlockLocation.class new file mode 100644 index 0000000..6401c0a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableBlockLocation.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableBlockType.class b/build/classes/java/main/net/minecraft/src/CallableBlockType.class new file mode 100644 index 0000000..61e5fa2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableBlockType.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableChunkPosHash.class b/build/classes/java/main/net/minecraft/src/CallableChunkPosHash.class new file mode 100644 index 0000000..3f031bf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableChunkPosHash.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableClientMemoryStats.class b/build/classes/java/main/net/minecraft/src/CallableClientMemoryStats.class new file mode 100644 index 0000000..72a17cc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableClientMemoryStats.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableClientProfiler.class b/build/classes/java/main/net/minecraft/src/CallableClientProfiler.class new file mode 100644 index 0000000..39c3a2b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableClientProfiler.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableConnectionName.class b/build/classes/java/main/net/minecraft/src/CallableConnectionName.class new file mode 100644 index 0000000..b08302b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableConnectionName.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableCrashMemoryReport.class b/build/classes/java/main/net/minecraft/src/CallableCrashMemoryReport.class new file mode 100644 index 0000000..8e21832 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableCrashMemoryReport.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableEntityName.class b/build/classes/java/main/net/minecraft/src/CallableEntityName.class new file mode 100644 index 0000000..633ce49 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableEntityName.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableEntityTracker.class b/build/classes/java/main/net/minecraft/src/CallableEntityTracker.class new file mode 100644 index 0000000..1367079 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableEntityTracker.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableEntityType.class b/build/classes/java/main/net/minecraft/src/CallableEntityType.class new file mode 100644 index 0000000..d1ac513 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableEntityType.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableGLInfo.class b/build/classes/java/main/net/minecraft/src/CallableGLInfo.class new file mode 100644 index 0000000..fb51b25 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableGLInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableIntCache.class b/build/classes/java/main/net/minecraft/src/CallableIntCache.class new file mode 100644 index 0000000..fefc653 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableIntCache.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableIsFeatureChunk.class b/build/classes/java/main/net/minecraft/src/CallableIsFeatureChunk.class new file mode 100644 index 0000000..aba02be Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableIsFeatureChunk.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableIsModded.class b/build/classes/java/main/net/minecraft/src/CallableIsModded.class new file mode 100644 index 0000000..d63fda2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableIsModded.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableIsServerModded.class b/build/classes/java/main/net/minecraft/src/CallableIsServerModded.class new file mode 100644 index 0000000..60967a8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableIsServerModded.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableItemName.class b/build/classes/java/main/net/minecraft/src/CallableItemName.class new file mode 100644 index 0000000..fe0f753 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableItemName.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableJVMFlags.class b/build/classes/java/main/net/minecraft/src/CallableJVMFlags.class new file mode 100644 index 0000000..8254c4d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableJVMFlags.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableJavaInfo.class b/build/classes/java/main/net/minecraft/src/CallableJavaInfo.class new file mode 100644 index 0000000..8190f23 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableJavaInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableJavaInfo2.class b/build/classes/java/main/net/minecraft/src/CallableJavaInfo2.class new file mode 100644 index 0000000..2062d59 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableJavaInfo2.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLWJGLVersion.class b/build/classes/java/main/net/minecraft/src/CallableLWJGLVersion.class new file mode 100644 index 0000000..3ebe70a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLWJGLVersion.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLaunchedVersion.class b/build/classes/java/main/net/minecraft/src/CallableLaunchedVersion.class new file mode 100644 index 0000000..f05ca40 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLaunchedVersion.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLevelDimension.class b/build/classes/java/main/net/minecraft/src/CallableLevelDimension.class new file mode 100644 index 0000000..c1df9b2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLevelDimension.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLevelGamemode.class b/build/classes/java/main/net/minecraft/src/CallableLevelGamemode.class new file mode 100644 index 0000000..4b49f36 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLevelGamemode.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLevelGenerator.class b/build/classes/java/main/net/minecraft/src/CallableLevelGenerator.class new file mode 100644 index 0000000..2158432 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLevelGenerator.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLevelGeneratorOptions.class b/build/classes/java/main/net/minecraft/src/CallableLevelGeneratorOptions.class new file mode 100644 index 0000000..15c4b0a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLevelGeneratorOptions.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLevelSeed.class b/build/classes/java/main/net/minecraft/src/CallableLevelSeed.class new file mode 100644 index 0000000..2c6c60f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLevelSeed.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLevelSpawnLocation.class b/build/classes/java/main/net/minecraft/src/CallableLevelSpawnLocation.class new file mode 100644 index 0000000..4f8213d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLevelSpawnLocation.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLevelStorageVersion.class b/build/classes/java/main/net/minecraft/src/CallableLevelStorageVersion.class new file mode 100644 index 0000000..6b2575a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLevelStorageVersion.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLevelTime.class b/build/classes/java/main/net/minecraft/src/CallableLevelTime.class new file mode 100644 index 0000000..f67a397 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLevelTime.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLevelWeather.class b/build/classes/java/main/net/minecraft/src/CallableLevelWeather.class new file mode 100644 index 0000000..3441b7c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLevelWeather.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLvl1.class b/build/classes/java/main/net/minecraft/src/CallableLvl1.class new file mode 100644 index 0000000..00d0098 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLvl1.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLvl2.class b/build/classes/java/main/net/minecraft/src/CallableLvl2.class new file mode 100644 index 0000000..f62f22c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLvl2.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableLvl3.class b/build/classes/java/main/net/minecraft/src/CallableLvl3.class new file mode 100644 index 0000000..195a3fd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableLvl3.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableMPL1.class b/build/classes/java/main/net/minecraft/src/CallableMPL1.class new file mode 100644 index 0000000..29bd30e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableMPL1.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableMPL2.class b/build/classes/java/main/net/minecraft/src/CallableMPL2.class new file mode 100644 index 0000000..a0bdc00 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableMPL2.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableMemoryInfo.class b/build/classes/java/main/net/minecraft/src/CallableMemoryInfo.class new file mode 100644 index 0000000..3cd64e2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableMemoryInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableMinecraftVersion.class b/build/classes/java/main/net/minecraft/src/CallableMinecraftVersion.class new file mode 100644 index 0000000..7550e83 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableMinecraftVersion.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableModded.class b/build/classes/java/main/net/minecraft/src/CallableModded.class new file mode 100644 index 0000000..225d5f6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableModded.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableMouseLocation.class b/build/classes/java/main/net/minecraft/src/CallableMouseLocation.class new file mode 100644 index 0000000..40a97fc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableMouseLocation.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableOSInfo.class b/build/classes/java/main/net/minecraft/src/CallableOSInfo.class new file mode 100644 index 0000000..528c59d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableOSInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallablePacketClass.class b/build/classes/java/main/net/minecraft/src/CallablePacketClass.class new file mode 100644 index 0000000..d4772c1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallablePacketClass.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallablePacketID.class b/build/classes/java/main/net/minecraft/src/CallablePacketID.class new file mode 100644 index 0000000..d8d4bf2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallablePacketID.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableParticlePositionInfo.class b/build/classes/java/main/net/minecraft/src/CallableParticlePositionInfo.class new file mode 100644 index 0000000..7fbff29 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableParticlePositionInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableParticleScreenName.class b/build/classes/java/main/net/minecraft/src/CallableParticleScreenName.class new file mode 100644 index 0000000..74f10ce Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableParticleScreenName.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableScreenName.class b/build/classes/java/main/net/minecraft/src/CallableScreenName.class new file mode 100644 index 0000000..7dd85f8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableScreenName.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableScreenSize.class b/build/classes/java/main/net/minecraft/src/CallableScreenSize.class new file mode 100644 index 0000000..81318a0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableScreenSize.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableServerMemoryStats.class b/build/classes/java/main/net/minecraft/src/CallableServerMemoryStats.class new file mode 100644 index 0000000..4813a58 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableServerMemoryStats.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableServerProfiler.class b/build/classes/java/main/net/minecraft/src/CallableServerProfiler.class new file mode 100644 index 0000000..21389f9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableServerProfiler.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableServerType.class b/build/classes/java/main/net/minecraft/src/CallableServerType.class new file mode 100644 index 0000000..08fa885 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableServerType.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableStructureType.class b/build/classes/java/main/net/minecraft/src/CallableStructureType.class new file mode 100644 index 0000000..78fdebf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableStructureType.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableSuspiciousClasses.class b/build/classes/java/main/net/minecraft/src/CallableSuspiciousClasses.class new file mode 100644 index 0000000..c278935 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableSuspiciousClasses.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableTagCompound1.class b/build/classes/java/main/net/minecraft/src/CallableTagCompound1.class new file mode 100644 index 0000000..1e9577c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableTagCompound1.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableTagCompound2.class b/build/classes/java/main/net/minecraft/src/CallableTagCompound2.class new file mode 100644 index 0000000..f0f9131 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableTagCompound2.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableTexturePack.class b/build/classes/java/main/net/minecraft/src/CallableTexturePack.class new file mode 100644 index 0000000..26e8fab Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableTexturePack.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableTileEntityData.class b/build/classes/java/main/net/minecraft/src/CallableTileEntityData.class new file mode 100644 index 0000000..e523206 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableTileEntityData.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableTileEntityID.class b/build/classes/java/main/net/minecraft/src/CallableTileEntityID.class new file mode 100644 index 0000000..fcfae55 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableTileEntityID.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableTileEntityName.class b/build/classes/java/main/net/minecraft/src/CallableTileEntityName.class new file mode 100644 index 0000000..f7b5da3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableTileEntityName.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableType.class b/build/classes/java/main/net/minecraft/src/CallableType.class new file mode 100644 index 0000000..622b514 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableType.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableType2.class b/build/classes/java/main/net/minecraft/src/CallableType2.class new file mode 100644 index 0000000..e1c5e4f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableType2.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableType3.class b/build/classes/java/main/net/minecraft/src/CallableType3.class new file mode 100644 index 0000000..4096e5a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableType3.class differ diff --git a/build/classes/java/main/net/minecraft/src/CallableUpdatingScreenName.class b/build/classes/java/main/net/minecraft/src/CallableUpdatingScreenName.class new file mode 100644 index 0000000..d3bf20f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CallableUpdatingScreenName.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChatAllowedCharacters.class b/build/classes/java/main/net/minecraft/src/ChatAllowedCharacters.class new file mode 100644 index 0000000..1c0cf77 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChatAllowedCharacters.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChatClickData.class b/build/classes/java/main/net/minecraft/src/ChatClickData.class new file mode 100644 index 0000000..3859678 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChatClickData.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChatLine.class b/build/classes/java/main/net/minecraft/src/ChatLine.class new file mode 100644 index 0000000..3f24b9f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChatLine.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChatMessageComponent.class b/build/classes/java/main/net/minecraft/src/ChatMessageComponent.class new file mode 100644 index 0000000..60ce9e7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChatMessageComponent.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChestItemRenderHelper.class b/build/classes/java/main/net/minecraft/src/ChestItemRenderHelper.class new file mode 100644 index 0000000..1a8312c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChestItemRenderHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/Chunk.class b/build/classes/java/main/net/minecraft/src/Chunk.class new file mode 100644 index 0000000..0c4c084 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Chunk.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChunkCache.class b/build/classes/java/main/net/minecraft/src/ChunkCache.class new file mode 100644 index 0000000..f21ab16 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChunkCache.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChunkCoordIntPair.class b/build/classes/java/main/net/minecraft/src/ChunkCoordIntPair.class new file mode 100644 index 0000000..bd34771 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChunkCoordIntPair.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChunkCoordinates.class b/build/classes/java/main/net/minecraft/src/ChunkCoordinates.class new file mode 100644 index 0000000..3439c95 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChunkCoordinates.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChunkLoader.class b/build/classes/java/main/net/minecraft/src/ChunkLoader.class new file mode 100644 index 0000000..3258c0d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChunkLoader.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChunkPosition.class b/build/classes/java/main/net/minecraft/src/ChunkPosition.class new file mode 100644 index 0000000..052811f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChunkPosition.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChunkProviderClient.class b/build/classes/java/main/net/minecraft/src/ChunkProviderClient.class new file mode 100644 index 0000000..99675dc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChunkProviderClient.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChunkProviderEnd.class b/build/classes/java/main/net/minecraft/src/ChunkProviderEnd.class new file mode 100644 index 0000000..5298cbe Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChunkProviderEnd.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChunkProviderFlat.class b/build/classes/java/main/net/minecraft/src/ChunkProviderFlat.class new file mode 100644 index 0000000..d7713df Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChunkProviderFlat.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChunkProviderGenerate.class b/build/classes/java/main/net/minecraft/src/ChunkProviderGenerate.class new file mode 100644 index 0000000..433d048 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChunkProviderGenerate.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChunkProviderHell.class b/build/classes/java/main/net/minecraft/src/ChunkProviderHell.class new file mode 100644 index 0000000..8758dbe Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChunkProviderHell.class differ diff --git a/build/classes/java/main/net/minecraft/src/ChunkProviderServer.class b/build/classes/java/main/net/minecraft/src/ChunkProviderServer.class new file mode 100644 index 0000000..7adb9dd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ChunkProviderServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/ClippingHelper.class b/build/classes/java/main/net/minecraft/src/ClippingHelper.class new file mode 100644 index 0000000..65a0964 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ClippingHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/ClippingHelperImpl.class b/build/classes/java/main/net/minecraft/src/ClippingHelperImpl.class new file mode 100644 index 0000000..7713a55 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ClippingHelperImpl.class differ diff --git a/build/classes/java/main/net/minecraft/src/ColorizerFoliage.class b/build/classes/java/main/net/minecraft/src/ColorizerFoliage.class new file mode 100644 index 0000000..0e56e85 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ColorizerFoliage.class differ diff --git a/build/classes/java/main/net/minecraft/src/ColorizerGrass.class b/build/classes/java/main/net/minecraft/src/ColorizerGrass.class new file mode 100644 index 0000000..252ba20 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ColorizerGrass.class differ diff --git a/build/classes/java/main/net/minecraft/src/CombatEntry.class b/build/classes/java/main/net/minecraft/src/CombatEntry.class new file mode 100644 index 0000000..f0cdab1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CombatEntry.class differ diff --git a/build/classes/java/main/net/minecraft/src/CombatTracker.class b/build/classes/java/main/net/minecraft/src/CombatTracker.class new file mode 100644 index 0000000..b77c870 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CombatTracker.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandBase.class b/build/classes/java/main/net/minecraft/src/CommandBase.class new file mode 100644 index 0000000..f733b4e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandClearInventory.class b/build/classes/java/main/net/minecraft/src/CommandClearInventory.class new file mode 100644 index 0000000..cb2ab3d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandClearInventory.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandDebug.class b/build/classes/java/main/net/minecraft/src/CommandDebug.class new file mode 100644 index 0000000..724324f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandDebug.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandDefaultGameMode.class b/build/classes/java/main/net/minecraft/src/CommandDefaultGameMode.class new file mode 100644 index 0000000..951e5d7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandDefaultGameMode.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandDifficulty.class b/build/classes/java/main/net/minecraft/src/CommandDifficulty.class new file mode 100644 index 0000000..0b56f22 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandDifficulty.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandEffect.class b/build/classes/java/main/net/minecraft/src/CommandEffect.class new file mode 100644 index 0000000..7b1db63 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandEffect.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandEnchant.class b/build/classes/java/main/net/minecraft/src/CommandEnchant.class new file mode 100644 index 0000000..d360142 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandEnchant.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandException.class b/build/classes/java/main/net/minecraft/src/CommandException.class new file mode 100644 index 0000000..9741f7e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandException.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandGameMode.class b/build/classes/java/main/net/minecraft/src/CommandGameMode.class new file mode 100644 index 0000000..044530e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandGameMode.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandGameRule.class b/build/classes/java/main/net/minecraft/src/CommandGameRule.class new file mode 100644 index 0000000..d4143b1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandGameRule.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandGive.class b/build/classes/java/main/net/minecraft/src/CommandGive.class new file mode 100644 index 0000000..b782bd6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandGive.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandHandler.class b/build/classes/java/main/net/minecraft/src/CommandHandler.class new file mode 100644 index 0000000..010b423 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandHandler.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandHelp.class b/build/classes/java/main/net/minecraft/src/CommandHelp.class new file mode 100644 index 0000000..e0477b1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandHelp.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandKill.class b/build/classes/java/main/net/minecraft/src/CommandKill.class new file mode 100644 index 0000000..e4b71ff Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandKill.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandNotFoundException.class b/build/classes/java/main/net/minecraft/src/CommandNotFoundException.class new file mode 100644 index 0000000..f170716 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandNotFoundException.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandPlaySound.class b/build/classes/java/main/net/minecraft/src/CommandPlaySound.class new file mode 100644 index 0000000..ee7a0b5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandPlaySound.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerBan.class b/build/classes/java/main/net/minecraft/src/CommandServerBan.class new file mode 100644 index 0000000..d6c8481 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerBan.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerBanIp.class b/build/classes/java/main/net/minecraft/src/CommandServerBanIp.class new file mode 100644 index 0000000..5491831 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerBanIp.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerBanlist.class b/build/classes/java/main/net/minecraft/src/CommandServerBanlist.class new file mode 100644 index 0000000..05fb9ef Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerBanlist.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerDeop.class b/build/classes/java/main/net/minecraft/src/CommandServerDeop.class new file mode 100644 index 0000000..17965f9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerDeop.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerEmote.class b/build/classes/java/main/net/minecraft/src/CommandServerEmote.class new file mode 100644 index 0000000..130c47c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerEmote.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerKick.class b/build/classes/java/main/net/minecraft/src/CommandServerKick.class new file mode 100644 index 0000000..bba0335 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerKick.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerList.class b/build/classes/java/main/net/minecraft/src/CommandServerList.class new file mode 100644 index 0000000..06a1945 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerList.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerMessage.class b/build/classes/java/main/net/minecraft/src/CommandServerMessage.class new file mode 100644 index 0000000..4e3b8fd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerMessage.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerOp.class b/build/classes/java/main/net/minecraft/src/CommandServerOp.class new file mode 100644 index 0000000..d678a2e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerOp.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerPardon.class b/build/classes/java/main/net/minecraft/src/CommandServerPardon.class new file mode 100644 index 0000000..df7a4e1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerPardon.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerPardonIp.class b/build/classes/java/main/net/minecraft/src/CommandServerPardonIp.class new file mode 100644 index 0000000..ab315ab Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerPardonIp.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerPublishLocal.class b/build/classes/java/main/net/minecraft/src/CommandServerPublishLocal.class new file mode 100644 index 0000000..88fa489 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerPublishLocal.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerSaveAll.class b/build/classes/java/main/net/minecraft/src/CommandServerSaveAll.class new file mode 100644 index 0000000..204a61c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerSaveAll.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerSaveOff.class b/build/classes/java/main/net/minecraft/src/CommandServerSaveOff.class new file mode 100644 index 0000000..0a211e4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerSaveOff.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerSaveOn.class b/build/classes/java/main/net/minecraft/src/CommandServerSaveOn.class new file mode 100644 index 0000000..fe20c80 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerSaveOn.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerSay.class b/build/classes/java/main/net/minecraft/src/CommandServerSay.class new file mode 100644 index 0000000..4f98228 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerSay.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerStop.class b/build/classes/java/main/net/minecraft/src/CommandServerStop.class new file mode 100644 index 0000000..054acb2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerStop.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerTp.class b/build/classes/java/main/net/minecraft/src/CommandServerTp.class new file mode 100644 index 0000000..716326d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerTp.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandServerWhitelist.class b/build/classes/java/main/net/minecraft/src/CommandServerWhitelist.class new file mode 100644 index 0000000..26240eb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandServerWhitelist.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandSetPlayerTimeout.class b/build/classes/java/main/net/minecraft/src/CommandSetPlayerTimeout.class new file mode 100644 index 0000000..ca7706a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandSetPlayerTimeout.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandSetSpawnpoint.class b/build/classes/java/main/net/minecraft/src/CommandSetSpawnpoint.class new file mode 100644 index 0000000..f461bf5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandSetSpawnpoint.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandShowSeed.class b/build/classes/java/main/net/minecraft/src/CommandShowSeed.class new file mode 100644 index 0000000..8bd2280 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandShowSeed.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandSpreadPlayers.class b/build/classes/java/main/net/minecraft/src/CommandSpreadPlayers.class new file mode 100644 index 0000000..b7cede1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandSpreadPlayers.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandSpreadPlayersPosition.class b/build/classes/java/main/net/minecraft/src/CommandSpreadPlayersPosition.class new file mode 100644 index 0000000..011e679 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandSpreadPlayersPosition.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandTime.class b/build/classes/java/main/net/minecraft/src/CommandTime.class new file mode 100644 index 0000000..0f7f156 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandTime.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandToggleDownfall.class b/build/classes/java/main/net/minecraft/src/CommandToggleDownfall.class new file mode 100644 index 0000000..5f11795 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandToggleDownfall.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandWeather.class b/build/classes/java/main/net/minecraft/src/CommandWeather.class new file mode 100644 index 0000000..ab9e538 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandWeather.class differ diff --git a/build/classes/java/main/net/minecraft/src/CommandXP.class b/build/classes/java/main/net/minecraft/src/CommandXP.class new file mode 100644 index 0000000..f9dd574 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CommandXP.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComparatorClassSorter.class b/build/classes/java/main/net/minecraft/src/ComparatorClassSorter.class new file mode 100644 index 0000000..c48b214 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComparatorClassSorter.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentMineshaftCorridor.class b/build/classes/java/main/net/minecraft/src/ComponentMineshaftCorridor.class new file mode 100644 index 0000000..a5b9c78 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentMineshaftCorridor.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentMineshaftCross.class b/build/classes/java/main/net/minecraft/src/ComponentMineshaftCross.class new file mode 100644 index 0000000..905bc4f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentMineshaftCross.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentMineshaftRoom.class b/build/classes/java/main/net/minecraft/src/ComponentMineshaftRoom.class new file mode 100644 index 0000000..95f4efd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentMineshaftRoom.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentMineshaftStairs.class b/build/classes/java/main/net/minecraft/src/ComponentMineshaftStairs.class new file mode 100644 index 0000000..61cc044 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentMineshaftStairs.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor.class new file mode 100644 index 0000000..4ea157c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor2.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor2.class new file mode 100644 index 0000000..19c0101 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor2.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor3.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor3.class new file mode 100644 index 0000000..4cb94ce Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor3.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor4.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor4.class new file mode 100644 index 0000000..69f5977 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor4.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor5.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor5.class new file mode 100644 index 0000000..df54d3d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCorridor5.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCrossing.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCrossing.class new file mode 100644 index 0000000..1484fd8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCrossing.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCrossing2.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCrossing2.class new file mode 100644 index 0000000..b27dfd1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCrossing2.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCrossing3.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCrossing3.class new file mode 100644 index 0000000..9aeaabf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeCrossing3.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeEnd.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeEnd.class new file mode 100644 index 0000000..6dcdc5b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeEnd.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeEntrance.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeEntrance.class new file mode 100644 index 0000000..511ea58 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeEntrance.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeNetherStalkRoom.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeNetherStalkRoom.class new file mode 100644 index 0000000..a2cee41 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeNetherStalkRoom.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgePiece.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgePiece.class new file mode 100644 index 0000000..8a248a9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgePiece.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeStairs.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeStairs.class new file mode 100644 index 0000000..4867c62 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeStairs.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeStartPiece.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeStartPiece.class new file mode 100644 index 0000000..c775272 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeStartPiece.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeStraight.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeStraight.class new file mode 100644 index 0000000..4ac5370 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeStraight.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeThrone.class b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeThrone.class new file mode 100644 index 0000000..fbb43e2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentNetherBridgeThrone.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentScatteredFeature.class b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeature.class new file mode 100644 index 0000000..10f47b2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeature.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentScatteredFeatureDesertPyramid.class b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeatureDesertPyramid.class new file mode 100644 index 0000000..8c49ab9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeatureDesertPyramid.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentScatteredFeatureJunglePyramid.class b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeatureJunglePyramid.class new file mode 100644 index 0000000..d6788b4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeatureJunglePyramid.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentScatteredFeaturePieces.class b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeaturePieces.class new file mode 100644 index 0000000..58563b2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeaturePieces.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentScatteredFeaturePieces2.class b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeaturePieces2.class new file mode 100644 index 0000000..7e4bef9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeaturePieces2.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentScatteredFeatureSwampHut.class b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeatureSwampHut.class new file mode 100644 index 0000000..65579a4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentScatteredFeatureSwampHut.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStronghold.class b/build/classes/java/main/net/minecraft/src/ComponentStronghold.class new file mode 100644 index 0000000..8499483 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStronghold.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdChestCorridor.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdChestCorridor.class new file mode 100644 index 0000000..b1fea18 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdChestCorridor.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdCorridor.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdCorridor.class new file mode 100644 index 0000000..02c5547 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdCorridor.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdCrossing.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdCrossing.class new file mode 100644 index 0000000..6706122 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdCrossing.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdLeftTurn.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdLeftTurn.class new file mode 100644 index 0000000..7ca9cab Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdLeftTurn.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdLibrary.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdLibrary.class new file mode 100644 index 0000000..22540f6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdLibrary.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdPortalRoom.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdPortalRoom.class new file mode 100644 index 0000000..4786b32 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdPortalRoom.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdPrison.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdPrison.class new file mode 100644 index 0000000..ee7d6ae Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdPrison.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdRightTurn.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdRightTurn.class new file mode 100644 index 0000000..db2e3ff Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdRightTurn.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdRoomCrossing.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdRoomCrossing.class new file mode 100644 index 0000000..788691f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdRoomCrossing.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdStairs.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdStairs.class new file mode 100644 index 0000000..e5274fb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdStairs.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdStairs2.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdStairs2.class new file mode 100644 index 0000000..11e7c86 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdStairs2.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdStairsStraight.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdStairsStraight.class new file mode 100644 index 0000000..92507eb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdStairsStraight.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentStrongholdStraight.class b/build/classes/java/main/net/minecraft/src/ComponentStrongholdStraight.class new file mode 100644 index 0000000..6b124d7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentStrongholdStraight.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillage.class b/build/classes/java/main/net/minecraft/src/ComponentVillage.class new file mode 100644 index 0000000..299912d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillage.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageChurch.class b/build/classes/java/main/net/minecraft/src/ComponentVillageChurch.class new file mode 100644 index 0000000..fa282cf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageChurch.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageField.class b/build/classes/java/main/net/minecraft/src/ComponentVillageField.class new file mode 100644 index 0000000..c77791d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageField.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageField2.class b/build/classes/java/main/net/minecraft/src/ComponentVillageField2.class new file mode 100644 index 0000000..caaa536 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageField2.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageHall.class b/build/classes/java/main/net/minecraft/src/ComponentVillageHall.class new file mode 100644 index 0000000..4418671 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageHall.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageHouse1.class b/build/classes/java/main/net/minecraft/src/ComponentVillageHouse1.class new file mode 100644 index 0000000..0d816fd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageHouse1.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageHouse2.class b/build/classes/java/main/net/minecraft/src/ComponentVillageHouse2.class new file mode 100644 index 0000000..e30812f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageHouse2.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageHouse3.class b/build/classes/java/main/net/minecraft/src/ComponentVillageHouse3.class new file mode 100644 index 0000000..b4460ea Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageHouse3.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageHouse4_Garden.class b/build/classes/java/main/net/minecraft/src/ComponentVillageHouse4_Garden.class new file mode 100644 index 0000000..98c7136 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageHouse4_Garden.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillagePathGen.class b/build/classes/java/main/net/minecraft/src/ComponentVillagePathGen.class new file mode 100644 index 0000000..d6e512e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillagePathGen.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageRoadPiece.class b/build/classes/java/main/net/minecraft/src/ComponentVillageRoadPiece.class new file mode 100644 index 0000000..ca38c2d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageRoadPiece.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageStartPiece.class b/build/classes/java/main/net/minecraft/src/ComponentVillageStartPiece.class new file mode 100644 index 0000000..d43a7d5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageStartPiece.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageTorch.class b/build/classes/java/main/net/minecraft/src/ComponentVillageTorch.class new file mode 100644 index 0000000..c88999e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageTorch.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageWell.class b/build/classes/java/main/net/minecraft/src/ComponentVillageWell.class new file mode 100644 index 0000000..65833b6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageWell.class differ diff --git a/build/classes/java/main/net/minecraft/src/ComponentVillageWoodHut.class b/build/classes/java/main/net/minecraft/src/ComponentVillageWoodHut.class new file mode 100644 index 0000000..6aaff02 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ComponentVillageWoodHut.class differ diff --git a/build/classes/java/main/net/minecraft/src/CompressedStreamTools.class b/build/classes/java/main/net/minecraft/src/CompressedStreamTools.class new file mode 100644 index 0000000..b7c9df4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CompressedStreamTools.class differ diff --git a/build/classes/java/main/net/minecraft/src/Container.class b/build/classes/java/main/net/minecraft/src/Container.class new file mode 100644 index 0000000..77f1fe9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Container.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerBeacon.class b/build/classes/java/main/net/minecraft/src/ContainerBeacon.class new file mode 100644 index 0000000..51a840b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerBeacon.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerBrewingStand.class b/build/classes/java/main/net/minecraft/src/ContainerBrewingStand.class new file mode 100644 index 0000000..2fce76b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerBrewingStand.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerChest.class b/build/classes/java/main/net/minecraft/src/ContainerChest.class new file mode 100644 index 0000000..d4d8539 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerCreative.class b/build/classes/java/main/net/minecraft/src/ContainerCreative.class new file mode 100644 index 0000000..2eedbfe Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerCreative.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerDispenser.class b/build/classes/java/main/net/minecraft/src/ContainerDispenser.class new file mode 100644 index 0000000..9a00f0d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerDispenser.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerEnchantment.class b/build/classes/java/main/net/minecraft/src/ContainerEnchantment.class new file mode 100644 index 0000000..fe5a0a0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerEnchantment.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerFurnace.class b/build/classes/java/main/net/minecraft/src/ContainerFurnace.class new file mode 100644 index 0000000..f457514 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerFurnace.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerHopper.class b/build/classes/java/main/net/minecraft/src/ContainerHopper.class new file mode 100644 index 0000000..47251b3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerHopper.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerHorseInventory.class b/build/classes/java/main/net/minecraft/src/ContainerHorseInventory.class new file mode 100644 index 0000000..4bd0926 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerHorseInventory.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerHorseInventorySlotArmor.class b/build/classes/java/main/net/minecraft/src/ContainerHorseInventorySlotArmor.class new file mode 100644 index 0000000..37d0d69 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerHorseInventorySlotArmor.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerHorseInventorySlotSaddle.class b/build/classes/java/main/net/minecraft/src/ContainerHorseInventorySlotSaddle.class new file mode 100644 index 0000000..060d60b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerHorseInventorySlotSaddle.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerMerchant.class b/build/classes/java/main/net/minecraft/src/ContainerMerchant.class new file mode 100644 index 0000000..f97fffa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerMerchant.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerPlayer.class b/build/classes/java/main/net/minecraft/src/ContainerPlayer.class new file mode 100644 index 0000000..4c4b8ad Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerPlayer.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerRepair.class b/build/classes/java/main/net/minecraft/src/ContainerRepair.class new file mode 100644 index 0000000..50cb59c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerRepair.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerRepairINNER1.class b/build/classes/java/main/net/minecraft/src/ContainerRepairINNER1.class new file mode 100644 index 0000000..b5c0220 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerRepairINNER1.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerRepairINNER2.class b/build/classes/java/main/net/minecraft/src/ContainerRepairINNER2.class new file mode 100644 index 0000000..a68667c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerRepairINNER2.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerSheep.class b/build/classes/java/main/net/minecraft/src/ContainerSheep.class new file mode 100644 index 0000000..04bbc73 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerSheep.class differ diff --git a/build/classes/java/main/net/minecraft/src/ContainerWorkbench.class b/build/classes/java/main/net/minecraft/src/ContainerWorkbench.class new file mode 100644 index 0000000..13fbf28 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ContainerWorkbench.class differ diff --git a/build/classes/java/main/net/minecraft/src/ConvertingProgressUpdate.class b/build/classes/java/main/net/minecraft/src/ConvertingProgressUpdate.class new file mode 100644 index 0000000..b938bc1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ConvertingProgressUpdate.class differ diff --git a/build/classes/java/main/net/minecraft/src/CraftingManager.class b/build/classes/java/main/net/minecraft/src/CraftingManager.class new file mode 100644 index 0000000..98a597f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CraftingManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/CrashReport.class b/build/classes/java/main/net/minecraft/src/CrashReport.class new file mode 100644 index 0000000..554ba9a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CrashReport.class differ diff --git a/build/classes/java/main/net/minecraft/src/CrashReportCategory.class b/build/classes/java/main/net/minecraft/src/CrashReportCategory.class new file mode 100644 index 0000000..3d4457f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CrashReportCategory.class differ diff --git a/build/classes/java/main/net/minecraft/src/CrashReportCategoryEntry.class b/build/classes/java/main/net/minecraft/src/CrashReportCategoryEntry.class new file mode 100644 index 0000000..0948059 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CrashReportCategoryEntry.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeCrafting.class b/build/classes/java/main/net/minecraft/src/CreativeCrafting.class new file mode 100644 index 0000000..e096b49 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeCrafting.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabBlock.class b/build/classes/java/main/net/minecraft/src/CreativeTabBlock.class new file mode 100644 index 0000000..69fa083 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabBrewing.class b/build/classes/java/main/net/minecraft/src/CreativeTabBrewing.class new file mode 100644 index 0000000..2431081 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabBrewing.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabCombat.class b/build/classes/java/main/net/minecraft/src/CreativeTabCombat.class new file mode 100644 index 0000000..7eee5ab Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabCombat.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabDeco.class b/build/classes/java/main/net/minecraft/src/CreativeTabDeco.class new file mode 100644 index 0000000..86ab0bc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabDeco.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabFood.class b/build/classes/java/main/net/minecraft/src/CreativeTabFood.class new file mode 100644 index 0000000..ac8a0a0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabFood.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabInventory.class b/build/classes/java/main/net/minecraft/src/CreativeTabInventory.class new file mode 100644 index 0000000..a21d4a2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabInventory.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabMaterial.class b/build/classes/java/main/net/minecraft/src/CreativeTabMaterial.class new file mode 100644 index 0000000..28ab26b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabMaterial.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabMisc.class b/build/classes/java/main/net/minecraft/src/CreativeTabMisc.class new file mode 100644 index 0000000..38731a9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabMisc.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabRedstone.class b/build/classes/java/main/net/minecraft/src/CreativeTabRedstone.class new file mode 100644 index 0000000..46940b1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabRedstone.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabSearch.class b/build/classes/java/main/net/minecraft/src/CreativeTabSearch.class new file mode 100644 index 0000000..75c566c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabSearch.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabTools.class b/build/classes/java/main/net/minecraft/src/CreativeTabTools.class new file mode 100644 index 0000000..f1a8cec Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabTools.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabTransport.class b/build/classes/java/main/net/minecraft/src/CreativeTabTransport.class new file mode 100644 index 0000000..2ca112c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabTransport.class differ diff --git a/build/classes/java/main/net/minecraft/src/CreativeTabs.class b/build/classes/java/main/net/minecraft/src/CreativeTabs.class new file mode 100644 index 0000000..918aa84 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CreativeTabs.class differ diff --git a/build/classes/java/main/net/minecraft/src/CryptManager.class b/build/classes/java/main/net/minecraft/src/CryptManager.class new file mode 100644 index 0000000..cb881c3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/CryptManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/DamageSource.class b/build/classes/java/main/net/minecraft/src/DamageSource.class new file mode 100644 index 0000000..cec5561 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DamageSource.class differ diff --git a/build/classes/java/main/net/minecraft/src/DataWatcher.class b/build/classes/java/main/net/minecraft/src/DataWatcher.class new file mode 100644 index 0000000..3f30e1e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DataWatcher.class differ diff --git a/build/classes/java/main/net/minecraft/src/DedicatedPlayerList.class b/build/classes/java/main/net/minecraft/src/DedicatedPlayerList.class new file mode 100644 index 0000000..9fdbeb7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DedicatedPlayerList.class differ diff --git a/build/classes/java/main/net/minecraft/src/DedicatedServer.class b/build/classes/java/main/net/minecraft/src/DedicatedServer.class new file mode 100644 index 0000000..cdf4a5f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DedicatedServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/DedicatedServerCommandThread.class b/build/classes/java/main/net/minecraft/src/DedicatedServerCommandThread.class new file mode 100644 index 0000000..c73b5aa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DedicatedServerCommandThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/DedicatedServerListenThread.class b/build/classes/java/main/net/minecraft/src/DedicatedServerListenThread.class new file mode 100644 index 0000000..699d8ba Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DedicatedServerListenThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/DedicatedServerSleepThread.class b/build/classes/java/main/net/minecraft/src/DedicatedServerSleepThread.class new file mode 100644 index 0000000..3780072 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DedicatedServerSleepThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/DefaultResourcePack.class b/build/classes/java/main/net/minecraft/src/DefaultResourcePack.class new file mode 100644 index 0000000..6f0d40b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DefaultResourcePack.class differ diff --git a/build/classes/java/main/net/minecraft/src/DemoWorldManager.class b/build/classes/java/main/net/minecraft/src/DemoWorldManager.class new file mode 100644 index 0000000..2cedf6f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DemoWorldManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/DemoWorldServer.class b/build/classes/java/main/net/minecraft/src/DemoWorldServer.class new file mode 100644 index 0000000..87142c2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DemoWorldServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/DerivedWorldInfo.class b/build/classes/java/main/net/minecraft/src/DerivedWorldInfo.class new file mode 100644 index 0000000..364670a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DerivedWorldInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/DestroyBlockProgress.class b/build/classes/java/main/net/minecraft/src/DestroyBlockProgress.class new file mode 100644 index 0000000..150b82f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DestroyBlockProgress.class differ diff --git a/build/classes/java/main/net/minecraft/src/Direction.class b/build/classes/java/main/net/minecraft/src/Direction.class new file mode 100644 index 0000000..9461d16 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Direction.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorArrow.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorArrow.class new file mode 100644 index 0000000..8831436 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorArrow.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorBoat.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorBoat.class new file mode 100644 index 0000000..caf104c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorBoat.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorDye.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorDye.class new file mode 100644 index 0000000..d5d364b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorDye.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorEgg.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorEgg.class new file mode 100644 index 0000000..d8a0f5a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorEgg.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorEmptyBucket.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorEmptyBucket.class new file mode 100644 index 0000000..64b8834 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorEmptyBucket.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorExperience.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorExperience.class new file mode 100644 index 0000000..3bf3b37 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorExperience.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorFilledBucket.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorFilledBucket.class new file mode 100644 index 0000000..ded76c1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorFilledBucket.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorFire.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorFire.class new file mode 100644 index 0000000..3442f61 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorFire.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorFireball.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorFireball.class new file mode 100644 index 0000000..0fd5504 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorFireball.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorFireworks.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorFireworks.class new file mode 100644 index 0000000..b29c6da Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorFireworks.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorMobEgg.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorMobEgg.class new file mode 100644 index 0000000..150e373 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorMobEgg.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorPotion.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorPotion.class new file mode 100644 index 0000000..f32e071 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorPotion.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorPotionProjectile.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorPotionProjectile.class new file mode 100644 index 0000000..07e229f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorPotionProjectile.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorSnowball.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorSnowball.class new file mode 100644 index 0000000..74de551 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorSnowball.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviorTNT.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviorTNT.class new file mode 100644 index 0000000..2b23bf3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviorTNT.class differ diff --git a/build/classes/java/main/net/minecraft/src/DispenserBehaviors.class b/build/classes/java/main/net/minecraft/src/DispenserBehaviors.class new file mode 100644 index 0000000..dee20e3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DispenserBehaviors.class differ diff --git a/build/classes/java/main/net/minecraft/src/DynamicTexture.class b/build/classes/java/main/net/minecraft/src/DynamicTexture.class new file mode 100644 index 0000000..1a49f1d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/DynamicTexture.class differ diff --git a/build/classes/java/main/net/minecraft/src/EffectRenderer.class b/build/classes/java/main/net/minecraft/src/EffectRenderer.class new file mode 100644 index 0000000..e3db161 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EffectRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/Empty3.class b/build/classes/java/main/net/minecraft/src/Empty3.class new file mode 100644 index 0000000..e1a2c51 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Empty3.class differ diff --git a/build/classes/java/main/net/minecraft/src/EmptyChunk.class b/build/classes/java/main/net/minecraft/src/EmptyChunk.class new file mode 100644 index 0000000..b88a9f1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EmptyChunk.class differ diff --git a/build/classes/java/main/net/minecraft/src/Enchantment.class b/build/classes/java/main/net/minecraft/src/Enchantment.class new file mode 100644 index 0000000..fb9d545 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Enchantment.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentArrowDamage.class b/build/classes/java/main/net/minecraft/src/EnchantmentArrowDamage.class new file mode 100644 index 0000000..44d2ba5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentArrowDamage.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentArrowFire.class b/build/classes/java/main/net/minecraft/src/EnchantmentArrowFire.class new file mode 100644 index 0000000..18d5cb7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentArrowFire.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentArrowInfinite.class b/build/classes/java/main/net/minecraft/src/EnchantmentArrowInfinite.class new file mode 100644 index 0000000..298694d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentArrowInfinite.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentArrowKnockback.class b/build/classes/java/main/net/minecraft/src/EnchantmentArrowKnockback.class new file mode 100644 index 0000000..5ad5ecc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentArrowKnockback.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentDamage.class b/build/classes/java/main/net/minecraft/src/EnchantmentDamage.class new file mode 100644 index 0000000..e28a5a9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentDamage.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentData.class b/build/classes/java/main/net/minecraft/src/EnchantmentData.class new file mode 100644 index 0000000..fd63840 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentData.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentDigging.class b/build/classes/java/main/net/minecraft/src/EnchantmentDigging.class new file mode 100644 index 0000000..598bf64 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentDigging.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentDurability.class b/build/classes/java/main/net/minecraft/src/EnchantmentDurability.class new file mode 100644 index 0000000..49a66c1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentDurability.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentFireAspect.class b/build/classes/java/main/net/minecraft/src/EnchantmentFireAspect.class new file mode 100644 index 0000000..1593194 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentFireAspect.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentHelper.class b/build/classes/java/main/net/minecraft/src/EnchantmentHelper.class new file mode 100644 index 0000000..2789f95 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentKnockback.class b/build/classes/java/main/net/minecraft/src/EnchantmentKnockback.class new file mode 100644 index 0000000..1955cdf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentKnockback.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentLootBonus.class b/build/classes/java/main/net/minecraft/src/EnchantmentLootBonus.class new file mode 100644 index 0000000..f932870 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentLootBonus.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentModifierDamage.class b/build/classes/java/main/net/minecraft/src/EnchantmentModifierDamage.class new file mode 100644 index 0000000..3af6ae0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentModifierDamage.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentModifierLiving.class b/build/classes/java/main/net/minecraft/src/EnchantmentModifierLiving.class new file mode 100644 index 0000000..40cbaf7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentModifierLiving.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentNameParts.class b/build/classes/java/main/net/minecraft/src/EnchantmentNameParts.class new file mode 100644 index 0000000..e4f0b35 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentNameParts.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentOxygen.class b/build/classes/java/main/net/minecraft/src/EnchantmentOxygen.class new file mode 100644 index 0000000..ef6b30e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentOxygen.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentProtection.class b/build/classes/java/main/net/minecraft/src/EnchantmentProtection.class new file mode 100644 index 0000000..819b0b6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentProtection.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentThorns.class b/build/classes/java/main/net/minecraft/src/EnchantmentThorns.class new file mode 100644 index 0000000..2a83bdd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentThorns.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentUntouching.class b/build/classes/java/main/net/minecraft/src/EnchantmentUntouching.class new file mode 100644 index 0000000..ae39949 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentUntouching.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnchantmentWaterWorker.class b/build/classes/java/main/net/minecraft/src/EnchantmentWaterWorker.class new file mode 100644 index 0000000..99ec849 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnchantmentWaterWorker.class differ diff --git a/build/classes/java/main/net/minecraft/src/Entity.class b/build/classes/java/main/net/minecraft/src/Entity.class new file mode 100644 index 0000000..3c7e193 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Entity.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIArrowAttack.class b/build/classes/java/main/net/minecraft/src/EntityAIArrowAttack.class new file mode 100644 index 0000000..ce5f705 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIArrowAttack.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIAttackOnCollide.class b/build/classes/java/main/net/minecraft/src/EntityAIAttackOnCollide.class new file mode 100644 index 0000000..1eb5e02 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIAttackOnCollide.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIAvoidEntity.class b/build/classes/java/main/net/minecraft/src/EntityAIAvoidEntity.class new file mode 100644 index 0000000..c443b83 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIAvoidEntity.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIAvoidEntitySelector.class b/build/classes/java/main/net/minecraft/src/EntityAIAvoidEntitySelector.class new file mode 100644 index 0000000..7350b5c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIAvoidEntitySelector.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIBase.class b/build/classes/java/main/net/minecraft/src/EntityAIBase.class new file mode 100644 index 0000000..ab4b49c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIBeg.class b/build/classes/java/main/net/minecraft/src/EntityAIBeg.class new file mode 100644 index 0000000..ac3bb68 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIBeg.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIBreakDoor.class b/build/classes/java/main/net/minecraft/src/EntityAIBreakDoor.class new file mode 100644 index 0000000..8f87e80 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIBreakDoor.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIControlledByPlayer.class b/build/classes/java/main/net/minecraft/src/EntityAIControlledByPlayer.class new file mode 100644 index 0000000..e24471a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIControlledByPlayer.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAICreeperSwell.class b/build/classes/java/main/net/minecraft/src/EntityAICreeperSwell.class new file mode 100644 index 0000000..da60799 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAICreeperSwell.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIDefendVillage.class b/build/classes/java/main/net/minecraft/src/EntityAIDefendVillage.class new file mode 100644 index 0000000..e140861 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIDefendVillage.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIDoorInteract.class b/build/classes/java/main/net/minecraft/src/EntityAIDoorInteract.class new file mode 100644 index 0000000..4b65b04 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIDoorInteract.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIEatGrass.class b/build/classes/java/main/net/minecraft/src/EntityAIEatGrass.class new file mode 100644 index 0000000..d9122ff Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIEatGrass.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIFleeSun.class b/build/classes/java/main/net/minecraft/src/EntityAIFleeSun.class new file mode 100644 index 0000000..4d09fc7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIFleeSun.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIFollowGolem.class b/build/classes/java/main/net/minecraft/src/EntityAIFollowGolem.class new file mode 100644 index 0000000..e32c4d6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIFollowGolem.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIFollowOwner.class b/build/classes/java/main/net/minecraft/src/EntityAIFollowOwner.class new file mode 100644 index 0000000..a51cbaa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIFollowOwner.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIFollowParent.class b/build/classes/java/main/net/minecraft/src/EntityAIFollowParent.class new file mode 100644 index 0000000..a627ca3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIFollowParent.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIHurtByTarget.class b/build/classes/java/main/net/minecraft/src/EntityAIHurtByTarget.class new file mode 100644 index 0000000..abb59a0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIHurtByTarget.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAILeapAtTarget.class b/build/classes/java/main/net/minecraft/src/EntityAILeapAtTarget.class new file mode 100644 index 0000000..46e207f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAILeapAtTarget.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAILookAtTradePlayer.class b/build/classes/java/main/net/minecraft/src/EntityAILookAtTradePlayer.class new file mode 100644 index 0000000..e5196a3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAILookAtTradePlayer.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAILookAtVillager.class b/build/classes/java/main/net/minecraft/src/EntityAILookAtVillager.class new file mode 100644 index 0000000..663d31d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAILookAtVillager.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAILookIdle.class b/build/classes/java/main/net/minecraft/src/EntityAILookIdle.class new file mode 100644 index 0000000..8fef983 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAILookIdle.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIMate.class b/build/classes/java/main/net/minecraft/src/EntityAIMate.class new file mode 100644 index 0000000..4f6d1d7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIMate.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIMoveIndoors.class b/build/classes/java/main/net/minecraft/src/EntityAIMoveIndoors.class new file mode 100644 index 0000000..a305fc7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIMoveIndoors.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIMoveThroughVillage.class b/build/classes/java/main/net/minecraft/src/EntityAIMoveThroughVillage.class new file mode 100644 index 0000000..63049e0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIMoveThroughVillage.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIMoveTowardsRestriction.class b/build/classes/java/main/net/minecraft/src/EntityAIMoveTowardsRestriction.class new file mode 100644 index 0000000..3e286a0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIMoveTowardsRestriction.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIMoveTowardsTarget.class b/build/classes/java/main/net/minecraft/src/EntityAIMoveTowardsTarget.class new file mode 100644 index 0000000..1a84540 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIMoveTowardsTarget.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAINearestAttackableTarget.class b/build/classes/java/main/net/minecraft/src/EntityAINearestAttackableTarget.class new file mode 100644 index 0000000..a773c90 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAINearestAttackableTarget.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAINearestAttackableTargetSelector.class b/build/classes/java/main/net/minecraft/src/EntityAINearestAttackableTargetSelector.class new file mode 100644 index 0000000..198404f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAINearestAttackableTargetSelector.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAINearestAttackableTargetSorter.class b/build/classes/java/main/net/minecraft/src/EntityAINearestAttackableTargetSorter.class new file mode 100644 index 0000000..a9f24e9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAINearestAttackableTargetSorter.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIOcelotAttack.class b/build/classes/java/main/net/minecraft/src/EntityAIOcelotAttack.class new file mode 100644 index 0000000..0fd88cc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIOcelotAttack.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIOcelotSit.class b/build/classes/java/main/net/minecraft/src/EntityAIOcelotSit.class new file mode 100644 index 0000000..31ba821 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIOcelotSit.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIOpenDoor.class b/build/classes/java/main/net/minecraft/src/EntityAIOpenDoor.class new file mode 100644 index 0000000..965cf2b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIOpenDoor.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIOwnerHurtByTarget.class b/build/classes/java/main/net/minecraft/src/EntityAIOwnerHurtByTarget.class new file mode 100644 index 0000000..6d0a512 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIOwnerHurtByTarget.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIOwnerHurtTarget.class b/build/classes/java/main/net/minecraft/src/EntityAIOwnerHurtTarget.class new file mode 100644 index 0000000..4b05b3c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIOwnerHurtTarget.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIPanic.class b/build/classes/java/main/net/minecraft/src/EntityAIPanic.class new file mode 100644 index 0000000..320bf83 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIPanic.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIPlay.class b/build/classes/java/main/net/minecraft/src/EntityAIPlay.class new file mode 100644 index 0000000..56282e9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIPlay.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIRestrictOpenDoor.class b/build/classes/java/main/net/minecraft/src/EntityAIRestrictOpenDoor.class new file mode 100644 index 0000000..115d958 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIRestrictOpenDoor.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIRestrictSun.class b/build/classes/java/main/net/minecraft/src/EntityAIRestrictSun.class new file mode 100644 index 0000000..e748e1b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIRestrictSun.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIRunAroundLikeCrazy.class b/build/classes/java/main/net/minecraft/src/EntityAIRunAroundLikeCrazy.class new file mode 100644 index 0000000..8a378bc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIRunAroundLikeCrazy.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAISit.class b/build/classes/java/main/net/minecraft/src/EntityAISit.class new file mode 100644 index 0000000..ea9dc39 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAISit.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAISwimming.class b/build/classes/java/main/net/minecraft/src/EntityAISwimming.class new file mode 100644 index 0000000..16b1ec6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAISwimming.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAITarget.class b/build/classes/java/main/net/minecraft/src/EntityAITarget.class new file mode 100644 index 0000000..f1ed731 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAITarget.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAITargetNonTamed.class b/build/classes/java/main/net/minecraft/src/EntityAITargetNonTamed.class new file mode 100644 index 0000000..27fd8a6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAITargetNonTamed.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAITaskEntry.class b/build/classes/java/main/net/minecraft/src/EntityAITaskEntry.class new file mode 100644 index 0000000..1d8e390 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAITaskEntry.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAITasks.class b/build/classes/java/main/net/minecraft/src/EntityAITasks.class new file mode 100644 index 0000000..815f298 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAITasks.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAITempt.class b/build/classes/java/main/net/minecraft/src/EntityAITempt.class new file mode 100644 index 0000000..73dbec4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAITempt.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAITradePlayer.class b/build/classes/java/main/net/minecraft/src/EntityAITradePlayer.class new file mode 100644 index 0000000..d9658ab Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAITradePlayer.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIVillagerMate.class b/build/classes/java/main/net/minecraft/src/EntityAIVillagerMate.class new file mode 100644 index 0000000..9eaec81 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIVillagerMate.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIWander.class b/build/classes/java/main/net/minecraft/src/EntityAIWander.class new file mode 100644 index 0000000..38ea66a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIWander.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIWatchClosest.class b/build/classes/java/main/net/minecraft/src/EntityAIWatchClosest.class new file mode 100644 index 0000000..3c649d0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIWatchClosest.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAIWatchClosest2.class b/build/classes/java/main/net/minecraft/src/EntityAIWatchClosest2.class new file mode 100644 index 0000000..41dbfb4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAIWatchClosest2.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAgeable.class b/build/classes/java/main/net/minecraft/src/EntityAgeable.class new file mode 100644 index 0000000..06ad751 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAgeable.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAmbientCreature.class b/build/classes/java/main/net/minecraft/src/EntityAmbientCreature.class new file mode 100644 index 0000000..3d39228 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAmbientCreature.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAnimal.class b/build/classes/java/main/net/minecraft/src/EntityAnimal.class new file mode 100644 index 0000000..a314ec0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAnimal.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityArrow.class b/build/classes/java/main/net/minecraft/src/EntityArrow.class new file mode 100644 index 0000000..7fca975 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityArrow.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityAuraFX.class b/build/classes/java/main/net/minecraft/src/EntityAuraFX.class new file mode 100644 index 0000000..37628ef Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityAuraFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityBat.class b/build/classes/java/main/net/minecraft/src/EntityBat.class new file mode 100644 index 0000000..781627b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityBat.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityBlaze.class b/build/classes/java/main/net/minecraft/src/EntityBlaze.class new file mode 100644 index 0000000..7c84be6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityBlaze.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityBoat.class b/build/classes/java/main/net/minecraft/src/EntityBoat.class new file mode 100644 index 0000000..aef1ff7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityBoat.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityBodyHelper.class b/build/classes/java/main/net/minecraft/src/EntityBodyHelper.class new file mode 100644 index 0000000..30a076c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityBodyHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityBreakingFX.class b/build/classes/java/main/net/minecraft/src/EntityBreakingFX.class new file mode 100644 index 0000000..81c0fd7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityBreakingFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityBubbleFX.class b/build/classes/java/main/net/minecraft/src/EntityBubbleFX.class new file mode 100644 index 0000000..ba5bb99 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityBubbleFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityCaveSpider.class b/build/classes/java/main/net/minecraft/src/EntityCaveSpider.class new file mode 100644 index 0000000..1b1a6fe Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityCaveSpider.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityChicken.class b/build/classes/java/main/net/minecraft/src/EntityChicken.class new file mode 100644 index 0000000..af7569c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityChicken.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityClientPlayerMP.class b/build/classes/java/main/net/minecraft/src/EntityClientPlayerMP.class new file mode 100644 index 0000000..f71da8e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityClientPlayerMP.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityCloudFX.class b/build/classes/java/main/net/minecraft/src/EntityCloudFX.class new file mode 100644 index 0000000..5dadb4e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityCloudFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityCow.class b/build/classes/java/main/net/minecraft/src/EntityCow.class new file mode 100644 index 0000000..acb3dca Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityCow.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityCreature.class b/build/classes/java/main/net/minecraft/src/EntityCreature.class new file mode 100644 index 0000000..3b6df23 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityCreature.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityCreeper.class b/build/classes/java/main/net/minecraft/src/EntityCreeper.class new file mode 100644 index 0000000..c500665 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityCreeper.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityCrit2FX.class b/build/classes/java/main/net/minecraft/src/EntityCrit2FX.class new file mode 100644 index 0000000..793b9bd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityCrit2FX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityCritFX.class b/build/classes/java/main/net/minecraft/src/EntityCritFX.class new file mode 100644 index 0000000..0bd2914 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityCritFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityDamageSource.class b/build/classes/java/main/net/minecraft/src/EntityDamageSource.class new file mode 100644 index 0000000..eb525b8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityDamageSource.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityDamageSourceIndirect.class b/build/classes/java/main/net/minecraft/src/EntityDamageSourceIndirect.class new file mode 100644 index 0000000..0d51fa2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityDamageSourceIndirect.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityDiggingFX.class b/build/classes/java/main/net/minecraft/src/EntityDiggingFX.class new file mode 100644 index 0000000..18a8bf1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityDiggingFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityDragon.class b/build/classes/java/main/net/minecraft/src/EntityDragon.class new file mode 100644 index 0000000..55bf360 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityDragon.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityDragonPart.class b/build/classes/java/main/net/minecraft/src/EntityDragonPart.class new file mode 100644 index 0000000..648b461 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityDragonPart.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityDropParticleFX.class b/build/classes/java/main/net/minecraft/src/EntityDropParticleFX.class new file mode 100644 index 0000000..36457b1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityDropParticleFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityEgg.class b/build/classes/java/main/net/minecraft/src/EntityEgg.class new file mode 100644 index 0000000..7abbbdd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityEgg.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityEggInfo.class b/build/classes/java/main/net/minecraft/src/EntityEggInfo.class new file mode 100644 index 0000000..5e1b1e1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityEggInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityEnchantmentTableParticleFX.class b/build/classes/java/main/net/minecraft/src/EntityEnchantmentTableParticleFX.class new file mode 100644 index 0000000..33a194a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityEnchantmentTableParticleFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityEnderCrystal.class b/build/classes/java/main/net/minecraft/src/EntityEnderCrystal.class new file mode 100644 index 0000000..9926979 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityEnderCrystal.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityEnderEye.class b/build/classes/java/main/net/minecraft/src/EntityEnderEye.class new file mode 100644 index 0000000..9baf58d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityEnderEye.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityEnderPearl.class b/build/classes/java/main/net/minecraft/src/EntityEnderPearl.class new file mode 100644 index 0000000..c122aa4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityEnderPearl.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityEnderman.class b/build/classes/java/main/net/minecraft/src/EntityEnderman.class new file mode 100644 index 0000000..81d99aa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityEnderman.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityExpBottle.class b/build/classes/java/main/net/minecraft/src/EntityExpBottle.class new file mode 100644 index 0000000..91f807c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityExpBottle.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityExplodeFX.class b/build/classes/java/main/net/minecraft/src/EntityExplodeFX.class new file mode 100644 index 0000000..55ea846 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityExplodeFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityFX.class b/build/classes/java/main/net/minecraft/src/EntityFX.class new file mode 100644 index 0000000..0ebbf68 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityFallingSand.class b/build/classes/java/main/net/minecraft/src/EntityFallingSand.class new file mode 100644 index 0000000..afe425b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityFallingSand.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityFireball.class b/build/classes/java/main/net/minecraft/src/EntityFireball.class new file mode 100644 index 0000000..3ad0d4a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityFireball.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityFireworkOverlayFX.class b/build/classes/java/main/net/minecraft/src/EntityFireworkOverlayFX.class new file mode 100644 index 0000000..56e35da Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityFireworkOverlayFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityFireworkRocket.class b/build/classes/java/main/net/minecraft/src/EntityFireworkRocket.class new file mode 100644 index 0000000..908f99b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityFireworkRocket.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityFireworkSparkFX.class b/build/classes/java/main/net/minecraft/src/EntityFireworkSparkFX.class new file mode 100644 index 0000000..ec6fc51 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityFireworkSparkFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityFireworkStarterFX.class b/build/classes/java/main/net/minecraft/src/EntityFireworkStarterFX.class new file mode 100644 index 0000000..25af673 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityFireworkStarterFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityFishHook.class b/build/classes/java/main/net/minecraft/src/EntityFishHook.class new file mode 100644 index 0000000..0cd576a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityFishHook.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityFlameFX.class b/build/classes/java/main/net/minecraft/src/EntityFlameFX.class new file mode 100644 index 0000000..6ca21f6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityFlameFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityFlying.class b/build/classes/java/main/net/minecraft/src/EntityFlying.class new file mode 100644 index 0000000..964029c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityFlying.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityFootStepFX.class b/build/classes/java/main/net/minecraft/src/EntityFootStepFX.class new file mode 100644 index 0000000..25b1013 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityFootStepFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityGhast.class b/build/classes/java/main/net/minecraft/src/EntityGhast.class new file mode 100644 index 0000000..a3f3a4b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityGhast.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityGiantZombie.class b/build/classes/java/main/net/minecraft/src/EntityGiantZombie.class new file mode 100644 index 0000000..12410bd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityGiantZombie.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityGolem.class b/build/classes/java/main/net/minecraft/src/EntityGolem.class new file mode 100644 index 0000000..26d3a00 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityGolem.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityHanging.class b/build/classes/java/main/net/minecraft/src/EntityHanging.class new file mode 100644 index 0000000..23b6f84 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityHanging.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityHeartFX.class b/build/classes/java/main/net/minecraft/src/EntityHeartFX.class new file mode 100644 index 0000000..4890790 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityHeartFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityHorse.class b/build/classes/java/main/net/minecraft/src/EntityHorse.class new file mode 100644 index 0000000..f76eafc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityHorse.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityHorseBredSelector.class b/build/classes/java/main/net/minecraft/src/EntityHorseBredSelector.class new file mode 100644 index 0000000..277d28e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityHorseBredSelector.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityHorseGroupData.class b/build/classes/java/main/net/minecraft/src/EntityHorseGroupData.class new file mode 100644 index 0000000..b271dbd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityHorseGroupData.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityHugeExplodeFX.class b/build/classes/java/main/net/minecraft/src/EntityHugeExplodeFX.class new file mode 100644 index 0000000..99ccbcc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityHugeExplodeFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityIronGolem.class b/build/classes/java/main/net/minecraft/src/EntityIronGolem.class new file mode 100644 index 0000000..480deea Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityIronGolem.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityItem.class b/build/classes/java/main/net/minecraft/src/EntityItem.class new file mode 100644 index 0000000..37225ea Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityItem.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityItemFrame.class b/build/classes/java/main/net/minecraft/src/EntityItemFrame.class new file mode 100644 index 0000000..8981d5d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityItemFrame.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityJumpHelper.class b/build/classes/java/main/net/minecraft/src/EntityJumpHelper.class new file mode 100644 index 0000000..610f091 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityJumpHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityLargeExplodeFX.class b/build/classes/java/main/net/minecraft/src/EntityLargeExplodeFX.class new file mode 100644 index 0000000..9ab66c6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityLargeExplodeFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityLargeFireball.class b/build/classes/java/main/net/minecraft/src/EntityLargeFireball.class new file mode 100644 index 0000000..4e64f9c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityLargeFireball.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityLavaFX.class b/build/classes/java/main/net/minecraft/src/EntityLavaFX.class new file mode 100644 index 0000000..fb335ab Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityLavaFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityLeashKnot.class b/build/classes/java/main/net/minecraft/src/EntityLeashKnot.class new file mode 100644 index 0000000..8eca2bf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityLeashKnot.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityLightningBolt.class b/build/classes/java/main/net/minecraft/src/EntityLightningBolt.class new file mode 100644 index 0000000..1cc97a7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityLightningBolt.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityList.class b/build/classes/java/main/net/minecraft/src/EntityList.class new file mode 100644 index 0000000..1a66012 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityList.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityLiving.class b/build/classes/java/main/net/minecraft/src/EntityLiving.class new file mode 100644 index 0000000..1e13887 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityLiving.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityLivingBase.class b/build/classes/java/main/net/minecraft/src/EntityLivingBase.class new file mode 100644 index 0000000..67a4edb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityLivingBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityLivingData.class b/build/classes/java/main/net/minecraft/src/EntityLivingData.class new file mode 100644 index 0000000..c8e2c2c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityLivingData.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityLookHelper.class b/build/classes/java/main/net/minecraft/src/EntityLookHelper.class new file mode 100644 index 0000000..f4fdd1a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityLookHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMagmaCube.class b/build/classes/java/main/net/minecraft/src/EntityMagmaCube.class new file mode 100644 index 0000000..43d195a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMagmaCube.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMinecart.class b/build/classes/java/main/net/minecraft/src/EntityMinecart.class new file mode 100644 index 0000000..bba3968 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMinecart.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMinecartChest.class b/build/classes/java/main/net/minecraft/src/EntityMinecartChest.class new file mode 100644 index 0000000..e0d0dec Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMinecartChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMinecartContainer.class b/build/classes/java/main/net/minecraft/src/EntityMinecartContainer.class new file mode 100644 index 0000000..f8aa6ed Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMinecartContainer.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMinecartEmpty.class b/build/classes/java/main/net/minecraft/src/EntityMinecartEmpty.class new file mode 100644 index 0000000..40bd921 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMinecartEmpty.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMinecartFurnace.class b/build/classes/java/main/net/minecraft/src/EntityMinecartFurnace.class new file mode 100644 index 0000000..fb48a50 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMinecartFurnace.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMinecartHopper.class b/build/classes/java/main/net/minecraft/src/EntityMinecartHopper.class new file mode 100644 index 0000000..7d649de Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMinecartHopper.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMinecartMobSpawner.class b/build/classes/java/main/net/minecraft/src/EntityMinecartMobSpawner.class new file mode 100644 index 0000000..b4508c7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMinecartMobSpawner.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMinecartMobSpawnerLogic.class b/build/classes/java/main/net/minecraft/src/EntityMinecartMobSpawnerLogic.class new file mode 100644 index 0000000..e080386 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMinecartMobSpawnerLogic.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMinecartTNT.class b/build/classes/java/main/net/minecraft/src/EntityMinecartTNT.class new file mode 100644 index 0000000..320d2c8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMinecartTNT.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMob.class b/build/classes/java/main/net/minecraft/src/EntityMob.class new file mode 100644 index 0000000..f8958f4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMob.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMooshroom.class b/build/classes/java/main/net/minecraft/src/EntityMooshroom.class new file mode 100644 index 0000000..17e9c45 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMooshroom.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityMoveHelper.class b/build/classes/java/main/net/minecraft/src/EntityMoveHelper.class new file mode 100644 index 0000000..ff22b5a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityMoveHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityNoteFX.class b/build/classes/java/main/net/minecraft/src/EntityNoteFX.class new file mode 100644 index 0000000..7b0852f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityNoteFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityOcelot.class b/build/classes/java/main/net/minecraft/src/EntityOcelot.class new file mode 100644 index 0000000..3125274 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityOcelot.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityOtherPlayerMP.class b/build/classes/java/main/net/minecraft/src/EntityOtherPlayerMP.class new file mode 100644 index 0000000..3362de4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityOtherPlayerMP.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityOwnable.class b/build/classes/java/main/net/minecraft/src/EntityOwnable.class new file mode 100644 index 0000000..d317aa1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityOwnable.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityPainting.class b/build/classes/java/main/net/minecraft/src/EntityPainting.class new file mode 100644 index 0000000..22c4353 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityPainting.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityPickupFX.class b/build/classes/java/main/net/minecraft/src/EntityPickupFX.class new file mode 100644 index 0000000..1ebe750 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityPickupFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityPig.class b/build/classes/java/main/net/minecraft/src/EntityPig.class new file mode 100644 index 0000000..91c201f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityPig.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityPigZombie.class b/build/classes/java/main/net/minecraft/src/EntityPigZombie.class new file mode 100644 index 0000000..69d164e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityPigZombie.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityPlayer.class b/build/classes/java/main/net/minecraft/src/EntityPlayer.class new file mode 100644 index 0000000..fb2e2fc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityPlayer.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityPlayerMP.class b/build/classes/java/main/net/minecraft/src/EntityPlayerMP.class new file mode 100644 index 0000000..d5acd4b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityPlayerMP.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityPlayerSP.class b/build/classes/java/main/net/minecraft/src/EntityPlayerSP.class new file mode 100644 index 0000000..637f09b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityPlayerSP.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityPortalFX.class b/build/classes/java/main/net/minecraft/src/EntityPortalFX.class new file mode 100644 index 0000000..02687cd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityPortalFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityPotion.class b/build/classes/java/main/net/minecraft/src/EntityPotion.class new file mode 100644 index 0000000..79c5e50 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityPotion.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityRainFX.class b/build/classes/java/main/net/minecraft/src/EntityRainFX.class new file mode 100644 index 0000000..cfe318a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityRainFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityReddustFX.class b/build/classes/java/main/net/minecraft/src/EntityReddustFX.class new file mode 100644 index 0000000..ebebfd4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityReddustFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityRenderer.class b/build/classes/java/main/net/minecraft/src/EntityRenderer.class new file mode 100644 index 0000000..63fc23f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySelectorAlive.class b/build/classes/java/main/net/minecraft/src/EntitySelectorAlive.class new file mode 100644 index 0000000..7a4ae99 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySelectorAlive.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySelectorArmoredMob.class b/build/classes/java/main/net/minecraft/src/EntitySelectorArmoredMob.class new file mode 100644 index 0000000..7bb6ba8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySelectorArmoredMob.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySelectorInventory.class b/build/classes/java/main/net/minecraft/src/EntitySelectorInventory.class new file mode 100644 index 0000000..985062e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySelectorInventory.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySenses.class b/build/classes/java/main/net/minecraft/src/EntitySenses.class new file mode 100644 index 0000000..70dfb22 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySenses.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySheep.class b/build/classes/java/main/net/minecraft/src/EntitySheep.class new file mode 100644 index 0000000..8157a55 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySheep.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySilverfish.class b/build/classes/java/main/net/minecraft/src/EntitySilverfish.class new file mode 100644 index 0000000..9940af5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySilverfish.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySkeleton.class b/build/classes/java/main/net/minecraft/src/EntitySkeleton.class new file mode 100644 index 0000000..c7414fa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySkeleton.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySlime.class b/build/classes/java/main/net/minecraft/src/EntitySlime.class new file mode 100644 index 0000000..2cf51b5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySlime.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySmallFireball.class b/build/classes/java/main/net/minecraft/src/EntitySmallFireball.class new file mode 100644 index 0000000..d4d576d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySmallFireball.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySmokeFX.class b/build/classes/java/main/net/minecraft/src/EntitySmokeFX.class new file mode 100644 index 0000000..7d70a02 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySmokeFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySnowShovelFX.class b/build/classes/java/main/net/minecraft/src/EntitySnowShovelFX.class new file mode 100644 index 0000000..077bb45 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySnowShovelFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySnowball.class b/build/classes/java/main/net/minecraft/src/EntitySnowball.class new file mode 100644 index 0000000..5b87e62 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySnowball.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySnowman.class b/build/classes/java/main/net/minecraft/src/EntitySnowman.class new file mode 100644 index 0000000..f4ccb30 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySnowman.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySorter.class b/build/classes/java/main/net/minecraft/src/EntitySorter.class new file mode 100644 index 0000000..8d663be Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySorter.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySpellParticleFX.class b/build/classes/java/main/net/minecraft/src/EntitySpellParticleFX.class new file mode 100644 index 0000000..3d73b29 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySpellParticleFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySpider.class b/build/classes/java/main/net/minecraft/src/EntitySpider.class new file mode 100644 index 0000000..e1ad61c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySpider.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySplashFX.class b/build/classes/java/main/net/minecraft/src/EntitySplashFX.class new file mode 100644 index 0000000..5529163 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySplashFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySquid.class b/build/classes/java/main/net/minecraft/src/EntitySquid.class new file mode 100644 index 0000000..91df6b2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySquid.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntitySuspendFX.class b/build/classes/java/main/net/minecraft/src/EntitySuspendFX.class new file mode 100644 index 0000000..9741317 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntitySuspendFX.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityTNTPrimed.class b/build/classes/java/main/net/minecraft/src/EntityTNTPrimed.class new file mode 100644 index 0000000..488cd24 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityTNTPrimed.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityTameable.class b/build/classes/java/main/net/minecraft/src/EntityTameable.class new file mode 100644 index 0000000..0d5eb70 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityTameable.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityThrowable.class b/build/classes/java/main/net/minecraft/src/EntityThrowable.class new file mode 100644 index 0000000..5ae57fd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityThrowable.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityTracker.class b/build/classes/java/main/net/minecraft/src/EntityTracker.class new file mode 100644 index 0000000..63095b9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityTracker.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityTrackerEntry.class b/build/classes/java/main/net/minecraft/src/EntityTrackerEntry.class new file mode 100644 index 0000000..06ea6ac Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityTrackerEntry.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityVillager.class b/build/classes/java/main/net/minecraft/src/EntityVillager.class new file mode 100644 index 0000000..0a4aef4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityVillager.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityWaterMob.class b/build/classes/java/main/net/minecraft/src/EntityWaterMob.class new file mode 100644 index 0000000..9390c1a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityWaterMob.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityWeatherEffect.class b/build/classes/java/main/net/minecraft/src/EntityWeatherEffect.class new file mode 100644 index 0000000..72a8e59 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityWeatherEffect.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityWitch.class b/build/classes/java/main/net/minecraft/src/EntityWitch.class new file mode 100644 index 0000000..ee31bb1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityWitch.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityWither.class b/build/classes/java/main/net/minecraft/src/EntityWither.class new file mode 100644 index 0000000..196c6a6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityWither.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityWitherAttackFilter.class b/build/classes/java/main/net/minecraft/src/EntityWitherAttackFilter.class new file mode 100644 index 0000000..623e109 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityWitherAttackFilter.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityWitherSkull.class b/build/classes/java/main/net/minecraft/src/EntityWitherSkull.class new file mode 100644 index 0000000..6ee5248 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityWitherSkull.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityWolf.class b/build/classes/java/main/net/minecraft/src/EntityWolf.class new file mode 100644 index 0000000..4bde093 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityWolf.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityXPOrb.class b/build/classes/java/main/net/minecraft/src/EntityXPOrb.class new file mode 100644 index 0000000..1dd2778 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityXPOrb.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityZombie.class b/build/classes/java/main/net/minecraft/src/EntityZombie.class new file mode 100644 index 0000000..43016a5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityZombie.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityZombieGroupData.class b/build/classes/java/main/net/minecraft/src/EntityZombieGroupData.class new file mode 100644 index 0000000..b916fb4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityZombieGroupData.class differ diff --git a/build/classes/java/main/net/minecraft/src/EntityZombieINNER1.class b/build/classes/java/main/net/minecraft/src/EntityZombieINNER1.class new file mode 100644 index 0000000..b3cdd68 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EntityZombieINNER1.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumAction.class b/build/classes/java/main/net/minecraft/src/EnumAction.class new file mode 100644 index 0000000..b9064ba Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumAction.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumArmorMaterial.class b/build/classes/java/main/net/minecraft/src/EnumArmorMaterial.class new file mode 100644 index 0000000..081f2bd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumArmorMaterial.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumArt.class b/build/classes/java/main/net/minecraft/src/EnumArt.class new file mode 100644 index 0000000..a6f60e9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumArt.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumChatFormatting.class b/build/classes/java/main/net/minecraft/src/EnumChatFormatting.class new file mode 100644 index 0000000..5c8848b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumChatFormatting.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumCreatureAttribute.class b/build/classes/java/main/net/minecraft/src/EnumCreatureAttribute.class new file mode 100644 index 0000000..7b63780 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumCreatureAttribute.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumCreatureType.class b/build/classes/java/main/net/minecraft/src/EnumCreatureType.class new file mode 100644 index 0000000..167df8a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumCreatureType.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumDoor.class b/build/classes/java/main/net/minecraft/src/EnumDoor.class new file mode 100644 index 0000000..fe64398 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumDoor.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumDoorHelper.class b/build/classes/java/main/net/minecraft/src/EnumDoorHelper.class new file mode 100644 index 0000000..3cb503a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumDoorHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumEnchantmentType.class b/build/classes/java/main/net/minecraft/src/EnumEnchantmentType.class new file mode 100644 index 0000000..650aa3f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumEnchantmentType.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumEntitySize.class b/build/classes/java/main/net/minecraft/src/EnumEntitySize.class new file mode 100644 index 0000000..1ca43c4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumEntitySize.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumEntitySizeHelper.class b/build/classes/java/main/net/minecraft/src/EnumEntitySizeHelper.class new file mode 100644 index 0000000..354215e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumEntitySizeHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumFacing.class b/build/classes/java/main/net/minecraft/src/EnumFacing.class new file mode 100644 index 0000000..8a2df9b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumFacing.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumGameType.class b/build/classes/java/main/net/minecraft/src/EnumGameType.class new file mode 100644 index 0000000..f3e06e1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumGameType.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumMobType.class b/build/classes/java/main/net/minecraft/src/EnumMobType.class new file mode 100644 index 0000000..93c6e0d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumMobType.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumMovingObjectType.class b/build/classes/java/main/net/minecraft/src/EnumMovingObjectType.class new file mode 100644 index 0000000..48c3c4f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumMovingObjectType.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumOS.class b/build/classes/java/main/net/minecraft/src/EnumOS.class new file mode 100644 index 0000000..6e71958 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumOS.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumOptions.class b/build/classes/java/main/net/minecraft/src/EnumOptions.class new file mode 100644 index 0000000..c9f2c7c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumOptions.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumOptionsHelper.class b/build/classes/java/main/net/minecraft/src/EnumOptionsHelper.class new file mode 100644 index 0000000..f81ec9a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumOptionsHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumRarity.class b/build/classes/java/main/net/minecraft/src/EnumRarity.class new file mode 100644 index 0000000..f42c507 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumRarity.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumSkyBlock.class b/build/classes/java/main/net/minecraft/src/EnumSkyBlock.class new file mode 100644 index 0000000..6e3df9e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumSkyBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumStatus.class b/build/classes/java/main/net/minecraft/src/EnumStatus.class new file mode 100644 index 0000000..6b0c0f8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumStatus.class differ diff --git a/build/classes/java/main/net/minecraft/src/EnumToolMaterial.class b/build/classes/java/main/net/minecraft/src/EnumToolMaterial.class new file mode 100644 index 0000000..2939c97 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/EnumToolMaterial.class differ diff --git a/build/classes/java/main/net/minecraft/src/ExceptionMcoHttp.class b/build/classes/java/main/net/minecraft/src/ExceptionMcoHttp.class new file mode 100644 index 0000000..2c607e7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ExceptionMcoHttp.class differ diff --git a/build/classes/java/main/net/minecraft/src/ExceptionMcoService.class b/build/classes/java/main/net/minecraft/src/ExceptionMcoService.class new file mode 100644 index 0000000..8b145d4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ExceptionMcoService.class differ diff --git a/build/classes/java/main/net/minecraft/src/ExceptionRetryCall.class b/build/classes/java/main/net/minecraft/src/ExceptionRetryCall.class new file mode 100644 index 0000000..bbe5573 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ExceptionRetryCall.class differ diff --git a/build/classes/java/main/net/minecraft/src/Explosion.class b/build/classes/java/main/net/minecraft/src/Explosion.class new file mode 100644 index 0000000..08a32aa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Explosion.class differ diff --git a/build/classes/java/main/net/minecraft/src/ExtendedBlockStorage.class b/build/classes/java/main/net/minecraft/src/ExtendedBlockStorage.class new file mode 100644 index 0000000..f441c7d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ExtendedBlockStorage.class differ diff --git a/build/classes/java/main/net/minecraft/src/Facing.class b/build/classes/java/main/net/minecraft/src/Facing.class new file mode 100644 index 0000000..39a83ec Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Facing.class differ diff --git a/build/classes/java/main/net/minecraft/src/FallbackResourceManager.class b/build/classes/java/main/net/minecraft/src/FallbackResourceManager.class new file mode 100644 index 0000000..4dd92c5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FallbackResourceManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/FileResourcePack.class b/build/classes/java/main/net/minecraft/src/FileResourcePack.class new file mode 100644 index 0000000..a6113b6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FileResourcePack.class differ diff --git a/build/classes/java/main/net/minecraft/src/FilterIMob.class b/build/classes/java/main/net/minecraft/src/FilterIMob.class new file mode 100644 index 0000000..602bec2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FilterIMob.class differ diff --git a/build/classes/java/main/net/minecraft/src/FlatGeneratorInfo.class b/build/classes/java/main/net/minecraft/src/FlatGeneratorInfo.class new file mode 100644 index 0000000..7d47f1c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FlatGeneratorInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/FlatLayerInfo.class b/build/classes/java/main/net/minecraft/src/FlatLayerInfo.class new file mode 100644 index 0000000..b1a5286 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FlatLayerInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/FolderResourcePack.class b/build/classes/java/main/net/minecraft/src/FolderResourcePack.class new file mode 100644 index 0000000..2de61f8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FolderResourcePack.class differ diff --git a/build/classes/java/main/net/minecraft/src/FoliageColorReloadListener.class b/build/classes/java/main/net/minecraft/src/FoliageColorReloadListener.class new file mode 100644 index 0000000..3adeb7e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FoliageColorReloadListener.class differ diff --git a/build/classes/java/main/net/minecraft/src/FontMetadataSection.class b/build/classes/java/main/net/minecraft/src/FontMetadataSection.class new file mode 100644 index 0000000..e65686e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FontMetadataSection.class differ diff --git a/build/classes/java/main/net/minecraft/src/FontMetadataSectionSerializer.class b/build/classes/java/main/net/minecraft/src/FontMetadataSectionSerializer.class new file mode 100644 index 0000000..913c913 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FontMetadataSectionSerializer.class differ diff --git a/build/classes/java/main/net/minecraft/src/FontRenderer.class b/build/classes/java/main/net/minecraft/src/FontRenderer.class new file mode 100644 index 0000000..b81ac08 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FontRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/FoodStats.class b/build/classes/java/main/net/minecraft/src/FoodStats.class new file mode 100644 index 0000000..45cd581 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FoodStats.class differ diff --git a/build/classes/java/main/net/minecraft/src/Frustrum.class b/build/classes/java/main/net/minecraft/src/Frustrum.class new file mode 100644 index 0000000..a5f8e22 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Frustrum.class differ diff --git a/build/classes/java/main/net/minecraft/src/FurnaceRecipes.class b/build/classes/java/main/net/minecraft/src/FurnaceRecipes.class new file mode 100644 index 0000000..4f12594 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/FurnaceRecipes.class differ diff --git a/build/classes/java/main/net/minecraft/src/GLAllocation.class b/build/classes/java/main/net/minecraft/src/GLAllocation.class new file mode 100644 index 0000000..1bcc57e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GLAllocation.class differ diff --git a/build/classes/java/main/net/minecraft/src/GameRuleValue.class b/build/classes/java/main/net/minecraft/src/GameRuleValue.class new file mode 100644 index 0000000..c0e3cdb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GameRuleValue.class differ diff --git a/build/classes/java/main/net/minecraft/src/GameRules.class b/build/classes/java/main/net/minecraft/src/GameRules.class new file mode 100644 index 0000000..8fb5046 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GameRules.class differ diff --git a/build/classes/java/main/net/minecraft/src/GameSettings.class b/build/classes/java/main/net/minecraft/src/GameSettings.class new file mode 100644 index 0000000..842ed73 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GameSettings.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayer.class b/build/classes/java/main/net/minecraft/src/GenLayer.class new file mode 100644 index 0000000..8dc9056 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayer.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerAddIsland.class b/build/classes/java/main/net/minecraft/src/GenLayerAddIsland.class new file mode 100644 index 0000000..3983caa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerAddIsland.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerAddMushroomIsland.class b/build/classes/java/main/net/minecraft/src/GenLayerAddMushroomIsland.class new file mode 100644 index 0000000..e5ba403 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerAddMushroomIsland.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerAddSnow.class b/build/classes/java/main/net/minecraft/src/GenLayerAddSnow.class new file mode 100644 index 0000000..fccd46c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerAddSnow.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerBiome.class b/build/classes/java/main/net/minecraft/src/GenLayerBiome.class new file mode 100644 index 0000000..43305fb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerBiome.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerFuzzyZoom.class b/build/classes/java/main/net/minecraft/src/GenLayerFuzzyZoom.class new file mode 100644 index 0000000..ed55851 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerFuzzyZoom.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerHills.class b/build/classes/java/main/net/minecraft/src/GenLayerHills.class new file mode 100644 index 0000000..7ba7a6c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerHills.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerIsland.class b/build/classes/java/main/net/minecraft/src/GenLayerIsland.class new file mode 100644 index 0000000..2e5bac2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerIsland.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerRiver.class b/build/classes/java/main/net/minecraft/src/GenLayerRiver.class new file mode 100644 index 0000000..2393562 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerRiver.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerRiverInit.class b/build/classes/java/main/net/minecraft/src/GenLayerRiverInit.class new file mode 100644 index 0000000..4d32d28 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerRiverInit.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerRiverMix.class b/build/classes/java/main/net/minecraft/src/GenLayerRiverMix.class new file mode 100644 index 0000000..3dd5ce7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerRiverMix.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerShore.class b/build/classes/java/main/net/minecraft/src/GenLayerShore.class new file mode 100644 index 0000000..d9955b3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerShore.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerSmooth.class b/build/classes/java/main/net/minecraft/src/GenLayerSmooth.class new file mode 100644 index 0000000..11e8a3a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerSmooth.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerSwampRivers.class b/build/classes/java/main/net/minecraft/src/GenLayerSwampRivers.class new file mode 100644 index 0000000..29378d0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerSwampRivers.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerVoronoiZoom.class b/build/classes/java/main/net/minecraft/src/GenLayerVoronoiZoom.class new file mode 100644 index 0000000..fe71114 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerVoronoiZoom.class differ diff --git a/build/classes/java/main/net/minecraft/src/GenLayerZoom.class b/build/classes/java/main/net/minecraft/src/GenLayerZoom.class new file mode 100644 index 0000000..29ba2b2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GenLayerZoom.class differ diff --git a/build/classes/java/main/net/minecraft/src/GrassColorReloadListener.class b/build/classes/java/main/net/minecraft/src/GrassColorReloadListener.class new file mode 100644 index 0000000..c05e696 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GrassColorReloadListener.class differ diff --git a/build/classes/java/main/net/minecraft/src/Gui.class b/build/classes/java/main/net/minecraft/src/Gui.class new file mode 100644 index 0000000..3f44988 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Gui.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiAchievement.class b/build/classes/java/main/net/minecraft/src/GuiAchievement.class new file mode 100644 index 0000000..0eed976 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiAchievement.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiAchievements.class b/build/classes/java/main/net/minecraft/src/GuiAchievements.class new file mode 100644 index 0000000..1a7b4be Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiAchievements.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiBeacon.class b/build/classes/java/main/net/minecraft/src/GuiBeacon.class new file mode 100644 index 0000000..a8c4788 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiBeacon.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiBeaconButton.class b/build/classes/java/main/net/minecraft/src/GuiBeaconButton.class new file mode 100644 index 0000000..a7f202a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiBeaconButton.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiBeaconButtonCancel.class b/build/classes/java/main/net/minecraft/src/GuiBeaconButtonCancel.class new file mode 100644 index 0000000..1b1e8ad Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiBeaconButtonCancel.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiBeaconButtonConfirm.class b/build/classes/java/main/net/minecraft/src/GuiBeaconButtonConfirm.class new file mode 100644 index 0000000..d42ba74 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiBeaconButtonConfirm.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiBeaconButtonPower.class b/build/classes/java/main/net/minecraft/src/GuiBeaconButtonPower.class new file mode 100644 index 0000000..c49c4af Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiBeaconButtonPower.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiBrewingStand.class b/build/classes/java/main/net/minecraft/src/GuiBrewingStand.class new file mode 100644 index 0000000..0d9c90b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiBrewingStand.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiButton.class b/build/classes/java/main/net/minecraft/src/GuiButton.class new file mode 100644 index 0000000..83bfb7f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiButton.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiButtonLanguage.class b/build/classes/java/main/net/minecraft/src/GuiButtonLanguage.class new file mode 100644 index 0000000..de877d6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiButtonLanguage.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiButtonLink.class b/build/classes/java/main/net/minecraft/src/GuiButtonLink.class new file mode 100644 index 0000000..767d7f9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiButtonLink.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiButtonMerchant.class b/build/classes/java/main/net/minecraft/src/GuiButtonMerchant.class new file mode 100644 index 0000000..16c15bc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiButtonMerchant.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiButtonNextPage.class b/build/classes/java/main/net/minecraft/src/GuiButtonNextPage.class new file mode 100644 index 0000000..60af923 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiButtonNextPage.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiChat.class b/build/classes/java/main/net/minecraft/src/GuiChat.class new file mode 100644 index 0000000..1bad810 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiChat.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiChest.class b/build/classes/java/main/net/minecraft/src/GuiChest.class new file mode 100644 index 0000000..f84144d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiCommandBlock.class b/build/classes/java/main/net/minecraft/src/GuiCommandBlock.class new file mode 100644 index 0000000..9d5c88b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiCommandBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiConfirmOpenLink.class b/build/classes/java/main/net/minecraft/src/GuiConfirmOpenLink.class new file mode 100644 index 0000000..bd3ae10 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiConfirmOpenLink.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiConnecting.class b/build/classes/java/main/net/minecraft/src/GuiConnecting.class new file mode 100644 index 0000000..205acc7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiConnecting.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiContainer.class b/build/classes/java/main/net/minecraft/src/GuiContainer.class new file mode 100644 index 0000000..a97c2fa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiContainer.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiContainerCreative.class b/build/classes/java/main/net/minecraft/src/GuiContainerCreative.class new file mode 100644 index 0000000..9c46656 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiContainerCreative.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiControls.class b/build/classes/java/main/net/minecraft/src/GuiControls.class new file mode 100644 index 0000000..25ea0aa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiControls.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiCrafting.class b/build/classes/java/main/net/minecraft/src/GuiCrafting.class new file mode 100644 index 0000000..1bf8c0e4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiCrafting.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiCreateFlatWorld.class b/build/classes/java/main/net/minecraft/src/GuiCreateFlatWorld.class new file mode 100644 index 0000000..4790901 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiCreateFlatWorld.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiCreateFlatWorldListSlot.class b/build/classes/java/main/net/minecraft/src/GuiCreateFlatWorldListSlot.class new file mode 100644 index 0000000..de9ebd0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiCreateFlatWorldListSlot.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiCreateWorld.class b/build/classes/java/main/net/minecraft/src/GuiCreateWorld.class new file mode 100644 index 0000000..5494ce9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiCreateWorld.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiDisconnected.class b/build/classes/java/main/net/minecraft/src/GuiDisconnected.class new file mode 100644 index 0000000..4b6d792 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiDisconnected.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiDispenser.class b/build/classes/java/main/net/minecraft/src/GuiDispenser.class new file mode 100644 index 0000000..27b4017 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiDispenser.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiDownloadTerrain.class b/build/classes/java/main/net/minecraft/src/GuiDownloadTerrain.class new file mode 100644 index 0000000..ee49dcd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiDownloadTerrain.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiEditSign.class b/build/classes/java/main/net/minecraft/src/GuiEditSign.class new file mode 100644 index 0000000..a0185b1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiEditSign.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiEnchantment.class b/build/classes/java/main/net/minecraft/src/GuiEnchantment.class new file mode 100644 index 0000000..f15e4df Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiEnchantment.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiErrorScreen.class b/build/classes/java/main/net/minecraft/src/GuiErrorScreen.class new file mode 100644 index 0000000..400b957 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiErrorScreen.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiFlatPresets.class b/build/classes/java/main/net/minecraft/src/GuiFlatPresets.class new file mode 100644 index 0000000..eb84016 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiFlatPresets.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiFlatPresetsItem.class b/build/classes/java/main/net/minecraft/src/GuiFlatPresetsItem.class new file mode 100644 index 0000000..9947955 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiFlatPresetsItem.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiFlatPresetsListSlot.class b/build/classes/java/main/net/minecraft/src/GuiFlatPresetsListSlot.class new file mode 100644 index 0000000..cc336c3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiFlatPresetsListSlot.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiFurnace.class b/build/classes/java/main/net/minecraft/src/GuiFurnace.class new file mode 100644 index 0000000..0e50b7d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiFurnace.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiGameOver.class b/build/classes/java/main/net/minecraft/src/GuiGameOver.class new file mode 100644 index 0000000..a896634 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiGameOver.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiHopper.class b/build/classes/java/main/net/minecraft/src/GuiHopper.class new file mode 100644 index 0000000..a6743cb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiHopper.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiIngame.class b/build/classes/java/main/net/minecraft/src/GuiIngame.class new file mode 100644 index 0000000..1bc2e10 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiIngame.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiIngameMenu.class b/build/classes/java/main/net/minecraft/src/GuiIngameMenu.class new file mode 100644 index 0000000..ffdd692 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiIngameMenu.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiInventory.class b/build/classes/java/main/net/minecraft/src/GuiInventory.class new file mode 100644 index 0000000..56dc80d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiInventory.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiLanguage.class b/build/classes/java/main/net/minecraft/src/GuiLanguage.class new file mode 100644 index 0000000..cd9b1e1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiLanguage.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiMainMenu.class b/build/classes/java/main/net/minecraft/src/GuiMainMenu.class new file mode 100644 index 0000000..38d5b6c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiMainMenu.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiMemoryErrorScreen.class b/build/classes/java/main/net/minecraft/src/GuiMemoryErrorScreen.class new file mode 100644 index 0000000..535443d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiMemoryErrorScreen.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiMerchant.class b/build/classes/java/main/net/minecraft/src/GuiMerchant.class new file mode 100644 index 0000000..d9f9995 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiMerchant.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiMultiplayer.class b/build/classes/java/main/net/minecraft/src/GuiMultiplayer.class new file mode 100644 index 0000000..febb6de Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiMultiplayer.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiNewChat.class b/build/classes/java/main/net/minecraft/src/GuiNewChat.class new file mode 100644 index 0000000..427f04f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiNewChat.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiOptions.class b/build/classes/java/main/net/minecraft/src/GuiOptions.class new file mode 100644 index 0000000..fcfe016 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiOptions.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiPlayerInfo.class b/build/classes/java/main/net/minecraft/src/GuiPlayerInfo.class new file mode 100644 index 0000000..d719575 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiPlayerInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiRenameWorld.class b/build/classes/java/main/net/minecraft/src/GuiRenameWorld.class new file mode 100644 index 0000000..c00303d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiRenameWorld.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiRepair.class b/build/classes/java/main/net/minecraft/src/GuiRepair.class new file mode 100644 index 0000000..735d990 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiRepair.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreen.class b/build/classes/java/main/net/minecraft/src/GuiScreen.class new file mode 100644 index 0000000..f9c9405 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreen.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenAddServer.class b/build/classes/java/main/net/minecraft/src/GuiScreenAddServer.class new file mode 100644 index 0000000..dce3bc1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenAddServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenBackup.class b/build/classes/java/main/net/minecraft/src/GuiScreenBackup.class new file mode 100644 index 0000000..efa6018 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenBackup.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenBackupDownloadThread.class b/build/classes/java/main/net/minecraft/src/GuiScreenBackupDownloadThread.class new file mode 100644 index 0000000..4c62f93 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenBackupDownloadThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenBackupRestoreTask.class b/build/classes/java/main/net/minecraft/src/GuiScreenBackupRestoreTask.class new file mode 100644 index 0000000..89f9c55 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenBackupRestoreTask.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenBackupSelectionList.class b/build/classes/java/main/net/minecraft/src/GuiScreenBackupSelectionList.class new file mode 100644 index 0000000..1c8e4f3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenBackupSelectionList.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenBook.class b/build/classes/java/main/net/minecraft/src/GuiScreenBook.class new file mode 100644 index 0000000..3f0528f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenBook.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenClientOutdated.class b/build/classes/java/main/net/minecraft/src/GuiScreenClientOutdated.class new file mode 100644 index 0000000..27b2d7b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenClientOutdated.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenConfigureWorld.class b/build/classes/java/main/net/minecraft/src/GuiScreenConfigureWorld.class new file mode 100644 index 0000000..b9deb8f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenConfigureWorld.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenConfirmation.class b/build/classes/java/main/net/minecraft/src/GuiScreenConfirmation.class new file mode 100644 index 0000000..18668c6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenConfirmation.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenConfirmationType.class b/build/classes/java/main/net/minecraft/src/GuiScreenConfirmationType.class new file mode 100644 index 0000000..27904eb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenConfirmationType.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenCreateOnlineWorld.class b/build/classes/java/main/net/minecraft/src/GuiScreenCreateOnlineWorld.class new file mode 100644 index 0000000..bfec2ab Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenCreateOnlineWorld.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenDemo.class b/build/classes/java/main/net/minecraft/src/GuiScreenDemo.class new file mode 100644 index 0000000..795b305 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenDemo.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenDisconnectedOnline.class b/build/classes/java/main/net/minecraft/src/GuiScreenDisconnectedOnline.class new file mode 100644 index 0000000..6edbdce Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenDisconnectedOnline.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenEditOnlineWorld.class b/build/classes/java/main/net/minecraft/src/GuiScreenEditOnlineWorld.class new file mode 100644 index 0000000..16584fa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenEditOnlineWorld.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenHorseInventory.class b/build/classes/java/main/net/minecraft/src/GuiScreenHorseInventory.class new file mode 100644 index 0000000..7896bae Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenHorseInventory.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenInvite.class b/build/classes/java/main/net/minecraft/src/GuiScreenInvite.class new file mode 100644 index 0000000..a21e7b1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenInvite.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenLongRunningTask.class b/build/classes/java/main/net/minecraft/src/GuiScreenLongRunningTask.class new file mode 100644 index 0000000..85d5395 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenLongRunningTask.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenMcoWorldTemplate.class b/build/classes/java/main/net/minecraft/src/GuiScreenMcoWorldTemplate.class new file mode 100644 index 0000000..8c788d8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenMcoWorldTemplate.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenMcoWorldTemplateDownloadThread.class b/build/classes/java/main/net/minecraft/src/GuiScreenMcoWorldTemplateDownloadThread.class new file mode 100644 index 0000000..6b88b20 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenMcoWorldTemplateDownloadThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenMcoWorldTemplateSelectionList.class b/build/classes/java/main/net/minecraft/src/GuiScreenMcoWorldTemplateSelectionList.class new file mode 100644 index 0000000..9f389e4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenMcoWorldTemplateSelectionList.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenOnlineServers.class b/build/classes/java/main/net/minecraft/src/GuiScreenOnlineServers.class new file mode 100644 index 0000000..6d61b28 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenOnlineServers.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenOnlineServersSubscreen.class b/build/classes/java/main/net/minecraft/src/GuiScreenOnlineServersSubscreen.class new file mode 100644 index 0000000..172e949 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenOnlineServersSubscreen.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitation.class b/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitation.class new file mode 100644 index 0000000..4f2b312 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitation.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationINNER1.class b/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationINNER1.class new file mode 100644 index 0000000..83871c7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationINNER1.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationINNER2.class b/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationINNER2.class new file mode 100644 index 0000000..48117e5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationINNER2.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationINNER3.class b/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationINNER3.class new file mode 100644 index 0000000..25a4144 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationINNER3.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationList.class b/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationList.class new file mode 100644 index 0000000..47db8de Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenPendingInvitationList.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenResetWorld.class b/build/classes/java/main/net/minecraft/src/GuiScreenResetWorld.class new file mode 100644 index 0000000..f3cbb7e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenResetWorld.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenSelectLocation.class b/build/classes/java/main/net/minecraft/src/GuiScreenSelectLocation.class new file mode 100644 index 0000000..03c4d70 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenSelectLocation.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenServerList.class b/build/classes/java/main/net/minecraft/src/GuiScreenServerList.class new file mode 100644 index 0000000..dd40f14 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenServerList.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenSubscription.class b/build/classes/java/main/net/minecraft/src/GuiScreenSubscription.class new file mode 100644 index 0000000..e21e6fc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenSubscription.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenTemporaryResourcePackSelect.class b/build/classes/java/main/net/minecraft/src/GuiScreenTemporaryResourcePackSelect.class new file mode 100644 index 0000000..534dc62 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenTemporaryResourcePackSelect.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiScreenTemporaryResourcePackSelectSelectionList.class b/build/classes/java/main/net/minecraft/src/GuiScreenTemporaryResourcePackSelectSelectionList.class new file mode 100644 index 0000000..74cefcf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiScreenTemporaryResourcePackSelectSelectionList.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSelectWorld.class b/build/classes/java/main/net/minecraft/src/GuiSelectWorld.class new file mode 100644 index 0000000..b26926b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSelectWorld.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiShareToLan.class b/build/classes/java/main/net/minecraft/src/GuiShareToLan.class new file mode 100644 index 0000000..b5ddb9c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiShareToLan.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSleepMP.class b/build/classes/java/main/net/minecraft/src/GuiSleepMP.class new file mode 100644 index 0000000..8144d09 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSleepMP.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSlider.class b/build/classes/java/main/net/minecraft/src/GuiSlider.class new file mode 100644 index 0000000..d3f8dc3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSlider.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSlot.class b/build/classes/java/main/net/minecraft/src/GuiSlot.class new file mode 100644 index 0000000..ee87af0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSlot.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSlotLanguage.class b/build/classes/java/main/net/minecraft/src/GuiSlotLanguage.class new file mode 100644 index 0000000..494f737 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSlotLanguage.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSlotOnlineServerList.class b/build/classes/java/main/net/minecraft/src/GuiSlotOnlineServerList.class new file mode 100644 index 0000000..aea2d71 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSlotOnlineServerList.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSlotServer.class b/build/classes/java/main/net/minecraft/src/GuiSlotServer.class new file mode 100644 index 0000000..76d4694 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSlotServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSlotStats.class b/build/classes/java/main/net/minecraft/src/GuiSlotStats.class new file mode 100644 index 0000000..dcbedcd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSlotStats.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSlotStatsBlock.class b/build/classes/java/main/net/minecraft/src/GuiSlotStatsBlock.class new file mode 100644 index 0000000..438c1a3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSlotStatsBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSlotStatsGeneral.class b/build/classes/java/main/net/minecraft/src/GuiSlotStatsGeneral.class new file mode 100644 index 0000000..6d53a9b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSlotStatsGeneral.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSlotStatsItem.class b/build/classes/java/main/net/minecraft/src/GuiSlotStatsItem.class new file mode 100644 index 0000000..cdf7b49 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSlotStatsItem.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSmallButton.class b/build/classes/java/main/net/minecraft/src/GuiSmallButton.class new file mode 100644 index 0000000..b80cfe4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSmallButton.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSnooper.class b/build/classes/java/main/net/minecraft/src/GuiSnooper.class new file mode 100644 index 0000000..978164f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSnooper.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiSnooperList.class b/build/classes/java/main/net/minecraft/src/GuiSnooperList.class new file mode 100644 index 0000000..3084f9e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiSnooperList.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiStats.class b/build/classes/java/main/net/minecraft/src/GuiStats.class new file mode 100644 index 0000000..fafaf4d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiStats.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiTextField.class b/build/classes/java/main/net/minecraft/src/GuiTextField.class new file mode 100644 index 0000000..4f3ae53 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiTextField.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiVideoSettings.class b/build/classes/java/main/net/minecraft/src/GuiVideoSettings.class new file mode 100644 index 0000000..fbfa469 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiVideoSettings.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiWinGame.class b/build/classes/java/main/net/minecraft/src/GuiWinGame.class new file mode 100644 index 0000000..8d37729 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiWinGame.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiWorldSlot.class b/build/classes/java/main/net/minecraft/src/GuiWorldSlot.class new file mode 100644 index 0000000..91c2180 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiWorldSlot.class differ diff --git a/build/classes/java/main/net/minecraft/src/GuiYesNo.class b/build/classes/java/main/net/minecraft/src/GuiYesNo.class new file mode 100644 index 0000000..3855e2c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/GuiYesNo.class differ diff --git a/build/classes/java/main/net/minecraft/src/Hopper.class b/build/classes/java/main/net/minecraft/src/Hopper.class new file mode 100644 index 0000000..5db182c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Hopper.class differ diff --git a/build/classes/java/main/net/minecraft/src/HttpUtil.class b/build/classes/java/main/net/minecraft/src/HttpUtil.class new file mode 100644 index 0000000..36edaec Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/HttpUtil.class differ diff --git a/build/classes/java/main/net/minecraft/src/I18n.class b/build/classes/java/main/net/minecraft/src/I18n.class new file mode 100644 index 0000000..8a7110c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/I18n.class differ diff --git a/build/classes/java/main/net/minecraft/src/IAdminCommand.class b/build/classes/java/main/net/minecraft/src/IAdminCommand.class new file mode 100644 index 0000000..8008d65 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IAdminCommand.class differ diff --git a/build/classes/java/main/net/minecraft/src/IAnimals.class b/build/classes/java/main/net/minecraft/src/IAnimals.class new file mode 100644 index 0000000..7cbc2cb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IAnimals.class differ diff --git a/build/classes/java/main/net/minecraft/src/IBehaviorDispenseItem.class b/build/classes/java/main/net/minecraft/src/IBehaviorDispenseItem.class new file mode 100644 index 0000000..d271872 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IBehaviorDispenseItem.class differ diff --git a/build/classes/java/main/net/minecraft/src/IBlockAccess.class b/build/classes/java/main/net/minecraft/src/IBlockAccess.class new file mode 100644 index 0000000..79dae44 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IBlockAccess.class differ diff --git a/build/classes/java/main/net/minecraft/src/IBlockSource.class b/build/classes/java/main/net/minecraft/src/IBlockSource.class new file mode 100644 index 0000000..79c4084 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IBlockSource.class differ diff --git a/build/classes/java/main/net/minecraft/src/IBossDisplayData.class b/build/classes/java/main/net/minecraft/src/IBossDisplayData.class new file mode 100644 index 0000000..61b3774 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IBossDisplayData.class differ diff --git a/build/classes/java/main/net/minecraft/src/ICamera.class b/build/classes/java/main/net/minecraft/src/ICamera.class new file mode 100644 index 0000000..4629949 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ICamera.class differ diff --git a/build/classes/java/main/net/minecraft/src/IChunkLoader.class b/build/classes/java/main/net/minecraft/src/IChunkLoader.class new file mode 100644 index 0000000..9aee9be Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IChunkLoader.class differ diff --git a/build/classes/java/main/net/minecraft/src/IChunkProvider.class b/build/classes/java/main/net/minecraft/src/IChunkProvider.class new file mode 100644 index 0000000..0a5f2e9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IChunkProvider.class differ diff --git a/build/classes/java/main/net/minecraft/src/ICommand.class b/build/classes/java/main/net/minecraft/src/ICommand.class new file mode 100644 index 0000000..04fdb90 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ICommand.class differ diff --git a/build/classes/java/main/net/minecraft/src/ICommandManager.class b/build/classes/java/main/net/minecraft/src/ICommandManager.class new file mode 100644 index 0000000..d448bf9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ICommandManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/ICommandSender.class b/build/classes/java/main/net/minecraft/src/ICommandSender.class new file mode 100644 index 0000000..021f17a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ICommandSender.class differ diff --git a/build/classes/java/main/net/minecraft/src/ICrafting.class b/build/classes/java/main/net/minecraft/src/ICrafting.class new file mode 100644 index 0000000..2878d55 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ICrafting.class differ diff --git a/build/classes/java/main/net/minecraft/src/IEnchantmentModifier.class b/build/classes/java/main/net/minecraft/src/IEnchantmentModifier.class new file mode 100644 index 0000000..7c001e0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IEnchantmentModifier.class differ diff --git a/build/classes/java/main/net/minecraft/src/IEntityMultiPart.class b/build/classes/java/main/net/minecraft/src/IEntityMultiPart.class new file mode 100644 index 0000000..c6d0aad Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IEntityMultiPart.class differ diff --git a/build/classes/java/main/net/minecraft/src/IEntitySelector.class b/build/classes/java/main/net/minecraft/src/IEntitySelector.class new file mode 100644 index 0000000..5e7cd8e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IEntitySelector.class differ diff --git a/build/classes/java/main/net/minecraft/src/IImageBuffer.class b/build/classes/java/main/net/minecraft/src/IImageBuffer.class new file mode 100644 index 0000000..785b964 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IImageBuffer.class differ diff --git a/build/classes/java/main/net/minecraft/src/IInvBasic.class b/build/classes/java/main/net/minecraft/src/IInvBasic.class new file mode 100644 index 0000000..6441177 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IInvBasic.class differ diff --git a/build/classes/java/main/net/minecraft/src/IInventory.class b/build/classes/java/main/net/minecraft/src/IInventory.class new file mode 100644 index 0000000..64aad48 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IInventory.class differ diff --git a/build/classes/java/main/net/minecraft/src/ILocatableSource.class b/build/classes/java/main/net/minecraft/src/ILocatableSource.class new file mode 100644 index 0000000..eb9a7c0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ILocatableSource.class differ diff --git a/build/classes/java/main/net/minecraft/src/ILocation.class b/build/classes/java/main/net/minecraft/src/ILocation.class new file mode 100644 index 0000000..0576a74 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ILocation.class differ diff --git a/build/classes/java/main/net/minecraft/src/ILogAgent.class b/build/classes/java/main/net/minecraft/src/ILogAgent.class new file mode 100644 index 0000000..18f7ed2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ILogAgent.class differ diff --git a/build/classes/java/main/net/minecraft/src/IMerchant.class b/build/classes/java/main/net/minecraft/src/IMerchant.class new file mode 100644 index 0000000..e54ed2f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IMerchant.class differ diff --git a/build/classes/java/main/net/minecraft/src/IMob.class b/build/classes/java/main/net/minecraft/src/IMob.class new file mode 100644 index 0000000..f23f07f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IMob.class differ diff --git a/build/classes/java/main/net/minecraft/src/INetworkManager.class b/build/classes/java/main/net/minecraft/src/INetworkManager.class new file mode 100644 index 0000000..47b3034 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/INetworkManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/INpc.class b/build/classes/java/main/net/minecraft/src/INpc.class new file mode 100644 index 0000000..9271c2e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/INpc.class differ diff --git a/build/classes/java/main/net/minecraft/src/IPlayerFileData.class b/build/classes/java/main/net/minecraft/src/IPlayerFileData.class new file mode 100644 index 0000000..f94fa06 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IPlayerFileData.class differ diff --git a/build/classes/java/main/net/minecraft/src/IPlayerUsage.class b/build/classes/java/main/net/minecraft/src/IPlayerUsage.class new file mode 100644 index 0000000..ba7063d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IPlayerUsage.class differ diff --git a/build/classes/java/main/net/minecraft/src/IPosition.class b/build/classes/java/main/net/minecraft/src/IPosition.class new file mode 100644 index 0000000..e216206 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IPosition.class differ diff --git a/build/classes/java/main/net/minecraft/src/IProgressUpdate.class b/build/classes/java/main/net/minecraft/src/IProgressUpdate.class new file mode 100644 index 0000000..e6451cf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IProgressUpdate.class differ diff --git a/build/classes/java/main/net/minecraft/src/IProjectile.class b/build/classes/java/main/net/minecraft/src/IProjectile.class new file mode 100644 index 0000000..a2c72a4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IProjectile.class differ diff --git a/build/classes/java/main/net/minecraft/src/IRangedAttackMob.class b/build/classes/java/main/net/minecraft/src/IRangedAttackMob.class new file mode 100644 index 0000000..08920c2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IRangedAttackMob.class differ diff --git a/build/classes/java/main/net/minecraft/src/IRecipe.class b/build/classes/java/main/net/minecraft/src/IRecipe.class new file mode 100644 index 0000000..fd7247d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IRecipe.class differ diff --git a/build/classes/java/main/net/minecraft/src/IRegistry.class b/build/classes/java/main/net/minecraft/src/IRegistry.class new file mode 100644 index 0000000..2e916a1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IRegistry.class differ diff --git a/build/classes/java/main/net/minecraft/src/ISaveFormat.class b/build/classes/java/main/net/minecraft/src/ISaveFormat.class new file mode 100644 index 0000000..700f9d3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ISaveFormat.class differ diff --git a/build/classes/java/main/net/minecraft/src/ISaveHandler.class b/build/classes/java/main/net/minecraft/src/ISaveHandler.class new file mode 100644 index 0000000..fdccc2e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ISaveHandler.class differ diff --git a/build/classes/java/main/net/minecraft/src/IServer.class b/build/classes/java/main/net/minecraft/src/IServer.class new file mode 100644 index 0000000..a44d439 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/ISidedInventory.class b/build/classes/java/main/net/minecraft/src/ISidedInventory.class new file mode 100644 index 0000000..56e0bf1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ISidedInventory.class differ diff --git a/build/classes/java/main/net/minecraft/src/IStatStringFormat.class b/build/classes/java/main/net/minecraft/src/IStatStringFormat.class new file mode 100644 index 0000000..92be0d1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IStatStringFormat.class differ diff --git a/build/classes/java/main/net/minecraft/src/IStatType.class b/build/classes/java/main/net/minecraft/src/IStatType.class new file mode 100644 index 0000000..40164aa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IStatType.class differ diff --git a/build/classes/java/main/net/minecraft/src/IThreadedFileIO.class b/build/classes/java/main/net/minecraft/src/IThreadedFileIO.class new file mode 100644 index 0000000..4707dd1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IThreadedFileIO.class differ diff --git a/build/classes/java/main/net/minecraft/src/ITileEntityProvider.class b/build/classes/java/main/net/minecraft/src/ITileEntityProvider.class new file mode 100644 index 0000000..bd30c90 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ITileEntityProvider.class differ diff --git a/build/classes/java/main/net/minecraft/src/IUpdatePlayerListBox.class b/build/classes/java/main/net/minecraft/src/IUpdatePlayerListBox.class new file mode 100644 index 0000000..c3f05c5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IUpdatePlayerListBox.class differ diff --git a/build/classes/java/main/net/minecraft/src/IWorldAccess.class b/build/classes/java/main/net/minecraft/src/IWorldAccess.class new file mode 100644 index 0000000..92f238f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IWorldAccess.class differ diff --git a/build/classes/java/main/net/minecraft/src/Icon.class b/build/classes/java/main/net/minecraft/src/Icon.class new file mode 100644 index 0000000..24a0b09 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Icon.class differ diff --git a/build/classes/java/main/net/minecraft/src/IconFlipped.class b/build/classes/java/main/net/minecraft/src/IconFlipped.class new file mode 100644 index 0000000..61ed20c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IconFlipped.class differ diff --git a/build/classes/java/main/net/minecraft/src/IconRegister.class b/build/classes/java/main/net/minecraft/src/IconRegister.class new file mode 100644 index 0000000..43f3947 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IconRegister.class differ diff --git a/build/classes/java/main/net/minecraft/src/ImageBufferDownload.class b/build/classes/java/main/net/minecraft/src/ImageBufferDownload.class new file mode 100644 index 0000000..7290d05 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ImageBufferDownload.class differ diff --git a/build/classes/java/main/net/minecraft/src/IntCache.class b/build/classes/java/main/net/minecraft/src/IntCache.class new file mode 100644 index 0000000..3ee6401 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IntCache.class differ diff --git a/build/classes/java/main/net/minecraft/src/IntHashMap.class b/build/classes/java/main/net/minecraft/src/IntHashMap.class new file mode 100644 index 0000000..e8c924e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IntHashMap.class differ diff --git a/build/classes/java/main/net/minecraft/src/IntHashMapEntry.class b/build/classes/java/main/net/minecraft/src/IntHashMapEntry.class new file mode 100644 index 0000000..808b567 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IntHashMapEntry.class differ diff --git a/build/classes/java/main/net/minecraft/src/IntegratedPlayerList.class b/build/classes/java/main/net/minecraft/src/IntegratedPlayerList.class new file mode 100644 index 0000000..6ce5f58 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IntegratedPlayerList.class differ diff --git a/build/classes/java/main/net/minecraft/src/IntegratedServer.class b/build/classes/java/main/net/minecraft/src/IntegratedServer.class new file mode 100644 index 0000000..463913c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IntegratedServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/IntegratedServerListenThread.class b/build/classes/java/main/net/minecraft/src/IntegratedServerListenThread.class new file mode 100644 index 0000000..e6c7096 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/IntegratedServerListenThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/InventoryBasic.class b/build/classes/java/main/net/minecraft/src/InventoryBasic.class new file mode 100644 index 0000000..31c0a47 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/InventoryBasic.class differ diff --git a/build/classes/java/main/net/minecraft/src/InventoryCraftResult.class b/build/classes/java/main/net/minecraft/src/InventoryCraftResult.class new file mode 100644 index 0000000..c5721fb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/InventoryCraftResult.class differ diff --git a/build/classes/java/main/net/minecraft/src/InventoryCrafting.class b/build/classes/java/main/net/minecraft/src/InventoryCrafting.class new file mode 100644 index 0000000..eee8c43 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/InventoryCrafting.class differ diff --git a/build/classes/java/main/net/minecraft/src/InventoryEffectRenderer.class b/build/classes/java/main/net/minecraft/src/InventoryEffectRenderer.class new file mode 100644 index 0000000..4ddf0fa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/InventoryEffectRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/InventoryEnderChest.class b/build/classes/java/main/net/minecraft/src/InventoryEnderChest.class new file mode 100644 index 0000000..d72eb15 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/InventoryEnderChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/InventoryLargeChest.class b/build/classes/java/main/net/minecraft/src/InventoryLargeChest.class new file mode 100644 index 0000000..759eeb5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/InventoryLargeChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/InventoryMerchant.class b/build/classes/java/main/net/minecraft/src/InventoryMerchant.class new file mode 100644 index 0000000..e9d9661 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/InventoryMerchant.class differ diff --git a/build/classes/java/main/net/minecraft/src/InventoryPlayer.class b/build/classes/java/main/net/minecraft/src/InventoryPlayer.class new file mode 100644 index 0000000..a20086b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/InventoryPlayer.class differ diff --git a/build/classes/java/main/net/minecraft/src/Item.class b/build/classes/java/main/net/minecraft/src/Item.class new file mode 100644 index 0000000..d33117e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Item.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemAnvilBlock.class b/build/classes/java/main/net/minecraft/src/ItemAnvilBlock.class new file mode 100644 index 0000000..8d383cf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemAnvilBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemAppleGold.class b/build/classes/java/main/net/minecraft/src/ItemAppleGold.class new file mode 100644 index 0000000..a0fc6af Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemAppleGold.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemArmor.class b/build/classes/java/main/net/minecraft/src/ItemArmor.class new file mode 100644 index 0000000..31b34cb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemArmor.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemAxe.class b/build/classes/java/main/net/minecraft/src/ItemAxe.class new file mode 100644 index 0000000..71abf85 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemAxe.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemBed.class b/build/classes/java/main/net/minecraft/src/ItemBed.class new file mode 100644 index 0000000..63481c8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemBed.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemBlock.class b/build/classes/java/main/net/minecraft/src/ItemBlock.class new file mode 100644 index 0000000..8ab88c6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemBlockWithMetadata.class b/build/classes/java/main/net/minecraft/src/ItemBlockWithMetadata.class new file mode 100644 index 0000000..cf75651 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemBlockWithMetadata.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemBoat.class b/build/classes/java/main/net/minecraft/src/ItemBoat.class new file mode 100644 index 0000000..1d0757f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemBoat.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemBook.class b/build/classes/java/main/net/minecraft/src/ItemBook.class new file mode 100644 index 0000000..e91859b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemBook.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemBow.class b/build/classes/java/main/net/minecraft/src/ItemBow.class new file mode 100644 index 0000000..7c5b720 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemBow.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemBucket.class b/build/classes/java/main/net/minecraft/src/ItemBucket.class new file mode 100644 index 0000000..f97082f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemBucket.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemBucketMilk.class b/build/classes/java/main/net/minecraft/src/ItemBucketMilk.class new file mode 100644 index 0000000..61b22e0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemBucketMilk.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemCarrotOnAStick.class b/build/classes/java/main/net/minecraft/src/ItemCarrotOnAStick.class new file mode 100644 index 0000000..c3bccf3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemCarrotOnAStick.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemCloth.class b/build/classes/java/main/net/minecraft/src/ItemCloth.class new file mode 100644 index 0000000..f4da7ee Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemCloth.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemCoal.class b/build/classes/java/main/net/minecraft/src/ItemCoal.class new file mode 100644 index 0000000..2af48e2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemCoal.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemColored.class b/build/classes/java/main/net/minecraft/src/ItemColored.class new file mode 100644 index 0000000..f9aa085 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemColored.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemDoor.class b/build/classes/java/main/net/minecraft/src/ItemDoor.class new file mode 100644 index 0000000..e07fe01 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemDoor.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemDye.class b/build/classes/java/main/net/minecraft/src/ItemDye.class new file mode 100644 index 0000000..1ddda4e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemDye.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemEditableBook.class b/build/classes/java/main/net/minecraft/src/ItemEditableBook.class new file mode 100644 index 0000000..c5f1024 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemEditableBook.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemEgg.class b/build/classes/java/main/net/minecraft/src/ItemEgg.class new file mode 100644 index 0000000..e1b6fe8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemEgg.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemEmptyMap.class b/build/classes/java/main/net/minecraft/src/ItemEmptyMap.class new file mode 100644 index 0000000..2bee504 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemEmptyMap.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemEnchantedBook.class b/build/classes/java/main/net/minecraft/src/ItemEnchantedBook.class new file mode 100644 index 0000000..fa03a50 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemEnchantedBook.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemEnderEye.class b/build/classes/java/main/net/minecraft/src/ItemEnderEye.class new file mode 100644 index 0000000..09daa1e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemEnderEye.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemEnderPearl.class b/build/classes/java/main/net/minecraft/src/ItemEnderPearl.class new file mode 100644 index 0000000..ab6a73b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemEnderPearl.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemExpBottle.class b/build/classes/java/main/net/minecraft/src/ItemExpBottle.class new file mode 100644 index 0000000..4f649bb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemExpBottle.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemFireball.class b/build/classes/java/main/net/minecraft/src/ItemFireball.class new file mode 100644 index 0000000..90f70ec Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemFireball.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemFirework.class b/build/classes/java/main/net/minecraft/src/ItemFirework.class new file mode 100644 index 0000000..9f99d5e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemFirework.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemFireworkCharge.class b/build/classes/java/main/net/minecraft/src/ItemFireworkCharge.class new file mode 100644 index 0000000..0696eaf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemFireworkCharge.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemFishingRod.class b/build/classes/java/main/net/minecraft/src/ItemFishingRod.class new file mode 100644 index 0000000..bce932c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemFishingRod.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemFlintAndSteel.class b/build/classes/java/main/net/minecraft/src/ItemFlintAndSteel.class new file mode 100644 index 0000000..d6e951a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemFlintAndSteel.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemFood.class b/build/classes/java/main/net/minecraft/src/ItemFood.class new file mode 100644 index 0000000..f38cb7c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemFood.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemGlassBottle.class b/build/classes/java/main/net/minecraft/src/ItemGlassBottle.class new file mode 100644 index 0000000..219ae7c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemGlassBottle.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemHangingEntity.class b/build/classes/java/main/net/minecraft/src/ItemHangingEntity.class new file mode 100644 index 0000000..1c0d453 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemHangingEntity.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemHoe.class b/build/classes/java/main/net/minecraft/src/ItemHoe.class new file mode 100644 index 0000000..a1b6dc8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemHoe.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemInWorldManager.class b/build/classes/java/main/net/minecraft/src/ItemInWorldManager.class new file mode 100644 index 0000000..7f16dd7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemInWorldManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemLeash.class b/build/classes/java/main/net/minecraft/src/ItemLeash.class new file mode 100644 index 0000000..5158605 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemLeash.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemLeaves.class b/build/classes/java/main/net/minecraft/src/ItemLeaves.class new file mode 100644 index 0000000..ce4535d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemLeaves.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemLilyPad.class b/build/classes/java/main/net/minecraft/src/ItemLilyPad.class new file mode 100644 index 0000000..86f5229 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemLilyPad.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemMap.class b/build/classes/java/main/net/minecraft/src/ItemMap.class new file mode 100644 index 0000000..891e7bd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemMap.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemMapBase.class b/build/classes/java/main/net/minecraft/src/ItemMapBase.class new file mode 100644 index 0000000..df14c99 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemMapBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemMinecart.class b/build/classes/java/main/net/minecraft/src/ItemMinecart.class new file mode 100644 index 0000000..188c89e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemMinecart.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemMonsterPlacer.class b/build/classes/java/main/net/minecraft/src/ItemMonsterPlacer.class new file mode 100644 index 0000000..a788c8f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemMonsterPlacer.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemMultiTextureTile.class b/build/classes/java/main/net/minecraft/src/ItemMultiTextureTile.class new file mode 100644 index 0000000..dfc60f9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemMultiTextureTile.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemNameTag.class b/build/classes/java/main/net/minecraft/src/ItemNameTag.class new file mode 100644 index 0000000..6ef522b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemNameTag.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemPickaxe.class b/build/classes/java/main/net/minecraft/src/ItemPickaxe.class new file mode 100644 index 0000000..740d48c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemPickaxe.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemPiston.class b/build/classes/java/main/net/minecraft/src/ItemPiston.class new file mode 100644 index 0000000..f8de85a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemPiston.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemPotion.class b/build/classes/java/main/net/minecraft/src/ItemPotion.class new file mode 100644 index 0000000..9c628b5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemPotion.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemRecord.class b/build/classes/java/main/net/minecraft/src/ItemRecord.class new file mode 100644 index 0000000..cf5b842 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemRecord.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemRedstone.class b/build/classes/java/main/net/minecraft/src/ItemRedstone.class new file mode 100644 index 0000000..ab57892 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemRedstone.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemReed.class b/build/classes/java/main/net/minecraft/src/ItemReed.class new file mode 100644 index 0000000..e16bb22 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemReed.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemRenderer.class b/build/classes/java/main/net/minecraft/src/ItemRenderer.class new file mode 100644 index 0000000..2fb1c84 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSaddle.class b/build/classes/java/main/net/minecraft/src/ItemSaddle.class new file mode 100644 index 0000000..717542a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSaddle.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSeedFood.class b/build/classes/java/main/net/minecraft/src/ItemSeedFood.class new file mode 100644 index 0000000..6072dff Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSeedFood.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSeeds.class b/build/classes/java/main/net/minecraft/src/ItemSeeds.class new file mode 100644 index 0000000..3da2a3c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSeeds.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemShears.class b/build/classes/java/main/net/minecraft/src/ItemShears.class new file mode 100644 index 0000000..f43c91e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemShears.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSign.class b/build/classes/java/main/net/minecraft/src/ItemSign.class new file mode 100644 index 0000000..34962ce Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSign.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSimpleFoiled.class b/build/classes/java/main/net/minecraft/src/ItemSimpleFoiled.class new file mode 100644 index 0000000..dc449ef Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSimpleFoiled.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSkull.class b/build/classes/java/main/net/minecraft/src/ItemSkull.class new file mode 100644 index 0000000..aedcbae Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSkull.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSlab.class b/build/classes/java/main/net/minecraft/src/ItemSlab.class new file mode 100644 index 0000000..3411e07 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSlab.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSnow.class b/build/classes/java/main/net/minecraft/src/ItemSnow.class new file mode 100644 index 0000000..d881a90 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSnow.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSnowball.class b/build/classes/java/main/net/minecraft/src/ItemSnowball.class new file mode 100644 index 0000000..9f2df02 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSnowball.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSoup.class b/build/classes/java/main/net/minecraft/src/ItemSoup.class new file mode 100644 index 0000000..e2cfc18 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSoup.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSpade.class b/build/classes/java/main/net/minecraft/src/ItemSpade.class new file mode 100644 index 0000000..283244e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSpade.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemStack.class b/build/classes/java/main/net/minecraft/src/ItemStack.class new file mode 100644 index 0000000..82bcf37 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemStack.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemSword.class b/build/classes/java/main/net/minecraft/src/ItemSword.class new file mode 100644 index 0000000..4c04b8c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemSword.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemTool.class b/build/classes/java/main/net/minecraft/src/ItemTool.class new file mode 100644 index 0000000..61b4982 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemTool.class differ diff --git a/build/classes/java/main/net/minecraft/src/ItemWritableBook.class b/build/classes/java/main/net/minecraft/src/ItemWritableBook.class new file mode 100644 index 0000000..d57897c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ItemWritableBook.class differ diff --git a/build/classes/java/main/net/minecraft/src/KeyBinding.class b/build/classes/java/main/net/minecraft/src/KeyBinding.class new file mode 100644 index 0000000..420e09a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/KeyBinding.class differ diff --git a/build/classes/java/main/net/minecraft/src/LanServer.class b/build/classes/java/main/net/minecraft/src/LanServer.class new file mode 100644 index 0000000..d5b1a85 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LanServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/LanServerList.class b/build/classes/java/main/net/minecraft/src/LanServerList.class new file mode 100644 index 0000000..2facdb6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LanServerList.class differ diff --git a/build/classes/java/main/net/minecraft/src/Language.class b/build/classes/java/main/net/minecraft/src/Language.class new file mode 100644 index 0000000..5641a80 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Language.class differ diff --git a/build/classes/java/main/net/minecraft/src/LanguageManager.class b/build/classes/java/main/net/minecraft/src/LanguageManager.class new file mode 100644 index 0000000..9b2f94e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LanguageManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/LanguageMetadataSection.class b/build/classes/java/main/net/minecraft/src/LanguageMetadataSection.class new file mode 100644 index 0000000..b0704dc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LanguageMetadataSection.class differ diff --git a/build/classes/java/main/net/minecraft/src/LanguageMetadataSectionSerializer.class b/build/classes/java/main/net/minecraft/src/LanguageMetadataSectionSerializer.class new file mode 100644 index 0000000..e9be4de Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LanguageMetadataSectionSerializer.class differ diff --git a/build/classes/java/main/net/minecraft/src/LayeredTexture.class b/build/classes/java/main/net/minecraft/src/LayeredTexture.class new file mode 100644 index 0000000..1baa5e8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LayeredTexture.class differ diff --git a/build/classes/java/main/net/minecraft/src/LoadingScreenRenderer.class b/build/classes/java/main/net/minecraft/src/LoadingScreenRenderer.class new file mode 100644 index 0000000..e949f21 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LoadingScreenRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/Locale.class b/build/classes/java/main/net/minecraft/src/Locale.class new file mode 100644 index 0000000..a32445a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Locale.class differ diff --git a/build/classes/java/main/net/minecraft/src/LogAgent.class b/build/classes/java/main/net/minecraft/src/LogAgent.class new file mode 100644 index 0000000..0fa0abd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LogAgent.class differ diff --git a/build/classes/java/main/net/minecraft/src/LogAgentEmptyAnon.class b/build/classes/java/main/net/minecraft/src/LogAgentEmptyAnon.class new file mode 100644 index 0000000..059241a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LogAgentEmptyAnon.class differ diff --git a/build/classes/java/main/net/minecraft/src/LogFormatter.class b/build/classes/java/main/net/minecraft/src/LogFormatter.class new file mode 100644 index 0000000..2f71cd8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LogFormatter.class differ diff --git a/build/classes/java/main/net/minecraft/src/LongHashMap.class b/build/classes/java/main/net/minecraft/src/LongHashMap.class new file mode 100644 index 0000000..ed98f75 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LongHashMap.class differ diff --git a/build/classes/java/main/net/minecraft/src/LongHashMapEntry.class b/build/classes/java/main/net/minecraft/src/LongHashMapEntry.class new file mode 100644 index 0000000..93622a1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LongHashMapEntry.class differ diff --git a/build/classes/java/main/net/minecraft/src/LowerStringMap.class b/build/classes/java/main/net/minecraft/src/LowerStringMap.class new file mode 100644 index 0000000..9d9506e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/LowerStringMap.class differ diff --git a/build/classes/java/main/net/minecraft/src/MD5String.class b/build/classes/java/main/net/minecraft/src/MD5String.class new file mode 100644 index 0000000..305fcec Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MD5String.class differ diff --git a/build/classes/java/main/net/minecraft/src/MainProxyAuthenticator.class b/build/classes/java/main/net/minecraft/src/MainProxyAuthenticator.class new file mode 100644 index 0000000..f622523 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MainProxyAuthenticator.class differ diff --git a/build/classes/java/main/net/minecraft/src/MainShutdownHook.class b/build/classes/java/main/net/minecraft/src/MainShutdownHook.class new file mode 100644 index 0000000..b0bd916 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MainShutdownHook.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapColor.class b/build/classes/java/main/net/minecraft/src/MapColor.class new file mode 100644 index 0000000..bb52e0e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapColor.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapCoord.class b/build/classes/java/main/net/minecraft/src/MapCoord.class new file mode 100644 index 0000000..9ae64c8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapCoord.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapData.class b/build/classes/java/main/net/minecraft/src/MapData.class new file mode 100644 index 0000000..10a7b32 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapData.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenBase.class b/build/classes/java/main/net/minecraft/src/MapGenBase.class new file mode 100644 index 0000000..b1fffdb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenCaves.class b/build/classes/java/main/net/minecraft/src/MapGenCaves.class new file mode 100644 index 0000000..71b0617 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenCaves.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenCavesHell.class b/build/classes/java/main/net/minecraft/src/MapGenCavesHell.class new file mode 100644 index 0000000..b65fc2e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenCavesHell.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenMineshaft.class b/build/classes/java/main/net/minecraft/src/MapGenMineshaft.class new file mode 100644 index 0000000..1d67ae3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenMineshaft.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenNetherBridge.class b/build/classes/java/main/net/minecraft/src/MapGenNetherBridge.class new file mode 100644 index 0000000..2bf1ee4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenNetherBridge.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenRavine.class b/build/classes/java/main/net/minecraft/src/MapGenRavine.class new file mode 100644 index 0000000..cf4d9ac Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenRavine.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenScatteredFeature.class b/build/classes/java/main/net/minecraft/src/MapGenScatteredFeature.class new file mode 100644 index 0000000..abef0e6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenScatteredFeature.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenStronghold.class b/build/classes/java/main/net/minecraft/src/MapGenStronghold.class new file mode 100644 index 0000000..293425a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenStronghold.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenStructure.class b/build/classes/java/main/net/minecraft/src/MapGenStructure.class new file mode 100644 index 0000000..ea7856b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenStructure.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenStructureData.class b/build/classes/java/main/net/minecraft/src/MapGenStructureData.class new file mode 100644 index 0000000..7e41e0f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenStructureData.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenStructureIO.class b/build/classes/java/main/net/minecraft/src/MapGenStructureIO.class new file mode 100644 index 0000000..1767ae2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenStructureIO.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapGenVillage.class b/build/classes/java/main/net/minecraft/src/MapGenVillage.class new file mode 100644 index 0000000..0945764 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapGenVillage.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapInfo.class b/build/classes/java/main/net/minecraft/src/MapInfo.class new file mode 100644 index 0000000..9c71ccb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapItemRenderer.class b/build/classes/java/main/net/minecraft/src/MapItemRenderer.class new file mode 100644 index 0000000..4f935f0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapItemRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/MapStorage.class b/build/classes/java/main/net/minecraft/src/MapStorage.class new file mode 100644 index 0000000..db34d2d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MapStorage.class differ diff --git a/build/classes/java/main/net/minecraft/src/Material.class b/build/classes/java/main/net/minecraft/src/Material.class new file mode 100644 index 0000000..8c85a0e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Material.class differ diff --git a/build/classes/java/main/net/minecraft/src/MaterialLiquid.class b/build/classes/java/main/net/minecraft/src/MaterialLiquid.class new file mode 100644 index 0000000..5eea1e3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MaterialLiquid.class differ diff --git a/build/classes/java/main/net/minecraft/src/MaterialLogic.class b/build/classes/java/main/net/minecraft/src/MaterialLogic.class new file mode 100644 index 0000000..4c02a79 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MaterialLogic.class differ diff --git a/build/classes/java/main/net/minecraft/src/MaterialPortal.class b/build/classes/java/main/net/minecraft/src/MaterialPortal.class new file mode 100644 index 0000000..9cfefd6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MaterialPortal.class differ diff --git a/build/classes/java/main/net/minecraft/src/MaterialTransparent.class b/build/classes/java/main/net/minecraft/src/MaterialTransparent.class new file mode 100644 index 0000000..ee335ec Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MaterialTransparent.class differ diff --git a/build/classes/java/main/net/minecraft/src/MaterialWeb.class b/build/classes/java/main/net/minecraft/src/MaterialWeb.class new file mode 100644 index 0000000..aea5c91 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MaterialWeb.class differ diff --git a/build/classes/java/main/net/minecraft/src/MathHelper.class b/build/classes/java/main/net/minecraft/src/MathHelper.class new file mode 100644 index 0000000..dcebcae Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MathHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/McoClient.class b/build/classes/java/main/net/minecraft/src/McoClient.class new file mode 100644 index 0000000..70cbaaf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/McoClient.class differ diff --git a/build/classes/java/main/net/minecraft/src/McoServer.class b/build/classes/java/main/net/minecraft/src/McoServer.class new file mode 100644 index 0000000..b0a5617 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/McoServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/McoServerAddress.class b/build/classes/java/main/net/minecraft/src/McoServerAddress.class new file mode 100644 index 0000000..f9a8b69 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/McoServerAddress.class differ diff --git a/build/classes/java/main/net/minecraft/src/McoServerList.class b/build/classes/java/main/net/minecraft/src/McoServerList.class new file mode 100644 index 0000000..1e3c709 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/McoServerList.class differ diff --git a/build/classes/java/main/net/minecraft/src/McoServerListEmptyAnon.class b/build/classes/java/main/net/minecraft/src/McoServerListEmptyAnon.class new file mode 100644 index 0000000..845beb9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/McoServerListEmptyAnon.class differ diff --git a/build/classes/java/main/net/minecraft/src/McoServerListUpdateTask.class b/build/classes/java/main/net/minecraft/src/McoServerListUpdateTask.class new file mode 100644 index 0000000..cff2b72 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/McoServerListUpdateTask.class differ diff --git a/build/classes/java/main/net/minecraft/src/McoServerListUpdateTaskComparator.class b/build/classes/java/main/net/minecraft/src/McoServerListUpdateTaskComparator.class new file mode 100644 index 0000000..018840a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/McoServerListUpdateTaskComparator.class differ diff --git a/build/classes/java/main/net/minecraft/src/MemoryConnection.class b/build/classes/java/main/net/minecraft/src/MemoryConnection.class new file mode 100644 index 0000000..869dad8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MemoryConnection.class differ diff --git a/build/classes/java/main/net/minecraft/src/MerchantRecipe.class b/build/classes/java/main/net/minecraft/src/MerchantRecipe.class new file mode 100644 index 0000000..1e657fa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MerchantRecipe.class differ diff --git a/build/classes/java/main/net/minecraft/src/MerchantRecipeList.class b/build/classes/java/main/net/minecraft/src/MerchantRecipeList.class new file mode 100644 index 0000000..905fd9a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MerchantRecipeList.class differ diff --git a/build/classes/java/main/net/minecraft/src/MessageComponentSerializer.class b/build/classes/java/main/net/minecraft/src/MessageComponentSerializer.class new file mode 100644 index 0000000..17cfa02 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MessageComponentSerializer.class differ diff --git a/build/classes/java/main/net/minecraft/src/MetadataSection.class b/build/classes/java/main/net/minecraft/src/MetadataSection.class new file mode 100644 index 0000000..24b178d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MetadataSection.class differ diff --git a/build/classes/java/main/net/minecraft/src/MetadataSectionSerializer.class b/build/classes/java/main/net/minecraft/src/MetadataSectionSerializer.class new file mode 100644 index 0000000..ae78227 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MetadataSectionSerializer.class differ diff --git a/build/classes/java/main/net/minecraft/src/MetadataSerializer.class b/build/classes/java/main/net/minecraft/src/MetadataSerializer.class new file mode 100644 index 0000000..cea2c21 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MetadataSerializer.class differ diff --git a/build/classes/java/main/net/minecraft/src/MetadataSerializerEmptyAnon.class b/build/classes/java/main/net/minecraft/src/MetadataSerializerEmptyAnon.class new file mode 100644 index 0000000..8d56db0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MetadataSerializerEmptyAnon.class differ diff --git a/build/classes/java/main/net/minecraft/src/MetadataSerializerRegistration.class b/build/classes/java/main/net/minecraft/src/MetadataSerializerRegistration.class new file mode 100644 index 0000000..c1b734d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MetadataSerializerRegistration.class differ diff --git a/build/classes/java/main/net/minecraft/src/Minecraft.class b/build/classes/java/main/net/minecraft/src/Minecraft.class new file mode 100644 index 0000000..63b7e90 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Minecraft.class differ diff --git a/build/classes/java/main/net/minecraft/src/MinecraftError.class b/build/classes/java/main/net/minecraft/src/MinecraftError.class new file mode 100644 index 0000000..77960ce Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MinecraftError.class differ diff --git a/build/classes/java/main/net/minecraft/src/MinecraftException.class b/build/classes/java/main/net/minecraft/src/MinecraftException.class new file mode 100644 index 0000000..238788c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MinecraftException.class differ diff --git a/build/classes/java/main/net/minecraft/src/MinecraftINNER13.class b/build/classes/java/main/net/minecraft/src/MinecraftINNER13.class new file mode 100644 index 0000000..a5773a2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MinecraftINNER13.class differ diff --git a/build/classes/java/main/net/minecraft/src/MobSpawnerBaseLogic.class b/build/classes/java/main/net/minecraft/src/MobSpawnerBaseLogic.class new file mode 100644 index 0000000..b0b19ba Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MobSpawnerBaseLogic.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelBase.class b/build/classes/java/main/net/minecraft/src/ModelBase.class new file mode 100644 index 0000000..3135740 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelBat.class b/build/classes/java/main/net/minecraft/src/ModelBat.class new file mode 100644 index 0000000..5b36f65 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelBat.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelBiped.class b/build/classes/java/main/net/minecraft/src/ModelBiped.class new file mode 100644 index 0000000..2108461 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelBiped.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelBlaze.class b/build/classes/java/main/net/minecraft/src/ModelBlaze.class new file mode 100644 index 0000000..b1b5058 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelBlaze.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelBoat.class b/build/classes/java/main/net/minecraft/src/ModelBoat.class new file mode 100644 index 0000000..5b410d0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelBoat.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelBook.class b/build/classes/java/main/net/minecraft/src/ModelBook.class new file mode 100644 index 0000000..139191c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelBook.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelBox.class b/build/classes/java/main/net/minecraft/src/ModelBox.class new file mode 100644 index 0000000..da1542d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelBox.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelChest.class b/build/classes/java/main/net/minecraft/src/ModelChest.class new file mode 100644 index 0000000..dde795a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelChicken.class b/build/classes/java/main/net/minecraft/src/ModelChicken.class new file mode 100644 index 0000000..645d237 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelChicken.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelCow.class b/build/classes/java/main/net/minecraft/src/ModelCow.class new file mode 100644 index 0000000..03f7a14 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelCow.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelCreeper.class b/build/classes/java/main/net/minecraft/src/ModelCreeper.class new file mode 100644 index 0000000..f6ab52e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelCreeper.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelDragon.class b/build/classes/java/main/net/minecraft/src/ModelDragon.class new file mode 100644 index 0000000..ff69a60 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelDragon.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelEnderCrystal.class b/build/classes/java/main/net/minecraft/src/ModelEnderCrystal.class new file mode 100644 index 0000000..12a3916 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelEnderCrystal.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelEnderman.class b/build/classes/java/main/net/minecraft/src/ModelEnderman.class new file mode 100644 index 0000000..baa5de5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelEnderman.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelGhast.class b/build/classes/java/main/net/minecraft/src/ModelGhast.class new file mode 100644 index 0000000..94aafb1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelGhast.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelHorse.class b/build/classes/java/main/net/minecraft/src/ModelHorse.class new file mode 100644 index 0000000..819e614 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelHorse.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelIronGolem.class b/build/classes/java/main/net/minecraft/src/ModelIronGolem.class new file mode 100644 index 0000000..a74ea82 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelIronGolem.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelLargeChest.class b/build/classes/java/main/net/minecraft/src/ModelLargeChest.class new file mode 100644 index 0000000..702851b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelLargeChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelLeashKnot.class b/build/classes/java/main/net/minecraft/src/ModelLeashKnot.class new file mode 100644 index 0000000..ae9d76a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelLeashKnot.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelMagmaCube.class b/build/classes/java/main/net/minecraft/src/ModelMagmaCube.class new file mode 100644 index 0000000..a542548 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelMagmaCube.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelMinecart.class b/build/classes/java/main/net/minecraft/src/ModelMinecart.class new file mode 100644 index 0000000..43bf964 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelMinecart.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelOcelot.class b/build/classes/java/main/net/minecraft/src/ModelOcelot.class new file mode 100644 index 0000000..ab7ecd0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelOcelot.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelPig.class b/build/classes/java/main/net/minecraft/src/ModelPig.class new file mode 100644 index 0000000..0c53742 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelPig.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelQuadruped.class b/build/classes/java/main/net/minecraft/src/ModelQuadruped.class new file mode 100644 index 0000000..8807745 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelQuadruped.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelRenderer.class b/build/classes/java/main/net/minecraft/src/ModelRenderer.class new file mode 100644 index 0000000..2aa9b94 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelSheep1.class b/build/classes/java/main/net/minecraft/src/ModelSheep1.class new file mode 100644 index 0000000..30cdc01 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelSheep1.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelSheep2.class b/build/classes/java/main/net/minecraft/src/ModelSheep2.class new file mode 100644 index 0000000..8969a6d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelSheep2.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelSign.class b/build/classes/java/main/net/minecraft/src/ModelSign.class new file mode 100644 index 0000000..b574206 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelSign.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelSilverfish.class b/build/classes/java/main/net/minecraft/src/ModelSilverfish.class new file mode 100644 index 0000000..0ae1e2d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelSilverfish.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelSkeleton.class b/build/classes/java/main/net/minecraft/src/ModelSkeleton.class new file mode 100644 index 0000000..5c757f6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelSkeleton.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelSkeletonHead.class b/build/classes/java/main/net/minecraft/src/ModelSkeletonHead.class new file mode 100644 index 0000000..70e02ea Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelSkeletonHead.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelSlime.class b/build/classes/java/main/net/minecraft/src/ModelSlime.class new file mode 100644 index 0000000..143564d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelSlime.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelSnowMan.class b/build/classes/java/main/net/minecraft/src/ModelSnowMan.class new file mode 100644 index 0000000..ba82671 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelSnowMan.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelSpider.class b/build/classes/java/main/net/minecraft/src/ModelSpider.class new file mode 100644 index 0000000..8376518 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelSpider.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelSquid.class b/build/classes/java/main/net/minecraft/src/ModelSquid.class new file mode 100644 index 0000000..5228a7c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelSquid.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelVillager.class b/build/classes/java/main/net/minecraft/src/ModelVillager.class new file mode 100644 index 0000000..fd67b11 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelVillager.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelWitch.class b/build/classes/java/main/net/minecraft/src/ModelWitch.class new file mode 100644 index 0000000..f5ae563 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelWitch.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelWither.class b/build/classes/java/main/net/minecraft/src/ModelWither.class new file mode 100644 index 0000000..fddecc2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelWither.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelWolf.class b/build/classes/java/main/net/minecraft/src/ModelWolf.class new file mode 100644 index 0000000..8dd37b9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelWolf.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelZombie.class b/build/classes/java/main/net/minecraft/src/ModelZombie.class new file mode 100644 index 0000000..0177922 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelZombie.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModelZombieVillager.class b/build/classes/java/main/net/minecraft/src/ModelZombieVillager.class new file mode 100644 index 0000000..8221c0c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModelZombieVillager.class differ diff --git a/build/classes/java/main/net/minecraft/src/ModifiableAttributeInstance.class b/build/classes/java/main/net/minecraft/src/ModifiableAttributeInstance.class new file mode 100644 index 0000000..543bebf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ModifiableAttributeInstance.class differ diff --git a/build/classes/java/main/net/minecraft/src/MouseFilter.class b/build/classes/java/main/net/minecraft/src/MouseFilter.class new file mode 100644 index 0000000..758790e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MouseFilter.class differ diff --git a/build/classes/java/main/net/minecraft/src/MouseHelper.class b/build/classes/java/main/net/minecraft/src/MouseHelper.class new file mode 100644 index 0000000..6ba260d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MouseHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/MovementInput.class b/build/classes/java/main/net/minecraft/src/MovementInput.class new file mode 100644 index 0000000..762f269 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MovementInput.class differ diff --git a/build/classes/java/main/net/minecraft/src/MovementInputFromOptions.class b/build/classes/java/main/net/minecraft/src/MovementInputFromOptions.class new file mode 100644 index 0000000..753bec9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MovementInputFromOptions.class differ diff --git a/build/classes/java/main/net/minecraft/src/MovingObjectPosition.class b/build/classes/java/main/net/minecraft/src/MovingObjectPosition.class new file mode 100644 index 0000000..ea5af58 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/MovingObjectPosition.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTBase.class b/build/classes/java/main/net/minecraft/src/NBTBase.class new file mode 100644 index 0000000..5b38397 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagByte.class b/build/classes/java/main/net/minecraft/src/NBTTagByte.class new file mode 100644 index 0000000..2ea2069 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagByte.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagByteArray.class b/build/classes/java/main/net/minecraft/src/NBTTagByteArray.class new file mode 100644 index 0000000..d624eb6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagByteArray.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagCompound.class b/build/classes/java/main/net/minecraft/src/NBTTagCompound.class new file mode 100644 index 0000000..7b7c1d1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagCompound.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagDouble.class b/build/classes/java/main/net/minecraft/src/NBTTagDouble.class new file mode 100644 index 0000000..9e2287c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagDouble.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagEnd.class b/build/classes/java/main/net/minecraft/src/NBTTagEnd.class new file mode 100644 index 0000000..5869d4b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagEnd.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagFloat.class b/build/classes/java/main/net/minecraft/src/NBTTagFloat.class new file mode 100644 index 0000000..a04f050 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagFloat.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagInt.class b/build/classes/java/main/net/minecraft/src/NBTTagInt.class new file mode 100644 index 0000000..5a23d34 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagInt.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagIntArray.class b/build/classes/java/main/net/minecraft/src/NBTTagIntArray.class new file mode 100644 index 0000000..0af3cc2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagIntArray.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagList.class b/build/classes/java/main/net/minecraft/src/NBTTagList.class new file mode 100644 index 0000000..da6f0ed Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagList.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagLong.class b/build/classes/java/main/net/minecraft/src/NBTTagLong.class new file mode 100644 index 0000000..5431269 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagLong.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagShort.class b/build/classes/java/main/net/minecraft/src/NBTTagShort.class new file mode 100644 index 0000000..65f2a4e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagShort.class differ diff --git a/build/classes/java/main/net/minecraft/src/NBTTagString.class b/build/classes/java/main/net/minecraft/src/NBTTagString.class new file mode 100644 index 0000000..1b179d8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NBTTagString.class differ diff --git a/build/classes/java/main/net/minecraft/src/NetClientHandler.class b/build/classes/java/main/net/minecraft/src/NetClientHandler.class new file mode 100644 index 0000000..f13a8db Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NetClientHandler.class differ diff --git a/build/classes/java/main/net/minecraft/src/NetHandler.class b/build/classes/java/main/net/minecraft/src/NetHandler.class new file mode 100644 index 0000000..4c9c7ba Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NetHandler.class differ diff --git a/build/classes/java/main/net/minecraft/src/NetLoginHandler.class b/build/classes/java/main/net/minecraft/src/NetLoginHandler.class new file mode 100644 index 0000000..7158a4e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NetLoginHandler.class differ diff --git a/build/classes/java/main/net/minecraft/src/NetServerHandler.class b/build/classes/java/main/net/minecraft/src/NetServerHandler.class new file mode 100644 index 0000000..a9d9b90 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NetServerHandler.class differ diff --git a/build/classes/java/main/net/minecraft/src/NetworkListenThread.class b/build/classes/java/main/net/minecraft/src/NetworkListenThread.class new file mode 100644 index 0000000..96ee0b7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NetworkListenThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/NextTickListEntry.class b/build/classes/java/main/net/minecraft/src/NextTickListEntry.class new file mode 100644 index 0000000..3104deb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NextTickListEntry.class differ diff --git a/build/classes/java/main/net/minecraft/src/NibbleArray.class b/build/classes/java/main/net/minecraft/src/NibbleArray.class new file mode 100644 index 0000000..b9adbb1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NibbleArray.class differ diff --git a/build/classes/java/main/net/minecraft/src/NibbleArrayReader.class b/build/classes/java/main/net/minecraft/src/NibbleArrayReader.class new file mode 100644 index 0000000..a6c560d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NibbleArrayReader.class differ diff --git a/build/classes/java/main/net/minecraft/src/NoiseGenerator.class b/build/classes/java/main/net/minecraft/src/NoiseGenerator.class new file mode 100644 index 0000000..08b4e0f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NoiseGenerator.class differ diff --git a/build/classes/java/main/net/minecraft/src/NoiseGeneratorOctaves.class b/build/classes/java/main/net/minecraft/src/NoiseGeneratorOctaves.class new file mode 100644 index 0000000..fd85eaa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NoiseGeneratorOctaves.class differ diff --git a/build/classes/java/main/net/minecraft/src/NoiseGeneratorPerlin.class b/build/classes/java/main/net/minecraft/src/NoiseGeneratorPerlin.class new file mode 100644 index 0000000..b0fae0d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NoiseGeneratorPerlin.class differ diff --git a/build/classes/java/main/net/minecraft/src/NpcMerchant.class b/build/classes/java/main/net/minecraft/src/NpcMerchant.class new file mode 100644 index 0000000..a39242d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NpcMerchant.class differ diff --git a/build/classes/java/main/net/minecraft/src/NumberInvalidException.class b/build/classes/java/main/net/minecraft/src/NumberInvalidException.class new file mode 100644 index 0000000..2d9d34a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/NumberInvalidException.class differ diff --git a/build/classes/java/main/net/minecraft/src/OpenGlCapsChecker.class b/build/classes/java/main/net/minecraft/src/OpenGlCapsChecker.class new file mode 100644 index 0000000..6782f44 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/OpenGlCapsChecker.class differ diff --git a/build/classes/java/main/net/minecraft/src/OpenGlHelper.class b/build/classes/java/main/net/minecraft/src/OpenGlHelper.class new file mode 100644 index 0000000..d9b80b7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/OpenGlHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/PackMetadataSection.class b/build/classes/java/main/net/minecraft/src/PackMetadataSection.class new file mode 100644 index 0000000..d3a0d67 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PackMetadataSection.class differ diff --git a/build/classes/java/main/net/minecraft/src/PackMetadataSectionSerializer.class b/build/classes/java/main/net/minecraft/src/PackMetadataSectionSerializer.class new file mode 100644 index 0000000..8db0e4e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PackMetadataSectionSerializer.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet.class b/build/classes/java/main/net/minecraft/src/Packet.class new file mode 100644 index 0000000..4b20b38 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet0KeepAlive.class b/build/classes/java/main/net/minecraft/src/Packet0KeepAlive.class new file mode 100644 index 0000000..303123e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet0KeepAlive.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet100OpenWindow.class b/build/classes/java/main/net/minecraft/src/Packet100OpenWindow.class new file mode 100644 index 0000000..b5b26b9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet100OpenWindow.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet101CloseWindow.class b/build/classes/java/main/net/minecraft/src/Packet101CloseWindow.class new file mode 100644 index 0000000..039f1f8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet101CloseWindow.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet102WindowClick.class b/build/classes/java/main/net/minecraft/src/Packet102WindowClick.class new file mode 100644 index 0000000..845dc60 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet102WindowClick.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet103SetSlot.class b/build/classes/java/main/net/minecraft/src/Packet103SetSlot.class new file mode 100644 index 0000000..6d542dd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet103SetSlot.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet104WindowItems.class b/build/classes/java/main/net/minecraft/src/Packet104WindowItems.class new file mode 100644 index 0000000..d120d05 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet104WindowItems.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet105UpdateProgressbar.class b/build/classes/java/main/net/minecraft/src/Packet105UpdateProgressbar.class new file mode 100644 index 0000000..07dd780 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet105UpdateProgressbar.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet106Transaction.class b/build/classes/java/main/net/minecraft/src/Packet106Transaction.class new file mode 100644 index 0000000..548234e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet106Transaction.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet107CreativeSetSlot.class b/build/classes/java/main/net/minecraft/src/Packet107CreativeSetSlot.class new file mode 100644 index 0000000..41999a9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet107CreativeSetSlot.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet108EnchantItem.class b/build/classes/java/main/net/minecraft/src/Packet108EnchantItem.class new file mode 100644 index 0000000..6b93bb8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet108EnchantItem.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet10Flying.class b/build/classes/java/main/net/minecraft/src/Packet10Flying.class new file mode 100644 index 0000000..db955a3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet10Flying.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet11PlayerPosition.class b/build/classes/java/main/net/minecraft/src/Packet11PlayerPosition.class new file mode 100644 index 0000000..2027015 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet11PlayerPosition.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet12PlayerLook.class b/build/classes/java/main/net/minecraft/src/Packet12PlayerLook.class new file mode 100644 index 0000000..6d0dda5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet12PlayerLook.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet130UpdateSign.class b/build/classes/java/main/net/minecraft/src/Packet130UpdateSign.class new file mode 100644 index 0000000..d1b3095 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet130UpdateSign.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet131MapData.class b/build/classes/java/main/net/minecraft/src/Packet131MapData.class new file mode 100644 index 0000000..2a5c0d9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet131MapData.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet132TileEntityData.class b/build/classes/java/main/net/minecraft/src/Packet132TileEntityData.class new file mode 100644 index 0000000..6c87e2d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet132TileEntityData.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet133TileEditorOpen.class b/build/classes/java/main/net/minecraft/src/Packet133TileEditorOpen.class new file mode 100644 index 0000000..6fcf8c5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet133TileEditorOpen.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet13PlayerLookMove.class b/build/classes/java/main/net/minecraft/src/Packet13PlayerLookMove.class new file mode 100644 index 0000000..64ba59b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet13PlayerLookMove.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet14BlockDig.class b/build/classes/java/main/net/minecraft/src/Packet14BlockDig.class new file mode 100644 index 0000000..fb67f3d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet14BlockDig.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet15Place.class b/build/classes/java/main/net/minecraft/src/Packet15Place.class new file mode 100644 index 0000000..f159c31 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet15Place.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet16BlockItemSwitch.class b/build/classes/java/main/net/minecraft/src/Packet16BlockItemSwitch.class new file mode 100644 index 0000000..aee1523 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet16BlockItemSwitch.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet17Sleep.class b/build/classes/java/main/net/minecraft/src/Packet17Sleep.class new file mode 100644 index 0000000..0a64b5d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet17Sleep.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet18Animation.class b/build/classes/java/main/net/minecraft/src/Packet18Animation.class new file mode 100644 index 0000000..593db0a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet18Animation.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet19EntityAction.class b/build/classes/java/main/net/minecraft/src/Packet19EntityAction.class new file mode 100644 index 0000000..798ac5a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet19EntityAction.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet1Login.class b/build/classes/java/main/net/minecraft/src/Packet1Login.class new file mode 100644 index 0000000..1676718 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet1Login.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet200Statistic.class b/build/classes/java/main/net/minecraft/src/Packet200Statistic.class new file mode 100644 index 0000000..0780c58 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet200Statistic.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet201PlayerInfo.class b/build/classes/java/main/net/minecraft/src/Packet201PlayerInfo.class new file mode 100644 index 0000000..7da04c1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet201PlayerInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet202PlayerAbilities.class b/build/classes/java/main/net/minecraft/src/Packet202PlayerAbilities.class new file mode 100644 index 0000000..e7682b1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet202PlayerAbilities.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet203AutoComplete.class b/build/classes/java/main/net/minecraft/src/Packet203AutoComplete.class new file mode 100644 index 0000000..bc567ce Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet203AutoComplete.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet204ClientInfo.class b/build/classes/java/main/net/minecraft/src/Packet204ClientInfo.class new file mode 100644 index 0000000..9fe0605 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet204ClientInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet205ClientCommand.class b/build/classes/java/main/net/minecraft/src/Packet205ClientCommand.class new file mode 100644 index 0000000..69cb006 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet205ClientCommand.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet206SetObjective.class b/build/classes/java/main/net/minecraft/src/Packet206SetObjective.class new file mode 100644 index 0000000..68394e1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet206SetObjective.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet207SetScore.class b/build/classes/java/main/net/minecraft/src/Packet207SetScore.class new file mode 100644 index 0000000..e3936f5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet207SetScore.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet208SetDisplayObjective.class b/build/classes/java/main/net/minecraft/src/Packet208SetDisplayObjective.class new file mode 100644 index 0000000..e0e3f82 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet208SetDisplayObjective.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet209SetPlayerTeam.class b/build/classes/java/main/net/minecraft/src/Packet209SetPlayerTeam.class new file mode 100644 index 0000000..642689e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet209SetPlayerTeam.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet20NamedEntitySpawn.class b/build/classes/java/main/net/minecraft/src/Packet20NamedEntitySpawn.class new file mode 100644 index 0000000..246cbcd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet20NamedEntitySpawn.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet22Collect.class b/build/classes/java/main/net/minecraft/src/Packet22Collect.class new file mode 100644 index 0000000..4076a04 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet22Collect.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet23VehicleSpawn.class b/build/classes/java/main/net/minecraft/src/Packet23VehicleSpawn.class new file mode 100644 index 0000000..63f3c1f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet23VehicleSpawn.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet24MobSpawn.class b/build/classes/java/main/net/minecraft/src/Packet24MobSpawn.class new file mode 100644 index 0000000..7e796b6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet24MobSpawn.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet250CustomPayload.class b/build/classes/java/main/net/minecraft/src/Packet250CustomPayload.class new file mode 100644 index 0000000..59e2638 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet250CustomPayload.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet252SharedKey.class b/build/classes/java/main/net/minecraft/src/Packet252SharedKey.class new file mode 100644 index 0000000..3c72870 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet252SharedKey.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet253ServerAuthData.class b/build/classes/java/main/net/minecraft/src/Packet253ServerAuthData.class new file mode 100644 index 0000000..f6d5341 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet253ServerAuthData.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet254ServerPing.class b/build/classes/java/main/net/minecraft/src/Packet254ServerPing.class new file mode 100644 index 0000000..d4a9f24 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet254ServerPing.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet255KickDisconnect.class b/build/classes/java/main/net/minecraft/src/Packet255KickDisconnect.class new file mode 100644 index 0000000..b562e1f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet255KickDisconnect.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet25EntityPainting.class b/build/classes/java/main/net/minecraft/src/Packet25EntityPainting.class new file mode 100644 index 0000000..f881e3c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet25EntityPainting.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet26EntityExpOrb.class b/build/classes/java/main/net/minecraft/src/Packet26EntityExpOrb.class new file mode 100644 index 0000000..776c995 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet26EntityExpOrb.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet27PlayerInput.class b/build/classes/java/main/net/minecraft/src/Packet27PlayerInput.class new file mode 100644 index 0000000..7cb7914 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet27PlayerInput.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet28EntityVelocity.class b/build/classes/java/main/net/minecraft/src/Packet28EntityVelocity.class new file mode 100644 index 0000000..1967970 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet28EntityVelocity.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet29DestroyEntity.class b/build/classes/java/main/net/minecraft/src/Packet29DestroyEntity.class new file mode 100644 index 0000000..feead7e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet29DestroyEntity.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet2ClientProtocol.class b/build/classes/java/main/net/minecraft/src/Packet2ClientProtocol.class new file mode 100644 index 0000000..fdaccf4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet2ClientProtocol.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet30Entity.class b/build/classes/java/main/net/minecraft/src/Packet30Entity.class new file mode 100644 index 0000000..742f901 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet30Entity.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet31RelEntityMove.class b/build/classes/java/main/net/minecraft/src/Packet31RelEntityMove.class new file mode 100644 index 0000000..bd35a78 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet31RelEntityMove.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet32EntityLook.class b/build/classes/java/main/net/minecraft/src/Packet32EntityLook.class new file mode 100644 index 0000000..0351ced Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet32EntityLook.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet33RelEntityMoveLook.class b/build/classes/java/main/net/minecraft/src/Packet33RelEntityMoveLook.class new file mode 100644 index 0000000..f17af50 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet33RelEntityMoveLook.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet34EntityTeleport.class b/build/classes/java/main/net/minecraft/src/Packet34EntityTeleport.class new file mode 100644 index 0000000..bc2c5cd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet34EntityTeleport.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet35EntityHeadRotation.class b/build/classes/java/main/net/minecraft/src/Packet35EntityHeadRotation.class new file mode 100644 index 0000000..109faf8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet35EntityHeadRotation.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet38EntityStatus.class b/build/classes/java/main/net/minecraft/src/Packet38EntityStatus.class new file mode 100644 index 0000000..680e7e6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet38EntityStatus.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet39AttachEntity.class b/build/classes/java/main/net/minecraft/src/Packet39AttachEntity.class new file mode 100644 index 0000000..306cfb3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet39AttachEntity.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet3Chat.class b/build/classes/java/main/net/minecraft/src/Packet3Chat.class new file mode 100644 index 0000000..08225f3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet3Chat.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet40EntityMetadata.class b/build/classes/java/main/net/minecraft/src/Packet40EntityMetadata.class new file mode 100644 index 0000000..3c8d40a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet40EntityMetadata.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet41EntityEffect.class b/build/classes/java/main/net/minecraft/src/Packet41EntityEffect.class new file mode 100644 index 0000000..40fd510 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet41EntityEffect.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet42RemoveEntityEffect.class b/build/classes/java/main/net/minecraft/src/Packet42RemoveEntityEffect.class new file mode 100644 index 0000000..af44d65 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet42RemoveEntityEffect.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet43Experience.class b/build/classes/java/main/net/minecraft/src/Packet43Experience.class new file mode 100644 index 0000000..3a94ea9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet43Experience.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet44UpdateAttributes.class b/build/classes/java/main/net/minecraft/src/Packet44UpdateAttributes.class new file mode 100644 index 0000000..d5a342d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet44UpdateAttributes.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet44UpdateAttributesSnapshot.class b/build/classes/java/main/net/minecraft/src/Packet44UpdateAttributesSnapshot.class new file mode 100644 index 0000000..53591e1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet44UpdateAttributesSnapshot.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet4UpdateTime.class b/build/classes/java/main/net/minecraft/src/Packet4UpdateTime.class new file mode 100644 index 0000000..7508752 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet4UpdateTime.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet51MapChunk.class b/build/classes/java/main/net/minecraft/src/Packet51MapChunk.class new file mode 100644 index 0000000..36431db Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet51MapChunk.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet51MapChunkData.class b/build/classes/java/main/net/minecraft/src/Packet51MapChunkData.class new file mode 100644 index 0000000..aad0a38 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet51MapChunkData.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet52MultiBlockChange.class b/build/classes/java/main/net/minecraft/src/Packet52MultiBlockChange.class new file mode 100644 index 0000000..0a6760b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet52MultiBlockChange.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet53BlockChange.class b/build/classes/java/main/net/minecraft/src/Packet53BlockChange.class new file mode 100644 index 0000000..6fe7dea Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet53BlockChange.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet54PlayNoteBlock.class b/build/classes/java/main/net/minecraft/src/Packet54PlayNoteBlock.class new file mode 100644 index 0000000..0cb180c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet54PlayNoteBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet55BlockDestroy.class b/build/classes/java/main/net/minecraft/src/Packet55BlockDestroy.class new file mode 100644 index 0000000..106cd96 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet55BlockDestroy.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet56MapChunks.class b/build/classes/java/main/net/minecraft/src/Packet56MapChunks.class new file mode 100644 index 0000000..65e945d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet56MapChunks.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet5PlayerInventory.class b/build/classes/java/main/net/minecraft/src/Packet5PlayerInventory.class new file mode 100644 index 0000000..e455340 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet5PlayerInventory.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet60Explosion.class b/build/classes/java/main/net/minecraft/src/Packet60Explosion.class new file mode 100644 index 0000000..270edd4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet60Explosion.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet61DoorChange.class b/build/classes/java/main/net/minecraft/src/Packet61DoorChange.class new file mode 100644 index 0000000..a3bb7ab Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet61DoorChange.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet62LevelSound.class b/build/classes/java/main/net/minecraft/src/Packet62LevelSound.class new file mode 100644 index 0000000..a6a8a6c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet62LevelSound.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet63WorldParticles.class b/build/classes/java/main/net/minecraft/src/Packet63WorldParticles.class new file mode 100644 index 0000000..a033a92 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet63WorldParticles.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet6SpawnPosition.class b/build/classes/java/main/net/minecraft/src/Packet6SpawnPosition.class new file mode 100644 index 0000000..9f32ec4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet6SpawnPosition.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet70GameEvent.class b/build/classes/java/main/net/minecraft/src/Packet70GameEvent.class new file mode 100644 index 0000000..90cb7a9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet70GameEvent.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet71Weather.class b/build/classes/java/main/net/minecraft/src/Packet71Weather.class new file mode 100644 index 0000000..2c6ceb5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet71Weather.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet7UseEntity.class b/build/classes/java/main/net/minecraft/src/Packet7UseEntity.class new file mode 100644 index 0000000..7c75b61 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet7UseEntity.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet8UpdateHealth.class b/build/classes/java/main/net/minecraft/src/Packet8UpdateHealth.class new file mode 100644 index 0000000..18f27d5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet8UpdateHealth.class differ diff --git a/build/classes/java/main/net/minecraft/src/Packet9Respawn.class b/build/classes/java/main/net/minecraft/src/Packet9Respawn.class new file mode 100644 index 0000000..89f0020 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Packet9Respawn.class differ diff --git a/build/classes/java/main/net/minecraft/src/PacketCount.class b/build/classes/java/main/net/minecraft/src/PacketCount.class new file mode 100644 index 0000000..df90127 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PacketCount.class differ diff --git a/build/classes/java/main/net/minecraft/src/Path.class b/build/classes/java/main/net/minecraft/src/Path.class new file mode 100644 index 0000000..e8281df Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Path.class differ diff --git a/build/classes/java/main/net/minecraft/src/PathEntity.class b/build/classes/java/main/net/minecraft/src/PathEntity.class new file mode 100644 index 0000000..02ba7dd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PathEntity.class differ diff --git a/build/classes/java/main/net/minecraft/src/PathFinder.class b/build/classes/java/main/net/minecraft/src/PathFinder.class new file mode 100644 index 0000000..e18d832 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PathFinder.class differ diff --git a/build/classes/java/main/net/minecraft/src/PathNavigate.class b/build/classes/java/main/net/minecraft/src/PathNavigate.class new file mode 100644 index 0000000..e165049 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PathNavigate.class differ diff --git a/build/classes/java/main/net/minecraft/src/PathPoint.class b/build/classes/java/main/net/minecraft/src/PathPoint.class new file mode 100644 index 0000000..810677c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PathPoint.class differ diff --git a/build/classes/java/main/net/minecraft/src/PendingInvite.class b/build/classes/java/main/net/minecraft/src/PendingInvite.class new file mode 100644 index 0000000..6e7ee64 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PendingInvite.class differ diff --git a/build/classes/java/main/net/minecraft/src/PendingInvitesList.class b/build/classes/java/main/net/minecraft/src/PendingInvitesList.class new file mode 100644 index 0000000..38ea2d2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PendingInvitesList.class differ diff --git a/build/classes/java/main/net/minecraft/src/PlayerCapabilities.class b/build/classes/java/main/net/minecraft/src/PlayerCapabilities.class new file mode 100644 index 0000000..e180ee8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PlayerCapabilities.class differ diff --git a/build/classes/java/main/net/minecraft/src/PlayerControllerMP.class b/build/classes/java/main/net/minecraft/src/PlayerControllerMP.class new file mode 100644 index 0000000..4adf76d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PlayerControllerMP.class differ diff --git a/build/classes/java/main/net/minecraft/src/PlayerInstance.class b/build/classes/java/main/net/minecraft/src/PlayerInstance.class new file mode 100644 index 0000000..c492b76 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PlayerInstance.class differ diff --git a/build/classes/java/main/net/minecraft/src/PlayerManager.class b/build/classes/java/main/net/minecraft/src/PlayerManager.class new file mode 100644 index 0000000..deb5876 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PlayerManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/PlayerNotFoundException.class b/build/classes/java/main/net/minecraft/src/PlayerNotFoundException.class new file mode 100644 index 0000000..e527439 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PlayerNotFoundException.class differ diff --git a/build/classes/java/main/net/minecraft/src/PlayerPositionComparator.class b/build/classes/java/main/net/minecraft/src/PlayerPositionComparator.class new file mode 100644 index 0000000..3032822 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PlayerPositionComparator.class differ diff --git a/build/classes/java/main/net/minecraft/src/PlayerSelector.class b/build/classes/java/main/net/minecraft/src/PlayerSelector.class new file mode 100644 index 0000000..a9e91ef Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PlayerSelector.class differ diff --git a/build/classes/java/main/net/minecraft/src/PlayerUsageSnooper.class b/build/classes/java/main/net/minecraft/src/PlayerUsageSnooper.class new file mode 100644 index 0000000..dcca6ae Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PlayerUsageSnooper.class differ diff --git a/build/classes/java/main/net/minecraft/src/PlayerUsageSnooperThread.class b/build/classes/java/main/net/minecraft/src/PlayerUsageSnooperThread.class new file mode 100644 index 0000000..ed981dc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PlayerUsageSnooperThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/PortalPosition.class b/build/classes/java/main/net/minecraft/src/PortalPosition.class new file mode 100644 index 0000000..fa2b4be Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PortalPosition.class differ diff --git a/build/classes/java/main/net/minecraft/src/PositionImpl.class b/build/classes/java/main/net/minecraft/src/PositionImpl.class new file mode 100644 index 0000000..2fc3c0d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PositionImpl.class differ diff --git a/build/classes/java/main/net/minecraft/src/PositionTextureVertex.class b/build/classes/java/main/net/minecraft/src/PositionTextureVertex.class new file mode 100644 index 0000000..1b85044 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PositionTextureVertex.class differ diff --git a/build/classes/java/main/net/minecraft/src/Potion.class b/build/classes/java/main/net/minecraft/src/Potion.class new file mode 100644 index 0000000..ba0cac5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Potion.class differ diff --git a/build/classes/java/main/net/minecraft/src/PotionAbsoption.class b/build/classes/java/main/net/minecraft/src/PotionAbsoption.class new file mode 100644 index 0000000..d17f51e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PotionAbsoption.class differ diff --git a/build/classes/java/main/net/minecraft/src/PotionAttackDamage.class b/build/classes/java/main/net/minecraft/src/PotionAttackDamage.class new file mode 100644 index 0000000..12d3ea1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PotionAttackDamage.class differ diff --git a/build/classes/java/main/net/minecraft/src/PotionEffect.class b/build/classes/java/main/net/minecraft/src/PotionEffect.class new file mode 100644 index 0000000..0cbcdb0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PotionEffect.class differ diff --git a/build/classes/java/main/net/minecraft/src/PotionHealth.class b/build/classes/java/main/net/minecraft/src/PotionHealth.class new file mode 100644 index 0000000..620fc88 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PotionHealth.class differ diff --git a/build/classes/java/main/net/minecraft/src/PotionHealthBoost.class b/build/classes/java/main/net/minecraft/src/PotionHealthBoost.class new file mode 100644 index 0000000..85f9706 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PotionHealthBoost.class differ diff --git a/build/classes/java/main/net/minecraft/src/PotionHelper.class b/build/classes/java/main/net/minecraft/src/PotionHelper.class new file mode 100644 index 0000000..dffbad0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PotionHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/Profiler.class b/build/classes/java/main/net/minecraft/src/Profiler.class new file mode 100644 index 0000000..b288724 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Profiler.class differ diff --git a/build/classes/java/main/net/minecraft/src/ProfilerResult.class b/build/classes/java/main/net/minecraft/src/ProfilerResult.class new file mode 100644 index 0000000..c9abe85 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ProfilerResult.class differ diff --git a/build/classes/java/main/net/minecraft/src/PropertyManager.class b/build/classes/java/main/net/minecraft/src/PropertyManager.class new file mode 100644 index 0000000..2b6a8a7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/PropertyManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/RConConsoleSource.class b/build/classes/java/main/net/minecraft/src/RConConsoleSource.class new file mode 100644 index 0000000..412f575 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RConConsoleSource.class differ diff --git a/build/classes/java/main/net/minecraft/src/RConOutputStream.class b/build/classes/java/main/net/minecraft/src/RConOutputStream.class new file mode 100644 index 0000000..db77cab Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RConOutputStream.class differ diff --git a/build/classes/java/main/net/minecraft/src/RConThreadBase.class b/build/classes/java/main/net/minecraft/src/RConThreadBase.class new file mode 100644 index 0000000..bdac55c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RConThreadBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/RConThreadClient.class b/build/classes/java/main/net/minecraft/src/RConThreadClient.class new file mode 100644 index 0000000..19719ee Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RConThreadClient.class differ diff --git a/build/classes/java/main/net/minecraft/src/RConThreadMain.class b/build/classes/java/main/net/minecraft/src/RConThreadMain.class new file mode 100644 index 0000000..9b2659c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RConThreadMain.class differ diff --git a/build/classes/java/main/net/minecraft/src/RConThreadQuery.class b/build/classes/java/main/net/minecraft/src/RConThreadQuery.class new file mode 100644 index 0000000..7e3817a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RConThreadQuery.class differ diff --git a/build/classes/java/main/net/minecraft/src/RConThreadQueryAuth.class b/build/classes/java/main/net/minecraft/src/RConThreadQueryAuth.class new file mode 100644 index 0000000..9e025ae Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RConThreadQueryAuth.class differ diff --git a/build/classes/java/main/net/minecraft/src/RConUtils.class b/build/classes/java/main/net/minecraft/src/RConUtils.class new file mode 100644 index 0000000..fb727bd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RConUtils.class differ diff --git a/build/classes/java/main/net/minecraft/src/RandomPositionGenerator.class b/build/classes/java/main/net/minecraft/src/RandomPositionGenerator.class new file mode 100644 index 0000000..74d650a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RandomPositionGenerator.class differ diff --git a/build/classes/java/main/net/minecraft/src/RangedAttribute.class b/build/classes/java/main/net/minecraft/src/RangedAttribute.class new file mode 100644 index 0000000..9945cf9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RangedAttribute.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipeFireworks.class b/build/classes/java/main/net/minecraft/src/RecipeFireworks.class new file mode 100644 index 0000000..3cc7104 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipeFireworks.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipeSorter.class b/build/classes/java/main/net/minecraft/src/RecipeSorter.class new file mode 100644 index 0000000..4573acc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipeSorter.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipesArmor.class b/build/classes/java/main/net/minecraft/src/RecipesArmor.class new file mode 100644 index 0000000..6e05b04 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipesArmor.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipesArmorDyes.class b/build/classes/java/main/net/minecraft/src/RecipesArmorDyes.class new file mode 100644 index 0000000..5ad4baf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipesArmorDyes.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipesCrafting.class b/build/classes/java/main/net/minecraft/src/RecipesCrafting.class new file mode 100644 index 0000000..b9ec280 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipesCrafting.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipesDyes.class b/build/classes/java/main/net/minecraft/src/RecipesDyes.class new file mode 100644 index 0000000..62b4061 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipesDyes.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipesFood.class b/build/classes/java/main/net/minecraft/src/RecipesFood.class new file mode 100644 index 0000000..d1f6109 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipesFood.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipesIngots.class b/build/classes/java/main/net/minecraft/src/RecipesIngots.class new file mode 100644 index 0000000..cbefeba Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipesIngots.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipesMapCloning.class b/build/classes/java/main/net/minecraft/src/RecipesMapCloning.class new file mode 100644 index 0000000..a6fefae Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipesMapCloning.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipesMapExtending.class b/build/classes/java/main/net/minecraft/src/RecipesMapExtending.class new file mode 100644 index 0000000..5334a43 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipesMapExtending.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipesTools.class b/build/classes/java/main/net/minecraft/src/RecipesTools.class new file mode 100644 index 0000000..d17d370 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipesTools.class differ diff --git a/build/classes/java/main/net/minecraft/src/RecipesWeapons.class b/build/classes/java/main/net/minecraft/src/RecipesWeapons.class new file mode 100644 index 0000000..4dd2797 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RecipesWeapons.class differ diff --git a/build/classes/java/main/net/minecraft/src/RedstoneUpdateInfo.class b/build/classes/java/main/net/minecraft/src/RedstoneUpdateInfo.class new file mode 100644 index 0000000..9567dbd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RedstoneUpdateInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/RegionFile.class b/build/classes/java/main/net/minecraft/src/RegionFile.class new file mode 100644 index 0000000..2cbdadf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RegionFile.class differ diff --git a/build/classes/java/main/net/minecraft/src/RegionFileCache.class b/build/classes/java/main/net/minecraft/src/RegionFileCache.class new file mode 100644 index 0000000..b0f240a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RegionFileCache.class differ diff --git a/build/classes/java/main/net/minecraft/src/RegionFileChunkBuffer.class b/build/classes/java/main/net/minecraft/src/RegionFileChunkBuffer.class new file mode 100644 index 0000000..e035ad3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RegionFileChunkBuffer.class differ diff --git a/build/classes/java/main/net/minecraft/src/RegistryDefaulted.class b/build/classes/java/main/net/minecraft/src/RegistryDefaulted.class new file mode 100644 index 0000000..00c4eb4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RegistryDefaulted.class differ diff --git a/build/classes/java/main/net/minecraft/src/RegistrySimple.class b/build/classes/java/main/net/minecraft/src/RegistrySimple.class new file mode 100644 index 0000000..9870267 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RegistrySimple.class differ diff --git a/build/classes/java/main/net/minecraft/src/ReloadableResourceManager.class b/build/classes/java/main/net/minecraft/src/ReloadableResourceManager.class new file mode 100644 index 0000000..c5f688d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ReloadableResourceManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/Render.class b/build/classes/java/main/net/minecraft/src/Render.class new file mode 100644 index 0000000..cf17409 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Render.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderArrow.class b/build/classes/java/main/net/minecraft/src/RenderArrow.class new file mode 100644 index 0000000..1870ab1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderArrow.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderBat.class b/build/classes/java/main/net/minecraft/src/RenderBat.class new file mode 100644 index 0000000..7e24d36 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderBat.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderBiped.class b/build/classes/java/main/net/minecraft/src/RenderBiped.class new file mode 100644 index 0000000..2b1dac6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderBiped.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderBlaze.class b/build/classes/java/main/net/minecraft/src/RenderBlaze.class new file mode 100644 index 0000000..9b1c496 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderBlaze.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderBlocks.class b/build/classes/java/main/net/minecraft/src/RenderBlocks.class new file mode 100644 index 0000000..a04c697 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderBlocks.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderBoat.class b/build/classes/java/main/net/minecraft/src/RenderBoat.class new file mode 100644 index 0000000..3c166cf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderBoat.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderCaveSpider.class b/build/classes/java/main/net/minecraft/src/RenderCaveSpider.class new file mode 100644 index 0000000..a3c3b5f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderCaveSpider.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderChicken.class b/build/classes/java/main/net/minecraft/src/RenderChicken.class new file mode 100644 index 0000000..4d26f75 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderChicken.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderCow.class b/build/classes/java/main/net/minecraft/src/RenderCow.class new file mode 100644 index 0000000..400afac Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderCow.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderCreeper.class b/build/classes/java/main/net/minecraft/src/RenderCreeper.class new file mode 100644 index 0000000..1536a79 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderCreeper.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderDragon.class b/build/classes/java/main/net/minecraft/src/RenderDragon.class new file mode 100644 index 0000000..92cb439 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderDragon.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderEnchantmentTable.class b/build/classes/java/main/net/minecraft/src/RenderEnchantmentTable.class new file mode 100644 index 0000000..0dcbb69 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderEnchantmentTable.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderEndPortal.class b/build/classes/java/main/net/minecraft/src/RenderEndPortal.class new file mode 100644 index 0000000..e172e84 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderEndPortal.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderEnderCrystal.class b/build/classes/java/main/net/minecraft/src/RenderEnderCrystal.class new file mode 100644 index 0000000..87ed65c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderEnderCrystal.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderEnderman.class b/build/classes/java/main/net/minecraft/src/RenderEnderman.class new file mode 100644 index 0000000..138ae02 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderEnderman.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderEntity.class b/build/classes/java/main/net/minecraft/src/RenderEntity.class new file mode 100644 index 0000000..84ddbe8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderEntity.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderFallingSand.class b/build/classes/java/main/net/minecraft/src/RenderFallingSand.class new file mode 100644 index 0000000..8fcf1d0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderFallingSand.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderFireball.class b/build/classes/java/main/net/minecraft/src/RenderFireball.class new file mode 100644 index 0000000..b5711ac Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderFireball.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderFish.class b/build/classes/java/main/net/minecraft/src/RenderFish.class new file mode 100644 index 0000000..1b7b023 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderFish.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderGhast.class b/build/classes/java/main/net/minecraft/src/RenderGhast.class new file mode 100644 index 0000000..e0065d6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderGhast.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderGiantZombie.class b/build/classes/java/main/net/minecraft/src/RenderGiantZombie.class new file mode 100644 index 0000000..97c93cd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderGiantZombie.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderGlobal.class b/build/classes/java/main/net/minecraft/src/RenderGlobal.class new file mode 100644 index 0000000..0d6f2b8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderGlobal.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderHelper.class b/build/classes/java/main/net/minecraft/src/RenderHelper.class new file mode 100644 index 0000000..0690261 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderHorse.class b/build/classes/java/main/net/minecraft/src/RenderHorse.class new file mode 100644 index 0000000..3c82668 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderHorse.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderIronGolem.class b/build/classes/java/main/net/minecraft/src/RenderIronGolem.class new file mode 100644 index 0000000..1f0a3ce Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderIronGolem.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderItem.class b/build/classes/java/main/net/minecraft/src/RenderItem.class new file mode 100644 index 0000000..8418dde Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderItem.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderItemFrame.class b/build/classes/java/main/net/minecraft/src/RenderItemFrame.class new file mode 100644 index 0000000..7ef06df Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderItemFrame.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderLeashKnot.class b/build/classes/java/main/net/minecraft/src/RenderLeashKnot.class new file mode 100644 index 0000000..a0a2c62 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderLeashKnot.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderLightningBolt.class b/build/classes/java/main/net/minecraft/src/RenderLightningBolt.class new file mode 100644 index 0000000..ccc33a2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderLightningBolt.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderList.class b/build/classes/java/main/net/minecraft/src/RenderList.class new file mode 100644 index 0000000..362c47c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderList.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderLiving.class b/build/classes/java/main/net/minecraft/src/RenderLiving.class new file mode 100644 index 0000000..55f8f6a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderLiving.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderMagmaCube.class b/build/classes/java/main/net/minecraft/src/RenderMagmaCube.class new file mode 100644 index 0000000..15239db Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderMagmaCube.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderManager.class b/build/classes/java/main/net/minecraft/src/RenderManager.class new file mode 100644 index 0000000..fa69757 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderMinecart.class b/build/classes/java/main/net/minecraft/src/RenderMinecart.class new file mode 100644 index 0000000..f193f8b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderMinecart.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderMinecartMobSpawner.class b/build/classes/java/main/net/minecraft/src/RenderMinecartMobSpawner.class new file mode 100644 index 0000000..079bc95 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderMinecartMobSpawner.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderMooshroom.class b/build/classes/java/main/net/minecraft/src/RenderMooshroom.class new file mode 100644 index 0000000..56abaf6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderMooshroom.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderOcelot.class b/build/classes/java/main/net/minecraft/src/RenderOcelot.class new file mode 100644 index 0000000..c27dbba Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderOcelot.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderPainting.class b/build/classes/java/main/net/minecraft/src/RenderPainting.class new file mode 100644 index 0000000..229f1e7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderPainting.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderPig.class b/build/classes/java/main/net/minecraft/src/RenderPig.class new file mode 100644 index 0000000..56bf677 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderPig.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderPlayer.class b/build/classes/java/main/net/minecraft/src/RenderPlayer.class new file mode 100644 index 0000000..8ec92aa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderPlayer.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderSheep.class b/build/classes/java/main/net/minecraft/src/RenderSheep.class new file mode 100644 index 0000000..a76d13e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderSheep.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderSilverfish.class b/build/classes/java/main/net/minecraft/src/RenderSilverfish.class new file mode 100644 index 0000000..ff38cb9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderSilverfish.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderSkeleton.class b/build/classes/java/main/net/minecraft/src/RenderSkeleton.class new file mode 100644 index 0000000..6cbfeb0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderSkeleton.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderSlime.class b/build/classes/java/main/net/minecraft/src/RenderSlime.class new file mode 100644 index 0000000..7c44167 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderSlime.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderSnowMan.class b/build/classes/java/main/net/minecraft/src/RenderSnowMan.class new file mode 100644 index 0000000..c8ba42d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderSnowMan.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderSnowball.class b/build/classes/java/main/net/minecraft/src/RenderSnowball.class new file mode 100644 index 0000000..60c6ab5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderSnowball.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderSorter.class b/build/classes/java/main/net/minecraft/src/RenderSorter.class new file mode 100644 index 0000000..937c6a3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderSorter.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderSpider.class b/build/classes/java/main/net/minecraft/src/RenderSpider.class new file mode 100644 index 0000000..538d445 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderSpider.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderSquid.class b/build/classes/java/main/net/minecraft/src/RenderSquid.class new file mode 100644 index 0000000..5c203f4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderSquid.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderTNTPrimed.class b/build/classes/java/main/net/minecraft/src/RenderTNTPrimed.class new file mode 100644 index 0000000..f260798 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderTNTPrimed.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderTntMinecart.class b/build/classes/java/main/net/minecraft/src/RenderTntMinecart.class new file mode 100644 index 0000000..cbeb27f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderTntMinecart.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderVillager.class b/build/classes/java/main/net/minecraft/src/RenderVillager.class new file mode 100644 index 0000000..35b3d40 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderVillager.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderWitch.class b/build/classes/java/main/net/minecraft/src/RenderWitch.class new file mode 100644 index 0000000..c42ddf8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderWitch.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderWither.class b/build/classes/java/main/net/minecraft/src/RenderWither.class new file mode 100644 index 0000000..947256a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderWither.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderWitherSkull.class b/build/classes/java/main/net/minecraft/src/RenderWitherSkull.class new file mode 100644 index 0000000..427d736 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderWitherSkull.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderWolf.class b/build/classes/java/main/net/minecraft/src/RenderWolf.class new file mode 100644 index 0000000..3fc0404 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderWolf.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderXPOrb.class b/build/classes/java/main/net/minecraft/src/RenderXPOrb.class new file mode 100644 index 0000000..b1a6230 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderXPOrb.class differ diff --git a/build/classes/java/main/net/minecraft/src/RenderZombie.class b/build/classes/java/main/net/minecraft/src/RenderZombie.class new file mode 100644 index 0000000..3e09e4b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RenderZombie.class differ diff --git a/build/classes/java/main/net/minecraft/src/RendererLivingEntity.class b/build/classes/java/main/net/minecraft/src/RendererLivingEntity.class new file mode 100644 index 0000000..67a53b4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RendererLivingEntity.class differ diff --git a/build/classes/java/main/net/minecraft/src/ReportedException.class b/build/classes/java/main/net/minecraft/src/ReportedException.class new file mode 100644 index 0000000..033e4ee Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ReportedException.class differ diff --git a/build/classes/java/main/net/minecraft/src/Request.class b/build/classes/java/main/net/minecraft/src/Request.class new file mode 100644 index 0000000..6cabf8e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Request.class differ diff --git a/build/classes/java/main/net/minecraft/src/RequestDelete.class b/build/classes/java/main/net/minecraft/src/RequestDelete.class new file mode 100644 index 0000000..b7f29f1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RequestDelete.class differ diff --git a/build/classes/java/main/net/minecraft/src/RequestGet.class b/build/classes/java/main/net/minecraft/src/RequestGet.class new file mode 100644 index 0000000..574868d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RequestGet.class differ diff --git a/build/classes/java/main/net/minecraft/src/RequestPost.class b/build/classes/java/main/net/minecraft/src/RequestPost.class new file mode 100644 index 0000000..5f0618a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RequestPost.class differ diff --git a/build/classes/java/main/net/minecraft/src/RequestPut.class b/build/classes/java/main/net/minecraft/src/RequestPut.class new file mode 100644 index 0000000..fa74775 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RequestPut.class differ diff --git a/build/classes/java/main/net/minecraft/src/Resource.class b/build/classes/java/main/net/minecraft/src/Resource.class new file mode 100644 index 0000000..0bdc696 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Resource.class differ diff --git a/build/classes/java/main/net/minecraft/src/ResourceLocation.class b/build/classes/java/main/net/minecraft/src/ResourceLocation.class new file mode 100644 index 0000000..f651227 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ResourceLocation.class differ diff --git a/build/classes/java/main/net/minecraft/src/ResourceManager.class b/build/classes/java/main/net/minecraft/src/ResourceManager.class new file mode 100644 index 0000000..3a2057f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ResourceManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/ResourceManagerReloadListener.class b/build/classes/java/main/net/minecraft/src/ResourceManagerReloadListener.class new file mode 100644 index 0000000..8d3bb77 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ResourceManagerReloadListener.class differ diff --git a/build/classes/java/main/net/minecraft/src/ResourcePack.class b/build/classes/java/main/net/minecraft/src/ResourcePack.class new file mode 100644 index 0000000..90536eb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ResourcePack.class differ diff --git a/build/classes/java/main/net/minecraft/src/ResourcePackFileNotFoundException.class b/build/classes/java/main/net/minecraft/src/ResourcePackFileNotFoundException.class new file mode 100644 index 0000000..ea14596 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ResourcePackFileNotFoundException.class differ diff --git a/build/classes/java/main/net/minecraft/src/ResourcePackRepository.class b/build/classes/java/main/net/minecraft/src/ResourcePackRepository.class new file mode 100644 index 0000000..9508333 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ResourcePackRepository.class differ diff --git a/build/classes/java/main/net/minecraft/src/ResourcePackRepositoryEntry.class b/build/classes/java/main/net/minecraft/src/ResourcePackRepositoryEntry.class new file mode 100644 index 0000000..da240dd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ResourcePackRepositoryEntry.class differ diff --git a/build/classes/java/main/net/minecraft/src/ResourcePackRepositoryFilter.class b/build/classes/java/main/net/minecraft/src/ResourcePackRepositoryFilter.class new file mode 100644 index 0000000..cb43c13 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ResourcePackRepositoryFilter.class differ diff --git a/build/classes/java/main/net/minecraft/src/RunnableTitleScreen.class b/build/classes/java/main/net/minecraft/src/RunnableTitleScreen.class new file mode 100644 index 0000000..46ef5f4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/RunnableTitleScreen.class differ diff --git a/build/classes/java/main/net/minecraft/src/SaveFormatComparator.class b/build/classes/java/main/net/minecraft/src/SaveFormatComparator.class new file mode 100644 index 0000000..fd8535f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SaveFormatComparator.class differ diff --git a/build/classes/java/main/net/minecraft/src/SaveFormatOld.class b/build/classes/java/main/net/minecraft/src/SaveFormatOld.class new file mode 100644 index 0000000..afd79b1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SaveFormatOld.class differ diff --git a/build/classes/java/main/net/minecraft/src/SaveHandler.class b/build/classes/java/main/net/minecraft/src/SaveHandler.class new file mode 100644 index 0000000..ba88446 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SaveHandler.class differ diff --git a/build/classes/java/main/net/minecraft/src/SaveHandlerMP.class b/build/classes/java/main/net/minecraft/src/SaveHandlerMP.class new file mode 100644 index 0000000..104cdb8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SaveHandlerMP.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScaledResolution.class b/build/classes/java/main/net/minecraft/src/ScaledResolution.class new file mode 100644 index 0000000..45e8c98 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScaledResolution.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScheduledSound.class b/build/classes/java/main/net/minecraft/src/ScheduledSound.class new file mode 100644 index 0000000..daf235d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScheduledSound.class differ diff --git a/build/classes/java/main/net/minecraft/src/Score.class b/build/classes/java/main/net/minecraft/src/Score.class new file mode 100644 index 0000000..e7c3691 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Score.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScoreComparator.class b/build/classes/java/main/net/minecraft/src/ScoreComparator.class new file mode 100644 index 0000000..980c7cc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScoreComparator.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScoreDummyCriteria.class b/build/classes/java/main/net/minecraft/src/ScoreDummyCriteria.class new file mode 100644 index 0000000..b74f8b1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScoreDummyCriteria.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScoreHealthCriteria.class b/build/classes/java/main/net/minecraft/src/ScoreHealthCriteria.class new file mode 100644 index 0000000..5c55d12 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScoreHealthCriteria.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScoreObjective.class b/build/classes/java/main/net/minecraft/src/ScoreObjective.class new file mode 100644 index 0000000..28b6bba Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScoreObjective.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScoreObjectiveCriteria.class b/build/classes/java/main/net/minecraft/src/ScoreObjectiveCriteria.class new file mode 100644 index 0000000..d708e5d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScoreObjectiveCriteria.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScorePlayerTeam.class b/build/classes/java/main/net/minecraft/src/ScorePlayerTeam.class new file mode 100644 index 0000000..5420a1d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScorePlayerTeam.class differ diff --git a/build/classes/java/main/net/minecraft/src/Scoreboard.class b/build/classes/java/main/net/minecraft/src/Scoreboard.class new file mode 100644 index 0000000..e941870 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Scoreboard.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScoreboardSaveData.class b/build/classes/java/main/net/minecraft/src/ScoreboardSaveData.class new file mode 100644 index 0000000..3cab54b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScoreboardSaveData.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScreenChatOptions.class b/build/classes/java/main/net/minecraft/src/ScreenChatOptions.class new file mode 100644 index 0000000..d71c0a9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScreenChatOptions.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScreenShotHelper.class b/build/classes/java/main/net/minecraft/src/ScreenShotHelper.class new file mode 100644 index 0000000..972db5c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScreenShotHelper.class differ diff --git a/build/classes/java/main/net/minecraft/src/ScreenWithCallback.class b/build/classes/java/main/net/minecraft/src/ScreenWithCallback.class new file mode 100644 index 0000000..dd75fc3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ScreenWithCallback.class differ diff --git a/build/classes/java/main/net/minecraft/src/SelectionListBase.class b/build/classes/java/main/net/minecraft/src/SelectionListBase.class new file mode 100644 index 0000000..1240196 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SelectionListBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/SelectionListInvited.class b/build/classes/java/main/net/minecraft/src/SelectionListInvited.class new file mode 100644 index 0000000..15bd688 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SelectionListInvited.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerAddress.class b/build/classes/java/main/net/minecraft/src/ServerAddress.class new file mode 100644 index 0000000..56651e3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerAddress.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerBlockEvent.class b/build/classes/java/main/net/minecraft/src/ServerBlockEvent.class new file mode 100644 index 0000000..c2180ac Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerBlockEvent.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerBlockEventList.class b/build/classes/java/main/net/minecraft/src/ServerBlockEventList.class new file mode 100644 index 0000000..fc2e0bb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerBlockEventList.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerCommand.class b/build/classes/java/main/net/minecraft/src/ServerCommand.class new file mode 100644 index 0000000..84b22e3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerCommand.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerCommandManager.class b/build/classes/java/main/net/minecraft/src/ServerCommandManager.class new file mode 100644 index 0000000..71afb3c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerCommandManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerCommandScoreboard.class b/build/classes/java/main/net/minecraft/src/ServerCommandScoreboard.class new file mode 100644 index 0000000..e332a2d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerCommandScoreboard.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerCommandTestFor.class b/build/classes/java/main/net/minecraft/src/ServerCommandTestFor.class new file mode 100644 index 0000000..d2010b0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerCommandTestFor.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerConfigurationManager.class b/build/classes/java/main/net/minecraft/src/ServerConfigurationManager.class new file mode 100644 index 0000000..1cbc917 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerConfigurationManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerData.class b/build/classes/java/main/net/minecraft/src/ServerData.class new file mode 100644 index 0000000..a951e53 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerData.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerList.class b/build/classes/java/main/net/minecraft/src/ServerList.class new file mode 100644 index 0000000..50027d8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerList.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerListenThread.class b/build/classes/java/main/net/minecraft/src/ServerListenThread.class new file mode 100644 index 0000000..b596d7d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerListenThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServerScoreboard.class b/build/classes/java/main/net/minecraft/src/ServerScoreboard.class new file mode 100644 index 0000000..e48d62a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServerScoreboard.class differ diff --git a/build/classes/java/main/net/minecraft/src/ServersideAttributeMap.class b/build/classes/java/main/net/minecraft/src/ServersideAttributeMap.class new file mode 100644 index 0000000..2ce86ff Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ServersideAttributeMap.class differ diff --git a/build/classes/java/main/net/minecraft/src/Session.class b/build/classes/java/main/net/minecraft/src/Session.class new file mode 100644 index 0000000..cbb884b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Session.class differ diff --git a/build/classes/java/main/net/minecraft/src/ShapedRecipes.class b/build/classes/java/main/net/minecraft/src/ShapedRecipes.class new file mode 100644 index 0000000..b2c8096 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ShapedRecipes.class differ diff --git a/build/classes/java/main/net/minecraft/src/ShapelessRecipes.class b/build/classes/java/main/net/minecraft/src/ShapelessRecipes.class new file mode 100644 index 0000000..76111cc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ShapelessRecipes.class differ diff --git a/build/classes/java/main/net/minecraft/src/SharedMonsterAttributes.class b/build/classes/java/main/net/minecraft/src/SharedMonsterAttributes.class new file mode 100644 index 0000000..d81e0fc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SharedMonsterAttributes.class differ diff --git a/build/classes/java/main/net/minecraft/src/SimpleReloadableResourceManager.class b/build/classes/java/main/net/minecraft/src/SimpleReloadableResourceManager.class new file mode 100644 index 0000000..256da10 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SimpleReloadableResourceManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/SimpleReloadableResourceManagerINNER1.class b/build/classes/java/main/net/minecraft/src/SimpleReloadableResourceManagerINNER1.class new file mode 100644 index 0000000..a168fbd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SimpleReloadableResourceManagerINNER1.class differ diff --git a/build/classes/java/main/net/minecraft/src/SimpleResource.class b/build/classes/java/main/net/minecraft/src/SimpleResource.class new file mode 100644 index 0000000..e39bf16 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SimpleResource.class differ diff --git a/build/classes/java/main/net/minecraft/src/SimpleTexture.class b/build/classes/java/main/net/minecraft/src/SimpleTexture.class new file mode 100644 index 0000000..b7dd841 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SimpleTexture.class differ diff --git a/build/classes/java/main/net/minecraft/src/Slot.class b/build/classes/java/main/net/minecraft/src/Slot.class new file mode 100644 index 0000000..575fef8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Slot.class differ diff --git a/build/classes/java/main/net/minecraft/src/SlotArmor.class b/build/classes/java/main/net/minecraft/src/SlotArmor.class new file mode 100644 index 0000000..9c56534 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SlotArmor.class differ diff --git a/build/classes/java/main/net/minecraft/src/SlotBeacon.class b/build/classes/java/main/net/minecraft/src/SlotBeacon.class new file mode 100644 index 0000000..6a0425b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SlotBeacon.class differ diff --git a/build/classes/java/main/net/minecraft/src/SlotBrewingStandIngredient.class b/build/classes/java/main/net/minecraft/src/SlotBrewingStandIngredient.class new file mode 100644 index 0000000..df4f97d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SlotBrewingStandIngredient.class differ diff --git a/build/classes/java/main/net/minecraft/src/SlotBrewingStandPotion.class b/build/classes/java/main/net/minecraft/src/SlotBrewingStandPotion.class new file mode 100644 index 0000000..f3dc9f8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SlotBrewingStandPotion.class differ diff --git a/build/classes/java/main/net/minecraft/src/SlotCrafting.class b/build/classes/java/main/net/minecraft/src/SlotCrafting.class new file mode 100644 index 0000000..ee2ed44 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SlotCrafting.class differ diff --git a/build/classes/java/main/net/minecraft/src/SlotCreativeInventory.class b/build/classes/java/main/net/minecraft/src/SlotCreativeInventory.class new file mode 100644 index 0000000..240b5a7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SlotCreativeInventory.class differ diff --git a/build/classes/java/main/net/minecraft/src/SlotEnchantment.class b/build/classes/java/main/net/minecraft/src/SlotEnchantment.class new file mode 100644 index 0000000..03b96dc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SlotEnchantment.class differ diff --git a/build/classes/java/main/net/minecraft/src/SlotEnchantmentTable.class b/build/classes/java/main/net/minecraft/src/SlotEnchantmentTable.class new file mode 100644 index 0000000..8b5f402 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SlotEnchantmentTable.class differ diff --git a/build/classes/java/main/net/minecraft/src/SlotFurnace.class b/build/classes/java/main/net/minecraft/src/SlotFurnace.class new file mode 100644 index 0000000..b34404b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SlotFurnace.class differ diff --git a/build/classes/java/main/net/minecraft/src/SlotMerchantResult.class b/build/classes/java/main/net/minecraft/src/SlotMerchantResult.class new file mode 100644 index 0000000..2272424 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SlotMerchantResult.class differ diff --git a/build/classes/java/main/net/minecraft/src/SorterStatsBlock.class b/build/classes/java/main/net/minecraft/src/SorterStatsBlock.class new file mode 100644 index 0000000..328a6a0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SorterStatsBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/SorterStatsItem.class b/build/classes/java/main/net/minecraft/src/SorterStatsItem.class new file mode 100644 index 0000000..155433c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SorterStatsItem.class differ diff --git a/build/classes/java/main/net/minecraft/src/SoundManager.class b/build/classes/java/main/net/minecraft/src/SoundManager.class new file mode 100644 index 0000000..2fb7f3f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SoundManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/SoundManagerINNER1.class b/build/classes/java/main/net/minecraft/src/SoundManagerINNER1.class new file mode 100644 index 0000000..a75a47c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SoundManagerINNER1.class differ diff --git a/build/classes/java/main/net/minecraft/src/SoundPool.class b/build/classes/java/main/net/minecraft/src/SoundPool.class new file mode 100644 index 0000000..ace6531 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SoundPool.class differ diff --git a/build/classes/java/main/net/minecraft/src/SoundPoolEntry.class b/build/classes/java/main/net/minecraft/src/SoundPoolEntry.class new file mode 100644 index 0000000..3756b7a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SoundPoolEntry.class differ diff --git a/build/classes/java/main/net/minecraft/src/SoundPoolProtocolHandler.class b/build/classes/java/main/net/minecraft/src/SoundPoolProtocolHandler.class new file mode 100644 index 0000000..57792af Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SoundPoolProtocolHandler.class differ diff --git a/build/classes/java/main/net/minecraft/src/SoundPoolURLConnection.class b/build/classes/java/main/net/minecraft/src/SoundPoolURLConnection.class new file mode 100644 index 0000000..eb5aabe Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SoundPoolURLConnection.class differ diff --git a/build/classes/java/main/net/minecraft/src/SoundUpdaterMinecart.class b/build/classes/java/main/net/minecraft/src/SoundUpdaterMinecart.class new file mode 100644 index 0000000..b34804b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SoundUpdaterMinecart.class differ diff --git a/build/classes/java/main/net/minecraft/src/SpawnListEntry.class b/build/classes/java/main/net/minecraft/src/SpawnListEntry.class new file mode 100644 index 0000000..7d7544e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SpawnListEntry.class differ diff --git a/build/classes/java/main/net/minecraft/src/SpawnerAnimals.class b/build/classes/java/main/net/minecraft/src/SpawnerAnimals.class new file mode 100644 index 0000000..a08fb65 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SpawnerAnimals.class differ diff --git a/build/classes/java/main/net/minecraft/src/SpiderEffectsGroupData.class b/build/classes/java/main/net/minecraft/src/SpiderEffectsGroupData.class new file mode 100644 index 0000000..88fd230 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SpiderEffectsGroupData.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatBase.class b/build/classes/java/main/net/minecraft/src/StatBase.class new file mode 100644 index 0000000..8ac3ed2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatBasic.class b/build/classes/java/main/net/minecraft/src/StatBasic.class new file mode 100644 index 0000000..200e728 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatBasic.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatCollector.class b/build/classes/java/main/net/minecraft/src/StatCollector.class new file mode 100644 index 0000000..287b702 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatCollector.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatCrafting.class b/build/classes/java/main/net/minecraft/src/StatCrafting.class new file mode 100644 index 0000000..e0fd488 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatCrafting.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatFileWriter.class b/build/classes/java/main/net/minecraft/src/StatFileWriter.class new file mode 100644 index 0000000..779d6f0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatFileWriter.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatList.class b/build/classes/java/main/net/minecraft/src/StatList.class new file mode 100644 index 0000000..4b7a292 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatList.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatPlaceholder.class b/build/classes/java/main/net/minecraft/src/StatPlaceholder.class new file mode 100644 index 0000000..7a5bd28 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatPlaceholder.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatStringFormatKeyInv.class b/build/classes/java/main/net/minecraft/src/StatStringFormatKeyInv.class new file mode 100644 index 0000000..2afe166 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatStringFormatKeyInv.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatTypeDistance.class b/build/classes/java/main/net/minecraft/src/StatTypeDistance.class new file mode 100644 index 0000000..055a535 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatTypeDistance.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatTypeFloat.class b/build/classes/java/main/net/minecraft/src/StatTypeFloat.class new file mode 100644 index 0000000..35bd4fa Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatTypeFloat.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatTypeSimple.class b/build/classes/java/main/net/minecraft/src/StatTypeSimple.class new file mode 100644 index 0000000..972bfed Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatTypeSimple.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatTypeTime.class b/build/classes/java/main/net/minecraft/src/StatTypeTime.class new file mode 100644 index 0000000..6345efb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatTypeTime.class differ diff --git a/build/classes/java/main/net/minecraft/src/StatsSyncher.class b/build/classes/java/main/net/minecraft/src/StatsSyncher.class new file mode 100644 index 0000000..d0bac0c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StatsSyncher.class differ diff --git a/build/classes/java/main/net/minecraft/src/StepSound.class b/build/classes/java/main/net/minecraft/src/StepSound.class new file mode 100644 index 0000000..514d601 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StepSound.class differ diff --git a/build/classes/java/main/net/minecraft/src/StepSoundAnvil.class b/build/classes/java/main/net/minecraft/src/StepSoundAnvil.class new file mode 100644 index 0000000..28e9940 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StepSoundAnvil.class differ diff --git a/build/classes/java/main/net/minecraft/src/StepSoundSand.class b/build/classes/java/main/net/minecraft/src/StepSoundSand.class new file mode 100644 index 0000000..ef227ed Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StepSoundSand.class differ diff --git a/build/classes/java/main/net/minecraft/src/StepSoundStone.class b/build/classes/java/main/net/minecraft/src/StepSoundStone.class new file mode 100644 index 0000000..265bc2e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StepSoundStone.class differ diff --git a/build/classes/java/main/net/minecraft/src/StitchHolder.class b/build/classes/java/main/net/minecraft/src/StitchHolder.class new file mode 100644 index 0000000..1301772 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StitchHolder.class differ diff --git a/build/classes/java/main/net/minecraft/src/StitchSlot.class b/build/classes/java/main/net/minecraft/src/StitchSlot.class new file mode 100644 index 0000000..63e1038 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StitchSlot.class differ diff --git a/build/classes/java/main/net/minecraft/src/Stitcher.class b/build/classes/java/main/net/minecraft/src/Stitcher.class new file mode 100644 index 0000000..b8c2714 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Stitcher.class differ diff --git a/build/classes/java/main/net/minecraft/src/StitcherException.class b/build/classes/java/main/net/minecraft/src/StitcherException.class new file mode 100644 index 0000000..32a5139 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StitcherException.class differ diff --git a/build/classes/java/main/net/minecraft/src/StringTranslate.class b/build/classes/java/main/net/minecraft/src/StringTranslate.class new file mode 100644 index 0000000..9c22742 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StringTranslate.class differ diff --git a/build/classes/java/main/net/minecraft/src/StringUtils.class b/build/classes/java/main/net/minecraft/src/StringUtils.class new file mode 100644 index 0000000..ba81bb7 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StringUtils.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureBoundingBox.class b/build/classes/java/main/net/minecraft/src/StructureBoundingBox.class new file mode 100644 index 0000000..d4bf9ad Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureBoundingBox.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureComponent.class b/build/classes/java/main/net/minecraft/src/StructureComponent.class new file mode 100644 index 0000000..0ace1f4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureComponent.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureMineshaftPieces.class b/build/classes/java/main/net/minecraft/src/StructureMineshaftPieces.class new file mode 100644 index 0000000..20c6deb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureMineshaftPieces.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureMineshaftStart.class b/build/classes/java/main/net/minecraft/src/StructureMineshaftStart.class new file mode 100644 index 0000000..a0300ba Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureMineshaftStart.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureNetherBridgePieceWeight.class b/build/classes/java/main/net/minecraft/src/StructureNetherBridgePieceWeight.class new file mode 100644 index 0000000..4509f02 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureNetherBridgePieceWeight.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureNetherBridgePieces.class b/build/classes/java/main/net/minecraft/src/StructureNetherBridgePieces.class new file mode 100644 index 0000000..c0f63d5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureNetherBridgePieces.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureNetherBridgeStart.class b/build/classes/java/main/net/minecraft/src/StructureNetherBridgeStart.class new file mode 100644 index 0000000..e22a5a2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureNetherBridgeStart.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructurePieceBlockSelector.class b/build/classes/java/main/net/minecraft/src/StructurePieceBlockSelector.class new file mode 100644 index 0000000..b4ee2b3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructurePieceBlockSelector.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureScatteredFeatureStart.class b/build/classes/java/main/net/minecraft/src/StructureScatteredFeatureStart.class new file mode 100644 index 0000000..59b59b3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureScatteredFeatureStart.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureScatteredFeatureStones.class b/build/classes/java/main/net/minecraft/src/StructureScatteredFeatureStones.class new file mode 100644 index 0000000..c5f7edc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureScatteredFeatureStones.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureStart.class b/build/classes/java/main/net/minecraft/src/StructureStart.class new file mode 100644 index 0000000..a6819df Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureStart.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureStrongholdPieceWeight.class b/build/classes/java/main/net/minecraft/src/StructureStrongholdPieceWeight.class new file mode 100644 index 0000000..527d99d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureStrongholdPieceWeight.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureStrongholdPieceWeight2.class b/build/classes/java/main/net/minecraft/src/StructureStrongholdPieceWeight2.class new file mode 100644 index 0000000..f269951 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureStrongholdPieceWeight2.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureStrongholdPieceWeight3.class b/build/classes/java/main/net/minecraft/src/StructureStrongholdPieceWeight3.class new file mode 100644 index 0000000..83f2969 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureStrongholdPieceWeight3.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureStrongholdPieces.class b/build/classes/java/main/net/minecraft/src/StructureStrongholdPieces.class new file mode 100644 index 0000000..7a727bf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureStrongholdPieces.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureStrongholdStart.class b/build/classes/java/main/net/minecraft/src/StructureStrongholdStart.class new file mode 100644 index 0000000..3a3ba80 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureStrongholdStart.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureStrongholdStones.class b/build/classes/java/main/net/minecraft/src/StructureStrongholdStones.class new file mode 100644 index 0000000..49c634f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureStrongholdStones.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureVillagePieceWeight.class b/build/classes/java/main/net/minecraft/src/StructureVillagePieceWeight.class new file mode 100644 index 0000000..c86c7f0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureVillagePieceWeight.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureVillagePieces.class b/build/classes/java/main/net/minecraft/src/StructureVillagePieces.class new file mode 100644 index 0000000..51cfdc6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureVillagePieces.class differ diff --git a/build/classes/java/main/net/minecraft/src/StructureVillageStart.class b/build/classes/java/main/net/minecraft/src/StructureVillageStart.class new file mode 100644 index 0000000..11e3d8b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/StructureVillageStart.class differ diff --git a/build/classes/java/main/net/minecraft/src/SyntaxErrorException.class b/build/classes/java/main/net/minecraft/src/SyntaxErrorException.class new file mode 100644 index 0000000..360c837 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/SyntaxErrorException.class differ diff --git a/build/classes/java/main/net/minecraft/src/TaskLongRunning.class b/build/classes/java/main/net/minecraft/src/TaskLongRunning.class new file mode 100644 index 0000000..6e410d8 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TaskLongRunning.class differ diff --git a/build/classes/java/main/net/minecraft/src/TaskOnlineConnect.class b/build/classes/java/main/net/minecraft/src/TaskOnlineConnect.class new file mode 100644 index 0000000..fbb1446 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TaskOnlineConnect.class differ diff --git a/build/classes/java/main/net/minecraft/src/TaskResetWorld.class b/build/classes/java/main/net/minecraft/src/TaskResetWorld.class new file mode 100644 index 0000000..c7d8715 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TaskResetWorld.class differ diff --git a/build/classes/java/main/net/minecraft/src/TaskWorldCreation.class b/build/classes/java/main/net/minecraft/src/TaskWorldCreation.class new file mode 100644 index 0000000..f118fd6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TaskWorldCreation.class differ diff --git a/build/classes/java/main/net/minecraft/src/TcpConnection.class b/build/classes/java/main/net/minecraft/src/TcpConnection.class new file mode 100644 index 0000000..377f50b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TcpConnection.class differ diff --git a/build/classes/java/main/net/minecraft/src/TcpMasterThread.class b/build/classes/java/main/net/minecraft/src/TcpMasterThread.class new file mode 100644 index 0000000..cde9d56 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TcpMasterThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/TcpMonitorThread.class b/build/classes/java/main/net/minecraft/src/TcpMonitorThread.class new file mode 100644 index 0000000..1712bab Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TcpMonitorThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/TcpReaderThread.class b/build/classes/java/main/net/minecraft/src/TcpReaderThread.class new file mode 100644 index 0000000..9bc8206 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TcpReaderThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/TcpWriterThread.class b/build/classes/java/main/net/minecraft/src/TcpWriterThread.class new file mode 100644 index 0000000..76edc70 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TcpWriterThread.class differ diff --git a/build/classes/java/main/net/minecraft/src/Team.class b/build/classes/java/main/net/minecraft/src/Team.class new file mode 100644 index 0000000..0660356 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Team.class differ diff --git a/build/classes/java/main/net/minecraft/src/Teleporter.class b/build/classes/java/main/net/minecraft/src/Teleporter.class new file mode 100644 index 0000000..745457c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Teleporter.class differ diff --git a/build/classes/java/main/net/minecraft/src/Tessellator.class b/build/classes/java/main/net/minecraft/src/Tessellator.class new file mode 100644 index 0000000..d0b6231 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Tessellator.class differ diff --git a/build/classes/java/main/net/minecraft/src/TextureAtlasSprite.class b/build/classes/java/main/net/minecraft/src/TextureAtlasSprite.class new file mode 100644 index 0000000..a5db54f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TextureAtlasSprite.class differ diff --git a/build/classes/java/main/net/minecraft/src/TextureClock.class b/build/classes/java/main/net/minecraft/src/TextureClock.class new file mode 100644 index 0000000..39e4257 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TextureClock.class differ diff --git a/build/classes/java/main/net/minecraft/src/TextureCompass.class b/build/classes/java/main/net/minecraft/src/TextureCompass.class new file mode 100644 index 0000000..9269640 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TextureCompass.class differ diff --git a/build/classes/java/main/net/minecraft/src/TextureManager.class b/build/classes/java/main/net/minecraft/src/TextureManager.class new file mode 100644 index 0000000..781cbba Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TextureManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/TextureManagerINNER1.class b/build/classes/java/main/net/minecraft/src/TextureManagerINNER1.class new file mode 100644 index 0000000..37e040b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TextureManagerINNER1.class differ diff --git a/build/classes/java/main/net/minecraft/src/TextureMap.class b/build/classes/java/main/net/minecraft/src/TextureMap.class new file mode 100644 index 0000000..8a5681f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TextureMap.class differ diff --git a/build/classes/java/main/net/minecraft/src/TextureMetadataSection.class b/build/classes/java/main/net/minecraft/src/TextureMetadataSection.class new file mode 100644 index 0000000..aa46488 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TextureMetadataSection.class differ diff --git a/build/classes/java/main/net/minecraft/src/TextureMetadataSectionSerializer.class b/build/classes/java/main/net/minecraft/src/TextureMetadataSectionSerializer.class new file mode 100644 index 0000000..52bd504 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TextureMetadataSectionSerializer.class differ diff --git a/build/classes/java/main/net/minecraft/src/TextureObject.class b/build/classes/java/main/net/minecraft/src/TextureObject.class new file mode 100644 index 0000000..a8c545d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TextureObject.class differ diff --git a/build/classes/java/main/net/minecraft/src/TextureOffset.class b/build/classes/java/main/net/minecraft/src/TextureOffset.class new file mode 100644 index 0000000..a3a4894 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TextureOffset.class differ diff --git a/build/classes/java/main/net/minecraft/src/TextureUtil.class b/build/classes/java/main/net/minecraft/src/TextureUtil.class new file mode 100644 index 0000000..d96507c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TextureUtil.class differ diff --git a/build/classes/java/main/net/minecraft/src/TexturedQuad.class b/build/classes/java/main/net/minecraft/src/TexturedQuad.class new file mode 100644 index 0000000..e79d796 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TexturedQuad.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadClientSleep.class b/build/classes/java/main/net/minecraft/src/ThreadClientSleep.class new file mode 100644 index 0000000..8f3572b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadClientSleep.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadConnectToOnlineServer.class b/build/classes/java/main/net/minecraft/src/ThreadConnectToOnlineServer.class new file mode 100644 index 0000000..ed88933 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadConnectToOnlineServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadConnectToServer.class b/build/classes/java/main/net/minecraft/src/ThreadConnectToServer.class new file mode 100644 index 0000000..af45b92 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadConnectToServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadDownloadImageData.class b/build/classes/java/main/net/minecraft/src/ThreadDownloadImageData.class new file mode 100644 index 0000000..06054cb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadDownloadImageData.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadDownloadImageDataINNER1.class b/build/classes/java/main/net/minecraft/src/ThreadDownloadImageDataINNER1.class new file mode 100644 index 0000000..11660fd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadDownloadImageDataINNER1.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadLanServerFind.class b/build/classes/java/main/net/minecraft/src/ThreadLanServerFind.class new file mode 100644 index 0000000..25cb263 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadLanServerFind.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadLanServerPing.class b/build/classes/java/main/net/minecraft/src/ThreadLanServerPing.class new file mode 100644 index 0000000..540a862 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadLanServerPing.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadLoginVerifier.class b/build/classes/java/main/net/minecraft/src/ThreadLoginVerifier.class new file mode 100644 index 0000000..6723634 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadLoginVerifier.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadMinecraftServer.class b/build/classes/java/main/net/minecraft/src/ThreadMinecraftServer.class new file mode 100644 index 0000000..0567bb1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadMinecraftServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadOnlineConnect.class b/build/classes/java/main/net/minecraft/src/ThreadOnlineConnect.class new file mode 100644 index 0000000..afe9686 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadOnlineConnect.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadOnlineScreen.class b/build/classes/java/main/net/minecraft/src/ThreadOnlineScreen.class new file mode 100644 index 0000000..c4e14dc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadOnlineScreen.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadPollServers.class b/build/classes/java/main/net/minecraft/src/ThreadPollServers.class new file mode 100644 index 0000000..a4d0a66 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadPollServers.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadStatSyncherReceive.class b/build/classes/java/main/net/minecraft/src/ThreadStatSyncherReceive.class new file mode 100644 index 0000000..5957a68 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadStatSyncherReceive.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadStatSyncherSend.class b/build/classes/java/main/net/minecraft/src/ThreadStatSyncherSend.class new file mode 100644 index 0000000..633741c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadStatSyncherSend.class differ diff --git a/build/classes/java/main/net/minecraft/src/ThreadedFileIOBase.class b/build/classes/java/main/net/minecraft/src/ThreadedFileIOBase.class new file mode 100644 index 0000000..fcfa810 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ThreadedFileIOBase.class differ diff --git a/build/classes/java/main/net/minecraft/src/Tickable.class b/build/classes/java/main/net/minecraft/src/Tickable.class new file mode 100644 index 0000000..822ba60 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Tickable.class differ diff --git a/build/classes/java/main/net/minecraft/src/TickableTextureObject.class b/build/classes/java/main/net/minecraft/src/TickableTextureObject.class new file mode 100644 index 0000000..343d778 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TickableTextureObject.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntity.class b/build/classes/java/main/net/minecraft/src/TileEntity.class new file mode 100644 index 0000000..ce08ef6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntity.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityBeacon.class b/build/classes/java/main/net/minecraft/src/TileEntityBeacon.class new file mode 100644 index 0000000..5448b95 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityBeacon.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityBeaconRenderer.class b/build/classes/java/main/net/minecraft/src/TileEntityBeaconRenderer.class new file mode 100644 index 0000000..2fbd541 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityBeaconRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityBrewingStand.class b/build/classes/java/main/net/minecraft/src/TileEntityBrewingStand.class new file mode 100644 index 0000000..de43636 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityBrewingStand.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityChest.class b/build/classes/java/main/net/minecraft/src/TileEntityChest.class new file mode 100644 index 0000000..a41fc9d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityChestRenderer.class b/build/classes/java/main/net/minecraft/src/TileEntityChestRenderer.class new file mode 100644 index 0000000..3d1dd88 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityChestRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityCommandBlock.class b/build/classes/java/main/net/minecraft/src/TileEntityCommandBlock.class new file mode 100644 index 0000000..bf9640a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityCommandBlock.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityComparator.class b/build/classes/java/main/net/minecraft/src/TileEntityComparator.class new file mode 100644 index 0000000..8309734 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityComparator.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityDaylightDetector.class b/build/classes/java/main/net/minecraft/src/TileEntityDaylightDetector.class new file mode 100644 index 0000000..f05fa3e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityDaylightDetector.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityDispenser.class b/build/classes/java/main/net/minecraft/src/TileEntityDispenser.class new file mode 100644 index 0000000..6cb054d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityDispenser.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityDropper.class b/build/classes/java/main/net/minecraft/src/TileEntityDropper.class new file mode 100644 index 0000000..7a15048 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityDropper.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityEnchantmentTable.class b/build/classes/java/main/net/minecraft/src/TileEntityEnchantmentTable.class new file mode 100644 index 0000000..7bb82e2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityEnchantmentTable.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityEndPortal.class b/build/classes/java/main/net/minecraft/src/TileEntityEndPortal.class new file mode 100644 index 0000000..4b78f32 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityEndPortal.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityEnderChest.class b/build/classes/java/main/net/minecraft/src/TileEntityEnderChest.class new file mode 100644 index 0000000..4fbdd84 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityEnderChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityEnderChestRenderer.class b/build/classes/java/main/net/minecraft/src/TileEntityEnderChestRenderer.class new file mode 100644 index 0000000..48f6bb0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityEnderChestRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityFurnace.class b/build/classes/java/main/net/minecraft/src/TileEntityFurnace.class new file mode 100644 index 0000000..b6f0b29 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityFurnace.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityHopper.class b/build/classes/java/main/net/minecraft/src/TileEntityHopper.class new file mode 100644 index 0000000..d8477b6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityHopper.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityMobSpawner.class b/build/classes/java/main/net/minecraft/src/TileEntityMobSpawner.class new file mode 100644 index 0000000..4f52029 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityMobSpawner.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityMobSpawnerLogic.class b/build/classes/java/main/net/minecraft/src/TileEntityMobSpawnerLogic.class new file mode 100644 index 0000000..1f6f854 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityMobSpawnerLogic.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityMobSpawnerRenderer.class b/build/classes/java/main/net/minecraft/src/TileEntityMobSpawnerRenderer.class new file mode 100644 index 0000000..ef93dac Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityMobSpawnerRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityNote.class b/build/classes/java/main/net/minecraft/src/TileEntityNote.class new file mode 100644 index 0000000..47415ca Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityNote.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityPiston.class b/build/classes/java/main/net/minecraft/src/TileEntityPiston.class new file mode 100644 index 0000000..fb55dd5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityPiston.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityRecordPlayer.class b/build/classes/java/main/net/minecraft/src/TileEntityRecordPlayer.class new file mode 100644 index 0000000..12dd2ee Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityRecordPlayer.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityRenderer.class b/build/classes/java/main/net/minecraft/src/TileEntityRenderer.class new file mode 100644 index 0000000..99a19c5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntityRendererPiston.class b/build/classes/java/main/net/minecraft/src/TileEntityRendererPiston.class new file mode 100644 index 0000000..6df1d24 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntityRendererPiston.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntitySign.class b/build/classes/java/main/net/minecraft/src/TileEntitySign.class new file mode 100644 index 0000000..29c2c84 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntitySign.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntitySignRenderer.class b/build/classes/java/main/net/minecraft/src/TileEntitySignRenderer.class new file mode 100644 index 0000000..ad16cc5 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntitySignRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntitySkull.class b/build/classes/java/main/net/minecraft/src/TileEntitySkull.class new file mode 100644 index 0000000..6ee6dc9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntitySkull.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntitySkullRenderer.class b/build/classes/java/main/net/minecraft/src/TileEntitySkullRenderer.class new file mode 100644 index 0000000..1ec5802 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntitySkullRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/TileEntitySpecialRenderer.class b/build/classes/java/main/net/minecraft/src/TileEntitySpecialRenderer.class new file mode 100644 index 0000000..2fd72fd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/TileEntitySpecialRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/Timer.class b/build/classes/java/main/net/minecraft/src/Timer.class new file mode 100644 index 0000000..87c9165 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Timer.class differ diff --git a/build/classes/java/main/net/minecraft/src/Tuple.class b/build/classes/java/main/net/minecraft/src/Tuple.class new file mode 100644 index 0000000..2b97309 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Tuple.class differ diff --git a/build/classes/java/main/net/minecraft/src/Util.class b/build/classes/java/main/net/minecraft/src/Util.class new file mode 100644 index 0000000..eb94414 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Util.class differ diff --git a/build/classes/java/main/net/minecraft/src/ValueObject.class b/build/classes/java/main/net/minecraft/src/ValueObject.class new file mode 100644 index 0000000..1d9274b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ValueObject.class differ diff --git a/build/classes/java/main/net/minecraft/src/ValueObjectList.class b/build/classes/java/main/net/minecraft/src/ValueObjectList.class new file mode 100644 index 0000000..497e3b9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ValueObjectList.class differ diff --git a/build/classes/java/main/net/minecraft/src/ValueObjectSubscription.class b/build/classes/java/main/net/minecraft/src/ValueObjectSubscription.class new file mode 100644 index 0000000..af9df99 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/ValueObjectSubscription.class differ diff --git a/build/classes/java/main/net/minecraft/src/Vec3.class b/build/classes/java/main/net/minecraft/src/Vec3.class new file mode 100644 index 0000000..0b178db Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Vec3.class differ diff --git a/build/classes/java/main/net/minecraft/src/Vec3Pool.class b/build/classes/java/main/net/minecraft/src/Vec3Pool.class new file mode 100644 index 0000000..dd3cd2d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Vec3Pool.class differ diff --git a/build/classes/java/main/net/minecraft/src/Village.class b/build/classes/java/main/net/minecraft/src/Village.class new file mode 100644 index 0000000..e54e0c3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/Village.class differ diff --git a/build/classes/java/main/net/minecraft/src/VillageAgressor.class b/build/classes/java/main/net/minecraft/src/VillageAgressor.class new file mode 100644 index 0000000..84db9e1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/VillageAgressor.class differ diff --git a/build/classes/java/main/net/minecraft/src/VillageCollection.class b/build/classes/java/main/net/minecraft/src/VillageCollection.class new file mode 100644 index 0000000..5427e89 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/VillageCollection.class differ diff --git a/build/classes/java/main/net/minecraft/src/VillageDoorInfo.class b/build/classes/java/main/net/minecraft/src/VillageDoorInfo.class new file mode 100644 index 0000000..bc3c3fc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/VillageDoorInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/VillageSiege.class b/build/classes/java/main/net/minecraft/src/VillageSiege.class new file mode 100644 index 0000000..867a504 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/VillageSiege.class differ diff --git a/build/classes/java/main/net/minecraft/src/WatchableObject.class b/build/classes/java/main/net/minecraft/src/WatchableObject.class new file mode 100644 index 0000000..504101a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WatchableObject.class differ diff --git a/build/classes/java/main/net/minecraft/src/WeightedRandom.class b/build/classes/java/main/net/minecraft/src/WeightedRandom.class new file mode 100644 index 0000000..41383c2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WeightedRandom.class differ diff --git a/build/classes/java/main/net/minecraft/src/WeightedRandomChestContent.class b/build/classes/java/main/net/minecraft/src/WeightedRandomChestContent.class new file mode 100644 index 0000000..e886d74 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WeightedRandomChestContent.class differ diff --git a/build/classes/java/main/net/minecraft/src/WeightedRandomItem.class b/build/classes/java/main/net/minecraft/src/WeightedRandomItem.class new file mode 100644 index 0000000..7e9b29d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WeightedRandomItem.class differ diff --git a/build/classes/java/main/net/minecraft/src/WeightedRandomMinecart.class b/build/classes/java/main/net/minecraft/src/WeightedRandomMinecart.class new file mode 100644 index 0000000..0e411ec Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WeightedRandomMinecart.class differ diff --git a/build/classes/java/main/net/minecraft/src/World.class b/build/classes/java/main/net/minecraft/src/World.class new file mode 100644 index 0000000..67bfa7f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/World.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldChunkManager.class b/build/classes/java/main/net/minecraft/src/WorldChunkManager.class new file mode 100644 index 0000000..d151fe3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldChunkManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldChunkManagerHell.class b/build/classes/java/main/net/minecraft/src/WorldChunkManagerHell.class new file mode 100644 index 0000000..0b388ce Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldChunkManagerHell.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldClient.class b/build/classes/java/main/net/minecraft/src/WorldClient.class new file mode 100644 index 0000000..8b611a3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldClient.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldClientINNER3.class b/build/classes/java/main/net/minecraft/src/WorldClientINNER3.class new file mode 100644 index 0000000..cbba466 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldClientINNER3.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldClientINNER4.class b/build/classes/java/main/net/minecraft/src/WorldClientINNER4.class new file mode 100644 index 0000000..9966f3f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldClientINNER4.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenBigMushroom.class b/build/classes/java/main/net/minecraft/src/WorldGenBigMushroom.class new file mode 100644 index 0000000..75e15cf Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenBigMushroom.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenBigTree.class b/build/classes/java/main/net/minecraft/src/WorldGenBigTree.class new file mode 100644 index 0000000..bafef50 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenBigTree.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenCactus.class b/build/classes/java/main/net/minecraft/src/WorldGenCactus.class new file mode 100644 index 0000000..23bdf1a Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenCactus.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenClay.class b/build/classes/java/main/net/minecraft/src/WorldGenClay.class new file mode 100644 index 0000000..bab1730 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenClay.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenDeadBush.class b/build/classes/java/main/net/minecraft/src/WorldGenDeadBush.class new file mode 100644 index 0000000..bb09cdc Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenDeadBush.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenDesertWells.class b/build/classes/java/main/net/minecraft/src/WorldGenDesertWells.class new file mode 100644 index 0000000..953016c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenDesertWells.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenDungeons.class b/build/classes/java/main/net/minecraft/src/WorldGenDungeons.class new file mode 100644 index 0000000..d484904 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenDungeons.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenFire.class b/build/classes/java/main/net/minecraft/src/WorldGenFire.class new file mode 100644 index 0000000..8fba7bb Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenFire.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenFlowers.class b/build/classes/java/main/net/minecraft/src/WorldGenFlowers.class new file mode 100644 index 0000000..6aaa213 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenFlowers.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenForest.class b/build/classes/java/main/net/minecraft/src/WorldGenForest.class new file mode 100644 index 0000000..aa2caf1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenForest.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenGlowStone1.class b/build/classes/java/main/net/minecraft/src/WorldGenGlowStone1.class new file mode 100644 index 0000000..d8326a0 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenGlowStone1.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenGlowStone2.class b/build/classes/java/main/net/minecraft/src/WorldGenGlowStone2.class new file mode 100644 index 0000000..887d2a6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenGlowStone2.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenHellLava.class b/build/classes/java/main/net/minecraft/src/WorldGenHellLava.class new file mode 100644 index 0000000..66d55d9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenHellLava.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenHugeTrees.class b/build/classes/java/main/net/minecraft/src/WorldGenHugeTrees.class new file mode 100644 index 0000000..c6e93f1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenHugeTrees.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenLakes.class b/build/classes/java/main/net/minecraft/src/WorldGenLakes.class new file mode 100644 index 0000000..eb5f7c3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenLakes.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenLiquids.class b/build/classes/java/main/net/minecraft/src/WorldGenLiquids.class new file mode 100644 index 0000000..7b7a016 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenLiquids.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenMinable.class b/build/classes/java/main/net/minecraft/src/WorldGenMinable.class new file mode 100644 index 0000000..439cbb9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenMinable.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenPumpkin.class b/build/classes/java/main/net/minecraft/src/WorldGenPumpkin.class new file mode 100644 index 0000000..3ffe0a2 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenPumpkin.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenReed.class b/build/classes/java/main/net/minecraft/src/WorldGenReed.class new file mode 100644 index 0000000..028204e Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenReed.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenSand.class b/build/classes/java/main/net/minecraft/src/WorldGenSand.class new file mode 100644 index 0000000..c48797b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenSand.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenShrub.class b/build/classes/java/main/net/minecraft/src/WorldGenShrub.class new file mode 100644 index 0000000..32f5b2b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenShrub.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenSpikes.class b/build/classes/java/main/net/minecraft/src/WorldGenSpikes.class new file mode 100644 index 0000000..c74d60b Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenSpikes.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenSwamp.class b/build/classes/java/main/net/minecraft/src/WorldGenSwamp.class new file mode 100644 index 0000000..535c3e6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenSwamp.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenTaiga1.class b/build/classes/java/main/net/minecraft/src/WorldGenTaiga1.class new file mode 100644 index 0000000..31e0c12 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenTaiga1.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenTaiga2.class b/build/classes/java/main/net/minecraft/src/WorldGenTaiga2.class new file mode 100644 index 0000000..367f287 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenTaiga2.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenTallGrass.class b/build/classes/java/main/net/minecraft/src/WorldGenTallGrass.class new file mode 100644 index 0000000..29530d6 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenTallGrass.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenTrees.class b/build/classes/java/main/net/minecraft/src/WorldGenTrees.class new file mode 100644 index 0000000..837caa4 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenTrees.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenVines.class b/build/classes/java/main/net/minecraft/src/WorldGenVines.class new file mode 100644 index 0000000..b0354c9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenVines.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenWaterlily.class b/build/classes/java/main/net/minecraft/src/WorldGenWaterlily.class new file mode 100644 index 0000000..127c89d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenWaterlily.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGenerator.class b/build/classes/java/main/net/minecraft/src/WorldGenerator.class new file mode 100644 index 0000000..32598fd Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGenerator.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldGeneratorBonusChest.class b/build/classes/java/main/net/minecraft/src/WorldGeneratorBonusChest.class new file mode 100644 index 0000000..c8a539f Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldGeneratorBonusChest.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldInfo.class b/build/classes/java/main/net/minecraft/src/WorldInfo.class new file mode 100644 index 0000000..8feff53 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldInfo.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldManager.class b/build/classes/java/main/net/minecraft/src/WorldManager.class new file mode 100644 index 0000000..2537655 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldManager.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldProvider.class b/build/classes/java/main/net/minecraft/src/WorldProvider.class new file mode 100644 index 0000000..ae0a511 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldProvider.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldProviderEnd.class b/build/classes/java/main/net/minecraft/src/WorldProviderEnd.class new file mode 100644 index 0000000..fb12cc1 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldProviderEnd.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldProviderHell.class b/build/classes/java/main/net/minecraft/src/WorldProviderHell.class new file mode 100644 index 0000000..d5fba34 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldProviderHell.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldProviderSurface.class b/build/classes/java/main/net/minecraft/src/WorldProviderSurface.class new file mode 100644 index 0000000..a5255c9 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldProviderSurface.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldRenderer.class b/build/classes/java/main/net/minecraft/src/WorldRenderer.class new file mode 100644 index 0000000..dcc0f0d Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldRenderer.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldSavedData.class b/build/classes/java/main/net/minecraft/src/WorldSavedData.class new file mode 100644 index 0000000..c94ed82 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldSavedData.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldServer.class b/build/classes/java/main/net/minecraft/src/WorldServer.class new file mode 100644 index 0000000..c7a1554 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldServer.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldServerMulti.class b/build/classes/java/main/net/minecraft/src/WorldServerMulti.class new file mode 100644 index 0000000..95e5b02 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldServerMulti.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldSettings.class b/build/classes/java/main/net/minecraft/src/WorldSettings.class new file mode 100644 index 0000000..3192d05 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldSettings.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldTemplate.class b/build/classes/java/main/net/minecraft/src/WorldTemplate.class new file mode 100644 index 0000000..a684c73 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldTemplate.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldTemplateList.class b/build/classes/java/main/net/minecraft/src/WorldTemplateList.class new file mode 100644 index 0000000..c6a9bf3 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldTemplateList.class differ diff --git a/build/classes/java/main/net/minecraft/src/WorldType.class b/build/classes/java/main/net/minecraft/src/WorldType.class new file mode 100644 index 0000000..1d15791 Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WorldType.class differ diff --git a/build/classes/java/main/net/minecraft/src/WrongUsageException.class b/build/classes/java/main/net/minecraft/src/WrongUsageException.class new file mode 100644 index 0000000..44fb44c Binary files /dev/null and b/build/classes/java/main/net/minecraft/src/WrongUsageException.class differ diff --git a/build/distributions/Project164.tar b/build/distributions/Project164.tar new file mode 100644 index 0000000..bfd39a9 Binary files /dev/null and b/build/distributions/Project164.tar differ diff --git a/build/distributions/Project164.zip b/build/distributions/Project164.zip new file mode 100644 index 0000000..a0ccc00 Binary files /dev/null and b/build/distributions/Project164.zip differ diff --git a/build/libs/Project164.jar b/build/libs/Project164.jar new file mode 100644 index 0000000..2b328b6 Binary files /dev/null and b/build/libs/Project164.jar differ diff --git a/build/scripts/Project164 b/build/scripts/Project164 new file mode 100644 index 0000000..cb51479 --- /dev/null +++ b/build/scripts/Project164 @@ -0,0 +1,243 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Project164 start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Project164 +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and PROJECT164_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit + +# Add default JVM options here. You can also use JAVA_OPTS and PROJECT164_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Djava.library.path=lwjgl-rundir"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/lib/Project164.jar:$APP_HOME/lib/commons-lang3-3.1.jar:$APP_HOME/lib/bcprov-jdk15on-1.47.jar:$APP_HOME/lib/codecjorbis-20101023.jar:$APP_HOME/lib/librarylwjglopenal-20100824.jar:$APP_HOME/lib/lwjgl_util-2.9.0.jar:$APP_HOME/lib/jopt-simple-4.5.jar:$APP_HOME/lib/libraryjavasound-20101123.jar:$APP_HOME/lib/codecwav-20101023.jar:$APP_HOME/lib/guava-14.0.jar:$APP_HOME/lib/soundsystem-20120107.jar:$APP_HOME/lib/lwjgl-platform-2.9.0-natives-linux.jar:$APP_HOME/lib/gson-2.2.2.jar:$APP_HOME/lib/argo-2.25_fixed.jar:$APP_HOME/lib/commons-io-2.4.jar:$APP_HOME/lib/lwjgl-2.9.0.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and PROJECT164_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $PROJECT164_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + -classpath "$CLASSPATH" \ + net.minecraft.client.main.Main \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $PROJECT164_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/build/scripts/Project164.bat b/build/scripts/Project164.bat new file mode 100644 index 0000000..9138c80 --- /dev/null +++ b/build/scripts/Project164.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Project164 startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME%.. + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and PROJECT164_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Djava.library.path=lwjgl-rundir" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\lib\Project164.jar;%APP_HOME%\lib\commons-lang3-3.1.jar;%APP_HOME%\lib\bcprov-jdk15on-1.47.jar;%APP_HOME%\lib\codecjorbis-20101023.jar;%APP_HOME%\lib\librarylwjglopenal-20100824.jar;%APP_HOME%\lib\lwjgl_util-2.9.0.jar;%APP_HOME%\lib\jopt-simple-4.5.jar;%APP_HOME%\lib\libraryjavasound-20101123.jar;%APP_HOME%\lib\codecwav-20101023.jar;%APP_HOME%\lib\guava-14.0.jar;%APP_HOME%\lib\soundsystem-20120107.jar;%APP_HOME%\lib\lwjgl-platform-2.9.0-natives-linux.jar;%APP_HOME%\lib\gson-2.2.2.jar;%APP_HOME%\lib\argo-2.25_fixed.jar;%APP_HOME%\lib\commons-io-2.4.jar;%APP_HOME%\lib\lwjgl-2.9.0.jar + + +@rem Execute Project164 +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %PROJECT164_OPTS% -classpath "%CLASSPATH%" net.minecraft.client.main.Main %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable PROJECT164_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%PROJECT164_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin new file mode 100644 index 0000000..91b7673 Binary files /dev/null and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/build/tmp/jar/MANIFEST.MF b/build/tmp/jar/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/build/tmp/jar/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/crash-reports/crash-2025-01-28_12.40.11-client.txt b/crash-reports/crash-2025-01-28_12.40.11-client.txt new file mode 100644 index 0000000..31c5477 --- /dev/null +++ b/crash-reports/crash-2025-01-28_12.40.11-client.txt @@ -0,0 +1,56 @@ +---- Minecraft Crash Report ---- +// There are four lights! + +Time: 1/28/25, 12:40 PM +Description: Initializing game + +java.lang.ExceptionInInitializerError + at net.minecraft.src.LanguageManager.onResourceManagerReload(LanguageManager.java:76) + at net.minecraft.src.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:103) + at net.minecraft.src.Minecraft.startGame(Minecraft.java:345) + at net.minecraft.src.Minecraft.run(Minecraft.java:676) + at net.minecraft.client.main.Main.main(Main.java:92) +Caused by: java.lang.NullPointerException + at java.base/java.io.Reader.(Reader.java:168) + at java.base/java.io.InputStreamReader.(InputStreamReader.java:112) + at org.apache.commons.io.IOUtils.readLines(IOUtils.java:986) + at net.minecraft.src.StringTranslate.(StringTranslate.java:29) + at net.minecraft.src.StringTranslate.(StringTranslate.java:21) + ... 5 more + + +A detailed walkthrough of the error, its code path and all known details is as follows: +--------------------------------------------------------------------------------------- + +-- Head -- +Stacktrace: + at net.minecraft.src.LanguageManager.onResourceManagerReload(LanguageManager.java:76) + at net.minecraft.src.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:103) + at net.minecraft.src.Minecraft.startGame(Minecraft.java:345) + +-- Initialization -- +Details: +Stacktrace: + at net.minecraft.src.Minecraft.run(Minecraft.java:676) + at net.minecraft.client.main.Main.main(Main.java:92) + +-- System Details -- +Details: + Minecraft Version: 1.6.4 + Operating System: Linux (amd64) version 6.8.0-52-generic + Java Version: 17.0.13, Ubuntu + Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Ubuntu + Memory: 243307560 bytes (232 MB) / 262144000 bytes (250 MB) up to 4108320768 bytes (3918 MB) + JVM Flags: 0 total; + AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used + Suspicious classes: + IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 + Launched Version: 1.6.4 + LWJGL: 2.9.0 + OpenGL: Mesa Intel(R) HD Graphics 520 (SKL GT2) GL version 4.6 (Compatibility Profile) Mesa 24.0.9-0ubuntu0.3, Intel + Is Modded: Very likely; Jar signature invalidated + Type: Client (map_client.txt) + Resource Pack: Default + Current Language: ~~ERROR~~ NullPointerException: Cannot invoke "net.minecraft.src.Language.toString()" because the return value of "net.minecraft.src.LanguageManager.getCurrentLanguage()" is null + Profiler Position: N/A (disabled) + Vec3 Pool Size: ~~ERROR~~ NullPointerException: Cannot invoke "net.minecraft.src.WorldClient.getWorldVec3Pool()" because "this.field_142056_a.theWorld" is null \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..2913ef0 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +org.gradle.jvmargs=-Xmx2G -Xms2G + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..249e583 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..e9da0e8 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Sun Feb 11 10:50:57 EST 2024 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..1b6c787 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..ac1b06f --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/lwjgl-rundir/argo-2.25_fixed.jar b/lwjgl-rundir/argo-2.25_fixed.jar new file mode 100644 index 0000000..421877c Binary files /dev/null and b/lwjgl-rundir/argo-2.25_fixed.jar differ diff --git a/lwjgl-rundir/bcprov-jdk15on-1.47.jar b/lwjgl-rundir/bcprov-jdk15on-1.47.jar new file mode 100644 index 0000000..0b80922 Binary files /dev/null and b/lwjgl-rundir/bcprov-jdk15on-1.47.jar differ diff --git a/lwjgl-rundir/codecjorbis-20101023.jar b/lwjgl-rundir/codecjorbis-20101023.jar new file mode 100644 index 0000000..e7e1f4a Binary files /dev/null and b/lwjgl-rundir/codecjorbis-20101023.jar differ diff --git a/lwjgl-rundir/codecwav-20101023.jar b/lwjgl-rundir/codecwav-20101023.jar new file mode 100644 index 0000000..7b6b1bd Binary files /dev/null and b/lwjgl-rundir/codecwav-20101023.jar differ diff --git a/lwjgl-rundir/commons-io-2.4.jar b/lwjgl-rundir/commons-io-2.4.jar new file mode 100644 index 0000000..90035a4 Binary files /dev/null and b/lwjgl-rundir/commons-io-2.4.jar differ diff --git a/lwjgl-rundir/commons-lang3-3.1.jar b/lwjgl-rundir/commons-lang3-3.1.jar new file mode 100644 index 0000000..a85e539 Binary files /dev/null and b/lwjgl-rundir/commons-lang3-3.1.jar differ diff --git a/lwjgl-rundir/gson-2.2.2.jar b/lwjgl-rundir/gson-2.2.2.jar new file mode 100644 index 0000000..9adc66f Binary files /dev/null and b/lwjgl-rundir/gson-2.2.2.jar differ diff --git a/lwjgl-rundir/guava-14.0.jar b/lwjgl-rundir/guava-14.0.jar new file mode 100644 index 0000000..5db9148 Binary files /dev/null and b/lwjgl-rundir/guava-14.0.jar differ diff --git a/lwjgl-rundir/jopt-simple-4.5.jar b/lwjgl-rundir/jopt-simple-4.5.jar new file mode 100644 index 0000000..6aa0c61 Binary files /dev/null and b/lwjgl-rundir/jopt-simple-4.5.jar differ diff --git a/lwjgl-rundir/libjinput-linux.so b/lwjgl-rundir/libjinput-linux.so new file mode 100644 index 0000000..dba9e59 Binary files /dev/null and b/lwjgl-rundir/libjinput-linux.so differ diff --git a/lwjgl-rundir/libjinput-linux64.so b/lwjgl-rundir/libjinput-linux64.so new file mode 100644 index 0000000..8b5f9d8 Binary files /dev/null and b/lwjgl-rundir/libjinput-linux64.so differ diff --git a/lwjgl-rundir/liblwjgl.so b/lwjgl-rundir/liblwjgl.so new file mode 100644 index 0000000..4beea98 Binary files /dev/null and b/lwjgl-rundir/liblwjgl.so differ diff --git a/lwjgl-rundir/liblwjgl64.so b/lwjgl-rundir/liblwjgl64.so new file mode 100644 index 0000000..314b892 Binary files /dev/null and b/lwjgl-rundir/liblwjgl64.so differ diff --git a/lwjgl-rundir/libopenal.so b/lwjgl-rundir/libopenal.so new file mode 100644 index 0000000..0a3a619 Binary files /dev/null and b/lwjgl-rundir/libopenal.so differ diff --git a/lwjgl-rundir/libopenal64.so b/lwjgl-rundir/libopenal64.so new file mode 100644 index 0000000..e0693c0 Binary files /dev/null and b/lwjgl-rundir/libopenal64.so differ diff --git a/lwjgl-rundir/libraryjavasound-20101123.jar b/lwjgl-rundir/libraryjavasound-20101123.jar new file mode 100644 index 0000000..f1681b7 Binary files /dev/null and b/lwjgl-rundir/libraryjavasound-20101123.jar differ diff --git a/lwjgl-rundir/librarylwjglopenal-20100824.jar b/lwjgl-rundir/librarylwjglopenal-20100824.jar new file mode 100644 index 0000000..2f5e910 Binary files /dev/null and b/lwjgl-rundir/librarylwjglopenal-20100824.jar differ diff --git a/lwjgl-rundir/lwjgl-2.9.0.jar b/lwjgl-rundir/lwjgl-2.9.0.jar new file mode 100644 index 0000000..4cb7cda Binary files /dev/null and b/lwjgl-rundir/lwjgl-2.9.0.jar differ diff --git a/lwjgl-rundir/lwjgl-platform-2.9.0-natives-linux.jar b/lwjgl-rundir/lwjgl-platform-2.9.0-natives-linux.jar new file mode 100644 index 0000000..e6f9892 Binary files /dev/null and b/lwjgl-rundir/lwjgl-platform-2.9.0-natives-linux.jar differ diff --git a/lwjgl-rundir/lwjgl_util-2.9.0.jar b/lwjgl-rundir/lwjgl_util-2.9.0.jar new file mode 100644 index 0000000..c055bff Binary files /dev/null and b/lwjgl-rundir/lwjgl_util-2.9.0.jar differ diff --git a/lwjgl-rundir/resources/assets/minecraft/font/glyph_sizes.bin b/lwjgl-rundir/resources/assets/minecraft/font/glyph_sizes.bin new file mode 100644 index 0000000..69c857e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/font/glyph_sizes.bin differ diff --git a/lwjgl-rundir/resources/assets/minecraft/lang/en_US.lang b/lwjgl-rundir/resources/assets/minecraft/lang/en_US.lang new file mode 100644 index 0000000..bcf0120 --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/lang/en_US.lang @@ -0,0 +1,1445 @@ + +language.name=English +language.region=US +language.code=en_US + +gui.done=Done +gui.cancel=Cancel +gui.back=Back +gui.toMenu=Back to title screen +gui.up=Up +gui.down=Down +gui.yes=Yes +gui.no=No + +translation.test.none=Hello, world! +translation.test.complex=Prefix, %s%2$s again %s and %1$s lastly %s and also %1$s again! +translation.test.escape=%%s %%%s %%%%s %%%%%s +translation.test.invalid=hi % +translation.test.invalid2=hi % s +translation.test.args=%s %s +translation.test.world=world + +menu.singleplayer=Singleplayer +menu.multiplayer=Multiplayer +menu.online=Minecraft Realms +menu.options=Options... +menu.quit=Quit Game +menu.returnToMenu=Save and Quit to Title +menu.disconnect=Disconnect +menu.returnToGame=Back to Game +menu.switchingLevel=Switching worlds +menu.generatingLevel=Generating world +menu.loadingLevel=Loading world +menu.generatingTerrain=Building terrain +menu.convertingLevel=Converting world +menu.simulating=Simulating the world for a bit +menu.respawning=Respawning +menu.shareToLan=Open to LAN + +selectWorld.title=Select World +selectWorld.empty=empty +selectWorld.world=World +selectWorld.select=Play Selected World +selectWorld.create=Create New World +selectWorld.recreate=Re-Create +selectWorld.createDemo=Play New Demo World +selectWorld.delete=Delete +selectWorld.rename=Rename +selectWorld.deleteQuestion=Are you sure you want to delete this world? +selectWorld.deleteWarning=will be lost forever! (A long time!) +selectWorld.deleteButton=Delete +selectWorld.renameButton=Rename +selectWorld.renameTitle=Rename World +selectWorld.conversion=Must be converted! +selectWorld.newWorld=New World +selectWorld.newWorld.copyOf=Copy of %s +selectWorld.enterName=World Name +selectWorld.resultFolder=Will be saved in: +selectWorld.enterSeed=Seed for the World Generator +selectWorld.seedInfo=Leave blank for a random seed +selectWorld.cheats=Cheats +selectWorld.customizeType=Customize + +createWorld.customize.presets=Presets +createWorld.customize.presets.title=Select a Preset +createWorld.customize.presets.select=Use Preset +createWorld.customize.presets.share=Want to share your preset with someone? Use the below box! +createWorld.customize.presets.list=Alternatively, here's some we made earlier! +createWorld.customize.flat.title=Superflat Customization +createWorld.customize.flat.tile=Layer Material +createWorld.customize.flat.height=Height +createWorld.customize.flat.addLayer=Add Layer +createWorld.customize.flat.editLayer=Edit Layer +createWorld.customize.flat.removeLayer=Remove Layer +createWorld.customize.flat.layer.top=Top - %d +createWorld.customize.flat.layer=%d +createWorld.customize.flat.layer.bottom=Bottom - %d + +gameMode.survival=Survival Mode +gameMode.creative=Creative Mode +gameMode.adventure=Adventure Mode +gameMode.hardcore=Hardcore Mode! +gameMode.changed=Your game mode has been updated + +selectWorld.gameMode=Game Mode +selectWorld.gameMode.survival=Survival +selectWorld.gameMode.survival.line1=Search for resources, crafting, gain +selectWorld.gameMode.survival.line2=levels, health and hunger +selectWorld.gameMode.creative=Creative +selectWorld.gameMode.creative.line1=Unlimited resources, free flying and +selectWorld.gameMode.creative.line2=destroy blocks instantly +selectWorld.gameMode.hardcore=Hardcore +selectWorld.gameMode.hardcore.line1=Same as survival mode, locked at hardest +selectWorld.gameMode.hardcore.line2=difficulty, and one life only +selectWorld.gameMode.adventure=Adventure +selectWorld.gameMode.adventure.line1=Same as survival mode, but blocks can't +selectWorld.gameMode.adventure.line2=be added or removed +selectWorld.moreWorldOptions=More World Options... +selectWorld.mapFeatures=Generate Structures: +selectWorld.mapFeatures.info=Villages, dungeons etc +selectWorld.mapType=World Type: +selectWorld.mapType.normal=Normal +selectWorld.allowCommands=Allow Cheats: +selectWorld.allowCommands.info=Commands like /gamemode, /xp +selectWorld.hardcoreMode=Hardcore: +selectWorld.hardcoreMode.info=World is deleted upon death +selectWorld.bonusItems=Bonus Chest: + +generator.default=Default +generator.flat=Superflat +generator.largeBiomes=Large Biomes + +selectServer.title=Select Server +selectServer.empty=empty +selectServer.select=Join Server +selectServer.direct=Direct Connect +selectServer.edit=Edit +selectServer.delete=Delete +selectServer.add=Add server +selectServer.defaultName=Minecraft Server +selectServer.deleteQuestion=Are you sure you want to remove this server? +selectServer.deleteWarning=will be lost forever! (A long time!) +selectServer.deleteButton=Delete +selectServer.refresh=Refresh +selectServer.hiddenAddress=(Hidden) +addServer.title=Edit Server Info +addServer.enterName=Server Name +addServer.enterIp=Server Address +addServer.add=Done +addServer.hideAddress=Hide Address +lanServer.title=LAN World +lanServer.scanning=Scanning for games on your local network +lanServer.start=Start LAN World +lanServer.otherPlayers=Settings for Other Players +mcoServer.title=Minecraft Online World + +multiplayer.title=Play Multiplayer +multiplayer.connect=Connect +multiplayer.info1=Minecraft Multiplayer is currently not finished, but there +multiplayer.info2=is some buggy early testing going on. +multiplayer.ipinfo=Enter the IP of a server to connect to it: +multiplayer.texturePrompt.line1=This server recommends the use of a custom resource pack. +multiplayer.texturePrompt.line2=Would you like to download and install it automagically? +multiplayer.downloadingTerrain=Downloading terrain +multiplayer.stopSleeping=Leave Bed +multiplayer.player.joined=%s joined the game +multiplayer.player.left=%s left the game + +chat.cannotSend=Cannot send chat message +chat.type.text=<%s> %s +chat.type.emote=* %s %s +chat.type.announcement=[%s] %s +chat.type.admin=[%s: %s] +chat.link.confirm=Are you sure you want to open the following website? +chat.link.warning=Never open links from people that you don't trust! +chat.copy=Copy to Clipboard + +menu.playdemo=Play Demo World +menu.resetdemo=Reset Demo World + +demo.day.1=This demo will last five game days, do your best! +demo.day.2=Day Two +demo.day.3=Day Three +demo.day.4=Day Four +demo.day.5=This is your last day! +demo.day.warning=Your time is almost up! +demo.day.6=You have passed your fifth day, use F2 to save a screenshot of your creation +demo.reminder=The demo time has expired, buy the game to continue or start a new world! +demo.remainingTime=Remaining time: %s +demo.demoExpired=Demo time's up! +demo.help.movement=Use %1$s, %2$s, %3$s, %4$s and the mouse to move around +demo.help.movementShort=Move by pressing %1$s, %2$s, %3$s, %4$s +demo.help.movementMouse=Look around using the mouse +demo.help.jump=Jump by pressing %1$s +demo.help.inventory=Use %1$s to open your inventory +demo.help.title=Minecraft Demo Mode +demo.help.fullWrapped=This demo will last 5 ingame days (about 1 hour and 40 minutes of real time). Check the achievements for hints! Have fun! +demo.help.buy=Purchase Now! +demo.help.later=Continue Playing! + +connect.connecting=Connecting to the server... +connect.authorizing=Logging in... +connect.failed=Failed to connect to the server + +disconnect.genericReason=%s +disconnect.disconnected=Disconnected by Server +disconnect.lost=Connection Lost +disconnect.kicked=Was kicked from the game +disconnect.timeout=Timed out +disconnect.closed=Connection closed +disconnect.loginFailed=Failed to login +disconnect.loginFailedInfo=Failed to login: %s +disconnect.quitting=Quitting +disconnect.endOfStream=End of stream +disconnect.overflow=Buffer overflow +disconnect.spam=Kicked for spamming + +options.off=OFF +options.on=ON +options.visible=Shown +options.hidden=Hidden +options.title=Options +options.controls=Controls... +options.video=Video Settings... +options.language=Language... +options.languageWarning=Language translations may not be 100% accurate +options.videoTitle=Video Settings +options.music=Music +options.sound=Sound +options.invertMouse=Invert Mouse +options.fov=FOV +options.fov.min=Normal +options.fov.max=Quake Pro +options.gamma=Brightness +options.gamma.min=Moody +options.gamma.max=Bright +options.sensitivity=Sensitivity +options.sensitivity.min=*yawn* +options.sensitivity.max=HYPERSPEED!!! +options.renderDistance=Render Distance +options.renderDistance.tiny=Tiny +options.renderDistance.short=Short +options.renderDistance.normal=Normal +options.renderDistance.far=Far +options.viewBobbing=View Bobbing +options.ao=Smooth Lighting +options.ao.off=Off +options.ao.min=Minimum +options.ao.max=Maximum +options.anaglyph=3D Anaglyph +options.framerateLimit=Performance +options.difficulty=Difficulty +options.difficulty.peaceful=Peaceful +options.difficulty.easy=Easy +options.difficulty.normal=Normal +options.difficulty.hard=Hard +options.difficulty.hardcore=Hardcore +options.graphics=Graphics +options.graphics.fancy=Fancy +options.graphics.fast=Fast +options.guiScale=GUI Scale +options.guiScale.auto=Auto +options.guiScale.small=Small +options.guiScale.normal=Normal +options.guiScale.large=Large +options.advancedOpengl=Advanced OpenGL +options.renderClouds=Clouds +options.farWarning1=A 64 bit Java installation is recommended +options.farWarning2=for 'Far' render distance (you have 32 bit) +options.particles=Particles +options.particles.all=All +options.particles.decreased=Decreased +options.particles.minimal=Minimal +options.multiplayer.title=Multiplayer Settings... +options.chat.title=Chat Settings... +options.chat.visibility=Chat +options.chat.visibility.full=Shown +options.chat.visibility.system=Commands Only +options.chat.visibility.hidden=Hidden +options.chat.color=Colors +options.chat.opacity=Opacity +options.chat.links=Web Links +options.chat.links.prompt=Prompt on Links +options.chat.scale=Scale +options.chat.width=Width +options.chat.height.focused=Focused Height +options.chat.height.unfocused=Unfocused Height +options.showCape=Show Cape +options.serverTextures=Server Textures +options.snooper=Allow Snooper +options.snooper.view=Snooper Settings... +options.snooper.title=Machine Specs Collection +options.snooper.desc=We want to collect information about your machine to help improve Minecraft by knowing what we can support and where the biggest problems are. All of this information is completely anonymous and viewable below. We promise we won't do anything bad with this data, but if you want to opt out then feel free to toggle it off! +options.resourcepack=Resource Packs +options.fullscreen=Fullscreen +options.vsync=Use VSync +options.touchscreen=Touchscreen Mode + +performance.max=Max FPS +performance.balanced=Balanced +performance.powersaver=Power saver + +controls.title=Controls + +key.forward=Forward +key.left=Left +key.back=Back +key.right=Right +key.jump=Jump +key.inventory=Inventory +key.drop=Drop +key.chat=Chat +key.fog=Toggle Fog +key.sneak=Sneak +key.playerlist=List Players +key.attack=Attack +key.use=Use Item +key.pickItem=Pick Block +key.mouseButton=Button %1$s +key.command=Command + +resourcePack.openFolder=Open resource pack folder +resourcePack.title=Select Resource Pack +resourcePack.folderInfo=(Place resource pack files here) + +book.pageIndicator=Page %1$s of %2$s +book.byAuthor=by %1$s +book.signButton=Sign +book.editTitle=Enter Book Title: +book.finalizeButton=Sign and Close +book.finalizeWarning=Note! When you sign the book, it will no longer be editable. + +tile.stone.name=Stone +tile.hayBlock.name=Hay Bale +tile.grass.name=Grass Block +tile.dirt.name=Dirt +tile.stonebrick.name=Cobblestone +tile.wood.name=Wooden Planks +tile.wood.oak.name=Oak Wood Planks +tile.wood.spruce.name=Spruce Wood Planks +tile.wood.birch.name=Birch Wood Planks +tile.wood.jungle.name=Jungle Wood Planks +tile.sapling.oak.name=Oak Sapling +tile.sapling.spruce.name=Spruce Sapling +tile.sapling.birch.name=Birch Sapling +tile.sapling.jungle.name=Jungle Sapling +tile.deadbush.name=Dead Bush +tile.bedrock.name=Bedrock +tile.water.name=Water +tile.lava.name=Lava +tile.sand.name=Sand +tile.sandStone.name=Sandstone +tile.sandStone.default.name=Sandstone +tile.sandStone.chiseled.name=Chiseled Sandstone +tile.sandStone.smooth.name=Smooth Sandstone +tile.gravel.name=Gravel +tile.oreGold.name=Gold Ore +tile.oreIron.name=Iron Ore +tile.oreCoal.name=Coal Ore +tile.log.name=Wood +tile.log.oak.name=Oak Wood +tile.log.spruce.name=Spruce Wood +tile.log.birch.name=Birch Wood +tile.log.jungle.name=Jungle Wood +tile.leaves.name=Leaves +tile.leaves.oak.name=Oak Leaves +tile.leaves.spruce.name=Spruce Leaves +tile.leaves.birch.name=Birch Leaves +tile.leaves.jungle.name=Jungle Leaves +tile.tallgrass.name=Grass +tile.tallgrass.shrub.name=Shrub +tile.tallgrass.grass.name=Grass +tile.tallgrass.fern.name=Fern +tile.sponge.name=Sponge +tile.glass.name=Glass +tile.thinGlass.name=Glass Pane +tile.cloth.name=Wool +tile.flower.name=Flower +tile.rose.name=Rose +tile.mushroom.name=Mushroom +tile.blockGold.name=Block of Gold +tile.blockIron.name=Block of Iron +tile.stoneSlab.stone.name=Stone Slab +tile.stoneSlab.sand.name=Sandstone Slab +tile.stoneSlab.wood.name=Wooden Slab +tile.stoneSlab.cobble.name=Cobblestone Slab +tile.stoneSlab.brick.name=Bricks Slab +tile.stoneSlab.smoothStoneBrick.name=Stone Bricks Slab +tile.stoneSlab.netherBrick.name=Nether Brick Slab +tile.stoneSlab.quartz.name=Quartz Slab +tile.woodSlab.oak.name=Oak Wood Slab +tile.woodSlab.spruce.name=Spruce Wood Slab +tile.woodSlab.birch.name=Birch Wood Slab +tile.woodSlab.jungle.name=Jungle Wood Slab +tile.brick.name=Bricks +tile.tnt.name=TNT +tile.bookshelf.name=Bookshelf +tile.stoneMoss.name=Moss Stone +tile.obsidian.name=Obsidian +tile.torch.name=Torch +tile.fire.name=Fire +tile.mobSpawner.name=Monster Spawner +tile.stairsWood.name=Oak Wood Stairs +tile.stairsWoodSpruce.name=Spruce Wood Stairs +tile.stairsWoodBirch.name=Birch Wood Stairs +tile.stairsWoodJungle.name=Jungle Wood Stairs +tile.chest.name=Chest +tile.chestTrap.name=Trapped Chest +tile.redstoneDust.name=Redstone Dust +tile.oreDiamond.name=Diamond Ore +tile.blockCoal.name=Block of Coal +tile.blockDiamond.name=Block of Diamond +tile.workbench.name=Crafting Table +tile.crops.name=Crops +tile.farmland.name=Farmland +tile.furnace.name=Furnace +tile.sign.name=Sign +tile.doorWood.name=Wooden Door +tile.ladder.name=Ladder +tile.rail.name=Rail +tile.goldenRail.name=Powered Rail +tile.activatorRail.name=Activator Rail +tile.detectorRail.name=Detector Rail +tile.stairsStone.name=Stone Stairs +tile.stairsSandStone.name=Sandstone Stairs +tile.lever.name=Lever +tile.pressurePlate.name=Pressure Plate +tile.weightedPlate_light.name=Weighted Pressure Plate (Light) +tile.weightedPlate_heavy.name=Weighted Pressure Plate (Heavy) +tile.doorIron.name=Iron Door +tile.oreRedstone.name=Redstone Ore +tile.notGate.name=Redstone Torch +tile.button.name=Button +tile.snow.name=Snow +tile.woolCarpet.black.name=Black Carpet +tile.woolCarpet.red.name=Red Carpet +tile.woolCarpet.green.name=Green Carpet +tile.woolCarpet.brown.name=Brown Carpet +tile.woolCarpet.blue.name=Blue Carpet +tile.woolCarpet.purple.name=Purple Carpet +tile.woolCarpet.cyan.name=Cyan Carpet +tile.woolCarpet.silver.name=Light Gray Carpet +tile.woolCarpet.gray.name=Gray Carpet +tile.woolCarpet.pink.name=Pink Carpet +tile.woolCarpet.lime.name=Lime Carpet +tile.woolCarpet.yellow.name=Yellow Carpet +tile.woolCarpet.lightBlue.name=Light Blue Carpet +tile.woolCarpet.magenta.name=Magenta Carpet +tile.woolCarpet.orange.name=Orange Carpet +tile.woolCarpet.white.name=Carpet +tile.ice.name=Ice +tile.cactus.name=Cactus +tile.clay.name=Clay +tile.clayHardenedStained.black.name=Black Stained Clay +tile.clayHardenedStained.red.name=Red Stained Clay +tile.clayHardenedStained.green.name=Green Stained Clay +tile.clayHardenedStained.brown.name=Brown Stained Clay +tile.clayHardenedStained.blue.name=Blue Stained Clay +tile.clayHardenedStained.purple.name=Purple Stained Clay +tile.clayHardenedStained.cyan.name=Cyan Stained Clay +tile.clayHardenedStained.silver.name=Light Gray Stained Clay +tile.clayHardenedStained.gray.name=Gray Stained Clay +tile.clayHardenedStained.pink.name=Pink Stained Clay +tile.clayHardenedStained.lime.name=Lime Stained Clay +tile.clayHardenedStained.yellow.name=Yellow Stained Clay +tile.clayHardenedStained.lightBlue.name=Light Blue Stained Clay +tile.clayHardenedStained.magenta.name=Magenta Stained Clay +tile.clayHardenedStained.orange.name=Orange Stained Clay +tile.clayHardenedStained.white.name=White Stained Clay +tile.clayHardened.name=Hardened Clay +tile.reeds.name=Sugar cane +tile.jukebox.name=Jukebox +tile.fence.name=Fence +tile.fenceGate.name=Fence Gate +tile.pumpkin.name=Pumpkin +tile.litpumpkin.name=Jack o'Lantern +tile.hellrock.name=Netherrack +tile.hellsand.name=Soul Sand +tile.lightgem.name=Glowstone +tile.portal.name=Portal +tile.cloth.black.name=Black Wool +tile.cloth.red.name=Red Wool +tile.cloth.green.name=Green Wool +tile.cloth.brown.name=Brown Wool +tile.cloth.blue.name=Blue Wool +tile.cloth.purple.name=Purple Wool +tile.cloth.cyan.name=Cyan Wool +tile.cloth.silver.name=Light Gray Wool +tile.cloth.gray.name=Gray Wool +tile.cloth.pink.name=Pink Wool +tile.cloth.lime.name=Lime Wool +tile.cloth.yellow.name=Yellow Wool +tile.cloth.lightBlue.name=Light Blue Wool +tile.cloth.magenta.name=Magenta Wool +tile.cloth.orange.name=Orange Wool +tile.cloth.white.name=Wool +tile.oreLapis.name=Lapis Lazuli Ore +tile.blockLapis.name=Lapis Lazuli Block +tile.dispenser.name=Dispenser +tile.dropper.name=Dropper +tile.musicBlock.name=Note Block +tile.cake.name=Cake +tile.bed.name=Bed +tile.bed.occupied=This bed is occupied +tile.bed.noSleep=You can only sleep at night +tile.bed.notSafe=You may not rest now, there are monsters nearby +tile.bed.notValid=Your home bed was missing or obstructed +tile.lockedchest.name=Locked chest +tile.trapdoor.name=Trapdoor +tile.web.name=Cobweb +tile.stonebricksmooth.name=Stone Bricks +tile.stonebricksmooth.default.name=Stone Bricks +tile.stonebricksmooth.mossy.name=Mossy Stone Bricks +tile.stonebricksmooth.cracked.name=Cracked Stone Bricks +tile.stonebricksmooth.chiseled.name=Chiseled Stone Bricks +tile.monsterStoneEgg.stone.name=Stone Monster Egg +tile.monsterStoneEgg.cobble.name=Cobblestone Monster Egg +tile.monsterStoneEgg.brick.name=Stone Brick Monster Egg +tile.pistonBase.name=Piston +tile.pistonStickyBase.name=Sticky Piston +tile.fenceIron.name=Iron Bars +tile.melon.name=Melon +tile.stairsBrick.name=Brick Stairs +tile.stairsStoneBrickSmooth.name=Stone Brick Stairs +tile.vine.name=Vines +tile.netherBrick.name=Nether Brick +tile.netherFence.name=Nether Brick Fence +tile.stairsNetherBrick.name=Nether Brick Stairs +tile.netherStalk.name=Nether Wart +tile.cauldron.name=Cauldron +tile.enchantmentTable.name=Enchantment Table +tile.anvil.name=Anvil +tile.anvil.intact.name=Anvil +tile.anvil.slightlyDamaged.name=Slightly Damaged Anvil +tile.anvil.veryDamaged.name=Very Damaged Anvil +tile.whiteStone.name=End Stone +tile.endPortalFrame.name=End Portal +tile.mycel.name=Mycelium +tile.waterlily.name=Lily Pad +tile.dragonEgg.name=Dragon Egg +tile.redstoneLight.name=Redstone Lamp +tile.cocoa.name=Cocoa +tile.enderChest.name=Ender Chest +tile.oreRuby.name=Ruby Ore +tile.oreEmerald.name=Emerald Ore +tile.blockEmerald.name=Block of Emerald +tile.blockRedstone.name=Block of Redstone +tile.tripWire.name=Tripwire +tile.tripWireSource.name=Tripwire Hook +tile.commandBlock.name=Command Block +tile.beacon.name=Beacon +tile.beacon.primary=Primary Power +tile.beacon.secondary=Secondary Power +tile.cobbleWall.normal.name=Cobblestone Wall +tile.cobbleWall.mossy.name=Mossy Cobblestone Wall +tile.carrots.name=Carrots +tile.potatoes.name=Potatoes +tile.daylightDetector.name=Daylight Sensor +tile.netherquartz.name=Nether Quartz Ore +tile.hopper.name=Hopper +tile.quartzBlock.default.name=Block of Quartz +tile.quartzBlock.chiseled.name=Chiseled Quartz Block +tile.quartzBlock.lines.name=Pillar Quartz Block +tile.stairsQuartz.name=Quartz Stairs + +item.nameTag.name=Name Tag +item.leash.name=Lead +item.shovelIron.name=Iron Shovel +item.pickaxeIron.name=Iron Pickaxe +item.hatchetIron.name=Iron Axe +item.flintAndSteel.name=Flint and Steel +item.apple.name=Apple +item.cookie.name=Cookie +item.bow.name=Bow +item.arrow.name=Arrow +item.coal.name=Coal +item.charcoal.name=Charcoal +item.diamond.name=Diamond +item.emerald.name=Emerald +item.ingotIron.name=Iron Ingot +item.ingotGold.name=Gold Ingot +item.swordIron.name=Iron Sword +item.swordWood.name=Wooden Sword +item.shovelWood.name=Wooden Shovel +item.pickaxeWood.name=Wooden Pickaxe +item.hatchetWood.name=Wooden Axe +item.swordStone.name=Stone Sword +item.shovelStone.name=Stone Shovel +item.pickaxeStone.name=Stone Pickaxe +item.hatchetStone.name=Stone Axe +item.swordDiamond.name=Diamond Sword +item.shovelDiamond.name=Diamond Shovel +item.pickaxeDiamond.name=Diamond Pickaxe +item.hatchetDiamond.name=Diamond Axe +item.stick.name=Stick +item.bowl.name=Bowl +item.mushroomStew.name=Mushroom Stew +item.swordGold.name=Golden Sword +item.shovelGold.name=Golden Shovel +item.pickaxeGold.name=Golden Pickaxe +item.hatchetGold.name=Golden Axe +item.string.name=String +item.feather.name=Feather +item.sulphur.name=Gunpowder +item.hoeWood.name=Wooden Hoe +item.hoeStone.name=Stone Hoe +item.hoeIron.name=Iron Hoe +item.hoeDiamond.name=Diamond Hoe +item.hoeGold.name=Golden Hoe +item.seeds.name=Seeds +item.seeds_pumpkin.name=Pumpkin Seeds +item.seeds_melon.name=Melon Seeds +item.melon.name=Melon +item.wheat.name=Wheat +item.bread.name=Bread +item.helmetCloth.name=Leather Cap +item.chestplateCloth.name=Leather Tunic +item.leggingsCloth.name=Leather Pants +item.bootsCloth.name=Leather Boots +item.helmetChain.name=Chain Helmet +item.chestplateChain.name=Chain Chestplate +item.leggingsChain.name=Chain Leggings +item.bootsChain.name=Chain Boots +item.helmetIron.name=Iron Helmet +item.chestplateIron.name=Iron Chestplate +item.leggingsIron.name=Iron Leggings +item.bootsIron.name=Iron Boots +item.helmetDiamond.name=Diamond Helmet +item.chestplateDiamond.name=Diamond Chestplate +item.leggingsDiamond.name=Diamond Leggings +item.bootsDiamond.name=Diamond Boots +item.helmetGold.name=Golden Helmet +item.chestplateGold.name=Golden Chestplate +item.leggingsGold.name=Golden Leggings +item.bootsGold.name=Golden Boots +item.flint.name=Flint +item.porkchopRaw.name=Raw Porkchop +item.porkchopCooked.name=Cooked Porkchop +item.chickenRaw.name=Raw Chicken +item.chickenCooked.name=Cooked Chicken +item.beefRaw.name=Raw Beef +item.beefCooked.name=Steak +item.painting.name=Painting +item.frame.name=Item Frame +item.appleGold.name=Golden Apple +item.sign.name=Sign +item.doorWood.name=Wooden Door +item.bucket.name=Bucket +item.bucketWater.name=Water Bucket +item.bucketLava.name=Lava Bucket +item.minecart.name=Minecart +item.saddle.name=Saddle +item.doorIron.name=Iron Door +item.redstone.name=Redstone +item.snowball.name=Snowball +item.boat.name=Boat +item.leather.name=Leather +item.milk.name=Milk +item.brick.name=Brick +item.clay.name=Clay +item.reeds.name=Sugar Canes +item.paper.name=Paper +item.book.name=Book +item.slimeball.name=Slimeball +item.minecartChest.name=Minecart with Chest +item.minecartFurnace.name=Minecart with Furnace +item.minecartTnt.name=Minecart with TNT +item.minecartHopper.name=Minecart with Hopper +item.egg.name=Egg +item.compass.name=Compass +item.fishingRod.name=Fishing Rod +item.clock.name=Clock +item.yellowDust.name=Glowstone Dust +item.fishRaw.name=Raw Fish +item.fishCooked.name=Cooked Fish +item.record.name=Music Disc +item.bone.name=Bone +item.dyePowder.black.name=Ink Sac +item.dyePowder.red.name=Rose Red +item.dyePowder.green.name=Cactus Green +item.dyePowder.brown.name=Cocoa Beans +item.dyePowder.blue.name=Lapis Lazuli +item.dyePowder.purple.name=Purple Dye +item.dyePowder.cyan.name=Cyan Dye +item.dyePowder.silver.name=Light Gray Dye +item.dyePowder.gray.name=Gray Dye +item.dyePowder.pink.name=Pink Dye +item.dyePowder.lime.name=Lime Dye +item.dyePowder.yellow.name=Dandelion Yellow +item.dyePowder.lightBlue.name=Light Blue Dye +item.dyePowder.magenta.name=Magenta Dye +item.dyePowder.orange.name=Orange Dye +item.dyePowder.white.name=Bone Meal +item.sugar.name=Sugar +item.cake.name=Cake +item.bed.name=Bed +item.diode.name=Redstone Repeater +item.comparator.name=Redstone Comparator +item.map.name=Map +item.leaves.name=Leaves +item.shears.name=Shears +item.rottenFlesh.name=Rotten Flesh +item.enderPearl.name=Ender Pearl +item.blazeRod.name=Blaze Rod +item.ghastTear.name=Ghast Tear +item.netherStalkSeeds.name=Nether Wart +item.potion.name=Potion +item.emptyPotion.name=Water Bottle +item.goldNugget.name=Gold Nugget +item.glassBottle.name=Glass Bottle +item.spiderEye.name=Spider Eye +item.fermentedSpiderEye.name=Fermented Spider Eye +item.blazePowder.name=Blaze Powder +item.magmaCream.name=Magma Cream +item.cauldron.name=Cauldron +item.brewingStand.name=Brewing Stand +item.eyeOfEnder.name=Eye of Ender +item.speckledMelon.name=Glistering Melon +item.monsterPlacer.name=Spawn +item.expBottle.name=Bottle o' Enchanting +item.fireball.name=Fire Charge +item.writingBook.name=Book and Quill +item.writtenBook.name=Written Book +item.ruby.name=Ruby +item.flowerPot.name=Flower Pot +item.emptyMap.name=Empty Map +item.carrots.name=Carrot +item.carrotGolden.name=Golden Carrot +item.potato.name=Potato +item.potatoBaked.name=Baked Potato +item.potatoPoisonous.name=Poisonous Potato +item.skull.skeleton.name=Skeleton Skull +item.skull.wither.name=Wither Skeleton Skull +item.skull.zombie.name=Zombie Head +item.skull.char.name=Head +item.skull.player.name=%s's Head +item.skull.creeper.name=Creeper Head +item.carrotOnAStick.name=Carrot on a Stick +item.netherStar.name=Nether Star +item.pumpkinPie.name=Pumpkin Pie +item.enchantedBook.name=Enchanted Book +item.fireworks.name=Firework Rocket +item.fireworks.flight=Flight Duration: +item.fireworksCharge.name=Firework Star +item.fireworksCharge.black=Black +item.fireworksCharge.red=Red +item.fireworksCharge.green=Green +item.fireworksCharge.brown=Brown +item.fireworksCharge.blue=Blue +item.fireworksCharge.purple=Purple +item.fireworksCharge.cyan=Cyan +item.fireworksCharge.silver=Light Gray +item.fireworksCharge.gray=Gray +item.fireworksCharge.pink=Pink +item.fireworksCharge.lime=Lime +item.fireworksCharge.yellow=Yellow +item.fireworksCharge.lightBlue=Light Blue +item.fireworksCharge.magenta=Magenta +item.fireworksCharge.orange=Orange +item.fireworksCharge.white=White +item.fireworksCharge.customColor=Custom +item.fireworksCharge.fadeTo=Fade to +item.fireworksCharge.flicker=Twinkle +item.fireworksCharge.trail=Trail +item.fireworksCharge.type.0=Small Ball +item.fireworksCharge.type.1=Large Ball +item.fireworksCharge.type.2=Star-shaped +item.fireworksCharge.type.3=Creeper-shaped +item.fireworksCharge.type.4=Burst +item.fireworksCharge.type=Unknown Shape +item.netherbrick.name=Nether Brick +item.netherquartz.name=Nether Quartz +item.horsearmormetal.name=Iron Horse Armor +item.horsearmorgold.name=Gold Horse Armor +item.horsearmordiamond.name=Diamond Horse Armor + +container.inventory=Inventory +container.hopper=Item Hopper +container.crafting=Crafting +container.dispenser=Dispenser +container.dropper=Dropper +container.furnace=Furnace +container.enchant=Enchant +container.repair=Repair & Name +container.repair.cost=Enchantment Cost: %1$d +container.repair.expensive=Too Expensive! +container.creative=Item Selection +container.brewing=Brewing Stand +container.chest=Chest +container.chestDouble=Large Chest +container.minecart=Minecart +container.enderchest=Ender Chest + +item.dyed=Dyed + +entity.Item.name=Item +entity.XPOrb.name=Experience Orb +entity.SmallFireball.name=Small Fireball +entity.Fireball.name=Fireball + +entity.Arrow.name=Arrow +entity.Snowball.name=Snowball +entity.Painting.name=Painting + +entity.Mob.name=Mob +entity.Monster.name=Monster + +entity.Creeper.name=Creeper +entity.Skeleton.name=Skeleton +entity.Spider.name=Spider +entity.Giant.name=Giant +entity.Zombie.name=Zombie +entity.Slime.name=Slime +entity.Ghast.name=Ghast +entity.PigZombie.name=Zombie Pigman +entity.Enderman.name=Enderman +entity.Silverfish.name=Silverfish +entity.CaveSpider.name=Cave Spider +entity.Blaze.name=Blaze +entity.LavaSlime.name=Magma Cube +entity.MushroomCow.name=Mooshroom +entity.Villager.name=Villager +entity.VillagerGolem.name=Iron Golem +entity.SnowMan.name=Snow Golem +entity.EnderDragon.name=Ender Dragon +entity.WitherBoss.name=Wither +entity.Witch.name=Witch + +entity.Pig.name=Pig +entity.Sheep.name=Sheep +entity.Cow.name=Cow +entity.Chicken.name=Chicken +entity.Squid.name=Squid +entity.Wolf.name=Wolf +entity.Ozelot.name=Ocelot +entity.Cat.name=Cat +entity.Bat.name=Bat +entity.EntityHorse.name=Horse +entity.horse.name=Horse +entity.donkey.name=Donkey +entity.mule.name=Mule +entity.skeletonhorse.name=Skeleton Horse +entity.zombiehorse.name=Zombie Horse + +entity.PrimedTnt.name=Block of TNT +entity.FallingSand.name=Falling Block + +entity.Minecart.name=Minecart +entity.Boat.name=Boat + +entity.Arrow.name=arrow +entity.generic.name=unknown + +death.fell.accident.ladder=%1$s fell off a ladder +death.fell.accident.vines=%1$s fell off some vines +death.fell.accident.water=%1$s fell out of the water +death.fell.accident.generic=%1$s fell from a high place +death.fell.killer=%1$s was doomed to fall +death.fell.assist=%1$s was doomed to fall by %2$s +death.fell.assist.item=%1$s was doomed to fall by %2$s using %3$s +death.fell.finish=%1$s fell too far and was finished by %2$s +death.fell.finish.item=%1$s fell too far and was finished by %2$s using %3$s + +death.attack.inFire=%1$s went up in flames +death.attack.inFire.player=%1$s walked into fire whilst fighting %2$s +death.attack.onFire=%1$s burned to death +death.attack.onFire.player=%1$s was burnt to a crisp whilst fighting %2$s +death.attack.lava=%1$s tried to swim in lava +death.attack.lava.player=%1$s tried to swim in lava to escape %2$s +death.attack.inWall=%1$s suffocated in a wall +death.attack.drown=%1$s drowned +death.attack.drown.player=%1$s drowned whilst trying to escape %2$s +death.attack.starve=%1$s starved to death +death.attack.cactus=%1$s was pricked to death +death.attack.cactus.player=%1$s walked into a cactus whilst trying to escape %2$s +death.attack.generic=%1$s died +death.attack.explosion=%1$s blew up +death.attack.explosion.player=%1$s was blown up by %2$s +death.attack.magic=%1$s was killed by magic +death.attack.wither=%1$s withered away +death.attack.anvil=%1$s was squashed by a falling anvil +death.attack.fallingBlock=%1$s was squashed by a falling block +death.attack.mob=%1$s was slain by %2$s +death.attack.player=%1$s was slain by %2$s +death.attack.player.item=%1$s was slain by %2$s using %3$s +death.attack.arrow=%1$s was shot by %2$s +death.attack.arrow.item=%1$s was shot by %2$s using %3$s +death.attack.fireball=%1$s was fireballed by %2$s +death.attack.fireball.item=%1$s was fireballed by %2$s using %3$s +death.attack.thrown=%1$s was pummeled by %2$s +death.attack.thrown.item=%1$s was pummeled by %2$s using %3$s +death.attack.indirectMagic=%1$s was killed by %2$s using magic +death.attack.indirectMagic.item=%1$s was killed by %2$s using %3$s +death.attack.thorns=%1$s was killed trying to hurt %2$s +death.attack.fall=%1$s hit the ground too hard +death.attack.outOfWorld=%1$s fell out of the world + +deathScreen.respawn=Respawn +deathScreen.deleteWorld=Delete world +deathScreen.titleScreen=Title screen +deathScreen.score=Score +deathScreen.title.hardcore=Game over! +deathScreen.hardcoreInfo=You cannot respawn in hardcore mode! +deathScreen.title=You died! +deathScreen.leaveServer=Leave server + +potion.effects.whenDrank=When Applied: +potion.empty=No Effects +potion.moveSpeed=Speed +potion.moveSlowdown=Slowness +potion.digSpeed=Haste +potion.digSlowDown=Mining Fatigue +potion.damageBoost=Strength +potion.weakness=Weakness +potion.heal=Instant Health +potion.harm=Instant Damage +potion.jump=Jump Boost +potion.confusion=Nausea +potion.regeneration=Regeneration +potion.resistance=Resistance +potion.fireResistance=Fire Resistance +potion.waterBreathing=Water Breathing +potion.invisibility=Invisibility +potion.blindness=Blindness +potion.nightVision=Night Vision +potion.hunger=Hunger +potion.poison=Poison +potion.wither=Wither +potion.healthBoost=Health Boost +potion.absorption=Absorption +potion.saturation=Saturation + +potion.moveSpeed.postfix=Potion of Swiftness +potion.moveSlowdown.postfix=Potion of Slowness +potion.digSpeed.postfix=Potion of Haste +potion.digSlowDown.postfix=Potion of Dullness +potion.damageBoost.postfix=Potion of Strength +potion.weakness.postfix=Potion of Weakness +potion.heal.postfix=Potion of Healing +potion.harm.postfix=Potion of Harming +potion.jump.postfix=Potion of Leaping +potion.confusion.postfix=Potion of Nausea +potion.regeneration.postfix=Potion of Regeneration +potion.resistance.postfix=Potion of Resistance +potion.fireResistance.postfix=Potion of Fire Resistance +potion.waterBreathing.postfix=Potion of Water Breathing +potion.invisibility.postfix=Potion of Invisibility +potion.blindness.postfix=Potion of Blindness +potion.nightVision.postfix=Potion of Night Vision +potion.hunger.postfix=Potion of Hunger +potion.poison.postfix=Potion of Poison +potion.wither.postfix=Potion of Decay +potion.healthBoost.postfix=Potion of Health Boost +potion.absorption.postfix=Potion of Absorption +potion.saturation.postfix=Potion of Saturation + +potion.potency.0= +potion.potency.1=II +potion.potency.2=III +potion.potency.3=IV + +potion.prefix.grenade=Splash +potion.prefix.mundane=Mundane +potion.prefix.uninteresting=Uninteresting +potion.prefix.bland=Bland +potion.prefix.clear=Clear +potion.prefix.milky=Milky +potion.prefix.diffuse=Diffuse +potion.prefix.artless=Artless +potion.prefix.thin=Thin +potion.prefix.awkward=Awkward +potion.prefix.flat=Flat +potion.prefix.bulky=Bulky +potion.prefix.bungling=Bungling +potion.prefix.buttered=Buttered +potion.prefix.smooth=Smooth +potion.prefix.suave=Suave +potion.prefix.debonair=Debonair +potion.prefix.thick=Thick +potion.prefix.elegant=Elegant +potion.prefix.fancy=Fancy +potion.prefix.charming=Charming +potion.prefix.dashing=Dashing +potion.prefix.refined=Refined +potion.prefix.cordial=Cordial +potion.prefix.sparkling=Sparkling +potion.prefix.potent=Potent +potion.prefix.foul=Foul +potion.prefix.odorless=Odorless +potion.prefix.rank=Rank +potion.prefix.harsh=Harsh +potion.prefix.acrid=Acrid +potion.prefix.gross=Gross +potion.prefix.stinky=Stinky + +enchantment.damage.all=Sharpness +enchantment.damage.undead=Smite +enchantment.damage.arthropods=Bane of Arthropods +enchantment.knockback=Knockback +enchantment.fire=Fire Aspect +enchantment.protect.all=Protection +enchantment.protect.fire=Fire Protection +enchantment.protect.fall=Feather Falling +enchantment.protect.explosion=Blast Protection +enchantment.protect.projectile=Projectile Protection +enchantment.oxygen=Respiration +enchantment.waterWorker=Aqua Affinity +enchantment.digging=Efficiency +enchantment.untouching=Silk Touch +enchantment.durability=Unbreaking +enchantment.lootBonus=Looting +enchantment.lootBonusDigger=Fortune +enchantment.arrowDamage=Power +enchantment.arrowFire=Flame +enchantment.arrowKnockback=Punch +enchantment.arrowInfinite=Infinity +enchantment.thorns=Thorns + +enchantment.level.1=I +enchantment.level.2=II +enchantment.level.3=III +enchantment.level.4=IV +enchantment.level.5=V +enchantment.level.6=VI +enchantment.level.7=VII +enchantment.level.8=VIII +enchantment.level.9=IX +enchantment.level.10=X + +gui.achievements=Achievements +gui.stats=Statistics + +stat.generalButton=General +stat.blocksButton=Blocks +stat.itemsButton=Items + +stat.used=Times Used +stat.mined=Times Mined +stat.depleted=Times Depleted +stat.crafted=Times Crafted + +stat.startGame=Times played +stat.createWorld=Worlds created +stat.loadWorld=Saves loaded +stat.joinMultiplayer=Multiplayer joins +stat.leaveGame=Games quit + +stat.playOneMinute=Minutes Played + +stat.walkOneCm=Distance Walked +stat.fallOneCm=Distance Fallen +stat.swimOneCm=Distance Swum +stat.flyOneCm=Distance Flown +stat.climbOneCm=Distance Climbed +stat.diveOneCm=Distance Dove +stat.minecartOneCm=Distance by Minecart +stat.boatOneCm=Distance by Boat +stat.pigOneCm=Distance by Pig +stat.jump=Jumps +stat.drop=Items Dropped + +stat.damageDealt=Damage Dealt +stat.damageTaken=Damage Taken +stat.deaths=Number of Deaths +stat.mobKills=Mob Kills +stat.playerKills=Player Kills +stat.fishCaught=Fish Caught + +stat.mineBlock=%1$s Mined +stat.craftItem=%1$s Crafted +stat.useItem=%1$s Used +stat.breakItem=%1$s Depleted + +achievement.get=Achievement get! + +achievement.taken=Taken! + +achievement.requires=Requires '%1$s' +achievement.openInventory=Taking Inventory +achievement.openInventory.desc=Press '%1$s' to open your inventory. +achievement.mineWood=Getting Wood +achievement.mineWood.desc=Attack a tree until a block of wood pops out +achievement.buildWorkBench=Benchmarking +achievement.buildWorkBench.desc=Craft a workbench with four blocks of planks +achievement.buildPickaxe=Time to Mine! +achievement.buildPickaxe.desc=Use planks and sticks to make a pickaxe +achievement.buildFurnace=Hot Topic +achievement.buildFurnace.desc=Construct a furnace out of eight stone blocks +achievement.acquireIron=Acquire Hardware +achievement.acquireIron.desc=Smelt an iron ingot +achievement.buildHoe=Time to Farm! +achievement.buildHoe.desc=Use planks and sticks to make a hoe +achievement.makeBread=Bake Bread +achievement.makeBread.desc=Turn wheat into bread +achievement.bakeCake=The Lie +achievement.bakeCake.desc=Wheat, sugar, milk and eggs! +achievement.buildBetterPickaxe=Getting an Upgrade +achievement.buildBetterPickaxe.desc=Construct a better pickaxe +achievement.cookFish=Delicious Fish +achievement.cookFish.desc=Catch and cook fish! +achievement.onARail=On A Rail +achievement.onARail.desc=Travel by minecart at least 1 km from where you started +achievement.buildSword=Time to Strike! +achievement.buildSword.desc=Use planks and sticks to make a sword +achievement.killEnemy=Monster Hunter +achievement.killEnemy.desc=Attack and destroy a monster +achievement.killCow=Cow Tipper +achievement.killCow.desc=Harvest some leather +achievement.flyPig=When Pigs Fly +achievement.flyPig.desc=Fly a pig off a cliff +achievement.snipeSkeleton=Sniper Duel +achievement.snipeSkeleton.desc=Kill a skeleton with an arrow from more than 50 meters +achievement.diamonds=DIAMONDS! +achievement.diamonds.desc=Acquire diamonds with your iron tools +achievement.portal=We Need to Go Deeper +achievement.portal.desc=Build a portal to the Nether +achievement.ghast=Return to Sender +achievement.ghast.desc=Destroy a Ghast with a fireball +achievement.blazeRod=Into Fire +achievement.blazeRod.desc=Relieve a Blaze of its rod +achievement.potion=Local Brewery +achievement.potion.desc=Brew a potion +achievement.theEnd=The End? +achievement.theEnd.desc=Locate the End +achievement.theEnd2=The End. +achievement.theEnd2.desc=Defeat the Ender Dragon +achievement.enchantments=Enchanter +achievement.enchantments.desc=Use a book, obsidian and diamonds to construct an enchantment table +achievement.overkill=Overkill +achievement.overkill.desc=Deal eight hearts of damage in a single hit +achievement.bookcase=Librarian +achievement.bookcase.desc=Build some bookshelves to improve your enchantment table + +commands.generic.exception=An unknown error occurred while attempting to perform this command +commands.generic.permission=You do not have permission to use this command +commands.generic.syntax=Invalid command syntax +commands.generic.player.notFound=That player cannot be found +commands.generic.notFound=Unknown command. Try /help for a list of commands +commands.generic.num.invalid='%s' is not a valid number +commands.generic.boolean.invalid='%s' is not true or false +commands.generic.num.tooSmall=The number you have entered (%d) is too small, it must be at least %d +commands.generic.num.tooBig=The number you have entered (%d) is too big, it must be at most %d +commands.generic.double.tooSmall=The number you have entered (%.2f) is too small, it must be at least %.2f +commands.generic.double.tooBig=The number you have entered (%.2f) is too big, it must be at most %.2f +commands.generic.usage=Usage: %s + +commands.setidletimeout.usage=/setidletimeout +commands.setidletimeout.success=Successfully set the idle timeout to %d minutes. +commands.xp.failure.widthdrawXp=Cannot give player negative experience points +commands.xp.success=Given %d experience to %s +commands.xp.success.levels=Given %d levels to %s +commands.xp.success.negative.levels=Taken %d levels from %s +commands.xp.usage=/xp [player] OR /xp L [player] +commands.playsound.usage=/playsound [x] [y] [z] [volume] [pitch] [minimumVolume] +commands.playsound.success=Played sound '%s' to %s +commands.playsound.playerTooFar=Player %s is too far away to hear the sound +commands.give.usage=/give [amount] [data] +commands.give.notFound=There is no such item with ID %d +commands.give.success=Given %s (ID %d) * %d to %s +commands.effect.usage=/effect [seconds] [amplifier] +commands.effect.notFound=There is no such mob effect with ID %d +commands.effect.success=Given %1$s (ID %2$d) * %3$d to %4$s for %5$d seconds +commands.effect.success.removed=Took %1$s from %2$s +commands.effect.success.removed.all=Took all effects from %s +commands.effect.failure.notActive=Couldn't take %1$s from %2$s as they do not have the effect +commands.effect.failure.notActive.all=Couldn't take any effects from %s as they do not have any +commands.enchant.usage=/enchant [level] +commands.enchant.notFound=There is no such enchantment with ID %d +commands.enchant.noItem=The target doesn't hold an item +commands.enchant.cantEnchant=The selected enchantment can't be added to the target item +commands.enchant.cantCombine=%1$s can't be combined with %2$s +commands.enchant.success=Enchanting succeeded +commands.clear.usage=/clear [item] [data] +commands.clear.success=Cleared the inventory of %s, removing %d items +commands.clear.failure=Could not clear the inventory of %s, no items to remove +commands.downfall.usage=/toggledownfall +commands.downfall.success=Toggled downfall +commands.time.usage=/time +commands.time.added=Added %d to the time +commands.time.set=Set the time to %d +commands.players.usage=/list +commands.players.list=There are %d/%d players online: +commands.banlist.ips=There are %d total banned IP addresses: +commands.banlist.players=There are %d total banned players: +commands.banlist.usage=/banlist [ips|players] +commands.kill.usage=/kill +commands.kill.success=Ouch! That looked like it hurt +commands.kick.success=Kicked %s from the game +commands.kick.success.reason=Kicked %s from the game: '%s' +commands.kick.usage=/kick [reason ...] +commands.op.success=Opped %s +commands.op.usage=/op +commands.deop.success=De-opped %s +commands.deop.usage=/deop +commands.say.usage=/say +commands.ban.success=Banned player %s +commands.ban.usage=/ban [reason ...] +commands.unban.success=Unbanned player %s +commands.unban.usage=/pardon +commands.banip.invalid=You have entered an invalid IP address or a player that is not online +commands.banip.success=Banned IP address %s +commands.banip.success.players=Banned IP address %s belonging to %s +commands.banip.usage=/ban-ip [reason ...] +commands.unbanip.invalid=You have entered an invalid IP address +commands.unbanip.success=Unbanned IP address %s +commands.unbanip.usage=/pardon-ip
+commands.save.usage=/save-all +commands.save-on.alreadyOn=Saving is already turned on. +commands.save-on.usage=/save-on +commands.save-off.alreadyOff=Saving is already turned off. +commands.save-off.usage=/save-off +commands.save.enabled=Turned on world auto-saving +commands.save.disabled=Turned off world auto-saving +commands.save.start=Saving... +commands.save.success=Saved the world +commands.save.failed=Saving failed: %s +commands.stop.usage=/stop +commands.stop.start=Stopping the server +commands.tp.success=Teleported %s to %s +commands.tp.success.coordinates=Teleported %s to %.2f,%.2f,%.2f +commands.tp.usage=/tp [target player] OR /tp [target player] +commands.tp.notSameDimension=Unable to teleport because players are not in the same dimension +commands.whitelist.list=There are %d (out of %d seen) whitelisted players: +commands.whitelist.enabled=Turned on the whitelist +commands.whitelist.disabled=Turned off the whitelist +commands.whitelist.reloaded=Reloaded the whitelist +commands.whitelist.add.success=Added %s to the whitelist +commands.whitelist.add.usage=/whitelist add +commands.whitelist.remove.success=Removed %s from the whitelist +commands.whitelist.remove.usage=/whitelist remove +commands.whitelist.usage=/whitelist +commands.scoreboard.usage=/scoreboard +commands.scoreboard.teamNotFound=No team was found by the name '%s' +commands.scoreboard.objectiveNotFound=No objective was found by the name '%s' +commands.scoreboard.objectiveReadOnly=The objective '%s' is read-only and cannot be set +commands.scoreboard.objectives.usage=/scoreboard objectives +commands.scoreboard.objectives.setdisplay.usage=/scoreboard objectives setdisplay [objective] +commands.scoreboard.objectives.setdisplay.invalidSlot=No such display slot '%s' +commands.scoreboard.objectives.setdisplay.successCleared=Cleared objective display slot '%s' +commands.scoreboard.objectives.setdisplay.successSet=Set the display objective in slot '%s' to '%s' +commands.scoreboard.objectives.add.usage=/scoreboard objectives add [display name ...] +commands.scoreboard.objectives.add.wrongType=Invalid objective criteria type. Valid types are: %s +commands.scoreboard.objectives.add.alreadyExists=An objective with the name '%s' already exists +commands.scoreboard.objectives.add.tooLong=The name '%s' is too long for an objective, it can be at most %d characters long +commands.scoreboard.objectives.add.displayTooLong=The display name '%s' is too long for an objective, it can be at most %d characters long +commands.scoreboard.objectives.add.success=Added new objective '%s' successfully +commands.scoreboard.objectives.remove.usage=/scoreboard objectives remove +commands.scoreboard.objectives.remove.success=Removed objective '%s' successfully +commands.scoreboard.objectives.list.count=Showing %d objective(s) on scoreboard +commands.scoreboard.objectives.list.entry=- %s: displays as '%s' and is type '%s' +commands.scoreboard.objectives.list.empty=There are no objectives on the scoreboard +commands.scoreboard.players.usage=/scoreboard players +commands.scoreboard.players.set.success=Set score of %s for player %s to %d +commands.scoreboard.players.set.usage=/scoreboard players set +commands.scoreboard.players.add.usage=/scoreboard players add +commands.scoreboard.players.remove.usage=/scoreboard players remove +commands.scoreboard.players.reset.usage=/scoreboard players reset +commands.scoreboard.players.reset.success=Reset all scores of player %s +commands.scoreboard.players.list.count=Showing %d tracked players on the scoreboard +commands.scoreboard.players.list.empty=There are no tracked players on the scoreboard +commands.scoreboard.players.list.player.count=Showing %d tracked objective(s) for %s +commands.scoreboard.players.list.player.entry=- %2$s: %1$d (%3$s) +commands.scoreboard.players.list.player.empty=Player %s has no scores recorded +commands.scoreboard.teams.usage=/scoreboard teams +commands.scoreboard.teams.add.usage=/scoreboard teams add [display name ...] +commands.scoreboard.teams.add.alreadyExists=A team with the name '%s' already exists +commands.scoreboard.teams.add.tooLong=The name '%s' is too long for a team, it can be at most %d characters long +commands.scoreboard.teams.add.displayTooLong=The display name '%s' is too long for a team, it can be at most %d characters long +commands.scoreboard.teams.add.success=Added new team '%s' successfully +commands.scoreboard.teams.list.usage=/scoreboard teams list [name] +commands.scoreboard.teams.list.count=Showing %d teams on the scoreboard +commands.scoreboard.teams.list.entry=- %1$s: '%2$s' has %3$d players +commands.scoreboard.teams.list.empty=There are no teams registered on the scoreboard +commands.scoreboard.teams.list.player.count=Showing %d player(s) in team %s +commands.scoreboard.teams.list.player.entry=- %2$s: %1$d (%3$s) +commands.scoreboard.teams.list.player.empty=Team %s has no players +commands.scoreboard.teams.empty.usage=/scoreboard teams clear +commands.scoreboard.teams.empty.alreadyEmpty=Team %s is already empty, cannot remove nonexistant players +commands.scoreboard.teams.empty.success=Removed all %d player(s) from team %s +commands.scoreboard.teams.remove.usage=/scoreboard teams remove +commands.scoreboard.teams.remove.success=Removed team %s +commands.scoreboard.teams.join.usage=/scoreboard teams join [player] +commands.scoreboard.teams.join.success=Added %d player(s) to team %s: %s +commands.scoreboard.teams.join.failure=Could not add %d player(s) to team %s: %s +commands.scoreboard.teams.leave.usage=/scoreboard teams leave [player] +commands.scoreboard.teams.leave.success=Removed %d player(s) from their teams: %s +commands.scoreboard.teams.leave.failure=Could not remove %d player(s) from their teams: %s +commands.scoreboard.teams.leave.noTeam=You are not in a team +commands.scoreboard.teams.option.usage=/scoreboard teams option +commands.scoreboard.teams.option.noValue=Valid values for option %s are: %s +commands.scoreboard.teams.option.success=Set option %s for team %s to %s +commands.gamemode.success.self=Set own game mode to %s +commands.gamemode.success.other=Set %s's game mode to %s +commands.gamemode.usage=/gamemode [player] +commands.defaultgamemode.usage=/defaultgamemode +commands.defaultgamemode.success=The world's default game mode is now %s +commands.me.usage=/me +commands.help.header=--- Showing help page %d of %d (/help ) --- +commands.help.footer=Tip: Use the key while typing a command to auto-complete the command or its arguments +commands.help.usage=/help [page|command name] +commands.publish.usage=/publish +commands.publish.started=Local game hosted on port %s +commands.publish.failed=Unable to host local game +commands.debug.start=Started debug profiling +commands.debug.stop=Stopped debug profiling after %.2f seconds (%d ticks) +commands.debug.notStarted=Can't stop profiling when we haven't started yet! +commands.debug.usage=/debug +commands.message.usage=/tell +commands.message.sameTarget=You can't send a private message to yourself! +commands.message.display.outgoing=You whisper to %s: %s +commands.message.display.incoming=%s whispers to you: %s +commands.difficulty.usage=/difficulty +commands.difficulty.success=Set game difficulty to %s +commands.spawnpoint.usage=/spawnpoint OR /spawnpoint OR /spawnpoint +commands.spawnpoint.success=Set %s's spawn point to (%d, %d, %d) +commands.gamerule.usage=/gamerule OR /gamerule +commands.gamerule.success=Game rule has been updated +commands.gamerule.norule=No game rule called '%s' is available +commands.weather.usage=/weather [duration in seconds] +commands.weather.clear=Changing to clear weather +commands.weather.rain=Changing to rainy weather +commands.weather.thunder=Changing to rain and thunder +commands.testfor.usage=/testfor +commands.testfor.failed=/testfor is only usable by commandblocks with analog output +commands.seed.usage=/seed +commands.seed.success=Seed: %s +commands.spreadplayers.usage=/spreadplayers +commands.spreadplayers.spreading.teams=Spreading %s teams %s blocks around %s,%s (min %s blocks apart) +commands.spreadplayers.spreading.players=Spreading %s players %s blocks around %s,%s (min %s blocks apart) +commands.spreadplayers.success.teams=Successfully spread %s teams around %s,%s +commands.spreadplayers.success.players=Successfully spread %s players around %s,%s +commands.spreadplayers.info.teams=(Average distance between teams is %s blocks apart after %s iterations) +commands.spreadplayers.info.players=(Average distance between players is %s blocks apart after %s iterations) +commands.spreadplayers.failure.teams=Could not spread %s teams around %s,%s (too many players for space - try using spread of at most %s) +commands.spreadplayers.failure.players=Could not spread %s players around %s,%s (too many players for space - try using spread of at most %s) + +itemGroup.buildingBlocks=Building Blocks +itemGroup.decorations=Decoration Blocks +itemGroup.redstone=Redstone +itemGroup.transportation=Transportation +itemGroup.misc=Miscellaneous +itemGroup.search=Search Items +itemGroup.food=Foodstuffs +itemGroup.tools=Tools +itemGroup.combat=Combat +itemGroup.brewing=Brewing +itemGroup.materials=Materials +itemGroup.inventory=Survival Inventory + +inventory.binSlot=Destroy Item + +advMode.setCommand=Set Console Command for Block +advMode.setCommand.success=Command set: %s +advMode.command=Console Command +advMode.nearestPlayer=Use "@p" to target nearest player +advMode.randomPlayer=Use "@r" to target random player +advMode.allPlayers=Use "@a" to target all players + +advMode.notEnabled=Command blocks are not enabled on this server +advMode.notAllowed=Must be an opped player in creative mode + +mco.title=Minecraft Realms +mount.onboard=Press %1$s to dismount + +mco.selectServer.play=Play +mco.selectServer.configure=Configure +mco.selectServer.leave=Leave Realm +mco.selectServer.create=Create Realm +mco.selectServer.moreinfo=More Info + +mco.selectServer.expired=Expired Server +mco.selectServer.open=Open Server +mco.selectServer.closed=Closed Server + +mco.selectServer.expires.days=Expires in %s days +mco.selectServer.expires.day=Expires in a day +mco.selectServer.expires.soon=Expires soon + +mco.configure.world.edit.title=Edit Realm + +mco.configure.world.title=Configure Realm +mco.configure.world.name=Name +mco.configure.world.description=Description +mco.configure.world.location=Location +mco.configure.world.invited=Invited +mco.configure.world.buttons.edit=Edit +mco.configure.world.buttons.reset=Reset Realm +mco.configure.world.buttons.done=Done +mco.configure.world.buttons.delete=Delete +mco.configure.world.buttons.open=Open Realm +mco.configure.world.buttons.close=Close Realm +mco.configure.world.buttons.invite=Invite +mco.configure.world.buttons.uninvite=Uninvite +mco.configure.world.buttons.backup=Backups +mco.configure.world.buttons.subscription=Subscription +mco.configure.world.invite.profile.name=Name +mco.configure.world.uninvite.question=Are you sure that you want to uninvite +mco.configure.world.status=Status + +mco.configure.world.subscription.title=Subscription Info +mco.configure.world.subscription.daysleft=Days Left +mco.configure.world.subscription.start=Start Date +mco.configure.world.subscription.extend=Extend + +mco.create.world.location.title=Locations +mco.create.world.location.warning=You may not get the exact location you select +mco.create.world.wait=Creating the realm... +mco.create.world.seed=Seed (Optional) + +mco.reset.world.title=Reset Realm +mco.reset.world.warning=This will permanently delete your realm! +mco.reset.world.seed=Seed (Optional) +mco.reset.world.resetting.screen.title=Resetting Realm... + +mco.configure.world.close.question.line1=Your realm will become unavailable. +mco.configure.world.close.question.line2=Are you sure you want to do that? + +mco.configure.world.leave.question.line1=If you leave this realm you won't see it unless invited again +mco.configure.world.leave.question.line2=Are you sure you want to do that? + +mco.configure.world.reset.question.line1=Your realm will be regenerated and your current realm will be lost +mco.configure.world.reset.question.line2=Are you sure you want to do that? + +mco.configure.world.restore.question.line1=Your realm will be restored to a previous version +mco.configure.world.restore.question.line2=Are you sure you want to do that? + +mco.connect.connecting=Connecting to the online server... +mco.connect.authorizing=Logging in... +mco.connect.failed=Failed to connect to the online server + +mco.create.world=Create + +mco.client.outdated.title=Client Outdated! +mco.client.outdated.msg=Your client is outdated, please consider updating it to use Realms + +mco.backup.title=Backups +mco.backup.button.restore=Restore +mco.backup.restoring=Restoring your realm + +mco.template.title=Realm Templates +mco.template.button.select=Select +mco.template.default.name=Select Template (Optional) +mco.template.name=Template + +mco.invites.button.accept=Accept +mco.invites.button.reject=Reject +mco.invites.title=Pending Invitations +mco.invites.pending=New invitations! + +build.tooHigh=Height limit for building is %s blocks + +attribute.modifier.plus.0=+%d %s +attribute.modifier.plus.1=+%d%% %s +attribute.modifier.plus.2=+%d%% %s +attribute.modifier.take.0=-%d %s +attribute.modifier.take.1=-%d%% %s +attribute.modifier.take.2=-%d%% %s + +attribute.name.horse.jumpStrength=Horse Jump Strength +attribute.name.zombie.spawnReinforcements=Zombie Reinforcements +attribute.name.generic.maxHealth=Max Health +attribute.name.generic.followRange=Mob Follow Range +attribute.name.generic.knockbackResistance=Knockback Resistance +attribute.name.generic.movementSpeed=Speed +attribute.name.generic.attackDamage=Attack Damage \ No newline at end of file diff --git a/lwjgl-rundir/resources/assets/minecraft/texts/credits.txt b/lwjgl-rundir/resources/assets/minecraft/texts/credits.txt new file mode 100644 index 0000000..ff582fc --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/texts/credits.txt @@ -0,0 +1,66 @@ +[C]§f=============== +[C]§eMinecraft Credits +[C]§f=============== + +§7Created by: +§f Markus Persson + +§7Game design, programming and graphics: +§f Markus Persson +§f Jens Bergensten +§f Nathan Adams + +§7Programming: +§f Erik Broes + +§7Music and sound: +§f Daniel Rosenfeld + +§7Ingame artwork and paintings: +§f Kristoffer Zetterstrand + +§7End game narrative: +§f Julian Gough + +§7Website development: +§f Tobias Möllstam +§f Daniel Frisk +§f Leonard Axelsson +§f Jens Bergensten +§f Markus Persson + +§7Logo and promotional artwork: +§f Markus Toivonen + +§7Business and administration: +§f Carl Manneh +§f Daniel Kaplan + +§7Director of fun: +§f Lydia Winters + +§7Number crunching and statistics: +§f Patrick Geuder + +§7Additional programming: +§f Paul Spooner +§f Ryan 'Scaevolus' Hitchman +§f Elliot 'Hippoplatimus' Segal + +§7Developers of Mo' Creatures (horses etc): +§f John Olarte (DrZhark) +§f Kent Christian Jensen +§f Dan Roque + +§7Technologies used: +§f Java by Oracle +§f LWJGL by many talented people +§f "3d Sound System" by Paul Lamb +§f JOrbis by JCraft + + + + + + +§f"Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover." §7- Unknown \ No newline at end of file diff --git a/lwjgl-rundir/resources/assets/minecraft/texts/end.txt b/lwjgl-rundir/resources/assets/minecraft/texts/end.txt new file mode 100644 index 0000000..675775d --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/texts/end.txt @@ -0,0 +1,151 @@ +§3I see the player you mean. + +§2PLAYERNAME? + +§3Yes. Take care. It has reached a higher level now. It can read our thoughts. + +§2That doesn't matter. It thinks we are part of the game. + +§3I like this player. It played well. It did not give up. + +§2It is reading our thoughts as though they were words on a screen. + +§3That is how it chooses to imagine many things, when it is deep in the dream of a game. + +§2Words make a wonderful interface. Very flexible. And less terrifying than staring at the reality behind the screen. + +§3They used to hear voices. Before players could read. Back in the days when those who did not play called the players witches, and warlocks. And players dreamed they flew through the air, on sticks powered by demons. + +§2What did this player dream? + +§3This player dreamed of sunlight and trees. Of fire and water. It dreamed it created. And it dreamed it destroyed. It dreamed it hunted, and was hunted. It dreamed of shelter. + +§2Hah, the original interface. A million years old, and it still works. But what true structure did this player create, in the reality behind the screen? + +§3It worked, with a million others, to sculpt a true world in a fold of the §f§k§a§b§3, and created a §f§k§a§b§3 for §f§k§a§b§3, in the §f§k§a§b§3. + +§2It cannot read that thought. + +§3No. It has not yet achieved the highest level. That, it must achieve in the long dream of life, not the short dream of a game. + +§2Does it know that we love it? That the universe is kind? + +§3Sometimes, through the noise of its thoughts, it hears the universe, yes. + +§2But there are times it is sad, in the long dream. It creates worlds that have no summer, and it shivers under a black sun, and it takes its sad creation for reality. + +§3To cure it of sorrow would destroy it. The sorrow is part of its own private task. We cannot interfere. + +§2Sometimes when they are deep in dreams, I want to tell them, they are building true worlds in reality. Sometimes I want to tell them of their importance to the universe. Sometimes, when they have not made a true connection in a while, I want to help them to speak the word they fear. + +§3It reads our thoughts. + +§2Sometimes I do not care. Sometimes I wish to tell them, this world you take for truth is merely §f§k§a§b§2 and §f§k§a§b§2, I wish to tell them that they are §f§k§a§b§2 in the §f§k§a§b§2. They see so little of reality, in their long dream. + +§3And yet they play the game. + +§2But it would be so easy to tell them... + +§3Too strong for this dream. To tell them how to live is to prevent them living. + +§2I will not tell the player how to live. + +§3The player is growing restless. + +§2I will tell the player a story. + +§3But not the truth. + +§2No. A story that contains the truth safely, in a cage of words. Not the naked truth that can burn over any distance. + +§3Give it a body, again. + +§2Yes. Player... + +§3Use its name. + +§2PLAYERNAME. Player of games. + +§3Good. + +§2Take a breath, now. Take another. Feel air in your lungs. Let your limbs return. Yes, move your fingers. Have a body again, under gravity, in air. Respawn in the long dream. There you are. Your body touching the universe again at every point, as though you were separate things. As though we were separate things. + +§3Who are we? Once we were called the spirit of the mountain. Father sun, mother moon. Ancestral spirits, animal spirits. Jinn. Ghosts. The green man. Then gods, demons. Angels. Poltergeists. Aliens, extraterrestrials. Leptons, quarks. The words change. We do not change. + +§2We are the universe. We are everything you think isn't you. You are looking at us now, through your skin and your eyes. And why does the universe touch your skin, and throw light on you? To see you, player. To know you. And to be known. I shall tell you a story. + +§2Once upon a time, there was a player. + +§3The player was you, PLAYERNAME. + +§2Sometimes it thought itself human, on the thin crust of a spinning globe of molten rock. The ball of molten rock circled a ball of blazing gas that was three hundred and thirty thousand times more massive than it. They were so far apart that light took eight minutes to cross the gap. The light was information from a star, and it could burn your skin from a hundred and fifty million kilometres away. + +§2Sometimes the player dreamed it was a miner, on the surface of a world that was flat, and infinite. The sun was a square of white. The days were short; there was much to do; and death was a temporary inconvenience. + +§3Sometimes the player dreamed it was lost in a story. + +§2Sometimes the player dreamed it was other things, in other places. Sometimes these dreams were disturbing. Sometimes very beautiful indeed. Sometimes the player woke from one dream into another, then woke from that into a third. + +§3Sometimes the player dreamed it watched words on a screen. + +§2Let's go back. + +§2The atoms of the player were scattered in the grass, in the rivers, in the air, in the ground. A woman gathered the atoms; she drank and ate and inhaled; and the woman assembled the player, in her body. + +§2And the player awoke, from the warm, dark world of its mother's body, into the long dream. + +§2And the player was a new story, never told before, written in letters of DNA. And the player was a new program, never run before, generated by a sourcecode a billion years old. And the player was a new human, never alive before, made from nothing but milk and love. + +§3You are the player. The story. The program. The human. Made from nothing but milk and love. + +§2Let's go further back. + +§2The seven billion billion billion atoms of the player's body were created, long before this game, in the heart of a star. So the player, too, is information from a star. And the player moves through a story, which is a forest of information planted by a man called Julian, on a flat, infinite world created by a man called Markus, that exists inside a small, private world created by the player, who inhabits a universe created by... + +§3Shush. Sometimes the player created a small, private world that was soft and warm and simple. Sometimes hard, and cold, and complicated. Sometimes it built a model of the universe in its head; flecks of energy, moving through vast empty spaces. Sometimes it called those flecks "electrons" and "protons". + +§2Sometimes it called them "planets" and "stars". + +§2Sometimes it believed it was in a universe that was made of energy that was made of offs and ons; zeros and ones; lines of code. Sometimes it believed it was playing a game. Sometimes it believed it was reading words on a screen. + +§3You are the player, reading words... + +§2Shush... Sometimes the player read lines of code on a screen. Decoded them into words; decoded words into meaning; decoded meaning into feelings, emotions, theories, ideas, and the player started to breathe faster and deeper and realised it was alive, it was alive, those thousand deaths had not been real, the player was alive + +§3You. You. You are alive. + +§2and sometimes the player believed the universe had spoken to it through the sunlight that came through the shuffling leaves of the summer trees + +§3and sometimes the player believed the universe had spoken to it through the light that fell from the crisp night sky of winter, where a fleck of light in the corner of the player's eye might be a star a million times as massive as the sun, boiling its planets to plasma in order to be visible for a moment to the player, walking home at the far side of the universe, suddenly smelling food, almost at the familiar door, about to dream again + +§2and sometimes the player believed the universe had spoken to it through the zeros and ones, through the electricity of the world, through the scrolling words on a screen at the end of a dream + +§3and the universe said I love you + +§2and the universe said you have played the game well + +§3and the universe said everything you need is within you + +§2and the universe said you are stronger than you know + +§3and the universe said you are the daylight + +§2and the universe said you are the night + +§3and the universe said the darkness you fight is within you + +§2and the universe said the light you seek is within you + +§3and the universe said you are not alone + +§2and the universe said you are not separate from every other thing + +§3and the universe said you are the universe tasting itself, talking to itself, reading its own code + +§2and the universe said I love you because you are love. + +§3And the game was over and the player woke up from the dream. And the player began a new dream. And the player dreamed again, dreamed better. And the player was the universe. And the player was love. + +§3You are the player. + +§2Wake up. diff --git a/lwjgl-rundir/resources/assets/minecraft/texts/splashes.txt b/lwjgl-rundir/resources/assets/minecraft/texts/splashes.txt new file mode 100644 index 0000000..72edd20 --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/texts/splashes.txt @@ -0,0 +1,320 @@ +As seen on TV! +Awesome! +100% pure! +May contain nuts! +Better than Prey! +More polygons! +Sexy! +Limited edition! +Flashing letters! +Made by Notch! +It's here! +Best in class! +It's finished! +Kind of dragon free! +Excitement! +More than 500 sold! +One of a kind! +Heaps of hits on YouTube! +Indev! +Spiders everywhere! +Check it out! +Holy cow, man! +It's a game! +Made in Sweden! +Uses LWJGL! +Reticulating splines! +Minecraft! +Yaaay! +Singleplayer! +Keyboard compatible! +Undocumented! +Ingots! +Exploding creepers! +That's no moon! +l33t! +Create! +Survive! +Dungeon! +Exclusive! +The bee's knees! +Down with O.P.P.! +Closed source! +Classy! +Wow! +Not on steam! +Oh man! +Awesome community! +Pixels! +Teetsuuuuoooo! +Kaaneeeedaaaa! +Now with difficulty! +Enhanced! +90% bug free! +Pretty! +12 herbs and spices! +Fat free! +Absolutely no memes! +Free dental! +Ask your doctor! +Minors welcome! +Cloud computing! +Legal in Finland! +Hard to label! +Technically good! +Bringing home the bacon! +Indie! +GOTY! +Ceci n'est pas une title screen! +Euclidian! +Now in 3D! +Inspirational! +Herregud! +Complex cellular automata! +Yes, sir! +Played by cowboys! +OpenGL 1.2! +Thousands of colors! +Try it! +Age of Wonders is better! +Try the mushroom stew! +Sensational! +Hot tamale, hot hot tamale! +Play him off, keyboard cat! +Guaranteed! +Macroscopic! +Bring it on! +Random splash! +Call your mother! +Monster infighting! +Loved by millions! +Ultimate edition! +Freaky! +You've got a brand new key! +Water proof! +Uninflammable! +Whoa, dude! +All inclusive! +Tell your friends! +NP is not in P! +Notch <3 ez! +Music by C418! +Livestreamed! +Haunted! +Polynomial! +Terrestrial! +All is full of love! +Full of stars! +Scientific! +Cooler than Spock! +Collaborate and listen! +Never dig down! +Take frequent breaks! +Not linear! +Han shot first! +Nice to meet you! +Buckets of lava! +Ride the pig! +Larger than Earth! +sqrt(-1) love you! +Phobos anomaly! +Punching wood! +Falling off cliffs! +0% sugar! +150% hyperbole! +Synecdoche! +Let's danec! +Seecret Friday update! +Reference implementation! +Lewd with two dudes with food! +Kiss the sky! +20 GOTO 10! +Verlet intregration! +Peter Griffin! +Do not distribute! +Cogito ergo sum! +4815162342 lines of code! +A skeleton popped out! +The Work of Notch! +The sum of its parts! +BTAF used to be good! +I miss ADOM! +umop-apisdn! +OICU812! +Bring me Ray Cokes! +Finger-licking! +Thematic! +Pneumatic! +Sublime! +Octagonal! +Une baguette! +Gargamel plays it! +Rita is the new top dog! +SWM forever! +Representing Edsbyn! +Matt Damon! +Supercalifragilisticexpialidocious! +Consummate V's! +Cow Tools! +Double buffered! +Fan fiction! +Flaxkikare! +Jason! Jason! Jason! +Hotter than the sun! +Internet enabled! +Autonomous! +Engage! +Fantasy! +DRR! DRR! DRR! +Kick it root down! +Regional resources! +Woo, facepunch! +Woo, somethingawful! +Woo, /v/! +Woo, tigsource! +Woo, minecraftforum! +Woo, worldofminecraft! +Woo, reddit! +Woo, 2pp! +Google anlyticsed! +Now supports åäö! +Give us Gordon! +Tip your waiter! +Very fun! +12345 is a bad password! +Vote for net neutrality! +Lives in a pineapple under the sea! +MAP11 has two names! +Omnipotent! +Gasp! +...! +Bees, bees, bees, bees! +Jag känner en bot! +This text is hard to read if you play the game at the default resolution, but at 1080p it's fine! +Haha, LOL! +Hampsterdance! +Switches and ores! +Menger sponge! +idspispopd! +Eple (original edit)! +So fresh, so clean! +Slow acting portals! +Try the Nether! +Don't look directly at the bugs! +Oh, ok, Pigmen! +Finally with ladders! +Scary! +Play Minecraft, Watch Topgear, Get Pig! +Twittered about! +Jump up, jump up, and get down! +Joel is neat! +A riddle, wrapped in a mystery! +Huge tracts of land! +Welcome to your Doom! +Stay a while, stay forever! +Stay a while and listen! +Treatment for your rash! +"Autological" is! +Information wants to be free! +"Almost never" is an interesting concept! +Lots of truthiness! +The creeper is a spy! +Turing complete! +It's groundbreaking! +Let our battle's begin! +The sky is the limit! +Jeb has amazing hair! +Casual gaming! +Undefeated! +Kinda like Lemmings! +Follow the train, CJ! +Leveraging synergy! +This message will never appear on the splash screen, isn't that weird? +DungeonQuest is unfair! +110813! +90210! +Check out the far lands! +Tyrion would love it! +Also try VVVVVV! +Also try Super Meat Boy! +Also try Terraria! +Also try Mount And Blade! +Also try Project Zomboid! +Also try World of Goo! +Also try Limbo! +Also try Pixeljunk Shooter! +Also try Braid! +That's super! +Bread is pain! +Read more books! +Khaaaaaaaaan! +Less addictive than TV Tropes! +More addictive than lemonade! +Bigger than a bread box! +Millions of peaches! +Fnord! +This is my true form! +Totally forgot about Dre! +Don't bother with the clones! +Pumpkinhead! +Hobo humping slobo babe! +Made by Jeb! +Has an ending! +Finally complete! +Feature packed! +Boots with the fur! +Stop, hammertime! +Testificates! +Conventional! +Homeomorphic to a 3-sphere! +Doesn't avoid double negatives! +Place ALL the blocks! +Does barrel rolls! +Meeting expectations! +PC gaming since 1873! +Ghoughpteighbteau tchoghs! +Déjà vu! +Déjà vu! +Got your nose! +Haley loves Elan! +Afraid of the big, black bat! +Doesn't use the U-word! +Child's play! +See you next Friday or so! +From the streets of Södermalm! +150 bpm for 400000 minutes! +Technologic! +Funk soul brother! +Pumpa kungen! +日本ハロー! +한국 안녕하세요! +Helo Cymru! +Cześć Polsko! +你好中国! +Привет Россия! +Γεια σου Ελλάδα! +My life for Aiur! +Lennart lennart = new Lennart(); +I see your vocabulary has improved! +Who put it there? +You can't explain that! +if not ok then return end +§1C§2o§3l§4o§5r§6m§7a§8t§9i§ac +§kFUNKY LOL +SOPA means LOSER in Swedish! +Big Pointy Teeth! +Bekarton guards the gate! +Mmmph, mmph! +Don't feed avocados to parrots! +Swords for everyone! +Plz reply to my tweet! +.party()! +Take her pillow! +Put that cookie down! +Pretty scary! +I have a suggestion. +Now with extra hugs! +Almost java 6! +Woah. +HURNERJSGER? +What's up, Doc? \ No newline at end of file diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_base.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_base.png new file mode 100644 index 0000000..cfc1fc8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_base.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_top_damaged_0.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_top_damaged_0.png new file mode 100644 index 0000000..395dea4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_top_damaged_0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_top_damaged_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_top_damaged_1.png new file mode 100644 index 0000000..eddc47f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_top_damaged_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_top_damaged_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_top_damaged_2.png new file mode 100644 index 0000000..6cade1f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/anvil_top_damaged_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/beacon.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/beacon.png new file mode 100644 index 0000000..a69e59d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/beacon.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_feet_end.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_feet_end.png new file mode 100644 index 0000000..6e1a4be Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_feet_end.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_feet_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_feet_side.png new file mode 100644 index 0000000..3ce06f3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_feet_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_feet_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_feet_top.png new file mode 100644 index 0000000..b96d357 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_feet_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_head_end.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_head_end.png new file mode 100644 index 0000000..b684c9a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_head_end.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_head_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_head_side.png new file mode 100644 index 0000000..3270b4a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_head_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_head_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_head_top.png new file mode 100644 index 0000000..2ab1090 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bed_head_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bedrock.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bedrock.png new file mode 100644 index 0000000..1643c99 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bedrock.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bookshelf.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bookshelf.png new file mode 100644 index 0000000..4c87f0f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/bookshelf.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/brewing_stand.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/brewing_stand.png new file mode 100644 index 0000000..60832aa Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/brewing_stand.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/brewing_stand_base.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/brewing_stand_base.png new file mode 100644 index 0000000..0742fbf Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/brewing_stand_base.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/brick.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/brick.png new file mode 100644 index 0000000..fd6959c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/brick.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cactus_bottom.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cactus_bottom.png new file mode 100644 index 0000000..6f10bc0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cactus_bottom.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cactus_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cactus_side.png new file mode 100644 index 0000000..9c55503 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cactus_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cactus_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cactus_top.png new file mode 100644 index 0000000..f182e84 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cactus_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_bottom.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_bottom.png new file mode 100644 index 0000000..d93b15a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_bottom.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_inner.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_inner.png new file mode 100644 index 0000000..ce7ce69 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_inner.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_side.png new file mode 100644 index 0000000..343a023 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_top.png new file mode 100644 index 0000000..2947892 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cake_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_0.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_0.png new file mode 100644 index 0000000..c1ef732 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_1.png new file mode 100644 index 0000000..1275f4f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_2.png new file mode 100644 index 0000000..b7347df Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_3.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_3.png new file mode 100644 index 0000000..2391be8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/carrots_stage_3.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_bottom.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_bottom.png new file mode 100644 index 0000000..fb31385 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_bottom.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_inner.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_inner.png new file mode 100644 index 0000000..d5a30dd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_inner.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_side.png new file mode 100644 index 0000000..72b0e5a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_top.png new file mode 100644 index 0000000..3ed6171 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cauldron_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/clay.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/clay.png new file mode 100644 index 0000000..c19e031 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/clay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/coal_block.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/coal_block.png new file mode 100644 index 0000000..024404b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/coal_block.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/coal_ore.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/coal_ore.png new file mode 100644 index 0000000..49486d2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/coal_ore.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cobblestone.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cobblestone.png new file mode 100644 index 0000000..da3498c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cobblestone.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cobblestone_mossy.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cobblestone_mossy.png new file mode 100644 index 0000000..29449e3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cobblestone_mossy.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cocoa_stage_0.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cocoa_stage_0.png new file mode 100644 index 0000000..25892eb Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cocoa_stage_0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cocoa_stage_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cocoa_stage_1.png new file mode 100644 index 0000000..d0098ff Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cocoa_stage_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cocoa_stage_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cocoa_stage_2.png new file mode 100644 index 0000000..db28c7b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/cocoa_stage_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/command_block.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/command_block.png new file mode 100644 index 0000000..4459675 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/command_block.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/comparator_off.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/comparator_off.png new file mode 100644 index 0000000..c9527bc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/comparator_off.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/comparator_on.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/comparator_on.png new file mode 100644 index 0000000..2e4fb7a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/comparator_on.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/crafting_table_front.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/crafting_table_front.png new file mode 100644 index 0000000..11986a4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/crafting_table_front.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/crafting_table_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/crafting_table_side.png new file mode 100644 index 0000000..1c678b4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/crafting_table_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/crafting_table_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/crafting_table_top.png new file mode 100644 index 0000000..5cd53a5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/crafting_table_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/daylight_detector_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/daylight_detector_side.png new file mode 100644 index 0000000..ac273ea Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/daylight_detector_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/daylight_detector_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/daylight_detector_top.png new file mode 100644 index 0000000..3bfb2da Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/daylight_detector_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/deadbush.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/deadbush.png new file mode 100644 index 0000000..c64e079 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/deadbush.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_0.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_0.png new file mode 100644 index 0000000..f65b7ed Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_1.png new file mode 100644 index 0000000..7c91596 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_2.png new file mode 100644 index 0000000..dadd6b0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_3.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_3.png new file mode 100644 index 0000000..52a40b6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_3.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_4.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_4.png new file mode 100644 index 0000000..e37c88a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_4.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_5.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_5.png new file mode 100644 index 0000000..9590d2f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_5.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_6.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_6.png new file mode 100644 index 0000000..8e490c0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_6.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_7.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_7.png new file mode 100644 index 0000000..0b40c78 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_7.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_8.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_8.png new file mode 100644 index 0000000..c0bf1de Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_8.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_9.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_9.png new file mode 100644 index 0000000..e3185f8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/destroy_stage_9.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/diamond_block.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/diamond_block.png new file mode 100644 index 0000000..f2e2e77 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/diamond_block.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/diamond_ore.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/diamond_ore.png new file mode 100644 index 0000000..735ecda Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/diamond_ore.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dirt.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dirt.png new file mode 100644 index 0000000..617d353 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dirt.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dispenser_front_horizontal.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dispenser_front_horizontal.png new file mode 100644 index 0000000..3e09fde Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dispenser_front_horizontal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dispenser_front_vertical.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dispenser_front_vertical.png new file mode 100644 index 0000000..87a7837 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dispenser_front_vertical.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_iron_lower.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_iron_lower.png new file mode 100644 index 0000000..dbc33ab Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_iron_lower.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_iron_upper.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_iron_upper.png new file mode 100644 index 0000000..56878fe Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_iron_upper.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_wood_lower.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_wood_lower.png new file mode 100644 index 0000000..cc61731 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_wood_lower.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_wood_upper.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_wood_upper.png new file mode 100644 index 0000000..93319d5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/door_wood_upper.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dragon_egg.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dragon_egg.png new file mode 100644 index 0000000..02af123 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dragon_egg.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dropper_front_horizontal.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dropper_front_horizontal.png new file mode 100644 index 0000000..7d5f260 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dropper_front_horizontal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dropper_front_vertical.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dropper_front_vertical.png new file mode 100644 index 0000000..68a56c8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/dropper_front_vertical.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/emerald_block.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/emerald_block.png new file mode 100644 index 0000000..dc214ee Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/emerald_block.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/emerald_ore.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/emerald_ore.png new file mode 100644 index 0000000..a26c35f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/emerald_ore.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/enchanting_table_bottom.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/enchanting_table_bottom.png new file mode 100644 index 0000000..0f492aa Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/enchanting_table_bottom.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/enchanting_table_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/enchanting_table_side.png new file mode 100644 index 0000000..f2f4614 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/enchanting_table_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/enchanting_table_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/enchanting_table_top.png new file mode 100644 index 0000000..0d5f68f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/enchanting_table_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/end_stone.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/end_stone.png new file mode 100644 index 0000000..c2a91e3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/end_stone.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/endframe_eye.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/endframe_eye.png new file mode 100644 index 0000000..afa1d5d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/endframe_eye.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/endframe_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/endframe_side.png new file mode 100644 index 0000000..e6cb567 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/endframe_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/endframe_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/endframe_top.png new file mode 100644 index 0000000..35215a5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/endframe_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/farmland_dry.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/farmland_dry.png new file mode 100644 index 0000000..d03a0f4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/farmland_dry.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/farmland_wet.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/farmland_wet.png new file mode 100644 index 0000000..f8d460d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/farmland_wet.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fern.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fern.png new file mode 100644 index 0000000..fd76950 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fern.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_0.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_0.png new file mode 100644 index 0000000..cf8910f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_0.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_0.png.mcmeta new file mode 100644 index 0000000..ca6a185 --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_0.png.mcmeta @@ -0,0 +1,38 @@ +{ + "animation": { + "frames": [ + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15 + ] + } +} diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_1.png new file mode 100644 index 0000000..6db92ac Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_1.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_1.png.mcmeta new file mode 100644 index 0000000..de3267f --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/fire_layer_1.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation": {} +} \ No newline at end of file diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/flower_dandelion.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/flower_dandelion.png new file mode 100644 index 0000000..873e3f5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/flower_dandelion.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/flower_pot.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/flower_pot.png new file mode 100644 index 0000000..09c2523 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/flower_pot.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/flower_rose.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/flower_rose.png new file mode 100644 index 0000000..15ebba6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/flower_rose.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_front_off.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_front_off.png new file mode 100644 index 0000000..0570c3a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_front_off.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_front_on.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_front_on.png new file mode 100644 index 0000000..92c89f3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_front_on.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_side.png new file mode 100644 index 0000000..115f73d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_top.png new file mode 100644 index 0000000..a3a5a08 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/furnace_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/glass.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/glass.png new file mode 100644 index 0000000..acadb01 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/glass.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/glass_pane_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/glass_pane_top.png new file mode 100644 index 0000000..02de587 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/glass_pane_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/glowstone.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/glowstone.png new file mode 100644 index 0000000..c7253b3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/glowstone.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/gold_block.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/gold_block.png new file mode 100644 index 0000000..174002e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/gold_block.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/gold_ore.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/gold_ore.png new file mode 100644 index 0000000..b1a7a55 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/gold_ore.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_side.png new file mode 100644 index 0000000..a4975e5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_side_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_side_overlay.png new file mode 100644 index 0000000..fc3fa9d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_side_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_side_snowed.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_side_snowed.png new file mode 100644 index 0000000..41f6197 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_side_snowed.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_top.png new file mode 100644 index 0000000..eaa7e45 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/grass_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/gravel.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/gravel.png new file mode 100644 index 0000000..388e5c5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/gravel.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay.png new file mode 100644 index 0000000..2446380 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_black.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_black.png new file mode 100644 index 0000000..59da22c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_black.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_blue.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_blue.png new file mode 100644 index 0000000..7e38e27 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_blue.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_brown.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_brown.png new file mode 100644 index 0000000..f81745f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_brown.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_cyan.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_cyan.png new file mode 100644 index 0000000..b05428c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_cyan.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_gray.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_gray.png new file mode 100644 index 0000000..8f86904 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_gray.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_green.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_green.png new file mode 100644 index 0000000..e89162e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_green.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_light_blue.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_light_blue.png new file mode 100644 index 0000000..3d9ebea Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_light_blue.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_lime.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_lime.png new file mode 100644 index 0000000..b459a0b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_lime.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_magenta.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_magenta.png new file mode 100644 index 0000000..9663106 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_magenta.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_orange.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_orange.png new file mode 100644 index 0000000..40929db Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_orange.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_pink.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_pink.png new file mode 100644 index 0000000..c21c0aa Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_pink.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_purple.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_purple.png new file mode 100644 index 0000000..edece94 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_purple.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_red.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_red.png new file mode 100644 index 0000000..6561d12 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_red.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_silver.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_silver.png new file mode 100644 index 0000000..eae07f2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_silver.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_white.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_white.png new file mode 100644 index 0000000..8066af0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_white.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_yellow.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_yellow.png new file mode 100644 index 0000000..5da4687 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hardened_clay_stained_yellow.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hay_block_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hay_block_side.png new file mode 100644 index 0000000..a2b32db Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hay_block_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hay_block_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hay_block_top.png new file mode 100644 index 0000000..1d35593 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hay_block_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hopper_inside.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hopper_inside.png new file mode 100644 index 0000000..24e8eae Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hopper_inside.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hopper_outside.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hopper_outside.png new file mode 100644 index 0000000..50ed8d5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hopper_outside.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hopper_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hopper_top.png new file mode 100644 index 0000000..3ed6171 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/hopper_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/ice.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/ice.png new file mode 100644 index 0000000..ac946e9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/ice.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/iron_bars.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/iron_bars.png new file mode 100644 index 0000000..732807f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/iron_bars.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/iron_block.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/iron_block.png new file mode 100644 index 0000000..7816799 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/iron_block.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/iron_ore.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/iron_ore.png new file mode 100644 index 0000000..250d8bb Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/iron_ore.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/itemframe_background.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/itemframe_background.png new file mode 100644 index 0000000..b40ad65 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/itemframe_background.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/jukebox_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/jukebox_side.png new file mode 100644 index 0000000..a3c27c1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/jukebox_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/jukebox_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/jukebox_top.png new file mode 100644 index 0000000..92ddb15 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/jukebox_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/ladder.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/ladder.png new file mode 100644 index 0000000..e2ec5f2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/ladder.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lapis_block.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lapis_block.png new file mode 100644 index 0000000..0271489 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lapis_block.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lapis_ore.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lapis_ore.png new file mode 100644 index 0000000..6144236 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lapis_ore.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_flow.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_flow.png new file mode 100644 index 0000000..af07f91 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_flow.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_flow.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_flow.png.mcmeta new file mode 100644 index 0000000..df9c61a --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_still.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_still.png new file mode 100644 index 0000000..78bb29d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_still.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_still.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_still.png.mcmeta new file mode 100644 index 0000000..55438bf --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lava_still.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +} \ No newline at end of file diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_birch.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_birch.png new file mode 100644 index 0000000..a6773af Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_birch.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_birch_opaque.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_birch_opaque.png new file mode 100644 index 0000000..e91ed32 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_birch_opaque.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_jungle.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_jungle.png new file mode 100644 index 0000000..e0cb935 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_jungle.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_jungle_opaque.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_jungle_opaque.png new file mode 100644 index 0000000..110a618 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_jungle_opaque.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_oak.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_oak.png new file mode 100644 index 0000000..a6773af Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_oak.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_oak_opaque.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_oak_opaque.png new file mode 100644 index 0000000..e91ed32 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_oak_opaque.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_spruce.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_spruce.png new file mode 100644 index 0000000..602eab8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_spruce.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_spruce_opaque.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_spruce_opaque.png new file mode 100644 index 0000000..2e5228e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/leaves_spruce_opaque.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lever.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lever.png new file mode 100644 index 0000000..051187f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/lever.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_birch.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_birch.png new file mode 100644 index 0000000..bfb209d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_birch.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_birch_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_birch_top.png new file mode 100644 index 0000000..7a44e77 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_birch_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_jungle.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_jungle.png new file mode 100644 index 0000000..0b7120a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_jungle.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_jungle_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_jungle_top.png new file mode 100644 index 0000000..7a44e77 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_jungle_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_oak.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_oak.png new file mode 100644 index 0000000..914cb5f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_oak.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_oak_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_oak_top.png new file mode 100644 index 0000000..7a44e77 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_oak_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_spruce.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_spruce.png new file mode 100644 index 0000000..dc1aa2f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_spruce.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_spruce_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_spruce_top.png new file mode 100644 index 0000000..7a44e77 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/log_spruce_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_side.png new file mode 100644 index 0000000..ec7b430 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_stem_connected.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_stem_connected.png new file mode 100644 index 0000000..6a5c10e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_stem_connected.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_stem_disconnected.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_stem_disconnected.png new file mode 100644 index 0000000..38065ef Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_stem_disconnected.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_top.png new file mode 100644 index 0000000..65cf169 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/melon_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mob_spawner.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mob_spawner.png new file mode 100644 index 0000000..7d55217 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mob_spawner.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_inside.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_inside.png new file mode 100644 index 0000000..f0e7a04 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_inside.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_skin_brown.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_skin_brown.png new file mode 100644 index 0000000..1f52ba8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_skin_brown.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_skin_red.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_skin_red.png new file mode 100644 index 0000000..66cf12c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_skin_red.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_skin_stem.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_skin_stem.png new file mode 100644 index 0000000..83c0840 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_block_skin_stem.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_brown.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_brown.png new file mode 100644 index 0000000..bf33d34 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_brown.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_red.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_red.png new file mode 100644 index 0000000..1b332b7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mushroom_red.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mycelium_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mycelium_side.png new file mode 100644 index 0000000..5547425 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mycelium_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mycelium_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mycelium_top.png new file mode 100644 index 0000000..088a825 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/mycelium_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_brick.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_brick.png new file mode 100644 index 0000000..caaf66f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_brick.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_wart_stage_0.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_wart_stage_0.png new file mode 100644 index 0000000..514a95b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_wart_stage_0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_wart_stage_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_wart_stage_1.png new file mode 100644 index 0000000..b4ad0d1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_wart_stage_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_wart_stage_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_wart_stage_2.png new file mode 100644 index 0000000..b9b6743 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/nether_wart_stage_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/netherrack.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/netherrack.png new file mode 100644 index 0000000..88129c4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/netherrack.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/noteblock.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/noteblock.png new file mode 100644 index 0000000..a3c27c1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/noteblock.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/obsidian.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/obsidian.png new file mode 100644 index 0000000..ff0a683 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/obsidian.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_bottom.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_bottom.png new file mode 100644 index 0000000..a3a5a08 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_bottom.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_inner.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_inner.png new file mode 100644 index 0000000..1043929 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_inner.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_side.png new file mode 100644 index 0000000..634f54a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_top_normal.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_top_normal.png new file mode 100644 index 0000000..eeaadab Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_top_normal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_top_sticky.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_top_sticky.png new file mode 100644 index 0000000..6ddd4ad Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/piston_top_sticky.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_birch.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_birch.png new file mode 100644 index 0000000..b113e3a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_birch.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_jungle.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_jungle.png new file mode 100644 index 0000000..e3fe82d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_jungle.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_oak.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_oak.png new file mode 100644 index 0000000..346f77d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_oak.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_spruce.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_spruce.png new file mode 100644 index 0000000..f45fa94 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/planks_spruce.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/portal.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/portal.png new file mode 100644 index 0000000..96859e2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/portal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/portal.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/portal.png.mcmeta new file mode 100644 index 0000000..de3267f --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/portal.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation": {} +} \ No newline at end of file diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_0.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_0.png new file mode 100644 index 0000000..c1ef732 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_1.png new file mode 100644 index 0000000..1275f4f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_2.png new file mode 100644 index 0000000..b7347df Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_3.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_3.png new file mode 100644 index 0000000..d7e8185 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/potatoes_stage_3.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_face_off.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_face_off.png new file mode 100644 index 0000000..ecef025 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_face_off.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_face_on.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_face_on.png new file mode 100644 index 0000000..907f499 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_face_on.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_side.png new file mode 100644 index 0000000..75dfc47 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_stem_connected.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_stem_connected.png new file mode 100644 index 0000000..6a5c10e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_stem_connected.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_stem_disconnected.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_stem_disconnected.png new file mode 100644 index 0000000..38065ef Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_stem_disconnected.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_top.png new file mode 100644 index 0000000..297ce3c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/pumpkin_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_bottom.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_bottom.png new file mode 100644 index 0000000..7e16c7c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_bottom.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_chiseled.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_chiseled.png new file mode 100644 index 0000000..80465a1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_chiseled.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_chiseled_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_chiseled_top.png new file mode 100644 index 0000000..44073e5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_chiseled_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_lines.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_lines.png new file mode 100644 index 0000000..184ecd2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_lines.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_lines_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_lines_top.png new file mode 100644 index 0000000..6d20379 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_lines_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_side.png new file mode 100644 index 0000000..a2cd2ca Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_top.png new file mode 100644 index 0000000..a2cd2ca Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_block_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_ore.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_ore.png new file mode 100644 index 0000000..4d758c1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/quartz_ore.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_activator.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_activator.png new file mode 100644 index 0000000..ce115ba Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_activator.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_activator_powered.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_activator_powered.png new file mode 100644 index 0000000..a3aaca9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_activator_powered.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_detector.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_detector.png new file mode 100644 index 0000000..92c1466 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_detector.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_detector_powered.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_detector_powered.png new file mode 100644 index 0000000..a1c6e6b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_detector_powered.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_golden.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_golden.png new file mode 100644 index 0000000..1fc52c3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_golden.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_golden_powered.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_golden_powered.png new file mode 100644 index 0000000..bd343be Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_golden_powered.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_normal.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_normal.png new file mode 100644 index 0000000..d609236 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_normal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_normal_turned.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_normal_turned.png new file mode 100644 index 0000000..f394a23 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/rail_normal_turned.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_block.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_block.png new file mode 100644 index 0000000..fcf6b40 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_block.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_cross.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_cross.png new file mode 100644 index 0000000..dcec893 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_cross.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_cross_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_cross_overlay.png new file mode 100644 index 0000000..96729e1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_cross_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_line.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_line.png new file mode 100644 index 0000000..ff0fb23 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_line.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_line_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_line_overlay.png new file mode 100644 index 0000000..96729e1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_dust_line_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_lamp_off.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_lamp_off.png new file mode 100644 index 0000000..522765b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_lamp_off.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_lamp_on.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_lamp_on.png new file mode 100644 index 0000000..9562ef3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_lamp_on.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_ore.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_ore.png new file mode 100644 index 0000000..575a488 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_ore.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_torch_off.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_torch_off.png new file mode 100644 index 0000000..635eabd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_torch_off.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_torch_on.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_torch_on.png new file mode 100644 index 0000000..2983d6c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/redstone_torch_on.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/reeds.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/reeds.png new file mode 100644 index 0000000..64bbfe0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/reeds.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/repeater_off.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/repeater_off.png new file mode 100644 index 0000000..8634669 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/repeater_off.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/repeater_on.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/repeater_on.png new file mode 100644 index 0000000..d71d0d9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/repeater_on.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sand.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sand.png new file mode 100644 index 0000000..86b9654 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sand.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_bottom.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_bottom.png new file mode 100644 index 0000000..e102220 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_bottom.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_carved.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_carved.png new file mode 100644 index 0000000..9bd7fa1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_carved.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_normal.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_normal.png new file mode 100644 index 0000000..1b79145 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_normal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_smooth.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_smooth.png new file mode 100644 index 0000000..ef118bd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_smooth.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_top.png new file mode 100644 index 0000000..bb5b157 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sandstone_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_birch.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_birch.png new file mode 100644 index 0000000..b0dacc5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_birch.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_jungle.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_jungle.png new file mode 100644 index 0000000..4e10b35 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_jungle.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_oak.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_oak.png new file mode 100644 index 0000000..1bf1bfa Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_oak.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_spruce.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_spruce.png new file mode 100644 index 0000000..5767d48 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sapling_spruce.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/snow.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/snow.png new file mode 100644 index 0000000..5c146cd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/snow.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/soul_sand.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/soul_sand.png new file mode 100644 index 0000000..fca7e8f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/soul_sand.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sponge.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sponge.png new file mode 100644 index 0000000..a850804 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/sponge.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stone.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stone.png new file mode 100644 index 0000000..87e19ff Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stone.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stone_slab_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stone_slab_side.png new file mode 100644 index 0000000..fe2a204 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stone_slab_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stone_slab_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stone_slab_top.png new file mode 100644 index 0000000..090657d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stone_slab_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick.png new file mode 100644 index 0000000..69138cf Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick_carved.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick_carved.png new file mode 100644 index 0000000..b7e88db Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick_carved.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick_cracked.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick_cracked.png new file mode 100644 index 0000000..918a884 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick_cracked.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick_mossy.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick_mossy.png new file mode 100644 index 0000000..5b9fe37 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/stonebrick_mossy.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tallgrass.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tallgrass.png new file mode 100644 index 0000000..42b2013 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tallgrass.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tnt_bottom.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tnt_bottom.png new file mode 100644 index 0000000..cc2e586 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tnt_bottom.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tnt_side.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tnt_side.png new file mode 100644 index 0000000..21109fb Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tnt_side.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tnt_top.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tnt_top.png new file mode 100644 index 0000000..ceb44b6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/tnt_top.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/torch_on.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/torch_on.png new file mode 100644 index 0000000..a2ce41b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/torch_on.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/trapdoor.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/trapdoor.png new file mode 100644 index 0000000..a7dcccc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/trapdoor.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/trip_wire.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/trip_wire.png new file mode 100644 index 0000000..6a9a72b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/trip_wire.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/trip_wire_source.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/trip_wire_source.png new file mode 100644 index 0000000..fbd464d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/trip_wire_source.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/vine.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/vine.png new file mode 100644 index 0000000..df5e435 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/vine.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_flow.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_flow.png new file mode 100644 index 0000000..e72280c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_flow.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_flow.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_flow.png.mcmeta new file mode 100644 index 0000000..de3267f --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_flow.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation": {} +} \ No newline at end of file diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_still.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_still.png new file mode 100644 index 0000000..c7e90b0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_still.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_still.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_still.png.mcmeta new file mode 100644 index 0000000..4b721e0 --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/water_still.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 2 + } +} diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/waterlily.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/waterlily.png new file mode 100644 index 0000000..f6c84f8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/waterlily.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/web.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/web.png new file mode 100644 index 0000000..7c097f1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/web.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_0.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_0.png new file mode 100644 index 0000000..185af6f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_1.png new file mode 100644 index 0000000..67588c1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_2.png new file mode 100644 index 0000000..3d33792 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_3.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_3.png new file mode 100644 index 0000000..4649f78 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_3.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_4.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_4.png new file mode 100644 index 0000000..ac04b52 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_4.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_5.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_5.png new file mode 100644 index 0000000..1ea81ac Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_5.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_6.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_6.png new file mode 100644 index 0000000..cb5f195 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_6.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_7.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_7.png new file mode 100644 index 0000000..7acafb3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wheat_stage_7.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_black.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_black.png new file mode 100644 index 0000000..b74d5c9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_black.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_blue.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_blue.png new file mode 100644 index 0000000..ce9515f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_blue.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_brown.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_brown.png new file mode 100644 index 0000000..b4dc3c5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_brown.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_cyan.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_cyan.png new file mode 100644 index 0000000..ca0800a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_cyan.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_gray.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_gray.png new file mode 100644 index 0000000..6409ff2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_gray.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_green.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_green.png new file mode 100644 index 0000000..a7be6d7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_green.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_light_blue.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_light_blue.png new file mode 100644 index 0000000..72d9d9e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_light_blue.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_lime.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_lime.png new file mode 100644 index 0000000..bf56389 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_lime.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_magenta.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_magenta.png new file mode 100644 index 0000000..3af6747 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_magenta.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_orange.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_orange.png new file mode 100644 index 0000000..eefe6de Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_orange.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_pink.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_pink.png new file mode 100644 index 0000000..c2785af Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_pink.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_purple.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_purple.png new file mode 100644 index 0000000..76f68d6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_purple.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_red.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_red.png new file mode 100644 index 0000000..0cff7a9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_red.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_silver.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_silver.png new file mode 100644 index 0000000..756d9b0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_silver.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_white.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_white.png new file mode 100644 index 0000000..abc7999 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_white.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_yellow.png b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_yellow.png new file mode 100644 index 0000000..4babaaa Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/blocks/wool_colored_yellow.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/colormap/foliage.png b/lwjgl-rundir/resources/assets/minecraft/textures/colormap/foliage.png new file mode 100644 index 0000000..dcc119e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/colormap/foliage.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/colormap/grass.png b/lwjgl-rundir/resources/assets/minecraft/textures/colormap/grass.png new file mode 100644 index 0000000..484a9a6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/colormap/grass.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/arrow.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/arrow.png new file mode 100644 index 0000000..3afa604 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/arrow.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/bat.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/bat.png new file mode 100644 index 0000000..803860e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/bat.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/beacon_beam.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/beacon_beam.png new file mode 100644 index 0000000..67545b4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/beacon_beam.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/blaze.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/blaze.png new file mode 100644 index 0000000..19cdbb5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/blaze.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/boat.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/boat.png new file mode 100644 index 0000000..9b58965 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/boat.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/black.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/black.png new file mode 100644 index 0000000..422908f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/black.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/ocelot.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/ocelot.png new file mode 100644 index 0000000..6b5064e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/ocelot.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/red.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/red.png new file mode 100644 index 0000000..17b6de5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/red.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/siamese.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/siamese.png new file mode 100644 index 0000000..cfed948 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cat/siamese.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/christmas.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/christmas.png new file mode 100644 index 0000000..4459112 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/christmas.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/christmas_double.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/christmas_double.png new file mode 100644 index 0000000..9e44eeb Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/christmas_double.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/ender.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/ender.png new file mode 100644 index 0000000..3631d0d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/ender.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/normal.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/normal.png new file mode 100644 index 0000000..2e3d7fd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/normal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/normal_double.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/normal_double.png new file mode 100644 index 0000000..0168338 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/normal_double.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/trapped.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/trapped.png new file mode 100644 index 0000000..3aef190 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/trapped.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/trapped_double.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/trapped_double.png new file mode 100644 index 0000000..00eebe5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chest/trapped_double.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/chicken.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chicken.png new file mode 100644 index 0000000..e24d550 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/chicken.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/cow/cow.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cow/cow.png new file mode 100644 index 0000000..f1320c3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cow/cow.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/cow/mooshroom.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cow/mooshroom.png new file mode 100644 index 0000000..905f160 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/cow/mooshroom.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/creeper/creeper.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/creeper/creeper.png new file mode 100644 index 0000000..abdb540 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/creeper/creeper.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/creeper/creeper_armor.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/creeper/creeper_armor.png new file mode 100644 index 0000000..119f6ff Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/creeper/creeper_armor.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/enchanting_table_book.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enchanting_table_book.png new file mode 100644 index 0000000..619e7a5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enchanting_table_book.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/end_portal.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/end_portal.png new file mode 100644 index 0000000..d5d8569 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/end_portal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/endercrystal/endercrystal.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/endercrystal/endercrystal.png new file mode 100644 index 0000000..8b3668a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/endercrystal/endercrystal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/endercrystal/endercrystal_beam.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/endercrystal/endercrystal_beam.png new file mode 100644 index 0000000..1259a5d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/endercrystal/endercrystal_beam.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderdragon/dragon.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderdragon/dragon.png new file mode 100644 index 0000000..b8a680c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderdragon/dragon.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderdragon/dragon_exploding.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderdragon/dragon_exploding.png new file mode 100644 index 0000000..ca5c949 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderdragon/dragon_exploding.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderdragon/dragon_eyes.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderdragon/dragon_eyes.png new file mode 100644 index 0000000..147b303 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderdragon/dragon_eyes.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderman/enderman.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderman/enderman.png new file mode 100644 index 0000000..ab23cb9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderman/enderman.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderman/enderman_eyes.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderman/enderman_eyes.png new file mode 100644 index 0000000..0804402 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/enderman/enderman_eyes.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/experience_orb.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/experience_orb.png new file mode 100644 index 0000000..92f9d0f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/experience_orb.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/explosion.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/explosion.png new file mode 100644 index 0000000..c309409 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/explosion.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/ghast/ghast.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/ghast/ghast.png new file mode 100644 index 0000000..dd63bc1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/ghast/ghast.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/ghast/ghast_shooting.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/ghast/ghast_shooting.png new file mode 100644 index 0000000..5d9be29 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/ghast/ghast_shooting.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/armor/horse_armor_diamond.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/armor/horse_armor_diamond.png new file mode 100644 index 0000000..39068f2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/armor/horse_armor_diamond.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/armor/horse_armor_gold.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/armor/horse_armor_gold.png new file mode 100644 index 0000000..4a0786d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/armor/horse_armor_gold.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/armor/horse_armor_iron.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/armor/horse_armor_iron.png new file mode 100644 index 0000000..533b2dd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/armor/horse_armor_iron.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/donkey.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/donkey.png new file mode 100644 index 0000000..b94bc63 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/donkey.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_black.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_black.png new file mode 100644 index 0000000..dde716e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_black.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_brown.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_brown.png new file mode 100644 index 0000000..ec0158f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_brown.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_chestnut.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_chestnut.png new file mode 100644 index 0000000..40322ff Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_chestnut.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_creamy.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_creamy.png new file mode 100644 index 0000000..bc42bcc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_creamy.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_darkbrown.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_darkbrown.png new file mode 100644 index 0000000..b38e914 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_darkbrown.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_gray.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_gray.png new file mode 100644 index 0000000..4987532 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_gray.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_blackdots.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_blackdots.png new file mode 100644 index 0000000..7320648 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_blackdots.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_white.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_white.png new file mode 100644 index 0000000..b1f0a69 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_white.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_whitedots.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_whitedots.png new file mode 100644 index 0000000..20e1954 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_whitedots.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_whitefield.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_whitefield.png new file mode 100644 index 0000000..baa2c06 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_markings_whitefield.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_skeleton.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_skeleton.png new file mode 100644 index 0000000..29d4ed5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_skeleton.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_white.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_white.png new file mode 100644 index 0000000..e90e6e7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_white.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_zombie.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_zombie.png new file mode 100644 index 0000000..22d55fa Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/horse_zombie.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/mule.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/mule.png new file mode 100644 index 0000000..241bdaa Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/horse/mule.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/iron_golem.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/iron_golem.png new file mode 100644 index 0000000..f9f6465 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/iron_golem.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/lead_knot.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/lead_knot.png new file mode 100644 index 0000000..ab4d3b3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/lead_knot.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/minecart.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/minecart.png new file mode 100644 index 0000000..7ad7b54 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/minecart.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/pig/pig.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/pig/pig.png new file mode 100644 index 0000000..0a9532f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/pig/pig.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/pig/pig_saddle.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/pig/pig_saddle.png new file mode 100644 index 0000000..640ea76 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/pig/pig_saddle.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/sheep/sheep.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/sheep/sheep.png new file mode 100644 index 0000000..d9fe93f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/sheep/sheep.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/sheep/sheep_fur.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/sheep/sheep_fur.png new file mode 100644 index 0000000..623340b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/sheep/sheep_fur.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/sign.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/sign.png new file mode 100644 index 0000000..e22e2f7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/sign.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/silverfish.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/silverfish.png new file mode 100644 index 0000000..416fa16 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/silverfish.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/skeleton/skeleton.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/skeleton/skeleton.png new file mode 100644 index 0000000..184b585 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/skeleton/skeleton.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/skeleton/wither_skeleton.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/skeleton/wither_skeleton.png new file mode 100644 index 0000000..b0db19d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/skeleton/wither_skeleton.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/slime/magmacube.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/slime/magmacube.png new file mode 100644 index 0000000..c1b397f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/slime/magmacube.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/slime/slime.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/slime/slime.png new file mode 100644 index 0000000..96edcf6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/slime/slime.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/snowman.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/snowman.png new file mode 100644 index 0000000..568d5f6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/snowman.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/spider/cave_spider.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/spider/cave_spider.png new file mode 100644 index 0000000..934f1ea Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/spider/cave_spider.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/spider/spider.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/spider/spider.png new file mode 100644 index 0000000..3a8c779 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/spider/spider.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/spider_eyes.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/spider_eyes.png new file mode 100644 index 0000000..6b80a06 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/spider_eyes.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/squid.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/squid.png new file mode 100644 index 0000000..f285388 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/squid.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/steve.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/steve.png new file mode 100644 index 0000000..6650185 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/steve.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/butcher.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/butcher.png new file mode 100644 index 0000000..f1c07d4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/butcher.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/farmer.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/farmer.png new file mode 100644 index 0000000..970c179 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/farmer.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/librarian.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/librarian.png new file mode 100644 index 0000000..b071cd3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/librarian.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/priest.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/priest.png new file mode 100644 index 0000000..35054ce Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/priest.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/smith.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/smith.png new file mode 100644 index 0000000..965da7f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/smith.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/villager.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/villager.png new file mode 100644 index 0000000..52de8e7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/villager/villager.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/witch.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/witch.png new file mode 100644 index 0000000..2403570 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/witch.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/wither/wither.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wither/wither.png new file mode 100644 index 0000000..0882d05 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wither/wither.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/wither/wither_armor.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wither/wither_armor.png new file mode 100644 index 0000000..a6b5cf5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wither/wither_armor.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/wither/wither_invulnerable.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wither/wither_invulnerable.png new file mode 100644 index 0000000..717750b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wither/wither_invulnerable.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf.png new file mode 100644 index 0000000..f37ef81 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf_angry.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf_angry.png new file mode 100644 index 0000000..7891ce9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf_angry.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf_collar.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf_collar.png new file mode 100644 index 0000000..ae1c920 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf_collar.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf_tame.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf_tame.png new file mode 100644 index 0000000..f1236d2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/wolf/wolf_tame.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/zombie/zombie.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/zombie/zombie.png new file mode 100644 index 0000000..22ff8f9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/zombie/zombie.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/zombie/zombie_villager.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/zombie/zombie_villager.png new file mode 100644 index 0000000..349f9c2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/zombie/zombie_villager.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/entity/zombie_pigman.png b/lwjgl-rundir/resources/assets/minecraft/textures/entity/zombie_pigman.png new file mode 100644 index 0000000..e95cc4c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/entity/zombie_pigman.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/environment/clouds.png b/lwjgl-rundir/resources/assets/minecraft/textures/environment/clouds.png new file mode 100644 index 0000000..a67c44d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/environment/clouds.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/environment/end_sky.png b/lwjgl-rundir/resources/assets/minecraft/textures/environment/end_sky.png new file mode 100644 index 0000000..094b309 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/environment/end_sky.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/environment/moon_phases.png b/lwjgl-rundir/resources/assets/minecraft/textures/environment/moon_phases.png new file mode 100644 index 0000000..cdba8d1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/environment/moon_phases.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/environment/rain.png b/lwjgl-rundir/resources/assets/minecraft/textures/environment/rain.png new file mode 100644 index 0000000..2dc4b1c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/environment/rain.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/environment/snow.png b/lwjgl-rundir/resources/assets/minecraft/textures/environment/snow.png new file mode 100644 index 0000000..1898903 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/environment/snow.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/environment/sun.png b/lwjgl-rundir/resources/assets/minecraft/textures/environment/sun.png new file mode 100644 index 0000000..08de644 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/environment/sun.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/ascii.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/ascii.png new file mode 100644 index 0000000..e446d53 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/ascii.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/ascii_sga.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/ascii_sga.png new file mode 100644 index 0000000..f443b4a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/ascii_sga.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_00.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_00.png new file mode 100644 index 0000000..44fd12f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_00.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_01.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_01.png new file mode 100644 index 0000000..ddac030 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_01.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_02.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_02.png new file mode 100644 index 0000000..dc1335a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_02.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_03.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_03.png new file mode 100644 index 0000000..6ff0257 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_03.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_04.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_04.png new file mode 100644 index 0000000..be3e833 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_04.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_05.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_05.png new file mode 100644 index 0000000..9b58804 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_05.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_06.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_06.png new file mode 100644 index 0000000..ed74e78 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_06.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_07.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_07.png new file mode 100644 index 0000000..b532177 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_07.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_09.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_09.png new file mode 100644 index 0000000..083b911 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_09.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0a.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0a.png new file mode 100644 index 0000000..0190c11 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0a.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0b.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0b.png new file mode 100644 index 0000000..4d0af48 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0b.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0c.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0c.png new file mode 100644 index 0000000..773297d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0c.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0d.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0d.png new file mode 100644 index 0000000..5f52231 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0d.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0e.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0e.png new file mode 100644 index 0000000..531ca7d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0e.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0f.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0f.png new file mode 100644 index 0000000..7b879fc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_0f.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_10.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_10.png new file mode 100644 index 0000000..53f056c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_10.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_11.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_11.png new file mode 100644 index 0000000..a9d5c11 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_11.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_12.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_12.png new file mode 100644 index 0000000..d20a864 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_12.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_13.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_13.png new file mode 100644 index 0000000..bbb0641 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_13.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_14.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_14.png new file mode 100644 index 0000000..ffd8e42 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_14.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_15.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_15.png new file mode 100644 index 0000000..ccfcae6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_15.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_16.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_16.png new file mode 100644 index 0000000..d02c557 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_16.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_17.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_17.png new file mode 100644 index 0000000..fed5b6e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_17.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_18.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_18.png new file mode 100644 index 0000000..97394d0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_18.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_19.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_19.png new file mode 100644 index 0000000..6929413 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_19.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1a.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1a.png new file mode 100644 index 0000000..d3a1b98 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1a.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1b.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1b.png new file mode 100644 index 0000000..9e0adf7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1b.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1c.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1c.png new file mode 100644 index 0000000..14d4890 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1c.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1d.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1d.png new file mode 100644 index 0000000..1924226 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1d.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1e.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1e.png new file mode 100644 index 0000000..cce20e3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1e.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1f.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1f.png new file mode 100644 index 0000000..bdaf22f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_1f.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_20.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_20.png new file mode 100644 index 0000000..ba948e9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_20.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_21.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_21.png new file mode 100644 index 0000000..998f2f9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_21.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_22.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_22.png new file mode 100644 index 0000000..c3fd5dd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_22.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_23.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_23.png new file mode 100644 index 0000000..9c2b2dc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_23.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_24.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_24.png new file mode 100644 index 0000000..d6cc8ae Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_24.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_25.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_25.png new file mode 100644 index 0000000..ee7535d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_25.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_26.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_26.png new file mode 100644 index 0000000..93aa960 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_26.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_27.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_27.png new file mode 100644 index 0000000..92f4501 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_27.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_28.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_28.png new file mode 100644 index 0000000..5f96e1b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_28.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_29.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_29.png new file mode 100644 index 0000000..4558220 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_29.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2a.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2a.png new file mode 100644 index 0000000..87e0e0c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2a.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2b.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2b.png new file mode 100644 index 0000000..722edf0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2b.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2c.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2c.png new file mode 100644 index 0000000..51830f7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2c.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2d.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2d.png new file mode 100644 index 0000000..dfafa53 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2d.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2e.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2e.png new file mode 100644 index 0000000..2aea04b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2e.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2f.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2f.png new file mode 100644 index 0000000..bff5f8e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_2f.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_30.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_30.png new file mode 100644 index 0000000..5ccba75 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_30.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_31.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_31.png new file mode 100644 index 0000000..44fc5e5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_31.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_32.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_32.png new file mode 100644 index 0000000..4858d08 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_32.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_33.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_33.png new file mode 100644 index 0000000..ab67072 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_33.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_34.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_34.png new file mode 100644 index 0000000..fd8fca9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_34.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_35.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_35.png new file mode 100644 index 0000000..603dc02 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_35.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_36.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_36.png new file mode 100644 index 0000000..778c190 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_36.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_37.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_37.png new file mode 100644 index 0000000..3032a23 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_37.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_38.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_38.png new file mode 100644 index 0000000..9b637bd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_38.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_39.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_39.png new file mode 100644 index 0000000..2f93850 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_39.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3a.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3a.png new file mode 100644 index 0000000..cdf4944 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3a.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3b.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3b.png new file mode 100644 index 0000000..10e8502 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3b.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3c.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3c.png new file mode 100644 index 0000000..022fea5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3c.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3d.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3d.png new file mode 100644 index 0000000..01ea1d1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3d.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3e.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3e.png new file mode 100644 index 0000000..3bdf7f8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3e.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3f.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3f.png new file mode 100644 index 0000000..3fd5249 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_3f.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_40.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_40.png new file mode 100644 index 0000000..544f89e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_40.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_41.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_41.png new file mode 100644 index 0000000..729fdaf Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_41.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_42.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_42.png new file mode 100644 index 0000000..755e546 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_42.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_43.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_43.png new file mode 100644 index 0000000..6069d0d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_43.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_44.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_44.png new file mode 100644 index 0000000..845c364 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_44.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_45.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_45.png new file mode 100644 index 0000000..294c78d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_45.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_46.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_46.png new file mode 100644 index 0000000..ee5e629 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_46.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_47.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_47.png new file mode 100644 index 0000000..55cb0c0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_47.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_48.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_48.png new file mode 100644 index 0000000..7652211 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_48.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_49.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_49.png new file mode 100644 index 0000000..b736232 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_49.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4a.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4a.png new file mode 100644 index 0000000..d3419bd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4a.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4b.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4b.png new file mode 100644 index 0000000..5e02ad3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4b.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4c.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4c.png new file mode 100644 index 0000000..11c6b31 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4c.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4d.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4d.png new file mode 100644 index 0000000..3eb224a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4d.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4e.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4e.png new file mode 100644 index 0000000..11a78ba Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4e.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4f.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4f.png new file mode 100644 index 0000000..b4c9fab Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_4f.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_50.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_50.png new file mode 100644 index 0000000..ff73d23 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_50.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_51.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_51.png new file mode 100644 index 0000000..6e0eae9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_51.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_52.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_52.png new file mode 100644 index 0000000..6f10fcb Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_52.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_53.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_53.png new file mode 100644 index 0000000..60d478e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_53.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_54.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_54.png new file mode 100644 index 0000000..ac75bdd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_54.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_55.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_55.png new file mode 100644 index 0000000..3d122d2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_55.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_56.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_56.png new file mode 100644 index 0000000..576d07f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_56.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_57.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_57.png new file mode 100644 index 0000000..545da73 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_57.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_58.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_58.png new file mode 100644 index 0000000..941542e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_58.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_59.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_59.png new file mode 100644 index 0000000..56f0102 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_59.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5a.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5a.png new file mode 100644 index 0000000..c14f1b1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5a.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5b.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5b.png new file mode 100644 index 0000000..f418e4c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5b.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5c.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5c.png new file mode 100644 index 0000000..e7efae6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5c.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5d.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5d.png new file mode 100644 index 0000000..7355fd3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5d.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5e.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5e.png new file mode 100644 index 0000000..abfd3af Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5e.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5f.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5f.png new file mode 100644 index 0000000..5a64b50 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_5f.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_60.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_60.png new file mode 100644 index 0000000..8166f15 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_60.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_61.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_61.png new file mode 100644 index 0000000..d11cd8a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_61.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_62.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_62.png new file mode 100644 index 0000000..f7b9a5b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_62.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_63.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_63.png new file mode 100644 index 0000000..5d4a8cc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_63.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_64.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_64.png new file mode 100644 index 0000000..bc43210 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_64.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_65.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_65.png new file mode 100644 index 0000000..42144c1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_65.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_66.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_66.png new file mode 100644 index 0000000..a65f25e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_66.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_67.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_67.png new file mode 100644 index 0000000..a115bb8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_67.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_68.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_68.png new file mode 100644 index 0000000..d47938b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_68.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_69.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_69.png new file mode 100644 index 0000000..c36e640 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_69.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6a.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6a.png new file mode 100644 index 0000000..5265d07 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6a.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6b.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6b.png new file mode 100644 index 0000000..6f207cc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6b.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6c.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6c.png new file mode 100644 index 0000000..6ffad7e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6c.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6d.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6d.png new file mode 100644 index 0000000..0fa88e3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6d.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6e.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6e.png new file mode 100644 index 0000000..301513e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6e.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6f.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6f.png new file mode 100644 index 0000000..a24cfff Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_6f.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_70.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_70.png new file mode 100644 index 0000000..2cec746 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_70.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_71.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_71.png new file mode 100644 index 0000000..1592ff4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_71.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_72.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_72.png new file mode 100644 index 0000000..856eedc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_72.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_73.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_73.png new file mode 100644 index 0000000..a7a2151 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_73.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_74.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_74.png new file mode 100644 index 0000000..a1b034a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_74.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_75.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_75.png new file mode 100644 index 0000000..512dc16 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_75.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_76.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_76.png new file mode 100644 index 0000000..12a45ff Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_76.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_77.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_77.png new file mode 100644 index 0000000..d763fba Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_77.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_78.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_78.png new file mode 100644 index 0000000..846c060 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_78.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_79.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_79.png new file mode 100644 index 0000000..f887cae Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_79.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7a.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7a.png new file mode 100644 index 0000000..90d5561 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7a.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7b.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7b.png new file mode 100644 index 0000000..2932cee Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7b.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7c.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7c.png new file mode 100644 index 0000000..416a21b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7c.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7d.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7d.png new file mode 100644 index 0000000..2e12e13 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7d.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7e.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7e.png new file mode 100644 index 0000000..952bfab Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7e.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7f.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7f.png new file mode 100644 index 0000000..d3d275c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_7f.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_80.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_80.png new file mode 100644 index 0000000..044ac3e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_80.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_81.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_81.png new file mode 100644 index 0000000..913a4ca Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_81.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_82.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_82.png new file mode 100644 index 0000000..19b8ded Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_82.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_83.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_83.png new file mode 100644 index 0000000..ef2d794 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_83.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_84.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_84.png new file mode 100644 index 0000000..74a6a53 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_84.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_85.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_85.png new file mode 100644 index 0000000..73cb2f9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_85.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_86.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_86.png new file mode 100644 index 0000000..135d6fc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_86.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_87.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_87.png new file mode 100644 index 0000000..bef88db Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_87.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_88.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_88.png new file mode 100644 index 0000000..698ff80 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_88.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_89.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_89.png new file mode 100644 index 0000000..a3820ee Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_89.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8a.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8a.png new file mode 100644 index 0000000..beb9024 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8a.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8b.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8b.png new file mode 100644 index 0000000..7f978ab Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8b.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8c.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8c.png new file mode 100644 index 0000000..3ed4594 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8c.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8d.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8d.png new file mode 100644 index 0000000..8d79123 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8d.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8e.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8e.png new file mode 100644 index 0000000..d82000b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8e.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8f.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8f.png new file mode 100644 index 0000000..b8c8328 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_8f.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_90.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_90.png new file mode 100644 index 0000000..132974b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_90.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_91.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_91.png new file mode 100644 index 0000000..b8e09ae Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_91.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_92.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_92.png new file mode 100644 index 0000000..9244661 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_92.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_93.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_93.png new file mode 100644 index 0000000..f71d835 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_93.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_94.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_94.png new file mode 100644 index 0000000..fa68d81 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_94.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_95.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_95.png new file mode 100644 index 0000000..346bc36 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_95.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_96.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_96.png new file mode 100644 index 0000000..bbd1772 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_96.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_97.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_97.png new file mode 100644 index 0000000..2fd136b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_97.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_98.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_98.png new file mode 100644 index 0000000..9319c0b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_98.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_99.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_99.png new file mode 100644 index 0000000..2bb7f3e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_99.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9a.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9a.png new file mode 100644 index 0000000..cbdd91e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9a.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9b.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9b.png new file mode 100644 index 0000000..8a96209 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9b.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9c.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9c.png new file mode 100644 index 0000000..8e977ff Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9c.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9d.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9d.png new file mode 100644 index 0000000..5041d6a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9d.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9e.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9e.png new file mode 100644 index 0000000..1cb0a5b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9e.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9f.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9f.png new file mode 100644 index 0000000..d987326 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_9f.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a0.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a0.png new file mode 100644 index 0000000..8c47db0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a1.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a1.png new file mode 100644 index 0000000..5ede7e7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a2.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a2.png new file mode 100644 index 0000000..a8c6ac1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a3.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a3.png new file mode 100644 index 0000000..7cc8448 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a3.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a4.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a4.png new file mode 100644 index 0000000..dc00e27 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a4.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a5.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a5.png new file mode 100644 index 0000000..eccfa47 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a5.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a6.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a6.png new file mode 100644 index 0000000..dcac87f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a6.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a7.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a7.png new file mode 100644 index 0000000..76c1ce2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a7.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a8.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a8.png new file mode 100644 index 0000000..a022390 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a8.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a9.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a9.png new file mode 100644 index 0000000..a35159a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_a9.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_aa.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_aa.png new file mode 100644 index 0000000..da1b615 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_aa.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ab.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ab.png new file mode 100644 index 0000000..0e45eae Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ab.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ac.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ac.png new file mode 100644 index 0000000..04d4d59 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ac.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ad.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ad.png new file mode 100644 index 0000000..3834337 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ad.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ae.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ae.png new file mode 100644 index 0000000..1445e68 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ae.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_af.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_af.png new file mode 100644 index 0000000..ea945dc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_af.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b0.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b0.png new file mode 100644 index 0000000..84b4885 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b1.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b1.png new file mode 100644 index 0000000..5f64672 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b2.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b2.png new file mode 100644 index 0000000..8551db8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b3.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b3.png new file mode 100644 index 0000000..b954159 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b3.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b4.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b4.png new file mode 100644 index 0000000..65991a4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b4.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b5.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b5.png new file mode 100644 index 0000000..3e6391b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b5.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b6.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b6.png new file mode 100644 index 0000000..df7c0f7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b6.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b7.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b7.png new file mode 100644 index 0000000..9142cad Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b7.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b8.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b8.png new file mode 100644 index 0000000..5b18d12 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b8.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b9.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b9.png new file mode 100644 index 0000000..0d212f0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_b9.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ba.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ba.png new file mode 100644 index 0000000..696cca9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ba.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bb.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bb.png new file mode 100644 index 0000000..5a2544c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bb.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bc.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bc.png new file mode 100644 index 0000000..df37526 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bc.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bd.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bd.png new file mode 100644 index 0000000..aed7803 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bd.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_be.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_be.png new file mode 100644 index 0000000..0da2254 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_be.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bf.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bf.png new file mode 100644 index 0000000..1f6a248 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_bf.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c0.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c0.png new file mode 100644 index 0000000..0610d67 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c1.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c1.png new file mode 100644 index 0000000..a95ca9b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c2.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c2.png new file mode 100644 index 0000000..1d104a0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c3.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c3.png new file mode 100644 index 0000000..6470dd8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c3.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c4.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c4.png new file mode 100644 index 0000000..e8c3105 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c4.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c5.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c5.png new file mode 100644 index 0000000..d89f288 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c5.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c6.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c6.png new file mode 100644 index 0000000..004091d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c6.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c7.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c7.png new file mode 100644 index 0000000..f64f6b4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c7.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c8.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c8.png new file mode 100644 index 0000000..75f8a50 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c8.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c9.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c9.png new file mode 100644 index 0000000..fbd9435 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_c9.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ca.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ca.png new file mode 100644 index 0000000..112b9c6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ca.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cb.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cb.png new file mode 100644 index 0000000..c0549b5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cb.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cc.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cc.png new file mode 100644 index 0000000..0684431 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cc.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cd.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cd.png new file mode 100644 index 0000000..9fdc54d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cd.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ce.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ce.png new file mode 100644 index 0000000..958a96b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ce.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cf.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cf.png new file mode 100644 index 0000000..4106f1b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_cf.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d0.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d0.png new file mode 100644 index 0000000..546b014 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d1.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d1.png new file mode 100644 index 0000000..6d67bf1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d2.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d2.png new file mode 100644 index 0000000..c4ae511 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d3.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d3.png new file mode 100644 index 0000000..576c9ea Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d3.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d4.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d4.png new file mode 100644 index 0000000..14be6c7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d4.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d5.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d5.png new file mode 100644 index 0000000..3c41836 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d5.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d6.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d6.png new file mode 100644 index 0000000..27424b1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d6.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d7.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d7.png new file mode 100644 index 0000000..d8772d8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_d7.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_f9.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_f9.png new file mode 100644 index 0000000..e723235 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_f9.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fa.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fa.png new file mode 100644 index 0000000..d78dcfe Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fa.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fb.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fb.png new file mode 100644 index 0000000..5423c86 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fb.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fc.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fc.png new file mode 100644 index 0000000..8034140 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fc.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fd.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fd.png new file mode 100644 index 0000000..c31bd6f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fd.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fe.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fe.png new file mode 100644 index 0000000..42ed33e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_fe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ff.png b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ff.png new file mode 100644 index 0000000..f0ff742 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/font/unicode_page_ff.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/achievement/achievement_background.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/achievement/achievement_background.png new file mode 100644 index 0000000..958ebd6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/achievement/achievement_background.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/achievement/achievement_icons.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/achievement/achievement_icons.png new file mode 100644 index 0000000..8c4ae79 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/achievement/achievement_icons.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/book.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/book.png new file mode 100644 index 0000000..3e4ba4e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/book.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/anvil.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/anvil.png new file mode 100644 index 0000000..34e8f9f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/anvil.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/beacon.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/beacon.png new file mode 100644 index 0000000..f51a2ef Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/beacon.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/brewing_stand.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/brewing_stand.png new file mode 100644 index 0000000..e7dc203 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/brewing_stand.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/crafting_table.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/crafting_table.png new file mode 100644 index 0000000..254dacc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/crafting_table.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tab_inventory.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tab_inventory.png new file mode 100644 index 0000000..c8d53a6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tab_inventory.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tab_item_search.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tab_item_search.png new file mode 100644 index 0000000..cc250e5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tab_item_search.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tab_items.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tab_items.png new file mode 100644 index 0000000..38421f7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tab_items.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tabs.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tabs.png new file mode 100644 index 0000000..1c44093 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/creative_inventory/tabs.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/dispenser.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/dispenser.png new file mode 100644 index 0000000..0a6ebe7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/dispenser.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/enchanting_table.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/enchanting_table.png new file mode 100644 index 0000000..59aeb04 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/enchanting_table.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/furnace.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/furnace.png new file mode 100644 index 0000000..2255d0a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/furnace.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/generic_54.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/generic_54.png new file mode 100644 index 0000000..0b880ef Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/generic_54.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/hopper.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/hopper.png new file mode 100644 index 0000000..3d00547 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/hopper.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/horse.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/horse.png new file mode 100644 index 0000000..194cc6b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/horse.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/inventory.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/inventory.png new file mode 100644 index 0000000..d553c4f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/inventory.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/stats_icons.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/stats_icons.png new file mode 100644 index 0000000..f13323b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/stats_icons.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/villager.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/villager.png new file mode 100644 index 0000000..3211a7a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/container/villager.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/demo_background.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/demo_background.png new file mode 100644 index 0000000..a7fd8be Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/demo_background.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/icons.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/icons.png new file mode 100644 index 0000000..89d780f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/icons.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/options_background.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/options_background.png new file mode 100644 index 0000000..cae5528 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/options_background.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_0.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_0.png new file mode 100644 index 0000000..27f015d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_1.png new file mode 100644 index 0000000..c16841a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_2.png new file mode 100644 index 0000000..0436d77 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_3.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_3.png new file mode 100644 index 0000000..2c7ad77 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_3.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_4.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_4.png new file mode 100644 index 0000000..0390096 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_4.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_5.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_5.png new file mode 100644 index 0000000..0331ad4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/background/panorama_5.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/minecraft.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/minecraft.png new file mode 100644 index 0000000..dc61041 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/minecraft.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/mojang.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/mojang.png new file mode 100644 index 0000000..ba394db Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/title/mojang.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/gui/widgets.png b/lwjgl-rundir/resources/assets/minecraft/textures/gui/widgets.png new file mode 100644 index 0000000..2a749c8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/gui/widgets.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/apple.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/apple.png new file mode 100644 index 0000000..3e2ee59 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/apple.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/apple_golden.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/apple_golden.png new file mode 100644 index 0000000..6201989 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/apple_golden.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/arrow.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/arrow.png new file mode 100644 index 0000000..4f748a0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/arrow.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bed.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bed.png new file mode 100644 index 0000000..22a4cf0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bed.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/beef_cooked.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/beef_cooked.png new file mode 100644 index 0000000..a1c765a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/beef_cooked.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/beef_raw.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/beef_raw.png new file mode 100644 index 0000000..82af4e7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/beef_raw.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/blaze_powder.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/blaze_powder.png new file mode 100644 index 0000000..89c57d6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/blaze_powder.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/blaze_rod.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/blaze_rod.png new file mode 100644 index 0000000..7050e10 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/blaze_rod.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/boat.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/boat.png new file mode 100644 index 0000000..235e0a2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/boat.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bone.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bone.png new file mode 100644 index 0000000..3faca89 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bone.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/book_enchanted.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/book_enchanted.png new file mode 100644 index 0000000..44215f6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/book_enchanted.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/book_normal.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/book_normal.png new file mode 100644 index 0000000..f791ae4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/book_normal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/book_writable.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/book_writable.png new file mode 100644 index 0000000..fa95246 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/book_writable.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/book_written.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/book_written.png new file mode 100644 index 0000000..b2a2aa8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/book_written.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_pulling_0.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_pulling_0.png new file mode 100644 index 0000000..2022aab Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_pulling_0.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_pulling_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_pulling_1.png new file mode 100644 index 0000000..a132079 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_pulling_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_pulling_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_pulling_2.png new file mode 100644 index 0000000..d459e68 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_pulling_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_standby.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_standby.png new file mode 100644 index 0000000..d709b9c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bow_standby.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bowl.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bowl.png new file mode 100644 index 0000000..63d16ad Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bowl.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bread.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bread.png new file mode 100644 index 0000000..c833604 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bread.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/brewing_stand.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/brewing_stand.png new file mode 100644 index 0000000..97db9af Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/brewing_stand.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/brick.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/brick.png new file mode 100644 index 0000000..11e74be Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/brick.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_empty.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_empty.png new file mode 100644 index 0000000..f8e5369 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_empty.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_lava.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_lava.png new file mode 100644 index 0000000..13a1957 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_lava.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_milk.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_milk.png new file mode 100644 index 0000000..c77d92c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_milk.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_water.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_water.png new file mode 100644 index 0000000..2f36acc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/bucket_water.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/cake.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/cake.png new file mode 100644 index 0000000..46e94b8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/cake.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/carrot.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/carrot.png new file mode 100644 index 0000000..2d08aab Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/carrot.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/carrot_golden.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/carrot_golden.png new file mode 100644 index 0000000..e0f1ea6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/carrot_golden.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/carrot_on_a_stick.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/carrot_on_a_stick.png new file mode 100644 index 0000000..9e88571 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/carrot_on_a_stick.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/cauldron.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/cauldron.png new file mode 100644 index 0000000..e3186eb Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/cauldron.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_boots.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_boots.png new file mode 100644 index 0000000..54a4a15 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_boots.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_chestplate.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_chestplate.png new file mode 100644 index 0000000..cd2115a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_chestplate.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_helmet.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_helmet.png new file mode 100644 index 0000000..a143338 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_helmet.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_leggings.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_leggings.png new file mode 100644 index 0000000..dae4b26 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/chainmail_leggings.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/charcoal.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/charcoal.png new file mode 100644 index 0000000..20d5b25 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/charcoal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/chicken_cooked.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/chicken_cooked.png new file mode 100644 index 0000000..890b5b3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/chicken_cooked.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/chicken_raw.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/chicken_raw.png new file mode 100644 index 0000000..6d25922 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/chicken_raw.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/clay_ball.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/clay_ball.png new file mode 100644 index 0000000..5103d6c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/clay_ball.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/clock.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/clock.png new file mode 100644 index 0000000..069a0ab Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/clock.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/clock.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/items/clock.png.mcmeta new file mode 100644 index 0000000..de3267f --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/items/clock.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation": {} +} \ No newline at end of file diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/coal.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/coal.png new file mode 100644 index 0000000..5563b6f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/coal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/comparator.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/comparator.png new file mode 100644 index 0000000..28b8eec Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/comparator.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/compass.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/compass.png new file mode 100644 index 0000000..9dcbdfe Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/compass.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/compass.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/items/compass.png.mcmeta new file mode 100644 index 0000000..de3267f --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/items/compass.png.mcmeta @@ -0,0 +1,3 @@ +{ + "animation": {} +} \ No newline at end of file diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/cookie.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/cookie.png new file mode 100644 index 0000000..01fe56b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/cookie.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond.png new file mode 100644 index 0000000..10e70a0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_axe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_axe.png new file mode 100644 index 0000000..7627f87 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_axe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_boots.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_boots.png new file mode 100644 index 0000000..70d9e5f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_boots.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_chestplate.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_chestplate.png new file mode 100644 index 0000000..afdff93 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_chestplate.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_helmet.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_helmet.png new file mode 100644 index 0000000..1c88592 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_helmet.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_hoe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_hoe.png new file mode 100644 index 0000000..c9a97e0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_hoe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_horse_armor.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_horse_armor.png new file mode 100644 index 0000000..b281aad Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_horse_armor.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_leggings.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_leggings.png new file mode 100644 index 0000000..a99c896 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_leggings.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_pickaxe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_pickaxe.png new file mode 100644 index 0000000..c279828 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_pickaxe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_shovel.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_shovel.png new file mode 100644 index 0000000..e4a8992 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_shovel.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_sword.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_sword.png new file mode 100644 index 0000000..2a1552d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/diamond_sword.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/door_iron.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/door_iron.png new file mode 100644 index 0000000..67877ab Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/door_iron.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/door_wood.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/door_wood.png new file mode 100644 index 0000000..750307f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/door_wood.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_black.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_black.png new file mode 100644 index 0000000..909bea5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_black.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_blue.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_blue.png new file mode 100644 index 0000000..4713983 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_blue.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_brown.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_brown.png new file mode 100644 index 0000000..62eae8d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_brown.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_cyan.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_cyan.png new file mode 100644 index 0000000..7b10c11 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_cyan.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_gray.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_gray.png new file mode 100644 index 0000000..4fce7e7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_gray.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_green.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_green.png new file mode 100644 index 0000000..009e058 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_green.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_light_blue.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_light_blue.png new file mode 100644 index 0000000..a8b45c9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_light_blue.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_lime.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_lime.png new file mode 100644 index 0000000..7a78764 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_lime.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_magenta.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_magenta.png new file mode 100644 index 0000000..ea7342a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_magenta.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_orange.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_orange.png new file mode 100644 index 0000000..677a1aa Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_orange.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_pink.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_pink.png new file mode 100644 index 0000000..1acc483 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_pink.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_purple.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_purple.png new file mode 100644 index 0000000..7d201c2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_purple.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_red.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_red.png new file mode 100644 index 0000000..2d1a742 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_red.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_silver.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_silver.png new file mode 100644 index 0000000..fa9e501 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_silver.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_white.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_white.png new file mode 100644 index 0000000..5b1833b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_white.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_yellow.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_yellow.png new file mode 100644 index 0000000..95e0673 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/dye_powder_yellow.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/egg.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/egg.png new file mode 100644 index 0000000..a6fe2bf Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/egg.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/emerald.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/emerald.png new file mode 100644 index 0000000..98d953e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/emerald.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_boots.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_boots.png new file mode 100644 index 0000000..fd7e05f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_boots.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_chestplate.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_chestplate.png new file mode 100644 index 0000000..6e632b9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_chestplate.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_helmet.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_helmet.png new file mode 100644 index 0000000..3a455f3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_helmet.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_leggings.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_leggings.png new file mode 100644 index 0000000..28b2c49 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/empty_armor_slot_leggings.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/ender_eye.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/ender_eye.png new file mode 100644 index 0000000..8c4ef4e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/ender_eye.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/ender_pearl.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/ender_pearl.png new file mode 100644 index 0000000..4b752a6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/ender_pearl.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/experience_bottle.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/experience_bottle.png new file mode 100644 index 0000000..ae4214f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/experience_bottle.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/feather.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/feather.png new file mode 100644 index 0000000..d4c3be5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/feather.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/fireball.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/fireball.png new file mode 100644 index 0000000..d62a6f4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/fireball.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/fireworks.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/fireworks.png new file mode 100644 index 0000000..f1e07fd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/fireworks.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/fireworks_charge.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/fireworks_charge.png new file mode 100644 index 0000000..43a4a21 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/fireworks_charge.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/fireworks_charge_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/fireworks_charge_overlay.png new file mode 100644 index 0000000..d8b91a9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/fireworks_charge_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/fish_cooked.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/fish_cooked.png new file mode 100644 index 0000000..87564c7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/fish_cooked.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/fish_raw.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/fish_raw.png new file mode 100644 index 0000000..e4f6837 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/fish_raw.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/fishing_rod_cast.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/fishing_rod_cast.png new file mode 100644 index 0000000..a5ab378 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/fishing_rod_cast.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/fishing_rod_uncast.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/fishing_rod_uncast.png new file mode 100644 index 0000000..d4b53f0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/fishing_rod_uncast.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/flint.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/flint.png new file mode 100644 index 0000000..5f51093 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/flint.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/flint_and_steel.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/flint_and_steel.png new file mode 100644 index 0000000..77bc340 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/flint_and_steel.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/flower_pot.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/flower_pot.png new file mode 100644 index 0000000..c4f26d2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/flower_pot.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/ghast_tear.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/ghast_tear.png new file mode 100644 index 0000000..e5c741f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/ghast_tear.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/glowstone_dust.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/glowstone_dust.png new file mode 100644 index 0000000..edd93a6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/glowstone_dust.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_axe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_axe.png new file mode 100644 index 0000000..0f47b60 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_axe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_boots.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_boots.png new file mode 100644 index 0000000..f6033d2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_boots.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_chestplate.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_chestplate.png new file mode 100644 index 0000000..e36076a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_chestplate.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_helmet.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_helmet.png new file mode 100644 index 0000000..9eb89a0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_helmet.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_hoe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_hoe.png new file mode 100644 index 0000000..1685d47 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_hoe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_horse_armor.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_horse_armor.png new file mode 100644 index 0000000..7c5c3a5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_horse_armor.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_ingot.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_ingot.png new file mode 100644 index 0000000..ea781e7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_ingot.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_leggings.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_leggings.png new file mode 100644 index 0000000..da23771 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_leggings.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_nugget.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_nugget.png new file mode 100644 index 0000000..3a9a2fe Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_nugget.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_pickaxe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_pickaxe.png new file mode 100644 index 0000000..ecccafe Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_pickaxe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_shovel.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_shovel.png new file mode 100644 index 0000000..150cbb9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_shovel.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_sword.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_sword.png new file mode 100644 index 0000000..0ddef04 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gold_sword.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/gunpowder.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/gunpowder.png new file mode 100644 index 0000000..73cadec Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/gunpowder.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/hopper.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/hopper.png new file mode 100644 index 0000000..f8b244f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/hopper.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_axe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_axe.png new file mode 100644 index 0000000..8bf133e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_axe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_boots.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_boots.png new file mode 100644 index 0000000..b69ca05 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_boots.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_chestplate.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_chestplate.png new file mode 100644 index 0000000..e7993ce Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_chestplate.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_helmet.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_helmet.png new file mode 100644 index 0000000..65e64cc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_helmet.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_hoe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_hoe.png new file mode 100644 index 0000000..28d4c36 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_hoe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_horse_armor.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_horse_armor.png new file mode 100644 index 0000000..5d697d1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_horse_armor.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_ingot.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_ingot.png new file mode 100644 index 0000000..3833fa0 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_ingot.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_leggings.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_leggings.png new file mode 100644 index 0000000..ad53673 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_leggings.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_pickaxe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_pickaxe.png new file mode 100644 index 0000000..d21440b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_pickaxe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_shovel.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_shovel.png new file mode 100644 index 0000000..079b236 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_shovel.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_sword.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_sword.png new file mode 100644 index 0000000..4d49c5a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/iron_sword.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/item_frame.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/item_frame.png new file mode 100644 index 0000000..261c98a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/item_frame.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/lead.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/lead.png new file mode 100644 index 0000000..0ef5312 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/lead.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/leather.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather.png new file mode 100644 index 0000000..13dc199 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_boots.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_boots.png new file mode 100644 index 0000000..31c2132 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_boots.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_boots_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_boots_overlay.png new file mode 100644 index 0000000..b6896d8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_boots_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_chestplate.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_chestplate.png new file mode 100644 index 0000000..e534aef Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_chestplate.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_chestplate_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_chestplate_overlay.png new file mode 100644 index 0000000..125fd34 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_chestplate_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_helmet.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_helmet.png new file mode 100644 index 0000000..da2cfa8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_helmet.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_helmet_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_helmet_overlay.png new file mode 100644 index 0000000..8040d77 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_helmet_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_leggings.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_leggings.png new file mode 100644 index 0000000..3ff24ee Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_leggings.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_leggings_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_leggings_overlay.png new file mode 100644 index 0000000..813ba26 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/leather_leggings_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/magma_cream.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/magma_cream.png new file mode 100644 index 0000000..b2be210 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/magma_cream.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/map_empty.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/map_empty.png new file mode 100644 index 0000000..8dc6e58 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/map_empty.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/map_filled.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/map_filled.png new file mode 100644 index 0000000..1381e21 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/map_filled.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/melon.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/melon.png new file mode 100644 index 0000000..590f47a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/melon.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/melon_speckled.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/melon_speckled.png new file mode 100644 index 0000000..dee1bf5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/melon_speckled.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_chest.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_chest.png new file mode 100644 index 0000000..78a3778 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_chest.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_furnace.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_furnace.png new file mode 100644 index 0000000..5478f25 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_furnace.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_hopper.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_hopper.png new file mode 100644 index 0000000..8a138fb Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_hopper.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_normal.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_normal.png new file mode 100644 index 0000000..2046f2b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_normal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_tnt.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_tnt.png new file mode 100644 index 0000000..561279b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/minecart_tnt.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/mushroom_stew.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/mushroom_stew.png new file mode 100644 index 0000000..5598bc7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/mushroom_stew.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/name_tag.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/name_tag.png new file mode 100644 index 0000000..a88f559 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/name_tag.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/nether_star.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/nether_star.png new file mode 100644 index 0000000..6b848af Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/nether_star.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/nether_wart.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/nether_wart.png new file mode 100644 index 0000000..09da1e3 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/nether_wart.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/netherbrick.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/netherbrick.png new file mode 100644 index 0000000..e9c14ed Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/netherbrick.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/painting.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/painting.png new file mode 100644 index 0000000..b394f30 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/painting.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/paper.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/paper.png new file mode 100644 index 0000000..a1d9c7e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/paper.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/porkchop_cooked.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/porkchop_cooked.png new file mode 100644 index 0000000..605d3f5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/porkchop_cooked.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/porkchop_raw.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/porkchop_raw.png new file mode 100644 index 0000000..7e83c1a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/porkchop_raw.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/potato.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/potato.png new file mode 100644 index 0000000..c1d8541 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/potato.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/potato_baked.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/potato_baked.png new file mode 100644 index 0000000..e4d765b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/potato_baked.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/potato_poisonous.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/potato_poisonous.png new file mode 100644 index 0000000..6f154af Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/potato_poisonous.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_bottle_drinkable.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_bottle_drinkable.png new file mode 100644 index 0000000..87339d7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_bottle_drinkable.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_bottle_empty.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_bottle_empty.png new file mode 100644 index 0000000..87339d7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_bottle_empty.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_bottle_splash.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_bottle_splash.png new file mode 100644 index 0000000..03b1f90 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_bottle_splash.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_overlay.png new file mode 100644 index 0000000..1e6165e Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/potion_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/pumpkin_pie.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/pumpkin_pie.png new file mode 100644 index 0000000..c21a032 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/pumpkin_pie.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/quartz.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/quartz.png new file mode 100644 index 0000000..e403446 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/quartz.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/quiver.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/quiver.png new file mode 100644 index 0000000..818f728 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/quiver.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_11.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_11.png new file mode 100644 index 0000000..07ac487 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_11.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_13.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_13.png new file mode 100644 index 0000000..ead0c61 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_13.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_blocks.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_blocks.png new file mode 100644 index 0000000..3732d6c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_blocks.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_cat.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_cat.png new file mode 100644 index 0000000..b3527ef Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_cat.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_chirp.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_chirp.png new file mode 100644 index 0000000..1b24e11 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_chirp.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_far.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_far.png new file mode 100644 index 0000000..2320efd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_far.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_mall.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_mall.png new file mode 100644 index 0000000..811d046 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_mall.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_mellohi.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_mellohi.png new file mode 100644 index 0000000..879b6a4 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_mellohi.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_stal.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_stal.png new file mode 100644 index 0000000..c650d21 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_stal.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_strad.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_strad.png new file mode 100644 index 0000000..72d6e32 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_strad.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_wait.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_wait.png new file mode 100644 index 0000000..5306b51 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_wait.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/record_ward.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_ward.png new file mode 100644 index 0000000..b33b93d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/record_ward.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/redstone_dust.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/redstone_dust.png new file mode 100644 index 0000000..6da938b Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/redstone_dust.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/reeds.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/reeds.png new file mode 100644 index 0000000..40872c6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/reeds.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/repeater.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/repeater.png new file mode 100644 index 0000000..7a07381 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/repeater.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/rotten_flesh.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/rotten_flesh.png new file mode 100644 index 0000000..3f39998 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/rotten_flesh.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/ruby.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/ruby.png new file mode 100644 index 0000000..4f288d9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/ruby.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/saddle.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/saddle.png new file mode 100644 index 0000000..b12eafa Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/saddle.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/seeds_melon.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/seeds_melon.png new file mode 100644 index 0000000..ef84499 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/seeds_melon.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/seeds_pumpkin.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/seeds_pumpkin.png new file mode 100644 index 0000000..8d8f076 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/seeds_pumpkin.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/seeds_wheat.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/seeds_wheat.png new file mode 100644 index 0000000..83d23a6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/seeds_wheat.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/shears.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/shears.png new file mode 100644 index 0000000..f9c6de1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/shears.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/sign.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/sign.png new file mode 100644 index 0000000..9b6e2ee Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/sign.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_creeper.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_creeper.png new file mode 100644 index 0000000..c195fd5 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_creeper.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_skeleton.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_skeleton.png new file mode 100644 index 0000000..bf383fc Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_skeleton.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_steve.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_steve.png new file mode 100644 index 0000000..e56f406 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_steve.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_wither.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_wither.png new file mode 100644 index 0000000..3571603 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_wither.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_zombie.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_zombie.png new file mode 100644 index 0000000..67d1347 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/skull_zombie.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/slimeball.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/slimeball.png new file mode 100644 index 0000000..46478ee Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/slimeball.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/snowball.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/snowball.png new file mode 100644 index 0000000..340c639 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/snowball.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/spawn_egg.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/spawn_egg.png new file mode 100644 index 0000000..23259c7 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/spawn_egg.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/spawn_egg_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/spawn_egg_overlay.png new file mode 100644 index 0000000..83ec78f Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/spawn_egg_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/spider_eye.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/spider_eye.png new file mode 100644 index 0000000..35d8584 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/spider_eye.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/spider_eye_fermented.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/spider_eye_fermented.png new file mode 100644 index 0000000..226ffb8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/spider_eye_fermented.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/stick.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/stick.png new file mode 100644 index 0000000..6f8ce13 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/stick.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_axe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_axe.png new file mode 100644 index 0000000..fb33584 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_axe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_hoe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_hoe.png new file mode 100644 index 0000000..d46b272 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_hoe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_pickaxe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_pickaxe.png new file mode 100644 index 0000000..19a8e50 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_pickaxe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_shovel.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_shovel.png new file mode 100644 index 0000000..8e1c0c2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_shovel.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_sword.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_sword.png new file mode 100644 index 0000000..5810dfd Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/stone_sword.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/string.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/string.png new file mode 100644 index 0000000..0b04ddb Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/string.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/sugar.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/sugar.png new file mode 100644 index 0000000..0864df9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/sugar.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/wheat.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/wheat.png new file mode 100644 index 0000000..bbd2fd9 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/wheat.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_axe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_axe.png new file mode 100644 index 0000000..3a19203 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_axe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_hoe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_hoe.png new file mode 100644 index 0000000..de1c7a6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_hoe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_pickaxe.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_pickaxe.png new file mode 100644 index 0000000..ebc6756 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_pickaxe.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_shovel.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_shovel.png new file mode 100644 index 0000000..b057911 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_shovel.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_sword.png b/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_sword.png new file mode 100644 index 0000000..c04dc0a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/items/wood_sword.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/map/map_background.png b/lwjgl-rundir/resources/assets/minecraft/textures/map/map_background.png new file mode 100644 index 0000000..2783b50 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/map/map_background.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/map/map_icons.png b/lwjgl-rundir/resources/assets/minecraft/textures/map/map_icons.png new file mode 100644 index 0000000..c2f35b8 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/map/map_icons.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/misc/enchanted_item_glint.png b/lwjgl-rundir/resources/assets/minecraft/textures/misc/enchanted_item_glint.png new file mode 100644 index 0000000..f9ca97c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/misc/enchanted_item_glint.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/misc/enchanted_item_glint.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/misc/enchanted_item_glint.png.mcmeta new file mode 100644 index 0000000..2f6b501 --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/misc/enchanted_item_glint.png.mcmeta @@ -0,0 +1,5 @@ +{ + "texture": { + "blur": true + } +} diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/misc/pumpkinblur.png b/lwjgl-rundir/resources/assets/minecraft/textures/misc/pumpkinblur.png new file mode 100644 index 0000000..d9725ce Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/misc/pumpkinblur.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/misc/pumpkinblur.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/misc/pumpkinblur.png.mcmeta new file mode 100644 index 0000000..5b992c3 --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/misc/pumpkinblur.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true + } +} + diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/misc/shadow.png b/lwjgl-rundir/resources/assets/minecraft/textures/misc/shadow.png new file mode 100644 index 0000000..b09fd47 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/misc/shadow.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/misc/shadow.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/misc/shadow.png.mcmeta new file mode 100644 index 0000000..67b9d53 --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/misc/shadow.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "clamp": true + } +} + diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/misc/underwater.png b/lwjgl-rundir/resources/assets/minecraft/textures/misc/underwater.png new file mode 100644 index 0000000..2fc23b1 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/misc/underwater.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/misc/unknown_pack.png b/lwjgl-rundir/resources/assets/minecraft/textures/misc/unknown_pack.png new file mode 100644 index 0000000..16afade Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/misc/unknown_pack.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/misc/vignette.png b/lwjgl-rundir/resources/assets/minecraft/textures/misc/vignette.png new file mode 100644 index 0000000..9c14e2d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/misc/vignette.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/misc/vignette.png.mcmeta b/lwjgl-rundir/resources/assets/minecraft/textures/misc/vignette.png.mcmeta new file mode 100644 index 0000000..5b992c3 --- /dev/null +++ b/lwjgl-rundir/resources/assets/minecraft/textures/misc/vignette.png.mcmeta @@ -0,0 +1,6 @@ +{ + "texture": { + "blur": true + } +} + diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/chainmail_layer_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/chainmail_layer_1.png new file mode 100644 index 0000000..9f84c18 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/chainmail_layer_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/chainmail_layer_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/chainmail_layer_2.png new file mode 100644 index 0000000..117811c Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/chainmail_layer_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/diamond_layer_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/diamond_layer_1.png new file mode 100644 index 0000000..14fecf2 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/diamond_layer_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/diamond_layer_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/diamond_layer_2.png new file mode 100644 index 0000000..2cca056 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/diamond_layer_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/gold_layer_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/gold_layer_1.png new file mode 100644 index 0000000..6802e06 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/gold_layer_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/gold_layer_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/gold_layer_2.png new file mode 100644 index 0000000..a7cf835 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/gold_layer_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/iron_layer_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/iron_layer_1.png new file mode 100644 index 0000000..6da6e84 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/iron_layer_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/iron_layer_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/iron_layer_2.png new file mode 100644 index 0000000..fab422a Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/iron_layer_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_1.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_1.png new file mode 100644 index 0000000..ebcfc41 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_1.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_1_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_1_overlay.png new file mode 100644 index 0000000..546397d Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_1_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_2.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_2.png new file mode 100644 index 0000000..8d8bba6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_2.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_2_overlay.png b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_2_overlay.png new file mode 100644 index 0000000..5655659 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/models/armor/leather_layer_2_overlay.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/painting/paintings_kristoffer_zetterstrand.png b/lwjgl-rundir/resources/assets/minecraft/textures/painting/paintings_kristoffer_zetterstrand.png new file mode 100644 index 0000000..d7df7f6 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/painting/paintings_kristoffer_zetterstrand.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/particle/footprint.png b/lwjgl-rundir/resources/assets/minecraft/textures/particle/footprint.png new file mode 100644 index 0000000..8d23f64 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/particle/footprint.png differ diff --git a/lwjgl-rundir/resources/assets/minecraft/textures/particle/particles.png b/lwjgl-rundir/resources/assets/minecraft/textures/particle/particles.png new file mode 100644 index 0000000..eec1f89 Binary files /dev/null and b/lwjgl-rundir/resources/assets/minecraft/textures/particle/particles.png differ diff --git a/lwjgl-rundir/resources/pack.mcmeta b/lwjgl-rundir/resources/pack.mcmeta new file mode 100644 index 0000000..1089a47 --- /dev/null +++ b/lwjgl-rundir/resources/pack.mcmeta @@ -0,0 +1,333 @@ +{ + "pack": { + "pack_format": 1, + "description": "The default look of Minecraft" + }, + "language": { + "af_ZA": { + "name": "Afrikaans", + "region": "ZA", + "bidirectional": false + }, + "ar_SA": { + "name": "\u0627\u0644\u0639\u0631\u0628\u064A\u0629", + "region": "\u0627\u0644\u0639\u0627\u0644\u0645 \u0627\u0644\u0639\u0631\u0628\u064A", + "bidirectional": true + }, + "bg_BG": { + "name": "\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438", + "region": "BG", + "bidirectional": false + }, + "ca_ES": { + "name": "Catal\u00E0", + "region": "CAT", + "bidirectional": false + }, + "cs_CZ": { + "name": "\u010Ce\u0161tina", + "region": "CZ", + "bidirectional": false + }, + "cy_GB": { + "name": "Cymraeg", + "region": "Cymru", + "bidirectional": false + }, + "da_DK": { + "name": "Dansk", + "region": "DK", + "bidirectional": false + }, + "de_DE": { + "name": "Deutsch", + "region": "Deutschland", + "bidirectional": false + }, + "el_GR": { + "name": "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC", + "region": "El", + "bidirectional": false + }, + "en_AU": { + "name": "Australian English", + "region": "Australia", + "bidirectional": false + }, + "en_CA": { + "name": "Canadian English", + "region": "CA", + "bidirectional": false + }, + "en_GB": { + "name": "English", + "region": "UK", + "bidirectional": false + }, + "en_PT": { + "name": "Pirate Speak", + "region": "PIRATE", + "bidirectional": false + }, + "en_US": { + "name": "English", + "region": "US", + "bidirectional": false + }, + "eo_UY": { + "name": "Esperanto", + "region": "Mondo", + "bidirectional": false + }, + "es_AR": { + "name": "Espa\u00F1ol", + "region": "Argentina", + "bidirectional": false + }, + "es_ES": { + "name": "Espa\u00F1ol", + "region": "Espa\u00F1a", + "bidirectional": false + }, + "es_MX": { + "name": "Espa\u00F1ol", + "region": "M\u00E9xico", + "bidirectional": false + }, + "es_UY": { + "name": "Espa\u00F1ol", + "region": "Uruguay", + "bidirectional": false + }, + "es_VE": { + "name": "Espa\u00F1ol", + "region": "Venezuela", + "bidirectional": false + }, + "et_EE": { + "name": "Eesti", + "region": "ET", + "bidirectional": false + }, + "eu_ES": { + "name": "Euskara", + "region": "EH", + "bidirectional": false + }, + "fi_FI": { + "name": "suomi", + "region": "FI", + "bidirectional": false + }, + "fr_CA": { + "name": "Fran\u00E7ais", + "region": "CA", + "bidirectional": false + }, + "fr_FR": { + "name": "Fran\u00E7ais", + "region": "France", + "bidirectional": false + }, + "ga_IE": { + "name": "Gaeilge", + "region": "\u00C9ire", + "bidirectional": false + }, + "gl_ES": { + "name": "Galego", + "region": "Galicia", + "bidirectional": false + }, + "he_IL": { + "name": "\u05D0\u05E0\u05D2\u05DC\u05D9\u05EA", + "region": "IL", + "bidirectional": true + }, + "hi_IN": { + "name": "\u0905\u0902\u0917\u094D\u0930\u0947\u095B\u0940", + "region": "\u092D\u093E\u0930\u0924", + "bidirectional": false + }, + "hr_HR": { + "name": "Hrvatski", + "region": "HR", + "bidirectional": false + }, + "hu_HU": { + "name": "Magyar", + "region": "HU", + "bidirectional": false + }, + "id_ID": { + "name": "Bahasa Indonesia", + "region": "ID", + "bidirectional": false + }, + "is_IS": { + "name": "\u00CDslenska", + "region": "IS", + "bidirectional": false + }, + "it_IT": { + "name": "Italiano", + "region": "Italia", + "bidirectional": false + }, + "ja_JP": { + "name": "\u65E5\u672C\u8A9E", + "region": "\u65E5\u672C", + "bidirectional": false + }, + "ka_GE": { + "name": "\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8", + "region": "\u10E1\u10D0\u10E5\u10D0\u10E0\u10D7\u10D5\u10D4\u10DA\u10DD", + "bidirectional": false + }, + "ko_KR": { + "name": "\uD55C\uAD6D\uC5B4", + "region": "KR", + "bidirectional": false + }, + "kw_GB": { + "name": "Kernowek", + "region": "Cornwall", + "bidirectional": false + }, + "ky_KG": { + "name": "\u0905\u0902\u0917\u094D\u0930\u0947\u095B\u0940", + "region": "\u092D\u093E\u0930\u0924", + "bidirectional": false + }, + "lt_LT": { + "name": "Lietuvi\u0173", + "region": "Lietuva", + "bidirectional": false + }, + "lv_LV": { + "name": "Latvie\u0161u", + "region": "Latvija", + "bidirectional": false + }, + "mi_NZ": { + "name": "Bahasa Melayu", + "region": "MS", + "bidirectional": false + }, + "ms_MY": { + "name": "Bahasa Melayu", + "region": "MS", + "bidirectional": false + }, + "mt_MT": { + "name": "Malti", + "region": "MT", + "bidirectional": false + }, + "nb_NO": { + "name": "Norsk", + "region": "NO", + "bidirectional": false + }, + "nl_NL": { + "name": "Nederlands", + "region": "Nederland", + "bidirectional": false + }, + "nn_NO": { + "name": "Norsk nynorsk", + "region": "Noreg", + "bidirectional": false + }, + "no_NO": { + "name": "Norsk", + "region": "NO", + "bidirectional": false + }, + "pl_PL": { + "name": "Polski", + "region": "Polska", + "bidirectional": false + }, + "pt_BR": { + "name": "Portugu\u00EAs", + "region": "BR", + "bidirectional": false + }, + "pt_PT": { + "name": "Portugu\u00EAs", + "region": "Portugal", + "bidirectional": false + }, + "qya_AA": { + "name": "Quenya", + "region": "Arda", + "bidirectional": false + }, + "ro_RO": { + "name": "Rom\u00E2n\u0103", + "region": "RO", + "bidirectional": false + }, + "ru_RU": { + "name": "\u0420\u0443\u0441\u0441\u043A\u0438\u0439", + "region": "\u0420\u043E\u0441\u0441\u0438\u044F", + "bidirectional": false + }, + "sk_SK": { + "name": "Sloven\u010Dina", + "region": "SK", + "bidirectional": false + }, + "sl_SI": { + "name": "Sloven\u0161\u010Dina", + "region": "SLO", + "bidirectional": false + }, + "sr_SP": { + "name": "\u0421\u0440\u043F\u0441\u043A\u0438", + "region": "\u0421\u0440\u0431\u0438\u0458\u0430", + "bidirectional": false + }, + "sv_SE": { + "name": "Svenska", + "region": "Sverige", + "bidirectional": false + }, + "th_TH": { + "name": "\u0E20\u0E32\u0E29\u0E32\u0E44\u0E17\u0E22", + "region": "TH", + "bidirectional": false + }, + "tlh_AA": { + "name": "tlhIngan Hol", + "region": "US", + "bidirectional": false + }, + "tr_TR": { + "name": "T\u00FCrk\u00E7e", + "region": "TR", + "bidirectional": false + }, + "uk_UA": { + "name": "\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430", + "region": "\u0423\u043A\u0440\u0430\u0457\u043D\u0430", + "bidirectional": false + }, + "vi_VN": { + "name": "Ti\u1EBFng Vi\u1EC7t", + "region": "VN", + "bidirectional": false + }, + "zh_CN": { + "name": "\u7B80\u4F53\u4E2D\u6587", + "region": "\u4E2D\u56FD", + "bidirectional": false + }, + "zh_TW": { + "name": "\u7E41\u9AD4\u4E2D\u6587", + "region": "\u53F0\u7063", + "bidirectional": false + } + } +} diff --git a/lwjgl-rundir/resources/pack.png b/lwjgl-rundir/resources/pack.png new file mode 100644 index 0000000..cfaa986 Binary files /dev/null and b/lwjgl-rundir/resources/pack.png differ diff --git a/lwjgl-rundir/soundsystem-20120107.jar b/lwjgl-rundir/soundsystem-20120107.jar new file mode 100644 index 0000000..52b6468 Binary files /dev/null and b/lwjgl-rundir/soundsystem-20120107.jar differ diff --git a/output-client.log b/output-client.log new file mode 100644 index 0000000..0d9205f --- /dev/null +++ b/output-client.log @@ -0,0 +1,9 @@ +2025-01-28 12:32:59 [CLIENT] [INFO] Setting user: Player5 +2025-01-28 12:32:59 [CLIENT] [INFO] (Session ID is null) +2025-01-28 12:35:08 [CLIENT] [INFO] Setting user: Player719 +2025-01-28 12:35:08 [CLIENT] [INFO] (Session ID is null) +2025-01-28 12:37:52 [CLIENT] [INFO] Setting user: DefaultClientTest +2025-01-28 12:37:52 [CLIENT] [INFO] (Session ID is null) +2025-01-28 12:40:11 [CLIENT] [INFO] Setting user: DefaultClientTest +2025-01-28 12:40:11 [CLIENT] [INFO] (Session ID is null) +2025-01-28 12:40:11 [CLIENT] [INFO] LWJGL Version: 2.9.0 diff --git a/src/main/java/Start.java b/src/main/java/Start.java new file mode 100644 index 0000000..cad8631 --- /dev/null +++ b/src/main/java/Start.java @@ -0,0 +1,20 @@ +import java.io.File; +import java.lang.reflect.Field; +import java.util.Arrays; + +import net.minecraft.client.main.Main; + +public class Start +{ + public static void main(String[] args) + { + Main.main(concat(new String[] {"--version", "1.6.4"}, args)); + } + + public static T[] concat(T[] first, T[] second) + { + T[] result = Arrays.copyOf(first, first.length + second.length); + System.arraycopy(second, 0, result, first.length, second.length); + return result; + } +} diff --git a/src/main/java/net/minecraft/client/ClientBrandRetriever.java b/src/main/java/net/minecraft/client/ClientBrandRetriever.java new file mode 100644 index 0000000..ea49cae --- /dev/null +++ b/src/main/java/net/minecraft/client/ClientBrandRetriever.java @@ -0,0 +1,9 @@ +package net.minecraft.client; + +public class ClientBrandRetriever +{ + public static String getClientModName() + { + return "vanilla"; + } +} diff --git a/src/main/java/net/minecraft/client/main/Main.java b/src/main/java/net/minecraft/client/main/Main.java new file mode 100644 index 0000000..30a30b3 --- /dev/null +++ b/src/main/java/net/minecraft/client/main/Main.java @@ -0,0 +1,99 @@ +package net.minecraft.client.main; + +import java.io.File; +import java.net.Authenticator; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.Proxy.Type; +import java.util.List; +import joptsimple.ArgumentAcceptingOptionSpec; +import joptsimple.NonOptionArgumentSpec; +import joptsimple.OptionParser; +import joptsimple.OptionSet; +import net.minecraft.src.MainProxyAuthenticator; +import net.minecraft.src.MainShutdownHook; +import net.minecraft.src.Minecraft; +import net.minecraft.src.Session; + +public class Main +{ + public static void main(String[] par0ArrayOfStr) + { + System.setProperty("java.net.preferIPv4Stack", "true"); + OptionParser var1 = new OptionParser(); + var1.allowsUnrecognizedOptions(); + var1.accepts("demo"); + var1.accepts("fullscreen"); + ArgumentAcceptingOptionSpec var2 = var1.accepts("server").withRequiredArg(); + ArgumentAcceptingOptionSpec var3 = var1.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(25565), new Integer[0]); + ArgumentAcceptingOptionSpec var4 = var1.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File("."), new File[0]); + ArgumentAcceptingOptionSpec var5 = var1.accepts("assetsDir").withRequiredArg().ofType(File.class).defaultsTo(new File("lwjgl-rundir/resources/assets"), new File[0]); + ArgumentAcceptingOptionSpec var6 = var1.accepts("resourcePackDir").withRequiredArg().ofType(File.class); + ArgumentAcceptingOptionSpec var7 = var1.accepts("proxyHost").withRequiredArg(); + ArgumentAcceptingOptionSpec var8 = var1.accepts("proxyPort").withRequiredArg().defaultsTo("8080", new String[0]).ofType(Integer.class); + ArgumentAcceptingOptionSpec var9 = var1.accepts("proxyUser").withRequiredArg(); + ArgumentAcceptingOptionSpec var10 = var1.accepts("proxyPass").withRequiredArg(); + ArgumentAcceptingOptionSpec var11 = var1.accepts("username").withRequiredArg().defaultsTo("DefaultClientTest"); + ArgumentAcceptingOptionSpec var12 = var1.accepts("session").withRequiredArg(); + ArgumentAcceptingOptionSpec var13 = var1.accepts("version").withRequiredArg().defaultsTo("1.6.4"); + ArgumentAcceptingOptionSpec var14 = var1.accepts("width").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(854), new Integer[0]); + ArgumentAcceptingOptionSpec var15 = var1.accepts("height").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(480), new Integer[0]); + NonOptionArgumentSpec var16 = var1.nonOptions(); + OptionSet var17 = var1.parse(par0ArrayOfStr); + List var18 = var17.valuesOf(var16); + String var19 = (String)var17.valueOf(var7); + Proxy var20 = Proxy.NO_PROXY; + + if (var19 != null) + { + try + { + var20 = new Proxy(Type.SOCKS, new InetSocketAddress(var19, ((Integer)var17.valueOf(var8)).intValue())); + } + catch (Exception var34) + { + ; + } + } + + String var21 = (String)var17.valueOf(var9); + String var22 = (String)var17.valueOf(var10); + + if (!var20.equals(Proxy.NO_PROXY) && func_110121_a(var21) && func_110121_a(var22)) + { + Authenticator.setDefault(new MainProxyAuthenticator(var21, var22)); + } + + int var23 = ((Integer)var17.valueOf(var14)).intValue(); + int var24 = ((Integer)var17.valueOf(var15)).intValue(); + boolean var25 = var17.has("fullscreen"); + boolean var26 = var17.has("demo"); + String var27 = (String)var17.valueOf(var13); + File var28 = (File)var17.valueOf(var4); + File var29 = var17.has(var5) ? (File)var17.valueOf(var5) : new File(var28, "assets/"); + File var30 = var17.has(var6) ? (File)var17.valueOf(var6) : new File(var28, "resourcepacks/"); + Session var31 = new Session((String)var11.value(var17), (String)var12.value(var17)); + Minecraft var32 = new Minecraft(var31, var23, var24, var25, var26, var28, var29, var30, var20, var27); + String var33 = (String)var17.valueOf(var2); + + if (var33 != null) + { + var32.setServer(var33, ((Integer)var17.valueOf(var3)).intValue()); + } + + Runtime.getRuntime().addShutdownHook(new MainShutdownHook()); + + if (!var18.isEmpty()) + { + System.out.println("Completely ignored arguments: " + var18); + } + + Thread.currentThread().setName("Minecraft main thread"); + var32.run(); + } + + private static boolean func_110121_a(String par0Str) + { + return par0Str != null && !par0Str.isEmpty(); + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java new file mode 100644 index 0000000..db6a166 --- /dev/null +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +1,1367 @@ +package net.minecraft.server; + +import java.awt.GraphicsEnvironment; +import java.io.File; +import java.io.IOException; +import java.net.Proxy; +import java.security.KeyPair; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import net.minecraft.src.AnvilSaveConverter; +import net.minecraft.src.AxisAlignedBB; +import net.minecraft.src.CallableIsServerModded; +import net.minecraft.src.CallableServerMemoryStats; +import net.minecraft.src.CallableServerProfiler; +import net.minecraft.src.ChatMessageComponent; +import net.minecraft.src.ChunkCoordinates; +import net.minecraft.src.CommandBase; +import net.minecraft.src.ConvertingProgressUpdate; +import net.minecraft.src.CrashReport; +import net.minecraft.src.DemoWorldServer; +import net.minecraft.src.DispenserBehaviors; +import net.minecraft.src.EntityPlayer; +import net.minecraft.src.EnumGameType; +import net.minecraft.src.ICommandManager; +import net.minecraft.src.ICommandSender; +import net.minecraft.src.ILogAgent; +import net.minecraft.src.IPlayerUsage; +import net.minecraft.src.IProgressUpdate; +import net.minecraft.src.ISaveFormat; +import net.minecraft.src.ISaveHandler; +import net.minecraft.src.IUpdatePlayerListBox; +import net.minecraft.src.MathHelper; +import net.minecraft.src.MinecraftException; +import net.minecraft.src.NetworkListenThread; +import net.minecraft.src.Packet; +import net.minecraft.src.Packet4UpdateTime; +import net.minecraft.src.PlayerUsageSnooper; +import net.minecraft.src.Profiler; +import net.minecraft.src.RConConsoleSource; +import net.minecraft.src.ReportedException; +import net.minecraft.src.ServerCommandManager; +import net.minecraft.src.ServerConfigurationManager; +import net.minecraft.src.ThreadMinecraftServer; +import net.minecraft.src.World; +import net.minecraft.src.WorldInfo; +import net.minecraft.src.WorldManager; +import net.minecraft.src.WorldServer; +import net.minecraft.src.WorldServerMulti; +import net.minecraft.src.WorldSettings; +import net.minecraft.src.WorldType; + +public abstract class MinecraftServer implements ICommandSender, Runnable, IPlayerUsage +{ + /** Instance of Minecraft Server. */ + private static MinecraftServer mcServer; + private final ISaveFormat anvilConverterForAnvilFile; + + /** The PlayerUsageSnooper instance. */ + private final PlayerUsageSnooper usageSnooper = new PlayerUsageSnooper("server", this, getSystemTimeMillis()); + private final File anvilFile; + + /** + * Collection of objects to update every tick. Type: List + */ + private final List tickables = new ArrayList(); + private final ICommandManager commandManager; + public final Profiler theProfiler = new Profiler(); + + /** The server's hostname. */ + private String hostname; + + /** The server's port. */ + private int serverPort = -1; + + /** The server world instances. */ + public WorldServer[] worldServers; + + /** The ServerConfigurationManager instance. */ + private ServerConfigurationManager serverConfigManager; + + /** + * Indicates whether the server is running or not. Set to false to initiate a shutdown. + */ + private boolean serverRunning = true; + + /** Indicates to other classes that the server is safely stopped. */ + private boolean serverStopped; + + /** Incremented every tick. */ + private int tickCounter; + protected Proxy serverProxy; + + /** + * The task the server is currently working on(and will output on outputPercentRemaining). + */ + public String currentTask; + + /** The percentage of the current task finished so far. */ + public int percentDone; + + /** True if the server is in online mode. */ + private boolean onlineMode; + + /** True if the server has animals turned on. */ + private boolean canSpawnAnimals; + private boolean canSpawnNPCs; + + /** Indicates whether PvP is active on the server or not. */ + private boolean pvpEnabled; + + /** Determines if flight is allowed or not. */ + private boolean allowFlight; + + /** The server MOTD string. */ + private String motd; + + /** Maximum build height. */ + private int buildLimit; + private int field_143008_E; + private long lastSentPacketID; + private long lastSentPacketSize; + private long lastReceivedID; + private long lastReceivedSize; + public final long[] sentPacketCountArray; + public final long[] sentPacketSizeArray; + public final long[] receivedPacketCountArray; + public final long[] receivedPacketSizeArray; + public final long[] tickTimeArray; + + /** Stats are [dimension][tick%100] system.nanoTime is stored. */ + public long[][] timeOfLastDimensionTick; + private KeyPair serverKeyPair; + + /** Username of the server owner (for integrated servers) */ + private String serverOwner; + private String folderName; + private String worldName; + private boolean isDemo; + private boolean enableBonusChest; + + /** + * If true, there is no need to save chunks or stop the server, because that is already being done. + */ + private boolean worldIsBeingDeleted; + private String texturePack; + private boolean serverIsRunning; + + /** + * Set when warned for "Can't keep up", which triggers again after 15 seconds. + */ + private long timeOfLastWarning; + private String userMessage; + private boolean startProfiling; + private boolean isGamemodeForced; + + public MinecraftServer(File par1File) + { + this.serverProxy = Proxy.NO_PROXY; + this.field_143008_E = 0; + this.sentPacketCountArray = new long[100]; + this.sentPacketSizeArray = new long[100]; + this.receivedPacketCountArray = new long[100]; + this.receivedPacketSizeArray = new long[100]; + this.tickTimeArray = new long[100]; + this.texturePack = ""; + mcServer = this; + this.anvilFile = par1File; + this.commandManager = new ServerCommandManager(); + this.anvilConverterForAnvilFile = new AnvilSaveConverter(par1File); + this.registerDispenseBehaviors(); + } + + /** + * Register all dispense behaviors. + */ + private void registerDispenseBehaviors() + { + DispenserBehaviors.registerDispenserBehaviours(); + } + + /** + * Initialises the server and starts it. + */ + protected abstract boolean startServer() throws IOException; + + protected void convertMapIfNeeded(String par1Str) + { + if (this.getActiveAnvilConverter().isOldMapFormat(par1Str)) + { + this.getLogAgent().logInfo("Converting map!"); + this.setUserMessage("menu.convertingLevel"); + this.getActiveAnvilConverter().convertMapFormat(par1Str, new ConvertingProgressUpdate(this)); + } + } + + /** + * Typically "menu.convertingLevel", "menu.loadingLevel" or others. + */ + protected synchronized void setUserMessage(String par1Str) + { + this.userMessage = par1Str; + } + + public synchronized String getUserMessage() + { + return this.userMessage; + } + + protected void loadAllWorlds(String par1Str, String par2Str, long par3, WorldType par5WorldType, String par6Str) + { + this.convertMapIfNeeded(par1Str); + this.setUserMessage("menu.loadingLevel"); + this.worldServers = new WorldServer[3]; + this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; + ISaveHandler var7 = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true); + WorldInfo var9 = var7.loadWorldInfo(); + WorldSettings var8; + + if (var9 == null) + { + var8 = new WorldSettings(par3, this.getGameType(), this.canStructuresSpawn(), this.isHardcore(), par5WorldType); + var8.func_82750_a(par6Str); + } + else + { + var8 = new WorldSettings(var9); + } + + if (this.enableBonusChest) + { + var8.enableBonusChest(); + } + + for (int var10 = 0; var10 < this.worldServers.length; ++var10) + { + byte var11 = 0; + + if (var10 == 1) + { + var11 = -1; + } + + if (var10 == 2) + { + var11 = 1; + } + + if (var10 == 0) + { + if (this.isDemo()) + { + this.worldServers[var10] = new DemoWorldServer(this, var7, par2Str, var11, this.theProfiler, this.getLogAgent()); + } + else + { + this.worldServers[var10] = new WorldServer(this, var7, par2Str, var11, var8, this.theProfiler, this.getLogAgent()); + } + } + else + { + this.worldServers[var10] = new WorldServerMulti(this, var7, par2Str, var11, var8, this.worldServers[0], this.theProfiler, this.getLogAgent()); + } + + this.worldServers[var10].addWorldAccess(new WorldManager(this, this.worldServers[var10])); + + if (!this.isSinglePlayer()) + { + this.worldServers[var10].getWorldInfo().setGameType(this.getGameType()); + } + + this.serverConfigManager.setPlayerManager(this.worldServers); + } + + this.setDifficultyForAllWorlds(this.getDifficulty()); + this.initialWorldChunkLoad(); + } + + protected void initialWorldChunkLoad() + { + boolean var1 = true; + boolean var2 = true; + boolean var3 = true; + boolean var4 = true; + int var5 = 0; + this.setUserMessage("menu.generatingTerrain"); + byte var6 = 0; + this.getLogAgent().logInfo("Preparing start region for level " + var6); + WorldServer var7 = this.worldServers[var6]; + ChunkCoordinates var8 = var7.getSpawnPoint(); + long var9 = getSystemTimeMillis(); + + for (int var11 = -192; var11 <= 192 && this.isServerRunning(); var11 += 16) + { + for (int var12 = -192; var12 <= 192 && this.isServerRunning(); var12 += 16) + { + long var13 = getSystemTimeMillis(); + + if (var13 - var9 > 1000L) + { + this.outputPercentRemaining("Preparing spawn area", var5 * 100 / 625); + var9 = var13; + } + + ++var5; + var7.theChunkProviderServer.loadChunk(var8.posX + var11 >> 4, var8.posZ + var12 >> 4); + } + } + + this.clearCurrentTask(); + } + + public abstract boolean canStructuresSpawn(); + + public abstract EnumGameType getGameType(); + + /** + * Defaults to "1" (Easy) for the dedicated server, defaults to "2" (Normal) on the client. + */ + public abstract int getDifficulty(); + + /** + * Defaults to false. + */ + public abstract boolean isHardcore(); + + public abstract int func_110455_j(); + + /** + * Used to display a percent remaining given text and the percentage. + */ + protected void outputPercentRemaining(String par1Str, int par2) + { + this.currentTask = par1Str; + this.percentDone = par2; + this.getLogAgent().logInfo(par1Str + ": " + par2 + "%"); + } + + /** + * Set current task to null and set its percentage to 0. + */ + protected void clearCurrentTask() + { + this.currentTask = null; + this.percentDone = 0; + } + + /** + * par1 indicates if a log message should be output. + */ + protected void saveAllWorlds(boolean par1) + { + if (!this.worldIsBeingDeleted) + { + WorldServer[] var2 = this.worldServers; + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + WorldServer var5 = var2[var4]; + + if (var5 != null) + { + if (!par1) + { + this.getLogAgent().logInfo("Saving chunks for level \'" + var5.getWorldInfo().getWorldName() + "\'/" + var5.provider.getDimensionName()); + } + + try + { + var5.saveAllChunks(true, (IProgressUpdate)null); + } + catch (MinecraftException var7) + { + this.getLogAgent().logWarning(var7.getMessage()); + } + } + } + } + } + + /** + * Saves all necessary data as preparation for stopping the server. + */ + public void stopServer() + { + if (!this.worldIsBeingDeleted) + { + this.getLogAgent().logInfo("Stopping server"); + + if (this.getNetworkThread() != null) + { + this.getNetworkThread().stopListening(); + } + + if (this.serverConfigManager != null) + { + this.getLogAgent().logInfo("Saving players"); + this.serverConfigManager.saveAllPlayerData(); + this.serverConfigManager.removeAllPlayers(); + } + + this.getLogAgent().logInfo("Saving worlds"); + this.saveAllWorlds(false); + + for (int var1 = 0; var1 < this.worldServers.length; ++var1) + { + WorldServer var2 = this.worldServers[var1]; + var2.flush(); + } + + if (this.usageSnooper != null && this.usageSnooper.isSnooperRunning()) + { + this.usageSnooper.stopSnooper(); + } + } + } + + /** + * "getHostname" is already taken, but both return the hostname. + */ + public String getServerHostname() + { + return this.hostname; + } + + public void setHostname(String par1Str) + { + this.hostname = par1Str; + } + + public boolean isServerRunning() + { + return this.serverRunning; + } + + /** + * Sets the serverRunning variable to false, in order to get the server to shut down. + */ + public void initiateShutdown() + { + this.serverRunning = false; + } + + public void run() + { + try + { + if (this.startServer()) + { + long var1 = getSystemTimeMillis(); + + for (long var50 = 0L; this.serverRunning; this.serverIsRunning = true) + { + long var5 = getSystemTimeMillis(); + long var7 = var5 - var1; + + if (var7 > 2000L && var1 - this.timeOfLastWarning >= 15000L) + { + this.getLogAgent().logWarning("Can\'t keep up! Did the system time change, or is the server overloaded?"); + var7 = 2000L; + this.timeOfLastWarning = var1; + } + + if (var7 < 0L) + { + this.getLogAgent().logWarning("Time ran backwards! Did the system time change?"); + var7 = 0L; + } + + var50 += var7; + var1 = var5; + + if (this.worldServers[0].areAllPlayersAsleep()) + { + this.tick(); + var50 = 0L; + } + else + { + while (var50 > 50L) + { + var50 -= 50L; + this.tick(); + } + } + + Thread.sleep(1L); + } + } + else + { + this.finalTick((CrashReport)null); + } + } + catch (Throwable var48) + { + var48.printStackTrace(); + this.getLogAgent().logSevereException("Encountered an unexpected exception " + var48.getClass().getSimpleName(), var48); + CrashReport var2 = null; + + if (var48 instanceof ReportedException) + { + var2 = this.addServerInfoToCrashReport(((ReportedException)var48).getCrashReport()); + } + else + { + var2 = this.addServerInfoToCrashReport(new CrashReport("Exception in server tick loop", var48)); + } + + File var3 = new File(new File(this.getDataDirectory(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt"); + + if (var2.saveToFile(var3, this.getLogAgent())) + { + this.getLogAgent().logSevere("This crash report has been saved to: " + var3.getAbsolutePath()); + } + else + { + this.getLogAgent().logSevere("We were unable to save this crash report to disk."); + } + + this.finalTick(var2); + } + finally + { + try + { + this.stopServer(); + this.serverStopped = true; + } + catch (Throwable var46) + { + var46.printStackTrace(); + } + finally + { + this.systemExitNow(); + } + } + } + + protected File getDataDirectory() + { + return new File("."); + } + + /** + * Called on exit from the main run() loop. + */ + protected void finalTick(CrashReport par1CrashReport) {} + + /** + * Directly calls System.exit(0), instantly killing the program. + */ + protected void systemExitNow() {} + + /** + * Main function called by run() every loop. + */ + public void tick() + { + long var1 = System.nanoTime(); + AxisAlignedBB.getAABBPool().cleanPool(); + ++this.tickCounter; + + if (this.startProfiling) + { + this.startProfiling = false; + this.theProfiler.profilingEnabled = true; + this.theProfiler.clearProfiling(); + } + + this.theProfiler.startSection("root"); + this.updateTimeLightAndEntities(); + + if (this.tickCounter % 900 == 0) + { + this.theProfiler.startSection("save"); + this.serverConfigManager.saveAllPlayerData(); + this.saveAllWorlds(true); + this.theProfiler.endSection(); + } + + this.theProfiler.startSection("tallying"); + this.tickTimeArray[this.tickCounter % 100] = System.nanoTime() - var1; + this.sentPacketCountArray[this.tickCounter % 100] = Packet.sentID - this.lastSentPacketID; + this.lastSentPacketID = Packet.sentID; + this.sentPacketSizeArray[this.tickCounter % 100] = Packet.sentSize - this.lastSentPacketSize; + this.lastSentPacketSize = Packet.sentSize; + this.receivedPacketCountArray[this.tickCounter % 100] = Packet.receivedID - this.lastReceivedID; + this.lastReceivedID = Packet.receivedID; + this.receivedPacketSizeArray[this.tickCounter % 100] = Packet.receivedSize - this.lastReceivedSize; + this.lastReceivedSize = Packet.receivedSize; + this.theProfiler.endSection(); + this.theProfiler.startSection("snooper"); + + if (!this.usageSnooper.isSnooperRunning() && this.tickCounter > 100) + { + this.usageSnooper.startSnooper(); + } + + if (this.tickCounter % 6000 == 0) + { + this.usageSnooper.addMemoryStatsToSnooper(); + } + + this.theProfiler.endSection(); + this.theProfiler.endSection(); + } + + public void updateTimeLightAndEntities() + { + this.theProfiler.startSection("levels"); + int var1; + + for (var1 = 0; var1 < this.worldServers.length; ++var1) + { + long var2 = System.nanoTime(); + + if (var1 == 0 || this.getAllowNether()) + { + WorldServer var4 = this.worldServers[var1]; + this.theProfiler.startSection(var4.getWorldInfo().getWorldName()); + this.theProfiler.startSection("pools"); + var4.getWorldVec3Pool().clear(); + this.theProfiler.endSection(); + + if (this.tickCounter % 20 == 0) + { + this.theProfiler.startSection("timeSync"); + this.serverConfigManager.sendPacketToAllPlayersInDimension(new Packet4UpdateTime(var4.getTotalWorldTime(), var4.getWorldTime(), var4.getGameRules().getGameRuleBooleanValue("doDaylightCycle")), var4.provider.dimensionId); + this.theProfiler.endSection(); + } + + this.theProfiler.startSection("tick"); + CrashReport var6; + + try + { + var4.tick(); + } + catch (Throwable var8) + { + var6 = CrashReport.makeCrashReport(var8, "Exception ticking world"); + var4.addWorldInfoToCrashReport(var6); + throw new ReportedException(var6); + } + + try + { + var4.updateEntities(); + } + catch (Throwable var7) + { + var6 = CrashReport.makeCrashReport(var7, "Exception ticking world entities"); + var4.addWorldInfoToCrashReport(var6); + throw new ReportedException(var6); + } + + this.theProfiler.endSection(); + this.theProfiler.startSection("tracker"); + var4.getEntityTracker().updateTrackedEntities(); + this.theProfiler.endSection(); + this.theProfiler.endSection(); + } + + this.timeOfLastDimensionTick[var1][this.tickCounter % 100] = System.nanoTime() - var2; + } + + this.theProfiler.endStartSection("connection"); + this.getNetworkThread().networkTick(); + this.theProfiler.endStartSection("players"); + this.serverConfigManager.sendPlayerInfoToAllPlayers(); + this.theProfiler.endStartSection("tickables"); + + for (var1 = 0; var1 < this.tickables.size(); ++var1) + { + ((IUpdatePlayerListBox)this.tickables.get(var1)).update(); + } + + this.theProfiler.endSection(); + } + + public boolean getAllowNether() + { + return true; + } + + public void startServerThread() + { + (new ThreadMinecraftServer(this, "Server thread")).start(); + } + + /** + * Returns a File object from the specified string. + */ + public File getFile(String par1Str) + { + return new File(this.getDataDirectory(), par1Str); + } + + /** + * Logs the message with a level of INFO. + */ + public void logInfo(String par1Str) + { + this.getLogAgent().logInfo(par1Str); + } + + /** + * Logs the message with a level of WARN. + */ + public void logWarning(String par1Str) + { + this.getLogAgent().logWarning(par1Str); + } + + /** + * Gets the worldServer by the given dimension. + */ + public WorldServer worldServerForDimension(int par1) + { + return par1 == -1 ? this.worldServers[1] : (par1 == 1 ? this.worldServers[2] : this.worldServers[0]); + } + + /** + * Returns the server's hostname. + */ + public String getHostname() + { + return this.hostname; + } + + /** + * Never used, but "getServerPort" is already taken. + */ + public int getPort() + { + return this.serverPort; + } + + /** + * Returns the server message of the day + */ + public String getServerMOTD() + { + return this.motd; + } + + /** + * Returns the server's Minecraft version as string. + */ + public String getMinecraftVersion() + { + return "1.6.4"; + } + + /** + * Returns the number of players currently on the server. + */ + public int getCurrentPlayerCount() + { + return this.serverConfigManager.getCurrentPlayerCount(); + } + + /** + * Returns the maximum number of players allowed on the server. + */ + public int getMaxPlayers() + { + return this.serverConfigManager.getMaxPlayers(); + } + + /** + * Returns an array of the usernames of all the connected players. + */ + public String[] getAllUsernames() + { + return this.serverConfigManager.getAllUsernames(); + } + + /** + * Used by RCon's Query in the form of "MajorServerMod 1.2.3: MyPlugin 1.3; AnotherPlugin 2.1; AndSoForth 1.0". + */ + public String getPlugins() + { + return ""; + } + + public String executeCommand(String par1Str) + { + RConConsoleSource.consoleBuffer.resetLog(); + this.commandManager.executeCommand(RConConsoleSource.consoleBuffer, par1Str); + return RConConsoleSource.consoleBuffer.getChatBuffer(); + } + + /** + * Returns true if debugging is enabled, false otherwise. + */ + public boolean isDebuggingEnabled() + { + return false; + } + + /** + * Logs the error message with a level of SEVERE. + */ + public void logSevere(String par1Str) + { + this.getLogAgent().logSevere(par1Str); + } + + /** + * If isDebuggingEnabled(), logs the message with a level of INFO. + */ + public void logDebug(String par1Str) + { + if (this.isDebuggingEnabled()) + { + this.getLogAgent().logInfo(par1Str); + } + } + + public String getServerModName() + { + return "vanilla"; + } + + /** + * Adds the server info, including from theWorldServer, to the crash report. + */ + public CrashReport addServerInfoToCrashReport(CrashReport par1CrashReport) + { + par1CrashReport.getCategory().addCrashSectionCallable("Profiler Position", new CallableIsServerModded(this)); + + if (this.worldServers != null && this.worldServers.length > 0 && this.worldServers[0] != null) + { + par1CrashReport.getCategory().addCrashSectionCallable("Vec3 Pool Size", new CallableServerProfiler(this)); + } + + if (this.serverConfigManager != null) + { + par1CrashReport.getCategory().addCrashSectionCallable("Player Count", new CallableServerMemoryStats(this)); + } + + return par1CrashReport; + } + + /** + * If par2Str begins with /, then it searches for commands, otherwise it returns players. + */ + public List getPossibleCompletions(ICommandSender par1ICommandSender, String par2Str) + { + ArrayList var3 = new ArrayList(); + + if (par2Str.startsWith("/")) + { + par2Str = par2Str.substring(1); + boolean var10 = !par2Str.contains(" "); + List var11 = this.commandManager.getPossibleCommands(par1ICommandSender, par2Str); + + if (var11 != null) + { + Iterator var12 = var11.iterator(); + + while (var12.hasNext()) + { + String var13 = (String)var12.next(); + + if (var10) + { + var3.add("/" + var13); + } + else + { + var3.add(var13); + } + } + } + + return var3; + } + else + { + String[] var4 = par2Str.split(" ", -1); + String var5 = var4[var4.length - 1]; + String[] var6 = this.serverConfigManager.getAllUsernames(); + int var7 = var6.length; + + for (int var8 = 0; var8 < var7; ++var8) + { + String var9 = var6[var8]; + + if (CommandBase.doesStringStartWith(var5, var9)) + { + var3.add(var9); + } + } + + return var3; + } + } + + /** + * Gets mcServer. + */ + public static MinecraftServer getServer() + { + return mcServer; + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getCommandSenderName() + { + return "Server"; + } + + public void sendChatToPlayer(ChatMessageComponent par1ChatMessageComponent) + { + this.getLogAgent().logInfo(par1ChatMessageComponent.toString()); + } + + /** + * Returns true if the command sender is allowed to use the given command. + */ + public boolean canCommandSenderUseCommand(int par1, String par2Str) + { + return true; + } + + public ICommandManager getCommandManager() + { + return this.commandManager; + } + + /** + * Gets KeyPair instanced in MinecraftServer. + */ + public KeyPair getKeyPair() + { + return this.serverKeyPair; + } + + /** + * Gets serverPort. + */ + public int getServerPort() + { + return this.serverPort; + } + + public void setServerPort(int par1) + { + this.serverPort = par1; + } + + /** + * Returns the username of the server owner (for integrated servers) + */ + public String getServerOwner() + { + return this.serverOwner; + } + + /** + * Sets the username of the owner of this server (in the case of an integrated server) + */ + public void setServerOwner(String par1Str) + { + this.serverOwner = par1Str; + } + + public boolean isSinglePlayer() + { + return this.serverOwner != null; + } + + public String getFolderName() + { + return this.folderName; + } + + public void setFolderName(String par1Str) + { + this.folderName = par1Str; + } + + public void setWorldName(String par1Str) + { + this.worldName = par1Str; + } + + public String getWorldName() + { + return this.worldName; + } + + public void setKeyPair(KeyPair par1KeyPair) + { + this.serverKeyPair = par1KeyPair; + } + + public void setDifficultyForAllWorlds(int par1) + { + for (int var2 = 0; var2 < this.worldServers.length; ++var2) + { + WorldServer var3 = this.worldServers[var2]; + + if (var3 != null) + { + if (var3.getWorldInfo().isHardcoreModeEnabled()) + { + var3.difficultySetting = 3; + var3.setAllowedSpawnTypes(true, true); + } + else if (this.isSinglePlayer()) + { + var3.difficultySetting = par1; + var3.setAllowedSpawnTypes(var3.difficultySetting > 0, true); + } + else + { + var3.difficultySetting = par1; + var3.setAllowedSpawnTypes(this.allowSpawnMonsters(), this.canSpawnAnimals); + } + } + } + } + + protected boolean allowSpawnMonsters() + { + return true; + } + + /** + * Gets whether this is a demo or not. + */ + public boolean isDemo() + { + return this.isDemo; + } + + /** + * Sets whether this is a demo or not. + */ + public void setDemo(boolean par1) + { + this.isDemo = par1; + } + + public void canCreateBonusChest(boolean par1) + { + this.enableBonusChest = par1; + } + + public ISaveFormat getActiveAnvilConverter() + { + return this.anvilConverterForAnvilFile; + } + + /** + * WARNING : directly calls + * getActiveAnvilConverter().deleteWorldDirectory(theWorldServer[0].getSaveHandler().getWorldDirectoryName()); + */ + public void deleteWorldAndStopServer() + { + this.worldIsBeingDeleted = true; + this.getActiveAnvilConverter().flushCache(); + + for (int var1 = 0; var1 < this.worldServers.length; ++var1) + { + WorldServer var2 = this.worldServers[var1]; + + if (var2 != null) + { + var2.flush(); + } + } + + this.getActiveAnvilConverter().deleteWorldDirectory(this.worldServers[0].getSaveHandler().getWorldDirectoryName()); + this.initiateShutdown(); + } + + public String getTexturePack() + { + return this.texturePack; + } + + public void setTexturePack(String par1Str) + { + this.texturePack = par1Str; + } + + public void addServerStatsToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper) + { + par1PlayerUsageSnooper.addData("whitelist_enabled", Boolean.valueOf(false)); + par1PlayerUsageSnooper.addData("whitelist_count", Integer.valueOf(0)); + par1PlayerUsageSnooper.addData("players_current", Integer.valueOf(this.getCurrentPlayerCount())); + par1PlayerUsageSnooper.addData("players_max", Integer.valueOf(this.getMaxPlayers())); + par1PlayerUsageSnooper.addData("players_seen", Integer.valueOf(this.serverConfigManager.getAvailablePlayerDat().length)); + par1PlayerUsageSnooper.addData("uses_auth", Boolean.valueOf(this.onlineMode)); + par1PlayerUsageSnooper.addData("gui_state", this.getGuiEnabled() ? "enabled" : "disabled"); + par1PlayerUsageSnooper.addData("run_time", Long.valueOf((getSystemTimeMillis() - par1PlayerUsageSnooper.func_130105_g()) / 60L * 1000L)); + par1PlayerUsageSnooper.addData("avg_tick_ms", Integer.valueOf((int)(MathHelper.average(this.tickTimeArray) * 1.0E-6D))); + par1PlayerUsageSnooper.addData("avg_sent_packet_count", Integer.valueOf((int)MathHelper.average(this.sentPacketCountArray))); + par1PlayerUsageSnooper.addData("avg_sent_packet_size", Integer.valueOf((int)MathHelper.average(this.sentPacketSizeArray))); + par1PlayerUsageSnooper.addData("avg_rec_packet_count", Integer.valueOf((int)MathHelper.average(this.receivedPacketCountArray))); + par1PlayerUsageSnooper.addData("avg_rec_packet_size", Integer.valueOf((int)MathHelper.average(this.receivedPacketSizeArray))); + int var2 = 0; + + for (int var3 = 0; var3 < this.worldServers.length; ++var3) + { + if (this.worldServers[var3] != null) + { + WorldServer var4 = this.worldServers[var3]; + WorldInfo var5 = var4.getWorldInfo(); + par1PlayerUsageSnooper.addData("world[" + var2 + "][dimension]", Integer.valueOf(var4.provider.dimensionId)); + par1PlayerUsageSnooper.addData("world[" + var2 + "][mode]", var5.getGameType()); + par1PlayerUsageSnooper.addData("world[" + var2 + "][difficulty]", Integer.valueOf(var4.difficultySetting)); + par1PlayerUsageSnooper.addData("world[" + var2 + "][hardcore]", Boolean.valueOf(var5.isHardcoreModeEnabled())); + par1PlayerUsageSnooper.addData("world[" + var2 + "][generator_name]", var5.getTerrainType().getWorldTypeName()); + par1PlayerUsageSnooper.addData("world[" + var2 + "][generator_version]", Integer.valueOf(var5.getTerrainType().getGeneratorVersion())); + par1PlayerUsageSnooper.addData("world[" + var2 + "][height]", Integer.valueOf(this.buildLimit)); + par1PlayerUsageSnooper.addData("world[" + var2 + "][chunks_loaded]", Integer.valueOf(var4.getChunkProvider().getLoadedChunkCount())); + ++var2; + } + } + + par1PlayerUsageSnooper.addData("worlds", Integer.valueOf(var2)); + } + + public void addServerTypeToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper) + { + par1PlayerUsageSnooper.addData("singleplayer", Boolean.valueOf(this.isSinglePlayer())); + par1PlayerUsageSnooper.addData("server_brand", this.getServerModName()); + par1PlayerUsageSnooper.addData("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported"); + par1PlayerUsageSnooper.addData("dedicated", Boolean.valueOf(this.isDedicatedServer())); + } + + /** + * Returns whether snooping is enabled or not. + */ + public boolean isSnooperEnabled() + { + return true; + } + + /** + * This is checked to be 16 upon receiving the packet, otherwise the packet is ignored. + */ + public int textureSize() + { + return 16; + } + + public abstract boolean isDedicatedServer(); + + public boolean isServerInOnlineMode() + { + return this.onlineMode; + } + + public void setOnlineMode(boolean par1) + { + this.onlineMode = par1; + } + + public boolean getCanSpawnAnimals() + { + return this.canSpawnAnimals; + } + + public void setCanSpawnAnimals(boolean par1) + { + this.canSpawnAnimals = par1; + } + + public boolean getCanSpawnNPCs() + { + return this.canSpawnNPCs; + } + + public void setCanSpawnNPCs(boolean par1) + { + this.canSpawnNPCs = par1; + } + + public boolean isPVPEnabled() + { + return this.pvpEnabled; + } + + public void setAllowPvp(boolean par1) + { + this.pvpEnabled = par1; + } + + public boolean isFlightAllowed() + { + return this.allowFlight; + } + + public void setAllowFlight(boolean par1) + { + this.allowFlight = par1; + } + + /** + * Return whether command blocks are enabled. + */ + public abstract boolean isCommandBlockEnabled(); + + public String getMOTD() + { + return this.motd; + } + + public void setMOTD(String par1Str) + { + this.motd = par1Str; + } + + public int getBuildLimit() + { + return this.buildLimit; + } + + public void setBuildLimit(int par1) + { + this.buildLimit = par1; + } + + public boolean isServerStopped() + { + return this.serverStopped; + } + + public ServerConfigurationManager getConfigurationManager() + { + return this.serverConfigManager; + } + + public void setConfigurationManager(ServerConfigurationManager par1ServerConfigurationManager) + { + this.serverConfigManager = par1ServerConfigurationManager; + } + + /** + * Sets the game type for all worlds. + */ + public void setGameType(EnumGameType par1EnumGameType) + { + for (int var2 = 0; var2 < this.worldServers.length; ++var2) + { + getServer().worldServers[var2].getWorldInfo().setGameType(par1EnumGameType); + } + } + + public abstract NetworkListenThread getNetworkThread(); + + public boolean serverIsInRunLoop() + { + return this.serverIsRunning; + } + + public boolean getGuiEnabled() + { + return false; + } + + /** + * On dedicated does nothing. On integrated, sets commandsAllowedForAll, gameType and allows external connections. + */ + public abstract String shareToLAN(EnumGameType var1, boolean var2); + + public int getTickCounter() + { + return this.tickCounter; + } + + public void enableProfiling() + { + this.startProfiling = true; + } + + public PlayerUsageSnooper getPlayerUsageSnooper() + { + return this.usageSnooper; + } + + /** + * Return the position for this command sender. + */ + public ChunkCoordinates getPlayerCoordinates() + { + return new ChunkCoordinates(0, 0, 0); + } + + public World getEntityWorld() + { + return this.worldServers[0]; + } + + /** + * Return the spawn protection area's size. + */ + public int getSpawnProtectionSize() + { + return 16; + } + + /** + * Returns true if a player does not have permission to edit the block at the given coordinates. + */ + public boolean isBlockProtected(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) + { + return false; + } + + public abstract ILogAgent getLogAgent(); + + public void setForceGamemode(boolean par1) + { + this.isGamemodeForced = par1; + } + + public boolean getForceGamemode() + { + return this.isGamemodeForced; + } + + public Proxy getServerProxy() + { + return this.serverProxy; + } + + /** + * returns the difference, measured in milliseconds, between the current system time and midnight, January 1, 1970 + * UTC. + */ + public static long getSystemTimeMillis() + { + return System.currentTimeMillis(); + } + + public int func_143007_ar() + { + return this.field_143008_E; + } + + public void func_143006_e(int par1) + { + this.field_143008_E = par1; + } + + /** + * Gets the current player count, maximum player count, and player entity list. + */ + public static ServerConfigurationManager getServerConfigurationManager(MinecraftServer par0MinecraftServer) + { + return par0MinecraftServer.serverConfigManager; + } +} diff --git a/src/main/java/net/minecraft/src/AABBLocalPool.java b/src/main/java/net/minecraft/src/AABBLocalPool.java new file mode 100644 index 0000000..46fd54a --- /dev/null +++ b/src/main/java/net/minecraft/src/AABBLocalPool.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +final class AABBLocalPool extends ThreadLocal +{ + protected AABBPool createNewDefaultPool() + { + return new AABBPool(300, 2000); + } + + protected Object initialValue() + { + return this.createNewDefaultPool(); + } +} diff --git a/src/main/java/net/minecraft/src/AABBPool.java b/src/main/java/net/minecraft/src/AABBPool.java new file mode 100644 index 0000000..3e6cd82 --- /dev/null +++ b/src/main/java/net/minecraft/src/AABBPool.java @@ -0,0 +1,106 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class AABBPool +{ + /** + * Maximum number of times the pool can be "cleaned" before the list is shrunk + */ + private final int maxNumCleans; + + /** + * Number of Pool entries to remove when cleanPool is called maxNumCleans times. + */ + private final int numEntriesToRemove; + + /** List of AABB stored in this Pool */ + private final List listAABB = new ArrayList(); + + /** Next index to use when adding a Pool Entry. */ + private int nextPoolIndex; + + /** + * Largest index reached by this Pool (can be reset to 0 upon calling cleanPool) + */ + private int maxPoolIndex; + + /** Number of times this Pool has been cleaned */ + private int numCleans; + + public AABBPool(int par1, int par2) + { + this.maxNumCleans = par1; + this.numEntriesToRemove = par2; + } + + /** + * Creates a new AABB, or reuses one that's no longer in use. Parameters: minX, minY, minZ, maxX, maxY, maxZ. AABBs + * returned from this function should only be used for one frame or tick, as after that they will be reused. + */ + public AxisAlignedBB getAABB(double par1, double par3, double par5, double par7, double par9, double par11) + { + AxisAlignedBB var13; + + if (this.nextPoolIndex >= this.listAABB.size()) + { + var13 = new AxisAlignedBB(par1, par3, par5, par7, par9, par11); + this.listAABB.add(var13); + } + else + { + var13 = (AxisAlignedBB)this.listAABB.get(this.nextPoolIndex); + var13.setBounds(par1, par3, par5, par7, par9, par11); + } + + ++this.nextPoolIndex; + return var13; + } + + /** + * Marks the pool as "empty", starting over when adding new entries. If this is called maxNumCleans times, the list + * size is reduced + */ + public void cleanPool() + { + if (this.nextPoolIndex > this.maxPoolIndex) + { + this.maxPoolIndex = this.nextPoolIndex; + } + + if (this.numCleans++ == this.maxNumCleans) + { + int var1 = Math.max(this.maxPoolIndex, this.listAABB.size() - this.numEntriesToRemove); + + while (this.listAABB.size() > var1) + { + this.listAABB.remove(var1); + } + + this.maxPoolIndex = 0; + this.numCleans = 0; + } + + this.nextPoolIndex = 0; + } + + /** + * Clears the AABBPool + */ + public void clearPool() + { + this.nextPoolIndex = 0; + this.listAABB.clear(); + } + + public int getlistAABBsize() + { + return this.listAABB.size(); + } + + public int getnextPoolIndex() + { + return this.nextPoolIndex; + } +} diff --git a/src/main/java/net/minecraft/src/AbstractClientPlayer.java b/src/main/java/net/minecraft/src/AbstractClientPlayer.java new file mode 100644 index 0000000..453153a --- /dev/null +++ b/src/main/java/net/minecraft/src/AbstractClientPlayer.java @@ -0,0 +1,98 @@ +package net.minecraft.src; + +public abstract class AbstractClientPlayer extends EntityPlayer +{ + public static final ResourceLocation locationStevePng = new ResourceLocation("textures/entity/steve.png"); + private ThreadDownloadImageData downloadImageSkin; + private ThreadDownloadImageData downloadImageCape; + private ResourceLocation locationSkin; + private ResourceLocation locationCape; + + public AbstractClientPlayer(World par1World, String par2Str) + { + super(par1World, par2Str); + this.setupCustomSkin(); + } + + protected void setupCustomSkin() + { + System.out.println("Setting up custom skins"); + + if (this.username != null && !this.username.isEmpty()) + { + this.locationSkin = getLocationSkin(this.username); + this.locationCape = getLocationCape(this.username); + this.downloadImageSkin = getDownloadImageSkin(this.locationSkin, this.username); + this.downloadImageCape = getDownloadImageCape(this.locationCape, this.username); + } + } + + public ThreadDownloadImageData getTextureSkin() + { + return this.downloadImageSkin; + } + + public ThreadDownloadImageData getTextureCape() + { + return this.downloadImageCape; + } + + public ResourceLocation getLocationSkin() + { + return this.locationSkin; + } + + public ResourceLocation getLocationCape() + { + return this.locationCape; + } + + public static ThreadDownloadImageData getDownloadImageSkin(ResourceLocation par0ResourceLocation, String par1Str) + { + return getDownloadImage(par0ResourceLocation, getSkinUrl(par1Str), locationStevePng, new ImageBufferDownload()); + } + + public static ThreadDownloadImageData getDownloadImageCape(ResourceLocation par0ResourceLocation, String par1Str) + { + return getDownloadImage(par0ResourceLocation, getCapeUrl(par1Str), (ResourceLocation)null, (IImageBuffer)null); + } + + private static ThreadDownloadImageData getDownloadImage(ResourceLocation par0ResourceLocation, String par1Str, ResourceLocation par2ResourceLocation, IImageBuffer par3IImageBuffer) + { + TextureManager var4 = Minecraft.getMinecraft().getTextureManager(); + Object var5 = var4.getTexture(par0ResourceLocation); + + if (var5 == null) + { + var5 = new ThreadDownloadImageData(par1Str, par2ResourceLocation, par3IImageBuffer); + var4.loadTexture(par0ResourceLocation, (TextureObject)var5); + } + + return (ThreadDownloadImageData)var5; + } + + public static String getSkinUrl(String par0Str) + { + return String.format("http://skins.minecraft.net/MinecraftSkins/%s.png", new Object[] {StringUtils.stripControlCodes(par0Str)}); + } + + public static String getCapeUrl(String par0Str) + { + return String.format("http://skins.minecraft.net/MinecraftCloaks/%s.png", new Object[] {StringUtils.stripControlCodes(par0Str)}); + } + + public static ResourceLocation getLocationSkin(String par0Str) + { + return new ResourceLocation("skins/" + StringUtils.stripControlCodes(par0Str)); + } + + public static ResourceLocation getLocationCape(String par0Str) + { + return new ResourceLocation("cloaks/" + StringUtils.stripControlCodes(par0Str)); + } + + public static ResourceLocation getLocationSkull(String par0Str) + { + return new ResourceLocation("skull/" + StringUtils.stripControlCodes(par0Str)); + } +} diff --git a/src/main/java/net/minecraft/src/AbstractResourcePack.java b/src/main/java/net/minecraft/src/AbstractResourcePack.java new file mode 100644 index 0000000..5d716c1 --- /dev/null +++ b/src/main/java/net/minecraft/src/AbstractResourcePack.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import java.awt.image.BufferedImage; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import javax.imageio.ImageIO; +import org.apache.commons.io.IOUtils; + +public abstract class AbstractResourcePack implements ResourcePack +{ + protected static final ILogAgent resourceLog = Minecraft.getMinecraft().getLogAgent(); + protected final File resourcePackFile; + + public AbstractResourcePack(File par1File) + { + this.resourcePackFile = par1File; + } + + private static String locationToName(ResourceLocation par0ResourceLocation) + { + return String.format("%s/%s/%s", new Object[] {"assets", par0ResourceLocation.getResourceDomain(), par0ResourceLocation.getResourcePath()}); + } + + protected static String getRelativeName(File par0File, File par1File) + { + return par0File.toURI().relativize(par1File.toURI()).getPath(); + } + + public InputStream getInputStream(ResourceLocation par1ResourceLocation) throws IOException + { + return this.getInputStreamByName(locationToName(par1ResourceLocation)); + } + + public boolean resourceExists(ResourceLocation par1ResourceLocation) + { + return this.hasResourceName(locationToName(par1ResourceLocation)); + } + + protected abstract InputStream getInputStreamByName(String var1) throws IOException; + + protected abstract boolean hasResourceName(String var1); + + protected void logNameNotLowercase(String par1Str) + { + resourceLog.logWarningFormatted("ResourcePack: ignored non-lowercase namespace: %s in %s", new Object[] {par1Str, this.resourcePackFile}); + } + + public MetadataSection getPackMetadata(MetadataSerializer par1MetadataSerializer, String par2Str) throws IOException + { + return readMetadata(par1MetadataSerializer, this.getInputStreamByName("pack.mcmeta"), par2Str); + } + + static MetadataSection readMetadata(MetadataSerializer par0MetadataSerializer, InputStream par1InputStream, String par2Str) + { + JsonObject var3 = null; + BufferedReader var4 = null; + + try + { + var4 = new BufferedReader(new InputStreamReader(par1InputStream)); + var3 = (new JsonParser()).parse(var4).getAsJsonObject(); + } + finally + { + IOUtils.closeQuietly(var4); + } + + return par0MetadataSerializer.parseMetadataSection(par2Str, var3); + } + + public BufferedImage getPackImage() throws IOException + { + return ImageIO.read(this.getInputStreamByName("pack.png")); + } + + public String getPackName() + { + return this.resourcePackFile.getName(); + } +} diff --git a/src/main/java/net/minecraft/src/AbstractTexture.java b/src/main/java/net/minecraft/src/AbstractTexture.java new file mode 100644 index 0000000..85894f0 --- /dev/null +++ b/src/main/java/net/minecraft/src/AbstractTexture.java @@ -0,0 +1,16 @@ +package net.minecraft.src; + +public abstract class AbstractTexture implements TextureObject +{ + protected int glTextureId = -1; + + public int getGlTextureId() + { + if (this.glTextureId == -1) + { + this.glTextureId = TextureUtil.glGenTextures(); + } + + return this.glTextureId; + } +} diff --git a/src/main/java/net/minecraft/src/Achievement.java b/src/main/java/net/minecraft/src/Achievement.java new file mode 100644 index 0000000..0e0d4c4 --- /dev/null +++ b/src/main/java/net/minecraft/src/Achievement.java @@ -0,0 +1,163 @@ +package net.minecraft.src; + +public class Achievement extends StatBase +{ + /** + * Is the column (related to center of achievement gui, in 24 pixels unit) that the achievement will be displayed. + */ + public final int displayColumn; + + /** + * Is the row (related to center of achievement gui, in 24 pixels unit) that the achievement will be displayed. + */ + public final int displayRow; + + /** + * Holds the parent achievement, that must be taken before this achievement is avaiable. + */ + public final Achievement parentAchievement; + + /** + * Holds the description of the achievement, ready to be formatted and/or displayed. + */ + private final String achievementDescription; + + /** + * Holds a string formatter for the achievement, some of then needs extra dynamic info - like the key used to open + * the inventory. + */ + private IStatStringFormat statStringFormatter; + + /** + * Holds the ItemStack that will be used to draw the achievement into the GUI. + */ + public final ItemStack theItemStack; + + /** + * Special achievements have a 'spiked' (on normal texture pack) frame, special achievements are the hardest ones to + * achieve. + */ + private boolean isSpecial; + + public Achievement(int par1, String par2Str, int par3, int par4, Item par5Item, Achievement par6Achievement) + { + this(par1, par2Str, par3, par4, new ItemStack(par5Item), par6Achievement); + } + + public Achievement(int par1, String par2Str, int par3, int par4, Block par5Block, Achievement par6Achievement) + { + this(par1, par2Str, par3, par4, new ItemStack(par5Block), par6Achievement); + } + + public Achievement(int par1, String par2Str, int par3, int par4, ItemStack par5ItemStack, Achievement par6Achievement) + { + super(5242880 + par1, "achievement." + par2Str); + this.theItemStack = par5ItemStack; + this.achievementDescription = "achievement." + par2Str + ".desc"; + this.displayColumn = par3; + this.displayRow = par4; + + if (par3 < AchievementList.minDisplayColumn) + { + AchievementList.minDisplayColumn = par3; + } + + if (par4 < AchievementList.minDisplayRow) + { + AchievementList.minDisplayRow = par4; + } + + if (par3 > AchievementList.maxDisplayColumn) + { + AchievementList.maxDisplayColumn = par3; + } + + if (par4 > AchievementList.maxDisplayRow) + { + AchievementList.maxDisplayRow = par4; + } + + this.parentAchievement = par6Achievement; + } + + /** + * Indicates whether or not the given achievement or statistic is independent (i.e., lacks prerequisites for being + * update). + */ + public Achievement setIndependent() + { + this.isIndependent = true; + return this; + } + + /** + * Special achievements have a 'spiked' (on normal texture pack) frame, special achievements are the hardest ones to + * achieve. + */ + public Achievement setSpecial() + { + this.isSpecial = true; + return this; + } + + /** + * Adds the achievement on the internal list of registered achievements, also, it's check for duplicated id's. + */ + public Achievement registerAchievement() + { + super.registerStat(); + AchievementList.achievementList.add(this); + return this; + } + + /** + * Returns whether or not the StatBase-derived class is a statistic (running counter) or an achievement (one-shot). + */ + public boolean isAchievement() + { + return true; + } + + /** + * Returns the fully description of the achievement - ready to be displayed on screen. + */ + public String getDescription() + { + return this.statStringFormatter != null ? this.statStringFormatter.formatString(StatCollector.translateToLocal(this.achievementDescription)) : StatCollector.translateToLocal(this.achievementDescription); + } + + /** + * Defines a string formatter for the achievement. + */ + public Achievement setStatStringFormatter(IStatStringFormat par1IStatStringFormat) + { + this.statStringFormatter = par1IStatStringFormat; + return this; + } + + /** + * Special achievements have a 'spiked' (on normal texture pack) frame, special achievements are the hardest ones to + * achieve. + */ + public boolean getSpecial() + { + return this.isSpecial; + } + + /** + * Register the stat into StatList. + */ + public StatBase registerStat() + { + return this.registerAchievement(); + } + + /** + * Initializes the current stat as independent (i.e., lacking prerequisites for being updated) and returns the + * current instance. + */ + public StatBase initIndependentStat() + { + return this.setIndependent(); + } +} diff --git a/src/main/java/net/minecraft/src/AchievementList.java b/src/main/java/net/minecraft/src/AchievementList.java new file mode 100644 index 0000000..a77590a --- /dev/null +++ b/src/main/java/net/minecraft/src/AchievementList.java @@ -0,0 +1,106 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class AchievementList +{ + /** Is the smallest column used to display a achievement on the GUI. */ + public static int minDisplayColumn; + + /** Is the smallest row used to display a achievement on the GUI. */ + public static int minDisplayRow; + + /** Is the biggest column used to display a achievement on the GUI. */ + public static int maxDisplayColumn; + + /** Is the biggest row used to display a achievement on the GUI. */ + public static int maxDisplayRow; + + /** Holds a list of all registered achievements. */ + public static List achievementList = new ArrayList(); + + /** Is the 'open inventory' achievement. */ + public static Achievement openInventory = (new Achievement(0, "openInventory", 0, 0, Item.book, (Achievement)null)).setIndependent().registerAchievement(); + + /** Is the 'getting wood' achievement. */ + public static Achievement mineWood = (new Achievement(1, "mineWood", 2, 1, Block.wood, openInventory)).registerAchievement(); + + /** Is the 'benchmarking' achievement. */ + public static Achievement buildWorkBench = (new Achievement(2, "buildWorkBench", 4, -1, Block.workbench, mineWood)).registerAchievement(); + + /** Is the 'time to mine' achievement. */ + public static Achievement buildPickaxe = (new Achievement(3, "buildPickaxe", 4, 2, Item.pickaxeWood, buildWorkBench)).registerAchievement(); + + /** Is the 'hot topic' achievement. */ + public static Achievement buildFurnace = (new Achievement(4, "buildFurnace", 3, 4, Block.furnaceIdle, buildPickaxe)).registerAchievement(); + + /** Is the 'acquire hardware' achievement. */ + public static Achievement acquireIron = (new Achievement(5, "acquireIron", 1, 4, Item.ingotIron, buildFurnace)).registerAchievement(); + + /** Is the 'time to farm' achievement. */ + public static Achievement buildHoe = (new Achievement(6, "buildHoe", 2, -3, Item.hoeWood, buildWorkBench)).registerAchievement(); + + /** Is the 'bake bread' achievement. */ + public static Achievement makeBread = (new Achievement(7, "makeBread", -1, -3, Item.bread, buildHoe)).registerAchievement(); + + /** Is the 'the lie' achievement. */ + public static Achievement bakeCake = (new Achievement(8, "bakeCake", 0, -5, Item.cake, buildHoe)).registerAchievement(); + + /** Is the 'getting a upgrade' achievement. */ + public static Achievement buildBetterPickaxe = (new Achievement(9, "buildBetterPickaxe", 6, 2, Item.pickaxeStone, buildPickaxe)).registerAchievement(); + + /** Is the 'delicious fish' achievement. */ + public static Achievement cookFish = (new Achievement(10, "cookFish", 2, 6, Item.fishCooked, buildFurnace)).registerAchievement(); + + /** Is the 'on a rail' achievement */ + public static Achievement onARail = (new Achievement(11, "onARail", 2, 3, Block.rail, acquireIron)).setSpecial().registerAchievement(); + + /** Is the 'time to strike' achievement. */ + public static Achievement buildSword = (new Achievement(12, "buildSword", 6, -1, Item.swordWood, buildWorkBench)).registerAchievement(); + + /** Is the 'monster hunter' achievement. */ + public static Achievement killEnemy = (new Achievement(13, "killEnemy", 8, -1, Item.bone, buildSword)).registerAchievement(); + + /** is the 'cow tipper' achievement. */ + public static Achievement killCow = (new Achievement(14, "killCow", 7, -3, Item.leather, buildSword)).registerAchievement(); + + /** Is the 'when pig fly' achievement. */ + public static Achievement flyPig = (new Achievement(15, "flyPig", 8, -4, Item.saddle, killCow)).setSpecial().registerAchievement(); + + /** The achievement for killing a Skeleton from 50 meters aways. */ + public static Achievement snipeSkeleton = (new Achievement(16, "snipeSkeleton", 7, 0, Item.bow, killEnemy)).setSpecial().registerAchievement(); + + /** Is the 'DIAMONDS!' achievement */ + public static Achievement diamonds = (new Achievement(17, "diamonds", -1, 5, Item.diamond, acquireIron)).registerAchievement(); + + /** Is the 'We Need to Go Deeper' achievement */ + public static Achievement portal = (new Achievement(18, "portal", -1, 7, Block.obsidian, diamonds)).registerAchievement(); + + /** Is the 'Return to Sender' achievement */ + public static Achievement ghast = (new Achievement(19, "ghast", -4, 8, Item.ghastTear, portal)).setSpecial().registerAchievement(); + + /** Is the 'Into Fire' achievement */ + public static Achievement blazeRod = (new Achievement(20, "blazeRod", 0, 9, Item.blazeRod, portal)).registerAchievement(); + + /** Is the 'Local Brewery' achievement */ + public static Achievement potion = (new Achievement(21, "potion", 2, 8, Item.potion, blazeRod)).registerAchievement(); + + /** Is the 'The End?' achievement */ + public static Achievement theEnd = (new Achievement(22, "theEnd", 3, 10, Item.eyeOfEnder, blazeRod)).setSpecial().registerAchievement(); + + /** Is the 'The End.' achievement */ + public static Achievement theEnd2 = (new Achievement(23, "theEnd2", 4, 13, Block.dragonEgg, theEnd)).setSpecial().registerAchievement(); + + /** Is the 'Enchanter' achievement */ + public static Achievement enchantments = (new Achievement(24, "enchantments", -4, 4, Block.enchantmentTable, diamonds)).registerAchievement(); + public static Achievement overkill = (new Achievement(25, "overkill", -4, 1, Item.swordDiamond, enchantments)).setSpecial().registerAchievement(); + + /** Is the 'Librarian' achievement */ + public static Achievement bookcase = (new Achievement(26, "bookcase", -3, 6, Block.bookShelf, enchantments)).registerAchievement(); + + /** + * A stub functions called to make the static initializer for this class run. + */ + public static void init() {} +} diff --git a/src/main/java/net/minecraft/src/AchievementMap.java b/src/main/java/net/minecraft/src/AchievementMap.java new file mode 100644 index 0000000..8accd9b --- /dev/null +++ b/src/main/java/net/minecraft/src/AchievementMap.java @@ -0,0 +1,45 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.HashMap; +import java.util.Map; + +public class AchievementMap +{ + /** Holds the singleton instance of AchievementMap. */ + public static AchievementMap instance = new AchievementMap(); + + /** Maps a achievement id with it's unique GUID. */ + private Map guidMap = new HashMap(); + + private AchievementMap() + { + try + { + BufferedReader var1 = new BufferedReader(new InputStreamReader(AchievementMap.class.getResourceAsStream("/achievement/map.txt"))); + String var2; + + while ((var2 = var1.readLine()) != null) + { + String[] var3 = var2.split(","); + int var4 = Integer.parseInt(var3[0]); + this.guidMap.put(Integer.valueOf(var4), var3[1]); + } + + var1.close(); + } + catch (Exception var5) + { + var5.printStackTrace(); + } + } + + /** + * Returns the unique GUID of a achievement id. + */ + public static String getGuid(int par0) + { + return (String)instance.guidMap.get(Integer.valueOf(par0)); + } +} diff --git a/src/main/java/net/minecraft/src/ActiveRenderInfo.java b/src/main/java/net/minecraft/src/ActiveRenderInfo.java new file mode 100644 index 0000000..04380aa --- /dev/null +++ b/src/main/java/net/minecraft/src/ActiveRenderInfo.java @@ -0,0 +1,111 @@ +package net.minecraft.src; + +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.GLU; + +public class ActiveRenderInfo +{ + /** The calculated view object X coordinate */ + public static float objectX; + + /** The calculated view object Y coordinate */ + public static float objectY; + + /** The calculated view object Z coordinate */ + public static float objectZ; + + /** The current GL viewport */ + private static IntBuffer viewport = GLAllocation.createDirectIntBuffer(16); + + /** The current GL modelview matrix */ + private static FloatBuffer modelview = GLAllocation.createDirectFloatBuffer(16); + + /** The current GL projection matrix */ + private static FloatBuffer projection = GLAllocation.createDirectFloatBuffer(16); + + /** The computed view object coordinates */ + private static FloatBuffer objectCoords = GLAllocation.createDirectFloatBuffer(3); + + /** The X component of the entity's yaw rotation */ + public static float rotationX; + + /** The combined X and Z components of the entity's pitch rotation */ + public static float rotationXZ; + + /** The Z component of the entity's yaw rotation */ + public static float rotationZ; + + /** + * The Y component (scaled along the Z axis) of the entity's pitch rotation + */ + public static float rotationYZ; + + /** + * The Y component (scaled along the X axis) of the entity's pitch rotation + */ + public static float rotationXY; + + /** + * Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode + */ + public static void updateRenderInfo(EntityPlayer par0EntityPlayer, boolean par1) + { + GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelview); + GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projection); + GL11.glGetInteger(GL11.GL_VIEWPORT, viewport); + float var2 = (float)((viewport.get(0) + viewport.get(2)) / 2); + float var3 = (float)((viewport.get(1) + viewport.get(3)) / 2); + GLU.gluUnProject(var2, var3, 0.0F, modelview, projection, viewport, objectCoords); + objectX = objectCoords.get(0); + objectY = objectCoords.get(1); + objectZ = objectCoords.get(2); + int var4 = par1 ? 1 : 0; + float var5 = par0EntityPlayer.rotationPitch; + float var6 = par0EntityPlayer.rotationYaw; + rotationX = MathHelper.cos(var6 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2); + rotationZ = MathHelper.sin(var6 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2); + rotationYZ = -rotationZ * MathHelper.sin(var5 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2); + rotationXY = rotationX * MathHelper.sin(var5 * (float)Math.PI / 180.0F) * (float)(1 - var4 * 2); + rotationXZ = MathHelper.cos(var5 * (float)Math.PI / 180.0F); + } + + /** + * Returns a vector representing the projection along the given entity's view for the given distance + */ + public static Vec3 projectViewFromEntity(EntityLivingBase par0EntityLivingBase, double par1) + { + double var3 = par0EntityLivingBase.prevPosX + (par0EntityLivingBase.posX - par0EntityLivingBase.prevPosX) * par1; + double var5 = par0EntityLivingBase.prevPosY + (par0EntityLivingBase.posY - par0EntityLivingBase.prevPosY) * par1 + (double)par0EntityLivingBase.getEyeHeight(); + double var7 = par0EntityLivingBase.prevPosZ + (par0EntityLivingBase.posZ - par0EntityLivingBase.prevPosZ) * par1; + double var9 = var3 + (double)(objectX * 1.0F); + double var11 = var5 + (double)(objectY * 1.0F); + double var13 = var7 + (double)(objectZ * 1.0F); + return par0EntityLivingBase.worldObj.getWorldVec3Pool().getVecFromPool(var9, var11, var13); + } + + /** + * Returns the block ID at the current camera location (either air or fluid), taking into account the height of + * fluid blocks + */ + public static int getBlockIdAtEntityViewpoint(World par0World, EntityLivingBase par1EntityLivingBase, float par2) + { + Vec3 var3 = projectViewFromEntity(par1EntityLivingBase, (double)par2); + ChunkPosition var4 = new ChunkPosition(var3); + int var5 = par0World.getBlockId(var4.x, var4.y, var4.z); + + if (var5 != 0 && Block.blocksList[var5].blockMaterial.isLiquid()) + { + float var6 = BlockFluid.getFluidHeightPercent(par0World.getBlockMetadata(var4.x, var4.y, var4.z)) - 0.11111111F; + float var7 = (float)(var4.y + 1) - var6; + + if (var3.yCoord >= (double)var7) + { + var5 = par0World.getBlockId(var4.x, var4.y + 1, var4.z); + } + } + + return var5; + } +} diff --git a/src/main/java/net/minecraft/src/AnimalChest.java b/src/main/java/net/minecraft/src/AnimalChest.java new file mode 100644 index 0000000..327fbdc --- /dev/null +++ b/src/main/java/net/minecraft/src/AnimalChest.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +public class AnimalChest extends InventoryBasic +{ + public AnimalChest(String par1Str, int par2) + { + super(par1Str, false, par2); + } + + public AnimalChest(String par1Str, boolean par2, int par3) + { + super(par1Str, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/AnimationFrame.java b/src/main/java/net/minecraft/src/AnimationFrame.java new file mode 100644 index 0000000..689fb92 --- /dev/null +++ b/src/main/java/net/minecraft/src/AnimationFrame.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +public class AnimationFrame +{ + private final int frameIndex; + private final int frameTime; + + public AnimationFrame(int par1) + { + this(par1, -1); + } + + public AnimationFrame(int par1, int par2) + { + this.frameIndex = par1; + this.frameTime = par2; + } + + public boolean hasNoTime() + { + return this.frameTime == -1; + } + + public int getFrameTime() + { + return this.frameTime; + } + + public int getFrameIndex() + { + return this.frameIndex; + } +} diff --git a/src/main/java/net/minecraft/src/AnimationMetadataSection.java b/src/main/java/net/minecraft/src/AnimationMetadataSection.java new file mode 100644 index 0000000..a29ed81 --- /dev/null +++ b/src/main/java/net/minecraft/src/AnimationMetadataSection.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +import com.google.common.collect.Sets; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +public class AnimationMetadataSection implements MetadataSection +{ + private final List animationFrames; + private final int frameWidth; + private final int frameHeight; + private final int frameTime; + + public AnimationMetadataSection(List par1List, int par2, int par3, int par4) + { + this.animationFrames = par1List; + this.frameWidth = par2; + this.frameHeight = par3; + this.frameTime = par4; + } + + public int getFrameHeight() + { + return this.frameHeight; + } + + public int getFrameWidth() + { + return this.frameWidth; + } + + public int getFrameCount() + { + return this.animationFrames.size(); + } + + public int getFrameTime() + { + return this.frameTime; + } + + private AnimationFrame getAnimationFrame(int par1) + { + return (AnimationFrame)this.animationFrames.get(par1); + } + + public int getFrameTimeSingle(int par1) + { + AnimationFrame var2 = this.getAnimationFrame(par1); + return var2.hasNoTime() ? this.frameTime : var2.getFrameTime(); + } + + public boolean frameHasTime(int par1) + { + return !((AnimationFrame)this.animationFrames.get(par1)).hasNoTime(); + } + + public int getFrameIndex(int par1) + { + return ((AnimationFrame)this.animationFrames.get(par1)).getFrameIndex(); + } + + public Set getFrameIndexSet() + { + HashSet var1 = Sets.newHashSet(); + Iterator var2 = this.animationFrames.iterator(); + + while (var2.hasNext()) + { + AnimationFrame var3 = (AnimationFrame)var2.next(); + var1.add(Integer.valueOf(var3.getFrameIndex())); + } + + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/AnimationMetadataSectionSerializer.java b/src/main/java/net/minecraft/src/AnimationMetadataSectionSerializer.java new file mode 100644 index 0000000..c89016b --- /dev/null +++ b/src/main/java/net/minecraft/src/AnimationMetadataSectionSerializer.java @@ -0,0 +1,135 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import java.util.ArrayList; + +public class AnimationMetadataSectionSerializer extends BaseMetadataSectionSerializer implements JsonSerializer +{ + public AnimationMetadataSection func_110493_a(JsonElement par1JsonElement, Type par2Type, JsonDeserializationContext par3JsonDeserializationContext) + { + ArrayList var4 = Lists.newArrayList(); + JsonObject var5 = (JsonObject)par1JsonElement; + int var6 = this.func_110485_a(var5.get("frametime"), "frametime", Integer.valueOf(1), 1, Integer.MAX_VALUE); + int var8; + + if (var5.has("frames")) + { + try + { + JsonArray var7 = var5.getAsJsonArray("frames"); + + for (var8 = 0; var8 < var7.size(); ++var8) + { + JsonElement var9 = var7.get(var8); + AnimationFrame var10 = this.parseAnimationFrame(var8, var9); + + if (var10 != null) + { + var4.add(var10); + } + } + } + catch (ClassCastException var11) + { + throw new JsonParseException("Invalid animation->frames: expected array, was " + var5.get("frames"), var11); + } + } + + int var12 = this.func_110485_a(var5.get("width"), "width", Integer.valueOf(-1), 1, Integer.MAX_VALUE); + var8 = this.func_110485_a(var5.get("height"), "height", Integer.valueOf(-1), 1, Integer.MAX_VALUE); + return new AnimationMetadataSection(var4, var12, var8, var6); + } + + private AnimationFrame parseAnimationFrame(int par1, JsonElement par2JsonElement) + { + if (par2JsonElement.isJsonPrimitive()) + { + try + { + return new AnimationFrame(par2JsonElement.getAsInt()); + } + catch (NumberFormatException var6) + { + throw new JsonParseException("Invalid animation->frames->" + par1 + ": expected number, was " + par2JsonElement, var6); + } + } + else if (par2JsonElement.isJsonObject()) + { + JsonObject var3 = par2JsonElement.getAsJsonObject(); + int var4 = this.func_110485_a(var3.get("time"), "frames->" + par1 + "->time", Integer.valueOf(-1), 1, Integer.MAX_VALUE); + int var5 = this.func_110485_a(var3.get("index"), "frames->" + par1 + "->index", (Integer)null, 0, Integer.MAX_VALUE); + return new AnimationFrame(var5, var4); + } + else + { + return null; + } + } + + public JsonElement func_110491_a(AnimationMetadataSection par1AnimationMetadataSection, Type par2Type, JsonSerializationContext par3JsonSerializationContext) + { + JsonObject var4 = new JsonObject(); + var4.addProperty("frametime", Integer.valueOf(par1AnimationMetadataSection.getFrameTime())); + + if (par1AnimationMetadataSection.getFrameWidth() != -1) + { + var4.addProperty("width", Integer.valueOf(par1AnimationMetadataSection.getFrameWidth())); + } + + if (par1AnimationMetadataSection.getFrameHeight() != -1) + { + var4.addProperty("height", Integer.valueOf(par1AnimationMetadataSection.getFrameHeight())); + } + + if (par1AnimationMetadataSection.getFrameCount() > 0) + { + JsonArray var5 = new JsonArray(); + + for (int var6 = 0; var6 < par1AnimationMetadataSection.getFrameCount(); ++var6) + { + if (par1AnimationMetadataSection.frameHasTime(var6)) + { + JsonObject var7 = new JsonObject(); + var7.addProperty("index", Integer.valueOf(par1AnimationMetadataSection.getFrameIndex(var6))); + var7.addProperty("time", Integer.valueOf(par1AnimationMetadataSection.getFrameTimeSingle(var6))); + var5.add(var7); + } + else + { + var5.add(new JsonPrimitive(Integer.valueOf(par1AnimationMetadataSection.getFrameIndex(var6)))); + } + } + + var4.add("frames", var5); + } + + return var4; + } + + /** + * The name of this section type as it appears in JSON. + */ + public String getSectionName() + { + return "animation"; + } + + public Object deserialize(JsonElement par1JsonElement, Type par2Type, JsonDeserializationContext par3JsonDeserializationContext) + { + return this.func_110493_a(par1JsonElement, par2Type, par3JsonDeserializationContext); + } + + public JsonElement serialize(Object par1Obj, Type par2Type, JsonSerializationContext par3JsonSerializationContext) + { + return this.func_110491_a((AnimationMetadataSection)par1Obj, par2Type, par3JsonSerializationContext); + } +} diff --git a/src/main/java/net/minecraft/src/AnvilChunkLoader.java b/src/main/java/net/minecraft/src/AnvilChunkLoader.java new file mode 100644 index 0000000..29664e8 --- /dev/null +++ b/src/main/java/net/minecraft/src/AnvilChunkLoader.java @@ -0,0 +1,425 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +public class AnvilChunkLoader implements IChunkLoader, IThreadedFileIO +{ + private List chunksToRemove = new ArrayList(); + private Set pendingAnvilChunksCoordinates = new HashSet(); + private Object syncLockObject = new Object(); + + /** Save directory for chunks using the Anvil format */ + private final File chunkSaveLocation; + + public AnvilChunkLoader(File par1File) + { + this.chunkSaveLocation = par1File; + } + + /** + * Loads the specified(XZ) chunk into the specified world. + */ + public Chunk loadChunk(World par1World, int par2, int par3) throws IOException + { + NBTTagCompound var4 = null; + ChunkCoordIntPair var5 = new ChunkCoordIntPair(par2, par3); + Object var6 = this.syncLockObject; + + synchronized (this.syncLockObject) + { + if (this.pendingAnvilChunksCoordinates.contains(var5)) + { + for (int var7 = 0; var7 < this.chunksToRemove.size(); ++var7) + { + if (((AnvilChunkLoaderPending)this.chunksToRemove.get(var7)).chunkCoordinate.equals(var5)) + { + var4 = ((AnvilChunkLoaderPending)this.chunksToRemove.get(var7)).nbtTags; + break; + } + } + } + } + + if (var4 == null) + { + DataInputStream var10 = RegionFileCache.getChunkInputStream(this.chunkSaveLocation, par2, par3); + + if (var10 == null) + { + return null; + } + + var4 = CompressedStreamTools.read(var10); + } + + return this.checkedReadChunkFromNBT(par1World, par2, par3, var4); + } + + /** + * Wraps readChunkFromNBT. Checks the coordinates and several NBT tags. + */ + protected Chunk checkedReadChunkFromNBT(World par1World, int par2, int par3, NBTTagCompound par4NBTTagCompound) + { + if (!par4NBTTagCompound.hasKey("Level")) + { + par1World.getWorldLogAgent().logSevere("Chunk file at " + par2 + "," + par3 + " is missing level data, skipping"); + return null; + } + else if (!par4NBTTagCompound.getCompoundTag("Level").hasKey("Sections")) + { + par1World.getWorldLogAgent().logSevere("Chunk file at " + par2 + "," + par3 + " is missing block data, skipping"); + return null; + } + else + { + Chunk var5 = this.readChunkFromNBT(par1World, par4NBTTagCompound.getCompoundTag("Level")); + + if (!var5.isAtLocation(par2, par3)) + { + par1World.getWorldLogAgent().logSevere("Chunk file at " + par2 + "," + par3 + " is in the wrong location; relocating. (Expected " + par2 + ", " + par3 + ", got " + var5.xPosition + ", " + var5.zPosition + ")"); + par4NBTTagCompound.setInteger("xPos", par2); + par4NBTTagCompound.setInteger("zPos", par3); + var5 = this.readChunkFromNBT(par1World, par4NBTTagCompound.getCompoundTag("Level")); + } + + return var5; + } + } + + public void saveChunk(World par1World, Chunk par2Chunk) throws MinecraftException, IOException + { + par1World.checkSessionLock(); + + try + { + NBTTagCompound var3 = new NBTTagCompound(); + NBTTagCompound var4 = new NBTTagCompound(); + var3.setTag("Level", var4); + this.writeChunkToNBT(par2Chunk, par1World, var4); + this.addChunkToPending(par2Chunk.getChunkCoordIntPair(), var3); + } + catch (Exception var5) + { + var5.printStackTrace(); + } + } + + protected void addChunkToPending(ChunkCoordIntPair par1ChunkCoordIntPair, NBTTagCompound par2NBTTagCompound) + { + Object var3 = this.syncLockObject; + + synchronized (this.syncLockObject) + { + if (this.pendingAnvilChunksCoordinates.contains(par1ChunkCoordIntPair)) + { + for (int var4 = 0; var4 < this.chunksToRemove.size(); ++var4) + { + if (((AnvilChunkLoaderPending)this.chunksToRemove.get(var4)).chunkCoordinate.equals(par1ChunkCoordIntPair)) + { + this.chunksToRemove.set(var4, new AnvilChunkLoaderPending(par1ChunkCoordIntPair, par2NBTTagCompound)); + return; + } + } + } + + this.chunksToRemove.add(new AnvilChunkLoaderPending(par1ChunkCoordIntPair, par2NBTTagCompound)); + this.pendingAnvilChunksCoordinates.add(par1ChunkCoordIntPair); + ThreadedFileIOBase.threadedIOInstance.queueIO(this); + } + } + + /** + * Returns a boolean stating if the write was unsuccessful. + */ + public boolean writeNextIO() + { + AnvilChunkLoaderPending var1 = null; + Object var2 = this.syncLockObject; + + synchronized (this.syncLockObject) + { + if (this.chunksToRemove.isEmpty()) + { + return false; + } + + var1 = (AnvilChunkLoaderPending)this.chunksToRemove.remove(0); + this.pendingAnvilChunksCoordinates.remove(var1.chunkCoordinate); + } + + if (var1 != null) + { + try + { + this.writeChunkNBTTags(var1); + } + catch (Exception var4) + { + var4.printStackTrace(); + } + } + + return true; + } + + private void writeChunkNBTTags(AnvilChunkLoaderPending par1AnvilChunkLoaderPending) throws IOException + { + DataOutputStream var2 = RegionFileCache.getChunkOutputStream(this.chunkSaveLocation, par1AnvilChunkLoaderPending.chunkCoordinate.chunkXPos, par1AnvilChunkLoaderPending.chunkCoordinate.chunkZPos); + CompressedStreamTools.write(par1AnvilChunkLoaderPending.nbtTags, var2); + var2.close(); + } + + /** + * Save extra data associated with this Chunk not normally saved during autosave, only during chunk unload. + * Currently unused. + */ + public void saveExtraChunkData(World par1World, Chunk par2Chunk) {} + + /** + * Called every World.tick() + */ + public void chunkTick() {} + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unused. + */ + public void saveExtraData() + { + while (this.writeNextIO()) + { + ; + } + } + + /** + * Writes the Chunk passed as an argument to the NBTTagCompound also passed, using the World argument to retrieve + * the Chunk's last update time. + */ + private void writeChunkToNBT(Chunk par1Chunk, World par2World, NBTTagCompound par3NBTTagCompound) + { + par3NBTTagCompound.setInteger("xPos", par1Chunk.xPosition); + par3NBTTagCompound.setInteger("zPos", par1Chunk.zPosition); + par3NBTTagCompound.setLong("LastUpdate", par2World.getTotalWorldTime()); + par3NBTTagCompound.setIntArray("HeightMap", par1Chunk.heightMap); + par3NBTTagCompound.setBoolean("TerrainPopulated", par1Chunk.isTerrainPopulated); + par3NBTTagCompound.setLong("InhabitedTime", par1Chunk.inhabitedTime); + ExtendedBlockStorage[] var4 = par1Chunk.getBlockStorageArray(); + NBTTagList var5 = new NBTTagList("Sections"); + boolean var6 = !par2World.provider.hasNoSky; + ExtendedBlockStorage[] var7 = var4; + int var8 = var4.length; + NBTTagCompound var11; + + for (int var9 = 0; var9 < var8; ++var9) + { + ExtendedBlockStorage var10 = var7[var9]; + + if (var10 != null) + { + var11 = new NBTTagCompound(); + var11.setByte("Y", (byte)(var10.getYLocation() >> 4 & 255)); + var11.setByteArray("Blocks", var10.getBlockLSBArray()); + + if (var10.getBlockMSBArray() != null) + { + var11.setByteArray("Add", var10.getBlockMSBArray().data); + } + + var11.setByteArray("Data", var10.getMetadataArray().data); + var11.setByteArray("BlockLight", var10.getBlocklightArray().data); + + if (var6) + { + var11.setByteArray("SkyLight", var10.getSkylightArray().data); + } + else + { + var11.setByteArray("SkyLight", new byte[var10.getBlocklightArray().data.length]); + } + + var5.appendTag(var11); + } + } + + par3NBTTagCompound.setTag("Sections", var5); + par3NBTTagCompound.setByteArray("Biomes", par1Chunk.getBiomeArray()); + par1Chunk.hasEntities = false; + NBTTagList var16 = new NBTTagList(); + Iterator var18; + + for (var8 = 0; var8 < par1Chunk.entityLists.length; ++var8) + { + var18 = par1Chunk.entityLists[var8].iterator(); + + while (var18.hasNext()) + { + Entity var20 = (Entity)var18.next(); + var11 = new NBTTagCompound(); + + if (var20.writeToNBTOptional(var11)) + { + par1Chunk.hasEntities = true; + var16.appendTag(var11); + } + } + } + + par3NBTTagCompound.setTag("Entities", var16); + NBTTagList var17 = new NBTTagList(); + var18 = par1Chunk.chunkTileEntityMap.values().iterator(); + + while (var18.hasNext()) + { + TileEntity var21 = (TileEntity)var18.next(); + var11 = new NBTTagCompound(); + var21.writeToNBT(var11); + var17.appendTag(var11); + } + + par3NBTTagCompound.setTag("TileEntities", var17); + List var19 = par2World.getPendingBlockUpdates(par1Chunk, false); + + if (var19 != null) + { + long var22 = par2World.getTotalWorldTime(); + NBTTagList var12 = new NBTTagList(); + Iterator var13 = var19.iterator(); + + while (var13.hasNext()) + { + NextTickListEntry var14 = (NextTickListEntry)var13.next(); + NBTTagCompound var15 = new NBTTagCompound(); + var15.setInteger("i", var14.blockID); + var15.setInteger("x", var14.xCoord); + var15.setInteger("y", var14.yCoord); + var15.setInteger("z", var14.zCoord); + var15.setInteger("t", (int)(var14.scheduledTime - var22)); + var15.setInteger("p", var14.priority); + var12.appendTag(var15); + } + + par3NBTTagCompound.setTag("TileTicks", var12); + } + } + + /** + * Reads the data stored in the passed NBTTagCompound and creates a Chunk with that data in the passed World. + * Returns the created Chunk. + */ + private Chunk readChunkFromNBT(World par1World, NBTTagCompound par2NBTTagCompound) + { + int var3 = par2NBTTagCompound.getInteger("xPos"); + int var4 = par2NBTTagCompound.getInteger("zPos"); + Chunk var5 = new Chunk(par1World, var3, var4); + var5.heightMap = par2NBTTagCompound.getIntArray("HeightMap"); + var5.isTerrainPopulated = par2NBTTagCompound.getBoolean("TerrainPopulated"); + var5.inhabitedTime = par2NBTTagCompound.getLong("InhabitedTime"); + NBTTagList var6 = par2NBTTagCompound.getTagList("Sections"); + byte var7 = 16; + ExtendedBlockStorage[] var8 = new ExtendedBlockStorage[var7]; + boolean var9 = !par1World.provider.hasNoSky; + + for (int var10 = 0; var10 < var6.tagCount(); ++var10) + { + NBTTagCompound var11 = (NBTTagCompound)var6.tagAt(var10); + byte var12 = var11.getByte("Y"); + ExtendedBlockStorage var13 = new ExtendedBlockStorage(var12 << 4, var9); + var13.setBlockLSBArray(var11.getByteArray("Blocks")); + + if (var11.hasKey("Add")) + { + var13.setBlockMSBArray(new NibbleArray(var11.getByteArray("Add"), 4)); + } + + var13.setBlockMetadataArray(new NibbleArray(var11.getByteArray("Data"), 4)); + var13.setBlocklightArray(new NibbleArray(var11.getByteArray("BlockLight"), 4)); + + if (var9) + { + var13.setSkylightArray(new NibbleArray(var11.getByteArray("SkyLight"), 4)); + } + + var13.removeInvalidBlocks(); + var8[var12] = var13; + } + + var5.setStorageArrays(var8); + + if (par2NBTTagCompound.hasKey("Biomes")) + { + var5.setBiomeArray(par2NBTTagCompound.getByteArray("Biomes")); + } + + NBTTagList var17 = par2NBTTagCompound.getTagList("Entities"); + + if (var17 != null) + { + for (int var18 = 0; var18 < var17.tagCount(); ++var18) + { + NBTTagCompound var20 = (NBTTagCompound)var17.tagAt(var18); + Entity var22 = EntityList.createEntityFromNBT(var20, par1World); + var5.hasEntities = true; + + if (var22 != null) + { + var5.addEntity(var22); + Entity var14 = var22; + + for (NBTTagCompound var15 = var20; var15.hasKey("Riding"); var15 = var15.getCompoundTag("Riding")) + { + Entity var16 = EntityList.createEntityFromNBT(var15.getCompoundTag("Riding"), par1World); + + if (var16 != null) + { + var5.addEntity(var16); + var14.mountEntity(var16); + } + + var14 = var16; + } + } + } + } + + NBTTagList var19 = par2NBTTagCompound.getTagList("TileEntities"); + + if (var19 != null) + { + for (int var21 = 0; var21 < var19.tagCount(); ++var21) + { + NBTTagCompound var24 = (NBTTagCompound)var19.tagAt(var21); + TileEntity var26 = TileEntity.createAndLoadEntity(var24); + + if (var26 != null) + { + var5.addTileEntity(var26); + } + } + } + + if (par2NBTTagCompound.hasKey("TileTicks")) + { + NBTTagList var23 = par2NBTTagCompound.getTagList("TileTicks"); + + if (var23 != null) + { + for (int var25 = 0; var25 < var23.tagCount(); ++var25) + { + NBTTagCompound var27 = (NBTTagCompound)var23.tagAt(var25); + par1World.scheduleBlockUpdateFromLoad(var27.getInteger("x"), var27.getInteger("y"), var27.getInteger("z"), var27.getInteger("i"), var27.getInteger("t"), var27.getInteger("p")); + } + } + } + + return var5; + } +} diff --git a/src/main/java/net/minecraft/src/AnvilChunkLoaderPending.java b/src/main/java/net/minecraft/src/AnvilChunkLoaderPending.java new file mode 100644 index 0000000..a44d167 --- /dev/null +++ b/src/main/java/net/minecraft/src/AnvilChunkLoaderPending.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +class AnvilChunkLoaderPending +{ + public final ChunkCoordIntPair chunkCoordinate; + public final NBTTagCompound nbtTags; + + public AnvilChunkLoaderPending(ChunkCoordIntPair par1ChunkCoordIntPair, NBTTagCompound par2NBTTagCompound) + { + this.chunkCoordinate = par1ChunkCoordIntPair; + this.nbtTags = par2NBTTagCompound; + } +} diff --git a/src/main/java/net/minecraft/src/AnvilConverterData.java b/src/main/java/net/minecraft/src/AnvilConverterData.java new file mode 100644 index 0000000..a91b693 --- /dev/null +++ b/src/main/java/net/minecraft/src/AnvilConverterData.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +public class AnvilConverterData +{ + public long lastUpdated; + public boolean terrainPopulated; + public byte[] heightmap; + public NibbleArrayReader blockLight; + public NibbleArrayReader skyLight; + public NibbleArrayReader data; + public byte[] blocks; + public NBTTagList entities; + public NBTTagList tileEntities; + public NBTTagList tileTicks; + public final int x; + public final int z; + + public AnvilConverterData(int par1, int par2) + { + this.x = par1; + this.z = par2; + } +} diff --git a/src/main/java/net/minecraft/src/AnvilConverterException.java b/src/main/java/net/minecraft/src/AnvilConverterException.java new file mode 100644 index 0000000..f484761 --- /dev/null +++ b/src/main/java/net/minecraft/src/AnvilConverterException.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public class AnvilConverterException extends Exception +{ + public AnvilConverterException(String par1Str) + { + super(par1Str); + } +} diff --git a/src/main/java/net/minecraft/src/AnvilSaveConverter.java b/src/main/java/net/minecraft/src/AnvilSaveConverter.java new file mode 100644 index 0000000..22e5261 --- /dev/null +++ b/src/main/java/net/minecraft/src/AnvilSaveConverter.java @@ -0,0 +1,263 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class AnvilSaveConverter extends SaveFormatOld +{ + public AnvilSaveConverter(File par1File) + { + super(par1File); + } + + public List getSaveList() throws AnvilConverterException + { + if (this.savesDirectory != null && this.savesDirectory.exists() && this.savesDirectory.isDirectory()) + { + ArrayList var1 = new ArrayList(); + File[] var2 = this.savesDirectory.listFiles(); + File[] var3 = var2; + int var4 = var2.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + File var6 = var3[var5]; + + if (var6.isDirectory()) + { + String var7 = var6.getName(); + WorldInfo var8 = this.getWorldInfo(var7); + + if (var8 != null && (var8.getSaveVersion() == 19132 || var8.getSaveVersion() == 19133)) + { + boolean var9 = var8.getSaveVersion() != this.getSaveVersion(); + String var10 = var8.getWorldName(); + + if (var10 == null || MathHelper.stringNullOrLengthZero(var10)) + { + var10 = var7; + } + + long var11 = 0L; + var1.add(new SaveFormatComparator(var7, var10, var8.getLastTimePlayed(), var11, var8.getGameType(), var9, var8.isHardcoreModeEnabled(), var8.areCommandsAllowed())); + } + } + } + + return var1; + } + else + { + throw new AnvilConverterException("Unable to read or access folder where game worlds are saved!"); + } + } + + protected int getSaveVersion() + { + return 19133; + } + + public void flushCache() + { + RegionFileCache.clearRegionFileReferences(); + } + + /** + * Returns back a loader for the specified save directory + */ + public ISaveHandler getSaveLoader(String par1Str, boolean par2) + { + return new AnvilSaveHandler(this.savesDirectory, par1Str, par2); + } + + /** + * Checks if the save directory uses the old map format + */ + public boolean isOldMapFormat(String par1Str) + { + WorldInfo var2 = this.getWorldInfo(par1Str); + return var2 != null && var2.getSaveVersion() != this.getSaveVersion(); + } + + /** + * Converts the specified map to the new map format. Args: worldName, loadingScreen + */ + public boolean convertMapFormat(String par1Str, IProgressUpdate par2IProgressUpdate) + { + par2IProgressUpdate.setLoadingProgress(0); + ArrayList var3 = new ArrayList(); + ArrayList var4 = new ArrayList(); + ArrayList var5 = new ArrayList(); + File var6 = new File(this.savesDirectory, par1Str); + File var7 = new File(var6, "DIM-1"); + File var8 = new File(var6, "DIM1"); + MinecraftServer.getServer().getLogAgent().logInfo("Scanning folders..."); + this.addRegionFilesToCollection(var6, var3); + + if (var7.exists()) + { + this.addRegionFilesToCollection(var7, var4); + } + + if (var8.exists()) + { + this.addRegionFilesToCollection(var8, var5); + } + + int var9 = var3.size() + var4.size() + var5.size(); + MinecraftServer.getServer().getLogAgent().logInfo("Total conversion count is " + var9); + WorldInfo var10 = this.getWorldInfo(par1Str); + Object var11 = null; + + if (var10.getTerrainType() == WorldType.FLAT) + { + var11 = new WorldChunkManagerHell(BiomeGenBase.plains, 0.5F, 0.5F); + } + else + { + var11 = new WorldChunkManager(var10.getSeed(), var10.getTerrainType()); + } + + this.convertFile(new File(var6, "region"), var3, (WorldChunkManager)var11, 0, var9, par2IProgressUpdate); + this.convertFile(new File(var7, "region"), var4, new WorldChunkManagerHell(BiomeGenBase.hell, 1.0F, 0.0F), var3.size(), var9, par2IProgressUpdate); + this.convertFile(new File(var8, "region"), var5, new WorldChunkManagerHell(BiomeGenBase.sky, 0.5F, 0.0F), var3.size() + var4.size(), var9, par2IProgressUpdate); + var10.setSaveVersion(19133); + + if (var10.getTerrainType() == WorldType.DEFAULT_1_1) + { + var10.setTerrainType(WorldType.DEFAULT); + } + + this.createFile(par1Str); + ISaveHandler var12 = this.getSaveLoader(par1Str, false); + var12.saveWorldInfo(var10); + return true; + } + + /** + * par: filename for the level.dat_mcr backup + */ + private void createFile(String par1Str) + { + File var2 = new File(this.savesDirectory, par1Str); + + if (!var2.exists()) + { + System.out.println("Warning: Unable to create level.dat_mcr backup"); + } + else + { + File var3 = new File(var2, "level.dat"); + + if (!var3.exists()) + { + System.out.println("Warning: Unable to create level.dat_mcr backup"); + } + else + { + File var4 = new File(var2, "level.dat_mcr"); + + if (!var3.renameTo(var4)) + { + System.out.println("Warning: Unable to create level.dat_mcr backup"); + } + } + } + } + + private void convertFile(File par1File, Iterable par2Iterable, WorldChunkManager par3WorldChunkManager, int par4, int par5, IProgressUpdate par6IProgressUpdate) + { + Iterator var7 = par2Iterable.iterator(); + + while (var7.hasNext()) + { + File var8 = (File)var7.next(); + this.convertChunks(par1File, var8, par3WorldChunkManager, par4, par5, par6IProgressUpdate); + ++par4; + int var9 = (int)Math.round(100.0D * (double)par4 / (double)par5); + par6IProgressUpdate.setLoadingProgress(var9); + } + } + + /** + * copies a 32x32 chunk set from par2File to par1File, via AnvilConverterData + */ + private void convertChunks(File par1File, File par2File, WorldChunkManager par3WorldChunkManager, int par4, int par5, IProgressUpdate par6IProgressUpdate) + { + try + { + String var7 = par2File.getName(); + RegionFile var8 = new RegionFile(par2File); + RegionFile var9 = new RegionFile(new File(par1File, var7.substring(0, var7.length() - ".mcr".length()) + ".mca")); + + for (int var10 = 0; var10 < 32; ++var10) + { + int var11; + + for (var11 = 0; var11 < 32; ++var11) + { + if (var8.isChunkSaved(var10, var11) && !var9.isChunkSaved(var10, var11)) + { + DataInputStream var12 = var8.getChunkDataInputStream(var10, var11); + + if (var12 == null) + { + MinecraftServer.getServer().getLogAgent().logWarning("Failed to fetch input stream"); + } + else + { + NBTTagCompound var13 = CompressedStreamTools.read(var12); + var12.close(); + NBTTagCompound var14 = var13.getCompoundTag("Level"); + AnvilConverterData var15 = ChunkLoader.load(var14); + NBTTagCompound var16 = new NBTTagCompound(); + NBTTagCompound var17 = new NBTTagCompound(); + var16.setTag("Level", var17); + ChunkLoader.convertToAnvilFormat(var15, var17, par3WorldChunkManager); + DataOutputStream var18 = var9.getChunkDataOutputStream(var10, var11); + CompressedStreamTools.write(var16, var18); + var18.close(); + } + } + } + + var11 = (int)Math.round(100.0D * (double)(par4 * 1024) / (double)(par5 * 1024)); + int var20 = (int)Math.round(100.0D * (double)((var10 + 1) * 32 + par4 * 1024) / (double)(par5 * 1024)); + + if (var20 > var11) + { + par6IProgressUpdate.setLoadingProgress(var20); + } + } + + var8.close(); + var9.close(); + } + catch (IOException var19) + { + var19.printStackTrace(); + } + } + + /** + * filters the files in the par1 directory, and adds them to the par2 collections + */ + private void addRegionFilesToCollection(File par1File, Collection par2Collection) + { + File var3 = new File(par1File, "region"); + File[] var4 = var3.listFiles(new AnvilSaveConverterFileFilter(this)); + + if (var4 != null) + { + Collections.addAll(par2Collection, var4); + } + } +} diff --git a/src/main/java/net/minecraft/src/AnvilSaveConverterFileFilter.java b/src/main/java/net/minecraft/src/AnvilSaveConverterFileFilter.java new file mode 100644 index 0000000..184c045 --- /dev/null +++ b/src/main/java/net/minecraft/src/AnvilSaveConverterFileFilter.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.FilenameFilter; + +class AnvilSaveConverterFileFilter implements FilenameFilter +{ + final AnvilSaveConverter parent; + + AnvilSaveConverterFileFilter(AnvilSaveConverter par1AnvilSaveConverter) + { + this.parent = par1AnvilSaveConverter; + } + + public boolean accept(File par1File, String par2Str) + { + return par2Str.endsWith(".mcr"); + } +} diff --git a/src/main/java/net/minecraft/src/AnvilSaveHandler.java b/src/main/java/net/minecraft/src/AnvilSaveHandler.java new file mode 100644 index 0000000..82e976e --- /dev/null +++ b/src/main/java/net/minecraft/src/AnvilSaveHandler.java @@ -0,0 +1,63 @@ +package net.minecraft.src; + +import java.io.File; + +public class AnvilSaveHandler extends SaveHandler +{ + public AnvilSaveHandler(File par1File, String par2Str, boolean par3) + { + super(par1File, par2Str, par3); + } + + /** + * Returns the chunk loader with the provided world provider + */ + public IChunkLoader getChunkLoader(WorldProvider par1WorldProvider) + { + File var2 = this.getWorldDirectory(); + File var3; + + if (par1WorldProvider instanceof WorldProviderHell) + { + var3 = new File(var2, "DIM-1"); + var3.mkdirs(); + return new AnvilChunkLoader(var3); + } + else if (par1WorldProvider instanceof WorldProviderEnd) + { + var3 = new File(var2, "DIM1"); + var3.mkdirs(); + return new AnvilChunkLoader(var3); + } + else + { + return new AnvilChunkLoader(var2); + } + } + + /** + * Saves the given World Info with the given NBTTagCompound as the Player. + */ + public void saveWorldInfoWithPlayer(WorldInfo par1WorldInfo, NBTTagCompound par2NBTTagCompound) + { + par1WorldInfo.setSaveVersion(19133); + super.saveWorldInfoWithPlayer(par1WorldInfo, par2NBTTagCompound); + } + + /** + * Called to flush all changes to disk, waiting for them to complete. + */ + public void flush() + { + try + { + ThreadedFileIOBase.threadedIOInstance.waitForFinish(); + } + catch (InterruptedException var2) + { + var2.printStackTrace(); + } + + RegionFileCache.clearRegionFileReferences(); + } +} diff --git a/src/main/java/net/minecraft/src/Attribute.java b/src/main/java/net/minecraft/src/Attribute.java new file mode 100644 index 0000000..5269ed1 --- /dev/null +++ b/src/main/java/net/minecraft/src/Attribute.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +public interface Attribute +{ + String getAttributeUnlocalizedName(); + + double clampValue(double var1); + + double getDefaultValue(); + + boolean getShouldWatch(); +} diff --git a/src/main/java/net/minecraft/src/AttributeInstance.java b/src/main/java/net/minecraft/src/AttributeInstance.java new file mode 100644 index 0000000..d232ee7 --- /dev/null +++ b/src/main/java/net/minecraft/src/AttributeInstance.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +import java.util.Collection; +import java.util.UUID; + +public interface AttributeInstance +{ + Attribute func_111123_a(); + + double getBaseValue(); + + void setAttribute(double var1); + + Collection func_111122_c(); + + /** + * Returns attribute modifier, if any, by the given UUID + */ + AttributeModifier getModifier(UUID var1); + + void applyModifier(AttributeModifier var1); + + void removeModifier(AttributeModifier var1); + + void func_142049_d(); + + double getAttributeValue(); +} diff --git a/src/main/java/net/minecraft/src/AttributeModifier.java b/src/main/java/net/minecraft/src/AttributeModifier.java new file mode 100644 index 0000000..84b5ef2 --- /dev/null +++ b/src/main/java/net/minecraft/src/AttributeModifier.java @@ -0,0 +1,110 @@ +package net.minecraft.src; + +import java.util.UUID; +import org.apache.commons.lang3.Validate; + +public class AttributeModifier +{ + private final double amount; + private final int operation; + private final String name; + private final UUID id; + + /** + * If false, this modifier is not saved in NBT. Used for "natural" modifiers like speed boost from sprinting + */ + private boolean isSaved; + + public AttributeModifier(String par1Str, double par2, int par4) + { + this(UUID.randomUUID(), par1Str, par2, par4); + } + + public AttributeModifier(UUID par1UUID, String par2Str, double par3, int par5) + { + this.isSaved = true; + this.id = par1UUID; + this.name = par2Str; + this.amount = par3; + this.operation = par5; + Validate.notEmpty(par2Str, "Modifier name cannot be empty", new Object[0]); + Validate.inclusiveBetween(Integer.valueOf(0), Integer.valueOf(2), Integer.valueOf(par5), "Invalid operation", new Object[0]); + } + + public UUID getID() + { + return this.id; + } + + public String getName() + { + return this.name; + } + + public int getOperation() + { + return this.operation; + } + + public double getAmount() + { + return this.amount; + } + + /** + * @see #isSaved + */ + public boolean isSaved() + { + return this.isSaved; + } + + /** + * @see #isSaved + */ + public AttributeModifier setSaved(boolean par1) + { + this.isSaved = par1; + return this; + } + + public boolean equals(Object par1Obj) + { + if (this == par1Obj) + { + return true; + } + else if (par1Obj != null && this.getClass() == par1Obj.getClass()) + { + AttributeModifier var2 = (AttributeModifier)par1Obj; + + if (this.id != null) + { + if (!this.id.equals(var2.id)) + { + return false; + } + } + else if (var2.id != null) + { + return false; + } + + return true; + } + else + { + return false; + } + } + + public int hashCode() + { + return this.id != null ? this.id.hashCode() : 0; + } + + public String toString() + { + return "AttributeModifier{amount=" + this.amount + ", operation=" + this.operation + ", name=\'" + this.name + '\'' + ", id=" + this.id + ", serialize=" + this.isSaved + '}'; + } +} diff --git a/src/main/java/net/minecraft/src/AxisAlignedBB.java b/src/main/java/net/minecraft/src/AxisAlignedBB.java new file mode 100644 index 0000000..0a88346 --- /dev/null +++ b/src/main/java/net/minecraft/src/AxisAlignedBB.java @@ -0,0 +1,489 @@ +package net.minecraft.src; + +public class AxisAlignedBB +{ + /** ThreadLocal AABBPool */ + private static final ThreadLocal theAABBLocalPool = new AABBLocalPool(); + public double minX; + public double minY; + public double minZ; + public double maxX; + public double maxY; + public double maxZ; + + /** + * Returns a bounding box with the specified bounds. Args: minX, minY, minZ, maxX, maxY, maxZ + */ + public static AxisAlignedBB getBoundingBox(double par0, double par2, double par4, double par6, double par8, double par10) + { + return new AxisAlignedBB(par0, par2, par4, par6, par8, par10); + } + + /** + * Gets the ThreadLocal AABBPool + */ + public static AABBPool getAABBPool() + { + return (AABBPool)theAABBLocalPool.get(); + } + + protected AxisAlignedBB(double par1, double par3, double par5, double par7, double par9, double par11) + { + this.minX = par1; + this.minY = par3; + this.minZ = par5; + this.maxX = par7; + this.maxY = par9; + this.maxZ = par11; + } + + /** + * Sets the bounds of the bounding box. Args: minX, minY, minZ, maxX, maxY, maxZ + */ + public AxisAlignedBB setBounds(double par1, double par3, double par5, double par7, double par9, double par11) + { + this.minX = par1; + this.minY = par3; + this.minZ = par5; + this.maxX = par7; + this.maxY = par9; + this.maxZ = par11; + return this; + } + + /** + * Adds the coordinates to the bounding box extending it if the point lies outside the current ranges. Args: x, y, z + */ + public AxisAlignedBB addCoord(double par1, double par3, double par5) + { + double var7 = this.minX; + double var9 = this.minY; + double var11 = this.minZ; + double var13 = this.maxX; + double var15 = this.maxY; + double var17 = this.maxZ; + + if (par1 < 0.0D) + { + var7 += par1; + } + + if (par1 > 0.0D) + { + var13 += par1; + } + + if (par3 < 0.0D) + { + var9 += par3; + } + + if (par3 > 0.0D) + { + var15 += par3; + } + + if (par5 < 0.0D) + { + var11 += par5; + } + + if (par5 > 0.0D) + { + var17 += par5; + } + + return getAABBPool().getAABB(var7, var9, var11, var13, var15, var17); + } + + /** + * Returns a bounding box expanded by the specified vector (if negative numbers are given it will shrink). Args: x, + * y, z + */ + public AxisAlignedBB expand(double par1, double par3, double par5) + { + double var7 = this.minX - par1; + double var9 = this.minY - par3; + double var11 = this.minZ - par5; + double var13 = this.maxX + par1; + double var15 = this.maxY + par3; + double var17 = this.maxZ + par5; + return getAABBPool().getAABB(var7, var9, var11, var13, var15, var17); + } + + public AxisAlignedBB func_111270_a(AxisAlignedBB par1AxisAlignedBB) + { + double var2 = Math.min(this.minX, par1AxisAlignedBB.minX); + double var4 = Math.min(this.minY, par1AxisAlignedBB.minY); + double var6 = Math.min(this.minZ, par1AxisAlignedBB.minZ); + double var8 = Math.max(this.maxX, par1AxisAlignedBB.maxX); + double var10 = Math.max(this.maxY, par1AxisAlignedBB.maxY); + double var12 = Math.max(this.maxZ, par1AxisAlignedBB.maxZ); + return getAABBPool().getAABB(var2, var4, var6, var8, var10, var12); + } + + /** + * Returns a bounding box offseted by the specified vector (if negative numbers are given it will shrink). Args: x, + * y, z + */ + public AxisAlignedBB getOffsetBoundingBox(double par1, double par3, double par5) + { + return getAABBPool().getAABB(this.minX + par1, this.minY + par3, this.minZ + par5, this.maxX + par1, this.maxY + par3, this.maxZ + par5); + } + + /** + * if instance and the argument bounding boxes overlap in the Y and Z dimensions, calculate the offset between them + * in the X dimension. return var2 if the bounding boxes do not overlap or if var2 is closer to 0 then the + * calculated offset. Otherwise return the calculated offset. + */ + public double calculateXOffset(AxisAlignedBB par1AxisAlignedBB, double par2) + { + if (par1AxisAlignedBB.maxY > this.minY && par1AxisAlignedBB.minY < this.maxY) + { + if (par1AxisAlignedBB.maxZ > this.minZ && par1AxisAlignedBB.minZ < this.maxZ) + { + double var4; + + if (par2 > 0.0D && par1AxisAlignedBB.maxX <= this.minX) + { + var4 = this.minX - par1AxisAlignedBB.maxX; + + if (var4 < par2) + { + par2 = var4; + } + } + + if (par2 < 0.0D && par1AxisAlignedBB.minX >= this.maxX) + { + var4 = this.maxX - par1AxisAlignedBB.minX; + + if (var4 > par2) + { + par2 = var4; + } + } + + return par2; + } + else + { + return par2; + } + } + else + { + return par2; + } + } + + /** + * if instance and the argument bounding boxes overlap in the X and Z dimensions, calculate the offset between them + * in the Y dimension. return var2 if the bounding boxes do not overlap or if var2 is closer to 0 then the + * calculated offset. Otherwise return the calculated offset. + */ + public double calculateYOffset(AxisAlignedBB par1AxisAlignedBB, double par2) + { + if (par1AxisAlignedBB.maxX > this.minX && par1AxisAlignedBB.minX < this.maxX) + { + if (par1AxisAlignedBB.maxZ > this.minZ && par1AxisAlignedBB.minZ < this.maxZ) + { + double var4; + + if (par2 > 0.0D && par1AxisAlignedBB.maxY <= this.minY) + { + var4 = this.minY - par1AxisAlignedBB.maxY; + + if (var4 < par2) + { + par2 = var4; + } + } + + if (par2 < 0.0D && par1AxisAlignedBB.minY >= this.maxY) + { + var4 = this.maxY - par1AxisAlignedBB.minY; + + if (var4 > par2) + { + par2 = var4; + } + } + + return par2; + } + else + { + return par2; + } + } + else + { + return par2; + } + } + + /** + * if instance and the argument bounding boxes overlap in the Y and X dimensions, calculate the offset between them + * in the Z dimension. return var2 if the bounding boxes do not overlap or if var2 is closer to 0 then the + * calculated offset. Otherwise return the calculated offset. + */ + public double calculateZOffset(AxisAlignedBB par1AxisAlignedBB, double par2) + { + if (par1AxisAlignedBB.maxX > this.minX && par1AxisAlignedBB.minX < this.maxX) + { + if (par1AxisAlignedBB.maxY > this.minY && par1AxisAlignedBB.minY < this.maxY) + { + double var4; + + if (par2 > 0.0D && par1AxisAlignedBB.maxZ <= this.minZ) + { + var4 = this.minZ - par1AxisAlignedBB.maxZ; + + if (var4 < par2) + { + par2 = var4; + } + } + + if (par2 < 0.0D && par1AxisAlignedBB.minZ >= this.maxZ) + { + var4 = this.maxZ - par1AxisAlignedBB.minZ; + + if (var4 > par2) + { + par2 = var4; + } + } + + return par2; + } + else + { + return par2; + } + } + else + { + return par2; + } + } + + /** + * Returns whether the given bounding box intersects with this one. Args: axisAlignedBB + */ + public boolean intersectsWith(AxisAlignedBB par1AxisAlignedBB) + { + return par1AxisAlignedBB.maxX > this.minX && par1AxisAlignedBB.minX < this.maxX ? (par1AxisAlignedBB.maxY > this.minY && par1AxisAlignedBB.minY < this.maxY ? par1AxisAlignedBB.maxZ > this.minZ && par1AxisAlignedBB.minZ < this.maxZ : false) : false; + } + + /** + * Offsets the current bounding box by the specified coordinates. Args: x, y, z + */ + public AxisAlignedBB offset(double par1, double par3, double par5) + { + this.minX += par1; + this.minY += par3; + this.minZ += par5; + this.maxX += par1; + this.maxY += par3; + this.maxZ += par5; + return this; + } + + /** + * Returns if the supplied Vec3D is completely inside the bounding box + */ + public boolean isVecInside(Vec3 par1Vec3) + { + return par1Vec3.xCoord > this.minX && par1Vec3.xCoord < this.maxX ? (par1Vec3.yCoord > this.minY && par1Vec3.yCoord < this.maxY ? par1Vec3.zCoord > this.minZ && par1Vec3.zCoord < this.maxZ : false) : false; + } + + /** + * Returns the average length of the edges of the bounding box. + */ + public double getAverageEdgeLength() + { + double var1 = this.maxX - this.minX; + double var3 = this.maxY - this.minY; + double var5 = this.maxZ - this.minZ; + return (var1 + var3 + var5) / 3.0D; + } + + /** + * Returns a bounding box that is inset by the specified amounts + */ + public AxisAlignedBB contract(double par1, double par3, double par5) + { + double var7 = this.minX + par1; + double var9 = this.minY + par3; + double var11 = this.minZ + par5; + double var13 = this.maxX - par1; + double var15 = this.maxY - par3; + double var17 = this.maxZ - par5; + return getAABBPool().getAABB(var7, var9, var11, var13, var15, var17); + } + + /** + * Returns a copy of the bounding box. + */ + public AxisAlignedBB copy() + { + return getAABBPool().getAABB(this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ); + } + + public MovingObjectPosition calculateIntercept(Vec3 par1Vec3, Vec3 par2Vec3) + { + Vec3 var3 = par1Vec3.getIntermediateWithXValue(par2Vec3, this.minX); + Vec3 var4 = par1Vec3.getIntermediateWithXValue(par2Vec3, this.maxX); + Vec3 var5 = par1Vec3.getIntermediateWithYValue(par2Vec3, this.minY); + Vec3 var6 = par1Vec3.getIntermediateWithYValue(par2Vec3, this.maxY); + Vec3 var7 = par1Vec3.getIntermediateWithZValue(par2Vec3, this.minZ); + Vec3 var8 = par1Vec3.getIntermediateWithZValue(par2Vec3, this.maxZ); + + if (!this.isVecInYZ(var3)) + { + var3 = null; + } + + if (!this.isVecInYZ(var4)) + { + var4 = null; + } + + if (!this.isVecInXZ(var5)) + { + var5 = null; + } + + if (!this.isVecInXZ(var6)) + { + var6 = null; + } + + if (!this.isVecInXY(var7)) + { + var7 = null; + } + + if (!this.isVecInXY(var8)) + { + var8 = null; + } + + Vec3 var9 = null; + + if (var3 != null && (var9 == null || par1Vec3.squareDistanceTo(var3) < par1Vec3.squareDistanceTo(var9))) + { + var9 = var3; + } + + if (var4 != null && (var9 == null || par1Vec3.squareDistanceTo(var4) < par1Vec3.squareDistanceTo(var9))) + { + var9 = var4; + } + + if (var5 != null && (var9 == null || par1Vec3.squareDistanceTo(var5) < par1Vec3.squareDistanceTo(var9))) + { + var9 = var5; + } + + if (var6 != null && (var9 == null || par1Vec3.squareDistanceTo(var6) < par1Vec3.squareDistanceTo(var9))) + { + var9 = var6; + } + + if (var7 != null && (var9 == null || par1Vec3.squareDistanceTo(var7) < par1Vec3.squareDistanceTo(var9))) + { + var9 = var7; + } + + if (var8 != null && (var9 == null || par1Vec3.squareDistanceTo(var8) < par1Vec3.squareDistanceTo(var9))) + { + var9 = var8; + } + + if (var9 == null) + { + return null; + } + else + { + byte var10 = -1; + + if (var9 == var3) + { + var10 = 4; + } + + if (var9 == var4) + { + var10 = 5; + } + + if (var9 == var5) + { + var10 = 0; + } + + if (var9 == var6) + { + var10 = 1; + } + + if (var9 == var7) + { + var10 = 2; + } + + if (var9 == var8) + { + var10 = 3; + } + + return new MovingObjectPosition(0, 0, 0, var10, var9); + } + } + + /** + * Checks if the specified vector is within the YZ dimensions of the bounding box. Args: Vec3D + */ + private boolean isVecInYZ(Vec3 par1Vec3) + { + return par1Vec3 == null ? false : par1Vec3.yCoord >= this.minY && par1Vec3.yCoord <= this.maxY && par1Vec3.zCoord >= this.minZ && par1Vec3.zCoord <= this.maxZ; + } + + /** + * Checks if the specified vector is within the XZ dimensions of the bounding box. Args: Vec3D + */ + private boolean isVecInXZ(Vec3 par1Vec3) + { + return par1Vec3 == null ? false : par1Vec3.xCoord >= this.minX && par1Vec3.xCoord <= this.maxX && par1Vec3.zCoord >= this.minZ && par1Vec3.zCoord <= this.maxZ; + } + + /** + * Checks if the specified vector is within the XY dimensions of the bounding box. Args: Vec3D + */ + private boolean isVecInXY(Vec3 par1Vec3) + { + return par1Vec3 == null ? false : par1Vec3.xCoord >= this.minX && par1Vec3.xCoord <= this.maxX && par1Vec3.yCoord >= this.minY && par1Vec3.yCoord <= this.maxY; + } + + /** + * Sets the bounding box to the same bounds as the bounding box passed in. Args: axisAlignedBB + */ + public void setBB(AxisAlignedBB par1AxisAlignedBB) + { + this.minX = par1AxisAlignedBB.minX; + this.minY = par1AxisAlignedBB.minY; + this.minZ = par1AxisAlignedBB.minZ; + this.maxX = par1AxisAlignedBB.maxX; + this.maxY = par1AxisAlignedBB.maxY; + this.maxZ = par1AxisAlignedBB.maxZ; + } + + public String toString() + { + return "box[" + this.minX + ", " + this.minY + ", " + this.minZ + " -> " + this.maxX + ", " + this.maxY + ", " + this.maxZ + "]"; + } +} diff --git a/src/main/java/net/minecraft/src/Backup.java b/src/main/java/net/minecraft/src/Backup.java new file mode 100644 index 0000000..7ad58ef --- /dev/null +++ b/src/main/java/net/minecraft/src/Backup.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import argo.jdom.JsonNode; +import java.util.Date; + +public class Backup extends ValueObject +{ + public String field_110727_a; + public Date field_110725_b; + public long field_110726_c; + + public static Backup func_110724_a(JsonNode par0JsonNode) + { + Backup var1 = new Backup(); + + try + { + var1.field_110727_a = par0JsonNode.getStringValue(new Object[] {"backupId"}); + var1.field_110725_b = new Date(Long.parseLong(par0JsonNode.getNumberValue(new Object[] {"lastModifiedDate"}))); + var1.field_110726_c = Long.parseLong(par0JsonNode.getNumberValue(new Object[] {"size"})); + } + catch (IllegalArgumentException var3) + { + ; + } + + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/BackupList.java b/src/main/java/net/minecraft/src/BackupList.java new file mode 100644 index 0000000..5e2d560 --- /dev/null +++ b/src/main/java/net/minecraft/src/BackupList.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +import argo.jdom.JdomParser; +import argo.jdom.JsonNode; +import argo.jdom.JsonRootNode; +import argo.saj.InvalidSyntaxException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class BackupList +{ + public List field_111223_a; + + public static BackupList func_111222_a(String par0Str) + { + BackupList var1 = new BackupList(); + var1.field_111223_a = new ArrayList(); + + try + { + JsonRootNode var2 = (new JdomParser()).parse(par0Str); + + if (var2.isArrayNode(new Object[] {"backups"})) + { + Iterator var3 = var2.getArrayNode(new Object[] {"backups"}).iterator(); + + while (var3.hasNext()) + { + JsonNode var4 = (JsonNode)var3.next(); + var1.field_111223_a.add(Backup.func_110724_a(var4)); + } + } + } + catch (InvalidSyntaxException var5) + { + ; + } + catch (IllegalArgumentException var6) + { + ; + } + + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/BanEntry.java b/src/main/java/net/minecraft/src/BanEntry.java new file mode 100644 index 0000000..bcbaa53 --- /dev/null +++ b/src/main/java/net/minecraft/src/BanEntry.java @@ -0,0 +1,170 @@ +package net.minecraft.src; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.regex.Pattern; +import net.minecraft.server.MinecraftServer; + +public class BanEntry +{ + public static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"); + private final String username; + private Date banStartDate = new Date(); + private String bannedBy = "(Unknown)"; + private Date banEndDate; + private String reason = "Banned by an operator."; + + public BanEntry(String par1Str) + { + this.username = par1Str; + } + + public String getBannedUsername() + { + return this.username; + } + + public Date getBanStartDate() + { + return this.banStartDate; + } + + /** + * null == start ban now + */ + public void setBanStartDate(Date par1Date) + { + this.banStartDate = par1Date != null ? par1Date : new Date(); + } + + public String getBannedBy() + { + return this.bannedBy; + } + + public void setBannedBy(String par1Str) + { + this.bannedBy = par1Str; + } + + public Date getBanEndDate() + { + return this.banEndDate; + } + + public void setBanEndDate(Date par1Date) + { + this.banEndDate = par1Date; + } + + public boolean hasBanExpired() + { + return this.banEndDate == null ? false : this.banEndDate.before(new Date()); + } + + public String getBanReason() + { + return this.reason; + } + + public void setBanReason(String par1Str) + { + this.reason = par1Str; + } + + public String buildBanString() + { + StringBuilder var1 = new StringBuilder(); + var1.append(this.getBannedUsername()); + var1.append("|"); + var1.append(dateFormat.format(this.getBanStartDate())); + var1.append("|"); + var1.append(this.getBannedBy()); + var1.append("|"); + var1.append(this.getBanEndDate() == null ? "Forever" : dateFormat.format(this.getBanEndDate())); + var1.append("|"); + var1.append(this.getBanReason()); + return var1.toString(); + } + + public static BanEntry parse(String par0Str) + { + if (par0Str.trim().length() < 2) + { + return null; + } + else + { + String[] var1 = par0Str.trim().split(Pattern.quote("|"), 5); + BanEntry var2 = new BanEntry(var1[0].trim()); + byte var3 = 0; + int var10000 = var1.length; + int var7 = var3 + 1; + + if (var10000 <= var7) + { + return var2; + } + else + { + try + { + var2.setBanStartDate(dateFormat.parse(var1[var7].trim())); + } + catch (ParseException var6) + { + MinecraftServer.getServer().getLogAgent().logWarningException("Could not read creation date format for ban entry \'" + var2.getBannedUsername() + "\' (was: \'" + var1[var7] + "\')", var6); + } + + var10000 = var1.length; + ++var7; + + if (var10000 <= var7) + { + return var2; + } + else + { + var2.setBannedBy(var1[var7].trim()); + var10000 = var1.length; + ++var7; + + if (var10000 <= var7) + { + return var2; + } + else + { + try + { + String var4 = var1[var7].trim(); + + if (!var4.equalsIgnoreCase("Forever") && var4.length() > 0) + { + var2.setBanEndDate(dateFormat.parse(var4)); + } + } + catch (ParseException var5) + { + MinecraftServer.getServer().getLogAgent().logWarningException("Could not read expiry date format for ban entry \'" + var2.getBannedUsername() + "\' (was: \'" + var1[var7] + "\')", var5); + } + + var10000 = var1.length; + ++var7; + + if (var10000 <= var7) + { + return var2; + } + else + { + var2.setBanReason(var1[var7].trim()); + return var2; + } + } + } + } + } + } +} diff --git a/src/main/java/net/minecraft/src/BanList.java b/src/main/java/net/minecraft/src/BanList.java new file mode 100644 index 0000000..6920696 --- /dev/null +++ b/src/main/java/net/minecraft/src/BanList.java @@ -0,0 +1,168 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Iterator; +import java.util.Map; +import net.minecraft.server.MinecraftServer; + +public class BanList +{ + private final LowerStringMap theBanList = new LowerStringMap(); + private final File fileName; + + /** set to true if not singlePlayer */ + private boolean listActive = true; + + public BanList(File par1File) + { + this.fileName = par1File; + } + + public boolean isListActive() + { + return this.listActive; + } + + public void setListActive(boolean par1) + { + this.listActive = par1; + } + + /** + * removes expired Bans before returning + */ + public Map getBannedList() + { + this.removeExpiredBans(); + return this.theBanList; + } + + public boolean isBanned(String par1Str) + { + if (!this.isListActive()) + { + return false; + } + else + { + this.removeExpiredBans(); + return this.theBanList.containsKey(par1Str); + } + } + + public void put(BanEntry par1BanEntry) + { + this.theBanList.putLower(par1BanEntry.getBannedUsername(), par1BanEntry); + this.saveToFileWithHeader(); + } + + public void remove(String par1Str) + { + this.theBanList.remove(par1Str); + this.saveToFileWithHeader(); + } + + public void removeExpiredBans() + { + Iterator var1 = this.theBanList.values().iterator(); + + while (var1.hasNext()) + { + BanEntry var2 = (BanEntry)var1.next(); + + if (var2.hasBanExpired()) + { + var1.remove(); + } + } + } + + /** + * Loads the ban list from the file (adds every entry, does not clear the current list). + */ + public void loadBanList() + { + if (this.fileName.isFile()) + { + BufferedReader var1; + + try + { + var1 = new BufferedReader(new FileReader(this.fileName)); + } + catch (FileNotFoundException var4) + { + throw new Error(); + } + + String var2; + + try + { + while ((var2 = var1.readLine()) != null) + { + if (!var2.startsWith("#")) + { + BanEntry var3 = BanEntry.parse(var2); + + if (var3 != null) + { + this.theBanList.putLower(var3.getBannedUsername(), var3); + } + } + } + } + catch (IOException var5) + { + MinecraftServer.getServer().getLogAgent().logSevereException("Could not load ban list", var5); + } + } + } + + public void saveToFileWithHeader() + { + this.saveToFile(true); + } + + /** + * par1: include header + */ + public void saveToFile(boolean par1) + { + this.removeExpiredBans(); + + try + { + PrintWriter var2 = new PrintWriter(new FileWriter(this.fileName, false)); + + if (par1) + { + var2.println("# Updated " + (new SimpleDateFormat()).format(new Date()) + " by Minecraft " + "1.6.4"); + var2.println("# victim name | ban date | banned by | banned until | reason"); + var2.println(); + } + + Iterator var3 = this.theBanList.values().iterator(); + + while (var3.hasNext()) + { + BanEntry var4 = (BanEntry)var3.next(); + var2.println(var4.buildBanString()); + } + + var2.close(); + } + catch (IOException var5) + { + MinecraftServer.getServer().getLogAgent().logSevereException("Could not save ban list", var5); + } + } +} diff --git a/src/main/java/net/minecraft/src/BaseAttribute.java b/src/main/java/net/minecraft/src/BaseAttribute.java new file mode 100644 index 0000000..9163079 --- /dev/null +++ b/src/main/java/net/minecraft/src/BaseAttribute.java @@ -0,0 +1,45 @@ +package net.minecraft.src; + +public abstract class BaseAttribute implements Attribute +{ + private final String field_111115_a; + private final double defaultValue; + private boolean shouldWatch; + + protected BaseAttribute(String par1Str, double par2) + { + this.field_111115_a = par1Str; + this.defaultValue = par2; + + if (par1Str == null) + { + throw new IllegalArgumentException("Name cannot be null!"); + } + } + + public String getAttributeUnlocalizedName() + { + return this.field_111115_a; + } + + public double getDefaultValue() + { + return this.defaultValue; + } + + public boolean getShouldWatch() + { + return this.shouldWatch; + } + + public BaseAttribute setShouldWatch(boolean par1) + { + this.shouldWatch = par1; + return this; + } + + public int hashCode() + { + return this.field_111115_a.hashCode(); + } +} diff --git a/src/main/java/net/minecraft/src/BaseAttributeMap.java b/src/main/java/net/minecraft/src/BaseAttributeMap.java new file mode 100644 index 0000000..2a769e6 --- /dev/null +++ b/src/main/java/net/minecraft/src/BaseAttributeMap.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +import com.google.common.collect.Multimap; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + +public abstract class BaseAttributeMap +{ + protected final Map attributes = new HashMap(); + protected final Map attributesByName = new LowerStringMap(); + + public AttributeInstance getAttributeInstance(Attribute par1Attribute) + { + return (AttributeInstance)this.attributes.get(par1Attribute); + } + + public AttributeInstance getAttributeInstanceByName(String par1Str) + { + return (AttributeInstance)this.attributesByName.get(par1Str); + } + + public abstract AttributeInstance func_111150_b(Attribute var1); + + public Collection getAllAttributes() + { + return this.attributesByName.values(); + } + + public void func_111149_a(ModifiableAttributeInstance par1ModifiableAttributeInstance) {} + + public void removeAttributeModifiers(Multimap par1Multimap) + { + Iterator var2 = par1Multimap.entries().iterator(); + + while (var2.hasNext()) + { + Entry var3 = (Entry)var2.next(); + AttributeInstance var4 = this.getAttributeInstanceByName((String)var3.getKey()); + + if (var4 != null) + { + var4.removeModifier((AttributeModifier)var3.getValue()); + } + } + } + + public void applyAttributeModifiers(Multimap par1Multimap) + { + Iterator var2 = par1Multimap.entries().iterator(); + + while (var2.hasNext()) + { + Entry var3 = (Entry)var2.next(); + AttributeInstance var4 = this.getAttributeInstanceByName((String)var3.getKey()); + + if (var4 != null) + { + var4.removeModifier((AttributeModifier)var3.getValue()); + var4.applyModifier((AttributeModifier)var3.getValue()); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/BaseMetadataSectionSerializer.java b/src/main/java/net/minecraft/src/BaseMetadataSectionSerializer.java new file mode 100644 index 0000000..260d451 --- /dev/null +++ b/src/main/java/net/minecraft/src/BaseMetadataSectionSerializer.java @@ -0,0 +1,161 @@ +package net.minecraft.src; + +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; + +public abstract class BaseMetadataSectionSerializer implements MetadataSectionSerializer +{ + protected float func_110487_a(JsonElement par1JsonElement, String par2Str, Float par3, float par4, float par5) + { + par2Str = this.getSectionName() + "->" + par2Str; + + if (par1JsonElement == null) + { + if (par3 == null) + { + throw new JsonParseException("Missing " + par2Str + ": expected float"); + } + else + { + return par3.floatValue(); + } + } + else if (!par1JsonElement.isJsonPrimitive()) + { + throw new JsonParseException("Invalid " + par2Str + ": expected float, was " + par1JsonElement); + } + else + { + try + { + float var6 = par1JsonElement.getAsFloat(); + + if (var6 < par4) + { + throw new JsonParseException("Invalid " + par2Str + ": expected float >= " + par4 + ", was " + var6); + } + else if (var6 > par5) + { + throw new JsonParseException("Invalid " + par2Str + ": expected float <= " + par5 + ", was " + var6); + } + else + { + return var6; + } + } + catch (NumberFormatException var7) + { + throw new JsonParseException("Invalid " + par2Str + ": expected float, was " + par1JsonElement, var7); + } + } + } + + protected int func_110485_a(JsonElement par1JsonElement, String par2Str, Integer par3, int par4, int par5) + { + par2Str = this.getSectionName() + "->" + par2Str; + + if (par1JsonElement == null) + { + if (par3 == null) + { + throw new JsonParseException("Missing " + par2Str + ": expected int"); + } + else + { + return par3.intValue(); + } + } + else if (!par1JsonElement.isJsonPrimitive()) + { + throw new JsonParseException("Invalid " + par2Str + ": expected int, was " + par1JsonElement); + } + else + { + try + { + int var6 = par1JsonElement.getAsInt(); + + if (var6 < par4) + { + throw new JsonParseException("Invalid " + par2Str + ": expected int >= " + par4 + ", was " + var6); + } + else if (var6 > par5) + { + throw new JsonParseException("Invalid " + par2Str + ": expected int <= " + par5 + ", was " + var6); + } + else + { + return var6; + } + } + catch (NumberFormatException var7) + { + throw new JsonParseException("Invalid " + par2Str + ": expected int, was " + par1JsonElement, var7); + } + } + } + + protected String func_110486_a(JsonElement par1JsonElement, String par2Str, String par3Str, int par4, int par5) + { + par2Str = this.getSectionName() + "->" + par2Str; + + if (par1JsonElement == null) + { + if (par3Str == null) + { + throw new JsonParseException("Missing " + par2Str + ": expected string"); + } + else + { + return par3Str; + } + } + else if (!par1JsonElement.isJsonPrimitive()) + { + throw new JsonParseException("Invalid " + par2Str + ": expected string, was " + par1JsonElement); + } + else + { + String var6 = par1JsonElement.getAsString(); + + if (var6.length() < par4) + { + throw new JsonParseException("Invalid " + par2Str + ": expected string length >= " + par4 + ", was " + var6); + } + else if (var6.length() > par5) + { + throw new JsonParseException("Invalid " + par2Str + ": expected string length <= " + par5 + ", was " + var6); + } + else + { + return var6; + } + } + } + + protected boolean func_110484_a(JsonElement par1JsonElement, String par2Str, Boolean par3) + { + par2Str = this.getSectionName() + "->" + par2Str; + + if (par1JsonElement == null) + { + if (par3 == null) + { + throw new JsonParseException("Missing " + par2Str + ": expected boolean"); + } + else + { + return par3.booleanValue(); + } + } + else if (!par1JsonElement.isJsonPrimitive()) + { + throw new JsonParseException("Invalid " + par2Str + ": expected boolean, was " + par1JsonElement); + } + else + { + boolean var4 = par1JsonElement.getAsBoolean(); + return var4; + } + } +} diff --git a/src/main/java/net/minecraft/src/BehaviorDefaultDispenseItem.java b/src/main/java/net/minecraft/src/BehaviorDefaultDispenseItem.java new file mode 100644 index 0000000..c54e9b1 --- /dev/null +++ b/src/main/java/net/minecraft/src/BehaviorDefaultDispenseItem.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +public class BehaviorDefaultDispenseItem implements IBehaviorDispenseItem +{ + /** + * Dispenses the specified ItemStack from a dispenser. + */ + public final ItemStack dispense(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + ItemStack var3 = this.dispenseStack(par1IBlockSource, par2ItemStack); + this.playDispenseSound(par1IBlockSource); + this.spawnDispenseParticles(par1IBlockSource, BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata())); + return var3; + } + + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + IPosition var4 = BlockDispenser.getIPositionFromBlockSource(par1IBlockSource); + ItemStack var5 = par2ItemStack.splitStack(1); + doDispense(par1IBlockSource.getWorld(), var5, 6, var3, var4); + return par2ItemStack; + } + + public static void doDispense(World par0World, ItemStack par1ItemStack, int par2, EnumFacing par3EnumFacing, IPosition par4IPosition) + { + double var5 = par4IPosition.getX(); + double var7 = par4IPosition.getY(); + double var9 = par4IPosition.getZ(); + EntityItem var11 = new EntityItem(par0World, var5, var7 - 0.3D, var9, par1ItemStack); + double var12 = par0World.rand.nextDouble() * 0.1D + 0.2D; + var11.motionX = (double)par3EnumFacing.getFrontOffsetX() * var12; + var11.motionY = 0.20000000298023224D; + var11.motionZ = (double)par3EnumFacing.getFrontOffsetZ() * var12; + var11.motionX += par0World.rand.nextGaussian() * 0.007499999832361937D * (double)par2; + var11.motionY += par0World.rand.nextGaussian() * 0.007499999832361937D * (double)par2; + var11.motionZ += par0World.rand.nextGaussian() * 0.007499999832361937D * (double)par2; + par0World.spawnEntityInWorld(var11); + } + + /** + * Play the dispense sound from the specified block. + */ + protected void playDispenseSound(IBlockSource par1IBlockSource) + { + par1IBlockSource.getWorld().playAuxSFX(1000, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0); + } + + /** + * Order clients to display dispense particles from the specified block and facing. + */ + protected void spawnDispenseParticles(IBlockSource par1IBlockSource, EnumFacing par2EnumFacing) + { + par1IBlockSource.getWorld().playAuxSFX(2000, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), this.func_82488_a(par2EnumFacing)); + } + + private int func_82488_a(EnumFacing par1EnumFacing) + { + return par1EnumFacing.getFrontOffsetX() + 1 + (par1EnumFacing.getFrontOffsetZ() + 1) * 3; + } +} diff --git a/src/main/java/net/minecraft/src/BehaviorDispenseArmor.java b/src/main/java/net/minecraft/src/BehaviorDispenseArmor.java new file mode 100644 index 0000000..36e3662 --- /dev/null +++ b/src/main/java/net/minecraft/src/BehaviorDispenseArmor.java @@ -0,0 +1,41 @@ +package net.minecraft.src; + +import java.util.List; + +final class BehaviorDispenseArmor extends BehaviorDefaultDispenseItem +{ + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + int var4 = par1IBlockSource.getXInt() + var3.getFrontOffsetX(); + int var5 = par1IBlockSource.getYInt() + var3.getFrontOffsetY(); + int var6 = par1IBlockSource.getZInt() + var3.getFrontOffsetZ(); + AxisAlignedBB var7 = AxisAlignedBB.getAABBPool().getAABB((double)var4, (double)var5, (double)var6, (double)(var4 + 1), (double)(var5 + 1), (double)(var6 + 1)); + List var8 = par1IBlockSource.getWorld().selectEntitiesWithinAABB(EntityLivingBase.class, var7, new EntitySelectorArmoredMob(par2ItemStack)); + + if (var8.size() > 0) + { + EntityLivingBase var9 = (EntityLivingBase)var8.get(0); + int var10 = var9 instanceof EntityPlayer ? 1 : 0; + int var11 = EntityLiving.getArmorPosition(par2ItemStack); + ItemStack var12 = par2ItemStack.copy(); + var12.stackSize = 1; + var9.setCurrentItemOrArmor(var11 - var10, var12); + + if (var9 instanceof EntityLiving) + { + ((EntityLiving)var9).setEquipmentDropChance(var11, 2.0F); + } + + --par2ItemStack.stackSize; + return par2ItemStack; + } + else + { + return super.dispenseStack(par1IBlockSource, par2ItemStack); + } + } +} diff --git a/src/main/java/net/minecraft/src/BehaviorDispenseItemProvider.java b/src/main/java/net/minecraft/src/BehaviorDispenseItemProvider.java new file mode 100644 index 0000000..78755d4 --- /dev/null +++ b/src/main/java/net/minecraft/src/BehaviorDispenseItemProvider.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +final class BehaviorDispenseItemProvider implements IBehaviorDispenseItem +{ + /** + * Dispenses the specified ItemStack from a dispenser. + */ + public ItemStack dispense(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + return par2ItemStack; + } +} diff --git a/src/main/java/net/minecraft/src/BehaviorDispenseMinecart.java b/src/main/java/net/minecraft/src/BehaviorDispenseMinecart.java new file mode 100644 index 0000000..e9630f5 --- /dev/null +++ b/src/main/java/net/minecraft/src/BehaviorDispenseMinecart.java @@ -0,0 +1,56 @@ +package net.minecraft.src; + +final class BehaviorDispenseMinecart extends BehaviorDefaultDispenseItem +{ + private final BehaviorDefaultDispenseItem behaviourDefaultDispenseItem = new BehaviorDefaultDispenseItem(); + + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + World var4 = par1IBlockSource.getWorld(); + double var5 = par1IBlockSource.getX() + (double)((float)var3.getFrontOffsetX() * 1.125F); + double var7 = par1IBlockSource.getY() + (double)((float)var3.getFrontOffsetY() * 1.125F); + double var9 = par1IBlockSource.getZ() + (double)((float)var3.getFrontOffsetZ() * 1.125F); + int var11 = par1IBlockSource.getXInt() + var3.getFrontOffsetX(); + int var12 = par1IBlockSource.getYInt() + var3.getFrontOffsetY(); + int var13 = par1IBlockSource.getZInt() + var3.getFrontOffsetZ(); + int var14 = var4.getBlockId(var11, var12, var13); + double var15; + + if (BlockRailBase.isRailBlock(var14)) + { + var15 = 0.0D; + } + else + { + if (var14 != 0 || !BlockRailBase.isRailBlock(var4.getBlockId(var11, var12 - 1, var13))) + { + return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack); + } + + var15 = -1.0D; + } + + EntityMinecart var17 = EntityMinecart.createMinecart(var4, var5, var7 + var15, var9, ((ItemMinecart)par2ItemStack.getItem()).minecartType); + + if (par2ItemStack.hasDisplayName()) + { + var17.setMinecartName(par2ItemStack.getDisplayName()); + } + + var4.spawnEntityInWorld(var17); + par2ItemStack.splitStack(1); + return par2ItemStack; + } + + /** + * Play the dispense sound from the specified block. + */ + protected void playDispenseSound(IBlockSource par1IBlockSource) + { + par1IBlockSource.getWorld().playAuxSFX(1000, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0); + } +} diff --git a/src/main/java/net/minecraft/src/BehaviorProjectileDispense.java b/src/main/java/net/minecraft/src/BehaviorProjectileDispense.java new file mode 100644 index 0000000..1ac7fef --- /dev/null +++ b/src/main/java/net/minecraft/src/BehaviorProjectileDispense.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +public abstract class BehaviorProjectileDispense extends BehaviorDefaultDispenseItem +{ + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + World var3 = par1IBlockSource.getWorld(); + IPosition var4 = BlockDispenser.getIPositionFromBlockSource(par1IBlockSource); + EnumFacing var5 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + IProjectile var6 = this.getProjectileEntity(var3, var4); + var6.setThrowableHeading((double)var5.getFrontOffsetX(), (double)((float)var5.getFrontOffsetY() + 0.1F), (double)var5.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a()); + var3.spawnEntityInWorld((Entity)var6); + par2ItemStack.splitStack(1); + return par2ItemStack; + } + + /** + * Play the dispense sound from the specified block. + */ + protected void playDispenseSound(IBlockSource par1IBlockSource) + { + par1IBlockSource.getWorld().playAuxSFX(1002, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0); + } + + /** + * Return the projectile entity spawned by this dispense behavior. + */ + protected abstract IProjectile getProjectileEntity(World var1, IPosition var2); + + protected float func_82498_a() + { + return 6.0F; + } + + protected float func_82500_b() + { + return 1.1F; + } +} diff --git a/src/main/java/net/minecraft/src/BiomeCache.java b/src/main/java/net/minecraft/src/BiomeCache.java new file mode 100644 index 0000000..4a51f69 --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeCache.java @@ -0,0 +1,99 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class BiomeCache +{ + /** Reference to the WorldChunkManager */ + private final WorldChunkManager chunkManager; + + /** The last time this BiomeCache was cleaned, in milliseconds. */ + private long lastCleanupTime; + + /** + * The map of keys to BiomeCacheBlocks. Keys are based on the chunk x, z coordinates as (x | z << 32). + */ + private LongHashMap cacheMap = new LongHashMap(); + + /** The list of cached BiomeCacheBlocks */ + private List cache = new ArrayList(); + + public BiomeCache(WorldChunkManager par1WorldChunkManager) + { + this.chunkManager = par1WorldChunkManager; + } + + /** + * Returns a biome cache block at location specified. + */ + public BiomeCacheBlock getBiomeCacheBlock(int par1, int par2) + { + par1 >>= 4; + par2 >>= 4; + long var3 = (long)par1 & 4294967295L | ((long)par2 & 4294967295L) << 32; + BiomeCacheBlock var5 = (BiomeCacheBlock)this.cacheMap.getValueByKey(var3); + + if (var5 == null) + { + var5 = new BiomeCacheBlock(this, par1, par2); + this.cacheMap.add(var3, var5); + this.cache.add(var5); + } + + var5.lastAccessTime = MinecraftServer.getSystemTimeMillis(); + return var5; + } + + /** + * Returns the BiomeGenBase related to the x, z position from the cache. + */ + public BiomeGenBase getBiomeGenAt(int par1, int par2) + { + return this.getBiomeCacheBlock(par1, par2).getBiomeGenAt(par1, par2); + } + + /** + * Removes BiomeCacheBlocks from this cache that haven't been accessed in at least 30 seconds. + */ + public void cleanupCache() + { + long var1 = MinecraftServer.getSystemTimeMillis(); + long var3 = var1 - this.lastCleanupTime; + + if (var3 > 7500L || var3 < 0L) + { + this.lastCleanupTime = var1; + + for (int var5 = 0; var5 < this.cache.size(); ++var5) + { + BiomeCacheBlock var6 = (BiomeCacheBlock)this.cache.get(var5); + long var7 = var1 - var6.lastAccessTime; + + if (var7 > 30000L || var7 < 0L) + { + this.cache.remove(var5--); + long var9 = (long)var6.xPosition & 4294967295L | ((long)var6.zPosition & 4294967295L) << 32; + this.cacheMap.remove(var9); + } + } + } + } + + /** + * Returns the array of cached biome types in the BiomeCacheBlock at the given location. + */ + public BiomeGenBase[] getCachedBiomes(int par1, int par2) + { + return this.getBiomeCacheBlock(par1, par2).biomes; + } + + /** + * Get the world chunk manager object for a biome list. + */ + static WorldChunkManager getChunkManager(BiomeCache par0BiomeCache) + { + return par0BiomeCache.chunkManager; + } +} diff --git a/src/main/java/net/minecraft/src/BiomeCacheBlock.java b/src/main/java/net/minecraft/src/BiomeCacheBlock.java new file mode 100644 index 0000000..837ae98 --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeCacheBlock.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +public class BiomeCacheBlock +{ + /** An array of chunk temperatures saved by this cache. */ + public float[] temperatureValues; + + /** An array of chunk rainfall values saved by this cache. */ + public float[] rainfallValues; + + /** The array of biome types stored in this BiomeCacheBlock. */ + public BiomeGenBase[] biomes; + + /** The x coordinate of the BiomeCacheBlock. */ + public int xPosition; + + /** The z coordinate of the BiomeCacheBlock. */ + public int zPosition; + + /** The last time this BiomeCacheBlock was accessed, in milliseconds. */ + public long lastAccessTime; + + /** The BiomeCache object that contains this BiomeCacheBlock */ + final BiomeCache theBiomeCache; + + public BiomeCacheBlock(BiomeCache par1BiomeCache, int par2, int par3) + { + this.theBiomeCache = par1BiomeCache; + this.temperatureValues = new float[256]; + this.rainfallValues = new float[256]; + this.biomes = new BiomeGenBase[256]; + this.xPosition = par2; + this.zPosition = par3; + BiomeCache.getChunkManager(par1BiomeCache).getTemperatures(this.temperatureValues, par2 << 4, par3 << 4, 16, 16); + BiomeCache.getChunkManager(par1BiomeCache).getRainfall(this.rainfallValues, par2 << 4, par3 << 4, 16, 16); + BiomeCache.getChunkManager(par1BiomeCache).getBiomeGenAt(this.biomes, par2 << 4, par3 << 4, 16, 16, false); + } + + /** + * Returns the BiomeGenBase related to the x, z position from the cache block. + */ + public BiomeGenBase getBiomeGenAt(int par1, int par2) + { + return this.biomes[par1 & 15 | (par2 & 15) << 4]; + } +} diff --git a/src/main/java/net/minecraft/src/BiomeDecorator.java b/src/main/java/net/minecraft/src/BiomeDecorator.java new file mode 100644 index 0000000..3c2a50b --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeDecorator.java @@ -0,0 +1,416 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BiomeDecorator +{ + /** The world the BiomeDecorator is currently decorating */ + protected World currentWorld; + + /** The Biome Decorator's random number generator. */ + protected Random randomGenerator; + + /** The X-coordinate of the chunk currently being decorated */ + protected int chunk_X; + + /** The Z-coordinate of the chunk currently being decorated */ + protected int chunk_Z; + + /** The biome generator object. */ + protected BiomeGenBase biome; + + /** The clay generator. */ + protected WorldGenerator clayGen = new WorldGenClay(4); + + /** The sand generator. */ + protected WorldGenerator sandGen; + + /** The gravel generator. */ + protected WorldGenerator gravelAsSandGen; + + /** The dirt generator. */ + protected WorldGenerator dirtGen; + protected WorldGenerator gravelGen; + protected WorldGenerator coalGen; + protected WorldGenerator ironGen; + + /** Field that holds gold WorldGenMinable */ + protected WorldGenerator goldGen; + + /** Field that holds redstone WorldGenMinable */ + protected WorldGenerator redstoneGen; + + /** Field that holds diamond WorldGenMinable */ + protected WorldGenerator diamondGen; + + /** Field that holds Lapis WorldGenMinable */ + protected WorldGenerator lapisGen; + + /** Field that holds one of the plantYellow WorldGenFlowers */ + protected WorldGenerator plantYellowGen; + + /** Field that holds one of the plantRed WorldGenFlowers */ + protected WorldGenerator plantRedGen; + + /** Field that holds mushroomBrown WorldGenFlowers */ + protected WorldGenerator mushroomBrownGen; + + /** Field that holds mushroomRed WorldGenFlowers */ + protected WorldGenerator mushroomRedGen; + + /** Field that holds big mushroom generator */ + protected WorldGenerator bigMushroomGen; + + /** Field that holds WorldGenReed */ + protected WorldGenerator reedGen; + + /** Field that holds WorldGenCactus */ + protected WorldGenerator cactusGen; + + /** The water lily generation! */ + protected WorldGenerator waterlilyGen; + + /** Amount of waterlilys per chunk. */ + protected int waterlilyPerChunk; + + /** + * The number of trees to attempt to generate per chunk. Up to 10 in forests, none in deserts. + */ + protected int treesPerChunk; + + /** + * The number of yellow flower patches to generate per chunk. The game generates much less than this number, since + * it attempts to generate them at a random altitude. + */ + protected int flowersPerChunk; + + /** The amount of tall grass to generate per chunk. */ + protected int grassPerChunk; + + /** + * The number of dead bushes to generate per chunk. Used in deserts and swamps. + */ + protected int deadBushPerChunk; + + /** + * The number of extra mushroom patches per chunk. It generates 1/4 this number in brown mushroom patches, and 1/8 + * this number in red mushroom patches. These mushrooms go beyond the default base number of mushrooms. + */ + protected int mushroomsPerChunk; + + /** + * The number of reeds to generate per chunk. Reeds won't generate if the randomly selected placement is unsuitable. + */ + protected int reedsPerChunk; + + /** + * The number of cactus plants to generate per chunk. Cacti only work on sand. + */ + protected int cactiPerChunk; + + /** + * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. + */ + protected int sandPerChunk; + + /** + * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. There + * appear to be two separate fields for this. + */ + protected int sandPerChunk2; + + /** + * The number of clay patches to generate per chunk. Only generates when part of it is underwater. + */ + protected int clayPerChunk; + + /** Amount of big mushrooms per chunk */ + protected int bigMushroomsPerChunk; + + /** True if decorator should generate surface lava & water */ + public boolean generateLakes; + + public BiomeDecorator(BiomeGenBase par1BiomeGenBase) + { + this.sandGen = new WorldGenSand(7, Block.sand.blockID); + this.gravelAsSandGen = new WorldGenSand(6, Block.gravel.blockID); + this.dirtGen = new WorldGenMinable(Block.dirt.blockID, 32); + this.gravelGen = new WorldGenMinable(Block.gravel.blockID, 32); + this.coalGen = new WorldGenMinable(Block.oreCoal.blockID, 16); + this.ironGen = new WorldGenMinable(Block.oreIron.blockID, 8); + this.goldGen = new WorldGenMinable(Block.oreGold.blockID, 8); + this.redstoneGen = new WorldGenMinable(Block.oreRedstone.blockID, 7); + this.diamondGen = new WorldGenMinable(Block.oreDiamond.blockID, 7); + this.lapisGen = new WorldGenMinable(Block.oreLapis.blockID, 6); + this.plantYellowGen = new WorldGenFlowers(Block.plantYellow.blockID); + this.plantRedGen = new WorldGenFlowers(Block.plantRed.blockID); + this.mushroomBrownGen = new WorldGenFlowers(Block.mushroomBrown.blockID); + this.mushroomRedGen = new WorldGenFlowers(Block.mushroomRed.blockID); + this.bigMushroomGen = new WorldGenBigMushroom(); + this.reedGen = new WorldGenReed(); + this.cactusGen = new WorldGenCactus(); + this.waterlilyGen = new WorldGenWaterlily(); + this.flowersPerChunk = 2; + this.grassPerChunk = 1; + this.sandPerChunk = 1; + this.sandPerChunk2 = 3; + this.clayPerChunk = 1; + this.generateLakes = true; + this.biome = par1BiomeGenBase; + } + + /** + * Decorates the world. Calls code that was formerly (pre-1.8) in ChunkProviderGenerate.populate + */ + public void decorate(World par1World, Random par2Random, int par3, int par4) + { + if (this.currentWorld != null) + { + throw new RuntimeException("Already decorating!!"); + } + else + { + this.currentWorld = par1World; + this.randomGenerator = par2Random; + this.chunk_X = par3; + this.chunk_Z = par4; + this.decorate(); + this.currentWorld = null; + this.randomGenerator = null; + } + } + + /** + * The method that does the work of actually decorating chunks + */ + protected void decorate() + { + this.generateOres(); + int var1; + int var2; + int var3; + + for (var1 = 0; var1 < this.sandPerChunk2; ++var1) + { + var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.sandGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); + } + + for (var1 = 0; var1 < this.clayPerChunk; ++var1) + { + var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.clayGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); + } + + for (var1 = 0; var1 < this.sandPerChunk; ++var1) + { + var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var3 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.sandGen.generate(this.currentWorld, this.randomGenerator, var2, this.currentWorld.getTopSolidOrLiquidBlock(var2, var3), var3); + } + + var1 = this.treesPerChunk; + + if (this.randomGenerator.nextInt(10) == 0) + { + ++var1; + } + + int var4; + + for (var2 = 0; var2 < var1; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + WorldGenerator var5 = this.biome.getRandomWorldGenForTrees(this.randomGenerator); + var5.setScale(1.0D, 1.0D, 1.0D); + var5.generate(this.currentWorld, this.randomGenerator, var3, this.currentWorld.getHeightValue(var3, var4), var4); + } + + for (var2 = 0; var2 < this.bigMushroomsPerChunk; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, var3, this.currentWorld.getHeightValue(var3, var4), var4); + } + + int var7; + + for (var2 = 0; var2 < this.flowersPerChunk; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.randomGenerator.nextInt(128); + var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.plantYellowGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + + if (this.randomGenerator.nextInt(4) == 0) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.randomGenerator.nextInt(128); + var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.plantRedGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + } + } + + for (var2 = 0; var2 < this.grassPerChunk; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.randomGenerator.nextInt(128); + var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + WorldGenerator var6 = this.biome.getRandomWorldGenForGrass(this.randomGenerator); + var6.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + } + + for (var2 = 0; var2 < this.deadBushPerChunk; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.randomGenerator.nextInt(128); + var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + (new WorldGenDeadBush(Block.deadBush.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + } + + for (var2 = 0; var2 < this.waterlilyPerChunk; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + + for (var7 = this.randomGenerator.nextInt(128); var7 > 0 && this.currentWorld.getBlockId(var3, var7 - 1, var4) == 0; --var7) + { + ; + } + + this.waterlilyGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); + } + + for (var2 = 0; var2 < this.mushroomsPerChunk; ++var2) + { + if (this.randomGenerator.nextInt(4) == 0) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + var7 = this.currentWorld.getHeightValue(var3, var4); + this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); + } + + if (this.randomGenerator.nextInt(8) == 0) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + var7 = this.randomGenerator.nextInt(128); + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); + } + } + + if (this.randomGenerator.nextInt(4) == 0) + { + var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var3 = this.randomGenerator.nextInt(128); + var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4); + } + + if (this.randomGenerator.nextInt(8) == 0) + { + var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var3 = this.randomGenerator.nextInt(128); + var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.mushroomRedGen.generate(this.currentWorld, this.randomGenerator, var2, var3, var4); + } + + for (var2 = 0; var2 < this.reedsPerChunk; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + var7 = this.randomGenerator.nextInt(128); + this.reedGen.generate(this.currentWorld, this.randomGenerator, var3, var7, var4); + } + + for (var2 = 0; var2 < 10; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.randomGenerator.nextInt(128); + var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.reedGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + } + + if (this.randomGenerator.nextInt(32) == 0) + { + var2 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var3 = this.randomGenerator.nextInt(128); + var4 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + (new WorldGenPumpkin()).generate(this.currentWorld, this.randomGenerator, var2, var3, var4); + } + + for (var2 = 0; var2 < this.cactiPerChunk; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.randomGenerator.nextInt(128); + var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + this.cactusGen.generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + } + + if (this.generateLakes) + { + for (var2 = 0; var2 < 50; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.randomGenerator.nextInt(this.randomGenerator.nextInt(120) + 8); + var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + (new WorldGenLiquids(Block.waterMoving.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + } + + for (var2 = 0; var2 < 20; ++var2) + { + var3 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + var4 = this.randomGenerator.nextInt(this.randomGenerator.nextInt(this.randomGenerator.nextInt(112) + 8) + 8); + var7 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + (new WorldGenLiquids(Block.lavaMoving.blockID)).generate(this.currentWorld, this.randomGenerator, var3, var4, var7); + } + } + } + + /** + * Standard ore generation helper. Generates most ores. + */ + protected void genStandardOre1(int par1, WorldGenerator par2WorldGenerator, int par3, int par4) + { + for (int var5 = 0; var5 < par1; ++var5) + { + int var6 = this.chunk_X + this.randomGenerator.nextInt(16); + int var7 = this.randomGenerator.nextInt(par4 - par3) + par3; + int var8 = this.chunk_Z + this.randomGenerator.nextInt(16); + par2WorldGenerator.generate(this.currentWorld, this.randomGenerator, var6, var7, var8); + } + } + + /** + * Standard ore generation helper. Generates Lapis Lazuli. + */ + protected void genStandardOre2(int par1, WorldGenerator par2WorldGenerator, int par3, int par4) + { + for (int var5 = 0; var5 < par1; ++var5) + { + int var6 = this.chunk_X + this.randomGenerator.nextInt(16); + int var7 = this.randomGenerator.nextInt(par4) + this.randomGenerator.nextInt(par4) + (par3 - par4); + int var8 = this.chunk_Z + this.randomGenerator.nextInt(16); + par2WorldGenerator.generate(this.currentWorld, this.randomGenerator, var6, var7, var8); + } + } + + /** + * Generates ores in the current chunk + */ + protected void generateOres() + { + this.genStandardOre1(20, this.dirtGen, 0, 128); + this.genStandardOre1(10, this.gravelGen, 0, 128); + this.genStandardOre1(20, this.coalGen, 0, 128); + this.genStandardOre1(20, this.ironGen, 0, 64); + this.genStandardOre1(2, this.goldGen, 0, 32); + this.genStandardOre1(8, this.redstoneGen, 0, 16); + this.genStandardOre1(1, this.diamondGen, 0, 16); + this.genStandardOre2(1, this.lapisGen, 16, 16); + } +} diff --git a/src/main/java/net/minecraft/src/BiomeEndDecorator.java b/src/main/java/net/minecraft/src/BiomeEndDecorator.java new file mode 100644 index 0000000..ebdb665 --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeEndDecorator.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +public class BiomeEndDecorator extends BiomeDecorator +{ + protected WorldGenerator spikeGen; + + public BiomeEndDecorator(BiomeGenBase par1BiomeGenBase) + { + super(par1BiomeGenBase); + this.spikeGen = new WorldGenSpikes(Block.whiteStone.blockID); + } + + /** + * The method that does the work of actually decorating chunks + */ + protected void decorate() + { + this.generateOres(); + + if (this.randomGenerator.nextInt(5) == 0) + { + int var1 = this.chunk_X + this.randomGenerator.nextInt(16) + 8; + int var2 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8; + int var3 = this.currentWorld.getTopSolidOrLiquidBlock(var1, var2); + this.spikeGen.generate(this.currentWorld, this.randomGenerator, var1, var3, var2); + } + + if (this.chunk_X == 0 && this.chunk_Z == 0) + { + EntityDragon var4 = new EntityDragon(this.currentWorld); + var4.setLocationAndAngles(0.0D, 128.0D, 0.0D, this.randomGenerator.nextFloat() * 360.0F, 0.0F); + this.currentWorld.spawnEntityInWorld(var4); + } + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenBase.java b/src/main/java/net/minecraft/src/BiomeGenBase.java new file mode 100644 index 0000000..2109dc9 --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenBase.java @@ -0,0 +1,355 @@ +package net.minecraft.src; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public abstract class BiomeGenBase +{ + /** An array of all the biomes, indexed by biome id. */ + public static final BiomeGenBase[] biomeList = new BiomeGenBase[256]; + public static final BiomeGenBase ocean = (new BiomeGenOcean(0)).setColor(112).setBiomeName("Ocean").setMinMaxHeight(-1.0F, 0.4F); + public static final BiomeGenBase plains = (new BiomeGenPlains(1)).setColor(9286496).setBiomeName("Plains").setTemperatureRainfall(0.8F, 0.4F); + public static final BiomeGenBase desert = (new BiomeGenDesert(2)).setColor(16421912).setBiomeName("Desert").setDisableRain().setTemperatureRainfall(2.0F, 0.0F).setMinMaxHeight(0.1F, 0.2F); + public static final BiomeGenBase extremeHills = (new BiomeGenHills(3)).setColor(6316128).setBiomeName("Extreme Hills").setMinMaxHeight(0.3F, 1.5F).setTemperatureRainfall(0.2F, 0.3F); + public static final BiomeGenBase forest = (new BiomeGenForest(4)).setColor(353825).setBiomeName("Forest").func_76733_a(5159473).setTemperatureRainfall(0.7F, 0.8F); + public static final BiomeGenBase taiga = (new BiomeGenTaiga(5)).setColor(747097).setBiomeName("Taiga").func_76733_a(5159473).setEnableSnow().setTemperatureRainfall(0.05F, 0.8F).setMinMaxHeight(0.1F, 0.4F); + public static final BiomeGenBase swampland = (new BiomeGenSwamp(6)).setColor(522674).setBiomeName("Swampland").func_76733_a(9154376).setMinMaxHeight(-0.2F, 0.1F).setTemperatureRainfall(0.8F, 0.9F); + public static final BiomeGenBase river = (new BiomeGenRiver(7)).setColor(255).setBiomeName("River").setMinMaxHeight(-0.5F, 0.0F); + public static final BiomeGenBase hell = (new BiomeGenHell(8)).setColor(16711680).setBiomeName("Hell").setDisableRain().setTemperatureRainfall(2.0F, 0.0F); + + /** Is the biome used for sky world. */ + public static final BiomeGenBase sky = (new BiomeGenEnd(9)).setColor(8421631).setBiomeName("Sky").setDisableRain(); + public static final BiomeGenBase frozenOcean = (new BiomeGenOcean(10)).setColor(9474208).setBiomeName("FrozenOcean").setEnableSnow().setMinMaxHeight(-1.0F, 0.5F).setTemperatureRainfall(0.0F, 0.5F); + public static final BiomeGenBase frozenRiver = (new BiomeGenRiver(11)).setColor(10526975).setBiomeName("FrozenRiver").setEnableSnow().setMinMaxHeight(-0.5F, 0.0F).setTemperatureRainfall(0.0F, 0.5F); + public static final BiomeGenBase icePlains = (new BiomeGenSnow(12)).setColor(16777215).setBiomeName("Ice Plains").setEnableSnow().setTemperatureRainfall(0.0F, 0.5F); + public static final BiomeGenBase iceMountains = (new BiomeGenSnow(13)).setColor(10526880).setBiomeName("Ice Mountains").setEnableSnow().setMinMaxHeight(0.3F, 1.3F).setTemperatureRainfall(0.0F, 0.5F); + public static final BiomeGenBase mushroomIsland = (new BiomeGenMushroomIsland(14)).setColor(16711935).setBiomeName("MushroomIsland").setTemperatureRainfall(0.9F, 1.0F).setMinMaxHeight(0.2F, 1.0F); + public static final BiomeGenBase mushroomIslandShore = (new BiomeGenMushroomIsland(15)).setColor(10486015).setBiomeName("MushroomIslandShore").setTemperatureRainfall(0.9F, 1.0F).setMinMaxHeight(-1.0F, 0.1F); + + /** Beach biome. */ + public static final BiomeGenBase beach = (new BiomeGenBeach(16)).setColor(16440917).setBiomeName("Beach").setTemperatureRainfall(0.8F, 0.4F).setMinMaxHeight(0.0F, 0.1F); + + /** Desert Hills biome. */ + public static final BiomeGenBase desertHills = (new BiomeGenDesert(17)).setColor(13786898).setBiomeName("DesertHills").setDisableRain().setTemperatureRainfall(2.0F, 0.0F).setMinMaxHeight(0.3F, 0.8F); + + /** Forest Hills biome. */ + public static final BiomeGenBase forestHills = (new BiomeGenForest(18)).setColor(2250012).setBiomeName("ForestHills").func_76733_a(5159473).setTemperatureRainfall(0.7F, 0.8F).setMinMaxHeight(0.3F, 0.7F); + + /** Taiga Hills biome. */ + public static final BiomeGenBase taigaHills = (new BiomeGenTaiga(19)).setColor(1456435).setBiomeName("TaigaHills").setEnableSnow().func_76733_a(5159473).setTemperatureRainfall(0.05F, 0.8F).setMinMaxHeight(0.3F, 0.8F); + + /** Extreme Hills Edge biome. */ + public static final BiomeGenBase extremeHillsEdge = (new BiomeGenHills(20)).setColor(7501978).setBiomeName("Extreme Hills Edge").setMinMaxHeight(0.2F, 0.8F).setTemperatureRainfall(0.2F, 0.3F); + + /** Jungle biome identifier */ + public static final BiomeGenBase jungle = (new BiomeGenJungle(21)).setColor(5470985).setBiomeName("Jungle").func_76733_a(5470985).setTemperatureRainfall(1.2F, 0.9F).setMinMaxHeight(0.2F, 0.4F); + public static final BiomeGenBase jungleHills = (new BiomeGenJungle(22)).setColor(2900485).setBiomeName("JungleHills").func_76733_a(5470985).setTemperatureRainfall(1.2F, 0.9F).setMinMaxHeight(1.8F, 0.5F); + public String biomeName; + public int color; + + /** The block expected to be on the top of this biome */ + public byte topBlock; + + /** The block to fill spots in when not on the top */ + public byte fillerBlock; + public int field_76754_C; + + /** The minimum height of this biome. Default 0.1. */ + public float minHeight; + + /** The maximum height of this biome. Default 0.3. */ + public float maxHeight; + + /** The temperature of this biome. */ + public float temperature; + + /** The rainfall in this biome. */ + public float rainfall; + + /** Color tint applied to water depending on biome */ + public int waterColorMultiplier; + + /** The biome decorator. */ + public BiomeDecorator theBiomeDecorator; + + /** + * Holds the classes of IMobs (hostile mobs) that can be spawned in the biome. + */ + protected List spawnableMonsterList; + + /** + * Holds the classes of any creature that can be spawned in the biome as friendly creature. + */ + protected List spawnableCreatureList; + + /** + * Holds the classes of any aquatic creature that can be spawned in the water of the biome. + */ + protected List spawnableWaterCreatureList; + protected List spawnableCaveCreatureList; + + /** Set to true if snow is enabled for this biome. */ + private boolean enableSnow; + + /** + * Is true (default) if the biome support rain (desert and nether can't have rain) + */ + private boolean enableRain; + + /** The id number to this biome, and its index in the biomeList array. */ + public final int biomeID; + + /** The tree generator. */ + protected WorldGenTrees worldGeneratorTrees; + + /** The big tree generator. */ + protected WorldGenBigTree worldGeneratorBigTree; + + /** The forest generator. */ + protected WorldGenForest worldGeneratorForest; + + /** The swamp tree generator. */ + protected WorldGenSwamp worldGeneratorSwamp; + + protected BiomeGenBase(int par1) + { + this.topBlock = (byte)Block.grass.blockID; + this.fillerBlock = (byte)Block.dirt.blockID; + this.field_76754_C = 5169201; + this.minHeight = 0.1F; + this.maxHeight = 0.3F; + this.temperature = 0.5F; + this.rainfall = 0.5F; + this.waterColorMultiplier = 16777215; + this.spawnableMonsterList = new ArrayList(); + this.spawnableCreatureList = new ArrayList(); + this.spawnableWaterCreatureList = new ArrayList(); + this.spawnableCaveCreatureList = new ArrayList(); + this.enableRain = true; + this.worldGeneratorTrees = new WorldGenTrees(false); + this.worldGeneratorBigTree = new WorldGenBigTree(false); + this.worldGeneratorForest = new WorldGenForest(false); + this.worldGeneratorSwamp = new WorldGenSwamp(); + this.biomeID = par1; + biomeList[par1] = this; + this.theBiomeDecorator = this.createBiomeDecorator(); + this.spawnableCreatureList.add(new SpawnListEntry(EntitySheep.class, 12, 4, 4)); + this.spawnableCreatureList.add(new SpawnListEntry(EntityPig.class, 10, 4, 4)); + this.spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 10, 4, 4)); + this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 8, 4, 4)); + this.spawnableMonsterList.add(new SpawnListEntry(EntitySpider.class, 10, 4, 4)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityZombie.class, 10, 4, 4)); + this.spawnableMonsterList.add(new SpawnListEntry(EntitySkeleton.class, 10, 4, 4)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityCreeper.class, 10, 4, 4)); + this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 10, 4, 4)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityEnderman.class, 1, 1, 4)); + this.spawnableWaterCreatureList.add(new SpawnListEntry(EntitySquid.class, 10, 4, 4)); + this.spawnableCaveCreatureList.add(new SpawnListEntry(EntityBat.class, 10, 8, 8)); + } + + /** + * Allocate a new BiomeDecorator for this BiomeGenBase + */ + protected BiomeDecorator createBiomeDecorator() + { + return new BiomeDecorator(this); + } + + /** + * Sets the temperature and rainfall of this biome. + */ + private BiomeGenBase setTemperatureRainfall(float par1, float par2) + { + if (par1 > 0.1F && par1 < 0.2F) + { + throw new IllegalArgumentException("Please avoid temperatures in the range 0.1 - 0.2 because of snow"); + } + else + { + this.temperature = par1; + this.rainfall = par2; + return this; + } + } + + /** + * Sets the minimum and maximum height of this biome. Seems to go from -2.0 to 2.0. + */ + private BiomeGenBase setMinMaxHeight(float par1, float par2) + { + this.minHeight = par1; + this.maxHeight = par2; + return this; + } + + /** + * Disable the rain for the biome. + */ + private BiomeGenBase setDisableRain() + { + this.enableRain = false; + return this; + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + public WorldGenerator getRandomWorldGenForTrees(Random par1Random) + { + return (WorldGenerator)(par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : this.worldGeneratorTrees); + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + public WorldGenerator getRandomWorldGenForGrass(Random par1Random) + { + return new WorldGenTallGrass(Block.tallGrass.blockID, 1); + } + + /** + * sets enableSnow to true during biome initialization. returns BiomeGenBase. + */ + protected BiomeGenBase setEnableSnow() + { + this.enableSnow = true; + return this; + } + + protected BiomeGenBase setBiomeName(String par1Str) + { + this.biomeName = par1Str; + return this; + } + + protected BiomeGenBase func_76733_a(int par1) + { + this.field_76754_C = par1; + return this; + } + + protected BiomeGenBase setColor(int par1) + { + this.color = par1; + return this; + } + + /** + * takes temperature, returns color + */ + public int getSkyColorByTemp(float par1) + { + par1 /= 3.0F; + + if (par1 < -1.0F) + { + par1 = -1.0F; + } + + if (par1 > 1.0F) + { + par1 = 1.0F; + } + + return Color.getHSBColor(0.62222224F - par1 * 0.05F, 0.5F + par1 * 0.1F, 1.0F).getRGB(); + } + + /** + * Returns the correspondent list of the EnumCreatureType informed. + */ + public List getSpawnableList(EnumCreatureType par1EnumCreatureType) + { + return par1EnumCreatureType == EnumCreatureType.monster ? this.spawnableMonsterList : (par1EnumCreatureType == EnumCreatureType.creature ? this.spawnableCreatureList : (par1EnumCreatureType == EnumCreatureType.waterCreature ? this.spawnableWaterCreatureList : (par1EnumCreatureType == EnumCreatureType.ambient ? this.spawnableCaveCreatureList : null))); + } + + /** + * Returns true if the biome have snowfall instead a normal rain. + */ + public boolean getEnableSnow() + { + return this.enableSnow; + } + + /** + * Return true if the biome supports lightning bolt spawn, either by have the bolts enabled and have rain enabled. + */ + public boolean canSpawnLightningBolt() + { + return this.enableSnow ? false : this.enableRain; + } + + /** + * Checks to see if the rainfall level of the biome is extremely high + */ + public boolean isHighHumidity() + { + return this.rainfall > 0.85F; + } + + /** + * returns the chance a creature has to spawn. + */ + public float getSpawningChance() + { + return 0.1F; + } + + /** + * Gets an integer representation of this biome's rainfall + */ + public final int getIntRainfall() + { + return (int)(this.rainfall * 65536.0F); + } + + /** + * Gets an integer representation of this biome's temperature + */ + public final int getIntTemperature() + { + return (int)(this.temperature * 65536.0F); + } + + /** + * Gets a floating point representation of this biome's rainfall + */ + public final float getFloatRainfall() + { + return this.rainfall; + } + + /** + * Gets a floating point representation of this biome's temperature + */ + public final float getFloatTemperature() + { + return this.temperature; + } + + public void decorate(World par1World, Random par2Random, int par3, int par4) + { + this.theBiomeDecorator.decorate(par1World, par2Random, par3, par4); + } + + /** + * Provides the basic grass color based on the biome temperature and rainfall + */ + public int getBiomeGrassColor() + { + double var1 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F); + double var3 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); + return ColorizerGrass.getGrassColor(var1, var3); + } + + /** + * Provides the basic foliage color based on the biome temperature and rainfall + */ + public int getBiomeFoliageColor() + { + double var1 = (double)MathHelper.clamp_float(this.getFloatTemperature(), 0.0F, 1.0F); + double var3 = (double)MathHelper.clamp_float(this.getFloatRainfall(), 0.0F, 1.0F); + return ColorizerFoliage.getFoliageColor(var1, var3); + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenBeach.java b/src/main/java/net/minecraft/src/BiomeGenBeach.java new file mode 100644 index 0000000..fb105aa --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenBeach.java @@ -0,0 +1,16 @@ +package net.minecraft.src; + +public class BiomeGenBeach extends BiomeGenBase +{ + public BiomeGenBeach(int par1) + { + super(par1); + this.spawnableCreatureList.clear(); + this.topBlock = (byte)Block.sand.blockID; + this.fillerBlock = (byte)Block.sand.blockID; + this.theBiomeDecorator.treesPerChunk = -999; + this.theBiomeDecorator.deadBushPerChunk = 0; + this.theBiomeDecorator.reedsPerChunk = 0; + this.theBiomeDecorator.cactiPerChunk = 0; + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenDesert.java b/src/main/java/net/minecraft/src/BiomeGenDesert.java new file mode 100644 index 0000000..de19309 --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenDesert.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BiomeGenDesert extends BiomeGenBase +{ + public BiomeGenDesert(int par1) + { + super(par1); + this.spawnableCreatureList.clear(); + this.topBlock = (byte)Block.sand.blockID; + this.fillerBlock = (byte)Block.sand.blockID; + this.theBiomeDecorator.treesPerChunk = -999; + this.theBiomeDecorator.deadBushPerChunk = 2; + this.theBiomeDecorator.reedsPerChunk = 50; + this.theBiomeDecorator.cactiPerChunk = 10; + } + + public void decorate(World par1World, Random par2Random, int par3, int par4) + { + super.decorate(par1World, par2Random, par3, par4); + + if (par2Random.nextInt(1000) == 0) + { + int var5 = par3 + par2Random.nextInt(16) + 8; + int var6 = par4 + par2Random.nextInt(16) + 8; + WorldGenDesertWells var7 = new WorldGenDesertWells(); + var7.generate(par1World, par2Random, var5, par1World.getHeightValue(var5, var6) + 1, var6); + } + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenEnd.java b/src/main/java/net/minecraft/src/BiomeGenEnd.java new file mode 100644 index 0000000..53f750d --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenEnd.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public class BiomeGenEnd extends BiomeGenBase +{ + public BiomeGenEnd(int par1) + { + super(par1); + this.spawnableMonsterList.clear(); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + this.spawnableCaveCreatureList.clear(); + this.spawnableMonsterList.add(new SpawnListEntry(EntityEnderman.class, 10, 4, 4)); + this.topBlock = (byte)Block.dirt.blockID; + this.fillerBlock = (byte)Block.dirt.blockID; + this.theBiomeDecorator = new BiomeEndDecorator(this); + } + + /** + * takes temperature, returns color + */ + public int getSkyColorByTemp(float par1) + { + return 0; + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenForest.java b/src/main/java/net/minecraft/src/BiomeGenForest.java new file mode 100644 index 0000000..d111d1a --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenForest.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BiomeGenForest extends BiomeGenBase +{ + public BiomeGenForest(int par1) + { + super(par1); + this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 4)); + this.theBiomeDecorator.treesPerChunk = 10; + this.theBiomeDecorator.grassPerChunk = 2; + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + public WorldGenerator getRandomWorldGenForTrees(Random par1Random) + { + return (WorldGenerator)(par1Random.nextInt(5) == 0 ? this.worldGeneratorForest : (par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : this.worldGeneratorTrees)); + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenHell.java b/src/main/java/net/minecraft/src/BiomeGenHell.java new file mode 100644 index 0000000..3970cf1 --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenHell.java @@ -0,0 +1,16 @@ +package net.minecraft.src; + +public class BiomeGenHell extends BiomeGenBase +{ + public BiomeGenHell(int par1) + { + super(par1); + this.spawnableMonsterList.clear(); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + this.spawnableCaveCreatureList.clear(); + this.spawnableMonsterList.add(new SpawnListEntry(EntityGhast.class, 50, 4, 4)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityPigZombie.class, 100, 4, 4)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityMagmaCube.class, 1, 4, 4)); + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenHills.java b/src/main/java/net/minecraft/src/BiomeGenHills.java new file mode 100644 index 0000000..6540ceb --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenHills.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BiomeGenHills extends BiomeGenBase +{ + private WorldGenerator theWorldGenerator; + + protected BiomeGenHills(int par1) + { + super(par1); + this.theWorldGenerator = new WorldGenMinable(Block.silverfish.blockID, 8); + } + + public void decorate(World par1World, Random par2Random, int par3, int par4) + { + super.decorate(par1World, par2Random, par3, par4); + int var5 = 3 + par2Random.nextInt(6); + int var6; + int var7; + int var8; + + for (var6 = 0; var6 < var5; ++var6) + { + var7 = par3 + par2Random.nextInt(16); + var8 = par2Random.nextInt(28) + 4; + int var9 = par4 + par2Random.nextInt(16); + int var10 = par1World.getBlockId(var7, var8, var9); + + if (var10 == Block.stone.blockID) + { + par1World.setBlock(var7, var8, var9, Block.oreEmerald.blockID, 0, 2); + } + } + + for (var5 = 0; var5 < 7; ++var5) + { + var6 = par3 + par2Random.nextInt(16); + var7 = par2Random.nextInt(64); + var8 = par4 + par2Random.nextInt(16); + this.theWorldGenerator.generate(par1World, par2Random, var6, var7, var8); + } + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenJungle.java b/src/main/java/net/minecraft/src/BiomeGenJungle.java new file mode 100644 index 0000000..6b63dcb --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenJungle.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BiomeGenJungle extends BiomeGenBase +{ + public BiomeGenJungle(int par1) + { + super(par1); + this.theBiomeDecorator.treesPerChunk = 50; + this.theBiomeDecorator.grassPerChunk = 25; + this.theBiomeDecorator.flowersPerChunk = 4; + this.spawnableMonsterList.add(new SpawnListEntry(EntityOcelot.class, 2, 1, 1)); + this.spawnableCreatureList.add(new SpawnListEntry(EntityChicken.class, 10, 4, 4)); + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + public WorldGenerator getRandomWorldGenForTrees(Random par1Random) + { + return (WorldGenerator)(par1Random.nextInt(10) == 0 ? this.worldGeneratorBigTree : (par1Random.nextInt(2) == 0 ? new WorldGenShrub(3, 0) : (par1Random.nextInt(3) == 0 ? new WorldGenHugeTrees(false, 10 + par1Random.nextInt(20), 3, 3) : new WorldGenTrees(false, 4 + par1Random.nextInt(7), 3, 3, true)))); + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + public WorldGenerator getRandomWorldGenForGrass(Random par1Random) + { + return par1Random.nextInt(4) == 0 ? new WorldGenTallGrass(Block.tallGrass.blockID, 2) : new WorldGenTallGrass(Block.tallGrass.blockID, 1); + } + + public void decorate(World par1World, Random par2Random, int par3, int par4) + { + super.decorate(par1World, par2Random, par3, par4); + WorldGenVines var5 = new WorldGenVines(); + + for (int var6 = 0; var6 < 50; ++var6) + { + int var7 = par3 + par2Random.nextInt(16) + 8; + byte var8 = 64; + int var9 = par4 + par2Random.nextInt(16) + 8; + var5.generate(par1World, par2Random, var7, var8, var9); + } + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenMushroomIsland.java b/src/main/java/net/minecraft/src/BiomeGenMushroomIsland.java new file mode 100644 index 0000000..a62759e --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenMushroomIsland.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class BiomeGenMushroomIsland extends BiomeGenBase +{ + public BiomeGenMushroomIsland(int par1) + { + super(par1); + this.theBiomeDecorator.treesPerChunk = -100; + this.theBiomeDecorator.flowersPerChunk = -100; + this.theBiomeDecorator.grassPerChunk = -100; + this.theBiomeDecorator.mushroomsPerChunk = 1; + this.theBiomeDecorator.bigMushroomsPerChunk = 1; + this.topBlock = (byte)Block.mycelium.blockID; + this.spawnableMonsterList.clear(); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + this.spawnableCreatureList.add(new SpawnListEntry(EntityMooshroom.class, 8, 4, 8)); + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenOcean.java b/src/main/java/net/minecraft/src/BiomeGenOcean.java new file mode 100644 index 0000000..230742c --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenOcean.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public class BiomeGenOcean extends BiomeGenBase +{ + public BiomeGenOcean(int par1) + { + super(par1); + this.spawnableCreatureList.clear(); + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenPlains.java b/src/main/java/net/minecraft/src/BiomeGenPlains.java new file mode 100644 index 0000000..24648b2 --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenPlains.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +public class BiomeGenPlains extends BiomeGenBase +{ + protected BiomeGenPlains(int par1) + { + super(par1); + this.spawnableCreatureList.add(new SpawnListEntry(EntityHorse.class, 5, 2, 6)); + this.theBiomeDecorator.treesPerChunk = -999; + this.theBiomeDecorator.flowersPerChunk = 4; + this.theBiomeDecorator.grassPerChunk = 10; + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenRiver.java b/src/main/java/net/minecraft/src/BiomeGenRiver.java new file mode 100644 index 0000000..fe439ba --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenRiver.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public class BiomeGenRiver extends BiomeGenBase +{ + public BiomeGenRiver(int par1) + { + super(par1); + this.spawnableCreatureList.clear(); + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenSnow.java b/src/main/java/net/minecraft/src/BiomeGenSnow.java new file mode 100644 index 0000000..5bdd521 --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenSnow.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public class BiomeGenSnow extends BiomeGenBase +{ + public BiomeGenSnow(int par1) + { + super(par1); + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenSwamp.java b/src/main/java/net/minecraft/src/BiomeGenSwamp.java new file mode 100644 index 0000000..31e7846 --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenSwamp.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BiomeGenSwamp extends BiomeGenBase +{ + protected BiomeGenSwamp(int par1) + { + super(par1); + this.theBiomeDecorator.treesPerChunk = 2; + this.theBiomeDecorator.flowersPerChunk = -999; + this.theBiomeDecorator.deadBushPerChunk = 1; + this.theBiomeDecorator.mushroomsPerChunk = 8; + this.theBiomeDecorator.reedsPerChunk = 10; + this.theBiomeDecorator.clayPerChunk = 1; + this.theBiomeDecorator.waterlilyPerChunk = 4; + this.waterColorMultiplier = 14745518; + this.spawnableMonsterList.add(new SpawnListEntry(EntitySlime.class, 1, 1, 1)); + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + public WorldGenerator getRandomWorldGenForTrees(Random par1Random) + { + return this.worldGeneratorSwamp; + } + + /** + * Provides the basic grass color based on the biome temperature and rainfall + */ + public int getBiomeGrassColor() + { + double var1 = (double)this.getFloatTemperature(); + double var3 = (double)this.getFloatRainfall(); + return ((ColorizerGrass.getGrassColor(var1, var3) & 16711422) + 5115470) / 2; + } + + /** + * Provides the basic foliage color based on the biome temperature and rainfall + */ + public int getBiomeFoliageColor() + { + double var1 = (double)this.getFloatTemperature(); + double var3 = (double)this.getFloatRainfall(); + return ((ColorizerFoliage.getFoliageColor(var1, var3) & 16711422) + 5115470) / 2; + } +} diff --git a/src/main/java/net/minecraft/src/BiomeGenTaiga.java b/src/main/java/net/minecraft/src/BiomeGenTaiga.java new file mode 100644 index 0000000..2ade88d --- /dev/null +++ b/src/main/java/net/minecraft/src/BiomeGenTaiga.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BiomeGenTaiga extends BiomeGenBase +{ + public BiomeGenTaiga(int par1) + { + super(par1); + this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 8, 4, 4)); + this.theBiomeDecorator.treesPerChunk = 10; + this.theBiomeDecorator.grassPerChunk = 1; + } + + /** + * Gets a WorldGen appropriate for this biome. + */ + public WorldGenerator getRandomWorldGenForTrees(Random par1Random) + { + return (WorldGenerator)(par1Random.nextInt(3) == 0 ? new WorldGenTaiga1() : new WorldGenTaiga2(false)); + } +} diff --git a/src/main/java/net/minecraft/src/Block.java b/src/main/java/net/minecraft/src/Block.java new file mode 100644 index 0000000..ecd600b --- /dev/null +++ b/src/main/java/net/minecraft/src/Block.java @@ -0,0 +1,1388 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class Block +{ + /** + * used as foreach item, if item.tab = current tab, display it on the screen + */ + private CreativeTabs displayOnCreativeTab; + protected String textureName; + public static final StepSound soundPowderFootstep = new StepSound("stone", 1.0F, 1.0F); + public static final StepSound soundWoodFootstep = new StepSound("wood", 1.0F, 1.0F); + public static final StepSound soundGravelFootstep = new StepSound("gravel", 1.0F, 1.0F); + public static final StepSound soundGrassFootstep = new StepSound("grass", 1.0F, 1.0F); + public static final StepSound soundStoneFootstep = new StepSound("stone", 1.0F, 1.0F); + public static final StepSound soundMetalFootstep = new StepSound("stone", 1.0F, 1.5F); + public static final StepSound soundGlassFootstep = new StepSoundStone("stone", 1.0F, 1.0F); + public static final StepSound soundClothFootstep = new StepSound("cloth", 1.0F, 1.0F); + public static final StepSound soundSandFootstep = new StepSound("sand", 1.0F, 1.0F); + public static final StepSound soundSnowFootstep = new StepSound("snow", 1.0F, 1.0F); + public static final StepSound soundLadderFootstep = new StepSoundSand("ladder", 1.0F, 1.0F); + public static final StepSound soundAnvilFootstep = new StepSoundAnvil("anvil", 0.3F, 1.0F); + + /** List of ly/ff (BlockType) containing the already registered blocks. */ + public static final Block[] blocksList = new Block[4096]; + + /** + * An array of 4096 booleans corresponding to the result of the isOpaqueCube() method for each block ID + */ + public static final boolean[] opaqueCubeLookup = new boolean[4096]; + + /** How much light is subtracted for going through this block */ + public static final int[] lightOpacity = new int[4096]; + + /** Array of booleans that tells if a block can grass */ + public static final boolean[] canBlockGrass = new boolean[4096]; + + /** Amount of light emitted */ + public static final int[] lightValue = new int[4096]; + + /** + * Flag if block ID should use the brightest neighbor light value as its own + */ + public static boolean[] useNeighborBrightness = new boolean[4096]; + public static final Block stone = (new BlockStone(1)).setHardness(1.5F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("stone").setTextureName("stone"); + public static final BlockGrass grass = (BlockGrass)(new BlockGrass(2)).setHardness(0.6F).setStepSound(soundGrassFootstep).setUnlocalizedName("grass").setTextureName("grass"); + public static final Block dirt = (new BlockDirt(3)).setHardness(0.5F).setStepSound(soundGravelFootstep).setUnlocalizedName("dirt").setTextureName("dirt"); + public static final Block cobblestone = (new Block(4, Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("stonebrick").setCreativeTab(CreativeTabs.tabBlock).setTextureName("cobblestone"); + public static final Block planks = (new BlockWood(5)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("wood").setTextureName("planks"); + public static final Block sapling = (new BlockSapling(6)).setHardness(0.0F).setStepSound(soundGrassFootstep).setUnlocalizedName("sapling").setTextureName("sapling"); + public static final Block bedrock = (new Block(7, Material.rock)).setBlockUnbreakable().setResistance(6000000.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("bedrock").disableStats().setCreativeTab(CreativeTabs.tabBlock).setTextureName("bedrock"); + public static final BlockFluid waterMoving = (BlockFluid)(new BlockFlowing(8, Material.water)).setHardness(100.0F).setLightOpacity(3).setUnlocalizedName("water").disableStats().setTextureName("water_flow"); + public static final Block waterStill = (new BlockStationary(9, Material.water)).setHardness(100.0F).setLightOpacity(3).setUnlocalizedName("water").disableStats().setTextureName("water_still"); + public static final BlockFluid lavaMoving = (BlockFluid)(new BlockFlowing(10, Material.lava)).setHardness(0.0F).setLightValue(1.0F).setUnlocalizedName("lava").disableStats().setTextureName("lava_flow"); + + /** Stationary lava source block */ + public static final Block lavaStill = (new BlockStationary(11, Material.lava)).setHardness(100.0F).setLightValue(1.0F).setUnlocalizedName("lava").disableStats().setTextureName("lava_still"); + public static final Block sand = (new BlockSand(12)).setHardness(0.5F).setStepSound(soundSandFootstep).setUnlocalizedName("sand").setTextureName("sand"); + public static final Block gravel = (new BlockGravel(13)).setHardness(0.6F).setStepSound(soundGravelFootstep).setUnlocalizedName("gravel").setTextureName("gravel"); + public static final Block oreGold = (new BlockOre(14)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("oreGold").setTextureName("gold_ore"); + public static final Block oreIron = (new BlockOre(15)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("oreIron").setTextureName("iron_ore"); + public static final Block oreCoal = (new BlockOre(16)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("oreCoal").setTextureName("coal_ore"); + public static final Block wood = (new BlockLog(17)).setHardness(2.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("log").setTextureName("log"); + public static final BlockLeaves leaves = (BlockLeaves)(new BlockLeaves(18)).setHardness(0.2F).setLightOpacity(1).setStepSound(soundGrassFootstep).setUnlocalizedName("leaves").setTextureName("leaves"); + public static final Block sponge = (new BlockSponge(19)).setHardness(0.6F).setStepSound(soundGrassFootstep).setUnlocalizedName("sponge").setTextureName("sponge"); + public static final Block glass = (new BlockGlass(20, Material.glass, false)).setHardness(0.3F).setStepSound(soundGlassFootstep).setUnlocalizedName("glass").setTextureName("glass"); + public static final Block oreLapis = (new BlockOre(21)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("oreLapis").setTextureName("lapis_ore"); + public static final Block blockLapis = (new Block(22, Material.rock)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("blockLapis").setCreativeTab(CreativeTabs.tabBlock).setTextureName("lapis_block"); + public static final Block dispenser = (new BlockDispenser(23)).setHardness(3.5F).setStepSound(soundStoneFootstep).setUnlocalizedName("dispenser").setTextureName("dispenser"); + public static final Block sandStone = (new BlockSandStone(24)).setStepSound(soundStoneFootstep).setHardness(0.8F).setUnlocalizedName("sandStone").setTextureName("sandstone"); + public static final Block music = (new BlockNote(25)).setHardness(0.8F).setUnlocalizedName("musicBlock").setTextureName("noteblock"); + public static final Block bed = (new BlockBed(26)).setHardness(0.2F).setUnlocalizedName("bed").disableStats().setTextureName("bed"); + public static final Block railPowered = (new BlockRailPowered(27)).setHardness(0.7F).setStepSound(soundMetalFootstep).setUnlocalizedName("goldenRail").setTextureName("rail_golden"); + public static final Block railDetector = (new BlockDetectorRail(28)).setHardness(0.7F).setStepSound(soundMetalFootstep).setUnlocalizedName("detectorRail").setTextureName("rail_detector"); + public static final BlockPistonBase pistonStickyBase = (BlockPistonBase)(new BlockPistonBase(29, true)).setUnlocalizedName("pistonStickyBase"); + public static final Block web = (new BlockWeb(30)).setLightOpacity(1).setHardness(4.0F).setUnlocalizedName("web").setTextureName("web"); + public static final BlockTallGrass tallGrass = (BlockTallGrass)(new BlockTallGrass(31)).setHardness(0.0F).setStepSound(soundGrassFootstep).setUnlocalizedName("tallgrass"); + public static final BlockDeadBush deadBush = (BlockDeadBush)(new BlockDeadBush(32)).setHardness(0.0F).setStepSound(soundGrassFootstep).setUnlocalizedName("deadbush").setTextureName("deadbush"); + public static final BlockPistonBase pistonBase = (BlockPistonBase)(new BlockPistonBase(33, false)).setUnlocalizedName("pistonBase"); + public static final BlockPistonExtension pistonExtension = new BlockPistonExtension(34); + public static final Block cloth = (new BlockColored(35, Material.cloth)).setHardness(0.8F).setStepSound(soundClothFootstep).setUnlocalizedName("cloth").setTextureName("wool_colored"); + public static final BlockPistonMoving pistonMoving = new BlockPistonMoving(36); + public static final BlockFlower plantYellow = (BlockFlower)(new BlockFlower(37)).setHardness(0.0F).setStepSound(soundGrassFootstep).setUnlocalizedName("flower").setTextureName("flower_dandelion"); + public static final BlockFlower plantRed = (BlockFlower)(new BlockFlower(38)).setHardness(0.0F).setStepSound(soundGrassFootstep).setUnlocalizedName("rose").setTextureName("flower_rose"); + public static final BlockFlower mushroomBrown = (BlockFlower)(new BlockMushroom(39)).setHardness(0.0F).setStepSound(soundGrassFootstep).setLightValue(0.125F).setUnlocalizedName("mushroom").setTextureName("mushroom_brown"); + public static final BlockFlower mushroomRed = (BlockFlower)(new BlockMushroom(40)).setHardness(0.0F).setStepSound(soundGrassFootstep).setUnlocalizedName("mushroom").setTextureName("mushroom_red"); + public static final Block blockGold = (new BlockOreStorage(41)).setHardness(3.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setUnlocalizedName("blockGold").setTextureName("gold_block"); + public static final Block blockIron = (new BlockOreStorage(42)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setUnlocalizedName("blockIron").setTextureName("iron_block"); + + /** stoneDoubleSlab */ + public static final BlockHalfSlab stoneDoubleSlab = (BlockHalfSlab)(new BlockStep(43, true)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("stoneSlab"); + + /** stoneSingleSlab */ + public static final BlockHalfSlab stoneSingleSlab = (BlockHalfSlab)(new BlockStep(44, false)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("stoneSlab"); + public static final Block brick = (new Block(45, Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("brick").setCreativeTab(CreativeTabs.tabBlock).setTextureName("brick"); + public static final Block tnt = (new BlockTNT(46)).setHardness(0.0F).setStepSound(soundGrassFootstep).setUnlocalizedName("tnt").setTextureName("tnt"); + public static final Block bookShelf = (new BlockBookshelf(47)).setHardness(1.5F).setStepSound(soundWoodFootstep).setUnlocalizedName("bookshelf").setTextureName("bookshelf"); + public static final Block cobblestoneMossy = (new Block(48, Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("stoneMoss").setCreativeTab(CreativeTabs.tabBlock).setTextureName("cobblestone_mossy"); + public static final Block obsidian = (new BlockObsidian(49)).setHardness(50.0F).setResistance(2000.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("obsidian").setTextureName("obsidian"); + public static final Block torchWood = (new BlockTorch(50)).setHardness(0.0F).setLightValue(0.9375F).setStepSound(soundWoodFootstep).setUnlocalizedName("torch").setTextureName("torch_on"); + public static final BlockFire fire = (BlockFire)(new BlockFire(51)).setHardness(0.0F).setLightValue(1.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("fire").disableStats().setTextureName("fire"); + public static final Block mobSpawner = (new BlockMobSpawner(52)).setHardness(5.0F).setStepSound(soundMetalFootstep).setUnlocalizedName("mobSpawner").disableStats().setTextureName("mob_spawner"); + public static final Block stairsWoodOak = (new BlockStairs(53, planks, 0)).setUnlocalizedName("stairsWood"); + public static final BlockChest chest = (BlockChest)(new BlockChest(54, 0)).setHardness(2.5F).setStepSound(soundWoodFootstep).setUnlocalizedName("chest"); + public static final BlockRedstoneWire redstoneWire = (BlockRedstoneWire)(new BlockRedstoneWire(55)).setHardness(0.0F).setStepSound(soundPowderFootstep).setUnlocalizedName("redstoneDust").disableStats().setTextureName("redstone_dust"); + public static final Block oreDiamond = (new BlockOre(56)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("oreDiamond").setTextureName("diamond_ore"); + public static final Block blockDiamond = (new BlockOreStorage(57)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setUnlocalizedName("blockDiamond").setTextureName("diamond_block"); + public static final Block workbench = (new BlockWorkbench(58)).setHardness(2.5F).setStepSound(soundWoodFootstep).setUnlocalizedName("workbench").setTextureName("crafting_table"); + public static final Block crops = (new BlockCrops(59)).setUnlocalizedName("crops").setTextureName("wheat"); + public static final Block tilledField = (new BlockFarmland(60)).setHardness(0.6F).setStepSound(soundGravelFootstep).setUnlocalizedName("farmland").setTextureName("farmland"); + public static final Block furnaceIdle = (new BlockFurnace(61, false)).setHardness(3.5F).setStepSound(soundStoneFootstep).setUnlocalizedName("furnace").setCreativeTab(CreativeTabs.tabDecorations); + public static final Block furnaceBurning = (new BlockFurnace(62, true)).setHardness(3.5F).setStepSound(soundStoneFootstep).setLightValue(0.875F).setUnlocalizedName("furnace"); + public static final Block signPost = (new BlockSign(63, TileEntitySign.class, true)).setHardness(1.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("sign").disableStats(); + public static final Block doorWood = (new BlockDoor(64, Material.wood)).setHardness(3.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("doorWood").disableStats().setTextureName("door_wood"); + public static final Block ladder = (new BlockLadder(65)).setHardness(0.4F).setStepSound(soundLadderFootstep).setUnlocalizedName("ladder").setTextureName("ladder"); + public static final Block rail = (new BlockRail(66)).setHardness(0.7F).setStepSound(soundMetalFootstep).setUnlocalizedName("rail").setTextureName("rail_normal"); + public static final Block stairsCobblestone = (new BlockStairs(67, cobblestone, 0)).setUnlocalizedName("stairsStone"); + public static final Block signWall = (new BlockSign(68, TileEntitySign.class, false)).setHardness(1.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("sign").disableStats(); + public static final Block lever = (new BlockLever(69)).setHardness(0.5F).setStepSound(soundWoodFootstep).setUnlocalizedName("lever").setTextureName("lever"); + public static final Block pressurePlateStone = (new BlockPressurePlate(70, "stone", Material.rock, EnumMobType.mobs)).setHardness(0.5F).setStepSound(soundStoneFootstep).setUnlocalizedName("pressurePlate"); + public static final Block doorIron = (new BlockDoor(71, Material.iron)).setHardness(5.0F).setStepSound(soundMetalFootstep).setUnlocalizedName("doorIron").disableStats().setTextureName("door_iron"); + public static final Block pressurePlatePlanks = (new BlockPressurePlate(72, "planks_oak", Material.wood, EnumMobType.everything)).setHardness(0.5F).setStepSound(soundWoodFootstep).setUnlocalizedName("pressurePlate"); + public static final Block oreRedstone = (new BlockRedstoneOre(73, false)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("oreRedstone").setCreativeTab(CreativeTabs.tabBlock).setTextureName("redstone_ore"); + public static final Block oreRedstoneGlowing = (new BlockRedstoneOre(74, true)).setLightValue(0.625F).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("oreRedstone").setTextureName("redstone_ore"); + public static final Block torchRedstoneIdle = (new BlockRedstoneTorch(75, false)).setHardness(0.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("notGate").setTextureName("redstone_torch_off"); + public static final Block torchRedstoneActive = (new BlockRedstoneTorch(76, true)).setHardness(0.0F).setLightValue(0.5F).setStepSound(soundWoodFootstep).setUnlocalizedName("notGate").setCreativeTab(CreativeTabs.tabRedstone).setTextureName("redstone_torch_on"); + public static final Block stoneButton = (new BlockButtonStone(77)).setHardness(0.5F).setStepSound(soundStoneFootstep).setUnlocalizedName("button"); + public static final Block snow = (new BlockSnow(78)).setHardness(0.1F).setStepSound(soundSnowFootstep).setUnlocalizedName("snow").setLightOpacity(0).setTextureName("snow"); + public static final Block ice = (new BlockIce(79)).setHardness(0.5F).setLightOpacity(3).setStepSound(soundGlassFootstep).setUnlocalizedName("ice").setTextureName("ice"); + public static final Block blockSnow = (new BlockSnowBlock(80)).setHardness(0.2F).setStepSound(soundSnowFootstep).setUnlocalizedName("snow").setTextureName("snow"); + public static final Block cactus = (new BlockCactus(81)).setHardness(0.4F).setStepSound(soundClothFootstep).setUnlocalizedName("cactus").setTextureName("cactus"); + public static final Block blockClay = (new BlockClay(82)).setHardness(0.6F).setStepSound(soundGravelFootstep).setUnlocalizedName("clay").setTextureName("clay"); + public static final Block reed = (new BlockReed(83)).setHardness(0.0F).setStepSound(soundGrassFootstep).setUnlocalizedName("reeds").disableStats().setTextureName("reeds"); + public static final Block jukebox = (new BlockJukeBox(84)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("jukebox").setTextureName("jukebox"); + public static final Block fence = (new BlockFence(85, "planks_oak", Material.wood)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("fence"); + public static final Block pumpkin = (new BlockPumpkin(86, false)).setHardness(1.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("pumpkin").setTextureName("pumpkin"); + public static final Block netherrack = (new BlockNetherrack(87)).setHardness(0.4F).setStepSound(soundStoneFootstep).setUnlocalizedName("hellrock").setTextureName("netherrack"); + public static final Block slowSand = (new BlockSoulSand(88)).setHardness(0.5F).setStepSound(soundSandFootstep).setUnlocalizedName("hellsand").setTextureName("soul_sand"); + public static final Block glowStone = (new BlockGlowStone(89, Material.glass)).setHardness(0.3F).setStepSound(soundGlassFootstep).setLightValue(1.0F).setUnlocalizedName("lightgem").setTextureName("glowstone"); + + /** The purple teleport blocks inside the obsidian circle */ + public static final BlockPortal portal = (BlockPortal)(new BlockPortal(90)).setHardness(-1.0F).setStepSound(soundGlassFootstep).setLightValue(0.75F).setUnlocalizedName("portal").setTextureName("portal"); + public static final Block pumpkinLantern = (new BlockPumpkin(91, true)).setHardness(1.0F).setStepSound(soundWoodFootstep).setLightValue(1.0F).setUnlocalizedName("litpumpkin").setTextureName("pumpkin"); + public static final Block cake = (new BlockCake(92)).setHardness(0.5F).setStepSound(soundClothFootstep).setUnlocalizedName("cake").disableStats().setTextureName("cake"); + public static final BlockRedstoneRepeater redstoneRepeaterIdle = (BlockRedstoneRepeater)(new BlockRedstoneRepeater(93, false)).setHardness(0.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("diode").disableStats().setTextureName("repeater_off"); + public static final BlockRedstoneRepeater redstoneRepeaterActive = (BlockRedstoneRepeater)(new BlockRedstoneRepeater(94, true)).setHardness(0.0F).setLightValue(0.625F).setStepSound(soundWoodFootstep).setUnlocalizedName("diode").disableStats().setTextureName("repeater_on"); + + /** + * April fools secret locked chest, only spawns on new chunks on 1st April. + */ + public static final Block lockedChest = (new BlockLockedChest(95)).setHardness(0.0F).setLightValue(1.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("lockedchest").setTickRandomly(true); + public static final Block trapdoor = (new BlockTrapDoor(96, Material.wood)).setHardness(3.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("trapdoor").disableStats().setTextureName("trapdoor"); + public static final Block silverfish = (new BlockSilverfish(97)).setHardness(0.75F).setUnlocalizedName("monsterStoneEgg"); + public static final Block stoneBrick = (new BlockStoneBrick(98)).setHardness(1.5F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("stonebricksmooth").setTextureName("stonebrick"); + public static final Block mushroomCapBrown = (new BlockMushroomCap(99, Material.wood, 0)).setHardness(0.2F).setStepSound(soundWoodFootstep).setUnlocalizedName("mushroom").setTextureName("mushroom_block"); + public static final Block mushroomCapRed = (new BlockMushroomCap(100, Material.wood, 1)).setHardness(0.2F).setStepSound(soundWoodFootstep).setUnlocalizedName("mushroom").setTextureName("mushroom_block"); + public static final Block fenceIron = (new BlockPane(101, "iron_bars", "iron_bars", Material.iron, true)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setUnlocalizedName("fenceIron"); + public static final Block thinGlass = (new BlockPane(102, "glass", "glass_pane_top", Material.glass, false)).setHardness(0.3F).setStepSound(soundGlassFootstep).setUnlocalizedName("thinGlass"); + public static final Block melon = (new BlockMelon(103)).setHardness(1.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("melon").setTextureName("melon"); + public static final Block pumpkinStem = (new BlockStem(104, pumpkin)).setHardness(0.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("pumpkinStem").setTextureName("pumpkin_stem"); + public static final Block melonStem = (new BlockStem(105, melon)).setHardness(0.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("pumpkinStem").setTextureName("melon_stem"); + public static final Block vine = (new BlockVine(106)).setHardness(0.2F).setStepSound(soundGrassFootstep).setUnlocalizedName("vine").setTextureName("vine"); + public static final Block fenceGate = (new BlockFenceGate(107)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("fenceGate"); + public static final Block stairsBrick = (new BlockStairs(108, brick, 0)).setUnlocalizedName("stairsBrick"); + public static final Block stairsStoneBrick = (new BlockStairs(109, stoneBrick, 0)).setUnlocalizedName("stairsStoneBrickSmooth"); + public static final BlockMycelium mycelium = (BlockMycelium)(new BlockMycelium(110)).setHardness(0.6F).setStepSound(soundGrassFootstep).setUnlocalizedName("mycel").setTextureName("mycelium"); + public static final Block waterlily = (new BlockLilyPad(111)).setHardness(0.0F).setStepSound(soundGrassFootstep).setUnlocalizedName("waterlily").setTextureName("waterlily"); + public static final Block netherBrick = (new Block(112, Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("netherBrick").setCreativeTab(CreativeTabs.tabBlock).setTextureName("nether_brick"); + public static final Block netherFence = (new BlockFence(113, "nether_brick", Material.rock)).setHardness(2.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("netherFence"); + public static final Block stairsNetherBrick = (new BlockStairs(114, netherBrick, 0)).setUnlocalizedName("stairsNetherBrick"); + public static final Block netherStalk = (new BlockNetherStalk(115)).setUnlocalizedName("netherStalk").setTextureName("nether_wart"); + public static final Block enchantmentTable = (new BlockEnchantmentTable(116)).setHardness(5.0F).setResistance(2000.0F).setUnlocalizedName("enchantmentTable").setTextureName("enchanting_table"); + public static final Block brewingStand = (new BlockBrewingStand(117)).setHardness(0.5F).setLightValue(0.125F).setUnlocalizedName("brewingStand").setTextureName("brewing_stand"); + public static final BlockCauldron cauldron = (BlockCauldron)(new BlockCauldron(118)).setHardness(2.0F).setUnlocalizedName("cauldron").setTextureName("cauldron"); + public static final Block endPortal = (new BlockEndPortal(119, Material.portal)).setHardness(-1.0F).setResistance(6000000.0F); + public static final Block endPortalFrame = (new BlockEndPortalFrame(120)).setStepSound(soundGlassFootstep).setLightValue(0.125F).setHardness(-1.0F).setUnlocalizedName("endPortalFrame").setResistance(6000000.0F).setCreativeTab(CreativeTabs.tabDecorations).setTextureName("endframe"); + + /** The rock found in The End. */ + public static final Block whiteStone = (new Block(121, Material.rock)).setHardness(3.0F).setResistance(15.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("whiteStone").setCreativeTab(CreativeTabs.tabBlock).setTextureName("end_stone"); + public static final Block dragonEgg = (new BlockDragonEgg(122)).setHardness(3.0F).setResistance(15.0F).setStepSound(soundStoneFootstep).setLightValue(0.125F).setUnlocalizedName("dragonEgg").setTextureName("dragon_egg"); + public static final Block redstoneLampIdle = (new BlockRedstoneLight(123, false)).setHardness(0.3F).setStepSound(soundGlassFootstep).setUnlocalizedName("redstoneLight").setCreativeTab(CreativeTabs.tabRedstone).setTextureName("redstone_lamp_off"); + public static final Block redstoneLampActive = (new BlockRedstoneLight(124, true)).setHardness(0.3F).setStepSound(soundGlassFootstep).setUnlocalizedName("redstoneLight").setTextureName("redstone_lamp_on"); + public static final BlockHalfSlab woodDoubleSlab = (BlockHalfSlab)(new BlockWoodSlab(125, true)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("woodSlab"); + public static final BlockHalfSlab woodSingleSlab = (BlockHalfSlab)(new BlockWoodSlab(126, false)).setHardness(2.0F).setResistance(5.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("woodSlab"); + public static final Block cocoaPlant = (new BlockCocoa(127)).setHardness(0.2F).setResistance(5.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("cocoa").setTextureName("cocoa"); + public static final Block stairsSandStone = (new BlockStairs(128, sandStone, 0)).setUnlocalizedName("stairsSandStone"); + public static final Block oreEmerald = (new BlockOre(129)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("oreEmerald").setTextureName("emerald_ore"); + public static final Block enderChest = (new BlockEnderChest(130)).setHardness(22.5F).setResistance(1000.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("enderChest").setLightValue(0.5F); + public static final BlockTripWireSource tripWireSource = (BlockTripWireSource)(new BlockTripWireSource(131)).setUnlocalizedName("tripWireSource").setTextureName("trip_wire_source"); + public static final Block tripWire = (new BlockTripWire(132)).setUnlocalizedName("tripWire").setTextureName("trip_wire"); + public static final Block blockEmerald = (new BlockOreStorage(133)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setUnlocalizedName("blockEmerald").setTextureName("emerald_block"); + public static final Block stairsWoodSpruce = (new BlockStairs(134, planks, 1)).setUnlocalizedName("stairsWoodSpruce"); + public static final Block stairsWoodBirch = (new BlockStairs(135, planks, 2)).setUnlocalizedName("stairsWoodBirch"); + public static final Block stairsWoodJungle = (new BlockStairs(136, planks, 3)).setUnlocalizedName("stairsWoodJungle"); + public static final Block commandBlock = (new BlockCommandBlock(137)).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("commandBlock").setTextureName("command_block"); + public static final BlockBeacon beacon = (BlockBeacon)(new BlockBeacon(138)).setUnlocalizedName("beacon").setLightValue(1.0F).setTextureName("beacon"); + public static final Block cobblestoneWall = (new BlockWall(139, cobblestone)).setUnlocalizedName("cobbleWall"); + public static final Block flowerPot = (new BlockFlowerPot(140)).setHardness(0.0F).setStepSound(soundPowderFootstep).setUnlocalizedName("flowerPot").setTextureName("flower_pot"); + public static final Block carrot = (new BlockCarrot(141)).setUnlocalizedName("carrots").setTextureName("carrots"); + public static final Block potato = (new BlockPotato(142)).setUnlocalizedName("potatoes").setTextureName("potatoes"); + public static final Block woodenButton = (new BlockButtonWood(143)).setHardness(0.5F).setStepSound(soundWoodFootstep).setUnlocalizedName("button"); + public static final Block skull = (new BlockSkull(144)).setHardness(1.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("skull").setTextureName("skull"); + public static final Block anvil = (new BlockAnvil(145)).setHardness(5.0F).setStepSound(soundAnvilFootstep).setResistance(2000.0F).setUnlocalizedName("anvil"); + public static final Block chestTrapped = (new BlockChest(146, 1)).setHardness(2.5F).setStepSound(soundWoodFootstep).setUnlocalizedName("chestTrap"); + public static final Block pressurePlateGold = (new BlockPressurePlateWeighted(147, "gold_block", Material.iron, 64)).setHardness(0.5F).setStepSound(soundWoodFootstep).setUnlocalizedName("weightedPlate_light"); + public static final Block pressurePlateIron = (new BlockPressurePlateWeighted(148, "iron_block", Material.iron, 640)).setHardness(0.5F).setStepSound(soundWoodFootstep).setUnlocalizedName("weightedPlate_heavy"); + public static final BlockComparator redstoneComparatorIdle = (BlockComparator)(new BlockComparator(149, false)).setHardness(0.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("comparator").disableStats().setTextureName("comparator_off"); + public static final BlockComparator redstoneComparatorActive = (BlockComparator)(new BlockComparator(150, true)).setHardness(0.0F).setLightValue(0.625F).setStepSound(soundWoodFootstep).setUnlocalizedName("comparator").disableStats().setTextureName("comparator_on"); + public static final BlockDaylightDetector daylightSensor = (BlockDaylightDetector)(new BlockDaylightDetector(151)).setHardness(0.2F).setStepSound(soundWoodFootstep).setUnlocalizedName("daylightDetector").setTextureName("daylight_detector"); + public static final Block blockRedstone = (new BlockPoweredOre(152)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundMetalFootstep).setUnlocalizedName("blockRedstone").setTextureName("redstone_block"); + public static final Block oreNetherQuartz = (new BlockOre(153)).setHardness(3.0F).setResistance(5.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("netherquartz").setTextureName("quartz_ore"); + public static final BlockHopper hopperBlock = (BlockHopper)(new BlockHopper(154)).setHardness(3.0F).setResistance(8.0F).setStepSound(soundWoodFootstep).setUnlocalizedName("hopper").setTextureName("hopper"); + public static final Block blockNetherQuartz = (new BlockQuartz(155)).setStepSound(soundStoneFootstep).setHardness(0.8F).setUnlocalizedName("quartzBlock").setTextureName("quartz_block"); + public static final Block stairsNetherQuartz = (new BlockStairs(156, blockNetherQuartz, 0)).setUnlocalizedName("stairsQuartz"); + public static final Block railActivator = (new BlockRailPowered(157)).setHardness(0.7F).setStepSound(soundMetalFootstep).setUnlocalizedName("activatorRail").setTextureName("rail_activator"); + public static final Block dropper = (new BlockDropper(158)).setHardness(3.5F).setStepSound(soundStoneFootstep).setUnlocalizedName("dropper").setTextureName("dropper"); + public static final Block stainedClay = (new BlockColored(159, Material.rock)).setHardness(1.25F).setResistance(7.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("clayHardenedStained").setTextureName("hardened_clay_stained"); + public static final Block hay = (new BlockHay(170)).setHardness(0.5F).setStepSound(soundGrassFootstep).setUnlocalizedName("hayBlock").setCreativeTab(CreativeTabs.tabBlock).setTextureName("hay_block"); + public static final Block carpet = (new BlockCarpet(171)).setHardness(0.1F).setStepSound(soundClothFootstep).setUnlocalizedName("woolCarpet").setLightOpacity(0); + public static final Block hardenedClay = (new Block(172, Material.rock)).setHardness(1.25F).setResistance(7.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("clayHardened").setCreativeTab(CreativeTabs.tabBlock).setTextureName("hardened_clay"); + public static final Block coalBlock = (new Block(173, Material.rock)).setHardness(5.0F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("blockCoal").setCreativeTab(CreativeTabs.tabBlock).setTextureName("coal_block"); + + /** ID of the block. */ + public final int blockID; + + /** Indicates how many hits it takes to break a block. */ + protected float blockHardness; + + /** Indicates the blocks resistance to explosions. */ + protected float blockResistance; + + /** + * set to true when Block's constructor is called through the chain of super()'s. Note: Never used + */ + protected boolean blockConstructorCalled = true; + + /** + * If this field is true, the block is counted for statistics (mined or placed) + */ + protected boolean enableStats = true; + + /** + * Flags whether or not this block is of a type that needs random ticking. Ref-counted by ExtendedBlockStorage in + * order to broadly cull a chunk from the random chunk update list for efficiency's sake. + */ + protected boolean needsRandomTick; + + /** true if the Block contains a Tile Entity */ + protected boolean isBlockContainer; + + /** minimum X for the block bounds (local coordinates) */ + protected double minX; + + /** minimum Y for the block bounds (local coordinates) */ + protected double minY; + + /** minimum Z for the block bounds (local coordinates) */ + protected double minZ; + + /** maximum X for the block bounds (local coordinates) */ + protected double maxX; + + /** maximum Y for the block bounds (local coordinates) */ + protected double maxY; + + /** maximum Z for the block bounds (local coordinates) */ + protected double maxZ; + + /** Sound of stepping on the block */ + public StepSound stepSound; + public float blockParticleGravity; + + /** Block material definition. */ + public final Material blockMaterial; + + /** + * Determines how much velocity is maintained while moving on top of this block + */ + public float slipperiness; + + /** The unlocalized name of this block. */ + private String unlocalizedName; + protected Icon blockIcon; + + protected Block(int par1, Material par2Material) + { + this.stepSound = soundPowderFootstep; + this.blockParticleGravity = 1.0F; + this.slipperiness = 0.6F; + + if (blocksList[par1] != null) + { + throw new IllegalArgumentException("Slot " + par1 + " is already occupied by " + blocksList[par1] + " when adding " + this); + } + else + { + this.blockMaterial = par2Material; + blocksList[par1] = this; + this.blockID = par1; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + opaqueCubeLookup[par1] = this.isOpaqueCube(); + lightOpacity[par1] = this.isOpaqueCube() ? 255 : 0; + canBlockGrass[par1] = !par2Material.getCanBlockGrass(); + } + } + + /** + * This method is called on a block after all other blocks gets already created. You can use it to reference and + * configure something on the block that needs the others ones. + */ + protected void initializeBlock() {} + + /** + * Sets the footstep sound for the block. Returns the object for convenience in constructing. + */ + protected Block setStepSound(StepSound par1StepSound) + { + this.stepSound = par1StepSound; + return this; + } + + /** + * Sets how much light is blocked going through this block. Returns the object for convenience in constructing. + */ + protected Block setLightOpacity(int par1) + { + lightOpacity[this.blockID] = par1; + return this; + } + + /** + * Sets the amount of light emitted by a block from 0.0f to 1.0f (converts internally to 0-15). Returns the object + * for convenience in constructing. + */ + protected Block setLightValue(float par1) + { + lightValue[this.blockID] = (int)(15.0F * par1); + return this; + } + + /** + * Sets the the blocks resistance to explosions. Returns the object for convenience in constructing. + */ + protected Block setResistance(float par1) + { + this.blockResistance = par1 * 3.0F; + return this; + } + + public static boolean isNormalCube(int par0) + { + Block var1 = blocksList[par0]; + return var1 == null ? false : var1.blockMaterial.isOpaque() && var1.renderAsNormalBlock() && !var1.canProvidePower(); + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return true; + } + + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return !this.blockMaterial.blocksMovement(); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 0; + } + + /** + * Sets how many hits it takes to break a block. + */ + protected Block setHardness(float par1) + { + this.blockHardness = par1; + + if (this.blockResistance < par1 * 5.0F) + { + this.blockResistance = par1 * 5.0F; + } + + return this; + } + + /** + * This method will make the hardness of the block equals to -1, and the block is indestructible. + */ + protected Block setBlockUnbreakable() + { + this.setHardness(-1.0F); + return this; + } + + /** + * Returns the block hardness at a location. Args: world, x, y, z + */ + public float getBlockHardness(World par1World, int par2, int par3, int par4) + { + return this.blockHardness; + } + + /** + * Sets whether this block type will receive random update ticks + */ + protected Block setTickRandomly(boolean par1) + { + this.needsRandomTick = par1; + return this; + } + + /** + * Returns whether or not this block is of a type that needs random ticking. Called for ref-counting purposes by + * ExtendedBlockStorage in order to broadly cull a chunk from the random chunk update list for efficiency's sake. + */ + public boolean getTickRandomly() + { + return this.needsRandomTick; + } + + public boolean hasTileEntity() + { + return this.isBlockContainer; + } + + /** + * Sets the bounds of the block. minX, minY, minZ, maxX, maxY, maxZ + */ + protected final void setBlockBounds(float par1, float par2, float par3, float par4, float par5, float par6) + { + this.minX = (double)par1; + this.minY = (double)par2; + this.minZ = (double)par3; + this.maxX = (double)par4; + this.maxY = (double)par5; + this.maxZ = (double)par6; + } + + /** + * How bright to render this block based on the light its receiving. Args: iBlockAccess, x, y, z + */ + public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return par1IBlockAccess.getBrightness(par2, par3, par4, lightValue[par1IBlockAccess.getBlockId(par2, par3, par4)]); + } + + /** + * Goes straight to getLightBrightnessForSkyBlocks for Blocks, does some fancy computing for Fluids + */ + public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, lightValue[par1IBlockAccess.getBlockId(par2, par3, par4)]); + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return par5 == 0 && this.minY > 0.0D ? true : (par5 == 1 && this.maxY < 1.0D ? true : (par5 == 2 && this.minZ > 0.0D ? true : (par5 == 3 && this.maxZ < 1.0D ? true : (par5 == 4 && this.minX > 0.0D ? true : (par5 == 5 && this.maxX < 1.0D ? true : !par1IBlockAccess.isBlockOpaqueCube(par2, par3, par4)))))); + } + + /** + * Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the + * adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side + */ + public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return par1IBlockAccess.getBlockMaterial(par2, par3, par4).isSolid(); + } + + /** + * Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side + */ + public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return this.getIcon(par5, par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return this.blockIcon; + } + + /** + * Returns the block texture based on the side being looked at. Args: side + */ + public final Icon getBlockTextureFromSide(int par1) + { + return this.getIcon(par1, 0); + } + + /** + * Returns the bounding box of the wired rectangular prism to render. + */ + public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return AxisAlignedBB.getAABBPool().getAABB((double)par2 + this.minX, (double)par3 + this.minY, (double)par4 + this.minZ, (double)par2 + this.maxX, (double)par3 + this.maxY, (double)par4 + this.maxZ); + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + AxisAlignedBB var8 = this.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); + + if (var8 != null && par5AxisAlignedBB.intersectsWith(var8)) + { + par6List.add(var8); + } + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return AxisAlignedBB.getAABBPool().getAABB((double)par2 + this.minX, (double)par3 + this.minY, (double)par4 + this.minZ, (double)par2 + this.maxX, (double)par3 + this.maxY, (double)par4 + this.maxZ); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return true; + } + + /** + * Returns whether this block is collideable based on the arguments passed in \n@param par1 block metaData \n@param + * par2 whether the player right-clicked while holding a boat + */ + public boolean canCollideCheck(int par1, boolean par2) + { + return this.isCollidable(); + } + + /** + * Returns if this block is collidable (only used by Fire). Args: x, y, z + */ + public boolean isCollidable() + { + return true; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {} + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {} + + /** + * Called right before the block is destroyed by a player. Args: world, x, y, z, metaData + */ + public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {} + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) {} + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 10; + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) {} + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {} + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 1; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return this.blockID; + } + + /** + * Gets the hardness of block at the given coordinates in the given world, relative to the ability of the given + * EntityPlayer. + */ + public float getPlayerRelativeBlockHardness(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5) + { + float var6 = this.getBlockHardness(par2World, par3, par4, par5); + return var6 < 0.0F ? 0.0F : (!par1EntityPlayer.canHarvestBlock(this) ? par1EntityPlayer.getCurrentPlayerStrVsBlock(this, false) / var6 / 100.0F : par1EntityPlayer.getCurrentPlayerStrVsBlock(this, true) / var6 / 30.0F); + } + + /** + * Drops the specified block items + */ + public final void dropBlockAsItem(World par1World, int par2, int par3, int par4, int par5, int par6) + { + this.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, 1.0F, par6); + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + if (!par1World.isRemote) + { + int var8 = this.quantityDroppedWithBonus(par7, par1World.rand); + + for (int var9 = 0; var9 < var8; ++var9) + { + if (par1World.rand.nextFloat() <= par6) + { + int var10 = this.idDropped(par5, par1World.rand, par7); + + if (var10 > 0) + { + this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var10, 1, this.damageDropped(par5))); + } + } + } + } + } + + /** + * Spawns EntityItem in the world for the given ItemStack if the world is not remote. + */ + protected void dropBlockAsItem_do(World par1World, int par2, int par3, int par4, ItemStack par5ItemStack) + { + if (!par1World.isRemote && par1World.getGameRules().getGameRuleBooleanValue("doTileDrops")) + { + float var6 = 0.7F; + double var7 = (double)(par1World.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D; + double var9 = (double)(par1World.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D; + double var11 = (double)(par1World.rand.nextFloat() * var6) + (double)(1.0F - var6) * 0.5D; + EntityItem var13 = new EntityItem(par1World, (double)par2 + var7, (double)par3 + var9, (double)par4 + var11, par5ItemStack); + var13.delayBeforeCanPickup = 10; + par1World.spawnEntityInWorld(var13); + } + } + + /** + * called by spawner, ore, redstoneOre blocks + */ + protected void dropXpOnBlockBreak(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isRemote) + { + while (par5 > 0) + { + int var6 = EntityXPOrb.getXPSplit(par5); + par5 -= var6; + par1World.spawnEntityInWorld(new EntityXPOrb(par1World, (double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, var6)); + } + } + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return 0; + } + + /** + * Returns how much this block can resist explosions from the passed in entity. + */ + public float getExplosionResistance(Entity par1Entity) + { + return this.blockResistance / 5.0F; + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, + * x, y, z, startVec, endVec + */ + public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + par5Vec3 = par5Vec3.addVector((double)(-par2), (double)(-par3), (double)(-par4)); + par6Vec3 = par6Vec3.addVector((double)(-par2), (double)(-par3), (double)(-par4)); + Vec3 var7 = par5Vec3.getIntermediateWithXValue(par6Vec3, this.minX); + Vec3 var8 = par5Vec3.getIntermediateWithXValue(par6Vec3, this.maxX); + Vec3 var9 = par5Vec3.getIntermediateWithYValue(par6Vec3, this.minY); + Vec3 var10 = par5Vec3.getIntermediateWithYValue(par6Vec3, this.maxY); + Vec3 var11 = par5Vec3.getIntermediateWithZValue(par6Vec3, this.minZ); + Vec3 var12 = par5Vec3.getIntermediateWithZValue(par6Vec3, this.maxZ); + + if (!this.isVecInsideYZBounds(var7)) + { + var7 = null; + } + + if (!this.isVecInsideYZBounds(var8)) + { + var8 = null; + } + + if (!this.isVecInsideXZBounds(var9)) + { + var9 = null; + } + + if (!this.isVecInsideXZBounds(var10)) + { + var10 = null; + } + + if (!this.isVecInsideXYBounds(var11)) + { + var11 = null; + } + + if (!this.isVecInsideXYBounds(var12)) + { + var12 = null; + } + + Vec3 var13 = null; + + if (var7 != null && (var13 == null || par5Vec3.squareDistanceTo(var7) < par5Vec3.squareDistanceTo(var13))) + { + var13 = var7; + } + + if (var8 != null && (var13 == null || par5Vec3.squareDistanceTo(var8) < par5Vec3.squareDistanceTo(var13))) + { + var13 = var8; + } + + if (var9 != null && (var13 == null || par5Vec3.squareDistanceTo(var9) < par5Vec3.squareDistanceTo(var13))) + { + var13 = var9; + } + + if (var10 != null && (var13 == null || par5Vec3.squareDistanceTo(var10) < par5Vec3.squareDistanceTo(var13))) + { + var13 = var10; + } + + if (var11 != null && (var13 == null || par5Vec3.squareDistanceTo(var11) < par5Vec3.squareDistanceTo(var13))) + { + var13 = var11; + } + + if (var12 != null && (var13 == null || par5Vec3.squareDistanceTo(var12) < par5Vec3.squareDistanceTo(var13))) + { + var13 = var12; + } + + if (var13 == null) + { + return null; + } + else + { + byte var14 = -1; + + if (var13 == var7) + { + var14 = 4; + } + + if (var13 == var8) + { + var14 = 5; + } + + if (var13 == var9) + { + var14 = 0; + } + + if (var13 == var10) + { + var14 = 1; + } + + if (var13 == var11) + { + var14 = 2; + } + + if (var13 == var12) + { + var14 = 3; + } + + return new MovingObjectPosition(par2, par3, par4, var14, var13.addVector((double)par2, (double)par3, (double)par4)); + } + } + + /** + * Checks if a vector is within the Y and Z bounds of the block. + */ + private boolean isVecInsideYZBounds(Vec3 par1Vec3) + { + return par1Vec3 == null ? false : par1Vec3.yCoord >= this.minY && par1Vec3.yCoord <= this.maxY && par1Vec3.zCoord >= this.minZ && par1Vec3.zCoord <= this.maxZ; + } + + /** + * Checks if a vector is within the X and Z bounds of the block. + */ + private boolean isVecInsideXZBounds(Vec3 par1Vec3) + { + return par1Vec3 == null ? false : par1Vec3.xCoord >= this.minX && par1Vec3.xCoord <= this.maxX && par1Vec3.zCoord >= this.minZ && par1Vec3.zCoord <= this.maxZ; + } + + /** + * Checks if a vector is within the X and Y bounds of the block. + */ + private boolean isVecInsideXYBounds(Vec3 par1Vec3) + { + return par1Vec3 == null ? false : par1Vec3.xCoord >= this.minX && par1Vec3.xCoord <= this.maxX && par1Vec3.yCoord >= this.minY && par1Vec3.yCoord <= this.maxY; + } + + /** + * Called upon the block being destroyed by an explosion + */ + public void onBlockDestroyedByExplosion(World par1World, int par2, int par3, int par4, Explosion par5Explosion) {} + + /** + * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha + */ + public int getRenderBlockPass() + { + return 0; + } + + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5, ItemStack par6ItemStack) + { + return this.canPlaceBlockOnSide(par1World, par2, par3, par4, par5); + } + + /** + * checks to see if you can place this block can be placed on that side of a block: BlockLever overrides + */ + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + { + return this.canPlaceBlockAt(par1World, par2, par3, par4); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockId(par2, par3, par4); + return var5 == 0 || blocksList[var5].blockMaterial.isReplaceable(); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + return false; + } + + /** + * Called whenever an entity is walking on top of this block. Args: world, x, y, z, entity + */ + public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity) {} + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + return par9; + } + + /** + * Called when the block is clicked by a player. Args: x, y, z, entityPlayer + */ + public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) {} + + /** + * Can add to the passed in vector for a movement vector to be applied to the entity. Args: x, y, z, entity, vec3d + */ + public void velocityToAddToEntity(World par1World, int par2, int par3, int par4, Entity par5Entity, Vec3 par6Vec3) {} + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {} + + /** + * returns the block bounderies minX value + */ + public final double getBlockBoundsMinX() + { + return this.minX; + } + + /** + * returns the block bounderies maxX value + */ + public final double getBlockBoundsMaxX() + { + return this.maxX; + } + + /** + * returns the block bounderies minY value + */ + public final double getBlockBoundsMinY() + { + return this.minY; + } + + /** + * returns the block bounderies maxY value + */ + public final double getBlockBoundsMaxY() + { + return this.maxY; + } + + /** + * returns the block bounderies minZ value + */ + public final double getBlockBoundsMinZ() + { + return this.minZ; + } + + /** + * returns the block bounderies maxZ value + */ + public final double getBlockBoundsMaxZ() + { + return this.maxZ; + } + + public int getBlockColor() + { + return 16777215; + } + + /** + * Returns the color this block should be rendered. Used by leaves. + */ + public int getRenderColor(int par1) + { + return 16777215; + } + + /** + * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called + * when first determining what to render. + */ + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return 16777215; + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return 0; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return false; + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {} + + /** + * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, + * side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return 0; + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() {} + + /** + * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the + * block and l is the block's subtype/damage. + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) + { + par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); + par2EntityPlayer.addExhaustion(0.025F); + + if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) + { + ItemStack var8 = this.createStackedBlock(par6); + + if (var8 != null) + { + this.dropBlockAsItem_do(par1World, par3, par4, par5, var8); + } + } + else + { + int var7 = EnchantmentHelper.getFortuneModifier(par2EntityPlayer); + this.dropBlockAsItem(par1World, par3, par4, par5, par6, var7); + } + } + + /** + * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops. + */ + protected boolean canSilkHarvest() + { + return this.renderAsNormalBlock() && !this.isBlockContainer; + } + + /** + * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage + * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null. + */ + protected ItemStack createStackedBlock(int par1) + { + int var2 = 0; + + if (this.blockID >= 0 && this.blockID < Item.itemsList.length && Item.itemsList[this.blockID].getHasSubtypes()) + { + var2 = par1; + } + + return new ItemStack(this.blockID, 1, var2); + } + + /** + * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive). + */ + public int quantityDroppedWithBonus(int par1, Random par2Random) + { + return this.quantityDropped(par2Random); + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) + { + return true; + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {} + + /** + * Called after a block is placed + */ + public void onPostBlockPlaced(World par1World, int par2, int par3, int par4, int par5) {} + + public Block setUnlocalizedName(String par1Str) + { + this.unlocalizedName = par1Str; + return this; + } + + /** + * Gets the localized name of this block. Used for the statistics page. + */ + public String getLocalizedName() + { + return StatCollector.translateToLocal(this.getUnlocalizedName() + ".name"); + } + + /** + * Returns the unlocalized name of this block. + */ + public String getUnlocalizedName() + { + return "tile." + this.unlocalizedName; + } + + /** + * Called when the block receives a BlockEvent - see World.addBlockEvent. By default, passes it on to the tile + * entity at this location. Args: world, x, y, z, blockID, EventID, event parameter + */ + public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) + { + return false; + } + + /** + * Return the state of blocks statistics flags - if the block is counted for mined and placed. + */ + public boolean getEnableStats() + { + return this.enableStats; + } + + /** + * Disable statistics for the block, the block will no count for mined or placed. + */ + protected Block disableStats() + { + this.enableStats = false; + return this; + } + + /** + * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility + * and stop pistons + */ + public int getMobilityFlag() + { + return this.blockMaterial.getMaterialMobility(); + } + + /** + * Returns the default ambient occlusion value based on block opacity + */ + public float getAmbientOcclusionLightValue(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return par1IBlockAccess.isBlockNormalCube(par2, par3, par4) ? 0.2F : 1.0F; + } + + /** + * Block's chance to react to an entity falling on it. + */ + public void onFallenUpon(World par1World, int par2, int par3, int par4, Entity par5Entity, float par6) {} + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return this.blockID; + } + + /** + * Get the block's damage value (for use with pick block). + */ + public int getDamageValue(World par1World, int par2, int par3, int par4) + { + return this.damageDropped(par1World.getBlockMetadata(par2, par3, par4)); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + } + + /** + * Returns the CreativeTab to display the given block on. + */ + public CreativeTabs getCreativeTabToDisplayOn() + { + return this.displayOnCreativeTab; + } + + /** + * Sets the CreativeTab to display this block on. + */ + public Block setCreativeTab(CreativeTabs par1CreativeTabs) + { + this.displayOnCreativeTab = par1CreativeTabs; + return this; + } + + /** + * Called when the block is attempted to be harvested + */ + public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {} + + /** + * Called on server worlds only when the block is about to be replaced by a different block or the same block with a + * different metadata value. Args: world, x, y, z, old metadata + */ + public void onBlockPreDestroy(World par1World, int par2, int par3, int par4, int par5) {} + + /** + * currently only used by BlockCauldron to incrament meta-data during rain + */ + public void fillWithRain(World par1World, int par2, int par3, int par4) {} + + /** + * Returns true only if block is flowerPot + */ + public boolean isFlowerPot() + { + return false; + } + + public boolean func_82506_l() + { + return true; + } + + /** + * Return whether this block can drop from an explosion. + */ + public boolean canDropFromExplosion(Explosion par1Explosion) + { + return true; + } + + /** + * Returns true if the given block ID is equivalent to this one. Example: redstoneTorchOn matches itself and + * redstoneTorchOff, and vice versa. Most blocks only match themselves. + */ + public boolean isAssociatedBlockID(int par1) + { + return this.blockID == par1; + } + + /** + * Static version of isAssociatedBlockID. + */ + public static boolean isAssociatedBlockID(int par0, int par1) + { + return par0 == par1 ? true : (par0 != 0 && par1 != 0 && blocksList[par0] != null && blocksList[par1] != null ? blocksList[par0].isAssociatedBlockID(par1) : false); + } + + /** + * If this returns true, then comparators facing away from this block will use the value from + * getComparatorInputOverride instead of the actual redstone signal strength. + */ + public boolean hasComparatorInputOverride() + { + return false; + } + + /** + * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal + * strength when this block inputs to a comparator. + */ + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) + { + return 0; + } + + protected Block setTextureName(String par1Str) + { + this.textureName = par1Str; + return this; + } + + protected String getTextureName() + { + return this.textureName == null ? "MISSING_ICON_TILE_" + this.blockID + "_" + this.unlocalizedName : this.textureName; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName()); + } + + /** + * Gets the icon name of the ItemBlock corresponding to this block. Used by hoppers. + */ + public String getItemIconName() + { + return null; + } + + static + { + Item.itemsList[cloth.blockID] = (new ItemCloth(cloth.blockID - 256)).setUnlocalizedName("cloth"); + Item.itemsList[stainedClay.blockID] = (new ItemCloth(stainedClay.blockID - 256)).setUnlocalizedName("clayHardenedStained"); + Item.itemsList[carpet.blockID] = (new ItemCloth(carpet.blockID - 256)).setUnlocalizedName("woolCarpet"); + Item.itemsList[wood.blockID] = (new ItemMultiTextureTile(wood.blockID - 256, wood, BlockLog.woodType)).setUnlocalizedName("log"); + Item.itemsList[planks.blockID] = (new ItemMultiTextureTile(planks.blockID - 256, planks, BlockWood.woodType)).setUnlocalizedName("wood"); + Item.itemsList[silverfish.blockID] = (new ItemMultiTextureTile(silverfish.blockID - 256, silverfish, BlockSilverfish.silverfishStoneTypes)).setUnlocalizedName("monsterStoneEgg"); + Item.itemsList[stoneBrick.blockID] = (new ItemMultiTextureTile(stoneBrick.blockID - 256, stoneBrick, BlockStoneBrick.STONE_BRICK_TYPES)).setUnlocalizedName("stonebricksmooth"); + Item.itemsList[sandStone.blockID] = (new ItemMultiTextureTile(sandStone.blockID - 256, sandStone, BlockSandStone.SAND_STONE_TYPES)).setUnlocalizedName("sandStone"); + Item.itemsList[blockNetherQuartz.blockID] = (new ItemMultiTextureTile(blockNetherQuartz.blockID - 256, blockNetherQuartz, BlockQuartz.quartzBlockTypes)).setUnlocalizedName("quartzBlock"); + Item.itemsList[stoneSingleSlab.blockID] = (new ItemSlab(stoneSingleSlab.blockID - 256, stoneSingleSlab, stoneDoubleSlab, false)).setUnlocalizedName("stoneSlab"); + Item.itemsList[stoneDoubleSlab.blockID] = (new ItemSlab(stoneDoubleSlab.blockID - 256, stoneSingleSlab, stoneDoubleSlab, true)).setUnlocalizedName("stoneSlab"); + Item.itemsList[woodSingleSlab.blockID] = (new ItemSlab(woodSingleSlab.blockID - 256, woodSingleSlab, woodDoubleSlab, false)).setUnlocalizedName("woodSlab"); + Item.itemsList[woodDoubleSlab.blockID] = (new ItemSlab(woodDoubleSlab.blockID - 256, woodSingleSlab, woodDoubleSlab, true)).setUnlocalizedName("woodSlab"); + Item.itemsList[sapling.blockID] = (new ItemMultiTextureTile(sapling.blockID - 256, sapling, BlockSapling.WOOD_TYPES)).setUnlocalizedName("sapling"); + Item.itemsList[leaves.blockID] = (new ItemLeaves(leaves.blockID - 256)).setUnlocalizedName("leaves"); + Item.itemsList[vine.blockID] = new ItemColored(vine.blockID - 256, false); + Item.itemsList[tallGrass.blockID] = (new ItemColored(tallGrass.blockID - 256, true)).setBlockNames(new String[] {"shrub", "grass", "fern"}); + Item.itemsList[snow.blockID] = new ItemSnow(snow.blockID - 256, snow); + Item.itemsList[waterlily.blockID] = new ItemLilyPad(waterlily.blockID - 256); + Item.itemsList[pistonBase.blockID] = new ItemPiston(pistonBase.blockID - 256); + Item.itemsList[pistonStickyBase.blockID] = new ItemPiston(pistonStickyBase.blockID - 256); + Item.itemsList[cobblestoneWall.blockID] = (new ItemMultiTextureTile(cobblestoneWall.blockID - 256, cobblestoneWall, BlockWall.types)).setUnlocalizedName("cobbleWall"); + Item.itemsList[anvil.blockID] = (new ItemAnvilBlock(anvil)).setUnlocalizedName("anvil"); + + for (int var0 = 0; var0 < 256; ++var0) + { + if (blocksList[var0] != null) + { + if (Item.itemsList[var0] == null) + { + Item.itemsList[var0] = new ItemBlock(var0 - 256); + blocksList[var0].initializeBlock(); + } + + boolean var1 = false; + + if (var0 > 0 && blocksList[var0].getRenderType() == 10) + { + var1 = true; + } + + if (var0 > 0 && blocksList[var0] instanceof BlockHalfSlab) + { + var1 = true; + } + + if (var0 == tilledField.blockID) + { + var1 = true; + } + + if (canBlockGrass[var0]) + { + var1 = true; + } + + if (lightOpacity[var0] == 0) + { + var1 = true; + } + + useNeighborBrightness[var0] = var1; + } + } + + canBlockGrass[0] = true; + StatList.initBreakableStats(); + } +} diff --git a/src/main/java/net/minecraft/src/BlockAnvil.java b/src/main/java/net/minecraft/src/BlockAnvil.java new file mode 100644 index 0000000..538cb6f --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockAnvil.java @@ -0,0 +1,182 @@ +package net.minecraft.src; + +import java.util.List; + +public class BlockAnvil extends BlockSand +{ + /** List of types/statues the Anvil can be in. */ + public static final String[] statuses = new String[] {"intact", "slightlyDamaged", "veryDamaged"}; + private static final String[] anvilIconNames = new String[] {"anvil_top_damaged_0", "anvil_top_damaged_1", "anvil_top_damaged_2"}; + public int field_82521_b; + private Icon[] iconArray; + + protected BlockAnvil(int par1) + { + super(par1, Material.anvil); + this.setLightOpacity(0); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + if (this.field_82521_b == 3 && par1 == 1) + { + int var3 = (par2 >> 2) % this.iconArray.length; + return this.iconArray[var3]; + } + else + { + return this.blockIcon; + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon("anvil_base"); + this.iconArray = new Icon[anvilIconNames.length]; + + for (int var2 = 0; var2 < this.iconArray.length; ++var2) + { + this.iconArray[var2] = par1IconRegister.registerIcon(anvilIconNames[var2]); + } + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int var8 = par1World.getBlockMetadata(par2, par3, par4) >> 2; + ++var7; + var7 %= 4; + + if (var7 == 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 | var8 << 2, 2); + } + + if (var7 == 1) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 3 | var8 << 2, 2); + } + + if (var7 == 2) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 0 | var8 << 2, 2); + } + + if (var7 == 3) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 | var8 << 2, 2); + } + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + par5EntityPlayer.displayGUIAnvil(par2, par3, par4); + return true; + } + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 35; + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1 >> 2; + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 3; + + if (var5 != 3 && var5 != 1) + { + this.setBlockBounds(0.125F, 0.0F, 0.0F, 0.875F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.125F, 1.0F, 1.0F, 0.875F); + } + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + } + + /** + * Called when the falling block entity for this block is created + */ + protected void onStartFalling(EntityFallingSand par1EntityFallingSand) + { + par1EntityFallingSand.setIsAnvil(true); + } + + /** + * Called when the falling block entity for this block hits the ground and turns back into a block + */ + public void onFinishFalling(World par1World, int par2, int par3, int par4, int par5) + { + par1World.playAuxSFX(1022, par2, par3, par4, 0); + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/BlockBasePressurePlate.java b/src/main/java/net/minecraft/src/BlockBasePressurePlate.java new file mode 100644 index 0000000..d46fac1 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockBasePressurePlate.java @@ -0,0 +1,269 @@ +package net.minecraft.src; + +import java.util.Random; + +public abstract class BlockBasePressurePlate extends Block +{ + private String pressurePlateIconName; + + protected BlockBasePressurePlate(int par1, String par2Str, Material par3Material) + { + super(par1, par3Material); + this.pressurePlateIconName = par2Str; + this.setCreativeTab(CreativeTabs.tabRedstone); + this.setTickRandomly(true); + this.func_94353_c_(this.getMetaFromWeight(15)); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.func_94353_c_(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + } + + protected void func_94353_c_(int par1) + { + boolean var2 = this.getPowerSupply(par1) > 0; + float var3 = 0.0625F; + + if (var2) + { + this.setBlockBounds(var3, 0.0F, var3, 1.0F - var3, 0.03125F, 1.0F - var3); + } + else + { + this.setBlockBounds(var3, 0.0F, var3, 1.0F - var3, 0.0625F, 1.0F - var3); + } + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 20; + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return true; + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) || BlockFence.isIdAFence(par1World.getBlockId(par2, par3 - 1, par4)); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + boolean var6 = false; + + if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !BlockFence.isIdAFence(par1World.getBlockId(par2, par3 - 1, par4))) + { + var6 = true; + } + + if (var6) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote) + { + int var6 = this.getPowerSupply(par1World.getBlockMetadata(par2, par3, par4)); + + if (var6 > 0) + { + this.setStateIfMobInteractsWithPlate(par1World, par2, par3, par4, var6); + } + } + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + if (!par1World.isRemote) + { + int var6 = this.getPowerSupply(par1World.getBlockMetadata(par2, par3, par4)); + + if (var6 == 0) + { + this.setStateIfMobInteractsWithPlate(par1World, par2, par3, par4, var6); + } + } + } + + /** + * Checks if there are mobs on the plate. If a mob is on the plate and it is off, it turns it on, and vice versa. + */ + protected void setStateIfMobInteractsWithPlate(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = this.getPlateState(par1World, par2, par3, par4); + boolean var7 = par5 > 0; + boolean var8 = var6 > 0; + + if (par5 != var6) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, this.getMetaFromWeight(var6), 2); + this.func_94354_b_(par1World, par2, par3, par4); + par1World.markBlockRangeForRenderUpdate(par2, par3, par4, par2, par3, par4); + } + + if (!var8 && var7) + { + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.1D, (double)par4 + 0.5D, "random.click", 0.3F, 0.5F); + } + else if (var8 && !var7) + { + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.1D, (double)par4 + 0.5D, "random.click", 0.3F, 0.6F); + } + + if (var8) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + } + } + + protected AxisAlignedBB getSensitiveAABB(int par1, int par2, int par3) + { + float var4 = 0.125F; + return AxisAlignedBB.getAABBPool().getAABB((double)((float)par1 + var4), (double)par2, (double)((float)par3 + var4), (double)((float)(par1 + 1) - var4), (double)par2 + 0.25D, (double)((float)(par3 + 1) - var4)); + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + if (this.getPowerSupply(par6) > 0) + { + this.func_94354_b_(par1World, par2, par3, par4); + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + protected void func_94354_b_(World par1World, int par2, int par3, int par4) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return this.getPowerSupply(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + } + + /** + * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, + * side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return par5 == 1 ? this.getPowerSupply(par1IBlockAccess.getBlockMetadata(par2, par3, par4)) : 0; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float var1 = 0.5F; + float var2 = 0.125F; + float var3 = 0.5F; + this.setBlockBounds(0.5F - var1, 0.5F - var2, 0.5F - var3, 0.5F + var1, 0.5F + var2, 0.5F + var3); + } + + /** + * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility + * and stop pistons + */ + public int getMobilityFlag() + { + return 1; + } + + /** + * Returns the current state of the pressure plate. Returns a value between 0 and 15 based on the number of items on + * it. + */ + protected abstract int getPlateState(World var1, int var2, int var3, int var4); + + /** + * Argument is metadata. Returns power level (0-15) + */ + protected abstract int getPowerSupply(int var1); + + /** + * Argument is weight (0-15). Return the metadata to be set because of it. + */ + protected abstract int getMetaFromWeight(int var1); + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.pressurePlateIconName); + } +} diff --git a/src/main/java/net/minecraft/src/BlockBaseRailLogic.java b/src/main/java/net/minecraft/src/BlockBaseRailLogic.java new file mode 100644 index 0000000..d8fddb9 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockBaseRailLogic.java @@ -0,0 +1,450 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class BlockBaseRailLogic +{ + private World logicWorld; + private int railX; + private int railY; + private int railZ; + private final boolean isStraightRail; + + /** The chunk position the rail is at. */ + private List railChunkPosition; + + final BlockRailBase theRail; + + public BlockBaseRailLogic(BlockRailBase par1BlockRailBase, World par2World, int par3, int par4, int par5) + { + this.theRail = par1BlockRailBase; + this.railChunkPosition = new ArrayList(); + this.logicWorld = par2World; + this.railX = par3; + this.railY = par4; + this.railZ = par5; + int var6 = par2World.getBlockId(par3, par4, par5); + int var7 = par2World.getBlockMetadata(par3, par4, par5); + + if (((BlockRailBase)Block.blocksList[var6]).isPowered) + { + this.isStraightRail = true; + var7 &= -9; + } + else + { + this.isStraightRail = false; + } + + this.setBasicRail(var7); + } + + private void setBasicRail(int par1) + { + this.railChunkPosition.clear(); + + if (par1 == 0) + { + this.railChunkPosition.add(new ChunkPosition(this.railX, this.railY, this.railZ - 1)); + this.railChunkPosition.add(new ChunkPosition(this.railX, this.railY, this.railZ + 1)); + } + else if (par1 == 1) + { + this.railChunkPosition.add(new ChunkPosition(this.railX - 1, this.railY, this.railZ)); + this.railChunkPosition.add(new ChunkPosition(this.railX + 1, this.railY, this.railZ)); + } + else if (par1 == 2) + { + this.railChunkPosition.add(new ChunkPosition(this.railX - 1, this.railY, this.railZ)); + this.railChunkPosition.add(new ChunkPosition(this.railX + 1, this.railY + 1, this.railZ)); + } + else if (par1 == 3) + { + this.railChunkPosition.add(new ChunkPosition(this.railX - 1, this.railY + 1, this.railZ)); + this.railChunkPosition.add(new ChunkPosition(this.railX + 1, this.railY, this.railZ)); + } + else if (par1 == 4) + { + this.railChunkPosition.add(new ChunkPosition(this.railX, this.railY + 1, this.railZ - 1)); + this.railChunkPosition.add(new ChunkPosition(this.railX, this.railY, this.railZ + 1)); + } + else if (par1 == 5) + { + this.railChunkPosition.add(new ChunkPosition(this.railX, this.railY, this.railZ - 1)); + this.railChunkPosition.add(new ChunkPosition(this.railX, this.railY + 1, this.railZ + 1)); + } + else if (par1 == 6) + { + this.railChunkPosition.add(new ChunkPosition(this.railX + 1, this.railY, this.railZ)); + this.railChunkPosition.add(new ChunkPosition(this.railX, this.railY, this.railZ + 1)); + } + else if (par1 == 7) + { + this.railChunkPosition.add(new ChunkPosition(this.railX - 1, this.railY, this.railZ)); + this.railChunkPosition.add(new ChunkPosition(this.railX, this.railY, this.railZ + 1)); + } + else if (par1 == 8) + { + this.railChunkPosition.add(new ChunkPosition(this.railX - 1, this.railY, this.railZ)); + this.railChunkPosition.add(new ChunkPosition(this.railX, this.railY, this.railZ - 1)); + } + else if (par1 == 9) + { + this.railChunkPosition.add(new ChunkPosition(this.railX + 1, this.railY, this.railZ)); + this.railChunkPosition.add(new ChunkPosition(this.railX, this.railY, this.railZ - 1)); + } + } + + private void refreshConnectedTracks() + { + for (int var1 = 0; var1 < this.railChunkPosition.size(); ++var1) + { + BlockBaseRailLogic var2 = this.getRailLogic((ChunkPosition)this.railChunkPosition.get(var1)); + + if (var2 != null && var2.isRailChunkPositionCorrect(this)) + { + this.railChunkPosition.set(var1, new ChunkPosition(var2.railX, var2.railY, var2.railZ)); + } + else + { + this.railChunkPosition.remove(var1--); + } + } + } + + private boolean isMinecartTrack(int par1, int par2, int par3) + { + return BlockRailBase.isRailBlockAt(this.logicWorld, par1, par2, par3) ? true : (BlockRailBase.isRailBlockAt(this.logicWorld, par1, par2 + 1, par3) ? true : BlockRailBase.isRailBlockAt(this.logicWorld, par1, par2 - 1, par3)); + } + + private BlockBaseRailLogic getRailLogic(ChunkPosition par1ChunkPosition) + { + return BlockRailBase.isRailBlockAt(this.logicWorld, par1ChunkPosition.x, par1ChunkPosition.y, par1ChunkPosition.z) ? new BlockBaseRailLogic(this.theRail, this.logicWorld, par1ChunkPosition.x, par1ChunkPosition.y, par1ChunkPosition.z) : (BlockRailBase.isRailBlockAt(this.logicWorld, par1ChunkPosition.x, par1ChunkPosition.y + 1, par1ChunkPosition.z) ? new BlockBaseRailLogic(this.theRail, this.logicWorld, par1ChunkPosition.x, par1ChunkPosition.y + 1, par1ChunkPosition.z) : (BlockRailBase.isRailBlockAt(this.logicWorld, par1ChunkPosition.x, par1ChunkPosition.y - 1, par1ChunkPosition.z) ? new BlockBaseRailLogic(this.theRail, this.logicWorld, par1ChunkPosition.x, par1ChunkPosition.y - 1, par1ChunkPosition.z) : null)); + } + + /** + * Checks if the rail is at the chunk position it is expected to be. + */ + private boolean isRailChunkPositionCorrect(BlockBaseRailLogic par1BlockBaseRailLogic) + { + for (int var2 = 0; var2 < this.railChunkPosition.size(); ++var2) + { + ChunkPosition var3 = (ChunkPosition)this.railChunkPosition.get(var2); + + if (var3.x == par1BlockBaseRailLogic.railX && var3.z == par1BlockBaseRailLogic.railZ) + { + return true; + } + } + + return false; + } + + private boolean isPartOfTrack(int par1, int par2, int par3) + { + for (int var4 = 0; var4 < this.railChunkPosition.size(); ++var4) + { + ChunkPosition var5 = (ChunkPosition)this.railChunkPosition.get(var4); + + if (var5.x == par1 && var5.z == par3) + { + return true; + } + } + + return false; + } + + protected int getNumberOfAdjacentTracks() + { + int var1 = 0; + + if (this.isMinecartTrack(this.railX, this.railY, this.railZ - 1)) + { + ++var1; + } + + if (this.isMinecartTrack(this.railX, this.railY, this.railZ + 1)) + { + ++var1; + } + + if (this.isMinecartTrack(this.railX - 1, this.railY, this.railZ)) + { + ++var1; + } + + if (this.isMinecartTrack(this.railX + 1, this.railY, this.railZ)) + { + ++var1; + } + + return var1; + } + + private boolean canConnectTo(BlockBaseRailLogic par1BlockBaseRailLogic) + { + return this.isRailChunkPositionCorrect(par1BlockBaseRailLogic) ? true : (this.railChunkPosition.size() == 2 ? false : (this.railChunkPosition.isEmpty() ? true : true)); + } + + private void connectToNeighbor(BlockBaseRailLogic par1BlockBaseRailLogic) + { + this.railChunkPosition.add(new ChunkPosition(par1BlockBaseRailLogic.railX, par1BlockBaseRailLogic.railY, par1BlockBaseRailLogic.railZ)); + boolean var2 = this.isPartOfTrack(this.railX, this.railY, this.railZ - 1); + boolean var3 = this.isPartOfTrack(this.railX, this.railY, this.railZ + 1); + boolean var4 = this.isPartOfTrack(this.railX - 1, this.railY, this.railZ); + boolean var5 = this.isPartOfTrack(this.railX + 1, this.railY, this.railZ); + byte var6 = -1; + + if (var2 || var3) + { + var6 = 0; + } + + if (var4 || var5) + { + var6 = 1; + } + + if (!this.isStraightRail) + { + if (var3 && var5 && !var2 && !var4) + { + var6 = 6; + } + + if (var3 && var4 && !var2 && !var5) + { + var6 = 7; + } + + if (var2 && var4 && !var3 && !var5) + { + var6 = 8; + } + + if (var2 && var5 && !var3 && !var4) + { + var6 = 9; + } + } + + if (var6 == 0) + { + if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ - 1)) + { + var6 = 4; + } + + if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ + 1)) + { + var6 = 5; + } + } + + if (var6 == 1) + { + if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX + 1, this.railY + 1, this.railZ)) + { + var6 = 2; + } + + if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX - 1, this.railY + 1, this.railZ)) + { + var6 = 3; + } + } + + if (var6 < 0) + { + var6 = 0; + } + + int var7 = var6; + + if (this.isStraightRail) + { + var7 = this.logicWorld.getBlockMetadata(this.railX, this.railY, this.railZ) & 8 | var6; + } + + this.logicWorld.setBlockMetadataWithNotify(this.railX, this.railY, this.railZ, var7, 3); + } + + private boolean canConnectFrom(int par1, int par2, int par3) + { + BlockBaseRailLogic var4 = this.getRailLogic(new ChunkPosition(par1, par2, par3)); + + if (var4 == null) + { + return false; + } + else + { + var4.refreshConnectedTracks(); + return var4.canConnectTo(this); + } + } + + public void func_94511_a(boolean par1, boolean par2) + { + boolean var3 = this.canConnectFrom(this.railX, this.railY, this.railZ - 1); + boolean var4 = this.canConnectFrom(this.railX, this.railY, this.railZ + 1); + boolean var5 = this.canConnectFrom(this.railX - 1, this.railY, this.railZ); + boolean var6 = this.canConnectFrom(this.railX + 1, this.railY, this.railZ); + byte var7 = -1; + + if ((var3 || var4) && !var5 && !var6) + { + var7 = 0; + } + + if ((var5 || var6) && !var3 && !var4) + { + var7 = 1; + } + + if (!this.isStraightRail) + { + if (var4 && var6 && !var3 && !var5) + { + var7 = 6; + } + + if (var4 && var5 && !var3 && !var6) + { + var7 = 7; + } + + if (var3 && var5 && !var4 && !var6) + { + var7 = 8; + } + + if (var3 && var6 && !var4 && !var5) + { + var7 = 9; + } + } + + if (var7 == -1) + { + if (var3 || var4) + { + var7 = 0; + } + + if (var5 || var6) + { + var7 = 1; + } + + if (!this.isStraightRail) + { + if (par1) + { + if (var4 && var6) + { + var7 = 6; + } + + if (var5 && var4) + { + var7 = 7; + } + + if (var6 && var3) + { + var7 = 9; + } + + if (var3 && var5) + { + var7 = 8; + } + } + else + { + if (var3 && var5) + { + var7 = 8; + } + + if (var6 && var3) + { + var7 = 9; + } + + if (var5 && var4) + { + var7 = 7; + } + + if (var4 && var6) + { + var7 = 6; + } + } + } + } + + if (var7 == 0) + { + if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ - 1)) + { + var7 = 4; + } + + if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ + 1)) + { + var7 = 5; + } + } + + if (var7 == 1) + { + if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX + 1, this.railY + 1, this.railZ)) + { + var7 = 2; + } + + if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX - 1, this.railY + 1, this.railZ)) + { + var7 = 3; + } + } + + if (var7 < 0) + { + var7 = 0; + } + + this.setBasicRail(var7); + int var8 = var7; + + if (this.isStraightRail) + { + var8 = this.logicWorld.getBlockMetadata(this.railX, this.railY, this.railZ) & 8 | var7; + } + + if (par2 || this.logicWorld.getBlockMetadata(this.railX, this.railY, this.railZ) != var8) + { + this.logicWorld.setBlockMetadataWithNotify(this.railX, this.railY, this.railZ, var8, 3); + + for (int var9 = 0; var9 < this.railChunkPosition.size(); ++var9) + { + BlockBaseRailLogic var10 = this.getRailLogic((ChunkPosition)this.railChunkPosition.get(var9)); + + if (var10 != null) + { + var10.refreshConnectedTracks(); + + if (var10.canConnectTo(this)) + { + var10.connectToNeighbor(this); + } + } + } + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockBeacon.java b/src/main/java/net/minecraft/src/BlockBeacon.java new file mode 100644 index 0000000..ee34169 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockBeacon.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +public class BlockBeacon extends BlockContainer +{ + public BlockBeacon(int par1) + { + super(par1, Material.glass); + this.setHardness(3.0F); + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityBeacon(); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + TileEntityBeacon var10 = (TileEntityBeacon)par1World.getBlockTileEntity(par2, par3, par4); + + if (var10 != null) + { + par5EntityPlayer.displayGUIBeacon(var10); + } + + return true; + } + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 34; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + super.registerIcons(par1IconRegister); + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack); + + if (par6ItemStack.hasDisplayName()) + { + ((TileEntityBeacon)par1World.getBlockTileEntity(par2, par3, par4)).func_94047_a(par6ItemStack.getDisplayName()); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockBed.java b/src/main/java/net/minecraft/src/BlockBed.java new file mode 100644 index 0000000..d219448 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockBed.java @@ -0,0 +1,343 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.Random; + +public class BlockBed extends BlockDirectional +{ + /** Maps the foot-of-bed block to the head-of-bed block. */ + public static final int[][] footBlockToHeadBlockMap = new int[][] {{0, 1}, { -1, 0}, {0, -1}, {1, 0}}; + private Icon[] field_94472_b; + private Icon[] bedSideIcons; + private Icon[] bedTopIcons; + + public BlockBed(int par1) + { + super(par1, Material.cloth); + this.setBounds(); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + int var10 = par1World.getBlockMetadata(par2, par3, par4); + + if (!isBlockHeadOfBed(var10)) + { + int var11 = getDirection(var10); + par2 += footBlockToHeadBlockMap[var11][0]; + par4 += footBlockToHeadBlockMap[var11][1]; + + if (par1World.getBlockId(par2, par3, par4) != this.blockID) + { + return true; + } + + var10 = par1World.getBlockMetadata(par2, par3, par4); + } + + if (par1World.provider.canRespawnHere() && par1World.getBiomeGenForCoords(par2, par4) != BiomeGenBase.hell) + { + if (isBedOccupied(var10)) + { + EntityPlayer var19 = null; + Iterator var12 = par1World.playerEntities.iterator(); + + while (var12.hasNext()) + { + EntityPlayer var21 = (EntityPlayer)var12.next(); + + if (var21.isPlayerSleeping()) + { + ChunkCoordinates var14 = var21.playerLocation; + + if (var14.posX == par2 && var14.posY == par3 && var14.posZ == par4) + { + var19 = var21; + } + } + } + + if (var19 != null) + { + par5EntityPlayer.addChatMessage("tile.bed.occupied"); + return true; + } + + setBedOccupied(par1World, par2, par3, par4, false); + } + + EnumStatus var20 = par5EntityPlayer.sleepInBedAt(par2, par3, par4); + + if (var20 == EnumStatus.OK) + { + setBedOccupied(par1World, par2, par3, par4, true); + return true; + } + else + { + if (var20 == EnumStatus.NOT_POSSIBLE_NOW) + { + par5EntityPlayer.addChatMessage("tile.bed.noSleep"); + } + else if (var20 == EnumStatus.NOT_SAFE) + { + par5EntityPlayer.addChatMessage("tile.bed.notSafe"); + } + + return true; + } + } + else + { + double var18 = (double)par2 + 0.5D; + double var13 = (double)par3 + 0.5D; + double var15 = (double)par4 + 0.5D; + par1World.setBlockToAir(par2, par3, par4); + int var17 = getDirection(var10); + par2 += footBlockToHeadBlockMap[var17][0]; + par4 += footBlockToHeadBlockMap[var17][1]; + + if (par1World.getBlockId(par2, par3, par4) == this.blockID) + { + par1World.setBlockToAir(par2, par3, par4); + var18 = (var18 + (double)par2 + 0.5D) / 2.0D; + var13 = (var13 + (double)par3 + 0.5D) / 2.0D; + var15 = (var15 + (double)par4 + 0.5D) / 2.0D; + } + + par1World.newExplosion((Entity)null, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), 5.0F, true, true); + return true; + } + } + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + if (par1 == 0) + { + return Block.planks.getBlockTextureFromSide(par1); + } + else + { + int var3 = getDirection(par2); + int var4 = Direction.bedDirection[var3][par1]; + int var5 = isBlockHeadOfBed(par2) ? 1 : 0; + return (var5 != 1 || var4 != 2) && (var5 != 0 || var4 != 3) ? (var4 != 5 && var4 != 4 ? this.bedTopIcons[var5] : this.bedSideIcons[var5]) : this.field_94472_b[var5]; + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.bedTopIcons = new Icon[] {par1IconRegister.registerIcon(this.getTextureName() + "_feet_top"), par1IconRegister.registerIcon(this.getTextureName() + "_head_top")}; + this.field_94472_b = new Icon[] {par1IconRegister.registerIcon(this.getTextureName() + "_feet_end"), par1IconRegister.registerIcon(this.getTextureName() + "_head_end")}; + this.bedSideIcons = new Icon[] {par1IconRegister.registerIcon(this.getTextureName() + "_feet_side"), par1IconRegister.registerIcon(this.getTextureName() + "_head_side")}; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 14; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.setBounds(); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + int var7 = getDirection(var6); + + if (isBlockHeadOfBed(var6)) + { + if (par1World.getBlockId(par2 - footBlockToHeadBlockMap[var7][0], par3, par4 - footBlockToHeadBlockMap[var7][1]) != this.blockID) + { + par1World.setBlockToAir(par2, par3, par4); + } + } + else if (par1World.getBlockId(par2 + footBlockToHeadBlockMap[var7][0], par3, par4 + footBlockToHeadBlockMap[var7][1]) != this.blockID) + { + par1World.setBlockToAir(par2, par3, par4); + + if (!par1World.isRemote) + { + this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0); + } + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return isBlockHeadOfBed(par1) ? 0 : Item.bed.itemID; + } + + /** + * Set the bounds of the bed block. + */ + private void setBounds() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5625F, 1.0F); + } + + /** + * Returns whether or not this bed block is the head of the bed. + */ + public static boolean isBlockHeadOfBed(int par0) + { + return (par0 & 8) != 0; + } + + /** + * Return whether or not the bed is occupied. + */ + public static boolean isBedOccupied(int par0) + { + return (par0 & 4) != 0; + } + + /** + * Sets whether or not the bed is occupied. + */ + public static void setBedOccupied(World par0World, int par1, int par2, int par3, boolean par4) + { + int var5 = par0World.getBlockMetadata(par1, par2, par3); + + if (par4) + { + var5 |= 4; + } + else + { + var5 &= -5; + } + + par0World.setBlockMetadataWithNotify(par1, par2, par3, var5, 4); + } + + /** + * Gets the nearest empty chunk coordinates for the player to wake up from a bed into. + */ + public static ChunkCoordinates getNearestEmptyChunkCoordinates(World par0World, int par1, int par2, int par3, int par4) + { + int var5 = par0World.getBlockMetadata(par1, par2, par3); + int var6 = BlockDirectional.getDirection(var5); + + for (int var7 = 0; var7 <= 1; ++var7) + { + int var8 = par1 - footBlockToHeadBlockMap[var6][0] * var7 - 1; + int var9 = par3 - footBlockToHeadBlockMap[var6][1] * var7 - 1; + int var10 = var8 + 2; + int var11 = var9 + 2; + + for (int var12 = var8; var12 <= var10; ++var12) + { + for (int var13 = var9; var13 <= var11; ++var13) + { + if (par0World.doesBlockHaveSolidTopSurface(var12, par2 - 1, var13) && !par0World.getBlockMaterial(var12, par2, var13).isOpaque() && !par0World.getBlockMaterial(var12, par2 + 1, var13).isOpaque()) + { + if (par4 <= 0) + { + return new ChunkCoordinates(var12, par2, var13); + } + + --par4; + } + } + } + } + + return null; + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + if (!isBlockHeadOfBed(par5)) + { + super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); + } + } + + /** + * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility + * and stop pistons + */ + public int getMobilityFlag() + { + return 1; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.bed.itemID; + } + + /** + * Called when the block is attempted to be harvested + */ + public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) + { + if (par6EntityPlayer.capabilities.isCreativeMode && isBlockHeadOfBed(par5)) + { + int var7 = getDirection(par5); + par2 -= footBlockToHeadBlockMap[var7][0]; + par4 -= footBlockToHeadBlockMap[var7][1]; + + if (par1World.getBlockId(par2, par3, par4) == this.blockID) + { + par1World.setBlockToAir(par2, par3, par4); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockBookshelf.java b/src/main/java/net/minecraft/src/BlockBookshelf.java new file mode 100644 index 0000000..1c56de3 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockBookshelf.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockBookshelf extends Block +{ + public BlockBookshelf(int par1) + { + super(par1, Material.wood); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 != 1 && par1 != 0 ? super.getIcon(par1, par2) : Block.planks.getBlockTextureFromSide(par1); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 3; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.book.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockBreakable.java b/src/main/java/net/minecraft/src/BlockBreakable.java new file mode 100644 index 0000000..5877f50 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockBreakable.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +public class BlockBreakable extends Block +{ + private boolean localFlag; + private String breakableBlockIcon; + + protected BlockBreakable(int par1, String par2Str, Material par3Material, boolean par4) + { + super(par1, par3Material); + this.localFlag = par4; + this.breakableBlockIcon = par2Str; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + int var6 = par1IBlockAccess.getBlockId(par2, par3, par4); + return !this.localFlag && var6 == this.blockID ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.breakableBlockIcon); + } +} diff --git a/src/main/java/net/minecraft/src/BlockBrewingStand.java b/src/main/java/net/minecraft/src/BlockBrewingStand.java new file mode 100644 index 0000000..ea06736 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockBrewingStand.java @@ -0,0 +1,208 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockBrewingStand extends BlockContainer +{ + private Random rand = new Random(); + private Icon theIcon; + + public BlockBrewingStand(int par1) + { + super(par1, Material.iron); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 25; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityBrewingStand(); + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + this.setBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBoundsForItemRender(); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + TileEntityBrewingStand var10 = (TileEntityBrewingStand)par1World.getBlockTileEntity(par2, par3, par4); + + if (var10 != null) + { + par5EntityPlayer.displayGUIBrewingStand(var10); + } + + return true; + } + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + if (par6ItemStack.hasDisplayName()) + { + ((TileEntityBrewingStand)par1World.getBlockTileEntity(par2, par3, par4)).func_94131_a(par6ItemStack.getDisplayName()); + } + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + double var6 = (double)((float)par2 + 0.4F + par5Random.nextFloat() * 0.2F); + double var8 = (double)((float)par3 + 0.7F + par5Random.nextFloat() * 0.3F); + double var10 = (double)((float)par4 + 0.4F + par5Random.nextFloat() * 0.2F); + par1World.spawnParticle("smoke", var6, var8, var10, 0.0D, 0.0D, 0.0D); + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + TileEntity var7 = par1World.getBlockTileEntity(par2, par3, par4); + + if (var7 instanceof TileEntityBrewingStand) + { + TileEntityBrewingStand var8 = (TileEntityBrewingStand)var7; + + for (int var9 = 0; var9 < var8.getSizeInventory(); ++var9) + { + ItemStack var10 = var8.getStackInSlot(var9); + + if (var10 != null) + { + float var11 = this.rand.nextFloat() * 0.8F + 0.1F; + float var12 = this.rand.nextFloat() * 0.8F + 0.1F; + float var13 = this.rand.nextFloat() * 0.8F + 0.1F; + + while (var10.stackSize > 0) + { + int var14 = this.rand.nextInt(21) + 10; + + if (var14 > var10.stackSize) + { + var14 = var10.stackSize; + } + + var10.stackSize -= var14; + EntityItem var15 = new EntityItem(par1World, (double)((float)par2 + var11), (double)((float)par3 + var12), (double)((float)par4 + var13), new ItemStack(var10.itemID, var14, var10.getItemDamage())); + float var16 = 0.05F; + var15.motionX = (double)((float)this.rand.nextGaussian() * var16); + var15.motionY = (double)((float)this.rand.nextGaussian() * var16 + 0.2F); + var15.motionZ = (double)((float)this.rand.nextGaussian() * var16); + par1World.spawnEntityInWorld(var15); + } + } + } + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.brewingStand.itemID; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.brewingStand.itemID; + } + + /** + * If this returns true, then comparators facing away from this block will use the value from + * getComparatorInputOverride instead of the actual redstone signal strength. + */ + public boolean hasComparatorInputOverride() + { + return true; + } + + /** + * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal + * strength when this block inputs to a comparator. + */ + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) + { + return Container.calcRedstoneFromInventory((IInventory)par1World.getBlockTileEntity(par2, par3, par4)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + super.registerIcons(par1IconRegister); + this.theIcon = par1IconRegister.registerIcon(this.getTextureName() + "_base"); + } + + public Icon getBrewingStandIcon() + { + return this.theIcon; + } +} diff --git a/src/main/java/net/minecraft/src/BlockButton.java b/src/main/java/net/minecraft/src/BlockButton.java new file mode 100644 index 0000000..0e166d3 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockButton.java @@ -0,0 +1,406 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public abstract class BlockButton extends Block +{ + /** Whether this button is sensible to arrows, used by wooden buttons. */ + private final boolean sensible; + + protected BlockButton(int par1, boolean par2) + { + super(par1, Material.circuits); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabRedstone); + this.sensible = par2; + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return this.sensible ? 30 : 20; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * checks to see if you can place this block can be placed on that side of a block: BlockLever overrides + */ + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + { + return par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1))); + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + int var10 = par1World.getBlockMetadata(par2, par3, par4); + int var11 = var10 & 8; + var10 &= 7; + + if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) + { + var10 = 4; + } + else if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) + { + var10 = 3; + } + else if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) + { + var10 = 2; + } + else if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) + { + var10 = 1; + } + else + { + var10 = this.getOrientation(par1World, par2, par3, par4); + } + + return var10 + var11; + } + + /** + * Get side which this button is facing. + */ + private int getOrientation(World par1World, int par2, int par3, int par4) + { + return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? 1 : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? 2 : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? 3 : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? 4 : 1))); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (this.redundantCanPlaceBlockAt(par1World, par2, par3, par4)) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4) & 7; + boolean var7 = false; + + if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && var6 == 1) + { + var7 = true; + } + + if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var6 == 2) + { + var7 = true; + } + + if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var6 == 3) + { + var7 = true; + } + + if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var6 == 4) + { + var7 = true; + } + + if (var7) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + } + } + + /** + * This method is redundant, check it out... + */ + private boolean redundantCanPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + return false; + } + else + { + return true; + } + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + this.func_82534_e(var5); + } + + private void func_82534_e(int par1) + { + int var2 = par1 & 7; + boolean var3 = (par1 & 8) > 0; + float var4 = 0.375F; + float var5 = 0.625F; + float var6 = 0.1875F; + float var7 = 0.125F; + + if (var3) + { + var7 = 0.0625F; + } + + if (var2 == 1) + { + this.setBlockBounds(0.0F, var4, 0.5F - var6, var7, var5, 0.5F + var6); + } + else if (var2 == 2) + { + this.setBlockBounds(1.0F - var7, var4, 0.5F - var6, 1.0F, var5, 0.5F + var6); + } + else if (var2 == 3) + { + this.setBlockBounds(0.5F - var6, var4, 0.0F, 0.5F + var6, var5, var7); + } + else if (var2 == 4) + { + this.setBlockBounds(0.5F - var6, var4, 1.0F - var7, 0.5F + var6, var5, 1.0F); + } + } + + /** + * Called when the block is clicked by a player. Args: x, y, z, entityPlayer + */ + public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) {} + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + int var10 = par1World.getBlockMetadata(par2, par3, par4); + int var11 = var10 & 7; + int var12 = 8 - (var10 & 8); + + if (var12 == 0) + { + return true; + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var11 + var12, 3); + par1World.markBlockRangeForRenderUpdate(par2, par3, par4, par2, par3, par4); + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "random.click", 0.3F, 0.6F); + this.func_82536_d(par1World, par2, par3, par4, var11); + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + return true; + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + if ((par6 & 8) > 0) + { + int var7 = par6 & 7; + this.func_82536_d(par1World, par2, par3, par4, var7); + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return (par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 8) > 0 ? 15 : 0; + } + + /** + * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, + * side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + + if ((var6 & 8) == 0) + { + return 0; + } + else + { + int var7 = var6 & 7; + return var7 == 5 && par5 == 1 ? 15 : (var7 == 4 && par5 == 2 ? 15 : (var7 == 3 && par5 == 3 ? 15 : (var7 == 2 && par5 == 4 ? 15 : (var7 == 1 && par5 == 5 ? 15 : 0)))); + } + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if ((var6 & 8) != 0) + { + if (this.sensible) + { + this.func_82535_o(par1World, par2, par3, par4); + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & 7, 3); + int var7 = var6 & 7; + this.func_82536_d(par1World, par2, par3, par4, var7); + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "random.click", 0.3F, 0.5F); + par1World.markBlockRangeForRenderUpdate(par2, par3, par4, par2, par3, par4); + } + } + } + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float var1 = 0.1875F; + float var2 = 0.125F; + float var3 = 0.125F; + this.setBlockBounds(0.5F - var1, 0.5F - var2, 0.5F - var3, 0.5F + var1, 0.5F + var2, 0.5F + var3); + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + if (!par1World.isRemote) + { + if (this.sensible) + { + if ((par1World.getBlockMetadata(par2, par3, par4) & 8) == 0) + { + this.func_82535_o(par1World, par2, par3, par4); + } + } + } + } + + private void func_82535_o(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + int var6 = var5 & 7; + boolean var7 = (var5 & 8) != 0; + this.func_82534_e(var5); + List var9 = par1World.getEntitiesWithinAABB(EntityArrow.class, AxisAlignedBB.getAABBPool().getAABB((double)par2 + this.minX, (double)par3 + this.minY, (double)par4 + this.minZ, (double)par2 + this.maxX, (double)par3 + this.maxY, (double)par4 + this.maxZ)); + boolean var8 = !var9.isEmpty(); + + if (var8 && !var7) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 | 8, 3); + this.func_82536_d(par1World, par2, par3, par4, var6); + par1World.markBlockRangeForRenderUpdate(par2, par3, par4, par2, par3, par4); + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "random.click", 0.3F, 0.6F); + } + + if (!var8 && var7) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 3); + this.func_82536_d(par1World, par2, par3, par4, var6); + par1World.markBlockRangeForRenderUpdate(par2, par3, par4, par2, par3, par4); + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "random.click", 0.3F, 0.5F); + } + + if (var8) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + } + } + + private void func_82536_d(World par1World, int par2, int par3, int par4, int par5) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); + + if (par5 == 1) + { + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID); + } + else if (par5 == 2) + { + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID); + } + else if (par5 == 3) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID); + } + else if (par5 == 4) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID); + } + else + { + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) {} +} diff --git a/src/main/java/net/minecraft/src/BlockButtonStone.java b/src/main/java/net/minecraft/src/BlockButtonStone.java new file mode 100644 index 0000000..944e1c2 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockButtonStone.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class BlockButtonStone extends BlockButton +{ + protected BlockButtonStone(int par1) + { + super(par1, false); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return Block.stone.getBlockTextureFromSide(1); + } +} diff --git a/src/main/java/net/minecraft/src/BlockButtonWood.java b/src/main/java/net/minecraft/src/BlockButtonWood.java new file mode 100644 index 0000000..bad7dc3 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockButtonWood.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class BlockButtonWood extends BlockButton +{ + protected BlockButtonWood(int par1) + { + super(par1, true); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return Block.planks.getBlockTextureFromSide(1); + } +} diff --git a/src/main/java/net/minecraft/src/BlockCactus.java b/src/main/java/net/minecraft/src/BlockCactus.java new file mode 100644 index 0000000..bbc2a24 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockCactus.java @@ -0,0 +1,167 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockCactus extends Block +{ + private Icon cactusTopIcon; + private Icon cactusBottomIcon; + + protected BlockCactus(int par1) + { + super(par1, Material.cactus); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (par1World.isAirBlock(par2, par3 + 1, par4)) + { + int var6; + + for (var6 = 1; par1World.getBlockId(par2, par3 - var6, par4) == this.blockID; ++var6) + { + ; + } + + if (var6 < 3) + { + int var7 = par1World.getBlockMetadata(par2, par3, par4); + + if (var7 == 15) + { + par1World.setBlock(par2, par3 + 1, par4, this.blockID); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 0, 4); + this.onNeighborBlockChange(par1World, par2, par3 + 1, par4, this.blockID); + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7 + 1, 4); + } + } + } + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + float var5 = 0.0625F; + return AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var5), (double)par3, (double)((float)par4 + var5), (double)((float)(par2 + 1) - var5), (double)((float)(par3 + 1) - var5), (double)((float)(par4 + 1) - var5)); + } + + /** + * Returns the bounding box of the wired rectangular prism to render. + */ + public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + float var5 = 0.0625F; + return AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var5), (double)par3, (double)((float)par4 + var5), (double)((float)(par2 + 1) - var5), (double)(par3 + 1), (double)((float)(par4 + 1) - var5)); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.cactusTopIcon : (par1 == 0 ? this.cactusBottomIcon : this.blockIcon); + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 13; + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return !super.canPlaceBlockAt(par1World, par2, par3, par4) ? false : this.canBlockStay(par1World, par2, par3, par4); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!this.canBlockStay(par1World, par2, par3, par4)) + { + par1World.destroyBlock(par2, par3, par4, true); + } + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) + { + if (par1World.getBlockMaterial(par2 - 1, par3, par4).isSolid()) + { + return false; + } + else if (par1World.getBlockMaterial(par2 + 1, par3, par4).isSolid()) + { + return false; + } + else if (par1World.getBlockMaterial(par2, par3, par4 - 1).isSolid()) + { + return false; + } + else if (par1World.getBlockMaterial(par2, par3, par4 + 1).isSolid()) + { + return false; + } + else + { + int var5 = par1World.getBlockId(par2, par3 - 1, par4); + return var5 == Block.cactus.blockID || var5 == Block.sand.blockID; + } + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + par5Entity.attackEntityFrom(DamageSource.cactus, 1.0F); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + this.cactusTopIcon = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.cactusBottomIcon = par1IconRegister.registerIcon(this.getTextureName() + "_bottom"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockCake.java b/src/main/java/net/minecraft/src/BlockCake.java new file mode 100644 index 0000000..d285602 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockCake.java @@ -0,0 +1,190 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockCake extends Block +{ + private Icon cakeTopIcon; + private Icon cakeBottomIcon; + private Icon field_94382_c; + + protected BlockCake(int par1) + { + super(par1, Material.cake); + this.setTickRandomly(true); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + float var6 = 0.0625F; + float var7 = (float)(1 + var5 * 2) / 16.0F; + float var8 = 0.5F; + this.setBlockBounds(var7, 0.0F, var6, 1.0F - var6, var8, 1.0F - var6); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float var1 = 0.0625F; + float var2 = 0.5F; + this.setBlockBounds(var1, 0.0F, var1, 1.0F - var1, var2, 1.0F - var1); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + float var6 = 0.0625F; + float var7 = (float)(1 + var5 * 2) / 16.0F; + float var8 = 0.5F; + return AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var7), (double)par3, (double)((float)par4 + var6), (double)((float)(par2 + 1) - var6), (double)((float)par3 + var8 - var6), (double)((float)(par4 + 1) - var6)); + } + + /** + * Returns the bounding box of the wired rectangular prism to render. + */ + public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + float var6 = 0.0625F; + float var7 = (float)(1 + var5 * 2) / 16.0F; + float var8 = 0.5F; + return AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var7), (double)par3, (double)((float)par4 + var6), (double)((float)(par2 + 1) - var6), (double)((float)par3 + var8), (double)((float)(par4 + 1) - var6)); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.cakeTopIcon : (par1 == 0 ? this.cakeBottomIcon : (par2 > 0 && par1 == 4 ? this.field_94382_c : this.blockIcon)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + this.field_94382_c = par1IconRegister.registerIcon(this.getTextureName() + "_inner"); + this.cakeTopIcon = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.cakeBottomIcon = par1IconRegister.registerIcon(this.getTextureName() + "_bottom"); + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + this.eatCakeSlice(par1World, par2, par3, par4, par5EntityPlayer); + return true; + } + + /** + * Called when the block is clicked by a player. Args: x, y, z, entityPlayer + */ + public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) + { + this.eatCakeSlice(par1World, par2, par3, par4, par5EntityPlayer); + } + + /** + * Heals the player and removes a slice from the cake. + */ + private void eatCakeSlice(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) + { + if (par5EntityPlayer.canEat(false)) + { + par5EntityPlayer.getFoodStats().addStats(2, 0.1F); + int var6 = par1World.getBlockMetadata(par2, par3, par4) + 1; + + if (var6 >= 6) + { + par1World.setBlockToAir(par2, par3, par4); + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 2); + } + } + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return !super.canPlaceBlockAt(par1World, par2, par3, par4) ? false : this.canBlockStay(par1World, par2, par3, par4); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!this.canBlockStay(par1World, par2, par3, par4)) + { + par1World.setBlockToAir(par2, par3, par4); + } + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) + { + return par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid(); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return 0; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.cake.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockCarpet.java b/src/main/java/net/minecraft/src/BlockCarpet.java new file mode 100644 index 0000000..10c57cb --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockCarpet.java @@ -0,0 +1,147 @@ +package net.minecraft.src; + +import java.util.List; + +public class BlockCarpet extends Block +{ + protected BlockCarpet(int par1) + { + super(par1, Material.materialCarpet); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + this.func_111047_d(0); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return Block.cloth.getIcon(par1, par2); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + byte var5 = 0; + float var6 = 0.0625F; + return AxisAlignedBB.getAABBPool().getAABB((double)par2 + this.minX, (double)par3 + this.minY, (double)par4 + this.minZ, (double)par2 + this.maxX, (double)((float)par3 + (float)var5 * var6), (double)par4 + this.maxZ); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.func_111047_d(0); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.func_111047_d(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + } + + protected void func_111047_d(int par1) + { + byte var2 = 0; + float var3 = (float)(1 * (1 + var2)) / 16.0F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, var3, 1.0F); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return super.canPlaceBlockAt(par1World, par2, par3, par4) && this.canBlockStay(par1World, par2, par3, par4); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + this.func_111046_k(par1World, par2, par3, par4); + } + + private boolean func_111046_k(World par1World, int par2, int par3, int par4) + { + if (!this.canBlockStay(par1World, par2, par3, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + return false; + } + else + { + return true; + } + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) + { + return !par1World.isAirBlock(par2, par3 - 1, par4); + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return par5 == 1 ? true : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + for (int var4 = 0; var4 < 16; ++var4) + { + par3List.add(new ItemStack(par1, 1, var4)); + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) {} +} diff --git a/src/main/java/net/minecraft/src/BlockCarrot.java b/src/main/java/net/minecraft/src/BlockCarrot.java new file mode 100644 index 0000000..cbadd7a --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockCarrot.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +public class BlockCarrot extends BlockCrops +{ + private Icon[] iconArray; + + public BlockCarrot(int par1) + { + super(par1); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + if (par2 < 7) + { + if (par2 == 6) + { + par2 = 5; + } + + return this.iconArray[par2 >> 1]; + } + else + { + return this.iconArray[3]; + } + } + + /** + * Generate a seed ItemStack for this crop. + */ + protected int getSeedItem() + { + return Item.carrot.itemID; + } + + /** + * Generate a crop produce ItemStack for this crop. + */ + protected int getCropItem() + { + return Item.carrot.itemID; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[4]; + + for (int var2 = 0; var2 < this.iconArray.length; ++var2) + { + this.iconArray[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + var2); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockCauldron.java b/src/main/java/net/minecraft/src/BlockCauldron.java new file mode 100644 index 0000000..7a84f60 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockCauldron.java @@ -0,0 +1,230 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockCauldron extends Block +{ + private Icon field_94378_a; + private Icon cauldronTopIcon; + private Icon cauldronBottomIcon; + + public BlockCauldron(int par1) + { + super(par1, Material.iron); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.cauldronTopIcon : (par1 == 0 ? this.cauldronBottomIcon : this.blockIcon); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.field_94378_a = par1IconRegister.registerIcon(this.getTextureName() + "_" + "inner"); + this.cauldronTopIcon = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.cauldronBottomIcon = par1IconRegister.registerIcon(this.getTextureName() + "_" + "bottom"); + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + } + + public static Icon getCauldronIcon(String par0Str) + { + return par0Str.equals("inner") ? Block.cauldron.field_94378_a : (par0Str.equals("bottom") ? Block.cauldron.cauldronBottomIcon : null); + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + float var8 = 0.125F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, var8, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var8); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(1.0F - var8, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(0.0F, 0.0F, 1.0F - var8, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBoundsForItemRender(); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 24; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + ItemStack var10 = par5EntityPlayer.inventory.getCurrentItem(); + + if (var10 == null) + { + return true; + } + else + { + int var11 = par1World.getBlockMetadata(par2, par3, par4); + int var12 = func_111045_h_(var11); + + if (var10.itemID == Item.bucketWater.itemID) + { + if (var12 < 3) + { + if (!par5EntityPlayer.capabilities.isCreativeMode) + { + par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, new ItemStack(Item.bucketEmpty)); + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2); + par1World.func_96440_m(par2, par3, par4, this.blockID); + } + + return true; + } + else + { + if (var10.itemID == Item.glassBottle.itemID) + { + if (var12 > 0) + { + ItemStack var13 = new ItemStack(Item.potion, 1, 0); + + if (!par5EntityPlayer.inventory.addItemStackToInventory(var13)) + { + par1World.spawnEntityInWorld(new EntityItem(par1World, (double)par2 + 0.5D, (double)par3 + 1.5D, (double)par4 + 0.5D, var13)); + } + else if (par5EntityPlayer instanceof EntityPlayerMP) + { + ((EntityPlayerMP)par5EntityPlayer).sendContainerToPlayer(par5EntityPlayer.inventoryContainer); + } + + --var10.stackSize; + + if (var10.stackSize <= 0) + { + par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, (ItemStack)null); + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, var12 - 1, 2); + par1World.func_96440_m(par2, par3, par4, this.blockID); + } + } + else if (var12 > 0 && var10.getItem() instanceof ItemArmor && ((ItemArmor)var10.getItem()).getArmorMaterial() == EnumArmorMaterial.CLOTH) + { + ItemArmor var14 = (ItemArmor)var10.getItem(); + var14.removeColor(var10); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var12 - 1, 2); + par1World.func_96440_m(par2, par3, par4, this.blockID); + return true; + } + + return true; + } + } + } + } + + /** + * currently only used by BlockCauldron to incrament meta-data during rain + */ + public void fillWithRain(World par1World, int par2, int par3, int par4) + { + if (par1World.rand.nextInt(20) == 1) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + + if (var5 < 3) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var5 + 1, 2); + } + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.cauldron.itemID; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.cauldron.itemID; + } + + /** + * If this returns true, then comparators facing away from this block will use the value from + * getComparatorInputOverride instead of the actual redstone signal strength. + */ + public boolean hasComparatorInputOverride() + { + return true; + } + + /** + * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal + * strength when this block inputs to a comparator. + */ + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + return func_111045_h_(var6); + } + + public static int func_111045_h_(int par0) + { + return par0; + } +} diff --git a/src/main/java/net/minecraft/src/BlockChest.java b/src/main/java/net/minecraft/src/BlockChest.java new file mode 100644 index 0000000..5a17025 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockChest.java @@ -0,0 +1,573 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.Random; + +public class BlockChest extends BlockContainer +{ + private final Random random = new Random(); + + /** 1 for trapped chests, 0 for normal chests. */ + public final int chestType; + + protected BlockChest(int par1, int par2) + { + super(par1, Material.wood); + this.chestType = par2; + this.setCreativeTab(CreativeTabs.tabDecorations); + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 22; + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + if (par1IBlockAccess.getBlockId(par2, par3, par4 - 1) == this.blockID) + { + this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F); + } + else if (par1IBlockAccess.getBlockId(par2, par3, par4 + 1) == this.blockID) + { + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F); + } + else if (par1IBlockAccess.getBlockId(par2 - 1, par3, par4) == this.blockID) + { + this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + } + else if (par1IBlockAccess.getBlockId(par2 + 1, par3, par4) == this.blockID) + { + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F); + } + else + { + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + } + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + this.unifyAdjacentChests(par1World, par2, par3, par4); + int var5 = par1World.getBlockId(par2, par3, par4 - 1); + int var6 = par1World.getBlockId(par2, par3, par4 + 1); + int var7 = par1World.getBlockId(par2 - 1, par3, par4); + int var8 = par1World.getBlockId(par2 + 1, par3, par4); + + if (var5 == this.blockID) + { + this.unifyAdjacentChests(par1World, par2, par3, par4 - 1); + } + + if (var6 == this.blockID) + { + this.unifyAdjacentChests(par1World, par2, par3, par4 + 1); + } + + if (var7 == this.blockID) + { + this.unifyAdjacentChests(par1World, par2 - 1, par3, par4); + } + + if (var8 == this.blockID) + { + this.unifyAdjacentChests(par1World, par2 + 1, par3, par4); + } + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = par1World.getBlockId(par2, par3, par4 - 1); + int var8 = par1World.getBlockId(par2, par3, par4 + 1); + int var9 = par1World.getBlockId(par2 - 1, par3, par4); + int var10 = par1World.getBlockId(par2 + 1, par3, par4); + byte var11 = 0; + int var12 = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + + if (var12 == 0) + { + var11 = 2; + } + + if (var12 == 1) + { + var11 = 5; + } + + if (var12 == 2) + { + var11 = 3; + } + + if (var12 == 3) + { + var11 = 4; + } + + if (var7 != this.blockID && var8 != this.blockID && var9 != this.blockID && var10 != this.blockID) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var11, 3); + } + else + { + if ((var7 == this.blockID || var8 == this.blockID) && (var11 == 4 || var11 == 5)) + { + if (var7 == this.blockID) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4 - 1, var11, 3); + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3, par4 + 1, var11, 3); + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, var11, 3); + } + + if ((var9 == this.blockID || var10 == this.blockID) && (var11 == 2 || var11 == 3)) + { + if (var9 == this.blockID) + { + par1World.setBlockMetadataWithNotify(par2 - 1, par3, par4, var11, 3); + } + else + { + par1World.setBlockMetadataWithNotify(par2 + 1, par3, par4, var11, 3); + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, var11, 3); + } + } + + if (par6ItemStack.hasDisplayName()) + { + ((TileEntityChest)par1World.getBlockTileEntity(par2, par3, par4)).setChestGuiName(par6ItemStack.getDisplayName()); + } + } + + /** + * Turns the adjacent chests to a double chest. + */ + public void unifyAdjacentChests(World par1World, int par2, int par3, int par4) + { + if (!par1World.isRemote) + { + int var5 = par1World.getBlockId(par2, par3, par4 - 1); + int var6 = par1World.getBlockId(par2, par3, par4 + 1); + int var7 = par1World.getBlockId(par2 - 1, par3, par4); + int var8 = par1World.getBlockId(par2 + 1, par3, par4); + boolean var9 = true; + int var10; + int var11; + boolean var12; + byte var13; + int var14; + + if (var5 != this.blockID && var6 != this.blockID) + { + if (var7 != this.blockID && var8 != this.blockID) + { + var13 = 3; + + if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6]) + { + var13 = 3; + } + + if (Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var5]) + { + var13 = 2; + } + + if (Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var8]) + { + var13 = 5; + } + + if (Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var7]) + { + var13 = 4; + } + } + else + { + var10 = par1World.getBlockId(var7 == this.blockID ? par2 - 1 : par2 + 1, par3, par4 - 1); + var11 = par1World.getBlockId(var7 == this.blockID ? par2 - 1 : par2 + 1, par3, par4 + 1); + var13 = 3; + var12 = true; + + if (var7 == this.blockID) + { + var14 = par1World.getBlockMetadata(par2 - 1, par3, par4); + } + else + { + var14 = par1World.getBlockMetadata(par2 + 1, par3, par4); + } + + if (var14 == 2) + { + var13 = 2; + } + + if ((Block.opaqueCubeLookup[var5] || Block.opaqueCubeLookup[var10]) && !Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var11]) + { + var13 = 3; + } + + if ((Block.opaqueCubeLookup[var6] || Block.opaqueCubeLookup[var11]) && !Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var10]) + { + var13 = 2; + } + } + } + else + { + var10 = par1World.getBlockId(par2 - 1, par3, var5 == this.blockID ? par4 - 1 : par4 + 1); + var11 = par1World.getBlockId(par2 + 1, par3, var5 == this.blockID ? par4 - 1 : par4 + 1); + var13 = 5; + var12 = true; + + if (var5 == this.blockID) + { + var14 = par1World.getBlockMetadata(par2, par3, par4 - 1); + } + else + { + var14 = par1World.getBlockMetadata(par2, par3, par4 + 1); + } + + if (var14 == 4) + { + var13 = 4; + } + + if ((Block.opaqueCubeLookup[var7] || Block.opaqueCubeLookup[var10]) && !Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var11]) + { + var13 = 5; + } + + if ((Block.opaqueCubeLookup[var8] || Block.opaqueCubeLookup[var11]) && !Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var10]) + { + var13 = 4; + } + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, var13, 3); + } + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + int var5 = 0; + + if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID) + { + ++var5; + } + + if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID) + { + ++var5; + } + + if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID) + { + ++var5; + } + + if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID) + { + ++var5; + } + + return var5 > 1 ? false : (this.isThereANeighborChest(par1World, par2 - 1, par3, par4) ? false : (this.isThereANeighborChest(par1World, par2 + 1, par3, par4) ? false : (this.isThereANeighborChest(par1World, par2, par3, par4 - 1) ? false : !this.isThereANeighborChest(par1World, par2, par3, par4 + 1)))); + } + + /** + * Checks the neighbor blocks to see if there is a chest there. Args: world, x, y, z + */ + private boolean isThereANeighborChest(World par1World, int par2, int par3, int par4) + { + return par1World.getBlockId(par2, par3, par4) != this.blockID ? false : (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID ? true : (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID ? true : (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID ? true : par1World.getBlockId(par2, par3, par4 + 1) == this.blockID))); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + super.onNeighborBlockChange(par1World, par2, par3, par4, par5); + TileEntityChest var6 = (TileEntityChest)par1World.getBlockTileEntity(par2, par3, par4); + + if (var6 != null) + { + var6.updateContainingBlockInfo(); + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + TileEntityChest var7 = (TileEntityChest)par1World.getBlockTileEntity(par2, par3, par4); + + if (var7 != null) + { + for (int var8 = 0; var8 < var7.getSizeInventory(); ++var8) + { + ItemStack var9 = var7.getStackInSlot(var8); + + if (var9 != null) + { + float var10 = this.random.nextFloat() * 0.8F + 0.1F; + float var11 = this.random.nextFloat() * 0.8F + 0.1F; + EntityItem var14; + + for (float var12 = this.random.nextFloat() * 0.8F + 0.1F; var9.stackSize > 0; par1World.spawnEntityInWorld(var14)) + { + int var13 = this.random.nextInt(21) + 10; + + if (var13 > var9.stackSize) + { + var13 = var9.stackSize; + } + + var9.stackSize -= var13; + var14 = new EntityItem(par1World, (double)((float)par2 + var10), (double)((float)par3 + var11), (double)((float)par4 + var12), new ItemStack(var9.itemID, var13, var9.getItemDamage())); + float var15 = 0.05F; + var14.motionX = (double)((float)this.random.nextGaussian() * var15); + var14.motionY = (double)((float)this.random.nextGaussian() * var15 + 0.2F); + var14.motionZ = (double)((float)this.random.nextGaussian() * var15); + + if (var9.hasTagCompound()) + { + var14.getEntityItem().setTagCompound((NBTTagCompound)var9.getTagCompound().copy()); + } + } + } + } + + par1World.func_96440_m(par2, par3, par4, par5); + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + IInventory var10 = this.getInventory(par1World, par2, par3, par4); + + if (var10 != null) + { + par5EntityPlayer.displayGUIChest(var10); + } + + return true; + } + } + + /** + * Gets the inventory of the chest at the specified coords, accounting for blocks or ocelots on top of the chest, + * and double chests. + */ + public IInventory getInventory(World par1World, int par2, int par3, int par4) + { + Object var5 = (TileEntityChest)par1World.getBlockTileEntity(par2, par3, par4); + + if (var5 == null) + { + return null; + } + else if (par1World.isBlockNormalCube(par2, par3 + 1, par4)) + { + return null; + } + else if (isOcelotBlockingChest(par1World, par2, par3, par4)) + { + return null; + } + else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 - 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4))) + { + return null; + } + else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 + 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4))) + { + return null; + } + else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 - 1) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1))) + { + return null; + } + else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 + 1) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1))) + { + return null; + } + else + { + if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID) + { + var5 = new InventoryLargeChest("container.chestDouble", (TileEntityChest)par1World.getBlockTileEntity(par2 - 1, par3, par4), (IInventory)var5); + } + + if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID) + { + var5 = new InventoryLargeChest("container.chestDouble", (IInventory)var5, (TileEntityChest)par1World.getBlockTileEntity(par2 + 1, par3, par4)); + } + + if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID) + { + var5 = new InventoryLargeChest("container.chestDouble", (TileEntityChest)par1World.getBlockTileEntity(par2, par3, par4 - 1), (IInventory)var5); + } + + if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID) + { + var5 = new InventoryLargeChest("container.chestDouble", (IInventory)var5, (TileEntityChest)par1World.getBlockTileEntity(par2, par3, par4 + 1)); + } + + return (IInventory)var5; + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + TileEntityChest var2 = new TileEntityChest(); + return var2; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return this.chestType == 1; + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + if (!this.canProvidePower()) + { + return 0; + } + else + { + int var6 = ((TileEntityChest)par1IBlockAccess.getBlockTileEntity(par2, par3, par4)).numUsingPlayers; + return MathHelper.clamp_int(var6, 0, 15); + } + } + + /** + * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, + * side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return par5 == 1 ? this.isProvidingWeakPower(par1IBlockAccess, par2, par3, par4, par5) : 0; + } + + /** + * Looks for a sitting ocelot within certain bounds. Such an ocelot is considered to be blocking access to the + * chest. + */ + private static boolean isOcelotBlockingChest(World par0World, int par1, int par2, int par3) + { + Iterator var4 = par0World.getEntitiesWithinAABB(EntityOcelot.class, AxisAlignedBB.getAABBPool().getAABB((double)par1, (double)(par2 + 1), (double)par3, (double)(par1 + 1), (double)(par2 + 2), (double)(par3 + 1))).iterator(); + EntityOcelot var6; + + do + { + if (!var4.hasNext()) + { + return false; + } + + EntityOcelot var5 = (EntityOcelot)var4.next(); + var6 = (EntityOcelot)var5; + } + while (!var6.isSitting()); + + return true; + } + + /** + * If this returns true, then comparators facing away from this block will use the value from + * getComparatorInputOverride instead of the actual redstone signal strength. + */ + public boolean hasComparatorInputOverride() + { + return true; + } + + /** + * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal + * strength when this block inputs to a comparator. + */ + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) + { + return Container.calcRedstoneFromInventory(this.getInventory(par1World, par2, par3, par4)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon("planks_oak"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockClay.java b/src/main/java/net/minecraft/src/BlockClay.java new file mode 100644 index 0000000..beda03d --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockClay.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockClay extends Block +{ + public BlockClay(int par1) + { + super(par1, Material.clay); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.clay.itemID; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 4; + } +} diff --git a/src/main/java/net/minecraft/src/BlockCocoa.java b/src/main/java/net/minecraft/src/BlockCocoa.java new file mode 100644 index 0000000..fa78799 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockCocoa.java @@ -0,0 +1,231 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockCocoa extends BlockDirectional +{ + private Icon[] iconArray; + + public BlockCocoa(int par1) + { + super(par1, Material.plants); + this.setTickRandomly(true); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return this.iconArray[2]; + } + + public Icon getCocoaIcon(int par1) + { + if (par1 < 0 || par1 >= this.iconArray.length) + { + par1 = this.iconArray.length - 1; + } + + return this.iconArray[par1]; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!this.canBlockStay(par1World, par2, par3, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlock(par2, par3, par4, 0, 0, 2); + } + else if (par1World.rand.nextInt(5) == 0) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + int var7 = func_72219_c(var6); + + if (var7 < 2) + { + ++var7; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7 << 2 | getDirection(var6), 2); + } + } + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) + { + int var5 = getDirection(par1World.getBlockMetadata(par2, par3, par4)); + par2 += Direction.offsetX[var5]; + par4 += Direction.offsetZ[var5]; + int var6 = par1World.getBlockId(par2, par3, par4); + return var6 == Block.wood.blockID && BlockLog.limitToValidMetadata(par1World.getBlockMetadata(par2, par3, par4)) == 3; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 28; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Returns the bounding box of the wired rectangular prism to render. + */ + public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.getSelectedBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + int var6 = getDirection(var5); + int var7 = func_72219_c(var5); + int var8 = 4 + var7 * 2; + int var9 = 5 + var7 * 2; + float var10 = (float)var8 / 2.0F; + + switch (var6) + { + case 0: + this.setBlockBounds((8.0F - var10) / 16.0F, (12.0F - (float)var9) / 16.0F, (15.0F - (float)var8) / 16.0F, (8.0F + var10) / 16.0F, 0.75F, 0.9375F); + break; + + case 1: + this.setBlockBounds(0.0625F, (12.0F - (float)var9) / 16.0F, (8.0F - var10) / 16.0F, (1.0F + (float)var8) / 16.0F, 0.75F, (8.0F + var10) / 16.0F); + break; + + case 2: + this.setBlockBounds((8.0F - var10) / 16.0F, (12.0F - (float)var9) / 16.0F, 0.0625F, (8.0F + var10) / 16.0F, 0.75F, (1.0F + (float)var8) / 16.0F); + break; + + case 3: + this.setBlockBounds((15.0F - (float)var8) / 16.0F, (12.0F - (float)var9) / 16.0F, (8.0F - var10) / 16.0F, 0.9375F, 0.75F, (8.0F + var10) / 16.0F); + } + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = ((MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 0) % 4; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 2); + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + if (par5 == 1 || par5 == 0) + { + par5 = 2; + } + + return Direction.rotateOpposite[Direction.facingToDirection[par5]]; + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!this.canBlockStay(par1World, par2, par3, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlock(par2, par3, par4, 0, 0, 2); + } + } + + public static int func_72219_c(int par0) + { + return (par0 & 12) >> 2; + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + int var8 = func_72219_c(par5); + byte var9 = 1; + + if (var8 >= 2) + { + var9 = 3; + } + + for (int var10 = 0; var10 < var9; ++var10) + { + this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.dyePowder, 1, 3)); + } + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.dyePowder.itemID; + } + + /** + * Get the block's damage value (for use with pick block). + */ + public int getDamageValue(World par1World, int par2, int par3, int par4) + { + return 3; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[3]; + + for (int var2 = 0; var2 < this.iconArray.length; ++var2) + { + this.iconArray[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + var2); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockColored.java b/src/main/java/net/minecraft/src/BlockColored.java new file mode 100644 index 0000000..567da99 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockColored.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +import java.util.List; + +public class BlockColored extends Block +{ + private Icon[] iconArray; + + public BlockColored(int par1, Material par2Material) + { + super(par1, par2Material); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return this.iconArray[par2 % this.iconArray.length]; + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1; + } + + /** + * Takes a dye damage value and returns the block damage value to match + */ + public static int getBlockFromDye(int par0) + { + return ~par0 & 15; + } + + /** + * Takes a block damage value and returns the dye damage value to match + */ + public static int getDyeFromBlock(int par0) + { + return ~par0 & 15; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + for (int var4 = 0; var4 < 16; ++var4) + { + par3List.add(new ItemStack(par1, 1, var4)); + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[16]; + + for (int var2 = 0; var2 < this.iconArray.length; ++var2) + { + this.iconArray[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_" + ItemDye.dyeItemNames[getDyeFromBlock(var2)]); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockCommandBlock.java b/src/main/java/net/minecraft/src/BlockCommandBlock.java new file mode 100644 index 0000000..3152d25 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockCommandBlock.java @@ -0,0 +1,121 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockCommandBlock extends BlockContainer +{ + public BlockCommandBlock(int par1) + { + super(par1, Material.iron); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityCommandBlock(); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isRemote) + { + boolean var6 = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4); + int var7 = par1World.getBlockMetadata(par2, par3, par4); + boolean var8 = (var7 & 1) != 0; + + if (var6 && !var8) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7 | 1, 4); + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + } + else if (!var6 && var8) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7 & -2, 4); + } + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + TileEntity var6 = par1World.getBlockTileEntity(par2, par3, par4); + + if (var6 != null && var6 instanceof TileEntityCommandBlock) + { + TileEntityCommandBlock var7 = (TileEntityCommandBlock)var6; + var7.func_96102_a(var7.executeCommandOnPowered(par1World)); + par1World.func_96440_m(par2, par3, par4, this.blockID); + } + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 1; + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + TileEntityCommandBlock var10 = (TileEntityCommandBlock)par1World.getBlockTileEntity(par2, par3, par4); + + if (var10 != null) + { + par5EntityPlayer.displayGUIEditSign(var10); + } + + return true; + } + + /** + * If this returns true, then comparators facing away from this block will use the value from + * getComparatorInputOverride instead of the actual redstone signal strength. + */ + public boolean hasComparatorInputOverride() + { + return true; + } + + /** + * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal + * strength when this block inputs to a comparator. + */ + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) + { + TileEntity var6 = par1World.getBlockTileEntity(par2, par3, par4); + return var6 != null && var6 instanceof TileEntityCommandBlock ? ((TileEntityCommandBlock)var6).func_96103_d() : 0; + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + TileEntityCommandBlock var7 = (TileEntityCommandBlock)par1World.getBlockTileEntity(par2, par3, par4); + + if (par6ItemStack.hasDisplayName()) + { + var7.setCommandSenderName(par6ItemStack.getDisplayName()); + } + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } +} diff --git a/src/main/java/net/minecraft/src/BlockComparator.java b/src/main/java/net/minecraft/src/BlockComparator.java new file mode 100644 index 0000000..30c3388 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockComparator.java @@ -0,0 +1,257 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockComparator extends BlockRedstoneLogic implements ITileEntityProvider +{ + public BlockComparator(int par1, boolean par2) + { + super(par1, par2); + this.isBlockContainer = true; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.comparator.itemID; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.comparator.itemID; + } + + protected int func_94481_j_(int par1) + { + return 2; + } + + protected BlockRedstoneLogic func_94485_e() + { + return Block.redstoneComparatorActive; + } + + protected BlockRedstoneLogic func_94484_i() + { + return Block.redstoneComparatorIdle; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 37; + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + boolean var3 = this.isRepeaterPowered || (par2 & 8) != 0; + return par1 == 0 ? (var3 ? Block.torchRedstoneActive.getBlockTextureFromSide(par1) : Block.torchRedstoneIdle.getBlockTextureFromSide(par1)) : (par1 == 1 ? (var3 ? Block.redstoneComparatorActive.blockIcon : this.blockIcon) : Block.stoneDoubleSlab.getBlockTextureFromSide(1)); + } + + protected boolean func_96470_c(int par1) + { + return this.isRepeaterPowered || (par1 & 8) != 0; + } + + protected int func_94480_d(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return this.getTileEntityComparator(par1IBlockAccess, par2, par3, par4).getOutputSignal(); + } + + private int getOutputStrength(World par1World, int par2, int par3, int par4, int par5) + { + return !this.func_94490_c(par5) ? this.getInputStrength(par1World, par2, par3, par4, par5) : Math.max(this.getInputStrength(par1World, par2, par3, par4, par5) - this.func_94482_f(par1World, par2, par3, par4, par5), 0); + } + + public boolean func_94490_c(int par1) + { + return (par1 & 4) == 4; + } + + protected boolean isGettingInput(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = this.getInputStrength(par1World, par2, par3, par4, par5); + + if (var6 >= 15) + { + return true; + } + else if (var6 == 0) + { + return false; + } + else + { + int var7 = this.func_94482_f(par1World, par2, par3, par4, par5); + return var7 == 0 ? true : var6 >= var7; + } + } + + /** + * Returns the signal strength at one input of the block. Args: world, X, Y, Z, side + */ + protected int getInputStrength(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = super.getInputStrength(par1World, par2, par3, par4, par5); + int var7 = getDirection(par5); + int var8 = par2 + Direction.offsetX[var7]; + int var9 = par4 + Direction.offsetZ[var7]; + int var10 = par1World.getBlockId(var8, par3, var9); + + if (var10 > 0) + { + if (Block.blocksList[var10].hasComparatorInputOverride()) + { + var6 = Block.blocksList[var10].getComparatorInputOverride(par1World, var8, par3, var9, Direction.rotateOpposite[var7]); + } + else if (var6 < 15 && Block.isNormalCube(var10)) + { + var8 += Direction.offsetX[var7]; + var9 += Direction.offsetZ[var7]; + var10 = par1World.getBlockId(var8, par3, var9); + + if (var10 > 0 && Block.blocksList[var10].hasComparatorInputOverride()) + { + var6 = Block.blocksList[var10].getComparatorInputOverride(par1World, var8, par3, var9, Direction.rotateOpposite[var7]); + } + } + } + + return var6; + } + + /** + * Returns the blockTileEntity at given coordinates. + */ + public TileEntityComparator getTileEntityComparator(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return (TileEntityComparator)par1IBlockAccess.getBlockTileEntity(par2, par3, par4); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + int var10 = par1World.getBlockMetadata(par2, par3, par4); + boolean var11 = this.isRepeaterPowered | (var10 & 8) != 0; + boolean var12 = !this.func_94490_c(var10); + int var13 = var12 ? 4 : 0; + var13 |= var11 ? 8 : 0; + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "random.click", 0.3F, var12 ? 0.55F : 0.5F); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var13 | var10 & 3, 2); + this.func_96476_c(par1World, par2, par3, par4, par1World.rand); + return true; + } + + protected void func_94479_f(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isBlockTickScheduledThisTick(par2, par3, par4, this.blockID)) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + int var7 = this.getOutputStrength(par1World, par2, par3, par4, var6); + int var8 = this.getTileEntityComparator(par1World, par2, par3, par4).getOutputSignal(); + + if (var7 != var8 || this.func_96470_c(var6) != this.isGettingInput(par1World, par2, par3, par4, var6)) + { + if (this.func_83011_d(par1World, par2, par3, par4, var6)) + { + par1World.scheduleBlockUpdateWithPriority(par2, par3, par4, this.blockID, this.func_94481_j_(0), -1); + } + else + { + par1World.scheduleBlockUpdateWithPriority(par2, par3, par4, this.blockID, this.func_94481_j_(0), 0); + } + } + } + } + + private void func_96476_c(World par1World, int par2, int par3, int par4, Random par5Random) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + int var7 = this.getOutputStrength(par1World, par2, par3, par4, var6); + int var8 = this.getTileEntityComparator(par1World, par2, par3, par4).getOutputSignal(); + this.getTileEntityComparator(par1World, par2, par3, par4).setOutputSignal(var7); + + if (var8 != var7 || !this.func_94490_c(var6)) + { + boolean var9 = this.isGettingInput(par1World, par2, par3, par4, var6); + boolean var10 = this.isRepeaterPowered || (var6 & 8) != 0; + + if (var10 && !var9) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 2); + } + else if (!var10 && var9) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 | 8, 2); + } + + this.func_94483_i_(par1World, par2, par3, par4); + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (this.isRepeaterPowered) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + par1World.setBlock(par2, par3, par4, this.func_94484_i().blockID, var6 | 8, 4); + } + + this.func_96476_c(par1World, par2, par3, par4, par5Random); + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + par1World.setBlockTileEntity(par2, par3, par4, this.createNewTileEntity(par1World)); + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + super.breakBlock(par1World, par2, par3, par4, par5, par6); + par1World.removeBlockTileEntity(par2, par3, par4); + this.func_94483_i_(par1World, par2, par3, par4); + } + + /** + * Called when the block receives a BlockEvent - see World.addBlockEvent. By default, passes it on to the tile + * entity at this location. Args: world, x, y, z, blockID, EventID, event parameter + */ + public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) + { + super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6); + TileEntity var7 = par1World.getBlockTileEntity(par2, par3, par4); + return var7 != null ? var7.receiveClientEvent(par5, par6) : false; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityComparator(); + } +} diff --git a/src/main/java/net/minecraft/src/BlockContainer.java b/src/main/java/net/minecraft/src/BlockContainer.java new file mode 100644 index 0000000..68a9615 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockContainer.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +public abstract class BlockContainer extends Block implements ITileEntityProvider +{ + protected BlockContainer(int par1, Material par2Material) + { + super(par1, par2Material); + this.isBlockContainer = true; + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + super.breakBlock(par1World, par2, par3, par4, par5, par6); + par1World.removeBlockTileEntity(par2, par3, par4); + } + + /** + * Called when the block receives a BlockEvent - see World.addBlockEvent. By default, passes it on to the tile + * entity at this location. Args: world, x, y, z, blockID, EventID, event parameter + */ + public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) + { + super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6); + TileEntity var7 = par1World.getBlockTileEntity(par2, par3, par4); + return var7 != null ? var7.receiveClientEvent(par5, par6) : false; + } +} diff --git a/src/main/java/net/minecraft/src/BlockCrops.java b/src/main/java/net/minecraft/src/BlockCrops.java new file mode 100644 index 0000000..bbbb7f2 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockCrops.java @@ -0,0 +1,221 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockCrops extends BlockFlower +{ + private Icon[] iconArray; + + protected BlockCrops(int par1) + { + super(par1); + this.setTickRandomly(true); + float var2 = 0.5F; + this.setBlockBounds(0.5F - var2, 0.0F, 0.5F - var2, 0.5F + var2, 0.25F, 0.5F + var2); + this.setCreativeTab((CreativeTabs)null); + this.setHardness(0.0F); + this.setStepSound(soundGrassFootstep); + this.disableStats(); + } + + /** + * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of + * blockID passed in. Args: blockID + */ + protected boolean canThisPlantGrowOnThisBlockID(int par1) + { + return par1 == Block.tilledField.blockID; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + super.updateTick(par1World, par2, par3, par4, par5Random); + + if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if (var6 < 7) + { + float var7 = this.getGrowthRate(par1World, par2, par3, par4); + + if (par5Random.nextInt((int)(25.0F / var7) + 1) == 0) + { + ++var6; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 2); + } + } + } + } + + /** + * Apply bonemeal to the crops. + */ + public void fertilize(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4) + MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5); + + if (var5 > 7) + { + var5 = 7; + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, var5, 2); + } + + /** + * Gets the growth rate for the crop. Setup to encourage rows by halving growth rate if there is diagonals, crops on + * different sides that aren't opposing, and by adding growth for every crop next to this one (and for crop below + * this one). Args: x, y, z + */ + private float getGrowthRate(World par1World, int par2, int par3, int par4) + { + float var5 = 1.0F; + int var6 = par1World.getBlockId(par2, par3, par4 - 1); + int var7 = par1World.getBlockId(par2, par3, par4 + 1); + int var8 = par1World.getBlockId(par2 - 1, par3, par4); + int var9 = par1World.getBlockId(par2 + 1, par3, par4); + int var10 = par1World.getBlockId(par2 - 1, par3, par4 - 1); + int var11 = par1World.getBlockId(par2 + 1, par3, par4 - 1); + int var12 = par1World.getBlockId(par2 + 1, par3, par4 + 1); + int var13 = par1World.getBlockId(par2 - 1, par3, par4 + 1); + boolean var14 = var8 == this.blockID || var9 == this.blockID; + boolean var15 = var6 == this.blockID || var7 == this.blockID; + boolean var16 = var10 == this.blockID || var11 == this.blockID || var12 == this.blockID || var13 == this.blockID; + + for (int var17 = par2 - 1; var17 <= par2 + 1; ++var17) + { + for (int var18 = par4 - 1; var18 <= par4 + 1; ++var18) + { + int var19 = par1World.getBlockId(var17, par3 - 1, var18); + float var20 = 0.0F; + + if (var19 == Block.tilledField.blockID) + { + var20 = 1.0F; + + if (par1World.getBlockMetadata(var17, par3 - 1, var18) > 0) + { + var20 = 3.0F; + } + } + + if (var17 != par2 || var18 != par4) + { + var20 /= 4.0F; + } + + var5 += var20; + } + } + + if (var16 || var14 && var15) + { + var5 /= 2.0F; + } + + return var5; + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + if (par2 < 0 || par2 > 7) + { + par2 = 7; + } + + return this.iconArray[par2]; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 6; + } + + /** + * Generate a seed ItemStack for this crop. + */ + protected int getSeedItem() + { + return Item.seeds.itemID; + } + + /** + * Generate a crop produce ItemStack for this crop. + */ + protected int getCropItem() + { + return Item.wheat.itemID; + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); + + if (!par1World.isRemote) + { + if (par5 >= 7) + { + int var8 = 3 + par7; + + for (int var9 = 0; var9 < var8; ++var9) + { + if (par1World.rand.nextInt(15) <= par5) + { + this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(this.getSeedItem(), 1, 0)); + } + } + } + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return par1 == 7 ? this.getCropItem() : this.getSeedItem(); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 1; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return this.getSeedItem(); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[8]; + + for (int var2 = 0; var2 < this.iconArray.length; ++var2) + { + this.iconArray[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + var2); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockDaylightDetector.java b/src/main/java/net/minecraft/src/BlockDaylightDetector.java new file mode 100644 index 0000000..c4b5b0c --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockDaylightDetector.java @@ -0,0 +1,136 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockDaylightDetector extends BlockContainer +{ + private Icon[] iconArray = new Icon[2]; + + public BlockDaylightDetector(int par1) + { + super(par1, Material.wood); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.375F, 1.0F); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.375F, 1.0F); + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return par1IBlockAccess.getBlockMetadata(par2, par3, par4); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {} + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) {} + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) {} + + public void updateLightLevel(World par1World, int par2, int par3, int par4) + { + if (!par1World.provider.hasNoSky) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + int var6 = par1World.getSavedLightValue(EnumSkyBlock.Sky, par2, par3, par4) - par1World.skylightSubtracted; + float var7 = par1World.getCelestialAngleRadians(1.0F); + + if (var7 < (float)Math.PI) + { + var7 += (0.0F - var7) * 0.2F; + } + else + { + var7 += (((float)Math.PI * 2F) - var7) * 0.2F; + } + + var6 = Math.round((float)var6 * MathHelper.cos(var7)); + + if (var6 < 0) + { + var6 = 0; + } + + if (var6 > 15) + { + var6 = 15; + } + + if (var5 != var6) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 3); + } + } + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityDaylightDetector(); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.iconArray[0] : this.iconArray[1]; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray[0] = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.iconArray[1] = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockDeadBush.java b/src/main/java/net/minecraft/src/BlockDeadBush.java new file mode 100644 index 0000000..3c409d3 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockDeadBush.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockDeadBush extends BlockFlower +{ + protected BlockDeadBush(int par1) + { + super(par1, Material.vine); + float var2 = 0.4F; + this.setBlockBounds(0.5F - var2, 0.0F, 0.5F - var2, 0.5F + var2, 0.8F, 0.5F + var2); + } + + /** + * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of + * blockID passed in. Args: blockID + */ + protected boolean canThisPlantGrowOnThisBlockID(int par1) + { + return par1 == Block.sand.blockID; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return -1; + } + + /** + * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the + * block and l is the block's subtype/damage. + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) + { + if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) + { + par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); + this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.deadBush, 1, par6)); + } + else + { + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockDetectorRail.java b/src/main/java/net/minecraft/src/BlockDetectorRail.java new file mode 100644 index 0000000..319ea0a --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockDetectorRail.java @@ -0,0 +1,178 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockDetectorRail extends BlockRailBase +{ + private Icon[] iconArray; + + public BlockDetectorRail(int par1) + { + super(par1, true); + this.setTickRandomly(true); + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 20; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + if (!par1World.isRemote) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if ((var6 & 8) == 0) + { + this.setStateIfMinecartInteractsWithRail(par1World, par2, par3, par4, var6); + } + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if ((var6 & 8) != 0) + { + this.setStateIfMinecartInteractsWithRail(par1World, par2, par3, par4, var6); + } + } + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return (par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 8) != 0 ? 15 : 0; + } + + /** + * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, + * side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return (par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 8) == 0 ? 0 : (par5 == 1 ? 15 : 0); + } + + /** + * Update the detector rail power state if a minecart enter, stays or leave the block. + */ + private void setStateIfMinecartInteractsWithRail(World par1World, int par2, int par3, int par4, int par5) + { + boolean var6 = (par5 & 8) != 0; + boolean var7 = false; + float var8 = 0.125F; + List var9 = par1World.getEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var8), (double)par3, (double)((float)par4 + var8), (double)((float)(par2 + 1) - var8), (double)((float)(par3 + 1) - var8), (double)((float)(par4 + 1) - var8))); + + if (!var9.isEmpty()) + { + var7 = true; + } + + if (var7 && !var6) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, par5 | 8, 3); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + par1World.markBlockRangeForRenderUpdate(par2, par3, par4, par2, par3, par4); + } + + if (!var7 && var6) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, par5 & 7, 3); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + par1World.markBlockRangeForRenderUpdate(par2, par3, par4, par2, par3, par4); + } + + if (var7) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + } + + par1World.func_96440_m(par2, par3, par4, this.blockID); + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + this.setStateIfMinecartInteractsWithRail(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4)); + } + + /** + * If this returns true, then comparators facing away from this block will use the value from + * getComparatorInputOverride instead of the actual redstone signal strength. + */ + public boolean hasComparatorInputOverride() + { + return true; + } + + /** + * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal + * strength when this block inputs to a comparator. + */ + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) + { + if ((par1World.getBlockMetadata(par2, par3, par4) & 8) > 0) + { + float var6 = 0.125F; + List var7 = par1World.selectEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + var6), (double)par3, (double)((float)par4 + var6), (double)((float)(par2 + 1) - var6), (double)((float)(par3 + 1) - var6), (double)((float)(par4 + 1) - var6)), IEntitySelector.selectInventories); + + if (var7.size() > 0) + { + return Container.calcRedstoneFromInventory((IInventory)var7.get(0)); + } + } + + return 0; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[2]; + this.iconArray[0] = par1IconRegister.registerIcon(this.getTextureName()); + this.iconArray[1] = par1IconRegister.registerIcon(this.getTextureName() + "_powered"); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return (par2 & 8) != 0 ? this.iconArray[1] : this.iconArray[0]; + } +} diff --git a/src/main/java/net/minecraft/src/BlockDirectional.java b/src/main/java/net/minecraft/src/BlockDirectional.java new file mode 100644 index 0000000..9e4b4de --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockDirectional.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public abstract class BlockDirectional extends Block +{ + protected BlockDirectional(int par1, Material par2Material) + { + super(par1, par2Material); + } + + /** + * Returns the orentation value from the specified metadata + */ + public static int getDirection(int par0) + { + return par0 & 3; + } +} diff --git a/src/main/java/net/minecraft/src/BlockDirt.java b/src/main/java/net/minecraft/src/BlockDirt.java new file mode 100644 index 0000000..f45e37b --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockDirt.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public class BlockDirt extends Block +{ + protected BlockDirt(int par1) + { + super(par1, Material.ground); + this.setCreativeTab(CreativeTabs.tabBlock); + } +} diff --git a/src/main/java/net/minecraft/src/BlockDispenser.java b/src/main/java/net/minecraft/src/BlockDispenser.java new file mode 100644 index 0000000..acf638d --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockDispenser.java @@ -0,0 +1,291 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockDispenser extends BlockContainer +{ + /** Registry for all dispense behaviors. */ + public static final IRegistry dispenseBehaviorRegistry = new RegistryDefaulted(new BehaviorDefaultDispenseItem()); + protected Random random = new Random(); + protected Icon furnaceTopIcon; + protected Icon furnaceFrontIcon; + protected Icon field_96473_e; + + protected BlockDispenser(int par1) + { + super(par1, Material.rock); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 4; + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + this.setDispenserDefaultDirection(par1World, par2, par3, par4); + } + + /** + * sets Dispenser block direction so that the front faces an non-opaque block; chooses west to be direction if all + * surrounding blocks are opaque. + */ + private void setDispenserDefaultDirection(World par1World, int par2, int par3, int par4) + { + if (!par1World.isRemote) + { + int var5 = par1World.getBlockId(par2, par3, par4 - 1); + int var6 = par1World.getBlockId(par2, par3, par4 + 1); + int var7 = par1World.getBlockId(par2 - 1, par3, par4); + int var8 = par1World.getBlockId(par2 + 1, par3, par4); + byte var9 = 3; + + if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6]) + { + var9 = 3; + } + + if (Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var5]) + { + var9 = 2; + } + + if (Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var8]) + { + var9 = 5; + } + + if (Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var7]) + { + var9 = 4; + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, var9, 2); + } + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + int var3 = par2 & 7; + return par1 == var3 ? (var3 != 1 && var3 != 0 ? this.furnaceFrontIcon : this.field_96473_e) : (var3 != 1 && var3 != 0 ? (par1 != 1 && par1 != 0 ? this.blockIcon : this.furnaceTopIcon) : this.furnaceTopIcon); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon("furnace_side"); + this.furnaceTopIcon = par1IconRegister.registerIcon("furnace_top"); + this.furnaceFrontIcon = par1IconRegister.registerIcon(this.getTextureName() + "_front_horizontal"); + this.field_96473_e = par1IconRegister.registerIcon(this.getTextureName() + "_front_vertical"); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + TileEntityDispenser var10 = (TileEntityDispenser)par1World.getBlockTileEntity(par2, par3, par4); + + if (var10 != null) + { + par5EntityPlayer.displayGUIDispenser(var10); + } + + return true; + } + } + + protected void dispense(World par1World, int par2, int par3, int par4) + { + BlockSourceImpl var5 = new BlockSourceImpl(par1World, par2, par3, par4); + TileEntityDispenser var6 = (TileEntityDispenser)var5.getBlockTileEntity(); + + if (var6 != null) + { + int var7 = var6.getRandomStackFromInventory(); + + if (var7 < 0) + { + par1World.playAuxSFX(1001, par2, par3, par4, 0); + } + else + { + ItemStack var8 = var6.getStackInSlot(var7); + IBehaviorDispenseItem var9 = this.getBehaviorForItemStack(var8); + + if (var9 != IBehaviorDispenseItem.itemDispenseBehaviorProvider) + { + ItemStack var10 = var9.dispense(var5, var8); + var6.setInventorySlotContents(var7, var10.stackSize == 0 ? null : var10); + } + } + } + } + + /** + * Returns the behavior for the given ItemStack. + */ + protected IBehaviorDispenseItem getBehaviorForItemStack(ItemStack par1ItemStack) + { + return (IBehaviorDispenseItem)dispenseBehaviorRegistry.getObject(par1ItemStack.getItem()); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + boolean var6 = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) || par1World.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4); + int var7 = par1World.getBlockMetadata(par2, par3, par4); + boolean var8 = (var7 & 8) != 0; + + if (var6 && !var8) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7 | 8, 4); + } + else if (!var6 && var8) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7 & -9, 4); + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote) + { + this.dispense(par1World, par2, par3, par4); + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityDispenser(); + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = BlockPistonBase.determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 2); + + if (par6ItemStack.hasDisplayName()) + { + ((TileEntityDispenser)par1World.getBlockTileEntity(par2, par3, par4)).setCustomName(par6ItemStack.getDisplayName()); + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + TileEntityDispenser var7 = (TileEntityDispenser)par1World.getBlockTileEntity(par2, par3, par4); + + if (var7 != null) + { + for (int var8 = 0; var8 < var7.getSizeInventory(); ++var8) + { + ItemStack var9 = var7.getStackInSlot(var8); + + if (var9 != null) + { + float var10 = this.random.nextFloat() * 0.8F + 0.1F; + float var11 = this.random.nextFloat() * 0.8F + 0.1F; + float var12 = this.random.nextFloat() * 0.8F + 0.1F; + + while (var9.stackSize > 0) + { + int var13 = this.random.nextInt(21) + 10; + + if (var13 > var9.stackSize) + { + var13 = var9.stackSize; + } + + var9.stackSize -= var13; + EntityItem var14 = new EntityItem(par1World, (double)((float)par2 + var10), (double)((float)par3 + var11), (double)((float)par4 + var12), new ItemStack(var9.itemID, var13, var9.getItemDamage())); + + if (var9.hasTagCompound()) + { + var14.getEntityItem().setTagCompound((NBTTagCompound)var9.getTagCompound().copy()); + } + + float var15 = 0.05F; + var14.motionX = (double)((float)this.random.nextGaussian() * var15); + var14.motionY = (double)((float)this.random.nextGaussian() * var15 + 0.2F); + var14.motionZ = (double)((float)this.random.nextGaussian() * var15); + par1World.spawnEntityInWorld(var14); + } + } + } + + par1World.func_96440_m(par2, par3, par4, par5); + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + public static IPosition getIPositionFromBlockSource(IBlockSource par0IBlockSource) + { + EnumFacing var1 = getFacing(par0IBlockSource.getBlockMetadata()); + double var2 = par0IBlockSource.getX() + 0.7D * (double)var1.getFrontOffsetX(); + double var4 = par0IBlockSource.getY() + 0.7D * (double)var1.getFrontOffsetY(); + double var6 = par0IBlockSource.getZ() + 0.7D * (double)var1.getFrontOffsetZ(); + return new PositionImpl(var2, var4, var6); + } + + public static EnumFacing getFacing(int par0) + { + return EnumFacing.getFront(par0 & 7); + } + + /** + * If this returns true, then comparators facing away from this block will use the value from + * getComparatorInputOverride instead of the actual redstone signal strength. + */ + public boolean hasComparatorInputOverride() + { + return true; + } + + /** + * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal + * strength when this block inputs to a comparator. + */ + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) + { + return Container.calcRedstoneFromInventory((IInventory)par1World.getBlockTileEntity(par2, par3, par4)); + } +} diff --git a/src/main/java/net/minecraft/src/BlockDoor.java b/src/main/java/net/minecraft/src/BlockDoor.java new file mode 100644 index 0000000..4289135 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockDoor.java @@ -0,0 +1,460 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockDoor extends Block +{ + private Icon[] field_111044_a; + private Icon[] field_111043_b; + + protected BlockDoor(int par1, Material par2Material) + { + super(par1, par2Material); + float var3 = 0.5F; + float var4 = 1.0F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var4, 0.5F + var3); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return this.field_111043_b[0]; + } + + /** + * Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side + */ + public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + if (par5 != 1 && par5 != 0) + { + int var6 = this.getFullMetadata(par1IBlockAccess, par2, par3, par4); + int var7 = var6 & 3; + boolean var8 = (var6 & 4) != 0; + boolean var9 = false; + boolean var10 = (var6 & 8) != 0; + + if (var8) + { + if (var7 == 0 && par5 == 2) + { + var9 = !var9; + } + else if (var7 == 1 && par5 == 5) + { + var9 = !var9; + } + else if (var7 == 2 && par5 == 3) + { + var9 = !var9; + } + else if (var7 == 3 && par5 == 4) + { + var9 = !var9; + } + } + else + { + if (var7 == 0 && par5 == 5) + { + var9 = !var9; + } + else if (var7 == 1 && par5 == 3) + { + var9 = !var9; + } + else if (var7 == 2 && par5 == 4) + { + var9 = !var9; + } + else if (var7 == 3 && par5 == 2) + { + var9 = !var9; + } + + if ((var6 & 16) != 0) + { + var9 = !var9; + } + } + + return var10 ? this.field_111044_a[var9 ? 1 : 0] : this.field_111043_b[var9 ? 1 : 0]; + } + else + { + return this.field_111043_b[0]; + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.field_111044_a = new Icon[2]; + this.field_111043_b = new Icon[2]; + this.field_111044_a[0] = par1IconRegister.registerIcon(this.getTextureName() + "_upper"); + this.field_111043_b[0] = par1IconRegister.registerIcon(this.getTextureName() + "_lower"); + this.field_111044_a[1] = new IconFlipped(this.field_111044_a[0], true, false); + this.field_111043_b[1] = new IconFlipped(this.field_111043_b[0], true, false); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = this.getFullMetadata(par1IBlockAccess, par2, par3, par4); + return (var5 & 4) != 0; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 7; + } + + /** + * Returns the bounding box of the wired rectangular prism to render. + */ + public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.getSelectedBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.setDoorRotation(this.getFullMetadata(par1IBlockAccess, par2, par3, par4)); + } + + /** + * Returns 0, 1, 2 or 3 depending on where the hinge is. + */ + public int getDoorOrientation(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return this.getFullMetadata(par1IBlockAccess, par2, par3, par4) & 3; + } + + public boolean isDoorOpen(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return (this.getFullMetadata(par1IBlockAccess, par2, par3, par4) & 4) != 0; + } + + private void setDoorRotation(int par1) + { + float var2 = 0.1875F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); + int var3 = par1 & 3; + boolean var4 = (par1 & 4) != 0; + boolean var5 = (par1 & 16) != 0; + + if (var3 == 0) + { + if (var4) + { + if (!var5) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var2); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F); + } + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 1.0F); + } + } + else if (var3 == 1) + { + if (var4) + { + if (!var5) + { + this.setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 1.0F); + } + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var2); + } + } + else if (var3 == 2) + { + if (var4) + { + if (!var5) + { + this.setBlockBounds(0.0F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var2); + } + } + else + { + this.setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + else if (var3 == 3) + { + if (var4) + { + if (!var5) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + else + { + this.setBlockBounds(0.0F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F); + } + } + } + + /** + * Called when the block is clicked by a player. Args: x, y, z, entityPlayer + */ + public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) {} + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (this.blockMaterial == Material.iron) + { + return true; + } + else + { + int var10 = this.getFullMetadata(par1World, par2, par3, par4); + int var11 = var10 & 7; + var11 ^= 4; + + if ((var10 & 8) == 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var11, 2); + par1World.markBlockRangeForRenderUpdate(par2, par3, par4, par2, par3, par4); + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3 - 1, par4, var11, 2); + par1World.markBlockRangeForRenderUpdate(par2, par3 - 1, par4, par2, par3, par4); + } + + par1World.playAuxSFXAtEntity(par5EntityPlayer, 1003, par2, par3, par4, 0); + return true; + } + } + + /** + * A function to open a door. + */ + public void onPoweredBlockChange(World par1World, int par2, int par3, int par4, boolean par5) + { + int var6 = this.getFullMetadata(par1World, par2, par3, par4); + boolean var7 = (var6 & 4) != 0; + + if (var7 != par5) + { + int var8 = var6 & 7; + var8 ^= 4; + + if ((var6 & 8) == 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var8, 2); + par1World.markBlockRangeForRenderUpdate(par2, par3, par4, par2, par3, par4); + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3 - 1, par4, var8, 2); + par1World.markBlockRangeForRenderUpdate(par2, par3 - 1, par4, par2, par3, par4); + } + + par1World.playAuxSFXAtEntity((EntityPlayer)null, 1003, par2, par3, par4, 0); + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if ((var6 & 8) == 0) + { + boolean var7 = false; + + if (par1World.getBlockId(par2, par3 + 1, par4) != this.blockID) + { + par1World.setBlockToAir(par2, par3, par4); + var7 = true; + } + + if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) + { + par1World.setBlockToAir(par2, par3, par4); + var7 = true; + + if (par1World.getBlockId(par2, par3 + 1, par4) == this.blockID) + { + par1World.setBlockToAir(par2, par3 + 1, par4); + } + } + + if (var7) + { + if (!par1World.isRemote) + { + this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0); + } + } + else + { + boolean var8 = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) || par1World.isBlockIndirectlyGettingPowered(par2, par3 + 1, par4); + + if ((var8 || par5 > 0 && Block.blocksList[par5].canProvidePower()) && par5 != this.blockID) + { + this.onPoweredBlockChange(par1World, par2, par3, par4, var8); + } + } + } + else + { + if (par1World.getBlockId(par2, par3 - 1, par4) != this.blockID) + { + par1World.setBlockToAir(par2, par3, par4); + } + + if (par5 > 0 && par5 != this.blockID) + { + this.onNeighborBlockChange(par1World, par2, par3 - 1, par4, par5); + } + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return (par1 & 8) != 0 ? 0 : (this.blockMaterial == Material.iron ? Item.doorIron.itemID : Item.doorWood.itemID); + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, + * x, y, z, startVec, endVec + */ + public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return par3 >= 255 ? false : par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && super.canPlaceBlockAt(par1World, par2, par3, par4) && super.canPlaceBlockAt(par1World, par2, par3 + 1, par4); + } + + /** + * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility + * and stop pistons + */ + public int getMobilityFlag() + { + return 1; + } + + /** + * Returns the full metadata value created by combining the metadata of both blocks the door takes up. + */ + public int getFullMetadata(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + boolean var6 = (var5 & 8) != 0; + int var7; + int var8; + + if (var6) + { + var7 = par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4); + var8 = var5; + } + else + { + var7 = var5; + var8 = par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4); + } + + boolean var9 = (var8 & 1) != 0; + return var7 & 7 | (var6 ? 8 : 0) | (var9 ? 16 : 0); + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return this.blockMaterial == Material.iron ? Item.doorIron.itemID : Item.doorWood.itemID; + } + + /** + * Called when the block is attempted to be harvested + */ + public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) + { + if (par6EntityPlayer.capabilities.isCreativeMode && (par5 & 8) != 0 && par1World.getBlockId(par2, par3 - 1, par4) == this.blockID) + { + par1World.setBlockToAir(par2, par3 - 1, par4); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockDragonEgg.java b/src/main/java/net/minecraft/src/BlockDragonEgg.java new file mode 100644 index 0000000..51d0115 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockDragonEgg.java @@ -0,0 +1,178 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockDragonEgg extends Block +{ + public BlockDragonEgg(int par1) + { + super(par1, Material.dragonEgg); + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F); + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + this.fallIfPossible(par1World, par2, par3, par4); + } + + /** + * Checks if the dragon egg can fall down, and if so, makes it fall. + */ + private void fallIfPossible(World par1World, int par2, int par3, int par4) + { + if (BlockSand.canFallBelow(par1World, par2, par3 - 1, par4) && par3 >= 0) + { + byte var5 = 32; + + if (!BlockSand.fallInstantly && par1World.checkChunksExist(par2 - var5, par3 - var5, par4 - var5, par2 + var5, par3 + var5, par4 + var5)) + { + EntityFallingSand var6 = new EntityFallingSand(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.blockID); + par1World.spawnEntityInWorld(var6); + } + else + { + par1World.setBlockToAir(par2, par3, par4); + + while (BlockSand.canFallBelow(par1World, par2, par3 - 1, par4) && par3 > 0) + { + --par3; + } + + if (par3 > 0) + { + par1World.setBlock(par2, par3, par4, this.blockID, 0, 2); + } + } + } + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + this.teleportNearby(par1World, par2, par3, par4); + return true; + } + + /** + * Called when the block is clicked by a player. Args: x, y, z, entityPlayer + */ + public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) + { + this.teleportNearby(par1World, par2, par3, par4); + } + + /** + * Teleports the dragon egg somewhere else in a 31x19x31 area centered on the egg. + */ + private void teleportNearby(World par1World, int par2, int par3, int par4) + { + if (par1World.getBlockId(par2, par3, par4) == this.blockID) + { + for (int var5 = 0; var5 < 1000; ++var5) + { + int var6 = par2 + par1World.rand.nextInt(16) - par1World.rand.nextInt(16); + int var7 = par3 + par1World.rand.nextInt(8) - par1World.rand.nextInt(8); + int var8 = par4 + par1World.rand.nextInt(16) - par1World.rand.nextInt(16); + + if (par1World.getBlockId(var6, var7, var8) == 0) + { + if (!par1World.isRemote) + { + par1World.setBlock(var6, var7, var8, this.blockID, par1World.getBlockMetadata(par2, par3, par4), 2); + par1World.setBlockToAir(par2, par3, par4); + } + else + { + short var9 = 128; + + for (int var10 = 0; var10 < var9; ++var10) + { + double var11 = par1World.rand.nextDouble(); + float var13 = (par1World.rand.nextFloat() - 0.5F) * 0.2F; + float var14 = (par1World.rand.nextFloat() - 0.5F) * 0.2F; + float var15 = (par1World.rand.nextFloat() - 0.5F) * 0.2F; + double var16 = (double)var6 + (double)(par2 - var6) * var11 + (par1World.rand.nextDouble() - 0.5D) * 1.0D + 0.5D; + double var18 = (double)var7 + (double)(par3 - var7) * var11 + par1World.rand.nextDouble() * 1.0D - 0.5D; + double var20 = (double)var8 + (double)(par4 - var8) * var11 + (par1World.rand.nextDouble() - 0.5D) * 1.0D + 0.5D; + par1World.spawnParticle("portal", var16, var18, var20, (double)var13, (double)var14, (double)var15); + } + } + + return; + } + } + } + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 5; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return true; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 27; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return 0; + } +} diff --git a/src/main/java/net/minecraft/src/BlockDropper.java b/src/main/java/net/minecraft/src/BlockDropper.java new file mode 100644 index 0000000..f074306 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockDropper.java @@ -0,0 +1,92 @@ +package net.minecraft.src; + +public class BlockDropper extends BlockDispenser +{ + private final IBehaviorDispenseItem dropperDefaultBehaviour = new BehaviorDefaultDispenseItem(); + + protected BlockDropper(int par1) + { + super(par1); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon("furnace_side"); + this.furnaceTopIcon = par1IconRegister.registerIcon("furnace_top"); + this.furnaceFrontIcon = par1IconRegister.registerIcon(this.getTextureName() + "_front_horizontal"); + this.field_96473_e = par1IconRegister.registerIcon(this.getTextureName() + "_front_vertical"); + } + + /** + * Returns the behavior for the given ItemStack. + */ + protected IBehaviorDispenseItem getBehaviorForItemStack(ItemStack par1ItemStack) + { + return this.dropperDefaultBehaviour; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityDropper(); + } + + protected void dispense(World par1World, int par2, int par3, int par4) + { + BlockSourceImpl var5 = new BlockSourceImpl(par1World, par2, par3, par4); + TileEntityDispenser var6 = (TileEntityDispenser)var5.getBlockTileEntity(); + + if (var6 != null) + { + int var7 = var6.getRandomStackFromInventory(); + + if (var7 < 0) + { + par1World.playAuxSFX(1001, par2, par3, par4, 0); + } + else + { + ItemStack var8 = var6.getStackInSlot(var7); + int var9 = par1World.getBlockMetadata(par2, par3, par4) & 7; + IInventory var10 = TileEntityHopper.getInventoryAtLocation(par1World, (double)(par2 + Facing.offsetsXForSide[var9]), (double)(par3 + Facing.offsetsYForSide[var9]), (double)(par4 + Facing.offsetsZForSide[var9])); + ItemStack var11; + + if (var10 != null) + { + var11 = TileEntityHopper.insertStack(var10, var8.copy().splitStack(1), Facing.oppositeSide[var9]); + + if (var11 == null) + { + var11 = var8.copy(); + + if (--var11.stackSize == 0) + { + var11 = null; + } + } + else + { + var11 = var8.copy(); + } + } + else + { + var11 = this.dropperDefaultBehaviour.dispense(var5, var8); + + if (var11 != null && var11.stackSize == 0) + { + var11 = null; + } + } + + var6.setInventorySlotContents(var7, var11); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockEnchantmentTable.java b/src/main/java/net/minecraft/src/BlockEnchantmentTable.java new file mode 100644 index 0000000..8617c73 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockEnchantmentTable.java @@ -0,0 +1,126 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockEnchantmentTable extends BlockContainer +{ + private Icon field_94461_a; + private Icon field_94460_b; + + protected BlockEnchantmentTable(int par1) + { + super(par1, Material.rock); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F); + this.setLightOpacity(0); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + super.randomDisplayTick(par1World, par2, par3, par4, par5Random); + + for (int var6 = par2 - 2; var6 <= par2 + 2; ++var6) + { + for (int var7 = par4 - 2; var7 <= par4 + 2; ++var7) + { + if (var6 > par2 - 2 && var6 < par2 + 2 && var7 == par4 - 1) + { + var7 = par4 + 2; + } + + if (par5Random.nextInt(16) == 0) + { + for (int var8 = par3; var8 <= par3 + 1; ++var8) + { + if (par1World.getBlockId(var6, var8, var7) == Block.bookShelf.blockID) + { + if (!par1World.isAirBlock((var6 - par2) / 2 + par2, var8, (var7 - par4) / 2 + par4)) + { + break; + } + + par1World.spawnParticle("enchantmenttable", (double)par2 + 0.5D, (double)par3 + 2.0D, (double)par4 + 0.5D, (double)((float)(var6 - par2) + par5Random.nextFloat()) - 0.5D, (double)((float)(var8 - par3) - par5Random.nextFloat() - 1.0F), (double)((float)(var7 - par4) + par5Random.nextFloat()) - 0.5D); + } + } + } + } + } + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 0 ? this.field_94460_b : (par1 == 1 ? this.field_94461_a : this.blockIcon); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityEnchantmentTable(); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + TileEntityEnchantmentTable var10 = (TileEntityEnchantmentTable)par1World.getBlockTileEntity(par2, par3, par4); + par5EntityPlayer.displayGUIEnchantment(par2, par3, par4, var10.func_94135_b() ? var10.func_94133_a() : null); + return true; + } + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack); + + if (par6ItemStack.hasDisplayName()) + { + ((TileEntityEnchantmentTable)par1World.getBlockTileEntity(par2, par3, par4)).func_94134_a(par6ItemStack.getDisplayName()); + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_" + "side"); + this.field_94461_a = par1IconRegister.registerIcon(this.getTextureName() + "_" + "top"); + this.field_94460_b = par1IconRegister.registerIcon(this.getTextureName() + "_" + "bottom"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockEndPortal.java b/src/main/java/net/minecraft/src/BlockEndPortal.java new file mode 100644 index 0000000..b7b2d9b --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockEndPortal.java @@ -0,0 +1,139 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockEndPortal extends BlockContainer +{ + /** + * true if the enderdragon has been killed - allows end portal blocks to be created in the end + */ + public static boolean bossDefeated; + + protected BlockEndPortal(int par1, Material par2Material) + { + super(par1, par2Material); + this.setLightValue(1.0F); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityEndPortal(); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + float var5 = 0.0625F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, var5, 1.0F); + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return par5 != 0 ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {} + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + if (par5Entity.ridingEntity == null && par5Entity.riddenByEntity == null && !par1World.isRemote) + { + par5Entity.travelToDimension(1); + } + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + double var6 = (double)((float)par2 + par5Random.nextFloat()); + double var8 = (double)((float)par3 + 0.8F); + double var10 = (double)((float)par4 + par5Random.nextFloat()); + double var12 = 0.0D; + double var14 = 0.0D; + double var16 = 0.0D; + par1World.spawnParticle("smoke", var6, var8, var10, var12, var14, var16); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return -1; + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + if (!bossDefeated) + { + if (par1World.provider.dimensionId != 0) + { + par1World.setBlockToAir(par2, par3, par4); + } + } + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return 0; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon("portal"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockEndPortalFrame.java b/src/main/java/net/minecraft/src/BlockEndPortalFrame.java new file mode 100644 index 0000000..15f969b --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockEndPortalFrame.java @@ -0,0 +1,127 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockEndPortalFrame extends Block +{ + private Icon field_94400_a; + private Icon field_94399_b; + + public BlockEndPortalFrame(int par1) + { + super(par1, Material.rock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.field_94400_a : (par1 == 0 ? Block.whiteStone.getBlockTextureFromSide(par1) : this.blockIcon); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + this.field_94400_a = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.field_94399_b = par1IconRegister.registerIcon(this.getTextureName() + "_eye"); + } + + public Icon func_94398_p() + { + return this.field_94399_b; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 26; + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F); + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + int var8 = par1World.getBlockMetadata(par2, par3, par4); + + if (isEnderEyeInserted(var8)) + { + this.setBlockBounds(0.3125F, 0.8125F, 0.3125F, 0.6875F, 1.0F, 0.6875F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + + this.setBlockBoundsForItemRender(); + } + + /** + * checks if an ender eye has been inserted into the frame block. parameters: metadata + */ + public static boolean isEnderEyeInserted(int par0) + { + return (par0 & 4) != 0; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return 0; + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = ((MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 2); + } + + /** + * If this returns true, then comparators facing away from this block will use the value from + * getComparatorInputOverride instead of the actual redstone signal strength. + */ + public boolean hasComparatorInputOverride() + { + return true; + } + + /** + * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal + * strength when this block inputs to a comparator. + */ + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + return isEnderEyeInserted(var6) ? 15 : 0; + } +} diff --git a/src/main/java/net/minecraft/src/BlockEnderChest.java b/src/main/java/net/minecraft/src/BlockEnderChest.java new file mode 100644 index 0000000..45d183c --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockEnderChest.java @@ -0,0 +1,167 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockEnderChest extends BlockContainer +{ + protected BlockEnderChest(int par1) + { + super(par1, Material.rock); + this.setCreativeTab(CreativeTabs.tabDecorations); + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 22; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.obsidian.blockID; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 8; + } + + /** + * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops. + */ + protected boolean canSilkHarvest() + { + return true; + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + byte var7 = 0; + int var8 = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + + if (var8 == 0) + { + var7 = 2; + } + + if (var8 == 1) + { + var7 = 5; + } + + if (var8 == 2) + { + var7 = 3; + } + + if (var8 == 3) + { + var7 = 4; + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 2); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + InventoryEnderChest var10 = par5EntityPlayer.getInventoryEnderChest(); + TileEntityEnderChest var11 = (TileEntityEnderChest)par1World.getBlockTileEntity(par2, par3, par4); + + if (var10 != null && var11 != null) + { + if (par1World.isBlockNormalCube(par2, par3 + 1, par4)) + { + return true; + } + else if (par1World.isRemote) + { + return true; + } + else + { + var10.setAssociatedChest(var11); + par5EntityPlayer.displayGUIChest(var10); + return true; + } + } + else + { + return true; + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityEnderChest(); + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + for (int var6 = 0; var6 < 3; ++var6) + { + double var10000 = (double)((float)par2 + par5Random.nextFloat()); + double var9 = (double)((float)par3 + par5Random.nextFloat()); + var10000 = (double)((float)par4 + par5Random.nextFloat()); + double var13 = 0.0D; + double var15 = 0.0D; + double var17 = 0.0D; + int var19 = par5Random.nextInt(2) * 2 - 1; + int var20 = par5Random.nextInt(2) * 2 - 1; + var13 = ((double)par5Random.nextFloat() - 0.5D) * 0.125D; + var15 = ((double)par5Random.nextFloat() - 0.5D) * 0.125D; + var17 = ((double)par5Random.nextFloat() - 0.5D) * 0.125D; + double var11 = (double)par4 + 0.5D + 0.25D * (double)var20; + var17 = (double)(par5Random.nextFloat() * 1.0F * (float)var20); + double var7 = (double)par2 + 0.5D + 0.25D * (double)var19; + var13 = (double)(par5Random.nextFloat() * 1.0F * (float)var19); + par1World.spawnParticle("portal", var7, var9, var11, var13, var15, var17); + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon("obsidian"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockEventData.java b/src/main/java/net/minecraft/src/BlockEventData.java new file mode 100644 index 0000000..5387489 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockEventData.java @@ -0,0 +1,91 @@ +package net.minecraft.src; + +public class BlockEventData +{ + private int coordX; + private int coordY; + private int coordZ; + private int blockID; + + /** Different for each blockID */ + private int eventID; + + /** Different for each blockID, eventID */ + private int eventParameter; + + public BlockEventData(int par1, int par2, int par3, int par4, int par5, int par6) + { + this.coordX = par1; + this.coordY = par2; + this.coordZ = par3; + this.eventID = par5; + this.eventParameter = par6; + this.blockID = par4; + } + + /** + * Get the X coordinate. + */ + public int getX() + { + return this.coordX; + } + + /** + * Get the Y coordinate. + */ + public int getY() + { + return this.coordY; + } + + /** + * Get the Z coordinate. + */ + public int getZ() + { + return this.coordZ; + } + + /** + * Get the Event ID (different for each BlockID) + */ + public int getEventID() + { + return this.eventID; + } + + /** + * Get the Event Parameter (different for each BlockID,EventID) + */ + public int getEventParameter() + { + return this.eventParameter; + } + + /** + * Gets the BlockID for this BlockEventData + */ + public int getBlockID() + { + return this.blockID; + } + + public boolean equals(Object par1Obj) + { + if (!(par1Obj instanceof BlockEventData)) + { + return false; + } + else + { + BlockEventData var2 = (BlockEventData)par1Obj; + return this.coordX == var2.coordX && this.coordY == var2.coordY && this.coordZ == var2.coordZ && this.eventID == var2.eventID && this.eventParameter == var2.eventParameter && this.blockID == var2.blockID; + } + } + + public String toString() + { + return "TE(" + this.coordX + "," + this.coordY + "," + this.coordZ + ")," + this.eventID + "," + this.eventParameter + "," + this.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockFarmland.java b/src/main/java/net/minecraft/src/BlockFarmland.java new file mode 100644 index 0000000..2cd54a8 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockFarmland.java @@ -0,0 +1,177 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockFarmland extends Block +{ + private Icon field_94441_a; + private Icon field_94440_b; + + protected BlockFarmland(int par1) + { + super(par1, Material.ground); + this.setTickRandomly(true); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F); + this.setLightOpacity(255); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return AxisAlignedBB.getAABBPool().getAABB((double)(par2 + 0), (double)(par3 + 0), (double)(par4 + 0), (double)(par2 + 1), (double)(par3 + 1), (double)(par4 + 1)); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? (par2 > 0 ? this.field_94441_a : this.field_94440_b) : Block.dirt.getBlockTextureFromSide(par1); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!this.isWaterNearby(par1World, par2, par3, par4) && !par1World.canLightningStrikeAt(par2, par3 + 1, par4)) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if (var6 > 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 - 1, 2); + } + else if (!this.isCropsNearby(par1World, par2, par3, par4)) + { + par1World.setBlock(par2, par3, par4, Block.dirt.blockID); + } + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 7, 2); + } + } + + /** + * Block's chance to react to an entity falling on it. + */ + public void onFallenUpon(World par1World, int par2, int par3, int par4, Entity par5Entity, float par6) + { + if (!par1World.isRemote && par1World.rand.nextFloat() < par6 - 0.5F) + { + if (!(par5Entity instanceof EntityPlayer) && !par1World.getGameRules().getGameRuleBooleanValue("mobGriefing")) + { + return; + } + + par1World.setBlock(par2, par3, par4, Block.dirt.blockID); + } + } + + /** + * returns true if there is at least one cropblock nearby (x-1 to x+1, y+1, z-1 to z+1) + */ + private boolean isCropsNearby(World par1World, int par2, int par3, int par4) + { + byte var5 = 0; + + for (int var6 = par2 - var5; var6 <= par2 + var5; ++var6) + { + for (int var7 = par4 - var5; var7 <= par4 + var5; ++var7) + { + int var8 = par1World.getBlockId(var6, par3 + 1, var7); + + if (var8 == Block.crops.blockID || var8 == Block.melonStem.blockID || var8 == Block.pumpkinStem.blockID || var8 == Block.potato.blockID || var8 == Block.carrot.blockID) + { + return true; + } + } + } + + return false; + } + + /** + * returns true if there's water nearby (x-4 to x+4, y to y+1, k-4 to k+4) + */ + private boolean isWaterNearby(World par1World, int par2, int par3, int par4) + { + for (int var5 = par2 - 4; var5 <= par2 + 4; ++var5) + { + for (int var6 = par3; var6 <= par3 + 1; ++var6) + { + for (int var7 = par4 - 4; var7 <= par4 + 4; ++var7) + { + if (par1World.getBlockMaterial(var5, var6, var7) == Material.water) + { + return true; + } + } + } + } + + return false; + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + super.onNeighborBlockChange(par1World, par2, par3, par4, par5); + Material var6 = par1World.getBlockMaterial(par2, par3 + 1, par4); + + if (var6.isSolid()) + { + par1World.setBlock(par2, par3, par4, Block.dirt.blockID); + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.dirt.idDropped(0, par2Random, par3); + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Block.dirt.blockID; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.field_94441_a = par1IconRegister.registerIcon(this.getTextureName() + "_wet"); + this.field_94440_b = par1IconRegister.registerIcon(this.getTextureName() + "_dry"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockFence.java b/src/main/java/net/minecraft/src/BlockFence.java new file mode 100644 index 0000000..9bb5740 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockFence.java @@ -0,0 +1,194 @@ +package net.minecraft.src; + +import java.util.List; + +public class BlockFence extends Block +{ + private final String field_94464_a; + + public BlockFence(int par1, String par2Str, Material par3Material) + { + super(par1, par3Material); + this.field_94464_a = par2Str; + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + boolean var8 = this.canConnectFenceTo(par1World, par2, par3, par4 - 1); + boolean var9 = this.canConnectFenceTo(par1World, par2, par3, par4 + 1); + boolean var10 = this.canConnectFenceTo(par1World, par2 - 1, par3, par4); + boolean var11 = this.canConnectFenceTo(par1World, par2 + 1, par3, par4); + float var12 = 0.375F; + float var13 = 0.625F; + float var14 = 0.375F; + float var15 = 0.625F; + + if (var8) + { + var14 = 0.0F; + } + + if (var9) + { + var15 = 1.0F; + } + + if (var8 || var9) + { + this.setBlockBounds(var12, 0.0F, var14, var13, 1.5F, var15); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + + var14 = 0.375F; + var15 = 0.625F; + + if (var10) + { + var12 = 0.0F; + } + + if (var11) + { + var13 = 1.0F; + } + + if (var10 || var11 || !var8 && !var9) + { + this.setBlockBounds(var12, 0.0F, var14, var13, 1.5F, var15); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + + if (var8) + { + var14 = 0.0F; + } + + if (var9) + { + var15 = 1.0F; + } + + this.setBlockBounds(var12, 0.0F, var14, var13, 1.0F, var15); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + boolean var5 = this.canConnectFenceTo(par1IBlockAccess, par2, par3, par4 - 1); + boolean var6 = this.canConnectFenceTo(par1IBlockAccess, par2, par3, par4 + 1); + boolean var7 = this.canConnectFenceTo(par1IBlockAccess, par2 - 1, par3, par4); + boolean var8 = this.canConnectFenceTo(par1IBlockAccess, par2 + 1, par3, par4); + float var9 = 0.375F; + float var10 = 0.625F; + float var11 = 0.375F; + float var12 = 0.625F; + + if (var5) + { + var11 = 0.0F; + } + + if (var6) + { + var12 = 1.0F; + } + + if (var7) + { + var9 = 0.0F; + } + + if (var8) + { + var10 = 1.0F; + } + + this.setBlockBounds(var9, 0.0F, var11, var10, 1.0F, var12); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 11; + } + + /** + * Returns true if the specified block can be connected by a fence + */ + public boolean canConnectFenceTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockId(par2, par3, par4); + + if (var5 != this.blockID && var5 != Block.fenceGate.blockID) + { + Block var6 = Block.blocksList[var5]; + return var6 != null && var6.blockMaterial.isOpaque() && var6.renderAsNormalBlock() ? var6.blockMaterial != Material.pumpkin : false; + } + else + { + return true; + } + } + + public static boolean isIdAFence(int par0) + { + return par0 == Block.fence.blockID || par0 == Block.netherFence.blockID; + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return true; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.field_94464_a); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + return par1World.isRemote ? true : ItemLeash.func_135066_a(par5EntityPlayer, par1World, par2, par3, par4); + } +} diff --git a/src/main/java/net/minecraft/src/BlockFenceGate.java b/src/main/java/net/minecraft/src/BlockFenceGate.java new file mode 100644 index 0000000..48a568f --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockFenceGate.java @@ -0,0 +1,170 @@ +package net.minecraft.src; + +public class BlockFenceGate extends BlockDirectional +{ + public BlockFenceGate(int par1) + { + super(par1, Material.wood); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return Block.planks.getBlockTextureFromSide(par1); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return !par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid() ? false : super.canPlaceBlockAt(par1World, par2, par3, par4); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + return isFenceGateOpen(var5) ? null : (var5 != 2 && var5 != 0 ? AxisAlignedBB.getAABBPool().getAABB((double)((float)par2 + 0.375F), (double)par3, (double)par4, (double)((float)par2 + 0.625F), (double)((float)par3 + 1.5F), (double)(par4 + 1)) : AxisAlignedBB.getAABBPool().getAABB((double)par2, (double)par3, (double)((float)par4 + 0.375F), (double)(par2 + 1), (double)((float)par3 + 1.5F), (double)((float)par4 + 0.625F))); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = getDirection(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + + if (var5 != 2 && var5 != 0) + { + this.setBlockBounds(0.375F, 0.0F, 0.0F, 0.625F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.375F, 1.0F, 1.0F, 0.625F); + } + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return isFenceGateOpen(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 21; + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = (MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) % 4; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 2); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + int var10 = par1World.getBlockMetadata(par2, par3, par4); + + if (isFenceGateOpen(var10)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var10 & -5, 2); + } + else + { + int var11 = (MathHelper.floor_double((double)(par5EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) % 4; + int var12 = getDirection(var10); + + if (var12 == (var11 + 2) % 4) + { + var10 = var11; + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, var10 | 4, 2); + } + + par1World.playAuxSFXAtEntity(par5EntityPlayer, 1003, par2, par3, par4, 0); + return true; + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isRemote) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + boolean var7 = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4); + + if (var7 || par5 > 0 && Block.blocksList[par5].canProvidePower()) + { + if (var7 && !isFenceGateOpen(var6)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 | 4, 2); + par1World.playAuxSFXAtEntity((EntityPlayer)null, 1003, par2, par3, par4, 0); + } + else if (!var7 && isFenceGateOpen(var6)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -5, 2); + par1World.playAuxSFXAtEntity((EntityPlayer)null, 1003, par2, par3, par4, 0); + } + } + } + } + + /** + * Returns if the fence gate is open according to its metadata. + */ + public static boolean isFenceGateOpen(int par0) + { + return (par0 & 4) != 0; + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return true; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) {} +} diff --git a/src/main/java/net/minecraft/src/BlockFire.java b/src/main/java/net/minecraft/src/BlockFire.java new file mode 100644 index 0000000..41ecc39 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockFire.java @@ -0,0 +1,455 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockFire extends Block +{ + /** The chance this block will encourage nearby blocks to catch on fire */ + private int[] chanceToEncourageFire = new int[256]; + + /** + * This is an array indexed by block ID the larger the number in the array the more likely a block type will catch + * fires + */ + private int[] abilityToCatchFire = new int[256]; + private Icon[] iconArray; + + protected BlockFire(int par1) + { + super(par1, Material.fire); + this.setTickRandomly(true); + } + + /** + * This method is called on a block after all other blocks gets already created. You can use it to reference and + * configure something on the block that needs the others ones. + */ + public void initializeBlock() + { + this.setBurnRate(Block.planks.blockID, 5, 20); + this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20); + this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20); + this.setBurnRate(Block.fence.blockID, 5, 20); + this.setBurnRate(Block.stairsWoodOak.blockID, 5, 20); + this.setBurnRate(Block.stairsWoodBirch.blockID, 5, 20); + this.setBurnRate(Block.stairsWoodSpruce.blockID, 5, 20); + this.setBurnRate(Block.stairsWoodJungle.blockID, 5, 20); + this.setBurnRate(Block.wood.blockID, 5, 5); + this.setBurnRate(Block.leaves.blockID, 30, 60); + this.setBurnRate(Block.bookShelf.blockID, 30, 20); + this.setBurnRate(Block.tnt.blockID, 15, 100); + this.setBurnRate(Block.tallGrass.blockID, 60, 100); + this.setBurnRate(Block.cloth.blockID, 30, 60); + this.setBurnRate(Block.vine.blockID, 15, 100); + this.setBurnRate(Block.coalBlock.blockID, 5, 5); + this.setBurnRate(Block.hay.blockID, 60, 20); + } + + /** + * Sets the burn rate for a block. The larger abilityToCatchFire the more easily it will catch. The larger + * chanceToEncourageFire the faster it will burn and spread to other blocks. Args: blockID, chanceToEncourageFire, + * abilityToCatchFire + */ + private void setBurnRate(int par1, int par2, int par3) + { + this.chanceToEncourageFire[par1] = par2; + this.abilityToCatchFire[par1] = par3; + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 3; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 30; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick")) + { + boolean var6 = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID; + + if (par1World.provider instanceof WorldProviderEnd && par1World.getBlockId(par2, par3 - 1, par4) == Block.bedrock.blockID) + { + var6 = true; + } + + if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) + { + par1World.setBlockToAir(par2, par3, par4); + } + + if (!var6 && par1World.isRaining() && (par1World.canLightningStrikeAt(par2, par3, par4) || par1World.canLightningStrikeAt(par2 - 1, par3, par4) || par1World.canLightningStrikeAt(par2 + 1, par3, par4) || par1World.canLightningStrikeAt(par2, par3, par4 - 1) || par1World.canLightningStrikeAt(par2, par3, par4 + 1))) + { + par1World.setBlockToAir(par2, par3, par4); + } + else + { + int var7 = par1World.getBlockMetadata(par2, par3, par4); + + if (var7 < 15) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7 + par5Random.nextInt(3) / 2, 4); + } + + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World) + par5Random.nextInt(10)); + + if (!var6 && !this.canNeighborBurn(par1World, par2, par3, par4)) + { + if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) || var7 > 3) + { + par1World.setBlockToAir(par2, par3, par4); + } + } + else if (!var6 && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4) && var7 == 15 && par5Random.nextInt(4) == 0) + { + par1World.setBlockToAir(par2, par3, par4); + } + else + { + boolean var8 = par1World.isBlockHighHumidity(par2, par3, par4); + byte var9 = 0; + + if (var8) + { + var9 = -50; + } + + this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7); + this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7); + this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7); + this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7); + this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7); + this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + var9, par5Random, var7); + + for (int var10 = par2 - 1; var10 <= par2 + 1; ++var10) + { + for (int var11 = par4 - 1; var11 <= par4 + 1; ++var11) + { + for (int var12 = par3 - 1; var12 <= par3 + 4; ++var12) + { + if (var10 != par2 || var12 != par3 || var11 != par4) + { + int var13 = 100; + + if (var12 > par3 + 1) + { + var13 += (var12 - (par3 + 1)) * 100; + } + + int var14 = this.getChanceOfNeighborsEncouragingFire(par1World, var10, var12, var11); + + if (var14 > 0) + { + int var15 = (var14 + 40 + par1World.difficultySetting * 7) / (var7 + 30); + + if (var8) + { + var15 /= 2; + } + + if (var15 > 0 && par5Random.nextInt(var13) <= var15 && (!par1World.isRaining() || !par1World.canLightningStrikeAt(var10, var12, var11)) && !par1World.canLightningStrikeAt(var10 - 1, var12, par4) && !par1World.canLightningStrikeAt(var10 + 1, var12, var11) && !par1World.canLightningStrikeAt(var10, var12, var11 - 1) && !par1World.canLightningStrikeAt(var10, var12, var11 + 1)) + { + int var16 = var7 + par5Random.nextInt(5) / 4; + + if (var16 > 15) + { + var16 = 15; + } + + par1World.setBlock(var10, var12, var11, this.blockID, var16, 3); + } + } + } + } + } + } + } + } + } + } + + public boolean func_82506_l() + { + return false; + } + + private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7) + { + int var8 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)]; + + if (par6Random.nextInt(par5) < var8) + { + boolean var9 = par1World.getBlockId(par2, par3, par4) == Block.tnt.blockID; + + if (par6Random.nextInt(par7 + 10) < 5 && !par1World.canLightningStrikeAt(par2, par3, par4)) + { + int var10 = par7 + par6Random.nextInt(5) / 4; + + if (var10 > 15) + { + var10 = 15; + } + + par1World.setBlock(par2, par3, par4, this.blockID, var10, 3); + } + else + { + par1World.setBlockToAir(par2, par3, par4); + } + + if (var9) + { + Block.tnt.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1); + } + } + } + + /** + * Returns true if at least one block next to this one can burn. + */ + private boolean canNeighborBurn(World par1World, int par2, int par3, int par4) + { + return this.canBlockCatchFire(par1World, par2 + 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2 - 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 - 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 + 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3, par4 - 1) ? true : this.canBlockCatchFire(par1World, par2, par3, par4 + 1))))); + } + + /** + * Gets the highest chance of a neighbor block encouraging this block to catch fire + */ + private int getChanceOfNeighborsEncouragingFire(World par1World, int par2, int par3, int par4) + { + byte var5 = 0; + + if (!par1World.isAirBlock(par2, par3, par4)) + { + return 0; + } + else + { + int var6 = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, var5); + var6 = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, var6); + var6 = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, var6); + var6 = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, var6); + var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6); + var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6); + return var6; + } + } + + /** + * Returns if this block is collidable (only used by Fire). Args: x, y, z + */ + public boolean isCollidable() + { + return false; + } + + /** + * Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z + */ + public boolean canBlockCatchFire(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return this.chanceToEncourageFire[par1IBlockAccess.getBlockId(par2, par3, par4)] > 0; + } + + /** + * Retrieves a specified block's chance to encourage their neighbors to burn and if the number is greater than the + * current number passed in it will return its number instead of the passed in one. Args: world, x, y, z, + * curChanceToEncourageFire + */ + public int getChanceToEncourageFire(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = this.chanceToEncourageFire[par1World.getBlockId(par2, par3, par4)]; + return var6 > par5 ? var6 : par5; + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) || this.canNeighborBurn(par1World, par2, par3, par4); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !this.canNeighborBurn(par1World, par2, par3, par4)) + { + par1World.setBlockToAir(par2, par3, par4); + } + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + if (par1World.provider.dimensionId > 0 || par1World.getBlockId(par2, par3 - 1, par4) != Block.obsidian.blockID || !Block.portal.tryToCreatePortal(par1World, par2, par3, par4)) + { + if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !this.canNeighborBurn(par1World, par2, par3, par4)) + { + par1World.setBlockToAir(par2, par3, par4); + } + else + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World) + par1World.rand.nextInt(10)); + } + } + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (par5Random.nextInt(24) == 0) + { + par1World.playSound((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), "fire.fire", 1.0F + par5Random.nextFloat(), par5Random.nextFloat() * 0.7F + 0.3F, false); + } + + int var6; + float var7; + float var8; + float var9; + + if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4)) + { + if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4)) + { + for (var6 = 0; var6 < 2; ++var6) + { + var7 = (float)par2 + par5Random.nextFloat() * 0.1F; + var8 = (float)par3 + par5Random.nextFloat(); + var9 = (float)par4 + par5Random.nextFloat(); + par1World.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + + if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4)) + { + for (var6 = 0; var6 < 2; ++var6) + { + var7 = (float)(par2 + 1) - par5Random.nextFloat() * 0.1F; + var8 = (float)par3 + par5Random.nextFloat(); + var9 = (float)par4 + par5Random.nextFloat(); + par1World.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + + if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1)) + { + for (var6 = 0; var6 < 2; ++var6) + { + var7 = (float)par2 + par5Random.nextFloat(); + var8 = (float)par3 + par5Random.nextFloat(); + var9 = (float)par4 + par5Random.nextFloat() * 0.1F; + par1World.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + + if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1)) + { + for (var6 = 0; var6 < 2; ++var6) + { + var7 = (float)par2 + par5Random.nextFloat(); + var8 = (float)par3 + par5Random.nextFloat(); + var9 = (float)(par4 + 1) - par5Random.nextFloat() * 0.1F; + par1World.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + + if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4)) + { + for (var6 = 0; var6 < 2; ++var6) + { + var7 = (float)par2 + par5Random.nextFloat(); + var8 = (float)(par3 + 1) - par5Random.nextFloat() * 0.1F; + var9 = (float)par4 + par5Random.nextFloat(); + par1World.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + } + else + { + for (var6 = 0; var6 < 3; ++var6) + { + var7 = (float)par2 + par5Random.nextFloat(); + var8 = (float)par3 + par5Random.nextFloat() * 0.5F + 0.5F; + var9 = (float)par4 + par5Random.nextFloat(); + par1World.spawnParticle("largesmoke", (double)var7, (double)var8, (double)var9, 0.0D, 0.0D, 0.0D); + } + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[] {par1IconRegister.registerIcon(this.getTextureName() + "_layer_0"), par1IconRegister.registerIcon(this.getTextureName() + "_layer_1")}; + } + + public Icon getFireIcon(int par1) + { + return this.iconArray[par1]; + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return this.iconArray[0]; + } +} diff --git a/src/main/java/net/minecraft/src/BlockFlower.java b/src/main/java/net/minecraft/src/BlockFlower.java new file mode 100644 index 0000000..9647c3a --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockFlower.java @@ -0,0 +1,106 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockFlower extends Block +{ + protected BlockFlower(int par1, Material par2Material) + { + super(par1, par2Material); + this.setTickRandomly(true); + float var3 = 0.2F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var3 * 3.0F, 0.5F + var3); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + protected BlockFlower(int par1) + { + this(par1, Material.plants); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return super.canPlaceBlockAt(par1World, par2, par3, par4) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4)); + } + + /** + * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of + * blockID passed in. Args: blockID + */ + protected boolean canThisPlantGrowOnThisBlockID(int par1) + { + return par1 == Block.grass.blockID || par1 == Block.dirt.blockID || par1 == Block.tilledField.blockID; + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + super.onNeighborBlockChange(par1World, par2, par3, par4, par5); + this.checkFlowerChange(par1World, par2, par3, par4); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + this.checkFlowerChange(par1World, par2, par3, par4); + } + + protected final void checkFlowerChange(World par1World, int par2, int par3, int par4) + { + if (!this.canBlockStay(par1World, par2, par3, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlock(par2, par3, par4, 0, 0, 2); + } + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) + { + return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4)); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 1; + } +} diff --git a/src/main/java/net/minecraft/src/BlockFlowerPot.java b/src/main/java/net/minecraft/src/BlockFlowerPot.java new file mode 100644 index 0000000..1e05f71 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockFlowerPot.java @@ -0,0 +1,266 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockFlowerPot extends Block +{ + public BlockFlowerPot(int par1) + { + super(par1, Material.circuits); + this.setBlockBoundsForItemRender(); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float var1 = 0.375F; + float var2 = var1 / 2.0F; + this.setBlockBounds(0.5F - var2, 0.0F, 0.5F - var2, 0.5F + var2, var1, 0.5F + var2); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 33; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + ItemStack var10 = par5EntityPlayer.inventory.getCurrentItem(); + + if (var10 == null) + { + return false; + } + else if (par1World.getBlockMetadata(par2, par3, par4) != 0) + { + return false; + } + else + { + int var11 = getMetaForPlant(var10); + + if (var11 > 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var11, 2); + + if (!par5EntityPlayer.capabilities.isCreativeMode && --var10.stackSize <= 0) + { + par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, (ItemStack)null); + } + + return true; + } + else + { + return false; + } + } + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + ItemStack var5 = getPlantForMeta(par1World.getBlockMetadata(par2, par3, par4)); + return var5 == null ? Item.flowerPot.itemID : var5.itemID; + } + + /** + * Get the block's damage value (for use with pick block). + */ + public int getDamageValue(World par1World, int par2, int par3, int par4) + { + ItemStack var5 = getPlantForMeta(par1World.getBlockMetadata(par2, par3, par4)); + return var5 == null ? Item.flowerPot.itemID : var5.getItemDamage(); + } + + /** + * Returns true only if block is flowerPot + */ + public boolean isFlowerPot() + { + return true; + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return super.canPlaceBlockAt(par1World, par2, par3, par4) && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); + + if (par5 > 0) + { + ItemStack var8 = getPlantForMeta(par5); + + if (var8 != null) + { + this.dropBlockAsItem_do(par1World, par2, par3, par4, var8); + } + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.flowerPot.itemID; + } + + /** + * Return the item associated with the specified flower pot metadata value. + */ + public static ItemStack getPlantForMeta(int par0) + { + switch (par0) + { + case 1: + return new ItemStack(Block.plantRed); + + case 2: + return new ItemStack(Block.plantYellow); + + case 3: + return new ItemStack(Block.sapling, 1, 0); + + case 4: + return new ItemStack(Block.sapling, 1, 1); + + case 5: + return new ItemStack(Block.sapling, 1, 2); + + case 6: + return new ItemStack(Block.sapling, 1, 3); + + case 7: + return new ItemStack(Block.mushroomRed); + + case 8: + return new ItemStack(Block.mushroomBrown); + + case 9: + return new ItemStack(Block.cactus); + + case 10: + return new ItemStack(Block.deadBush); + + case 11: + return new ItemStack(Block.tallGrass, 1, 2); + + default: + return null; + } + } + + /** + * Return the flower pot metadata value associated with the specified item. + */ + public static int getMetaForPlant(ItemStack par0ItemStack) + { + int var1 = par0ItemStack.getItem().itemID; + + if (var1 == Block.plantRed.blockID) + { + return 1; + } + else if (var1 == Block.plantYellow.blockID) + { + return 2; + } + else if (var1 == Block.cactus.blockID) + { + return 9; + } + else if (var1 == Block.mushroomBrown.blockID) + { + return 8; + } + else if (var1 == Block.mushroomRed.blockID) + { + return 7; + } + else if (var1 == Block.deadBush.blockID) + { + return 10; + } + else + { + if (var1 == Block.sapling.blockID) + { + switch (par0ItemStack.getItemDamage()) + { + case 0: + return 3; + + case 1: + return 4; + + case 2: + return 5; + + case 3: + return 6; + } + } + + if (var1 == Block.tallGrass.blockID) + { + switch (par0ItemStack.getItemDamage()) + { + case 2: + return 11; + } + } + + return 0; + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockFlowing.java b/src/main/java/net/minecraft/src/BlockFlowing.java new file mode 100644 index 0000000..712670a --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockFlowing.java @@ -0,0 +1,423 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockFlowing extends BlockFluid +{ + /** + * Number of horizontally adjacent liquid source blocks. Diagonal doesn't count. Only source blocks of the same + * liquid as the block using the field are counted. + */ + int numAdjacentSources; + + /** + * Indicates whether the flow direction is optimal. Each array index corresponds to one of the four cardinal + * directions. + */ + boolean[] isOptimalFlowDirection = new boolean[4]; + + /** + * The estimated cost to flow in a given direction from the current point. Each array index corresponds to one of + * the four cardinal directions. + */ + int[] flowCost = new int[4]; + + protected BlockFlowing(int par1, Material par2Material) + { + super(par1, par2Material); + } + + /** + * Updates the flow for the BlockFlowing object. + */ + private void updateFlow(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + par1World.setBlock(par2, par3, par4, this.blockID + 1, var5, 2); + } + + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return this.blockMaterial != Material.lava; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + int var6 = this.getFlowDecay(par1World, par2, par3, par4); + byte var7 = 1; + + if (this.blockMaterial == Material.lava && !par1World.provider.isHellWorld) + { + var7 = 2; + } + + boolean var8 = true; + int var9 = this.tickRate(par1World); + int var11; + + if (var6 > 0) + { + byte var10 = -100; + this.numAdjacentSources = 0; + int var13 = this.getSmallestFlowDecay(par1World, par2 - 1, par3, par4, var10); + var13 = this.getSmallestFlowDecay(par1World, par2 + 1, par3, par4, var13); + var13 = this.getSmallestFlowDecay(par1World, par2, par3, par4 - 1, var13); + var13 = this.getSmallestFlowDecay(par1World, par2, par3, par4 + 1, var13); + var11 = var13 + var7; + + if (var11 >= 8 || var13 < 0) + { + var11 = -1; + } + + if (this.getFlowDecay(par1World, par2, par3 + 1, par4) >= 0) + { + int var12 = this.getFlowDecay(par1World, par2, par3 + 1, par4); + + if (var12 >= 8) + { + var11 = var12; + } + else + { + var11 = var12 + 8; + } + } + + if (this.numAdjacentSources >= 2 && this.blockMaterial == Material.water) + { + if (par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid()) + { + var11 = 0; + } + else if (par1World.getBlockMaterial(par2, par3 - 1, par4) == this.blockMaterial && par1World.getBlockMetadata(par2, par3 - 1, par4) == 0) + { + var11 = 0; + } + } + + if (this.blockMaterial == Material.lava && var6 < 8 && var11 < 8 && var11 > var6 && par5Random.nextInt(4) != 0) + { + var9 *= 4; + } + + if (var11 == var6) + { + if (var8) + { + this.updateFlow(par1World, par2, par3, par4); + } + } + else + { + var6 = var11; + + if (var11 < 0) + { + par1World.setBlockToAir(par2, par3, par4); + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var11, 2); + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, var9); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); + } + } + } + else + { + this.updateFlow(par1World, par2, par3, par4); + } + + if (this.liquidCanDisplaceBlock(par1World, par2, par3 - 1, par4)) + { + if (this.blockMaterial == Material.lava && par1World.getBlockMaterial(par2, par3 - 1, par4) == Material.water) + { + par1World.setBlock(par2, par3 - 1, par4, Block.stone.blockID); + this.triggerLavaMixEffects(par1World, par2, par3 - 1, par4); + return; + } + + if (var6 >= 8) + { + this.flowIntoBlock(par1World, par2, par3 - 1, par4, var6); + } + else + { + this.flowIntoBlock(par1World, par2, par3 - 1, par4, var6 + 8); + } + } + else if (var6 >= 0 && (var6 == 0 || this.blockBlocksFlow(par1World, par2, par3 - 1, par4))) + { + boolean[] var14 = this.getOptimalFlowDirections(par1World, par2, par3, par4); + var11 = var6 + var7; + + if (var6 >= 8) + { + var11 = 1; + } + + if (var11 >= 8) + { + return; + } + + if (var14[0]) + { + this.flowIntoBlock(par1World, par2 - 1, par3, par4, var11); + } + + if (var14[1]) + { + this.flowIntoBlock(par1World, par2 + 1, par3, par4, var11); + } + + if (var14[2]) + { + this.flowIntoBlock(par1World, par2, par3, par4 - 1, var11); + } + + if (var14[3]) + { + this.flowIntoBlock(par1World, par2, par3, par4 + 1, var11); + } + } + } + + /** + * flowIntoBlock(World world, int x, int y, int z, int newFlowDecay) - Flows into the block at the coordinates and + * changes the block type to the liquid. + */ + private void flowIntoBlock(World par1World, int par2, int par3, int par4, int par5) + { + if (this.liquidCanDisplaceBlock(par1World, par2, par3, par4)) + { + int var6 = par1World.getBlockId(par2, par3, par4); + + if (var6 > 0) + { + if (this.blockMaterial == Material.lava) + { + this.triggerLavaMixEffects(par1World, par2, par3, par4); + } + else + { + Block.blocksList[var6].dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + } + } + + par1World.setBlock(par2, par3, par4, this.blockID, par5, 3); + } + } + + /** + * calculateFlowCost(World world, int x, int y, int z, int accumulatedCost, int previousDirectionOfFlow) - Used to + * determine the path of least resistance, this method returns the lowest possible flow cost for the direction of + * flow indicated. Each necessary horizontal flow adds to the flow cost. + */ + private int calculateFlowCost(World par1World, int par2, int par3, int par4, int par5, int par6) + { + int var7 = 1000; + + for (int var8 = 0; var8 < 4; ++var8) + { + if ((var8 != 0 || par6 != 1) && (var8 != 1 || par6 != 0) && (var8 != 2 || par6 != 3) && (var8 != 3 || par6 != 2)) + { + int var9 = par2; + int var11 = par4; + + if (var8 == 0) + { + var9 = par2 - 1; + } + + if (var8 == 1) + { + ++var9; + } + + if (var8 == 2) + { + var11 = par4 - 1; + } + + if (var8 == 3) + { + ++var11; + } + + if (!this.blockBlocksFlow(par1World, var9, par3, var11) && (par1World.getBlockMaterial(var9, par3, var11) != this.blockMaterial || par1World.getBlockMetadata(var9, par3, var11) != 0)) + { + if (!this.blockBlocksFlow(par1World, var9, par3 - 1, var11)) + { + return par5; + } + + if (par5 < 4) + { + int var12 = this.calculateFlowCost(par1World, var9, par3, var11, par5 + 1, var8); + + if (var12 < var7) + { + var7 = var12; + } + } + } + } + } + + return var7; + } + + /** + * Returns a boolean array indicating which flow directions are optimal based on each direction's calculated flow + * cost. Each array index corresponds to one of the four cardinal directions. A value of true indicates the + * direction is optimal. + */ + private boolean[] getOptimalFlowDirections(World par1World, int par2, int par3, int par4) + { + int var5; + int var6; + + for (var5 = 0; var5 < 4; ++var5) + { + this.flowCost[var5] = 1000; + var6 = par2; + int var8 = par4; + + if (var5 == 0) + { + var6 = par2 - 1; + } + + if (var5 == 1) + { + ++var6; + } + + if (var5 == 2) + { + var8 = par4 - 1; + } + + if (var5 == 3) + { + ++var8; + } + + if (!this.blockBlocksFlow(par1World, var6, par3, var8) && (par1World.getBlockMaterial(var6, par3, var8) != this.blockMaterial || par1World.getBlockMetadata(var6, par3, var8) != 0)) + { + if (this.blockBlocksFlow(par1World, var6, par3 - 1, var8)) + { + this.flowCost[var5] = this.calculateFlowCost(par1World, var6, par3, var8, 1, var5); + } + else + { + this.flowCost[var5] = 0; + } + } + } + + var5 = this.flowCost[0]; + + for (var6 = 1; var6 < 4; ++var6) + { + if (this.flowCost[var6] < var5) + { + var5 = this.flowCost[var6]; + } + } + + for (var6 = 0; var6 < 4; ++var6) + { + this.isOptimalFlowDirection[var6] = this.flowCost[var6] == var5; + } + + return this.isOptimalFlowDirection; + } + + /** + * Returns true if block at coords blocks fluids + */ + private boolean blockBlocksFlow(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockId(par2, par3, par4); + + if (var5 != Block.doorWood.blockID && var5 != Block.doorIron.blockID && var5 != Block.signPost.blockID && var5 != Block.ladder.blockID && var5 != Block.reed.blockID) + { + if (var5 == 0) + { + return false; + } + else + { + Material var6 = Block.blocksList[var5].blockMaterial; + return var6 == Material.portal ? true : var6.blocksMovement(); + } + } + else + { + return true; + } + } + + /** + * getSmallestFlowDecay(World world, intx, int y, int z, int currentSmallestFlowDecay) - Looks up the flow decay at + * the coordinates given and returns the smaller of this value or the provided currentSmallestFlowDecay. If one + * value is valid and the other isn't, the valid value will be returned. Valid values are >= 0. Flow decay is the + * amount that a liquid has dissipated. 0 indicates a source block. + */ + protected int getSmallestFlowDecay(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = this.getFlowDecay(par1World, par2, par3, par4); + + if (var6 < 0) + { + return par5; + } + else + { + if (var6 == 0) + { + ++this.numAdjacentSources; + } + + if (var6 >= 8) + { + var6 = 0; + } + + return par5 >= 0 && var6 >= par5 ? par5 : var6; + } + } + + /** + * Returns true if the block at the coordinates can be displaced by the liquid. + */ + private boolean liquidCanDisplaceBlock(World par1World, int par2, int par3, int par4) + { + Material var5 = par1World.getBlockMaterial(par2, par3, par4); + return var5 == this.blockMaterial ? false : (var5 == Material.lava ? false : !this.blockBlocksFlow(par1World, par2, par3, par4)); + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + + if (par1World.getBlockId(par2, par3, par4) == this.blockID) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + } + } + + public boolean func_82506_l() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/BlockFluid.java b/src/main/java/net/minecraft/src/BlockFluid.java new file mode 100644 index 0000000..fadc3b3 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockFluid.java @@ -0,0 +1,625 @@ +package net.minecraft.src; + +import java.util.Random; + +public abstract class BlockFluid extends Block +{ + private Icon[] theIcon; + + protected BlockFluid(int par1, Material par2Material) + { + super(par1, par2Material); + float var3 = 0.0F; + float var4 = 0.0F; + this.setBlockBounds(0.0F + var4, 0.0F + var3, 0.0F + var4, 1.0F + var4, 1.0F + var3, 1.0F + var4); + this.setTickRandomly(true); + } + + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return this.blockMaterial != Material.lava; + } + + public int getBlockColor() + { + return 16777215; + } + + /** + * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called + * when first determining what to render. + */ + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + if (this.blockMaterial != Material.water) + { + return 16777215; + } + else + { + int var5 = 0; + int var6 = 0; + int var7 = 0; + + for (int var8 = -1; var8 <= 1; ++var8) + { + for (int var9 = -1; var9 <= 1; ++var9) + { + int var10 = par1IBlockAccess.getBiomeGenForCoords(par2 + var9, par4 + var8).waterColorMultiplier; + var5 += (var10 & 16711680) >> 16; + var6 += (var10 & 65280) >> 8; + var7 += var10 & 255; + } + } + + return (var5 / 9 & 255) << 16 | (var6 / 9 & 255) << 8 | var7 / 9 & 255; + } + } + + /** + * Returns the percentage of the fluid block that is air, based on the given flow decay of the fluid. + */ + public static float getFluidHeightPercent(int par0) + { + if (par0 >= 8) + { + par0 = 0; + } + + return (float)(par0 + 1) / 9.0F; + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 != 0 && par1 != 1 ? this.theIcon[1] : this.theIcon[0]; + } + + /** + * Returns the amount of fluid decay at the coordinates, or -1 if the block at the coordinates is not the same + * material as the fluid. + */ + protected int getFlowDecay(World par1World, int par2, int par3, int par4) + { + return par1World.getBlockMaterial(par2, par3, par4) == this.blockMaterial ? par1World.getBlockMetadata(par2, par3, par4) : -1; + } + + /** + * Returns the flow decay but converts values indicating falling liquid (values >=8) to their effective source block + * value of zero. + */ + protected int getEffectiveFlowDecay(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + if (par1IBlockAccess.getBlockMaterial(par2, par3, par4) != this.blockMaterial) + { + return -1; + } + else + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + + if (var5 >= 8) + { + var5 = 0; + } + + return var5; + } + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Returns whether this block is collideable based on the arguments passed in \n@param par1 block metaData \n@param + * par2 whether the player right-clicked while holding a boat + */ + public boolean canCollideCheck(int par1, boolean par2) + { + return par2 && par1 == 0; + } + + /** + * Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the + * adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side + */ + public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + Material var6 = par1IBlockAccess.getBlockMaterial(par2, par3, par4); + return var6 == this.blockMaterial ? false : (par5 == 1 ? true : (var6 == Material.ice ? false : super.isBlockSolid(par1IBlockAccess, par2, par3, par4, par5))); + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + Material var6 = par1IBlockAccess.getBlockMaterial(par2, par3, par4); + return var6 == this.blockMaterial ? false : (par5 == 1 ? true : (var6 == Material.ice ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5))); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 4; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return 0; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * Returns a vector indicating the direction and intensity of fluid flow. + */ + private Vec3 getFlowVector(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + Vec3 var5 = par1IBlockAccess.getWorldVec3Pool().getVecFromPool(0.0D, 0.0D, 0.0D); + int var6 = this.getEffectiveFlowDecay(par1IBlockAccess, par2, par3, par4); + + for (int var7 = 0; var7 < 4; ++var7) + { + int var8 = par2; + int var10 = par4; + + if (var7 == 0) + { + var8 = par2 - 1; + } + + if (var7 == 1) + { + var10 = par4 - 1; + } + + if (var7 == 2) + { + ++var8; + } + + if (var7 == 3) + { + ++var10; + } + + int var11 = this.getEffectiveFlowDecay(par1IBlockAccess, var8, par3, var10); + int var12; + + if (var11 < 0) + { + if (!par1IBlockAccess.getBlockMaterial(var8, par3, var10).blocksMovement()) + { + var11 = this.getEffectiveFlowDecay(par1IBlockAccess, var8, par3 - 1, var10); + + if (var11 >= 0) + { + var12 = var11 - (var6 - 8); + var5 = var5.addVector((double)((var8 - par2) * var12), (double)((par3 - par3) * var12), (double)((var10 - par4) * var12)); + } + } + } + else if (var11 >= 0) + { + var12 = var11 - var6; + var5 = var5.addVector((double)((var8 - par2) * var12), (double)((par3 - par3) * var12), (double)((var10 - par4) * var12)); + } + } + + if (par1IBlockAccess.getBlockMetadata(par2, par3, par4) >= 8) + { + boolean var13 = false; + + if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3, par4 - 1, 2)) + { + var13 = true; + } + + if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3, par4 + 1, 3)) + { + var13 = true; + } + + if (var13 || this.isBlockSolid(par1IBlockAccess, par2 - 1, par3, par4, 4)) + { + var13 = true; + } + + if (var13 || this.isBlockSolid(par1IBlockAccess, par2 + 1, par3, par4, 5)) + { + var13 = true; + } + + if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3 + 1, par4 - 1, 2)) + { + var13 = true; + } + + if (var13 || this.isBlockSolid(par1IBlockAccess, par2, par3 + 1, par4 + 1, 3)) + { + var13 = true; + } + + if (var13 || this.isBlockSolid(par1IBlockAccess, par2 - 1, par3 + 1, par4, 4)) + { + var13 = true; + } + + if (var13 || this.isBlockSolid(par1IBlockAccess, par2 + 1, par3 + 1, par4, 5)) + { + var13 = true; + } + + if (var13) + { + var5 = var5.normalize().addVector(0.0D, -6.0D, 0.0D); + } + } + + var5 = var5.normalize(); + return var5; + } + + /** + * Can add to the passed in vector for a movement vector to be applied to the entity. Args: x, y, z, entity, vec3d + */ + public void velocityToAddToEntity(World par1World, int par2, int par3, int par4, Entity par5Entity, Vec3 par6Vec3) + { + Vec3 var7 = this.getFlowVector(par1World, par2, par3, par4); + par6Vec3.xCoord += var7.xCoord; + par6Vec3.yCoord += var7.yCoord; + par6Vec3.zCoord += var7.zCoord; + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return this.blockMaterial == Material.water ? 5 : (this.blockMaterial == Material.lava ? (par1World.provider.hasNoSky ? 10 : 30) : 0); + } + + /** + * Goes straight to getLightBrightnessForSkyBlocks for Blocks, does some fancy computing for Fluids + */ + public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, 0); + int var6 = par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3 + 1, par4, 0); + int var7 = var5 & 255; + int var8 = var6 & 255; + int var9 = var5 >> 16 & 255; + int var10 = var6 >> 16 & 255; + return (var7 > var8 ? var7 : var8) | (var9 > var10 ? var9 : var10) << 16; + } + + /** + * How bright to render this block based on the light its receiving. Args: iBlockAccess, x, y, z + */ + public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + float var5 = par1IBlockAccess.getLightBrightness(par2, par3, par4); + float var6 = par1IBlockAccess.getLightBrightness(par2, par3 + 1, par4); + return var5 > var6 ? var5 : var6; + } + + /** + * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha + */ + public int getRenderBlockPass() + { + return this.blockMaterial == Material.water ? 1 : 0; + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + int var6; + + if (this.blockMaterial == Material.water) + { + if (par5Random.nextInt(10) == 0) + { + var6 = par1World.getBlockMetadata(par2, par3, par4); + + if (var6 <= 0 || var6 >= 8) + { + par1World.spawnParticle("suspended", (double)((float)par2 + par5Random.nextFloat()), (double)((float)par3 + par5Random.nextFloat()), (double)((float)par4 + par5Random.nextFloat()), 0.0D, 0.0D, 0.0D); + } + } + + for (var6 = 0; var6 < 0; ++var6) + { + int var7 = par5Random.nextInt(4); + int var8 = par2; + int var9 = par4; + + if (var7 == 0) + { + var8 = par2 - 1; + } + + if (var7 == 1) + { + ++var8; + } + + if (var7 == 2) + { + var9 = par4 - 1; + } + + if (var7 == 3) + { + ++var9; + } + + if (par1World.getBlockMaterial(var8, par3, var9) == Material.air && (par1World.getBlockMaterial(var8, par3 - 1, var9).blocksMovement() || par1World.getBlockMaterial(var8, par3 - 1, var9).isLiquid())) + { + float var10 = 0.0625F; + double var11 = (double)((float)par2 + par5Random.nextFloat()); + double var13 = (double)((float)par3 + par5Random.nextFloat()); + double var15 = (double)((float)par4 + par5Random.nextFloat()); + + if (var7 == 0) + { + var11 = (double)((float)par2 - var10); + } + + if (var7 == 1) + { + var11 = (double)((float)(par2 + 1) + var10); + } + + if (var7 == 2) + { + var15 = (double)((float)par4 - var10); + } + + if (var7 == 3) + { + var15 = (double)((float)(par4 + 1) + var10); + } + + double var17 = 0.0D; + double var19 = 0.0D; + + if (var7 == 0) + { + var17 = (double)(-var10); + } + + if (var7 == 1) + { + var17 = (double)var10; + } + + if (var7 == 2) + { + var19 = (double)(-var10); + } + + if (var7 == 3) + { + var19 = (double)var10; + } + + par1World.spawnParticle("splash", var11, var13, var15, var17, 0.0D, var19); + } + } + } + + if (this.blockMaterial == Material.water && par5Random.nextInt(64) == 0) + { + var6 = par1World.getBlockMetadata(par2, par3, par4); + + if (var6 > 0 && var6 < 8) + { + par1World.playSound((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), "liquid.water", par5Random.nextFloat() * 0.25F + 0.75F, par5Random.nextFloat() * 1.0F + 0.5F, false); + } + } + + double var21; + double var22; + double var23; + + if (this.blockMaterial == Material.lava && par1World.getBlockMaterial(par2, par3 + 1, par4) == Material.air && !par1World.isBlockOpaqueCube(par2, par3 + 1, par4)) + { + if (par5Random.nextInt(100) == 0) + { + var21 = (double)((float)par2 + par5Random.nextFloat()); + var22 = (double)par3 + this.maxY; + var23 = (double)((float)par4 + par5Random.nextFloat()); + par1World.spawnParticle("lava", var21, var22, var23, 0.0D, 0.0D, 0.0D); + par1World.playSound(var21, var22, var23, "liquid.lavapop", 0.2F + par5Random.nextFloat() * 0.2F, 0.9F + par5Random.nextFloat() * 0.15F, false); + } + + if (par5Random.nextInt(200) == 0) + { + par1World.playSound((double)par2, (double)par3, (double)par4, "liquid.lava", 0.2F + par5Random.nextFloat() * 0.2F, 0.9F + par5Random.nextFloat() * 0.15F, false); + } + } + + if (par5Random.nextInt(10) == 0 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !par1World.getBlockMaterial(par2, par3 - 2, par4).blocksMovement()) + { + var21 = (double)((float)par2 + par5Random.nextFloat()); + var22 = (double)par3 - 1.05D; + var23 = (double)((float)par4 + par5Random.nextFloat()); + + if (this.blockMaterial == Material.water) + { + par1World.spawnParticle("dripWater", var21, var22, var23, 0.0D, 0.0D, 0.0D); + } + else + { + par1World.spawnParticle("dripLava", var21, var22, var23, 0.0D, 0.0D, 0.0D); + } + } + } + + /** + * the sin and cos of this number determine the surface gradient of the flowing block. + */ + public static double getFlowDirection(IBlockAccess par0IBlockAccess, int par1, int par2, int par3, Material par4Material) + { + Vec3 var5 = null; + + if (par4Material == Material.water) + { + var5 = Block.waterMoving.getFlowVector(par0IBlockAccess, par1, par2, par3); + } + + if (par4Material == Material.lava) + { + var5 = Block.lavaMoving.getFlowVector(par0IBlockAccess, par1, par2, par3); + } + + return var5.xCoord == 0.0D && var5.zCoord == 0.0D ? -1000.0D : Math.atan2(var5.zCoord, var5.xCoord) - (Math.PI / 2D); + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + this.checkForHarden(par1World, par2, par3, par4); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + this.checkForHarden(par1World, par2, par3, par4); + } + + /** + * Forces lava to check to see if it is colliding with water, and then decide what it should harden to. + */ + private void checkForHarden(World par1World, int par2, int par3, int par4) + { + if (par1World.getBlockId(par2, par3, par4) == this.blockID) + { + if (this.blockMaterial == Material.lava) + { + boolean var5 = false; + + if (var5 || par1World.getBlockMaterial(par2, par3, par4 - 1) == Material.water) + { + var5 = true; + } + + if (var5 || par1World.getBlockMaterial(par2, par3, par4 + 1) == Material.water) + { + var5 = true; + } + + if (var5 || par1World.getBlockMaterial(par2 - 1, par3, par4) == Material.water) + { + var5 = true; + } + + if (var5 || par1World.getBlockMaterial(par2 + 1, par3, par4) == Material.water) + { + var5 = true; + } + + if (var5 || par1World.getBlockMaterial(par2, par3 + 1, par4) == Material.water) + { + var5 = true; + } + + if (var5) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if (var6 == 0) + { + par1World.setBlock(par2, par3, par4, Block.obsidian.blockID); + } + else if (var6 <= 4) + { + par1World.setBlock(par2, par3, par4, Block.cobblestone.blockID); + } + + this.triggerLavaMixEffects(par1World, par2, par3, par4); + } + } + } + } + + /** + * Creates fizzing sound and smoke. Used when lava flows over block or mixes with water. + */ + protected void triggerLavaMixEffects(World par1World, int par2, int par3, int par4) + { + par1World.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F); + + for (int var5 = 0; var5 < 8; ++var5) + { + par1World.spawnParticle("largesmoke", (double)par2 + Math.random(), (double)par3 + 1.2D, (double)par4 + Math.random(), 0.0D, 0.0D, 0.0D); + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + if (this.blockMaterial == Material.lava) + { + this.theIcon = new Icon[] {par1IconRegister.registerIcon("lava_still"), par1IconRegister.registerIcon("lava_flow")}; + } + else + { + this.theIcon = new Icon[] {par1IconRegister.registerIcon("water_still"), par1IconRegister.registerIcon("water_flow")}; + } + } + + public static Icon getFluidIcon(String par0Str) + { + return par0Str == "water_still" ? Block.waterMoving.theIcon[0] : (par0Str == "water_flow" ? Block.waterMoving.theIcon[1] : (par0Str == "lava_still" ? Block.lavaMoving.theIcon[0] : (par0Str == "lava_flow" ? Block.lavaMoving.theIcon[1] : null))); + } +} diff --git a/src/main/java/net/minecraft/src/BlockFurnace.java b/src/main/java/net/minecraft/src/BlockFurnace.java new file mode 100644 index 0000000..f3f5744 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockFurnace.java @@ -0,0 +1,311 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockFurnace extends BlockContainer +{ + /** + * Is the random generator used by furnace to drop the inventory contents in random directions. + */ + private final Random furnaceRand = new Random(); + + /** True if this is an active furnace, false if idle */ + private final boolean isActive; + + /** + * This flag is used to prevent the furnace inventory to be dropped upon block removal, is used internally when the + * furnace block changes from idle to active and vice-versa. + */ + private static boolean keepFurnaceInventory; + private Icon furnaceIconTop; + private Icon furnaceIconFront; + + protected BlockFurnace(int par1, boolean par2) + { + super(par1, Material.rock); + this.isActive = par2; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.furnaceIdle.blockID; + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + this.setDefaultDirection(par1World, par2, par3, par4); + } + + /** + * set a blocks direction + */ + private void setDefaultDirection(World par1World, int par2, int par3, int par4) + { + if (!par1World.isRemote) + { + int var5 = par1World.getBlockId(par2, par3, par4 - 1); + int var6 = par1World.getBlockId(par2, par3, par4 + 1); + int var7 = par1World.getBlockId(par2 - 1, par3, par4); + int var8 = par1World.getBlockId(par2 + 1, par3, par4); + byte var9 = 3; + + if (Block.opaqueCubeLookup[var5] && !Block.opaqueCubeLookup[var6]) + { + var9 = 3; + } + + if (Block.opaqueCubeLookup[var6] && !Block.opaqueCubeLookup[var5]) + { + var9 = 2; + } + + if (Block.opaqueCubeLookup[var7] && !Block.opaqueCubeLookup[var8]) + { + var9 = 5; + } + + if (Block.opaqueCubeLookup[var8] && !Block.opaqueCubeLookup[var7]) + { + var9 = 4; + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, var9, 2); + } + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.furnaceIconTop : (par1 == 0 ? this.furnaceIconTop : (par1 != par2 ? this.blockIcon : this.furnaceIconFront)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon("furnace_side"); + this.furnaceIconFront = par1IconRegister.registerIcon(this.isActive ? "furnace_front_on" : "furnace_front_off"); + this.furnaceIconTop = par1IconRegister.registerIcon("furnace_top"); + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (this.isActive) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + float var7 = (float)par2 + 0.5F; + float var8 = (float)par3 + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F; + float var9 = (float)par4 + 0.5F; + float var10 = 0.52F; + float var11 = par5Random.nextFloat() * 0.6F - 0.3F; + + if (var6 == 4) + { + par1World.spawnParticle("smoke", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); + par1World.spawnParticle("flame", (double)(var7 - var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); + } + else if (var6 == 5) + { + par1World.spawnParticle("smoke", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); + par1World.spawnParticle("flame", (double)(var7 + var10), (double)var8, (double)(var9 + var11), 0.0D, 0.0D, 0.0D); + } + else if (var6 == 2) + { + par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D); + par1World.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 - var10), 0.0D, 0.0D, 0.0D); + } + else if (var6 == 3) + { + par1World.spawnParticle("smoke", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D); + par1World.spawnParticle("flame", (double)(var7 + var11), (double)var8, (double)(var9 + var10), 0.0D, 0.0D, 0.0D); + } + } + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + TileEntityFurnace var10 = (TileEntityFurnace)par1World.getBlockTileEntity(par2, par3, par4); + + if (var10 != null) + { + par5EntityPlayer.displayGUIFurnace(var10); + } + + return true; + } + } + + /** + * Update which block ID the furnace is using depending on whether or not it is burning + */ + public static void updateFurnaceBlockState(boolean par0, World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + TileEntity var6 = par1World.getBlockTileEntity(par2, par3, par4); + keepFurnaceInventory = true; + + if (par0) + { + par1World.setBlock(par2, par3, par4, Block.furnaceBurning.blockID); + } + else + { + par1World.setBlock(par2, par3, par4, Block.furnaceIdle.blockID); + } + + keepFurnaceInventory = false; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var5, 2); + + if (var6 != null) + { + var6.validate(); + par1World.setBlockTileEntity(par2, par3, par4, var6); + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityFurnace(); + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + + if (var7 == 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2); + } + + if (var7 == 1) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2); + } + + if (var7 == 2) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2); + } + + if (var7 == 3) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2); + } + + if (par6ItemStack.hasDisplayName()) + { + ((TileEntityFurnace)par1World.getBlockTileEntity(par2, par3, par4)).setGuiDisplayName(par6ItemStack.getDisplayName()); + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + if (!keepFurnaceInventory) + { + TileEntityFurnace var7 = (TileEntityFurnace)par1World.getBlockTileEntity(par2, par3, par4); + + if (var7 != null) + { + for (int var8 = 0; var8 < var7.getSizeInventory(); ++var8) + { + ItemStack var9 = var7.getStackInSlot(var8); + + if (var9 != null) + { + float var10 = this.furnaceRand.nextFloat() * 0.8F + 0.1F; + float var11 = this.furnaceRand.nextFloat() * 0.8F + 0.1F; + float var12 = this.furnaceRand.nextFloat() * 0.8F + 0.1F; + + while (var9.stackSize > 0) + { + int var13 = this.furnaceRand.nextInt(21) + 10; + + if (var13 > var9.stackSize) + { + var13 = var9.stackSize; + } + + var9.stackSize -= var13; + EntityItem var14 = new EntityItem(par1World, (double)((float)par2 + var10), (double)((float)par3 + var11), (double)((float)par4 + var12), new ItemStack(var9.itemID, var13, var9.getItemDamage())); + + if (var9.hasTagCompound()) + { + var14.getEntityItem().setTagCompound((NBTTagCompound)var9.getTagCompound().copy()); + } + + float var15 = 0.05F; + var14.motionX = (double)((float)this.furnaceRand.nextGaussian() * var15); + var14.motionY = (double)((float)this.furnaceRand.nextGaussian() * var15 + 0.2F); + var14.motionZ = (double)((float)this.furnaceRand.nextGaussian() * var15); + par1World.spawnEntityInWorld(var14); + } + } + } + + par1World.func_96440_m(par2, par3, par4, par5); + } + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + /** + * If this returns true, then comparators facing away from this block will use the value from + * getComparatorInputOverride instead of the actual redstone signal strength. + */ + public boolean hasComparatorInputOverride() + { + return true; + } + + /** + * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal + * strength when this block inputs to a comparator. + */ + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) + { + return Container.calcRedstoneFromInventory((IInventory)par1World.getBlockTileEntity(par2, par3, par4)); + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Block.furnaceIdle.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockGlass.java b/src/main/java/net/minecraft/src/BlockGlass.java new file mode 100644 index 0000000..8541536 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockGlass.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockGlass extends BlockBreakable +{ + public BlockGlass(int par1, Material par2Material, boolean par3) + { + super(par1, "glass", par2Material, par3); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha + */ + public int getRenderBlockPass() + { + return 0; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops. + */ + protected boolean canSilkHarvest() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/BlockGlowStone.java b/src/main/java/net/minecraft/src/BlockGlowStone.java new file mode 100644 index 0000000..89335a9 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockGlowStone.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockGlowStone extends Block +{ + public BlockGlowStone(int par1, Material par2Material) + { + super(par1, par2Material); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive). + */ + public int quantityDroppedWithBonus(int par1, Random par2Random) + { + return MathHelper.clamp_int(this.quantityDropped(par2Random) + par2Random.nextInt(par1 + 1), 1, 4); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 2 + par1Random.nextInt(3); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.glowstone.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockGrass.java b/src/main/java/net/minecraft/src/BlockGrass.java new file mode 100644 index 0000000..5704f13 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockGrass.java @@ -0,0 +1,138 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockGrass extends Block +{ + private Icon iconGrassTop; + private Icon iconSnowSide; + private Icon iconGrassSideOverlay; + + protected BlockGrass(int par1) + { + super(par1, Material.grass); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.iconGrassTop : (par1 == 0 ? Block.dirt.getBlockTextureFromSide(par1) : this.blockIcon); + } + + /** + * Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side + */ + public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + if (par5 == 1) + { + return this.iconGrassTop; + } + else if (par5 == 0) + { + return Block.dirt.getBlockTextureFromSide(par5); + } + else + { + Material var6 = par1IBlockAccess.getBlockMaterial(par2, par3 + 1, par4); + return var6 != Material.snow && var6 != Material.craftedSnow ? this.blockIcon : this.iconSnowSide; + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + this.iconGrassTop = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.iconSnowSide = par1IconRegister.registerIcon(this.getTextureName() + "_side_snowed"); + this.iconGrassSideOverlay = par1IconRegister.registerIcon(this.getTextureName() + "_side_overlay"); + } + + public int getBlockColor() + { + double var1 = 0.5D; + double var3 = 1.0D; + return ColorizerGrass.getGrassColor(var1, var3); + } + + /** + * Returns the color this block should be rendered. Used by leaves. + */ + public int getRenderColor(int par1) + { + return this.getBlockColor(); + } + + /** + * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called + * when first determining what to render. + */ + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = 0; + int var6 = 0; + int var7 = 0; + + for (int var8 = -1; var8 <= 1; ++var8) + { + for (int var9 = -1; var9 <= 1; ++var9) + { + int var10 = par1IBlockAccess.getBiomeGenForCoords(par2 + var9, par4 + var8).getBiomeGrassColor(); + var5 += (var10 & 16711680) >> 16; + var6 += (var10 & 65280) >> 8; + var7 += var10 & 255; + } + } + + return (var5 / 9 & 255) << 16 | (var6 / 9 & 255) << 8 | var7 / 9 & 255; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote) + { + if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2) + { + par1World.setBlock(par2, par3, par4, Block.dirt.blockID); + } + else if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) + { + for (int var6 = 0; var6 < 4; ++var6) + { + int var7 = par2 + par5Random.nextInt(3) - 1; + int var8 = par3 + par5Random.nextInt(5) - 3; + int var9 = par4 + par5Random.nextInt(3) - 1; + int var10 = par1World.getBlockId(var7, var8 + 1, var9); + + if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && Block.lightOpacity[var10] <= 2) + { + par1World.setBlock(var7, var8, var9, Block.grass.blockID); + } + } + } + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.dirt.idDropped(0, par2Random, par3); + } + + public static Icon getIconSideOverlay() + { + return Block.grass.iconGrassSideOverlay; + } +} diff --git a/src/main/java/net/minecraft/src/BlockGravel.java b/src/main/java/net/minecraft/src/BlockGravel.java new file mode 100644 index 0000000..7a754a8 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockGravel.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockGravel extends BlockSand +{ + public BlockGravel(int par1) + { + super(par1); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + if (par3 > 3) + { + par3 = 3; + } + + return par2Random.nextInt(10 - par3 * 3) == 0 ? Item.flint.itemID : this.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockHalfSlab.java b/src/main/java/net/minecraft/src/BlockHalfSlab.java new file mode 100644 index 0000000..d5550a3 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockHalfSlab.java @@ -0,0 +1,169 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public abstract class BlockHalfSlab extends Block +{ + protected final boolean isDoubleSlab; + + public BlockHalfSlab(int par1, boolean par2, Material par3Material) + { + super(par1, par3Material); + this.isDoubleSlab = par2; + + if (par2) + { + opaqueCubeLookup[par1] = true; + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + + this.setLightOpacity(255); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + if (this.isDoubleSlab) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + boolean var5 = (par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 8) != 0; + + if (var5) + { + this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + } + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + if (this.isDoubleSlab) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return this.isDoubleSlab; + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + return this.isDoubleSlab ? par9 : (par5 != 0 && (par5 == 1 || (double)par7 <= 0.5D) ? par9 : par9 | 8); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return this.isDoubleSlab ? 2 : 1; + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1 & 7; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return this.isDoubleSlab; + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + if (this.isDoubleSlab) + { + return super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + } + else if (par5 != 1 && par5 != 0 && !super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5)) + { + return false; + } + else + { + int var6 = par2 + Facing.offsetsXForSide[Facing.oppositeSide[par5]]; + int var7 = par3 + Facing.offsetsYForSide[Facing.oppositeSide[par5]]; + int var8 = par4 + Facing.offsetsZForSide[Facing.oppositeSide[par5]]; + boolean var9 = (par1IBlockAccess.getBlockMetadata(var6, var7, var8) & 8) != 0; + return var9 ? (par5 == 0 ? true : (par5 == 1 && super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5) ? true : !isBlockSingleSlab(par1IBlockAccess.getBlockId(par2, par3, par4)) || (par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 8) == 0)) : (par5 == 1 ? true : (par5 == 0 && super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5) ? true : !isBlockSingleSlab(par1IBlockAccess.getBlockId(par2, par3, par4)) || (par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 8) != 0)); + } + } + + /** + * Takes a block ID, returns true if it's the same as the ID for a stone or wooden single slab. + */ + private static boolean isBlockSingleSlab(int par0) + { + return par0 == Block.stoneSingleSlab.blockID || par0 == Block.woodSingleSlab.blockID; + } + + /** + * Returns the slab block name with step type. + */ + public abstract String getFullSlabName(int var1); + + /** + * Get the block's damage value (for use with pick block). + */ + public int getDamageValue(World par1World, int par2, int par3, int par4) + { + return super.getDamageValue(par1World, par2, par3, par4) & 7; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return isBlockSingleSlab(this.blockID) ? this.blockID : (this.blockID == Block.stoneDoubleSlab.blockID ? Block.stoneSingleSlab.blockID : (this.blockID == Block.woodDoubleSlab.blockID ? Block.woodSingleSlab.blockID : Block.stoneSingleSlab.blockID)); + } +} diff --git a/src/main/java/net/minecraft/src/BlockHay.java b/src/main/java/net/minecraft/src/BlockHay.java new file mode 100644 index 0000000..0d2e370 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockHay.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +public class BlockHay extends BlockRotatedPillar +{ + public BlockHay(int par1) + { + super(par1, Material.grass); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 31; + } + + /** + * The icon for the side of the block. + */ + protected Icon getSideIcon(int par1) + { + return this.blockIcon; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.field_111051_a = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockHopper.java b/src/main/java/net/minecraft/src/BlockHopper.java new file mode 100644 index 0000000..44a2b6c --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockHopper.java @@ -0,0 +1,292 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockHopper extends BlockContainer +{ + private final Random field_94457_a = new Random(); + private Icon hopperIcon; + private Icon hopperTopIcon; + private Icon hopperInsideIcon; + + public BlockHopper(int par1) + { + super(par1, Material.iron); + this.setCreativeTab(CreativeTabs.tabRedstone); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + float var8 = 0.125F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, var8, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var8); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(1.0F - var8, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(0.0F, 0.0F, 1.0F - var8, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + int var10 = Facing.oppositeSide[par5]; + + if (var10 == 1) + { + var10 = 0; + } + + return var10; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityHopper(); + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack); + + if (par6ItemStack.hasDisplayName()) + { + TileEntityHopper var7 = getHopperTile(par1World, par2, par3, par4); + var7.setInventoryName(par6ItemStack.getDisplayName()); + } + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + this.updateMetadata(par1World, par2, par3, par4); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + TileEntityHopper var10 = getHopperTile(par1World, par2, par3, par4); + + if (var10 != null) + { + par5EntityPlayer.displayGUIHopper(var10); + } + + return true; + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + this.updateMetadata(par1World, par2, par3, par4); + } + + /** + * Updates the Metadata to include if the Hopper gets powered by Redstone or not + */ + private void updateMetadata(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + int var6 = getDirectionFromMetadata(var5); + boolean var7 = !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4); + boolean var8 = getIsBlockNotPoweredFromMetadata(var5); + + if (var7 != var8) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 | (var7 ? 0 : 8), 4); + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + TileEntityHopper var7 = (TileEntityHopper)par1World.getBlockTileEntity(par2, par3, par4); + + if (var7 != null) + { + for (int var8 = 0; var8 < var7.getSizeInventory(); ++var8) + { + ItemStack var9 = var7.getStackInSlot(var8); + + if (var9 != null) + { + float var10 = this.field_94457_a.nextFloat() * 0.8F + 0.1F; + float var11 = this.field_94457_a.nextFloat() * 0.8F + 0.1F; + float var12 = this.field_94457_a.nextFloat() * 0.8F + 0.1F; + + while (var9.stackSize > 0) + { + int var13 = this.field_94457_a.nextInt(21) + 10; + + if (var13 > var9.stackSize) + { + var13 = var9.stackSize; + } + + var9.stackSize -= var13; + EntityItem var14 = new EntityItem(par1World, (double)((float)par2 + var10), (double)((float)par3 + var11), (double)((float)par4 + var12), new ItemStack(var9.itemID, var13, var9.getItemDamage())); + + if (var9.hasTagCompound()) + { + var14.getEntityItem().setTagCompound((NBTTagCompound)var9.getTagCompound().copy()); + } + + float var15 = 0.05F; + var14.motionX = (double)((float)this.field_94457_a.nextGaussian() * var15); + var14.motionY = (double)((float)this.field_94457_a.nextGaussian() * var15 + 0.2F); + var14.motionZ = (double)((float)this.field_94457_a.nextGaussian() * var15); + par1World.spawnEntityInWorld(var14); + } + } + } + + par1World.func_96440_m(par2, par3, par4, par5); + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 38; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return true; + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.hopperTopIcon : this.hopperIcon; + } + + public static int getDirectionFromMetadata(int par0) + { + return par0 & 7; + } + + public static boolean getIsBlockNotPoweredFromMetadata(int par0) + { + return (par0 & 8) != 8; + } + + /** + * If this returns true, then comparators facing away from this block will use the value from + * getComparatorInputOverride instead of the actual redstone signal strength. + */ + public boolean hasComparatorInputOverride() + { + return true; + } + + /** + * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal + * strength when this block inputs to a comparator. + */ + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) + { + return Container.calcRedstoneFromInventory(getHopperTile(par1World, par2, par3, par4)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.hopperIcon = par1IconRegister.registerIcon("hopper_outside"); + this.hopperTopIcon = par1IconRegister.registerIcon("hopper_top"); + this.hopperInsideIcon = par1IconRegister.registerIcon("hopper_inside"); + } + + public static Icon getHopperIcon(String par0Str) + { + return par0Str.equals("hopper_outside") ? Block.hopperBlock.hopperIcon : (par0Str.equals("hopper_inside") ? Block.hopperBlock.hopperInsideIcon : null); + } + + /** + * Gets the icon name of the ItemBlock corresponding to this block. Used by hoppers. + */ + public String getItemIconName() + { + return "hopper"; + } + + public static TileEntityHopper getHopperTile(IBlockAccess par0IBlockAccess, int par1, int par2, int par3) + { + return (TileEntityHopper)par0IBlockAccess.getBlockTileEntity(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/BlockIce.java b/src/main/java/net/minecraft/src/BlockIce.java new file mode 100644 index 0000000..4021874 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockIce.java @@ -0,0 +1,103 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockIce extends BlockBreakable +{ + public BlockIce(int par1) + { + super(par1, "ice", Material.ice, false); + this.slipperiness = 0.98F; + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha + */ + public int getRenderBlockPass() + { + return 1; + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, 1 - par5); + } + + /** + * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the + * block and l is the block's subtype/damage. + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) + { + par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); + par2EntityPlayer.addExhaustion(0.025F); + + if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer)) + { + ItemStack var9 = this.createStackedBlock(par6); + + if (var9 != null) + { + this.dropBlockAsItem_do(par1World, par3, par4, par5, var9); + } + } + else + { + if (par1World.provider.isHellWorld) + { + par1World.setBlockToAir(par3, par4, par5); + return; + } + + int var7 = EnchantmentHelper.getFortuneModifier(par2EntityPlayer); + this.dropBlockAsItem(par1World, par3, par4, par5, par6, var7); + Material var8 = par1World.getBlockMaterial(par3, par4 - 1, par5); + + if (var8.blocksMovement() || var8.isLiquid()) + { + par1World.setBlock(par3, par4, par5, Block.waterMoving.blockID); + } + } + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11 - Block.lightOpacity[this.blockID]) + { + if (par1World.provider.isHellWorld) + { + par1World.setBlockToAir(par2, par3, par4); + return; + } + + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlock(par2, par3, par4, Block.waterStill.blockID); + } + } + + /** + * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility + * and stop pistons + */ + public int getMobilityFlag() + { + return 0; + } +} diff --git a/src/main/java/net/minecraft/src/BlockJukeBox.java b/src/main/java/net/minecraft/src/BlockJukeBox.java new file mode 100644 index 0000000..17c622e --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockJukeBox.java @@ -0,0 +1,144 @@ +package net.minecraft.src; + +public class BlockJukeBox extends BlockContainer +{ + private Icon theIcon; + + protected BlockJukeBox(int par1) + { + super(par1, Material.wood); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.theIcon : this.blockIcon; + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.getBlockMetadata(par2, par3, par4) == 0) + { + return false; + } + else + { + this.ejectRecord(par1World, par2, par3, par4); + return true; + } + } + + /** + * Insert the specified music disc in the jukebox at the given coordinates + */ + public void insertRecord(World par1World, int par2, int par3, int par4, ItemStack par5ItemStack) + { + if (!par1World.isRemote) + { + TileEntityRecordPlayer var6 = (TileEntityRecordPlayer)par1World.getBlockTileEntity(par2, par3, par4); + + if (var6 != null) + { + var6.func_96098_a(par5ItemStack.copy()); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 2); + } + } + } + + /** + * Ejects the current record inside of the jukebox. + */ + public void ejectRecord(World par1World, int par2, int par3, int par4) + { + if (!par1World.isRemote) + { + TileEntityRecordPlayer var5 = (TileEntityRecordPlayer)par1World.getBlockTileEntity(par2, par3, par4); + + if (var5 != null) + { + ItemStack var6 = var5.func_96097_a(); + + if (var6 != null) + { + par1World.playAuxSFX(1005, par2, par3, par4, 0); + par1World.playRecord((String)null, par2, par3, par4); + var5.func_96098_a((ItemStack)null); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 0, 2); + float var7 = 0.7F; + double var8 = (double)(par1World.rand.nextFloat() * var7) + (double)(1.0F - var7) * 0.5D; + double var10 = (double)(par1World.rand.nextFloat() * var7) + (double)(1.0F - var7) * 0.2D + 0.6D; + double var12 = (double)(par1World.rand.nextFloat() * var7) + (double)(1.0F - var7) * 0.5D; + ItemStack var14 = var6.copy(); + EntityItem var15 = new EntityItem(par1World, (double)par2 + var8, (double)par3 + var10, (double)par4 + var12, var14); + var15.delayBeforeCanPickup = 10; + par1World.spawnEntityInWorld(var15); + } + } + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + this.ejectRecord(par1World, par2, par3, par4); + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + if (!par1World.isRemote) + { + super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0); + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityRecordPlayer(); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + this.theIcon = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + } + + /** + * If this returns true, then comparators facing away from this block will use the value from + * getComparatorInputOverride instead of the actual redstone signal strength. + */ + public boolean hasComparatorInputOverride() + { + return true; + } + + /** + * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal + * strength when this block inputs to a comparator. + */ + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) + { + ItemStack var6 = ((TileEntityRecordPlayer)par1World.getBlockTileEntity(par2, par3, par4)).func_96097_a(); + return var6 == null ? 0 : var6.itemID + 1 - Item.record13.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockLadder.java b/src/main/java/net/minecraft/src/BlockLadder.java new file mode 100644 index 0000000..4ac222a --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockLadder.java @@ -0,0 +1,176 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockLadder extends Block +{ + protected BlockLadder(int par1) + { + super(par1, Material.circuits); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Returns the bounding box of the wired rectangular prism to render. + */ + public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.getSelectedBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.updateLadderBounds(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + } + + /** + * Update the ladder block bounds based on the given metadata value. + */ + public void updateLadderBounds(int par1) + { + float var3 = 0.125F; + + if (par1 == 2) + { + this.setBlockBounds(0.0F, 0.0F, 1.0F - var3, 1.0F, 1.0F, 1.0F); + } + + if (par1 == 3) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var3); + } + + if (par1 == 4) + { + this.setBlockBounds(1.0F - var3, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + if (par1 == 5) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, var3, 1.0F, 1.0F); + } + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 8; + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1))); + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + int var10 = par9; + + if ((par9 == 0 || par5 == 2) && par1World.isBlockNormalCube(par2, par3, par4 + 1)) + { + var10 = 2; + } + + if ((var10 == 0 || par5 == 3) && par1World.isBlockNormalCube(par2, par3, par4 - 1)) + { + var10 = 3; + } + + if ((var10 == 0 || par5 == 4) && par1World.isBlockNormalCube(par2 + 1, par3, par4)) + { + var10 = 4; + } + + if ((var10 == 0 || par5 == 5) && par1World.isBlockNormalCube(par2 - 1, par3, par4)) + { + var10 = 5; + } + + return var10; + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + boolean var7 = false; + + if (var6 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) + { + var7 = true; + } + + if (var6 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) + { + var7 = true; + } + + if (var6 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) + { + var7 = true; + } + + if (var6 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) + { + var7 = true; + } + + if (!var7) + { + this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0); + par1World.setBlockToAir(par2, par3, par4); + } + + super.onNeighborBlockChange(par1World, par2, par3, par4, par5); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 1; + } +} diff --git a/src/main/java/net/minecraft/src/BlockLeaves.java b/src/main/java/net/minecraft/src/BlockLeaves.java new file mode 100644 index 0000000..2ab9a0c --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockLeaves.java @@ -0,0 +1,392 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockLeaves extends BlockLeavesBase +{ + public static final String[] LEAF_TYPES = new String[] {"oak", "spruce", "birch", "jungle"}; + public static final String[][] field_94396_b = new String[][] {{"leaves_oak", "leaves_spruce", "leaves_birch", "leaves_jungle"}, {"leaves_oak_opaque", "leaves_spruce_opaque", "leaves_birch_opaque", "leaves_jungle_opaque"}}; + + /** 1 for fast graphic. 0 for fancy graphics. used in iconArray. */ + private int iconType; + private Icon[][] iconArray = new Icon[2][]; + int[] adjacentTreeBlocks; + + protected BlockLeaves(int par1) + { + super(par1, Material.leaves, false); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + public int getBlockColor() + { + double var1 = 0.5D; + double var3 = 1.0D; + return ColorizerFoliage.getFoliageColor(var1, var3); + } + + /** + * Returns the color this block should be rendered. Used by leaves. + */ + public int getRenderColor(int par1) + { + return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); + } + + /** + * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called + * when first determining what to render. + */ + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + + if ((var5 & 3) == 1) + { + return ColorizerFoliage.getFoliageColorPine(); + } + else if ((var5 & 3) == 2) + { + return ColorizerFoliage.getFoliageColorBirch(); + } + else + { + int var6 = 0; + int var7 = 0; + int var8 = 0; + + for (int var9 = -1; var9 <= 1; ++var9) + { + for (int var10 = -1; var10 <= 1; ++var10) + { + int var11 = par1IBlockAccess.getBiomeGenForCoords(par2 + var10, par4 + var9).getBiomeFoliageColor(); + var6 += (var11 & 16711680) >> 16; + var7 += (var11 & 65280) >> 8; + var8 += var11 & 255; + } + } + + return (var6 / 9 & 255) << 16 | (var7 / 9 & 255) << 8 | var8 / 9 & 255; + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + byte var7 = 1; + int var8 = var7 + 1; + + if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) + { + for (int var9 = -var7; var9 <= var7; ++var9) + { + for (int var10 = -var7; var10 <= var7; ++var10) + { + for (int var11 = -var7; var11 <= var7; ++var11) + { + int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); + + if (var12 == Block.leaves.blockID) + { + int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); + par1World.setBlockMetadataWithNotify(par2 + var9, par3 + var10, par4 + var11, var13 | 8, 4); + } + } + } + } + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if ((var6 & 8) != 0 && (var6 & 4) == 0) + { + byte var7 = 4; + int var8 = var7 + 1; + byte var9 = 32; + int var10 = var9 * var9; + int var11 = var9 / 2; + + if (this.adjacentTreeBlocks == null) + { + this.adjacentTreeBlocks = new int[var9 * var9 * var9]; + } + + int var12; + + if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) + { + int var13; + int var14; + int var15; + + for (var12 = -var7; var12 <= var7; ++var12) + { + for (var13 = -var7; var13 <= var7; ++var13) + { + for (var14 = -var7; var14 <= var7; ++var14) + { + var15 = par1World.getBlockId(par2 + var12, par3 + var13, par4 + var14); + + if (var15 == Block.wood.blockID) + { + this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = 0; + } + else if (var15 == Block.leaves.blockID) + { + this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -2; + } + else + { + this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -1; + } + } + } + } + + for (var12 = 1; var12 <= 4; ++var12) + { + for (var13 = -var7; var13 <= var7; ++var13) + { + for (var14 = -var7; var14 <= var7; ++var14) + { + for (var15 = -var7; var15 <= var7; ++var15) + { + if (this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11] == var12 - 1) + { + if (this.adjacentTreeBlocks[(var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15 + var11] == -2) + { + this.adjacentTreeBlocks[(var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15 + var11] = var12; + } + + if (this.adjacentTreeBlocks[(var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15 + var11] == -2) + { + this.adjacentTreeBlocks[(var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15 + var11] = var12; + } + + if (this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15 + var11] == -2) + { + this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15 + var11] = var12; + } + + if (this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15 + var11] == -2) + { + this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15 + var11] = var12; + } + + if (this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + (var15 + var11 - 1)] == -2) + { + this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + (var15 + var11 - 1)] = var12; + } + + if (this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11 + 1] == -2) + { + this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11 + 1] = var12; + } + } + } + } + } + } + } + + var12 = this.adjacentTreeBlocks[var11 * var10 + var11 * var9 + var11]; + + if (var12 >= 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 & -9, 4); + } + else + { + this.removeLeaves(par1World, par2, par3, par4); + } + } + } + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (par1World.canLightningStrikeAt(par2, par3 + 1, par4) && !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && par5Random.nextInt(15) == 1) + { + double var6 = (double)((float)par2 + par5Random.nextFloat()); + double var8 = (double)par3 - 0.05D; + double var10 = (double)((float)par4 + par5Random.nextFloat()); + par1World.spawnParticle("dripWater", var6, var8, var10, 0.0D, 0.0D, 0.0D); + } + } + + private void removeLeaves(World par1World, int par2, int par3, int par4) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return par1Random.nextInt(20) == 0 ? 1 : 0; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.sapling.blockID; + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + if (!par1World.isRemote) + { + int var8 = 20; + + if ((par5 & 3) == 3) + { + var8 = 40; + } + + if (par7 > 0) + { + var8 -= 2 << par7; + + if (var8 < 10) + { + var8 = 10; + } + } + + if (par1World.rand.nextInt(var8) == 0) + { + int var9 = this.idDropped(par5, par1World.rand, par7); + this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var9, 1, this.damageDropped(par5))); + } + + var8 = 200; + + if (par7 > 0) + { + var8 -= 10 << par7; + + if (var8 < 40) + { + var8 = 40; + } + } + + if ((par5 & 3) == 0 && par1World.rand.nextInt(var8) == 0) + { + this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.appleRed, 1, 0)); + } + } + } + + /** + * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the + * block and l is the block's subtype/damage. + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) + { + if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) + { + par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); + this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.leaves.blockID, 1, par6 & 3)); + } + else + { + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + } + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1 & 3; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return !this.graphicsLevel; + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return (par2 & 3) == 1 ? this.iconArray[this.iconType][1] : ((par2 & 3) == 3 ? this.iconArray[this.iconType][3] : ((par2 & 3) == 2 ? this.iconArray[this.iconType][2] : this.iconArray[this.iconType][0])); + } + + /** + * Pass true to draw this block using fancy graphics, or false for fast graphics. + */ + public void setGraphicsLevel(boolean par1) + { + this.graphicsLevel = par1; + this.iconType = par1 ? 0 : 1; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + } + + /** + * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage + * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null. + */ + protected ItemStack createStackedBlock(int par1) + { + return new ItemStack(this.blockID, 1, par1 & 3); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + for (int var2 = 0; var2 < field_94396_b.length; ++var2) + { + this.iconArray[var2] = new Icon[field_94396_b[var2].length]; + + for (int var3 = 0; var3 < field_94396_b[var2].length; ++var3) + { + this.iconArray[var2][var3] = par1IconRegister.registerIcon(field_94396_b[var2][var3]); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockLeavesBase.java b/src/main/java/net/minecraft/src/BlockLeavesBase.java new file mode 100644 index 0000000..74bb685 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockLeavesBase.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +public class BlockLeavesBase extends Block +{ + /** + * Used to determine how to display leaves based on the graphics level. May also be used in rendering for + * transparency, not sure. + */ + protected boolean graphicsLevel; + + protected BlockLeavesBase(int par1, Material par2Material, boolean par3) + { + super(par1, par2Material); + this.graphicsLevel = par3; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + int var6 = par1IBlockAccess.getBlockId(par2, par3, par4); + return !this.graphicsLevel && var6 == this.blockID ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + } +} diff --git a/src/main/java/net/minecraft/src/BlockLever.java b/src/main/java/net/minecraft/src/BlockLever.java new file mode 100644 index 0000000..b3724b8 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockLever.java @@ -0,0 +1,412 @@ +package net.minecraft.src; + +public class BlockLever extends Block +{ + protected BlockLever(int par1) + { + super(par1, Material.circuits); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 12; + } + + /** + * checks to see if you can place this block can be placed on that side of a block: BlockLever overrides + */ + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + { + return par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4) ? true : (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? true : (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))))); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? true : par1World.isBlockNormalCube(par2, par3 + 1, par4))))); + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + int var11 = par9 & 8; + int var10 = par9 & 7; + byte var12 = -1; + + if (par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4)) + { + var12 = 0; + } + + if (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) + { + var12 = 5; + } + + if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) + { + var12 = 4; + } + + if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1)) + { + var12 = 3; + } + + if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4)) + { + var12 = 2; + } + + if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)) + { + var12 = 1; + } + + return var12 + var11; + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = par1World.getBlockMetadata(par2, par3, par4); + int var8 = var7 & 7; + int var9 = var7 & 8; + + if (var8 == invertMetadata(1)) + { + if ((MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 5 | var9, 2); + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 6 | var9, 2); + } + } + else if (var8 == invertMetadata(0)) + { + if ((MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 7 | var9, 2); + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 0 | var9, 2); + } + } + } + + /** + * only used in ComponentScatteredFeatureJunglePyramid.addComponentParts" + */ + public static int invertMetadata(int par0) + { + switch (par0) + { + case 0: + return 0; + + case 1: + return 5; + + case 2: + return 4; + + case 3: + return 3; + + case 4: + return 2; + + case 5: + return 1; + + default: + return -1; + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (this.checkIfAttachedToBlock(par1World, par2, par3, par4)) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4) & 7; + boolean var7 = false; + + if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && var6 == 1) + { + var7 = true; + } + + if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var6 == 2) + { + var7 = true; + } + + if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var6 == 3) + { + var7 = true; + } + + if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var6 == 4) + { + var7 = true; + } + + if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && var6 == 5) + { + var7 = true; + } + + if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && var6 == 6) + { + var7 = true; + } + + if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && var6 == 0) + { + var7 = true; + } + + if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && var6 == 7) + { + var7 = true; + } + + if (var7) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + } + } + + /** + * Checks if the block is attached to another block. If it is not, it returns false and drops the block as an item. + * If it is it returns true. + */ + private boolean checkIfAttachedToBlock(World par1World, int par2, int par3, int par4) + { + if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + return false; + } + else + { + return true; + } + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 7; + float var6 = 0.1875F; + + if (var5 == 1) + { + this.setBlockBounds(0.0F, 0.2F, 0.5F - var6, var6 * 2.0F, 0.8F, 0.5F + var6); + } + else if (var5 == 2) + { + this.setBlockBounds(1.0F - var6 * 2.0F, 0.2F, 0.5F - var6, 1.0F, 0.8F, 0.5F + var6); + } + else if (var5 == 3) + { + this.setBlockBounds(0.5F - var6, 0.2F, 0.0F, 0.5F + var6, 0.8F, var6 * 2.0F); + } + else if (var5 == 4) + { + this.setBlockBounds(0.5F - var6, 0.2F, 1.0F - var6 * 2.0F, 0.5F + var6, 0.8F, 1.0F); + } + else if (var5 != 5 && var5 != 6) + { + if (var5 == 0 || var5 == 7) + { + var6 = 0.25F; + this.setBlockBounds(0.5F - var6, 0.4F, 0.5F - var6, 0.5F + var6, 1.0F, 0.5F + var6); + } + } + else + { + var6 = 0.25F; + this.setBlockBounds(0.5F - var6, 0.0F, 0.5F - var6, 0.5F + var6, 0.6F, 0.5F + var6); + } + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + int var10 = par1World.getBlockMetadata(par2, par3, par4); + int var11 = var10 & 7; + int var12 = 8 - (var10 & 8); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var11 + var12, 3); + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "random.click", 0.3F, var12 > 0 ? 0.6F : 0.5F); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); + + if (var11 == 1) + { + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID); + } + else if (var11 == 2) + { + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID); + } + else if (var11 == 3) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID); + } + else if (var11 == 4) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID); + } + else if (var11 != 5 && var11 != 6) + { + if (var11 == 0 || var11 == 7) + { + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID); + } + } + else + { + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + } + + return true; + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + if ((par6 & 8) > 0) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); + int var7 = par6 & 7; + + if (var7 == 1) + { + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID); + } + else if (var7 == 2) + { + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID); + } + else if (var7 == 3) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID); + } + else if (var7 == 4) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID); + } + else if (var7 != 5 && var7 != 6) + { + if (var7 == 0 || var7 == 7) + { + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID); + } + } + else + { + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + } + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return (par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 8) > 0 ? 15 : 0; + } + + /** + * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, + * side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + + if ((var6 & 8) == 0) + { + return 0; + } + else + { + int var7 = var6 & 7; + return var7 == 0 && par5 == 0 ? 15 : (var7 == 7 && par5 == 0 ? 15 : (var7 == 6 && par5 == 1 ? 15 : (var7 == 5 && par5 == 1 ? 15 : (var7 == 4 && par5 == 2 ? 15 : (var7 == 3 && par5 == 3 ? 15 : (var7 == 2 && par5 == 4 ? 15 : (var7 == 1 && par5 == 5 ? 15 : 0))))))); + } + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/BlockLilyPad.java b/src/main/java/net/minecraft/src/BlockLilyPad.java new file mode 100644 index 0000000..3dbf578 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockLilyPad.java @@ -0,0 +1,83 @@ +package net.minecraft.src; + +import java.util.List; + +public class BlockLilyPad extends BlockFlower +{ + protected BlockLilyPad(int par1) + { + super(par1); + float var2 = 0.5F; + float var3 = 0.015625F; + this.setBlockBounds(0.5F - var2, 0.0F, 0.5F - var2, 0.5F + var2, var3, 0.5F + var2); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 23; + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + if (par7Entity == null || !(par7Entity instanceof EntityBoat)) + { + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return AxisAlignedBB.getAABBPool().getAABB((double)par2 + this.minX, (double)par3 + this.minY, (double)par4 + this.minZ, (double)par2 + this.maxX, (double)par3 + this.maxY, (double)par4 + this.maxZ); + } + + public int getBlockColor() + { + return 2129968; + } + + /** + * Returns the color this block should be rendered. Used by leaves. + */ + public int getRenderColor(int par1) + { + return 2129968; + } + + /** + * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called + * when first determining what to render. + */ + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return 2129968; + } + + /** + * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of + * blockID passed in. Args: blockID + */ + protected boolean canThisPlantGrowOnThisBlockID(int par1) + { + return par1 == Block.waterStill.blockID; + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) + { + return par3 >= 0 && par3 < 256 ? par1World.getBlockMaterial(par2, par3 - 1, par4) == Material.water && par1World.getBlockMetadata(par2, par3 - 1, par4) == 0 : false; + } +} diff --git a/src/main/java/net/minecraft/src/BlockLockedChest.java b/src/main/java/net/minecraft/src/BlockLockedChest.java new file mode 100644 index 0000000..0158e5a --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockLockedChest.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockLockedChest extends Block +{ + protected BlockLockedChest(int par1) + { + super(par1, Material.wood); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return true; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + par1World.setBlockToAir(par2, par3, par4); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) {} +} diff --git a/src/main/java/net/minecraft/src/BlockLog.java b/src/main/java/net/minecraft/src/BlockLog.java new file mode 100644 index 0000000..b1d5284 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockLog.java @@ -0,0 +1,120 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockLog extends BlockRotatedPillar +{ + /** The type of tree this log came from. */ + public static final String[] woodType = new String[] {"oak", "spruce", "birch", "jungle"}; + private Icon[] field_111052_c; + private Icon[] tree_top; + + protected BlockLog(int par1) + { + super(par1, Material.wood); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 1; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.wood.blockID; + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + byte var7 = 4; + int var8 = var7 + 1; + + if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) + { + for (int var9 = -var7; var9 <= var7; ++var9) + { + for (int var10 = -var7; var10 <= var7; ++var10) + { + for (int var11 = -var7; var11 <= var7; ++var11) + { + int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); + + if (var12 == Block.leaves.blockID) + { + int var13 = par1World.getBlockMetadata(par2 + var9, par3 + var10, par4 + var11); + + if ((var13 & 8) == 0) + { + par1World.setBlockMetadataWithNotify(par2 + var9, par3 + var10, par4 + var11, var13 | 8, 4); + } + } + } + } + } + } + } + + /** + * The icon for the side of the block. + */ + protected Icon getSideIcon(int par1) + { + return this.field_111052_c[par1]; + } + + /** + * The icon for the tops and bottoms of the block. + */ + protected Icon getEndIcon(int par1) + { + return this.tree_top[par1]; + } + + /** + * returns a number between 0 and 3 + */ + public static int limitToValidMetadata(int par0) + { + return par0 & 3; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.field_111052_c = new Icon[woodType.length]; + this.tree_top = new Icon[woodType.length]; + + for (int var2 = 0; var2 < this.field_111052_c.length; ++var2) + { + this.field_111052_c[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_" + woodType[var2]); + this.tree_top[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_" + woodType[var2] + "_top"); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockMelon.java b/src/main/java/net/minecraft/src/BlockMelon.java new file mode 100644 index 0000000..5241e51 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockMelon.java @@ -0,0 +1,63 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockMelon extends Block +{ + private Icon theIcon; + + protected BlockMelon(int par1) + { + super(par1, Material.pumpkin); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 != 1 && par1 != 0 ? this.blockIcon : this.theIcon; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.melon.itemID; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 3 + par1Random.nextInt(5); + } + + /** + * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive). + */ + public int quantityDroppedWithBonus(int par1, Random par2Random) + { + int var3 = this.quantityDropped(par2Random) + par2Random.nextInt(1 + par1); + + if (var3 > 9) + { + var3 = 9; + } + + return var3; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + this.theIcon = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockMobSpawner.java b/src/main/java/net/minecraft/src/BlockMobSpawner.java new file mode 100644 index 0000000..a9da220 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockMobSpawner.java @@ -0,0 +1,62 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockMobSpawner extends BlockContainer +{ + protected BlockMobSpawner(int par1) + { + super(par1, Material.rock); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityMobSpawner(); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return 0; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); + int var8 = 15 + par1World.rand.nextInt(15) + par1World.rand.nextInt(15); + this.dropXpOnBlockBreak(par1World, par2, par3, par4, var8); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return 0; + } +} diff --git a/src/main/java/net/minecraft/src/BlockMushroom.java b/src/main/java/net/minecraft/src/BlockMushroom.java new file mode 100644 index 0000000..8565ec8 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockMushroom.java @@ -0,0 +1,133 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockMushroom extends BlockFlower +{ + protected BlockMushroom(int par1) + { + super(par1); + float var2 = 0.2F; + this.setBlockBounds(0.5F - var2, 0.0F, 0.5F - var2, 0.5F + var2, var2 * 2.0F, 0.5F + var2); + this.setTickRandomly(true); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (par5Random.nextInt(25) == 0) + { + byte var6 = 4; + int var7 = 5; + int var8; + int var9; + int var10; + + for (var8 = par2 - var6; var8 <= par2 + var6; ++var8) + { + for (var9 = par4 - var6; var9 <= par4 + var6; ++var9) + { + for (var10 = par3 - 1; var10 <= par3 + 1; ++var10) + { + if (par1World.getBlockId(var8, var10, var9) == this.blockID) + { + --var7; + + if (var7 <= 0) + { + return; + } + } + } + } + } + + var8 = par2 + par5Random.nextInt(3) - 1; + var9 = par3 + par5Random.nextInt(2) - par5Random.nextInt(2); + var10 = par4 + par5Random.nextInt(3) - 1; + + for (int var11 = 0; var11 < 4; ++var11) + { + if (par1World.isAirBlock(var8, var9, var10) && this.canBlockStay(par1World, var8, var9, var10)) + { + par2 = var8; + par3 = var9; + par4 = var10; + } + + var8 = par2 + par5Random.nextInt(3) - 1; + var9 = par3 + par5Random.nextInt(2) - par5Random.nextInt(2); + var10 = par4 + par5Random.nextInt(3) - 1; + } + + if (par1World.isAirBlock(var8, var9, var10) && this.canBlockStay(par1World, var8, var9, var10)) + { + par1World.setBlock(var8, var9, var10, this.blockID, 0, 2); + } + } + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return super.canPlaceBlockAt(par1World, par2, par3, par4) && this.canBlockStay(par1World, par2, par3, par4); + } + + /** + * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of + * blockID passed in. Args: blockID + */ + protected boolean canThisPlantGrowOnThisBlockID(int par1) + { + return Block.opaqueCubeLookup[par1]; + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) + { + if (par3 >= 0 && par3 < 256) + { + int var5 = par1World.getBlockId(par2, par3 - 1, par4); + return var5 == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13 && this.canThisPlantGrowOnThisBlockID(var5); + } + else + { + return false; + } + } + + /** + * Fertilize the mushroom. + */ + public boolean fertilizeMushroom(World par1World, int par2, int par3, int par4, Random par5Random) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + par1World.setBlockToAir(par2, par3, par4); + WorldGenBigMushroom var7 = null; + + if (this.blockID == Block.mushroomBrown.blockID) + { + var7 = new WorldGenBigMushroom(0); + } + else if (this.blockID == Block.mushroomRed.blockID) + { + var7 = new WorldGenBigMushroom(1); + } + + if (var7 != null && var7.generate(par1World, par5Random, par2, par3, par4)) + { + return true; + } + else + { + par1World.setBlock(par2, par3, par4, this.blockID, var6, 3); + return false; + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockMushroomCap.java b/src/main/java/net/minecraft/src/BlockMushroomCap.java new file mode 100644 index 0000000..0a6a27a --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockMushroomCap.java @@ -0,0 +1,76 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockMushroomCap extends Block +{ + private static final String[] field_94429_a = new String[] {"skin_brown", "skin_red"}; + + /** The mushroom type. 0 for brown, 1 for red. */ + private final int mushroomType; + private Icon[] iconArray; + private Icon field_94426_cO; + private Icon field_94427_cP; + + public BlockMushroomCap(int par1, Material par2Material, int par3) + { + super(par1, par2Material); + this.mushroomType = par3; + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par2 == 10 && par1 > 1 ? this.field_94426_cO : (par2 >= 1 && par2 <= 9 && par1 == 1 ? this.iconArray[this.mushroomType] : (par2 >= 1 && par2 <= 3 && par1 == 2 ? this.iconArray[this.mushroomType] : (par2 >= 7 && par2 <= 9 && par1 == 3 ? this.iconArray[this.mushroomType] : ((par2 == 1 || par2 == 4 || par2 == 7) && par1 == 4 ? this.iconArray[this.mushroomType] : ((par2 == 3 || par2 == 6 || par2 == 9) && par1 == 5 ? this.iconArray[this.mushroomType] : (par2 == 14 ? this.iconArray[this.mushroomType] : (par2 == 15 ? this.field_94426_cO : this.field_94427_cP))))))); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + int var2 = par1Random.nextInt(10) - 7; + + if (var2 < 0) + { + var2 = 0; + } + + return var2; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.mushroomBrown.blockID + this.mushroomType; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Block.mushroomBrown.blockID + this.mushroomType; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[field_94429_a.length]; + + for (int var2 = 0; var2 < this.iconArray.length; ++var2) + { + this.iconArray[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_" + field_94429_a[var2]); + } + + this.field_94427_cP = par1IconRegister.registerIcon(this.getTextureName() + "_" + "inside"); + this.field_94426_cO = par1IconRegister.registerIcon(this.getTextureName() + "_" + "skin_stem"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockMycelium.java b/src/main/java/net/minecraft/src/BlockMycelium.java new file mode 100644 index 0000000..9af81f4 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockMycelium.java @@ -0,0 +1,105 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockMycelium extends Block +{ + private Icon field_94422_a; + private Icon field_94421_b; + + protected BlockMycelium(int par1) + { + super(par1, Material.grass); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.field_94422_a : (par1 == 0 ? Block.dirt.getBlockTextureFromSide(par1) : this.blockIcon); + } + + /** + * Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side + */ + public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + if (par5 == 1) + { + return this.field_94422_a; + } + else if (par5 == 0) + { + return Block.dirt.getBlockTextureFromSide(par5); + } + else + { + Material var6 = par1IBlockAccess.getBlockMaterial(par2, par3 + 1, par4); + return var6 != Material.snow && var6 != Material.craftedSnow ? this.blockIcon : this.field_94421_b; + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + this.field_94422_a = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.field_94421_b = par1IconRegister.registerIcon("grass_side_snowed"); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote) + { + if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2) + { + par1World.setBlock(par2, par3, par4, Block.dirt.blockID); + } + else if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) + { + for (int var6 = 0; var6 < 4; ++var6) + { + int var7 = par2 + par5Random.nextInt(3) - 1; + int var8 = par3 + par5Random.nextInt(5) - 3; + int var9 = par4 + par5Random.nextInt(3) - 1; + int var10 = par1World.getBlockId(var7, var8 + 1, var9); + + if (par1World.getBlockId(var7, var8, var9) == Block.dirt.blockID && par1World.getBlockLightValue(var7, var8 + 1, var9) >= 4 && Block.lightOpacity[var10] <= 2) + { + par1World.setBlock(var7, var8, var9, this.blockID); + } + } + } + } + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + super.randomDisplayTick(par1World, par2, par3, par4, par5Random); + + if (par5Random.nextInt(10) == 0) + { + par1World.spawnParticle("townaura", (double)((float)par2 + par5Random.nextFloat()), (double)((float)par3 + 1.1F), (double)((float)par4 + par5Random.nextFloat()), 0.0D, 0.0D, 0.0D); + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.dirt.idDropped(0, par2Random, par3); + } +} diff --git a/src/main/java/net/minecraft/src/BlockNetherStalk.java b/src/main/java/net/minecraft/src/BlockNetherStalk.java new file mode 100644 index 0000000..9ded3a5 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockNetherStalk.java @@ -0,0 +1,130 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockNetherStalk extends BlockFlower +{ + private Icon[] iconArray; + + protected BlockNetherStalk(int par1) + { + super(par1); + this.setTickRandomly(true); + float var2 = 0.5F; + this.setBlockBounds(0.5F - var2, 0.0F, 0.5F - var2, 0.5F + var2, 0.25F, 0.5F + var2); + this.setCreativeTab((CreativeTabs)null); + } + + /** + * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of + * blockID passed in. Args: blockID + */ + protected boolean canThisPlantGrowOnThisBlockID(int par1) + { + return par1 == Block.slowSand.blockID; + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) + { + return this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4)); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if (var6 < 3 && par5Random.nextInt(10) == 0) + { + ++var6; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 2); + } + + super.updateTick(par1World, par2, par3, par4, par5Random); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par2 >= 3 ? this.iconArray[2] : (par2 > 0 ? this.iconArray[1] : this.iconArray[0]); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 6; + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + if (!par1World.isRemote) + { + int var8 = 1; + + if (par5 >= 3) + { + var8 = 2 + par1World.rand.nextInt(3); + + if (par7 > 0) + { + var8 += par1World.rand.nextInt(par7 + 1); + } + } + + for (int var9 = 0; var9 < var8; ++var9) + { + this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.netherStalkSeeds)); + } + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return 0; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.netherStalkSeeds.itemID; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[3]; + + for (int var2 = 0; var2 < this.iconArray.length; ++var2) + { + this.iconArray[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + var2); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockNetherrack.java b/src/main/java/net/minecraft/src/BlockNetherrack.java new file mode 100644 index 0000000..1260f1e --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockNetherrack.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public class BlockNetherrack extends Block +{ + public BlockNetherrack(int par1) + { + super(par1, Material.rock); + this.setCreativeTab(CreativeTabs.tabBlock); + } +} diff --git a/src/main/java/net/minecraft/src/BlockNote.java b/src/main/java/net/minecraft/src/BlockNote.java new file mode 100644 index 0000000..20e7f37 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockNote.java @@ -0,0 +1,111 @@ +package net.minecraft.src; + +public class BlockNote extends BlockContainer +{ + public BlockNote(int par1) + { + super(par1, Material.wood); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + boolean var6 = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4); + TileEntityNote var7 = (TileEntityNote)par1World.getBlockTileEntity(par2, par3, par4); + + if (var7 != null && var7.previousRedstoneState != var6) + { + if (var6) + { + var7.triggerNote(par1World, par2, par3, par4); + } + + var7.previousRedstoneState = var6; + } + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + TileEntityNote var10 = (TileEntityNote)par1World.getBlockTileEntity(par2, par3, par4); + + if (var10 != null) + { + var10.changePitch(); + var10.triggerNote(par1World, par2, par3, par4); + } + + return true; + } + } + + /** + * Called when the block is clicked by a player. Args: x, y, z, entityPlayer + */ + public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) + { + if (!par1World.isRemote) + { + TileEntityNote var6 = (TileEntityNote)par1World.getBlockTileEntity(par2, par3, par4); + + if (var6 != null) + { + var6.triggerNote(par1World, par2, par3, par4); + } + } + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntityNote(); + } + + /** + * Called when the block receives a BlockEvent - see World.addBlockEvent. By default, passes it on to the tile + * entity at this location. Args: world, x, y, z, blockID, EventID, event parameter + */ + public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) + { + float var7 = (float)Math.pow(2.0D, (double)(par6 - 12) / 12.0D); + String var8 = "harp"; + + if (par5 == 1) + { + var8 = "bd"; + } + + if (par5 == 2) + { + var8 = "snare"; + } + + if (par5 == 3) + { + var8 = "hat"; + } + + if (par5 == 4) + { + var8 = "bassattack"; + } + + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "note." + var8, 3.0F, var7); + par1World.spawnParticle("note", (double)par2 + 0.5D, (double)par3 + 1.2D, (double)par4 + 0.5D, (double)par6 / 24.0D, 0.0D, 0.0D); + return true; + } +} diff --git a/src/main/java/net/minecraft/src/BlockObsidian.java b/src/main/java/net/minecraft/src/BlockObsidian.java new file mode 100644 index 0000000..d98d8e0 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockObsidian.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockObsidian extends BlockStone +{ + public BlockObsidian(int par1) + { + super(par1); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 1; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.obsidian.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockOre.java b/src/main/java/net/minecraft/src/BlockOre.java new file mode 100644 index 0000000..38abdf1 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockOre.java @@ -0,0 +1,94 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockOre extends Block +{ + public BlockOre(int par1) + { + super(par1, Material.rock); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return this.blockID == Block.oreCoal.blockID ? Item.coal.itemID : (this.blockID == Block.oreDiamond.blockID ? Item.diamond.itemID : (this.blockID == Block.oreLapis.blockID ? Item.dyePowder.itemID : (this.blockID == Block.oreEmerald.blockID ? Item.emerald.itemID : (this.blockID == Block.oreNetherQuartz.blockID ? Item.netherQuartz.itemID : this.blockID)))); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return this.blockID == Block.oreLapis.blockID ? 4 + par1Random.nextInt(5) : 1; + } + + /** + * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive). + */ + public int quantityDroppedWithBonus(int par1, Random par2Random) + { + if (par1 > 0 && this.blockID != this.idDropped(0, par2Random, par1)) + { + int var3 = par2Random.nextInt(par1 + 2) - 1; + + if (var3 < 0) + { + var3 = 0; + } + + return this.quantityDropped(par2Random) * (var3 + 1); + } + else + { + return this.quantityDropped(par2Random); + } + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); + + if (this.idDropped(par5, par1World.rand, par7) != this.blockID) + { + int var8 = 0; + + if (this.blockID == Block.oreCoal.blockID) + { + var8 = MathHelper.getRandomIntegerInRange(par1World.rand, 0, 2); + } + else if (this.blockID == Block.oreDiamond.blockID) + { + var8 = MathHelper.getRandomIntegerInRange(par1World.rand, 3, 7); + } + else if (this.blockID == Block.oreEmerald.blockID) + { + var8 = MathHelper.getRandomIntegerInRange(par1World.rand, 3, 7); + } + else if (this.blockID == Block.oreLapis.blockID) + { + var8 = MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5); + } + else if (this.blockID == Block.oreNetherQuartz.blockID) + { + var8 = MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5); + } + + this.dropXpOnBlockBreak(par1World, par2, par3, par4, var8); + } + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return this.blockID == Block.oreLapis.blockID ? 4 : 0; + } +} diff --git a/src/main/java/net/minecraft/src/BlockOreStorage.java b/src/main/java/net/minecraft/src/BlockOreStorage.java new file mode 100644 index 0000000..1740a5b --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockOreStorage.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public class BlockOreStorage extends Block +{ + public BlockOreStorage(int par1) + { + super(par1, Material.iron); + this.setCreativeTab(CreativeTabs.tabBlock); + } +} diff --git a/src/main/java/net/minecraft/src/BlockPane.java b/src/main/java/net/minecraft/src/BlockPane.java new file mode 100644 index 0000000..cf53abe --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockPane.java @@ -0,0 +1,225 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockPane extends Block +{ + /** + * Holds the texture index of the side of the pane (the thin lateral side) + */ + private final String sideTextureIndex; + + /** + * If this field is true, the pane block drops itself when destroyed (like the iron fences), otherwise, it's just + * destroyed (like glass panes) + */ + private final boolean canDropItself; + private final String field_94402_c; + private Icon theIcon; + + protected BlockPane(int par1, String par2Str, String par3Str, Material par4Material, boolean par5) + { + super(par1, par4Material); + this.sideTextureIndex = par3Str; + this.canDropItself = par5; + this.field_94402_c = par2Str; + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return !this.canDropItself ? 0 : super.idDropped(par1, par2Random, par3); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 18; + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + int var6 = par1IBlockAccess.getBlockId(par2, par3, par4); + return var6 == this.blockID ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + boolean var8 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 - 1)); + boolean var9 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 + 1)); + boolean var10 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 - 1, par3, par4)); + boolean var11 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 + 1, par3, par4)); + + if ((!var10 || !var11) && (var10 || var11 || var8 || var9)) + { + if (var10 && !var11) + { + this.setBlockBounds(0.0F, 0.0F, 0.4375F, 0.5F, 1.0F, 0.5625F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + else if (!var10 && var11) + { + this.setBlockBounds(0.5F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + + if ((!var8 || !var9) && (var10 || var11 || var8 || var9)) + { + if (var8 && !var9) + { + this.setBlockBounds(0.4375F, 0.0F, 0.0F, 0.5625F, 1.0F, 0.5F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + else if (!var8 && var9) + { + this.setBlockBounds(0.4375F, 0.0F, 0.5F, 0.5625F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + } + else + { + this.setBlockBounds(0.4375F, 0.0F, 0.0F, 0.5625F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + float var5 = 0.4375F; + float var6 = 0.5625F; + float var7 = 0.4375F; + float var8 = 0.5625F; + boolean var9 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 - 1)); + boolean var10 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 + 1)); + boolean var11 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 - 1, par3, par4)); + boolean var12 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 + 1, par3, par4)); + + if ((!var11 || !var12) && (var11 || var12 || var9 || var10)) + { + if (var11 && !var12) + { + var5 = 0.0F; + } + else if (!var11 && var12) + { + var6 = 1.0F; + } + } + else + { + var5 = 0.0F; + var6 = 1.0F; + } + + if ((!var9 || !var10) && (var11 || var12 || var9 || var10)) + { + if (var9 && !var10) + { + var7 = 0.0F; + } + else if (!var9 && var10) + { + var8 = 1.0F; + } + } + else + { + var7 = 0.0F; + var8 = 1.0F; + } + + this.setBlockBounds(var5, 0.0F, var7, var6, 1.0F, var8); + } + + /** + * Returns the texture index of the thin side of the pane. + */ + public Icon getSideTextureIndex() + { + return this.theIcon; + } + + /** + * Gets passed in the blockID of the block adjacent and supposed to return true if its allowed to connect to the + * type of blockID passed in. Args: blockID + */ + public final boolean canThisPaneConnectToThisBlockID(int par1) + { + return Block.opaqueCubeLookup[par1] || par1 == this.blockID || par1 == Block.glass.blockID; + } + + /** + * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops. + */ + protected boolean canSilkHarvest() + { + return true; + } + + /** + * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage + * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null. + */ + protected ItemStack createStackedBlock(int par1) + { + return new ItemStack(this.blockID, 1, par1); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.field_94402_c); + this.theIcon = par1IconRegister.registerIcon(this.sideTextureIndex); + } +} diff --git a/src/main/java/net/minecraft/src/BlockPistonBase.java b/src/main/java/net/minecraft/src/BlockPistonBase.java new file mode 100644 index 0000000..4f0e9e7 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockPistonBase.java @@ -0,0 +1,570 @@ +package net.minecraft.src; + +import java.util.List; + +public class BlockPistonBase extends Block +{ + /** This pistons is the sticky one? */ + private final boolean isSticky; + + /** Only visible when piston is extended */ + private Icon innerTopIcon; + + /** Bottom side texture */ + private Icon bottomIcon; + + /** Top icon of piston depends on (either sticky or normal) */ + private Icon topIcon; + + public BlockPistonBase(int par1, boolean par2) + { + super(par1, Material.piston); + this.isSticky = par2; + this.setStepSound(soundStoneFootstep); + this.setHardness(0.5F); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Return the either 106 or 107 as the texture index depending on the isSticky flag. This will actually never get + * called by TileEntityRendererPiston.renderPiston() because TileEntityPiston.shouldRenderHead() will always return + * false. + */ + public Icon getPistonExtensionTexture() + { + return this.topIcon; + } + + public void func_96479_b(float par1, float par2, float par3, float par4, float par5, float par6) + { + this.setBlockBounds(par1, par2, par3, par4, par5, par6); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + int var3 = getOrientation(par2); + return var3 > 5 ? this.topIcon : (par1 == var3 ? (!isExtended(par2) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.topIcon : this.innerTopIcon) : (par1 == Facing.oppositeSide[var3] ? this.bottomIcon : this.blockIcon)); + } + + public static Icon getPistonBaseIcon(String par0Str) + { + return par0Str == "piston_side" ? Block.pistonBase.blockIcon : (par0Str == "piston_top_normal" ? Block.pistonBase.topIcon : (par0Str == "piston_top_sticky" ? Block.pistonStickyBase.topIcon : (par0Str == "piston_inner" ? Block.pistonBase.innerTopIcon : null))); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon("piston_side"); + this.topIcon = par1IconRegister.registerIcon(this.isSticky ? "piston_top_sticky" : "piston_top_normal"); + this.innerTopIcon = par1IconRegister.registerIcon("piston_inner"); + this.bottomIcon = par1IconRegister.registerIcon("piston_bottom"); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 16; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + return false; + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 2); + + if (!par1World.isRemote) + { + this.updatePistonState(par1World, par2, par3, par4); + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isRemote) + { + this.updatePistonState(par1World, par2, par3, par4); + } + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + if (!par1World.isRemote && par1World.getBlockTileEntity(par2, par3, par4) == null) + { + this.updatePistonState(par1World, par2, par3, par4); + } + } + + /** + * handles attempts to extend or retract the piston. + */ + private void updatePistonState(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + int var6 = getOrientation(var5); + + if (var6 != 7) + { + boolean var7 = this.isIndirectlyPowered(par1World, par2, par3, par4, var6); + + if (var7 && !isExtended(var5)) + { + if (canExtend(par1World, par2, par3, par4, var6)) + { + par1World.addBlockEvent(par2, par3, par4, this.blockID, 0, var6); + } + } + else if (!var7 && isExtended(var5)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 2); + par1World.addBlockEvent(par2, par3, par4, this.blockID, 1, var6); + } + } + } + + /** + * checks the block to that side to see if it is indirectly powered. + */ + private boolean isIndirectlyPowered(World par1World, int par2, int par3, int par4, int par5) + { + return par5 != 0 && par1World.getIndirectPowerOutput(par2, par3 - 1, par4, 0) ? true : (par5 != 1 && par1World.getIndirectPowerOutput(par2, par3 + 1, par4, 1) ? true : (par5 != 2 && par1World.getIndirectPowerOutput(par2, par3, par4 - 1, 2) ? true : (par5 != 3 && par1World.getIndirectPowerOutput(par2, par3, par4 + 1, 3) ? true : (par5 != 5 && par1World.getIndirectPowerOutput(par2 + 1, par3, par4, 5) ? true : (par5 != 4 && par1World.getIndirectPowerOutput(par2 - 1, par3, par4, 4) ? true : (par1World.getIndirectPowerOutput(par2, par3, par4, 0) ? true : (par1World.getIndirectPowerOutput(par2, par3 + 2, par4, 1) ? true : (par1World.getIndirectPowerOutput(par2, par3 + 1, par4 - 1, 2) ? true : (par1World.getIndirectPowerOutput(par2, par3 + 1, par4 + 1, 3) ? true : (par1World.getIndirectPowerOutput(par2 - 1, par3 + 1, par4, 4) ? true : par1World.getIndirectPowerOutput(par2 + 1, par3 + 1, par4, 5))))))))))); + } + + /** + * Called when the block receives a BlockEvent - see World.addBlockEvent. By default, passes it on to the tile + * entity at this location. Args: world, x, y, z, blockID, EventID, event parameter + */ + public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) + { + if (!par1World.isRemote) + { + boolean var7 = this.isIndirectlyPowered(par1World, par2, par3, par4, par6); + + if (var7 && par5 == 1) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6 | 8, 2); + return false; + } + + if (!var7 && par5 == 0) + { + return false; + } + } + + if (par5 == 0) + { + if (!this.tryExtend(par1World, par2, par3, par4, par6)) + { + return false; + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6 | 8, 2); + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "tile.piston.out", 0.5F, par1World.rand.nextFloat() * 0.25F + 0.6F); + } + else if (par5 == 1) + { + TileEntity var16 = par1World.getBlockTileEntity(par2 + Facing.offsetsXForSide[par6], par3 + Facing.offsetsYForSide[par6], par4 + Facing.offsetsZForSide[par6]); + + if (var16 instanceof TileEntityPiston) + { + ((TileEntityPiston)var16).clearPistonTileEntity(); + } + + par1World.setBlock(par2, par3, par4, Block.pistonMoving.blockID, par6, 3); + par1World.setBlockTileEntity(par2, par3, par4, BlockPistonMoving.getTileEntity(this.blockID, par6, par6, false, true)); + + if (this.isSticky) + { + int var8 = par2 + Facing.offsetsXForSide[par6] * 2; + int var9 = par3 + Facing.offsetsYForSide[par6] * 2; + int var10 = par4 + Facing.offsetsZForSide[par6] * 2; + int var11 = par1World.getBlockId(var8, var9, var10); + int var12 = par1World.getBlockMetadata(var8, var9, var10); + boolean var13 = false; + + if (var11 == Block.pistonMoving.blockID) + { + TileEntity var14 = par1World.getBlockTileEntity(var8, var9, var10); + + if (var14 instanceof TileEntityPiston) + { + TileEntityPiston var15 = (TileEntityPiston)var14; + + if (var15.getPistonOrientation() == par6 && var15.isExtending()) + { + var15.clearPistonTileEntity(); + var11 = var15.getStoredBlockID(); + var12 = var15.getBlockMetadata(); + var13 = true; + } + } + } + + if (!var13 && var11 > 0 && canPushBlock(var11, par1World, var8, var9, var10, false) && (Block.blocksList[var11].getMobilityFlag() == 0 || var11 == Block.pistonBase.blockID || var11 == Block.pistonStickyBase.blockID)) + { + par2 += Facing.offsetsXForSide[par6]; + par3 += Facing.offsetsYForSide[par6]; + par4 += Facing.offsetsZForSide[par6]; + par1World.setBlock(par2, par3, par4, Block.pistonMoving.blockID, var12, 3); + par1World.setBlockTileEntity(par2, par3, par4, BlockPistonMoving.getTileEntity(var11, var12, par6, false, false)); + par1World.setBlockToAir(var8, var9, var10); + } + else if (!var13) + { + par1World.setBlockToAir(par2 + Facing.offsetsXForSide[par6], par3 + Facing.offsetsYForSide[par6], par4 + Facing.offsetsZForSide[par6]); + } + } + else + { + par1World.setBlockToAir(par2 + Facing.offsetsXForSide[par6], par3 + Facing.offsetsYForSide[par6], par4 + Facing.offsetsZForSide[par6]); + } + + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "tile.piston.in", 0.5F, par1World.rand.nextFloat() * 0.15F + 0.6F); + } + + return true; + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + + if (isExtended(var5)) + { + float var6 = 0.25F; + + switch (getOrientation(var5)) + { + case 0: + this.setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + + case 1: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F); + break; + + case 2: + this.setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 1.0F); + break; + + case 3: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.75F); + break; + + case 4: + this.setBlockBounds(0.25F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + + case 5: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.75F, 1.0F, 1.0F); + } + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * returns an int which describes the direction the piston faces + */ + public static int getOrientation(int par0) + { + return par0 & 7; + } + + /** + * Determine if the metadata is related to something powered. + */ + public static boolean isExtended(int par0) + { + return (par0 & 8) != 0; + } + + /** + * gets the way this piston should face for that entity that placed it. + */ + public static int determineOrientation(World par0World, int par1, int par2, int par3, EntityLivingBase par4EntityLivingBase) + { + if (MathHelper.abs((float)par4EntityLivingBase.posX - (float)par1) < 2.0F && MathHelper.abs((float)par4EntityLivingBase.posZ - (float)par3) < 2.0F) + { + double var5 = par4EntityLivingBase.posY + 1.82D - (double)par4EntityLivingBase.yOffset; + + if (var5 - (double)par2 > 2.0D) + { + return 1; + } + + if ((double)par2 - var5 > 0.0D) + { + return 0; + } + } + + int var7 = MathHelper.floor_double((double)(par4EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + return var7 == 0 ? 2 : (var7 == 1 ? 5 : (var7 == 2 ? 3 : (var7 == 3 ? 4 : 0))); + } + + /** + * returns true if the piston can push the specified block + */ + private static boolean canPushBlock(int par0, World par1World, int par2, int par3, int par4, boolean par5) + { + if (par0 == Block.obsidian.blockID) + { + return false; + } + else + { + if (par0 != Block.pistonBase.blockID && par0 != Block.pistonStickyBase.blockID) + { + if (Block.blocksList[par0].getBlockHardness(par1World, par2, par3, par4) == -1.0F) + { + return false; + } + + if (Block.blocksList[par0].getMobilityFlag() == 2) + { + return false; + } + + if (Block.blocksList[par0].getMobilityFlag() == 1) + { + if (!par5) + { + return false; + } + + return true; + } + } + else if (isExtended(par1World.getBlockMetadata(par2, par3, par4))) + { + return false; + } + + return !(Block.blocksList[par0] instanceof ITileEntityProvider); + } + } + + /** + * checks to see if this piston could push the blocks in front of it. + */ + private static boolean canExtend(World par0World, int par1, int par2, int par3, int par4) + { + int var5 = par1 + Facing.offsetsXForSide[par4]; + int var6 = par2 + Facing.offsetsYForSide[par4]; + int var7 = par3 + Facing.offsetsZForSide[par4]; + int var8 = 0; + + while (true) + { + if (var8 < 13) + { + if (var6 <= 0 || var6 >= 255) + { + return false; + } + + int var9 = par0World.getBlockId(var5, var6, var7); + + if (var9 != 0) + { + if (!canPushBlock(var9, par0World, var5, var6, var7, true)) + { + return false; + } + + if (Block.blocksList[var9].getMobilityFlag() != 1) + { + if (var8 == 12) + { + return false; + } + + var5 += Facing.offsetsXForSide[par4]; + var6 += Facing.offsetsYForSide[par4]; + var7 += Facing.offsetsZForSide[par4]; + ++var8; + continue; + } + } + } + + return true; + } + } + + /** + * attempts to extend the piston. returns false if impossible. + */ + private boolean tryExtend(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = par2 + Facing.offsetsXForSide[par5]; + int var7 = par3 + Facing.offsetsYForSide[par5]; + int var8 = par4 + Facing.offsetsZForSide[par5]; + int var9 = 0; + + while (true) + { + int var10; + + if (var9 < 13) + { + if (var7 <= 0 || var7 >= 255) + { + return false; + } + + var10 = par1World.getBlockId(var6, var7, var8); + + if (var10 != 0) + { + if (!canPushBlock(var10, par1World, var6, var7, var8, true)) + { + return false; + } + + if (Block.blocksList[var10].getMobilityFlag() != 1) + { + if (var9 == 12) + { + return false; + } + + var6 += Facing.offsetsXForSide[par5]; + var7 += Facing.offsetsYForSide[par5]; + var8 += Facing.offsetsZForSide[par5]; + ++var9; + continue; + } + + Block.blocksList[var10].dropBlockAsItem(par1World, var6, var7, var8, par1World.getBlockMetadata(var6, var7, var8), 0); + par1World.setBlockToAir(var6, var7, var8); + } + } + + var9 = var6; + var10 = var7; + int var11 = var8; + int var12 = 0; + int[] var13; + int var14; + int var15; + int var16; + + for (var13 = new int[13]; var6 != par2 || var7 != par3 || var8 != par4; var8 = var16) + { + var14 = var6 - Facing.offsetsXForSide[par5]; + var15 = var7 - Facing.offsetsYForSide[par5]; + var16 = var8 - Facing.offsetsZForSide[par5]; + int var17 = par1World.getBlockId(var14, var15, var16); + int var18 = par1World.getBlockMetadata(var14, var15, var16); + + if (var17 == this.blockID && var14 == par2 && var15 == par3 && var16 == par4) + { + par1World.setBlock(var6, var7, var8, Block.pistonMoving.blockID, par5 | (this.isSticky ? 8 : 0), 4); + par1World.setBlockTileEntity(var6, var7, var8, BlockPistonMoving.getTileEntity(Block.pistonExtension.blockID, par5 | (this.isSticky ? 8 : 0), par5, true, false)); + } + else + { + par1World.setBlock(var6, var7, var8, Block.pistonMoving.blockID, var18, 4); + par1World.setBlockTileEntity(var6, var7, var8, BlockPistonMoving.getTileEntity(var17, var18, par5, true, false)); + } + + var13[var12++] = var17; + var6 = var14; + var7 = var15; + } + + var6 = var9; + var7 = var10; + var8 = var11; + + for (var12 = 0; var6 != par2 || var7 != par3 || var8 != par4; var8 = var16) + { + var14 = var6 - Facing.offsetsXForSide[par5]; + var15 = var7 - Facing.offsetsYForSide[par5]; + var16 = var8 - Facing.offsetsZForSide[par5]; + par1World.notifyBlocksOfNeighborChange(var14, var15, var16, var13[var12++]); + var6 = var14; + var7 = var15; + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockPistonExtension.java b/src/main/java/net/minecraft/src/BlockPistonExtension.java new file mode 100644 index 0000000..cc275fd --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockPistonExtension.java @@ -0,0 +1,264 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockPistonExtension extends Block +{ + /** The texture for the 'head' of the piston. Sticky or normal. */ + private Icon headTexture; + + public BlockPistonExtension(int par1) + { + super(par1, Material.piston); + this.setStepSound(soundStoneFootstep); + this.setHardness(0.5F); + } + + public void setHeadTexture(Icon par1Icon) + { + this.headTexture = par1Icon; + } + + public void clearHeadTexture() + { + this.headTexture = null; + } + + /** + * Called when the block is attempted to be harvested + */ + public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) + { + if (par6EntityPlayer.capabilities.isCreativeMode) + { + int var7 = getDirectionMeta(par5); + int var8 = par1World.getBlockId(par2 - Facing.offsetsXForSide[var7], par3 - Facing.offsetsYForSide[var7], par4 - Facing.offsetsZForSide[var7]); + + if (var8 == Block.pistonBase.blockID || var8 == Block.pistonStickyBase.blockID) + { + par1World.setBlockToAir(par2 - Facing.offsetsXForSide[var7], par3 - Facing.offsetsYForSide[var7], par4 - Facing.offsetsZForSide[var7]); + } + } + + super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer); + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + super.breakBlock(par1World, par2, par3, par4, par5, par6); + int var7 = Facing.oppositeSide[getDirectionMeta(par6)]; + par2 += Facing.offsetsXForSide[var7]; + par3 += Facing.offsetsYForSide[var7]; + par4 += Facing.offsetsZForSide[var7]; + int var8 = par1World.getBlockId(par2, par3, par4); + + if (var8 == Block.pistonBase.blockID || var8 == Block.pistonStickyBase.blockID) + { + par6 = par1World.getBlockMetadata(par2, par3, par4); + + if (BlockPistonBase.isExtended(par6)) + { + Block.blocksList[var8].dropBlockAsItem(par1World, par2, par3, par4, par6, 0); + par1World.setBlockToAir(par2, par3, par4); + } + } + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + int var3 = getDirectionMeta(par2); + return par1 == var3 ? (this.headTexture != null ? this.headTexture : ((par2 & 8) != 0 ? BlockPistonBase.getPistonBaseIcon("piston_top_sticky") : BlockPistonBase.getPistonBaseIcon("piston_top_normal"))) : (var3 < 6 && par1 == Facing.oppositeSide[var3] ? BlockPistonBase.getPistonBaseIcon("piston_top_normal") : BlockPistonBase.getPistonBaseIcon("piston_side")); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) {} + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 17; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return false; + } + + /** + * checks to see if you can place this block can be placed on that side of a block: BlockLever overrides + */ + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + { + return false; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + int var8 = par1World.getBlockMetadata(par2, par3, par4); + float var9 = 0.25F; + float var10 = 0.375F; + float var11 = 0.625F; + float var12 = 0.25F; + float var13 = 0.75F; + + switch (getDirectionMeta(var8)) + { + case 0: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(0.375F, 0.25F, 0.375F, 0.625F, 1.0F, 0.625F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + break; + + case 1: + this.setBlockBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 0.75F, 0.625F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + break; + + case 2: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(0.25F, 0.375F, 0.25F, 0.75F, 0.625F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + break; + + case 3: + this.setBlockBounds(0.0F, 0.0F, 0.75F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(0.25F, 0.375F, 0.0F, 0.75F, 0.625F, 0.75F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + break; + + case 4: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(0.375F, 0.25F, 0.25F, 0.625F, 0.75F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + break; + + case 5: + this.setBlockBounds(0.75F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + this.setBlockBounds(0.0F, 0.375F, 0.25F, 0.75F, 0.625F, 0.75F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + float var6 = 0.25F; + + switch (getDirectionMeta(var5)) + { + case 0: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F); + break; + + case 1: + this.setBlockBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + + case 2: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.25F); + break; + + case 3: + this.setBlockBounds(0.0F, 0.0F, 0.75F, 1.0F, 1.0F, 1.0F); + break; + + case 4: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.25F, 1.0F, 1.0F); + break; + + case 5: + this.setBlockBounds(0.75F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = getDirectionMeta(par1World.getBlockMetadata(par2, par3, par4)); + int var7 = par1World.getBlockId(par2 - Facing.offsetsXForSide[var6], par3 - Facing.offsetsYForSide[var6], par4 - Facing.offsetsZForSide[var6]); + + if (var7 != Block.pistonBase.blockID && var7 != Block.pistonStickyBase.blockID) + { + par1World.setBlockToAir(par2, par3, par4); + } + else + { + Block.blocksList[var7].onNeighborBlockChange(par1World, par2 - Facing.offsetsXForSide[var6], par3 - Facing.offsetsYForSide[var6], par4 - Facing.offsetsZForSide[var6], par5); + } + } + + public static int getDirectionMeta(int par0) + { + return par0 & 7; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + return (var5 & 8) != 0 ? Block.pistonStickyBase.blockID : Block.pistonBase.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockPistonMoving.java b/src/main/java/net/minecraft/src/BlockPistonMoving.java new file mode 100644 index 0000000..b500b0f --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockPistonMoving.java @@ -0,0 +1,278 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockPistonMoving extends BlockContainer +{ + public BlockPistonMoving(int par1) + { + super(par1, Material.piston); + this.setHardness(-1.0F); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return null; + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) {} + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + TileEntity var7 = par1World.getBlockTileEntity(par2, par3, par4); + + if (var7 instanceof TileEntityPiston) + { + ((TileEntityPiston)var7).clearPistonTileEntity(); + } + else + { + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return false; + } + + /** + * checks to see if you can place this block can be placed on that side of a block: BlockLever overrides + */ + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return -1; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (!par1World.isRemote && par1World.getBlockTileEntity(par2, par3, par4) == null) + { + par1World.setBlockToAir(par2, par3, par4); + return true; + } + else + { + return false; + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return 0; + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + if (!par1World.isRemote) + { + TileEntityPiston var8 = this.getTileEntityAtLocation(par1World, par2, par3, par4); + + if (var8 != null) + { + Block.blocksList[var8.getStoredBlockID()].dropBlockAsItem(par1World, par2, par3, par4, var8.getBlockMetadata(), 0); + } + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isRemote) + { + par1World.getBlockTileEntity(par2, par3, par4); + } + } + + /** + * gets a new TileEntityPiston created with the arguments provided. + */ + public static TileEntity getTileEntity(int par0, int par1, int par2, boolean par3, boolean par4) + { + return new TileEntityPiston(par0, par1, par2, par3, par4); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + TileEntityPiston var5 = this.getTileEntityAtLocation(par1World, par2, par3, par4); + + if (var5 == null) + { + return null; + } + else + { + float var6 = var5.getProgress(0.0F); + + if (var5.isExtending()) + { + var6 = 1.0F - var6; + } + + return this.getAxisAlignedBB(par1World, par2, par3, par4, var5.getStoredBlockID(), var6, var5.getPistonOrientation()); + } + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + TileEntityPiston var5 = this.getTileEntityAtLocation(par1IBlockAccess, par2, par3, par4); + + if (var5 != null) + { + Block var6 = Block.blocksList[var5.getStoredBlockID()]; + + if (var6 == null || var6 == this) + { + return; + } + + var6.setBlockBoundsBasedOnState(par1IBlockAccess, par2, par3, par4); + float var7 = var5.getProgress(0.0F); + + if (var5.isExtending()) + { + var7 = 1.0F - var7; + } + + int var8 = var5.getPistonOrientation(); + this.minX = var6.getBlockBoundsMinX() - (double)((float)Facing.offsetsXForSide[var8] * var7); + this.minY = var6.getBlockBoundsMinY() - (double)((float)Facing.offsetsYForSide[var8] * var7); + this.minZ = var6.getBlockBoundsMinZ() - (double)((float)Facing.offsetsZForSide[var8] * var7); + this.maxX = var6.getBlockBoundsMaxX() - (double)((float)Facing.offsetsXForSide[var8] * var7); + this.maxY = var6.getBlockBoundsMaxY() - (double)((float)Facing.offsetsYForSide[var8] * var7); + this.maxZ = var6.getBlockBoundsMaxZ() - (double)((float)Facing.offsetsZForSide[var8] * var7); + } + } + + public AxisAlignedBB getAxisAlignedBB(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + if (par5 != 0 && par5 != this.blockID) + { + AxisAlignedBB var8 = Block.blocksList[par5].getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); + + if (var8 == null) + { + return null; + } + else + { + if (Facing.offsetsXForSide[par7] < 0) + { + var8.minX -= (double)((float)Facing.offsetsXForSide[par7] * par6); + } + else + { + var8.maxX -= (double)((float)Facing.offsetsXForSide[par7] * par6); + } + + if (Facing.offsetsYForSide[par7] < 0) + { + var8.minY -= (double)((float)Facing.offsetsYForSide[par7] * par6); + } + else + { + var8.maxY -= (double)((float)Facing.offsetsYForSide[par7] * par6); + } + + if (Facing.offsetsZForSide[par7] < 0) + { + var8.minZ -= (double)((float)Facing.offsetsZForSide[par7] * par6); + } + else + { + var8.maxZ -= (double)((float)Facing.offsetsZForSide[par7] * par6); + } + + return var8; + } + } + else + { + return null; + } + } + + /** + * gets the piston tile entity at the specified location + */ + private TileEntityPiston getTileEntityAtLocation(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + TileEntity var5 = par1IBlockAccess.getBlockTileEntity(par2, par3, par4); + return var5 instanceof TileEntityPiston ? (TileEntityPiston)var5 : null; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return 0; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon("piston_top_normal"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockPortal.java b/src/main/java/net/minecraft/src/BlockPortal.java new file mode 100644 index 0000000..000de52 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockPortal.java @@ -0,0 +1,312 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockPortal extends BlockBreakable +{ + public BlockPortal(int par1) + { + super(par1, "portal", Material.portal, false); + this.setTickRandomly(true); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + super.updateTick(par1World, par2, par3, par4, par5Random); + + if (par1World.provider.isSurfaceWorld() && par5Random.nextInt(2000) < par1World.difficultySetting) + { + int var6; + + for (var6 = par3; !par1World.doesBlockHaveSolidTopSurface(par2, var6, par4) && var6 > 0; --var6) + { + ; + } + + if (var6 > 0 && !par1World.isBlockNormalCube(par2, var6 + 1, par4)) + { + Entity var7 = ItemMonsterPlacer.spawnCreature(par1World, 57, (double)par2 + 0.5D, (double)var6 + 1.1D, (double)par4 + 0.5D); + + if (var7 != null) + { + var7.timeUntilPortal = var7.getPortalCooldown(); + } + } + } + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + float var5; + float var6; + + if (par1IBlockAccess.getBlockId(par2 - 1, par3, par4) != this.blockID && par1IBlockAccess.getBlockId(par2 + 1, par3, par4) != this.blockID) + { + var5 = 0.125F; + var6 = 0.5F; + this.setBlockBounds(0.5F - var5, 0.0F, 0.5F - var6, 0.5F + var5, 1.0F, 0.5F + var6); + } + else + { + var5 = 0.5F; + var6 = 0.125F; + this.setBlockBounds(0.5F - var5, 0.0F, 0.5F - var6, 0.5F + var5, 1.0F, 0.5F + var6); + } + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Checks to see if this location is valid to create a portal and will return True if it does. Args: world, x, y, z + */ + public boolean tryToCreatePortal(World par1World, int par2, int par3, int par4) + { + byte var5 = 0; + byte var6 = 0; + + if (par1World.getBlockId(par2 - 1, par3, par4) == Block.obsidian.blockID || par1World.getBlockId(par2 + 1, par3, par4) == Block.obsidian.blockID) + { + var5 = 1; + } + + if (par1World.getBlockId(par2, par3, par4 - 1) == Block.obsidian.blockID || par1World.getBlockId(par2, par3, par4 + 1) == Block.obsidian.blockID) + { + var6 = 1; + } + + if (var5 == var6) + { + return false; + } + else + { + if (par1World.getBlockId(par2 - var5, par3, par4 - var6) == 0) + { + par2 -= var5; + par4 -= var6; + } + + int var7; + int var8; + + for (var7 = -1; var7 <= 2; ++var7) + { + for (var8 = -1; var8 <= 3; ++var8) + { + boolean var9 = var7 == -1 || var7 == 2 || var8 == -1 || var8 == 3; + + if (var7 != -1 && var7 != 2 || var8 != -1 && var8 != 3) + { + int var10 = par1World.getBlockId(par2 + var5 * var7, par3 + var8, par4 + var6 * var7); + + if (var9) + { + if (var10 != Block.obsidian.blockID) + { + return false; + } + } + else if (var10 != 0 && var10 != Block.fire.blockID) + { + return false; + } + } + } + } + + for (var7 = 0; var7 < 2; ++var7) + { + for (var8 = 0; var8 < 3; ++var8) + { + par1World.setBlock(par2 + var5 * var7, par3 + var8, par4 + var6 * var7, Block.portal.blockID, 0, 2); + } + } + + return true; + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + byte var6 = 0; + byte var7 = 1; + + if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID) + { + var6 = 1; + var7 = 0; + } + + int var8; + + for (var8 = par3; par1World.getBlockId(par2, var8 - 1, par4) == this.blockID; --var8) + { + ; + } + + if (par1World.getBlockId(par2, var8 - 1, par4) != Block.obsidian.blockID) + { + par1World.setBlockToAir(par2, par3, par4); + } + else + { + int var9; + + for (var9 = 1; var9 < 4 && par1World.getBlockId(par2, var8 + var9, par4) == this.blockID; ++var9) + { + ; + } + + if (var9 == 3 && par1World.getBlockId(par2, var8 + var9, par4) == Block.obsidian.blockID) + { + boolean var10 = par1World.getBlockId(par2 - 1, par3, par4) == this.blockID || par1World.getBlockId(par2 + 1, par3, par4) == this.blockID; + boolean var11 = par1World.getBlockId(par2, par3, par4 - 1) == this.blockID || par1World.getBlockId(par2, par3, par4 + 1) == this.blockID; + + if (var10 && var11) + { + par1World.setBlockToAir(par2, par3, par4); + } + else + { + if ((par1World.getBlockId(par2 + var6, par3, par4 + var7) != Block.obsidian.blockID || par1World.getBlockId(par2 - var6, par3, par4 - var7) != this.blockID) && (par1World.getBlockId(par2 - var6, par3, par4 - var7) != Block.obsidian.blockID || par1World.getBlockId(par2 + var6, par3, par4 + var7) != this.blockID)) + { + par1World.setBlockToAir(par2, par3, par4); + } + } + } + else + { + par1World.setBlockToAir(par2, par3, par4); + } + } + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + if (par1IBlockAccess.getBlockId(par2, par3, par4) == this.blockID) + { + return false; + } + else + { + boolean var6 = par1IBlockAccess.getBlockId(par2 - 1, par3, par4) == this.blockID && par1IBlockAccess.getBlockId(par2 - 2, par3, par4) != this.blockID; + boolean var7 = par1IBlockAccess.getBlockId(par2 + 1, par3, par4) == this.blockID && par1IBlockAccess.getBlockId(par2 + 2, par3, par4) != this.blockID; + boolean var8 = par1IBlockAccess.getBlockId(par2, par3, par4 - 1) == this.blockID && par1IBlockAccess.getBlockId(par2, par3, par4 - 2) != this.blockID; + boolean var9 = par1IBlockAccess.getBlockId(par2, par3, par4 + 1) == this.blockID && par1IBlockAccess.getBlockId(par2, par3, par4 + 2) != this.blockID; + boolean var10 = var6 || var7; + boolean var11 = var8 || var9; + return var10 && par5 == 4 ? true : (var10 && par5 == 5 ? true : (var11 && par5 == 2 ? true : var11 && par5 == 3)); + } + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha + */ + public int getRenderBlockPass() + { + return 1; + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + if (par5Entity.ridingEntity == null && par5Entity.riddenByEntity == null) + { + par5Entity.setInPortal(); + } + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (par5Random.nextInt(100) == 0) + { + par1World.playSound((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D, "portal.portal", 0.5F, par5Random.nextFloat() * 0.4F + 0.8F, false); + } + + for (int var6 = 0; var6 < 4; ++var6) + { + double var7 = (double)((float)par2 + par5Random.nextFloat()); + double var9 = (double)((float)par3 + par5Random.nextFloat()); + double var11 = (double)((float)par4 + par5Random.nextFloat()); + double var13 = 0.0D; + double var15 = 0.0D; + double var17 = 0.0D; + int var19 = par5Random.nextInt(2) * 2 - 1; + var13 = ((double)par5Random.nextFloat() - 0.5D) * 0.5D; + var15 = ((double)par5Random.nextFloat() - 0.5D) * 0.5D; + var17 = ((double)par5Random.nextFloat() - 0.5D) * 0.5D; + + if (par1World.getBlockId(par2 - 1, par3, par4) != this.blockID && par1World.getBlockId(par2 + 1, par3, par4) != this.blockID) + { + var7 = (double)par2 + 0.5D + 0.25D * (double)var19; + var13 = (double)(par5Random.nextFloat() * 2.0F * (float)var19); + } + else + { + var11 = (double)par4 + 0.5D + 0.25D * (double)var19; + var17 = (double)(par5Random.nextFloat() * 2.0F * (float)var19); + } + + par1World.spawnParticle("portal", var7, var9, var11, var13, var15, var17); + } + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return 0; + } +} diff --git a/src/main/java/net/minecraft/src/BlockPotato.java b/src/main/java/net/minecraft/src/BlockPotato.java new file mode 100644 index 0000000..695eb72 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockPotato.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +public class BlockPotato extends BlockCrops +{ + private Icon[] iconArray; + + public BlockPotato(int par1) + { + super(par1); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + if (par2 < 7) + { + if (par2 == 6) + { + par2 = 5; + } + + return this.iconArray[par2 >> 1]; + } + else + { + return this.iconArray[3]; + } + } + + /** + * Generate a seed ItemStack for this crop. + */ + protected int getSeedItem() + { + return Item.potato.itemID; + } + + /** + * Generate a crop produce ItemStack for this crop. + */ + protected int getCropItem() + { + return Item.potato.itemID; + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); + + if (!par1World.isRemote) + { + if (par5 >= 7 && par1World.rand.nextInt(50) == 0) + { + this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.poisonousPotato)); + } + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[4]; + + for (int var2 = 0; var2 < this.iconArray.length; ++var2) + { + this.iconArray[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + var2); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockPoweredOre.java b/src/main/java/net/minecraft/src/BlockPoweredOre.java new file mode 100644 index 0000000..68d2059 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockPoweredOre.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +public class BlockPoweredOre extends BlockOreStorage +{ + public BlockPoweredOre(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return 15; + } +} diff --git a/src/main/java/net/minecraft/src/BlockPressurePlate.java b/src/main/java/net/minecraft/src/BlockPressurePlate.java new file mode 100644 index 0000000..aa134e9 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockPressurePlate.java @@ -0,0 +1,73 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class BlockPressurePlate extends BlockBasePressurePlate +{ + /** The mob type that can trigger this pressure plate. */ + private EnumMobType triggerMobType; + + protected BlockPressurePlate(int par1, String par2Str, Material par3Material, EnumMobType par4EnumMobType) + { + super(par1, par2Str, par3Material); + this.triggerMobType = par4EnumMobType; + } + + /** + * Argument is weight (0-15). Return the metadata to be set because of it. + */ + protected int getMetaFromWeight(int par1) + { + return par1 > 0 ? 1 : 0; + } + + /** + * Argument is metadata. Returns power level (0-15) + */ + protected int getPowerSupply(int par1) + { + return par1 == 1 ? 15 : 0; + } + + /** + * Returns the current state of the pressure plate. Returns a value between 0 and 15 based on the number of items on + * it. + */ + protected int getPlateState(World par1World, int par2, int par3, int par4) + { + List var5 = null; + + if (this.triggerMobType == EnumMobType.everything) + { + var5 = par1World.getEntitiesWithinAABBExcludingEntity((Entity)null, this.getSensitiveAABB(par2, par3, par4)); + } + + if (this.triggerMobType == EnumMobType.mobs) + { + var5 = par1World.getEntitiesWithinAABB(EntityLivingBase.class, this.getSensitiveAABB(par2, par3, par4)); + } + + if (this.triggerMobType == EnumMobType.players) + { + var5 = par1World.getEntitiesWithinAABB(EntityPlayer.class, this.getSensitiveAABB(par2, par3, par4)); + } + + if (var5 != null && !var5.isEmpty()) + { + Iterator var6 = var5.iterator(); + + while (var6.hasNext()) + { + Entity var7 = (Entity)var6.next(); + + if (!var7.doesEntityNotTriggerPressurePlate()) + { + return 15; + } + } + } + + return 0; + } +} diff --git a/src/main/java/net/minecraft/src/BlockPressurePlateWeighted.java b/src/main/java/net/minecraft/src/BlockPressurePlateWeighted.java new file mode 100644 index 0000000..684306e --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockPressurePlateWeighted.java @@ -0,0 +1,70 @@ +package net.minecraft.src; + +import java.util.Iterator; + +public class BlockPressurePlateWeighted extends BlockBasePressurePlate +{ + /** The maximum number of items the plate weights. */ + private final int maxItemsWeighted; + + protected BlockPressurePlateWeighted(int par1, String par2Str, Material par3Material, int par4) + { + super(par1, par2Str, par3Material); + this.maxItemsWeighted = par4; + } + + /** + * Returns the current state of the pressure plate. Returns a value between 0 and 15 based on the number of items on + * it. + */ + protected int getPlateState(World par1World, int par2, int par3, int par4) + { + int var5 = 0; + Iterator var6 = par1World.getEntitiesWithinAABB(EntityItem.class, this.getSensitiveAABB(par2, par3, par4)).iterator(); + + while (var6.hasNext()) + { + EntityItem var7 = (EntityItem)var6.next(); + var5 += var7.getEntityItem().stackSize; + + if (var5 >= this.maxItemsWeighted) + { + break; + } + } + + if (var5 <= 0) + { + return 0; + } + else + { + float var8 = (float)Math.min(this.maxItemsWeighted, var5) / (float)this.maxItemsWeighted; + return MathHelper.ceiling_float_int(var8 * 15.0F); + } + } + + /** + * Argument is metadata. Returns power level (0-15) + */ + protected int getPowerSupply(int par1) + { + return par1; + } + + /** + * Argument is weight (0-15). Return the metadata to be set because of it. + */ + protected int getMetaFromWeight(int par1) + { + return par1; + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 10; + } +} diff --git a/src/main/java/net/minecraft/src/BlockPumpkin.java b/src/main/java/net/minecraft/src/BlockPumpkin.java new file mode 100644 index 0000000..7243ed3 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockPumpkin.java @@ -0,0 +1,131 @@ +package net.minecraft.src; + +public class BlockPumpkin extends BlockDirectional +{ + /** Boolean used to seperate different states of blocks */ + private boolean blockType; + private Icon field_94474_b; + private Icon field_94475_c; + + protected BlockPumpkin(int par1, boolean par2) + { + super(par1, Material.pumpkin); + this.setTickRandomly(true); + this.blockType = par2; + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.field_94474_b : (par1 == 0 ? this.field_94474_b : (par2 == 2 && par1 == 2 ? this.field_94475_c : (par2 == 3 && par1 == 5 ? this.field_94475_c : (par2 == 0 && par1 == 3 ? this.field_94475_c : (par2 == 1 && par1 == 4 ? this.field_94475_c : this.blockIcon))))); + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + + if (par1World.getBlockId(par2, par3 - 1, par4) == Block.blockSnow.blockID && par1World.getBlockId(par2, par3 - 2, par4) == Block.blockSnow.blockID) + { + if (!par1World.isRemote) + { + par1World.setBlock(par2, par3, par4, 0, 0, 2); + par1World.setBlock(par2, par3 - 1, par4, 0, 0, 2); + par1World.setBlock(par2, par3 - 2, par4, 0, 0, 2); + EntitySnowman var9 = new EntitySnowman(par1World); + var9.setLocationAndAngles((double)par2 + 0.5D, (double)par3 - 1.95D, (double)par4 + 0.5D, 0.0F, 0.0F); + par1World.spawnEntityInWorld(var9); + par1World.notifyBlockChange(par2, par3, par4, 0); + par1World.notifyBlockChange(par2, par3 - 1, par4, 0); + par1World.notifyBlockChange(par2, par3 - 2, par4, 0); + } + + for (int var10 = 0; var10 < 120; ++var10) + { + par1World.spawnParticle("snowshovel", (double)par2 + par1World.rand.nextDouble(), (double)(par3 - 2) + par1World.rand.nextDouble() * 2.5D, (double)par4 + par1World.rand.nextDouble(), 0.0D, 0.0D, 0.0D); + } + } + else if (par1World.getBlockId(par2, par3 - 1, par4) == Block.blockIron.blockID && par1World.getBlockId(par2, par3 - 2, par4) == Block.blockIron.blockID) + { + boolean var5 = par1World.getBlockId(par2 - 1, par3 - 1, par4) == Block.blockIron.blockID && par1World.getBlockId(par2 + 1, par3 - 1, par4) == Block.blockIron.blockID; + boolean var6 = par1World.getBlockId(par2, par3 - 1, par4 - 1) == Block.blockIron.blockID && par1World.getBlockId(par2, par3 - 1, par4 + 1) == Block.blockIron.blockID; + + if (var5 || var6) + { + par1World.setBlock(par2, par3, par4, 0, 0, 2); + par1World.setBlock(par2, par3 - 1, par4, 0, 0, 2); + par1World.setBlock(par2, par3 - 2, par4, 0, 0, 2); + + if (var5) + { + par1World.setBlock(par2 - 1, par3 - 1, par4, 0, 0, 2); + par1World.setBlock(par2 + 1, par3 - 1, par4, 0, 0, 2); + } + else + { + par1World.setBlock(par2, par3 - 1, par4 - 1, 0, 0, 2); + par1World.setBlock(par2, par3 - 1, par4 + 1, 0, 0, 2); + } + + EntityIronGolem var7 = new EntityIronGolem(par1World); + var7.setPlayerCreated(true); + var7.setLocationAndAngles((double)par2 + 0.5D, (double)par3 - 1.95D, (double)par4 + 0.5D, 0.0F, 0.0F); + par1World.spawnEntityInWorld(var7); + + for (int var8 = 0; var8 < 120; ++var8) + { + par1World.spawnParticle("snowballpoof", (double)par2 + par1World.rand.nextDouble(), (double)(par3 - 2) + par1World.rand.nextDouble() * 3.9D, (double)par4 + par1World.rand.nextDouble(), 0.0D, 0.0D, 0.0D); + } + + par1World.notifyBlockChange(par2, par3, par4, 0); + par1World.notifyBlockChange(par2, par3 - 1, par4, 0); + par1World.notifyBlockChange(par2, par3 - 2, par4, 0); + + if (var5) + { + par1World.notifyBlockChange(par2 - 1, par3 - 1, par4, 0); + par1World.notifyBlockChange(par2 + 1, par3 - 1, par4, 0); + } + else + { + par1World.notifyBlockChange(par2, par3 - 1, par4 - 1, 0); + par1World.notifyBlockChange(par2, par3 - 1, par4 + 1, 0); + } + } + } + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockId(par2, par3, par4); + return (var5 == 0 || Block.blocksList[var5].blockMaterial.isReplaceable()) && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 2); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.field_94475_c = par1IconRegister.registerIcon(this.getTextureName() + "_face_" + (this.blockType ? "on" : "off")); + this.field_94474_b = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockQuartz.java b/src/main/java/net/minecraft/src/BlockQuartz.java new file mode 100644 index 0000000..f140fd1 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockQuartz.java @@ -0,0 +1,143 @@ +package net.minecraft.src; + +import java.util.List; + +public class BlockQuartz extends Block +{ + public static final String[] quartzBlockTypes = new String[] {"default", "chiseled", "lines"}; + private static final String[] quartzBlockTextureTypes = new String[] {"side", "chiseled", "lines", null, null}; + private Icon[] quartzblockIcons; + private Icon quartzblock_chiseled_top; + private Icon quartzblock_lines_top; + private Icon quartzblock_top; + private Icon quartzblock_bottom; + + public BlockQuartz(int par1) + { + super(par1, Material.rock); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + if (par2 != 2 && par2 != 3 && par2 != 4) + { + if (par1 != 1 && (par1 != 0 || par2 != 1)) + { + if (par1 == 0) + { + return this.quartzblock_bottom; + } + else + { + if (par2 < 0 || par2 >= this.quartzblockIcons.length) + { + par2 = 0; + } + + return this.quartzblockIcons[par2]; + } + } + else + { + return par2 == 1 ? this.quartzblock_chiseled_top : this.quartzblock_top; + } + } + else + { + return par2 == 2 && (par1 == 1 || par1 == 0) ? this.quartzblock_lines_top : (par2 == 3 && (par1 == 5 || par1 == 4) ? this.quartzblock_lines_top : (par2 == 4 && (par1 == 2 || par1 == 3) ? this.quartzblock_lines_top : this.quartzblockIcons[par2])); + } + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + if (par9 == 2) + { + switch (par5) + { + case 0: + case 1: + par9 = 2; + break; + + case 2: + case 3: + par9 = 4; + break; + + case 4: + case 5: + par9 = 3; + } + } + + return par9; + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1 != 3 && par1 != 4 ? par1 : 2; + } + + /** + * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage + * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null. + */ + protected ItemStack createStackedBlock(int par1) + { + return par1 != 3 && par1 != 4 ? super.createStackedBlock(par1) : new ItemStack(this.blockID, 1, 2); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 39; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.quartzblockIcons = new Icon[quartzBlockTextureTypes.length]; + + for (int var2 = 0; var2 < this.quartzblockIcons.length; ++var2) + { + if (quartzBlockTextureTypes[var2] == null) + { + this.quartzblockIcons[var2] = this.quartzblockIcons[var2 - 1]; + } + else + { + this.quartzblockIcons[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_" + quartzBlockTextureTypes[var2]); + } + } + + this.quartzblock_top = par1IconRegister.registerIcon(this.getTextureName() + "_" + "top"); + this.quartzblock_chiseled_top = par1IconRegister.registerIcon(this.getTextureName() + "_" + "chiseled_top"); + this.quartzblock_lines_top = par1IconRegister.registerIcon(this.getTextureName() + "_" + "lines_top"); + this.quartzblock_bottom = par1IconRegister.registerIcon(this.getTextureName() + "_" + "bottom"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockRail.java b/src/main/java/net/minecraft/src/BlockRail.java new file mode 100644 index 0000000..6852df9 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockRail.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +public class BlockRail extends BlockRailBase +{ + private Icon theIcon; + + protected BlockRail(int par1) + { + super(par1, false); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par2 >= 6 ? this.theIcon : this.blockIcon; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + super.registerIcons(par1IconRegister); + this.theIcon = par1IconRegister.registerIcon(this.getTextureName() + "_turned"); + } + + protected void func_94358_a(World par1World, int par2, int par3, int par4, int par5, int par6, int par7) + { + if (par7 > 0 && Block.blocksList[par7].canProvidePower() && (new BlockBaseRailLogic(this, par1World, par2, par3, par4)).getNumberOfAdjacentTracks() == 3) + { + this.refreshTrackShape(par1World, par2, par3, par4, false); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockRailBase.java b/src/main/java/net/minecraft/src/BlockRailBase.java new file mode 100644 index 0000000..50c32a3 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockRailBase.java @@ -0,0 +1,240 @@ +package net.minecraft.src; + +import java.util.Random; + +public abstract class BlockRailBase extends Block +{ + /** Power related rails have this field at true. */ + protected final boolean isPowered; + + /** + * Returns true if the block at the coordinates of world passed is a valid rail block (current is rail, powered or + * detector). + */ + public static final boolean isRailBlockAt(World par0World, int par1, int par2, int par3) + { + return isRailBlock(par0World.getBlockId(par1, par2, par3)); + } + + /** + * Return true if the parameter is a blockID for a valid rail block (current is rail, powered or detector). + */ + public static final boolean isRailBlock(int par0) + { + return par0 == Block.rail.blockID || par0 == Block.railPowered.blockID || par0 == Block.railDetector.blockID || par0 == Block.railActivator.blockID; + } + + protected BlockRailBase(int par1, boolean par2) + { + super(par1, Material.circuits); + this.isPowered = par2; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + this.setCreativeTab(CreativeTabs.tabTransport); + } + + /** + * Returns true if the block is power related rail. + */ + public boolean isPowered() + { + return this.isPowered; + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, + * x, y, z, startVec, endVec + */ + public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + + if (var5 >= 2 && var5 <= 5) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + } + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 9; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 1; + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + if (!par1World.isRemote) + { + this.refreshTrackShape(par1World, par2, par3, par4, true); + + if (this.isPowered) + { + this.onNeighborBlockChange(par1World, par2, par3, par4, this.blockID); + } + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isRemote) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + int var7 = var6; + + if (this.isPowered) + { + var7 = var6 & 7; + } + + boolean var8 = false; + + if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4)) + { + var8 = true; + } + + if (var7 == 2 && !par1World.doesBlockHaveSolidTopSurface(par2 + 1, par3, par4)) + { + var8 = true; + } + + if (var7 == 3 && !par1World.doesBlockHaveSolidTopSurface(par2 - 1, par3, par4)) + { + var8 = true; + } + + if (var7 == 4 && !par1World.doesBlockHaveSolidTopSurface(par2, par3, par4 - 1)) + { + var8 = true; + } + + if (var7 == 5 && !par1World.doesBlockHaveSolidTopSurface(par2, par3, par4 + 1)) + { + var8 = true; + } + + if (var8) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + else + { + this.func_94358_a(par1World, par2, par3, par4, var6, var7, par5); + } + } + } + + protected void func_94358_a(World par1World, int par2, int par3, int par4, int par5, int par6, int par7) {} + + /** + * Completely recalculates the track shape based on neighboring tracks + */ + protected void refreshTrackShape(World par1World, int par2, int par3, int par4, boolean par5) + { + if (!par1World.isRemote) + { + (new BlockBaseRailLogic(this, par1World, par2, par3, par4)).func_94511_a(par1World.isBlockIndirectlyGettingPowered(par2, par3, par4), par5); + } + } + + /** + * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility + * and stop pistons + */ + public int getMobilityFlag() + { + return 0; + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + int var7 = par6; + + if (this.isPowered) + { + var7 = par6 & 7; + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + + if (var7 == 2 || var7 == 3 || var7 == 4 || var7 == 5) + { + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, par5); + } + + if (this.isPowered) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, par5); + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, par5); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockRailPowered.java b/src/main/java/net/minecraft/src/BlockRailPowered.java new file mode 100644 index 0000000..4ed5358 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockRailPowered.java @@ -0,0 +1,191 @@ +package net.minecraft.src; + +public class BlockRailPowered extends BlockRailBase +{ + protected Icon theIcon; + + protected BlockRailPowered(int par1) + { + super(par1, true); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return (par2 & 8) == 0 ? this.blockIcon : this.theIcon; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + super.registerIcons(par1IconRegister); + this.theIcon = par1IconRegister.registerIcon(this.getTextureName() + "_powered"); + } + + protected boolean func_94360_a(World par1World, int par2, int par3, int par4, int par5, boolean par6, int par7) + { + if (par7 >= 8) + { + return false; + } + else + { + int var8 = par5 & 7; + boolean var9 = true; + + switch (var8) + { + case 0: + if (par6) + { + ++par4; + } + else + { + --par4; + } + + break; + + case 1: + if (par6) + { + --par2; + } + else + { + ++par2; + } + + break; + + case 2: + if (par6) + { + --par2; + } + else + { + ++par2; + ++par3; + var9 = false; + } + + var8 = 1; + break; + + case 3: + if (par6) + { + --par2; + ++par3; + var9 = false; + } + else + { + ++par2; + } + + var8 = 1; + break; + + case 4: + if (par6) + { + ++par4; + } + else + { + --par4; + ++par3; + var9 = false; + } + + var8 = 0; + break; + + case 5: + if (par6) + { + ++par4; + ++par3; + var9 = false; + } + else + { + --par4; + } + + var8 = 0; + } + + return this.func_94361_a(par1World, par2, par3, par4, par6, par7, var8) ? true : var9 && this.func_94361_a(par1World, par2, par3 - 1, par4, par6, par7, var8); + } + } + + protected boolean func_94361_a(World par1World, int par2, int par3, int par4, boolean par5, int par6, int par7) + { + int var8 = par1World.getBlockId(par2, par3, par4); + + if (var8 == this.blockID) + { + int var9 = par1World.getBlockMetadata(par2, par3, par4); + int var10 = var9 & 7; + + if (par7 == 1 && (var10 == 0 || var10 == 4 || var10 == 5)) + { + return false; + } + + if (par7 == 0 && (var10 == 1 || var10 == 2 || var10 == 3)) + { + return false; + } + + if ((var9 & 8) != 0) + { + if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) + { + return true; + } + + return this.func_94360_a(par1World, par2, par3, par4, var9, par5, par6 + 1); + } + } + + return false; + } + + protected void func_94358_a(World par1World, int par2, int par3, int par4, int par5, int par6, int par7) + { + boolean var8 = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4); + var8 = var8 || this.func_94360_a(par1World, par2, par3, par4, par5, true, 0) || this.func_94360_a(par1World, par2, par3, par4, par5, false, 0); + boolean var9 = false; + + if (var8 && (par5 & 8) == 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6 | 8, 3); + var9 = true; + } + else if (!var8 && (par5 & 8) != 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6, 3); + var9 = true; + } + + if (var9) + { + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + + if (par6 == 2 || par6 == 3 || par6 == 4 || par6 == 5) + { + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockRedstoneLight.java b/src/main/java/net/minecraft/src/BlockRedstoneLight.java new file mode 100644 index 0000000..61c2ab6 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockRedstoneLight.java @@ -0,0 +1,84 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockRedstoneLight extends Block +{ + /** Whether this lamp block is the powered version. */ + private final boolean powered; + + public BlockRedstoneLight(int par1, boolean par2) + { + super(par1, Material.redstoneLight); + this.powered = par2; + + if (par2) + { + this.setLightValue(1.0F); + } + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + if (!par1World.isRemote) + { + if (this.powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 4); + } + else if (!this.powered && par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) + { + par1World.setBlock(par2, par3, par4, Block.redstoneLampActive.blockID, 0, 2); + } + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isRemote) + { + if (this.powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 4); + } + else if (!this.powered && par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) + { + par1World.setBlock(par2, par3, par4, Block.redstoneLampActive.blockID, 0, 2); + } + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote && this.powered && !par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) + { + par1World.setBlock(par2, par3, par4, Block.redstoneLampIdle.blockID, 0, 2); + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.redstoneLampIdle.blockID; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Block.redstoneLampIdle.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockRedstoneLogic.java b/src/main/java/net/minecraft/src/BlockRedstoneLogic.java new file mode 100644 index 0000000..5977e9d --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockRedstoneLogic.java @@ -0,0 +1,366 @@ +package net.minecraft.src; + +import java.util.Random; + +public abstract class BlockRedstoneLogic extends BlockDirectional +{ + /** Tells whether the repeater is powered or not */ + protected final boolean isRepeaterPowered; + + protected BlockRedstoneLogic(int par1, boolean par2) + { + super(par1, Material.circuits); + this.isRepeaterPowered = par2; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? false : super.canPlaceBlockAt(par1World, par2, par3, par4); + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) + { + return !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? false : super.canBlockStay(par1World, par2, par3, par4); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if (!this.func_94476_e(par1World, par2, par3, par4, var6)) + { + boolean var7 = this.isGettingInput(par1World, par2, par3, par4, var6); + + if (this.isRepeaterPowered && !var7) + { + par1World.setBlock(par2, par3, par4, this.func_94484_i().blockID, var6, 2); + } + else if (!this.isRepeaterPowered) + { + par1World.setBlock(par2, par3, par4, this.func_94485_e().blockID, var6, 2); + + if (!var7) + { + par1World.scheduleBlockUpdateWithPriority(par2, par3, par4, this.func_94485_e().blockID, this.func_94486_g(var6), -1); + } + } + } + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 0 ? (this.isRepeaterPowered ? Block.torchRedstoneActive.getBlockTextureFromSide(par1) : Block.torchRedstoneIdle.getBlockTextureFromSide(par1)) : (par1 == 1 ? this.blockIcon : Block.stoneDoubleSlab.getBlockTextureFromSide(1)); + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return par5 != 0 && par5 != 1; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 36; + } + + protected boolean func_96470_c(int par1) + { + return this.isRepeaterPowered; + } + + /** + * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, + * side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return this.isProvidingWeakPower(par1IBlockAccess, par2, par3, par4, par5); + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + + if (!this.func_96470_c(var6)) + { + return 0; + } + else + { + int var7 = getDirection(var6); + return var7 == 0 && par5 == 3 ? this.func_94480_d(par1IBlockAccess, par2, par3, par4, var6) : (var7 == 1 && par5 == 4 ? this.func_94480_d(par1IBlockAccess, par2, par3, par4, var6) : (var7 == 2 && par5 == 2 ? this.func_94480_d(par1IBlockAccess, par2, par3, par4, var6) : (var7 == 3 && par5 == 5 ? this.func_94480_d(par1IBlockAccess, par2, par3, par4, var6) : 0))); + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!this.canBlockStay(par1World, par2, par3, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID); + } + else + { + this.func_94479_f(par1World, par2, par3, par4, par5); + } + } + + protected void func_94479_f(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if (!this.func_94476_e(par1World, par2, par3, par4, var6)) + { + boolean var7 = this.isGettingInput(par1World, par2, par3, par4, var6); + + if ((this.isRepeaterPowered && !var7 || !this.isRepeaterPowered && var7) && !par1World.isBlockTickScheduledThisTick(par2, par3, par4, this.blockID)) + { + byte var8 = -1; + + if (this.func_83011_d(par1World, par2, par3, par4, var6)) + { + var8 = -3; + } + else if (this.isRepeaterPowered) + { + var8 = -2; + } + + par1World.scheduleBlockUpdateWithPriority(par2, par3, par4, this.blockID, this.func_94481_j_(var6), var8); + } + } + } + + public boolean func_94476_e(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return false; + } + + protected boolean isGettingInput(World par1World, int par2, int par3, int par4, int par5) + { + return this.getInputStrength(par1World, par2, par3, par4, par5) > 0; + } + + /** + * Returns the signal strength at one input of the block. Args: world, X, Y, Z, side + */ + protected int getInputStrength(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = getDirection(par5); + int var7 = par2 + Direction.offsetX[var6]; + int var8 = par4 + Direction.offsetZ[var6]; + int var9 = par1World.getIndirectPowerLevelTo(var7, par3, var8, Direction.directionToFacing[var6]); + return var9 >= 15 ? var9 : Math.max(var9, par1World.getBlockId(var7, par3, var8) == Block.redstoneWire.blockID ? par1World.getBlockMetadata(var7, par3, var8) : 0); + } + + protected int func_94482_f(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + int var6 = getDirection(par5); + + switch (var6) + { + case 0: + case 2: + return Math.max(this.func_94488_g(par1IBlockAccess, par2 - 1, par3, par4, 4), this.func_94488_g(par1IBlockAccess, par2 + 1, par3, par4, 5)); + + case 1: + case 3: + return Math.max(this.func_94488_g(par1IBlockAccess, par2, par3, par4 + 1, 3), this.func_94488_g(par1IBlockAccess, par2, par3, par4 - 1, 2)); + + default: + return 0; + } + } + + protected int func_94488_g(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + int var6 = par1IBlockAccess.getBlockId(par2, par3, par4); + return this.func_94477_d(var6) ? (var6 == Block.redstoneWire.blockID ? par1IBlockAccess.getBlockMetadata(par2, par3, par4) : par1IBlockAccess.isBlockProvidingPowerTo(par2, par3, par4, par5)) : 0; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = ((MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 3); + boolean var8 = this.isGettingInput(par1World, par2, par3, par4, var7); + + if (var8) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, 1); + } + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + this.func_94483_i_(par1World, par2, par3, par4); + } + + protected void func_94483_i_(World par1World, int par2, int par3, int par4) + { + int var5 = getDirection(par1World.getBlockMetadata(par2, par3, par4)); + + if (var5 == 1) + { + par1World.notifyBlockOfNeighborChange(par2 + 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID, 4); + } + + if (var5 == 3) + { + par1World.notifyBlockOfNeighborChange(par2 - 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID, 5); + } + + if (var5 == 2) + { + par1World.notifyBlockOfNeighborChange(par2, par3, par4 + 1, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID, 2); + } + + if (var5 == 0) + { + par1World.notifyBlockOfNeighborChange(par2, par3, par4 - 1, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID, 3); + } + } + + /** + * Called right before the block is destroyed by a player. Args: world, x, y, z, metaData + */ + public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) + { + if (this.isRepeaterPowered) + { + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID); + } + + super.onBlockDestroyedByPlayer(par1World, par2, par3, par4, par5); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + protected boolean func_94477_d(int par1) + { + Block var2 = Block.blocksList[par1]; + return var2 != null && var2.canProvidePower(); + } + + protected int func_94480_d(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return 15; + } + + public static boolean isRedstoneRepeaterBlockID(int par0) + { + return Block.redstoneRepeaterIdle.func_94487_f(par0) || Block.redstoneComparatorIdle.func_94487_f(par0); + } + + public boolean func_94487_f(int par1) + { + return par1 == this.func_94485_e().blockID || par1 == this.func_94484_i().blockID; + } + + public boolean func_83011_d(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = getDirection(par5); + + if (isRedstoneRepeaterBlockID(par1World.getBlockId(par2 - Direction.offsetX[var6], par3, par4 - Direction.offsetZ[var6]))) + { + int var7 = par1World.getBlockMetadata(par2 - Direction.offsetX[var6], par3, par4 - Direction.offsetZ[var6]); + int var8 = getDirection(var7); + return var8 != var6; + } + else + { + return false; + } + } + + protected int func_94486_g(int par1) + { + return this.func_94481_j_(par1); + } + + protected abstract int func_94481_j_(int var1); + + protected abstract BlockRedstoneLogic func_94485_e(); + + protected abstract BlockRedstoneLogic func_94484_i(); + + /** + * Returns true if the given block ID is equivalent to this one. Example: redstoneTorchOn matches itself and + * redstoneTorchOff, and vice versa. Most blocks only match themselves. + */ + public boolean isAssociatedBlockID(int par1) + { + return this.func_94487_f(par1); + } +} diff --git a/src/main/java/net/minecraft/src/BlockRedstoneOre.java b/src/main/java/net/minecraft/src/BlockRedstoneOre.java new file mode 100644 index 0000000..4249bfe --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockRedstoneOre.java @@ -0,0 +1,188 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockRedstoneOre extends Block +{ + private boolean glowing; + + public BlockRedstoneOre(int par1, boolean par2) + { + super(par1, Material.rock); + + if (par2) + { + this.setTickRandomly(true); + } + + this.glowing = par2; + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 30; + } + + /** + * Called when the block is clicked by a player. Args: x, y, z, entityPlayer + */ + public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) + { + this.glow(par1World, par2, par3, par4); + super.onBlockClicked(par1World, par2, par3, par4, par5EntityPlayer); + } + + /** + * Called whenever an entity is walking on top of this block. Args: world, x, y, z, entity + */ + public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + this.glow(par1World, par2, par3, par4); + super.onEntityWalking(par1World, par2, par3, par4, par5Entity); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + this.glow(par1World, par2, par3, par4); + return super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9); + } + + /** + * The redstone ore glows. + */ + private void glow(World par1World, int par2, int par3, int par4) + { + this.sparkle(par1World, par2, par3, par4); + + if (this.blockID == Block.oreRedstone.blockID) + { + par1World.setBlock(par2, par3, par4, Block.oreRedstoneGlowing.blockID); + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (this.blockID == Block.oreRedstoneGlowing.blockID) + { + par1World.setBlock(par2, par3, par4, Block.oreRedstone.blockID); + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.redstone.itemID; + } + + /** + * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive). + */ + public int quantityDroppedWithBonus(int par1, Random par2Random) + { + return this.quantityDropped(par2Random) + par2Random.nextInt(par1 + 1); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 4 + par1Random.nextInt(2); + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); + + if (this.idDropped(par5, par1World.rand, par7) != this.blockID) + { + int var8 = 1 + par1World.rand.nextInt(5); + this.dropXpOnBlockBreak(par1World, par2, par3, par4, var8); + } + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (this.glowing) + { + this.sparkle(par1World, par2, par3, par4); + } + } + + /** + * The redstone ore sparkles. + */ + private void sparkle(World par1World, int par2, int par3, int par4) + { + Random var5 = par1World.rand; + double var6 = 0.0625D; + + for (int var8 = 0; var8 < 6; ++var8) + { + double var9 = (double)((float)par2 + var5.nextFloat()); + double var11 = (double)((float)par3 + var5.nextFloat()); + double var13 = (double)((float)par4 + var5.nextFloat()); + + if (var8 == 0 && !par1World.isBlockOpaqueCube(par2, par3 + 1, par4)) + { + var11 = (double)(par3 + 1) + var6; + } + + if (var8 == 1 && !par1World.isBlockOpaqueCube(par2, par3 - 1, par4)) + { + var11 = (double)(par3 + 0) - var6; + } + + if (var8 == 2 && !par1World.isBlockOpaqueCube(par2, par3, par4 + 1)) + { + var13 = (double)(par4 + 1) + var6; + } + + if (var8 == 3 && !par1World.isBlockOpaqueCube(par2, par3, par4 - 1)) + { + var13 = (double)(par4 + 0) - var6; + } + + if (var8 == 4 && !par1World.isBlockOpaqueCube(par2 + 1, par3, par4)) + { + var9 = (double)(par2 + 1) + var6; + } + + if (var8 == 5 && !par1World.isBlockOpaqueCube(par2 - 1, par3, par4)) + { + var9 = (double)(par2 + 0) - var6; + } + + if (var9 < (double)par2 || var9 > (double)(par2 + 1) || var11 < 0.0D || var11 > (double)(par3 + 1) || var13 < (double)par4 || var13 > (double)(par4 + 1)) + { + par1World.spawnParticle("reddust", var9, var11, var13, 0.0D, 0.0D, 0.0D); + } + } + } + + /** + * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage + * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null. + */ + protected ItemStack createStackedBlock(int par1) + { + return new ItemStack(Block.oreRedstone); + } +} diff --git a/src/main/java/net/minecraft/src/BlockRedstoneRepeater.java b/src/main/java/net/minecraft/src/BlockRedstoneRepeater.java new file mode 100644 index 0000000..9ef77bd --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockRedstoneRepeater.java @@ -0,0 +1,151 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockRedstoneRepeater extends BlockRedstoneLogic +{ + /** The offsets for the two torches in redstone repeater blocks. */ + public static final double[] repeaterTorchOffset = new double[] { -0.0625D, 0.0625D, 0.1875D, 0.3125D}; + + /** The states in which the redstone repeater blocks can be. */ + private static final int[] repeaterState = new int[] {1, 2, 3, 4}; + + protected BlockRedstoneRepeater(int par1, boolean par2) + { + super(par1, par2); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + int var10 = par1World.getBlockMetadata(par2, par3, par4); + int var11 = (var10 & 12) >> 2; + var11 = var11 + 1 << 2 & 12; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var11 | var10 & 3, 3); + return true; + } + + protected int func_94481_j_(int par1) + { + return repeaterState[(par1 & 12) >> 2] * 2; + } + + protected BlockRedstoneLogic func_94485_e() + { + return Block.redstoneRepeaterActive; + } + + protected BlockRedstoneLogic func_94484_i() + { + return Block.redstoneRepeaterIdle; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.redstoneRepeater.itemID; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.redstoneRepeater.itemID; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 15; + } + + public boolean func_94476_e(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return this.func_94482_f(par1IBlockAccess, par2, par3, par4, par5) > 0; + } + + protected boolean func_94477_d(int par1) + { + return isRedstoneRepeaterBlockID(par1); + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (this.isRepeaterPowered) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + int var7 = getDirection(var6); + double var8 = (double)((float)par2 + 0.5F) + (double)(par5Random.nextFloat() - 0.5F) * 0.2D; + double var10 = (double)((float)par3 + 0.4F) + (double)(par5Random.nextFloat() - 0.5F) * 0.2D; + double var12 = (double)((float)par4 + 0.5F) + (double)(par5Random.nextFloat() - 0.5F) * 0.2D; + double var14 = 0.0D; + double var16 = 0.0D; + + if (par5Random.nextInt(2) == 0) + { + switch (var7) + { + case 0: + var16 = -0.3125D; + break; + + case 1: + var14 = 0.3125D; + break; + + case 2: + var16 = 0.3125D; + break; + + case 3: + var14 = -0.3125D; + } + } + else + { + int var18 = (var6 & 12) >> 2; + + switch (var7) + { + case 0: + var16 = repeaterTorchOffset[var18]; + break; + + case 1: + var14 = -repeaterTorchOffset[var18]; + break; + + case 2: + var16 = -repeaterTorchOffset[var18]; + break; + + case 3: + var14 = repeaterTorchOffset[var18]; + } + } + + par1World.spawnParticle("reddust", var8 + var14, var10, var12 + var16, 0.0D, 0.0D, 0.0D); + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + super.breakBlock(par1World, par2, par3, par4, par5, par6); + this.func_94483_i_(par1World, par2, par3, par4); + } +} diff --git a/src/main/java/net/minecraft/src/BlockRedstoneTorch.java b/src/main/java/net/minecraft/src/BlockRedstoneTorch.java new file mode 100644 index 0000000..075ce35 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockRedstoneTorch.java @@ -0,0 +1,267 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public class BlockRedstoneTorch extends BlockTorch +{ + /** Whether the redstone torch is currently active or not. */ + private boolean torchActive; + + /** Map of ArrayLists of RedstoneUpdateInfo. Key of map is World. */ + private static Map redstoneUpdateInfoCache = new HashMap(); + + private boolean checkForBurnout(World par1World, int par2, int par3, int par4, boolean par5) + { + if (!redstoneUpdateInfoCache.containsKey(par1World)) + { + redstoneUpdateInfoCache.put(par1World, new ArrayList()); + } + + List var6 = (List)redstoneUpdateInfoCache.get(par1World); + + if (par5) + { + var6.add(new RedstoneUpdateInfo(par2, par3, par4, par1World.getTotalWorldTime())); + } + + int var7 = 0; + + for (int var8 = 0; var8 < var6.size(); ++var8) + { + RedstoneUpdateInfo var9 = (RedstoneUpdateInfo)var6.get(var8); + + if (var9.x == par2 && var9.y == par3 && var9.z == par4) + { + ++var7; + + if (var7 >= 8) + { + return true; + } + } + } + + return false; + } + + protected BlockRedstoneTorch(int par1, boolean par2) + { + super(par1); + this.torchActive = par2; + this.setTickRandomly(true); + this.setCreativeTab((CreativeTabs)null); + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 2; + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + if (par1World.getBlockMetadata(par2, par3, par4) == 0) + { + super.onBlockAdded(par1World, par2, par3, par4); + } + + if (this.torchActive) + { + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID); + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + if (this.torchActive) + { + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID); + } + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + if (!this.torchActive) + { + return 0; + } + else + { + int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + return var6 == 5 && par5 == 1 ? 0 : (var6 == 3 && par5 == 3 ? 0 : (var6 == 4 && par5 == 2 ? 0 : (var6 == 1 && par5 == 5 ? 0 : (var6 == 2 && par5 == 4 ? 0 : 15)))); + } + } + + /** + * Returns true or false based on whether the block the torch is attached to is providing indirect power. + */ + private boolean isIndirectlyPowered(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + return var5 == 5 && par1World.getIndirectPowerOutput(par2, par3 - 1, par4, 0) ? true : (var5 == 3 && par1World.getIndirectPowerOutput(par2, par3, par4 - 1, 2) ? true : (var5 == 4 && par1World.getIndirectPowerOutput(par2, par3, par4 + 1, 3) ? true : (var5 == 1 && par1World.getIndirectPowerOutput(par2 - 1, par3, par4, 4) ? true : var5 == 2 && par1World.getIndirectPowerOutput(par2 + 1, par3, par4, 5)))); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + boolean var6 = this.isIndirectlyPowered(par1World, par2, par3, par4); + List var7 = (List)redstoneUpdateInfoCache.get(par1World); + + while (var7 != null && !var7.isEmpty() && par1World.getTotalWorldTime() - ((RedstoneUpdateInfo)var7.get(0)).updateTime > 60L) + { + var7.remove(0); + } + + if (this.torchActive) + { + if (var6) + { + par1World.setBlock(par2, par3, par4, Block.torchRedstoneIdle.blockID, par1World.getBlockMetadata(par2, par3, par4), 3); + + if (this.checkForBurnout(par1World, par2, par3, par4, true)) + { + par1World.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F); + + for (int var8 = 0; var8 < 5; ++var8) + { + double var9 = (double)par2 + par5Random.nextDouble() * 0.6D + 0.2D; + double var11 = (double)par3 + par5Random.nextDouble() * 0.6D + 0.2D; + double var13 = (double)par4 + par5Random.nextDouble() * 0.6D + 0.2D; + par1World.spawnParticle("smoke", var9, var11, var13, 0.0D, 0.0D, 0.0D); + } + } + } + } + else if (!var6 && !this.checkForBurnout(par1World, par2, par3, par4, false)) + { + par1World.setBlock(par2, par3, par4, Block.torchRedstoneActive.blockID, par1World.getBlockMetadata(par2, par3, par4), 3); + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!this.func_94397_d(par1World, par2, par3, par4, par5)) + { + boolean var6 = this.isIndirectlyPowered(par1World, par2, par3, par4); + + if (this.torchActive && var6 || !this.torchActive && !var6) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + } + } + } + + /** + * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, + * side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return par5 == 0 ? this.isProvidingWeakPower(par1IBlockAccess, par2, par3, par4, par5) : 0; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.torchRedstoneActive.blockID; + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (this.torchActive) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + double var7 = (double)((float)par2 + 0.5F) + (double)(par5Random.nextFloat() - 0.5F) * 0.2D; + double var9 = (double)((float)par3 + 0.7F) + (double)(par5Random.nextFloat() - 0.5F) * 0.2D; + double var11 = (double)((float)par4 + 0.5F) + (double)(par5Random.nextFloat() - 0.5F) * 0.2D; + double var13 = 0.2199999988079071D; + double var15 = 0.27000001072883606D; + + if (var6 == 1) + { + par1World.spawnParticle("reddust", var7 - var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + } + else if (var6 == 2) + { + par1World.spawnParticle("reddust", var7 + var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + } + else if (var6 == 3) + { + par1World.spawnParticle("reddust", var7, var9 + var13, var11 - var15, 0.0D, 0.0D, 0.0D); + } + else if (var6 == 4) + { + par1World.spawnParticle("reddust", var7, var9 + var13, var11 + var15, 0.0D, 0.0D, 0.0D); + } + else + { + par1World.spawnParticle("reddust", var7, var9, var11, 0.0D, 0.0D, 0.0D); + } + } + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Block.torchRedstoneActive.blockID; + } + + /** + * Returns true if the given block ID is equivalent to this one. Example: redstoneTorchOn matches itself and + * redstoneTorchOff, and vice versa. Most blocks only match themselves. + */ + public boolean isAssociatedBlockID(int par1) + { + return par1 == Block.torchRedstoneIdle.blockID || par1 == Block.torchRedstoneActive.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockRedstoneWire.java b/src/main/java/net/minecraft/src/BlockRedstoneWire.java new file mode 100644 index 0000000..1dd2940 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockRedstoneWire.java @@ -0,0 +1,558 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Random; +import java.util.Set; + +public class BlockRedstoneWire extends Block +{ + /** + * When false, power transmission methods do not look at other redstone wires. Used internally during + * updateCurrentStrength. + */ + private boolean wiresProvidePower = true; + private Set blocksNeedingUpdate = new HashSet(); + private Icon field_94413_c; + private Icon field_94410_cO; + private Icon field_94411_cP; + private Icon field_94412_cQ; + + public BlockRedstoneWire(int par1) + { + super(par1, Material.circuits); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 5; + } + + /** + * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called + * when first determining what to render. + */ + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return 8388608; + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) || par1World.getBlockId(par2, par3 - 1, par4) == Block.glowStone.blockID; + } + + /** + * Sets the strength of the wire current (0-15) for this block based on neighboring blocks and propagates to + * neighboring redstone wires + */ + private void updateAndPropagateCurrentStrength(World par1World, int par2, int par3, int par4) + { + this.calculateCurrentChanges(par1World, par2, par3, par4, par2, par3, par4); + ArrayList var5 = new ArrayList(this.blocksNeedingUpdate); + this.blocksNeedingUpdate.clear(); + + for (int var6 = 0; var6 < var5.size(); ++var6) + { + ChunkPosition var7 = (ChunkPosition)var5.get(var6); + par1World.notifyBlocksOfNeighborChange(var7.x, var7.y, var7.z, this.blockID); + } + } + + private void calculateCurrentChanges(World par1World, int par2, int par3, int par4, int par5, int par6, int par7) + { + int var8 = par1World.getBlockMetadata(par2, par3, par4); + byte var9 = 0; + int var15 = this.getMaxCurrentStrength(par1World, par5, par6, par7, var9); + this.wiresProvidePower = false; + int var10 = par1World.getStrongestIndirectPower(par2, par3, par4); + this.wiresProvidePower = true; + + if (var10 > 0 && var10 > var15 - 1) + { + var15 = var10; + } + + int var11 = 0; + + for (int var12 = 0; var12 < 4; ++var12) + { + int var13 = par2; + int var14 = par4; + + if (var12 == 0) + { + var13 = par2 - 1; + } + + if (var12 == 1) + { + ++var13; + } + + if (var12 == 2) + { + var14 = par4 - 1; + } + + if (var12 == 3) + { + ++var14; + } + + if (var13 != par5 || var14 != par7) + { + var11 = this.getMaxCurrentStrength(par1World, var13, par3, var14, var11); + } + + if (par1World.isBlockNormalCube(var13, par3, var14) && !par1World.isBlockNormalCube(par2, par3 + 1, par4)) + { + if ((var13 != par5 || var14 != par7) && par3 >= par6) + { + var11 = this.getMaxCurrentStrength(par1World, var13, par3 + 1, var14, var11); + } + } + else if (!par1World.isBlockNormalCube(var13, par3, var14) && (var13 != par5 || var14 != par7) && par3 <= par6) + { + var11 = this.getMaxCurrentStrength(par1World, var13, par3 - 1, var14, var11); + } + } + + if (var11 > var15) + { + var15 = var11 - 1; + } + else if (var15 > 0) + { + --var15; + } + else + { + var15 = 0; + } + + if (var10 > var15 - 1) + { + var15 = var10; + } + + if (var8 != var15) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var15, 2); + this.blocksNeedingUpdate.add(new ChunkPosition(par2, par3, par4)); + this.blocksNeedingUpdate.add(new ChunkPosition(par2 - 1, par3, par4)); + this.blocksNeedingUpdate.add(new ChunkPosition(par2 + 1, par3, par4)); + this.blocksNeedingUpdate.add(new ChunkPosition(par2, par3 - 1, par4)); + this.blocksNeedingUpdate.add(new ChunkPosition(par2, par3 + 1, par4)); + this.blocksNeedingUpdate.add(new ChunkPosition(par2, par3, par4 - 1)); + this.blocksNeedingUpdate.add(new ChunkPosition(par2, par3, par4 + 1)); + } + } + + /** + * Calls World.notifyBlocksOfNeighborChange() for all neighboring blocks, but only if the given block is a redstone + * wire. + */ + private void notifyWireNeighborsOfNeighborChange(World par1World, int par2, int par3, int par4) + { + if (par1World.getBlockId(par2, par3, par4) == this.blockID) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID); + } + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + + if (!par1World.isRemote) + { + this.updateAndPropagateCurrentStrength(par1World, par2, par3, par4); + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + this.notifyWireNeighborsOfNeighborChange(par1World, par2 - 1, par3, par4); + this.notifyWireNeighborsOfNeighborChange(par1World, par2 + 1, par3, par4); + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3, par4 - 1); + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3, par4 + 1); + + if (par1World.isBlockNormalCube(par2 - 1, par3, par4)) + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2 - 1, par3 + 1, par4); + } + else + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2 - 1, par3 - 1, par4); + } + + if (par1World.isBlockNormalCube(par2 + 1, par3, par4)) + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2 + 1, par3 + 1, par4); + } + else + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2 + 1, par3 - 1, par4); + } + + if (par1World.isBlockNormalCube(par2, par3, par4 - 1)) + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3 + 1, par4 - 1); + } + else + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3 - 1, par4 - 1); + } + + if (par1World.isBlockNormalCube(par2, par3, par4 + 1)) + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3 + 1, par4 + 1); + } + else + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3 - 1, par4 + 1); + } + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + super.breakBlock(par1World, par2, par3, par4, par5, par6); + + if (!par1World.isRemote) + { + par1World.notifyBlocksOfNeighborChange(par2, par3 + 1, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID); + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID); + this.updateAndPropagateCurrentStrength(par1World, par2, par3, par4); + this.notifyWireNeighborsOfNeighborChange(par1World, par2 - 1, par3, par4); + this.notifyWireNeighborsOfNeighborChange(par1World, par2 + 1, par3, par4); + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3, par4 - 1); + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3, par4 + 1); + + if (par1World.isBlockNormalCube(par2 - 1, par3, par4)) + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2 - 1, par3 + 1, par4); + } + else + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2 - 1, par3 - 1, par4); + } + + if (par1World.isBlockNormalCube(par2 + 1, par3, par4)) + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2 + 1, par3 + 1, par4); + } + else + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2 + 1, par3 - 1, par4); + } + + if (par1World.isBlockNormalCube(par2, par3, par4 - 1)) + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3 + 1, par4 - 1); + } + else + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3 - 1, par4 - 1); + } + + if (par1World.isBlockNormalCube(par2, par3, par4 + 1)) + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3 + 1, par4 + 1); + } + else + { + this.notifyWireNeighborsOfNeighborChange(par1World, par2, par3 - 1, par4 + 1); + } + } + } + + /** + * Returns the current strength at the specified block if it is greater than the passed value, or the passed value + * otherwise. Signature: (world, x, y, z, strength) + */ + private int getMaxCurrentStrength(World par1World, int par2, int par3, int par4, int par5) + { + if (par1World.getBlockId(par2, par3, par4) != this.blockID) + { + return par5; + } + else + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + return var6 > par5 ? var6 : par5; + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isRemote) + { + boolean var6 = this.canPlaceBlockAt(par1World, par2, par3, par4); + + if (var6) + { + this.updateAndPropagateCurrentStrength(par1World, par2, par3, par4); + } + else + { + this.dropBlockAsItem(par1World, par2, par3, par4, 0, 0); + par1World.setBlockToAir(par2, par3, par4); + } + + super.onNeighborBlockChange(par1World, par2, par3, par4, par5); + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.redstone.itemID; + } + + /** + * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, + * side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return !this.wiresProvidePower ? 0 : this.isProvidingWeakPower(par1IBlockAccess, par2, par3, par4, par5); + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + if (!this.wiresProvidePower) + { + return 0; + } + else + { + int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + + if (var6 == 0) + { + return 0; + } + else if (par5 == 1) + { + return var6; + } + else + { + boolean var7 = isPoweredOrRepeater(par1IBlockAccess, par2 - 1, par3, par4, 1) || !par1IBlockAccess.isBlockNormalCube(par2 - 1, par3, par4) && isPoweredOrRepeater(par1IBlockAccess, par2 - 1, par3 - 1, par4, -1); + boolean var8 = isPoweredOrRepeater(par1IBlockAccess, par2 + 1, par3, par4, 3) || !par1IBlockAccess.isBlockNormalCube(par2 + 1, par3, par4) && isPoweredOrRepeater(par1IBlockAccess, par2 + 1, par3 - 1, par4, -1); + boolean var9 = isPoweredOrRepeater(par1IBlockAccess, par2, par3, par4 - 1, 2) || !par1IBlockAccess.isBlockNormalCube(par2, par3, par4 - 1) && isPoweredOrRepeater(par1IBlockAccess, par2, par3 - 1, par4 - 1, -1); + boolean var10 = isPoweredOrRepeater(par1IBlockAccess, par2, par3, par4 + 1, 0) || !par1IBlockAccess.isBlockNormalCube(par2, par3, par4 + 1) && isPoweredOrRepeater(par1IBlockAccess, par2, par3 - 1, par4 + 1, -1); + + if (!par1IBlockAccess.isBlockNormalCube(par2, par3 + 1, par4)) + { + if (par1IBlockAccess.isBlockNormalCube(par2 - 1, par3, par4) && isPoweredOrRepeater(par1IBlockAccess, par2 - 1, par3 + 1, par4, -1)) + { + var7 = true; + } + + if (par1IBlockAccess.isBlockNormalCube(par2 + 1, par3, par4) && isPoweredOrRepeater(par1IBlockAccess, par2 + 1, par3 + 1, par4, -1)) + { + var8 = true; + } + + if (par1IBlockAccess.isBlockNormalCube(par2, par3, par4 - 1) && isPoweredOrRepeater(par1IBlockAccess, par2, par3 + 1, par4 - 1, -1)) + { + var9 = true; + } + + if (par1IBlockAccess.isBlockNormalCube(par2, par3, par4 + 1) && isPoweredOrRepeater(par1IBlockAccess, par2, par3 + 1, par4 + 1, -1)) + { + var10 = true; + } + } + + return !var9 && !var8 && !var7 && !var10 && par5 >= 2 && par5 <= 5 ? var6 : (par5 == 2 && var9 && !var7 && !var8 ? var6 : (par5 == 3 && var10 && !var7 && !var8 ? var6 : (par5 == 4 && var7 && !var9 && !var10 ? var6 : (par5 == 5 && var8 && !var9 && !var10 ? var6 : 0)))); + } + } + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return this.wiresProvidePower; + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if (var6 > 0) + { + double var7 = (double)par2 + 0.5D + ((double)par5Random.nextFloat() - 0.5D) * 0.2D; + double var9 = (double)((float)par3 + 0.0625F); + double var11 = (double)par4 + 0.5D + ((double)par5Random.nextFloat() - 0.5D) * 0.2D; + float var13 = (float)var6 / 15.0F; + float var14 = var13 * 0.6F + 0.4F; + + if (var6 == 0) + { + var14 = 0.0F; + } + + float var15 = var13 * var13 * 0.7F - 0.5F; + float var16 = var13 * var13 * 0.6F - 0.7F; + + if (var15 < 0.0F) + { + var15 = 0.0F; + } + + if (var16 < 0.0F) + { + var16 = 0.0F; + } + + par1World.spawnParticle("reddust", var7, var9, var11, (double)var14, (double)var15, (double)var16); + } + } + + /** + * Returns true if redstone wire can connect to the specified block. Params: World, X, Y, Z, side (not a normal + * notch-side, this can be 0, 1, 2, 3 or -1) + */ + public static boolean isPowerProviderOrWire(IBlockAccess par0IBlockAccess, int par1, int par2, int par3, int par4) + { + int var5 = par0IBlockAccess.getBlockId(par1, par2, par3); + + if (var5 == Block.redstoneWire.blockID) + { + return true; + } + else if (var5 == 0) + { + return false; + } + else if (!Block.redstoneRepeaterIdle.func_94487_f(var5)) + { + return Block.blocksList[var5].canProvidePower() && par4 != -1; + } + else + { + int var6 = par0IBlockAccess.getBlockMetadata(par1, par2, par3); + return par4 == (var6 & 3) || par4 == Direction.rotateOpposite[var6 & 3]; + } + } + + /** + * Returns true if the block coordinate passed can provide power, or is a redstone wire, or if its a repeater that + * is powered. + */ + public static boolean isPoweredOrRepeater(IBlockAccess par0IBlockAccess, int par1, int par2, int par3, int par4) + { + if (isPowerProviderOrWire(par0IBlockAccess, par1, par2, par3, par4)) + { + return true; + } + else + { + int var5 = par0IBlockAccess.getBlockId(par1, par2, par3); + + if (var5 == Block.redstoneRepeaterActive.blockID) + { + int var6 = par0IBlockAccess.getBlockMetadata(par1, par2, par3); + return par4 == (var6 & 3); + } + else + { + return false; + } + } + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.redstone.itemID; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.field_94413_c = par1IconRegister.registerIcon(this.getTextureName() + "_" + "cross"); + this.field_94410_cO = par1IconRegister.registerIcon(this.getTextureName() + "_" + "line"); + this.field_94411_cP = par1IconRegister.registerIcon(this.getTextureName() + "_" + "cross_overlay"); + this.field_94412_cQ = par1IconRegister.registerIcon(this.getTextureName() + "_" + "line_overlay"); + this.blockIcon = this.field_94413_c; + } + + public static Icon getRedstoneWireIcon(String par0Str) + { + return par0Str.equals("cross") ? Block.redstoneWire.field_94413_c : (par0Str.equals("line") ? Block.redstoneWire.field_94410_cO : (par0Str.equals("cross_overlay") ? Block.redstoneWire.field_94411_cP : (par0Str.equals("line_overlay") ? Block.redstoneWire.field_94412_cQ : null))); + } +} diff --git a/src/main/java/net/minecraft/src/BlockReed.java b/src/main/java/net/minecraft/src/BlockReed.java new file mode 100644 index 0000000..040d57c --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockReed.java @@ -0,0 +1,133 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockReed extends Block +{ + protected BlockReed(int par1) + { + super(par1, Material.plants); + float var2 = 0.375F; + this.setBlockBounds(0.5F - var2, 0.0F, 0.5F - var2, 0.5F + var2, 1.0F, 0.5F + var2); + this.setTickRandomly(true); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (par1World.isAirBlock(par2, par3 + 1, par4)) + { + int var6; + + for (var6 = 1; par1World.getBlockId(par2, par3 - var6, par4) == this.blockID; ++var6) + { + ; + } + + if (var6 < 3) + { + int var7 = par1World.getBlockMetadata(par2, par3, par4); + + if (var7 == 15) + { + par1World.setBlock(par2, par3 + 1, par4, this.blockID); + par1World.setBlockMetadataWithNotify(par2, par3, par4, 0, 4); + } + else + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7 + 1, 4); + } + } + } + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockId(par2, par3 - 1, par4); + return var5 == this.blockID ? true : (var5 != Block.grass.blockID && var5 != Block.dirt.blockID && var5 != Block.sand.blockID ? false : (par1World.getBlockMaterial(par2 - 1, par3 - 1, par4) == Material.water ? true : (par1World.getBlockMaterial(par2 + 1, par3 - 1, par4) == Material.water ? true : (par1World.getBlockMaterial(par2, par3 - 1, par4 - 1) == Material.water ? true : par1World.getBlockMaterial(par2, par3 - 1, par4 + 1) == Material.water)))); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + this.checkBlockCoordValid(par1World, par2, par3, par4); + } + + /** + * Checks if current block pos is valid, if not, breaks the block as dropable item. Used for reed and cactus. + */ + protected final void checkBlockCoordValid(World par1World, int par2, int par3, int par4) + { + if (!this.canBlockStay(par1World, par2, par3, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + } + + /** + * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. + */ + public boolean canBlockStay(World par1World, int par2, int par3, int par4) + { + return this.canPlaceBlockAt(par1World, par2, par3, par4); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.reed.itemID; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 1; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.reed.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockRotatedPillar.java b/src/main/java/net/minecraft/src/BlockRotatedPillar.java new file mode 100644 index 0000000..25202f3 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockRotatedPillar.java @@ -0,0 +1,92 @@ +package net.minecraft.src; + +public abstract class BlockRotatedPillar extends Block +{ + protected Icon field_111051_a; + + protected BlockRotatedPillar(int par1, Material par2Material) + { + super(par1, par2Material); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 31; + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + int var10 = par9 & 3; + byte var11 = 0; + + switch (par5) + { + case 0: + case 1: + var11 = 0; + break; + + case 2: + case 3: + var11 = 8; + break; + + case 4: + case 5: + var11 = 4; + } + + return var10 | var11; + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + int var3 = par2 & 12; + int var4 = par2 & 3; + return var3 == 0 && (par1 == 1 || par1 == 0) ? this.getEndIcon(var4) : (var3 == 4 && (par1 == 5 || par1 == 4) ? this.getEndIcon(var4) : (var3 == 8 && (par1 == 2 || par1 == 3) ? this.getEndIcon(var4) : this.getSideIcon(var4))); + } + + /** + * The icon for the side of the block. + */ + protected abstract Icon getSideIcon(int var1); + + /** + * The icon for the tops and bottoms of the block. + */ + protected Icon getEndIcon(int par1) + { + return this.field_111051_a; + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1 & 3; + } + + public int func_111050_e(int par1) + { + return par1 & 3; + } + + /** + * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage + * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null. + */ + protected ItemStack createStackedBlock(int par1) + { + return new ItemStack(this.blockID, 1, this.func_111050_e(par1)); + } +} diff --git a/src/main/java/net/minecraft/src/BlockSand.java b/src/main/java/net/minecraft/src/BlockSand.java new file mode 100644 index 0000000..5b9053c --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockSand.java @@ -0,0 +1,123 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockSand extends Block +{ + /** Do blocks fall instantly to where they stop or do they fall over time */ + public static boolean fallInstantly; + + public BlockSand(int par1) + { + super(par1, Material.sand); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + public BlockSand(int par1, Material par2Material) + { + super(par1, par2Material); + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote) + { + this.tryToFall(par1World, par2, par3, par4); + } + } + + /** + * If there is space to fall below will start this block falling + */ + private void tryToFall(World par1World, int par2, int par3, int par4) + { + if (canFallBelow(par1World, par2, par3 - 1, par4) && par3 >= 0) + { + byte var8 = 32; + + if (!fallInstantly && par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8)) + { + if (!par1World.isRemote) + { + EntityFallingSand var9 = new EntityFallingSand(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.blockID, par1World.getBlockMetadata(par2, par3, par4)); + this.onStartFalling(var9); + par1World.spawnEntityInWorld(var9); + } + } + else + { + par1World.setBlockToAir(par2, par3, par4); + + while (canFallBelow(par1World, par2, par3 - 1, par4) && par3 > 0) + { + --par3; + } + + if (par3 > 0) + { + par1World.setBlock(par2, par3, par4, this.blockID); + } + } + } + } + + /** + * Called when the falling block entity for this block is created + */ + protected void onStartFalling(EntityFallingSand par1EntityFallingSand) {} + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 2; + } + + /** + * Checks to see if the sand can fall into the block below it + */ + public static boolean canFallBelow(World par0World, int par1, int par2, int par3) + { + int var4 = par0World.getBlockId(par1, par2, par3); + + if (var4 == 0) + { + return true; + } + else if (var4 == Block.fire.blockID) + { + return true; + } + else + { + Material var5 = Block.blocksList[var4].blockMaterial; + return var5 == Material.water ? true : var5 == Material.lava; + } + } + + /** + * Called when the falling block entity for this block hits the ground and turns back into a block + */ + public void onFinishFalling(World par1World, int par2, int par3, int par4, int par5) {} +} diff --git a/src/main/java/net/minecraft/src/BlockSandStone.java b/src/main/java/net/minecraft/src/BlockSandStone.java new file mode 100644 index 0000000..3ac3084 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockSandStone.java @@ -0,0 +1,80 @@ +package net.minecraft.src; + +import java.util.List; + +public class BlockSandStone extends Block +{ + public static final String[] SAND_STONE_TYPES = new String[] {"default", "chiseled", "smooth"}; + private static final String[] field_94405_b = new String[] {"normal", "carved", "smooth"}; + private Icon[] field_94406_c; + private Icon field_94403_cO; + private Icon field_94404_cP; + + public BlockSandStone(int par1) + { + super(par1, Material.rock); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + if (par1 != 1 && (par1 != 0 || par2 != 1 && par2 != 2)) + { + if (par1 == 0) + { + return this.field_94404_cP; + } + else + { + if (par2 < 0 || par2 >= this.field_94406_c.length) + { + par2 = 0; + } + + return this.field_94406_c[par2]; + } + } + else + { + return this.field_94403_cO; + } + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.field_94406_c = new Icon[field_94405_b.length]; + + for (int var2 = 0; var2 < this.field_94406_c.length; ++var2) + { + this.field_94406_c[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_" + field_94405_b[var2]); + } + + this.field_94403_cO = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.field_94404_cP = par1IconRegister.registerIcon(this.getTextureName() + "_bottom"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockSapling.java b/src/main/java/net/minecraft/src/BlockSapling.java new file mode 100644 index 0000000..e92498a --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockSapling.java @@ -0,0 +1,182 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockSapling extends BlockFlower +{ + public static final String[] WOOD_TYPES = new String[] {"oak", "spruce", "birch", "jungle"}; + private Icon[] saplingIcon; + + protected BlockSapling(int par1) + { + super(par1); + float var2 = 0.4F; + this.setBlockBounds(0.5F - var2, 0.0F, 0.5F - var2, 0.5F + var2, var2 * 2.0F, 0.5F + var2); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote) + { + super.updateTick(par1World, par2, par3, par4, par5Random); + + if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9 && par5Random.nextInt(7) == 0) + { + this.markOrGrowMarked(par1World, par2, par3, par4, par5Random); + } + } + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + par2 &= 3; + return this.saplingIcon[par2]; + } + + public void markOrGrowMarked(World par1World, int par2, int par3, int par4, Random par5Random) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if ((var6 & 8) == 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 | 8, 4); + } + else + { + this.growTree(par1World, par2, par3, par4, par5Random); + } + } + + /** + * Attempts to grow a sapling into a tree + */ + public void growTree(World par1World, int par2, int par3, int par4, Random par5Random) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4) & 3; + Object var7 = null; + int var8 = 0; + int var9 = 0; + boolean var10 = false; + + if (var6 == 1) + { + var7 = new WorldGenTaiga2(true); + } + else if (var6 == 2) + { + var7 = new WorldGenForest(true); + } + else if (var6 == 3) + { + for (var8 = 0; var8 >= -1; --var8) + { + for (var9 = 0; var9 >= -1; --var9) + { + if (this.isSameSapling(par1World, par2 + var8, par3, par4 + var9, 3) && this.isSameSapling(par1World, par2 + var8 + 1, par3, par4 + var9, 3) && this.isSameSapling(par1World, par2 + var8, par3, par4 + var9 + 1, 3) && this.isSameSapling(par1World, par2 + var8 + 1, par3, par4 + var9 + 1, 3)) + { + var7 = new WorldGenHugeTrees(true, 10 + par5Random.nextInt(20), 3, 3); + var10 = true; + break; + } + } + + if (var7 != null) + { + break; + } + } + + if (var7 == null) + { + var9 = 0; + var8 = 0; + var7 = new WorldGenTrees(true, 4 + par5Random.nextInt(7), 3, 3, false); + } + } + else + { + var7 = new WorldGenTrees(true); + + if (par5Random.nextInt(10) == 0) + { + var7 = new WorldGenBigTree(true); + } + } + + if (var10) + { + par1World.setBlock(par2 + var8, par3, par4 + var9, 0, 0, 4); + par1World.setBlock(par2 + var8 + 1, par3, par4 + var9, 0, 0, 4); + par1World.setBlock(par2 + var8, par3, par4 + var9 + 1, 0, 0, 4); + par1World.setBlock(par2 + var8 + 1, par3, par4 + var9 + 1, 0, 0, 4); + } + else + { + par1World.setBlock(par2, par3, par4, 0, 0, 4); + } + + if (!((WorldGenerator)var7).generate(par1World, par5Random, par2 + var8, par3, par4 + var9)) + { + if (var10) + { + par1World.setBlock(par2 + var8, par3, par4 + var9, this.blockID, var6, 4); + par1World.setBlock(par2 + var8 + 1, par3, par4 + var9, this.blockID, var6, 4); + par1World.setBlock(par2 + var8, par3, par4 + var9 + 1, this.blockID, var6, 4); + par1World.setBlock(par2 + var8 + 1, par3, par4 + var9 + 1, this.blockID, var6, 4); + } + else + { + par1World.setBlock(par2, par3, par4, this.blockID, var6, 4); + } + } + } + + /** + * Determines if the same sapling is present at the given location. + */ + public boolean isSameSapling(World par1World, int par2, int par3, int par4, int par5) + { + return par1World.getBlockId(par2, par3, par4) == this.blockID && (par1World.getBlockMetadata(par2, par3, par4) & 3) == par5; + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1 & 3; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.saplingIcon = new Icon[WOOD_TYPES.length]; + + for (int var2 = 0; var2 < this.saplingIcon.length; ++var2) + { + this.saplingIcon[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_" + WOOD_TYPES[var2]); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockSign.java b/src/main/java/net/minecraft/src/BlockSign.java new file mode 100644 index 0000000..631ed63 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockSign.java @@ -0,0 +1,201 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockSign extends BlockContainer +{ + private Class signEntityClass; + + /** Whether this is a freestanding sign or a wall-mounted sign */ + private boolean isFreestanding; + + protected BlockSign(int par1, Class par2Class, boolean par3) + { + super(par1, Material.wood); + this.isFreestanding = par3; + this.signEntityClass = par2Class; + float var4 = 0.25F; + float var5 = 1.0F; + this.setBlockBounds(0.5F - var4, 0.0F, 0.5F - var4, 0.5F + var4, var5, 0.5F + var4); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return Block.planks.getBlockTextureFromSide(par1); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Returns the bounding box of the wired rectangular prism to render. + */ + public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.getSelectedBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + if (!this.isFreestanding) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + float var6 = 0.28125F; + float var7 = 0.78125F; + float var8 = 0.0F; + float var9 = 1.0F; + float var10 = 0.125F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + + if (var5 == 2) + { + this.setBlockBounds(var8, var6, 1.0F - var10, var9, var7, 1.0F); + } + + if (var5 == 3) + { + this.setBlockBounds(var8, var6, 0.0F, var9, var7, var10); + } + + if (var5 == 4) + { + this.setBlockBounds(1.0F - var10, var6, var8, 1.0F, var7, var9); + } + + if (var5 == 5) + { + this.setBlockBounds(0.0F, var6, var8, var10, var7, var9); + } + } + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return -1; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return true; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + try + { + return (TileEntity)this.signEntityClass.newInstance(); + } + catch (Exception var3) + { + throw new RuntimeException(var3); + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.sign.itemID; + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + boolean var6 = false; + + if (this.isFreestanding) + { + if (!par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid()) + { + var6 = true; + } + } + else + { + int var7 = par1World.getBlockMetadata(par2, par3, par4); + var6 = true; + + if (var7 == 2 && par1World.getBlockMaterial(par2, par3, par4 + 1).isSolid()) + { + var6 = false; + } + + if (var7 == 3 && par1World.getBlockMaterial(par2, par3, par4 - 1).isSolid()) + { + var6 = false; + } + + if (var7 == 4 && par1World.getBlockMaterial(par2 + 1, par3, par4).isSolid()) + { + var6 = false; + } + + if (var7 == 5 && par1World.getBlockMaterial(par2 - 1, par3, par4).isSolid()) + { + var6 = false; + } + } + + if (var6) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + + super.onNeighborBlockChange(par1World, par2, par3, par4, par5); + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.sign.itemID; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) {} +} diff --git a/src/main/java/net/minecraft/src/BlockSilverfish.java b/src/main/java/net/minecraft/src/BlockSilverfish.java new file mode 100644 index 0000000..75a60e0 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockSilverfish.java @@ -0,0 +1,112 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockSilverfish extends Block +{ + /** Block names that can be a silverfish stone. */ + public static final String[] silverfishStoneTypes = new String[] {"stone", "cobble", "brick"}; + + public BlockSilverfish(int par1) + { + super(par1, Material.clay); + this.setHardness(0.0F); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par2 == 1 ? Block.cobblestone.getBlockTextureFromSide(par1) : (par2 == 2 ? Block.stoneBrick.getBlockTextureFromSide(par1) : Block.stone.getBlockTextureFromSide(par1)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) {} + + /** + * Called right before the block is destroyed by a player. Args: world, x, y, z, metaData + */ + public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isRemote) + { + EntitySilverfish var6 = new EntitySilverfish(par1World); + var6.setLocationAndAngles((double)par2 + 0.5D, (double)par3, (double)par4 + 0.5D, 0.0F, 0.0F); + par1World.spawnEntityInWorld(var6); + var6.spawnExplosionParticle(); + } + + super.onBlockDestroyedByPlayer(par1World, par2, par3, par4, par5); + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * Gets the blockID of the block this block is pretending to be according to this block's metadata. + */ + public static boolean getPosingIdByMetadata(int par0) + { + return par0 == Block.stone.blockID || par0 == Block.cobblestone.blockID || par0 == Block.stoneBrick.blockID; + } + + /** + * Returns the metadata to use when a Silverfish hides in the block. Sets the block to BlockSilverfish with this + * metadata. It changes the displayed texture client side to look like a normal block. + */ + public static int getMetadataForBlockType(int par0) + { + return par0 == Block.cobblestone.blockID ? 1 : (par0 == Block.stoneBrick.blockID ? 2 : 0); + } + + /** + * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage + * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null. + */ + protected ItemStack createStackedBlock(int par1) + { + Block var2 = Block.stone; + + if (par1 == 1) + { + var2 = Block.cobblestone; + } + + if (par1 == 2) + { + var2 = Block.stoneBrick; + } + + return new ItemStack(var2); + } + + /** + * Get the block's damage value (for use with pick block). + */ + public int getDamageValue(World par1World, int par2, int par3, int par4) + { + return par1World.getBlockMetadata(par2, par3, par4); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + for (int var4 = 0; var4 < 3; ++var4) + { + par3List.add(new ItemStack(par1, 1, var4)); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockSkull.java b/src/main/java/net/minecraft/src/BlockSkull.java new file mode 100644 index 0000000..e3e36cd --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockSkull.java @@ -0,0 +1,302 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockSkull extends BlockContainer +{ + protected BlockSkull(int par1) + { + super(par1, Material.circuits); + this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return -1; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 7; + + switch (var5) + { + case 1: + default: + this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); + break; + + case 2: + this.setBlockBounds(0.25F, 0.25F, 0.5F, 0.75F, 0.75F, 1.0F); + break; + + case 3: + this.setBlockBounds(0.25F, 0.25F, 0.0F, 0.75F, 0.75F, 0.5F); + break; + + case 4: + this.setBlockBounds(0.5F, 0.25F, 0.25F, 1.0F, 0.75F, 0.75F); + break; + + case 5: + this.setBlockBounds(0.0F, 0.25F, 0.25F, 0.5F, 0.75F, 0.75F); + } + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 2); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World par1World) + { + return new TileEntitySkull(); + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.skull.itemID; + } + + /** + * Get the block's damage value (for use with pick block). + */ + public int getDamageValue(World par1World, int par2, int par3, int par4) + { + TileEntity var5 = par1World.getBlockTileEntity(par2, par3, par4); + return var5 != null && var5 instanceof TileEntitySkull ? ((TileEntitySkull)var5).getSkullType() : super.getDamageValue(par1World, par2, par3, par4); + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1; + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) {} + + /** + * Called when the block is attempted to be harvested + */ + public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) + { + if (par6EntityPlayer.capabilities.isCreativeMode) + { + par5 |= 8; + par1World.setBlockMetadataWithNotify(par2, par3, par4, par5, 4); + } + + super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer); + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + if (!par1World.isRemote) + { + if ((par6 & 8) == 0) + { + ItemStack var7 = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(par1World, par2, par3, par4)); + TileEntitySkull var8 = (TileEntitySkull)par1World.getBlockTileEntity(par2, par3, par4); + + if (var8.getSkullType() == 3 && var8.getExtraType() != null && var8.getExtraType().length() > 0) + { + var7.setTagCompound(new NBTTagCompound()); + var7.getTagCompound().setString("SkullOwner", var8.getExtraType()); + } + + this.dropBlockAsItem_do(par1World, par2, par3, par4, var7); + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.skull.itemID; + } + + /** + * This method attempts to create a wither at the given location and skull + */ + public void makeWither(World par1World, int par2, int par3, int par4, TileEntitySkull par5TileEntitySkull) + { + if (par5TileEntitySkull.getSkullType() == 1 && par3 >= 2 && par1World.difficultySetting > 0 && !par1World.isRemote) + { + int var6 = Block.slowSand.blockID; + int var7; + EntityWither var8; + int var9; + + for (var7 = -2; var7 <= 0; ++var7) + { + if (par1World.getBlockId(par2, par3 - 1, par4 + var7) == var6 && par1World.getBlockId(par2, par3 - 1, par4 + var7 + 1) == var6 && par1World.getBlockId(par2, par3 - 2, par4 + var7 + 1) == var6 && par1World.getBlockId(par2, par3 - 1, par4 + var7 + 2) == var6 && this.func_82528_d(par1World, par2, par3, par4 + var7, 1) && this.func_82528_d(par1World, par2, par3, par4 + var7 + 1, 1) && this.func_82528_d(par1World, par2, par3, par4 + var7 + 2, 1)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4 + var7, 8, 2); + par1World.setBlockMetadataWithNotify(par2, par3, par4 + var7 + 1, 8, 2); + par1World.setBlockMetadataWithNotify(par2, par3, par4 + var7 + 2, 8, 2); + par1World.setBlock(par2, par3, par4 + var7, 0, 0, 2); + par1World.setBlock(par2, par3, par4 + var7 + 1, 0, 0, 2); + par1World.setBlock(par2, par3, par4 + var7 + 2, 0, 0, 2); + par1World.setBlock(par2, par3 - 1, par4 + var7, 0, 0, 2); + par1World.setBlock(par2, par3 - 1, par4 + var7 + 1, 0, 0, 2); + par1World.setBlock(par2, par3 - 1, par4 + var7 + 2, 0, 0, 2); + par1World.setBlock(par2, par3 - 2, par4 + var7 + 1, 0, 0, 2); + + if (!par1World.isRemote) + { + var8 = new EntityWither(par1World); + var8.setLocationAndAngles((double)par2 + 0.5D, (double)par3 - 1.45D, (double)(par4 + var7) + 1.5D, 90.0F, 0.0F); + var8.renderYawOffset = 90.0F; + var8.func_82206_m(); + par1World.spawnEntityInWorld(var8); + } + + for (var9 = 0; var9 < 120; ++var9) + { + par1World.spawnParticle("snowballpoof", (double)par2 + par1World.rand.nextDouble(), (double)(par3 - 2) + par1World.rand.nextDouble() * 3.9D, (double)(par4 + var7 + 1) + par1World.rand.nextDouble(), 0.0D, 0.0D, 0.0D); + } + + par1World.notifyBlockChange(par2, par3, par4 + var7, 0); + par1World.notifyBlockChange(par2, par3, par4 + var7 + 1, 0); + par1World.notifyBlockChange(par2, par3, par4 + var7 + 2, 0); + par1World.notifyBlockChange(par2, par3 - 1, par4 + var7, 0); + par1World.notifyBlockChange(par2, par3 - 1, par4 + var7 + 1, 0); + par1World.notifyBlockChange(par2, par3 - 1, par4 + var7 + 2, 0); + par1World.notifyBlockChange(par2, par3 - 2, par4 + var7 + 1, 0); + return; + } + } + + for (var7 = -2; var7 <= 0; ++var7) + { + if (par1World.getBlockId(par2 + var7, par3 - 1, par4) == var6 && par1World.getBlockId(par2 + var7 + 1, par3 - 1, par4) == var6 && par1World.getBlockId(par2 + var7 + 1, par3 - 2, par4) == var6 && par1World.getBlockId(par2 + var7 + 2, par3 - 1, par4) == var6 && this.func_82528_d(par1World, par2 + var7, par3, par4, 1) && this.func_82528_d(par1World, par2 + var7 + 1, par3, par4, 1) && this.func_82528_d(par1World, par2 + var7 + 2, par3, par4, 1)) + { + par1World.setBlockMetadataWithNotify(par2 + var7, par3, par4, 8, 2); + par1World.setBlockMetadataWithNotify(par2 + var7 + 1, par3, par4, 8, 2); + par1World.setBlockMetadataWithNotify(par2 + var7 + 2, par3, par4, 8, 2); + par1World.setBlock(par2 + var7, par3, par4, 0, 0, 2); + par1World.setBlock(par2 + var7 + 1, par3, par4, 0, 0, 2); + par1World.setBlock(par2 + var7 + 2, par3, par4, 0, 0, 2); + par1World.setBlock(par2 + var7, par3 - 1, par4, 0, 0, 2); + par1World.setBlock(par2 + var7 + 1, par3 - 1, par4, 0, 0, 2); + par1World.setBlock(par2 + var7 + 2, par3 - 1, par4, 0, 0, 2); + par1World.setBlock(par2 + var7 + 1, par3 - 2, par4, 0, 0, 2); + + if (!par1World.isRemote) + { + var8 = new EntityWither(par1World); + var8.setLocationAndAngles((double)(par2 + var7) + 1.5D, (double)par3 - 1.45D, (double)par4 + 0.5D, 0.0F, 0.0F); + var8.func_82206_m(); + par1World.spawnEntityInWorld(var8); + } + + for (var9 = 0; var9 < 120; ++var9) + { + par1World.spawnParticle("snowballpoof", (double)(par2 + var7 + 1) + par1World.rand.nextDouble(), (double)(par3 - 2) + par1World.rand.nextDouble() * 3.9D, (double)par4 + par1World.rand.nextDouble(), 0.0D, 0.0D, 0.0D); + } + + par1World.notifyBlockChange(par2 + var7, par3, par4, 0); + par1World.notifyBlockChange(par2 + var7 + 1, par3, par4, 0); + par1World.notifyBlockChange(par2 + var7 + 2, par3, par4, 0); + par1World.notifyBlockChange(par2 + var7, par3 - 1, par4, 0); + par1World.notifyBlockChange(par2 + var7 + 1, par3 - 1, par4, 0); + par1World.notifyBlockChange(par2 + var7 + 2, par3 - 1, par4, 0); + par1World.notifyBlockChange(par2 + var7 + 1, par3 - 2, par4, 0); + return; + } + } + } + } + + private boolean func_82528_d(World par1World, int par2, int par3, int par4, int par5) + { + if (par1World.getBlockId(par2, par3, par4) != this.blockID) + { + return false; + } + else + { + TileEntity var6 = par1World.getBlockTileEntity(par2, par3, par4); + return var6 != null && var6 instanceof TileEntitySkull ? ((TileEntitySkull)var6).getSkullType() == par5 : false; + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) {} + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return Block.slowSand.getBlockTextureFromSide(par1); + } + + /** + * Gets the icon name of the ItemBlock corresponding to this block. Used by hoppers. + */ + public String getItemIconName() + { + return this.getTextureName() + "_" + ItemSkull.field_94587_a[0]; + } +} diff --git a/src/main/java/net/minecraft/src/BlockSnow.java b/src/main/java/net/minecraft/src/BlockSnow.java new file mode 100644 index 0000000..6a08bf7 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockSnow.java @@ -0,0 +1,163 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockSnow extends Block +{ + protected BlockSnow(int par1) + { + super(par1, Material.snow); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + this.setBlockBoundsForSnowDepth(0); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon("snow"); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4) & 7; + float var6 = 0.125F; + return AxisAlignedBB.getAABBPool().getAABB((double)par2 + this.minX, (double)par3 + this.minY, (double)par4 + this.minZ, (double)par2 + this.maxX, (double)((float)par3 + (float)var5 * var6), (double)par4 + this.maxZ); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBoundsForSnowDepth(0); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.setBlockBoundsForSnowDepth(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + } + + /** + * calls setBlockBounds based on the depth of the snow. Int is any values 0x0-0x7, usually this blocks metadata. + */ + protected void setBlockBoundsForSnowDepth(int par1) + { + int var2 = par1 & 7; + float var3 = (float)(2 * (1 + var2)) / 16.0F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, var3, 1.0F); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockId(par2, par3 - 1, par4); + return var5 == 0 ? false : (var5 == this.blockID && (par1World.getBlockMetadata(par2, par3 - 1, par4) & 7) == 7 ? true : (var5 != Block.leaves.blockID && !Block.blocksList[var5].isOpaqueCube() ? false : par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement())); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + this.canSnowStay(par1World, par2, par3, par4); + } + + /** + * Checks if this snow block can stay at this location. + */ + private boolean canSnowStay(World par1World, int par2, int par3, int par4) + { + if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + return false; + } + else + { + return true; + } + } + + /** + * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the + * block and l is the block's subtype/damage. + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) + { + int var7 = Item.snowball.itemID; + int var8 = par6 & 7; + this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(var7, var8 + 1, 0)); + par1World.setBlockToAir(par3, par4, par5); + par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.snowball.itemID; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return par5 == 1 ? true : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5); + } +} diff --git a/src/main/java/net/minecraft/src/BlockSnowBlock.java b/src/main/java/net/minecraft/src/BlockSnowBlock.java new file mode 100644 index 0000000..b2178d3 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockSnowBlock.java @@ -0,0 +1,41 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockSnowBlock extends Block +{ + protected BlockSnowBlock(int par1) + { + super(par1, Material.craftedSnow); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.snowball.itemID; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 4; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockSoulSand.java b/src/main/java/net/minecraft/src/BlockSoulSand.java new file mode 100644 index 0000000..f458c74 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockSoulSand.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +public class BlockSoulSand extends Block +{ + public BlockSoulSand(int par1) + { + super(par1, Material.sand); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + float var5 = 0.125F; + return AxisAlignedBB.getAABBPool().getAABB((double)par2, (double)par3, (double)par4, (double)(par2 + 1), (double)((float)(par3 + 1) - var5), (double)(par4 + 1)); + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + par5Entity.motionX *= 0.4D; + par5Entity.motionZ *= 0.4D; + } +} diff --git a/src/main/java/net/minecraft/src/BlockSourceImpl.java b/src/main/java/net/minecraft/src/BlockSourceImpl.java new file mode 100644 index 0000000..6548bd6 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockSourceImpl.java @@ -0,0 +1,62 @@ +package net.minecraft.src; + +public class BlockSourceImpl implements IBlockSource +{ + private final World worldObj; + private final int xPos; + private final int yPos; + private final int zPos; + + public BlockSourceImpl(World par1World, int par2, int par3, int par4) + { + this.worldObj = par1World; + this.xPos = par2; + this.yPos = par3; + this.zPos = par4; + } + + public World getWorld() + { + return this.worldObj; + } + + public double getX() + { + return (double)this.xPos + 0.5D; + } + + public double getY() + { + return (double)this.yPos + 0.5D; + } + + public double getZ() + { + return (double)this.zPos + 0.5D; + } + + public int getXInt() + { + return this.xPos; + } + + public int getYInt() + { + return this.yPos; + } + + public int getZInt() + { + return this.zPos; + } + + public int getBlockMetadata() + { + return this.worldObj.getBlockMetadata(this.xPos, this.yPos, this.zPos); + } + + public TileEntity getBlockTileEntity() + { + return this.worldObj.getBlockTileEntity(this.xPos, this.yPos, this.zPos); + } +} diff --git a/src/main/java/net/minecraft/src/BlockSponge.java b/src/main/java/net/minecraft/src/BlockSponge.java new file mode 100644 index 0000000..99f9ca6 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockSponge.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public class BlockSponge extends Block +{ + protected BlockSponge(int par1) + { + super(par1, Material.sponge); + this.setCreativeTab(CreativeTabs.tabBlock); + } +} diff --git a/src/main/java/net/minecraft/src/BlockStairs.java b/src/main/java/net/minecraft/src/BlockStairs.java new file mode 100644 index 0000000..809c51c --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockStairs.java @@ -0,0 +1,633 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockStairs extends Block +{ + private static final int[][] field_72159_a = new int[][] {{2, 6}, {3, 7}, {2, 3}, {6, 7}, {0, 4}, {1, 5}, {0, 1}, {4, 5}}; + + /** The block that is used as model for the stair. */ + private final Block modelBlock; + private final int modelBlockMetadata; + private boolean field_72156_cr; + private int field_72160_cs; + + protected BlockStairs(int par1, Block par2Block, int par3) + { + super(par1, par2Block.blockMaterial); + this.modelBlock = par2Block; + this.modelBlockMetadata = par3; + this.setHardness(par2Block.blockHardness); + this.setResistance(par2Block.blockResistance / 3.0F); + this.setStepSound(par2Block.stepSound); + this.setLightOpacity(255); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + if (this.field_72156_cr) + { + this.setBlockBounds(0.5F * (float)(this.field_72160_cs % 2), 0.5F * (float)(this.field_72160_cs / 2 % 2), 0.5F * (float)(this.field_72160_cs / 4 % 2), 0.5F + 0.5F * (float)(this.field_72160_cs % 2), 0.5F + 0.5F * (float)(this.field_72160_cs / 2 % 2), 0.5F + 0.5F * (float)(this.field_72160_cs / 4 % 2)); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 10; + } + + public void func_82541_d(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + + if ((var5 & 4) != 0) + { + this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + } + + /** + * Checks if supplied ID is one of a BlockStairs + */ + public static boolean isBlockStairsID(int par0) + { + return par0 > 0 && Block.blocksList[par0] instanceof BlockStairs; + } + + /** + * returns true if the given block is a stairs block and is in the given direction of par5. Parameters are + * IBlockAccess, x, y, z, direction + */ + private boolean isBlockStairsDirection(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + int var6 = par1IBlockAccess.getBlockId(par2, par3, par4); + return isBlockStairsID(var6) && par1IBlockAccess.getBlockMetadata(par2, par3, par4) == par5; + } + + public boolean func_82542_g(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + int var6 = var5 & 3; + float var7 = 0.5F; + float var8 = 1.0F; + + if ((var5 & 4) != 0) + { + var7 = 0.0F; + var8 = 0.5F; + } + + float var9 = 0.0F; + float var10 = 1.0F; + float var11 = 0.0F; + float var12 = 0.5F; + boolean var13 = true; + int var14; + int var15; + int var16; + + if (var6 == 0) + { + var9 = 0.5F; + var12 = 1.0F; + var14 = par1IBlockAccess.getBlockId(par2 + 1, par3, par4); + var15 = par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4); + + if (isBlockStairsID(var14) && (var5 & 4) == (var15 & 4)) + { + var16 = var15 & 3; + + if (var16 == 3 && !this.isBlockStairsDirection(par1IBlockAccess, par2, par3, par4 + 1, var5)) + { + var12 = 0.5F; + var13 = false; + } + else if (var16 == 2 && !this.isBlockStairsDirection(par1IBlockAccess, par2, par3, par4 - 1, var5)) + { + var11 = 0.5F; + var13 = false; + } + } + } + else if (var6 == 1) + { + var10 = 0.5F; + var12 = 1.0F; + var14 = par1IBlockAccess.getBlockId(par2 - 1, par3, par4); + var15 = par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4); + + if (isBlockStairsID(var14) && (var5 & 4) == (var15 & 4)) + { + var16 = var15 & 3; + + if (var16 == 3 && !this.isBlockStairsDirection(par1IBlockAccess, par2, par3, par4 + 1, var5)) + { + var12 = 0.5F; + var13 = false; + } + else if (var16 == 2 && !this.isBlockStairsDirection(par1IBlockAccess, par2, par3, par4 - 1, var5)) + { + var11 = 0.5F; + var13 = false; + } + } + } + else if (var6 == 2) + { + var11 = 0.5F; + var12 = 1.0F; + var14 = par1IBlockAccess.getBlockId(par2, par3, par4 + 1); + var15 = par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1); + + if (isBlockStairsID(var14) && (var5 & 4) == (var15 & 4)) + { + var16 = var15 & 3; + + if (var16 == 1 && !this.isBlockStairsDirection(par1IBlockAccess, par2 + 1, par3, par4, var5)) + { + var10 = 0.5F; + var13 = false; + } + else if (var16 == 0 && !this.isBlockStairsDirection(par1IBlockAccess, par2 - 1, par3, par4, var5)) + { + var9 = 0.5F; + var13 = false; + } + } + } + else if (var6 == 3) + { + var14 = par1IBlockAccess.getBlockId(par2, par3, par4 - 1); + var15 = par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1); + + if (isBlockStairsID(var14) && (var5 & 4) == (var15 & 4)) + { + var16 = var15 & 3; + + if (var16 == 1 && !this.isBlockStairsDirection(par1IBlockAccess, par2 + 1, par3, par4, var5)) + { + var10 = 0.5F; + var13 = false; + } + else if (var16 == 0 && !this.isBlockStairsDirection(par1IBlockAccess, par2 - 1, par3, par4, var5)) + { + var9 = 0.5F; + var13 = false; + } + } + } + + this.setBlockBounds(var9, var7, var11, var10, var8, var12); + return var13; + } + + public boolean func_82544_h(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + int var6 = var5 & 3; + float var7 = 0.5F; + float var8 = 1.0F; + + if ((var5 & 4) != 0) + { + var7 = 0.0F; + var8 = 0.5F; + } + + float var9 = 0.0F; + float var10 = 0.5F; + float var11 = 0.5F; + float var12 = 1.0F; + boolean var13 = false; + int var14; + int var15; + int var16; + + if (var6 == 0) + { + var14 = par1IBlockAccess.getBlockId(par2 - 1, par3, par4); + var15 = par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4); + + if (isBlockStairsID(var14) && (var5 & 4) == (var15 & 4)) + { + var16 = var15 & 3; + + if (var16 == 3 && !this.isBlockStairsDirection(par1IBlockAccess, par2, par3, par4 - 1, var5)) + { + var11 = 0.0F; + var12 = 0.5F; + var13 = true; + } + else if (var16 == 2 && !this.isBlockStairsDirection(par1IBlockAccess, par2, par3, par4 + 1, var5)) + { + var11 = 0.5F; + var12 = 1.0F; + var13 = true; + } + } + } + else if (var6 == 1) + { + var14 = par1IBlockAccess.getBlockId(par2 + 1, par3, par4); + var15 = par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4); + + if (isBlockStairsID(var14) && (var5 & 4) == (var15 & 4)) + { + var9 = 0.5F; + var10 = 1.0F; + var16 = var15 & 3; + + if (var16 == 3 && !this.isBlockStairsDirection(par1IBlockAccess, par2, par3, par4 - 1, var5)) + { + var11 = 0.0F; + var12 = 0.5F; + var13 = true; + } + else if (var16 == 2 && !this.isBlockStairsDirection(par1IBlockAccess, par2, par3, par4 + 1, var5)) + { + var11 = 0.5F; + var12 = 1.0F; + var13 = true; + } + } + } + else if (var6 == 2) + { + var14 = par1IBlockAccess.getBlockId(par2, par3, par4 - 1); + var15 = par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1); + + if (isBlockStairsID(var14) && (var5 & 4) == (var15 & 4)) + { + var11 = 0.0F; + var12 = 0.5F; + var16 = var15 & 3; + + if (var16 == 1 && !this.isBlockStairsDirection(par1IBlockAccess, par2 - 1, par3, par4, var5)) + { + var13 = true; + } + else if (var16 == 0 && !this.isBlockStairsDirection(par1IBlockAccess, par2 + 1, par3, par4, var5)) + { + var9 = 0.5F; + var10 = 1.0F; + var13 = true; + } + } + } + else if (var6 == 3) + { + var14 = par1IBlockAccess.getBlockId(par2, par3, par4 + 1); + var15 = par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1); + + if (isBlockStairsID(var14) && (var5 & 4) == (var15 & 4)) + { + var16 = var15 & 3; + + if (var16 == 1 && !this.isBlockStairsDirection(par1IBlockAccess, par2 - 1, par3, par4, var5)) + { + var13 = true; + } + else if (var16 == 0 && !this.isBlockStairsDirection(par1IBlockAccess, par2 + 1, par3, par4, var5)) + { + var9 = 0.5F; + var10 = 1.0F; + var13 = true; + } + } + } + + if (var13) + { + this.setBlockBounds(var9, var7, var11, var10, var8, var12); + } + + return var13; + } + + /** + * Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the + * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity + */ + public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + this.func_82541_d(par1World, par2, par3, par4); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + boolean var8 = this.func_82542_g(par1World, par2, par3, par4); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + + if (var8 && this.func_82544_h(par1World, par2, par3, par4)) + { + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + this.modelBlock.randomDisplayTick(par1World, par2, par3, par4, par5Random); + } + + /** + * Called when the block is clicked by a player. Args: x, y, z, entityPlayer + */ + public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) + { + this.modelBlock.onBlockClicked(par1World, par2, par3, par4, par5EntityPlayer); + } + + /** + * Called right before the block is destroyed by a player. Args: world, x, y, z, metaData + */ + public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) + { + this.modelBlock.onBlockDestroyedByPlayer(par1World, par2, par3, par4, par5); + } + + /** + * Goes straight to getLightBrightnessForSkyBlocks for Blocks, does some fancy computing for Fluids + */ + public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return this.modelBlock.getMixedBrightnessForBlock(par1IBlockAccess, par2, par3, par4); + } + + /** + * How bright to render this block based on the light its receiving. Args: iBlockAccess, x, y, z + */ + public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return this.modelBlock.getBlockBrightness(par1IBlockAccess, par2, par3, par4); + } + + /** + * Returns how much this block can resist explosions from the passed in entity. + */ + public float getExplosionResistance(Entity par1Entity) + { + return this.modelBlock.getExplosionResistance(par1Entity); + } + + /** + * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha + */ + public int getRenderBlockPass() + { + return this.modelBlock.getRenderBlockPass(); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return this.modelBlock.getIcon(par1, this.modelBlockMetadata); + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return this.modelBlock.tickRate(par1World); + } + + /** + * Returns the bounding box of the wired rectangular prism to render. + */ + public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return this.modelBlock.getSelectedBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Can add to the passed in vector for a movement vector to be applied to the entity. Args: x, y, z, entity, vec3d + */ + public void velocityToAddToEntity(World par1World, int par2, int par3, int par4, Entity par5Entity, Vec3 par6Vec3) + { + this.modelBlock.velocityToAddToEntity(par1World, par2, par3, par4, par5Entity, par6Vec3); + } + + /** + * Returns if this block is collidable (only used by Fire). Args: x, y, z + */ + public boolean isCollidable() + { + return this.modelBlock.isCollidable(); + } + + /** + * Returns whether this block is collideable based on the arguments passed in \n@param par1 block metaData \n@param + * par2 whether the player right-clicked while holding a boat + */ + public boolean canCollideCheck(int par1, boolean par2) + { + return this.modelBlock.canCollideCheck(par1, par2); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return this.modelBlock.canPlaceBlockAt(par1World, par2, par3, par4); + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + this.onNeighborBlockChange(par1World, par2, par3, par4, 0); + this.modelBlock.onBlockAdded(par1World, par2, par3, par4); + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + this.modelBlock.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + /** + * Called whenever an entity is walking on top of this block. Args: world, x, y, z, entity + */ + public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + this.modelBlock.onEntityWalking(par1World, par2, par3, par4, par5Entity); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + this.modelBlock.updateTick(par1World, par2, par3, par4, par5Random); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + return this.modelBlock.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, 0, 0.0F, 0.0F, 0.0F); + } + + /** + * Called upon the block being destroyed by an explosion + */ + public void onBlockDestroyedByExplosion(World par1World, int par2, int par3, int par4, Explosion par5Explosion) + { + this.modelBlock.onBlockDestroyedByExplosion(par1World, par2, par3, par4, par5Explosion); + } + + /** + * Called when the block is placed in the world. + */ + public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) + { + int var7 = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int var8 = par1World.getBlockMetadata(par2, par3, par4) & 4; + + if (var7 == 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 2 | var8, 2); + } + + if (var7 == 1) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 1 | var8, 2); + } + + if (var7 == 2) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 3 | var8, 2); + } + + if (var7 == 3) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 0 | var8, 2); + } + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + return par5 != 0 && (par5 == 1 || (double)par7 <= 0.5D) ? par9 : par9 | 4; + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, + * x, y, z, startVec, endVec + */ + public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3) + { + MovingObjectPosition[] var7 = new MovingObjectPosition[8]; + int var8 = par1World.getBlockMetadata(par2, par3, par4); + int var9 = var8 & 3; + boolean var10 = (var8 & 4) == 4; + int[] var11 = field_72159_a[var9 + (var10 ? 4 : 0)]; + this.field_72156_cr = true; + int var14; + int var15; + int var16; + + for (int var12 = 0; var12 < 8; ++var12) + { + this.field_72160_cs = var12; + int[] var13 = var11; + var14 = var11.length; + + for (var15 = 0; var15 < var14; ++var15) + { + var16 = var13[var15]; + + if (var16 == var12) + { + ; + } + } + + var7[var12] = super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3); + } + + int[] var21 = var11; + int var23 = var11.length; + + for (var14 = 0; var14 < var23; ++var14) + { + var15 = var21[var14]; + var7[var15] = null; + } + + MovingObjectPosition var22 = null; + double var24 = 0.0D; + MovingObjectPosition[] var25 = var7; + var16 = var7.length; + + for (int var17 = 0; var17 < var16; ++var17) + { + MovingObjectPosition var18 = var25[var17]; + + if (var18 != null) + { + double var19 = var18.hitVec.squareDistanceTo(par6Vec3); + + if (var19 > var24) + { + var22 = var18; + var24 = var19; + } + } + } + + return var22; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) {} +} diff --git a/src/main/java/net/minecraft/src/BlockStationary.java b/src/main/java/net/minecraft/src/BlockStationary.java new file mode 100644 index 0000000..68f6f5e --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockStationary.java @@ -0,0 +1,105 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockStationary extends BlockFluid +{ + protected BlockStationary(int par1, Material par2Material) + { + super(par1, par2Material); + this.setTickRandomly(false); + + if (par2Material == Material.lava) + { + this.setTickRandomly(true); + } + } + + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return this.blockMaterial != Material.lava; + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + super.onNeighborBlockChange(par1World, par2, par3, par4, par5); + + if (par1World.getBlockId(par2, par3, par4) == this.blockID) + { + this.setNotStationary(par1World, par2, par3, par4); + } + } + + /** + * Changes the block ID to that of an updating fluid. + */ + private void setNotStationary(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + par1World.setBlock(par2, par3, par4, this.blockID - 1, var5, 2); + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID - 1, this.tickRate(par1World)); + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (this.blockMaterial == Material.lava) + { + int var6 = par5Random.nextInt(3); + int var7; + int var8; + + for (var7 = 0; var7 < var6; ++var7) + { + par2 += par5Random.nextInt(3) - 1; + ++par3; + par4 += par5Random.nextInt(3) - 1; + var8 = par1World.getBlockId(par2, par3, par4); + + if (var8 == 0) + { + if (this.isFlammable(par1World, par2 - 1, par3, par4) || this.isFlammable(par1World, par2 + 1, par3, par4) || this.isFlammable(par1World, par2, par3, par4 - 1) || this.isFlammable(par1World, par2, par3, par4 + 1) || this.isFlammable(par1World, par2, par3 - 1, par4) || this.isFlammable(par1World, par2, par3 + 1, par4)) + { + par1World.setBlock(par2, par3, par4, Block.fire.blockID); + return; + } + } + else if (Block.blocksList[var8].blockMaterial.blocksMovement()) + { + return; + } + } + + if (var6 == 0) + { + var7 = par2; + var8 = par4; + + for (int var9 = 0; var9 < 3; ++var9) + { + par2 = var7 + par5Random.nextInt(3) - 1; + par4 = var8 + par5Random.nextInt(3) - 1; + + if (par1World.isAirBlock(par2, par3 + 1, par4) && this.isFlammable(par1World, par2, par3, par4)) + { + par1World.setBlock(par2, par3 + 1, par4, Block.fire.blockID); + } + } + } + } + } + + /** + * Checks to see if the block is flammable. + */ + private boolean isFlammable(World par1World, int par2, int par3, int par4) + { + return par1World.getBlockMaterial(par2, par3, par4).getCanBurn(); + } +} diff --git a/src/main/java/net/minecraft/src/BlockStem.java b/src/main/java/net/minecraft/src/BlockStem.java new file mode 100644 index 0000000..3730225 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockStem.java @@ -0,0 +1,294 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockStem extends BlockFlower +{ + /** Defines if it is a Melon or a Pumpkin that the stem is producing. */ + private final Block fruitType; + private Icon theIcon; + + protected BlockStem(int par1, Block par2Block) + { + super(par1); + this.fruitType = par2Block; + this.setTickRandomly(true); + float var3 = 0.125F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.25F, 0.5F + var3); + this.setCreativeTab((CreativeTabs)null); + } + + /** + * Gets passed in the blockID of the block below and supposed to return true if its allowed to grow on the type of + * blockID passed in. Args: blockID + */ + protected boolean canThisPlantGrowOnThisBlockID(int par1) + { + return par1 == Block.tilledField.blockID; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + super.updateTick(par1World, par2, par3, par4, par5Random); + + if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) + { + float var6 = this.getGrowthModifier(par1World, par2, par3, par4); + + if (par5Random.nextInt((int)(25.0F / var6) + 1) == 0) + { + int var7 = par1World.getBlockMetadata(par2, par3, par4); + + if (var7 < 7) + { + ++var7; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var7, 2); + } + else + { + if (par1World.getBlockId(par2 - 1, par3, par4) == this.fruitType.blockID) + { + return; + } + + if (par1World.getBlockId(par2 + 1, par3, par4) == this.fruitType.blockID) + { + return; + } + + if (par1World.getBlockId(par2, par3, par4 - 1) == this.fruitType.blockID) + { + return; + } + + if (par1World.getBlockId(par2, par3, par4 + 1) == this.fruitType.blockID) + { + return; + } + + int var8 = par5Random.nextInt(4); + int var9 = par2; + int var10 = par4; + + if (var8 == 0) + { + var9 = par2 - 1; + } + + if (var8 == 1) + { + ++var9; + } + + if (var8 == 2) + { + var10 = par4 - 1; + } + + if (var8 == 3) + { + ++var10; + } + + int var11 = par1World.getBlockId(var9, par3 - 1, var10); + + if (par1World.getBlockId(var9, par3, var10) == 0 && (var11 == Block.tilledField.blockID || var11 == Block.dirt.blockID || var11 == Block.grass.blockID)) + { + par1World.setBlock(var9, par3, var10, this.fruitType.blockID); + } + } + } + } + } + + public void fertilizeStem(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4) + MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5); + + if (var5 > 7) + { + var5 = 7; + } + + par1World.setBlockMetadataWithNotify(par2, par3, par4, var5, 2); + } + + private float getGrowthModifier(World par1World, int par2, int par3, int par4) + { + float var5 = 1.0F; + int var6 = par1World.getBlockId(par2, par3, par4 - 1); + int var7 = par1World.getBlockId(par2, par3, par4 + 1); + int var8 = par1World.getBlockId(par2 - 1, par3, par4); + int var9 = par1World.getBlockId(par2 + 1, par3, par4); + int var10 = par1World.getBlockId(par2 - 1, par3, par4 - 1); + int var11 = par1World.getBlockId(par2 + 1, par3, par4 - 1); + int var12 = par1World.getBlockId(par2 + 1, par3, par4 + 1); + int var13 = par1World.getBlockId(par2 - 1, par3, par4 + 1); + boolean var14 = var8 == this.blockID || var9 == this.blockID; + boolean var15 = var6 == this.blockID || var7 == this.blockID; + boolean var16 = var10 == this.blockID || var11 == this.blockID || var12 == this.blockID || var13 == this.blockID; + + for (int var17 = par2 - 1; var17 <= par2 + 1; ++var17) + { + for (int var18 = par4 - 1; var18 <= par4 + 1; ++var18) + { + int var19 = par1World.getBlockId(var17, par3 - 1, var18); + float var20 = 0.0F; + + if (var19 == Block.tilledField.blockID) + { + var20 = 1.0F; + + if (par1World.getBlockMetadata(var17, par3 - 1, var18) > 0) + { + var20 = 3.0F; + } + } + + if (var17 != par2 || var18 != par4) + { + var20 /= 4.0F; + } + + var5 += var20; + } + } + + if (var16 || var14 && var15) + { + var5 /= 2.0F; + } + + return var5; + } + + /** + * Returns the color this block should be rendered. Used by leaves. + */ + public int getRenderColor(int par1) + { + int var2 = par1 * 32; + int var3 = 255 - par1 * 8; + int var4 = par1 * 4; + return var2 << 16 | var3 << 8 | var4; + } + + /** + * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called + * when first determining what to render. + */ + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return this.getRenderColor(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float var1 = 0.125F; + this.setBlockBounds(0.5F - var1, 0.0F, 0.5F - var1, 0.5F + var1, 0.25F, 0.5F + var1); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.maxY = (double)((float)(par1IBlockAccess.getBlockMetadata(par2, par3, par4) * 2 + 2) / 16.0F); + float var5 = 0.125F; + this.setBlockBounds(0.5F - var5, 0.0F, 0.5F - var5, 0.5F + var5, (float)this.maxY, 0.5F + var5); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 19; + } + + /** + * Returns the current state of the stem. Returns -1 if the stem is not fully grown, or a value between 0 and 3 + * based on the direction the stem is facing. + */ + public int getState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + return var5 < 7 ? -1 : (par1IBlockAccess.getBlockId(par2 - 1, par3, par4) == this.fruitType.blockID ? 0 : (par1IBlockAccess.getBlockId(par2 + 1, par3, par4) == this.fruitType.blockID ? 1 : (par1IBlockAccess.getBlockId(par2, par3, par4 - 1) == this.fruitType.blockID ? 2 : (par1IBlockAccess.getBlockId(par2, par3, par4 + 1) == this.fruitType.blockID ? 3 : -1)))); + } + + /** + * Drops the block items with a specified chance of dropping the specified items + */ + public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) + { + super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7); + + if (!par1World.isRemote) + { + Item var8 = null; + + if (this.fruitType == Block.pumpkin) + { + var8 = Item.pumpkinSeeds; + } + + if (this.fruitType == Block.melon) + { + var8 = Item.melonSeeds; + } + + for (int var9 = 0; var9 < 3; ++var9) + { + if (par1World.rand.nextInt(15) <= par5) + { + this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var8)); + } + } + } + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return -1; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 1; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return this.fruitType == Block.pumpkin ? Item.pumpkinSeeds.itemID : (this.fruitType == Block.melon ? Item.melonSeeds.itemID : 0); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_disconnected"); + this.theIcon = par1IconRegister.registerIcon(this.getTextureName() + "_connected"); + } + + public Icon getStemIcon() + { + return this.theIcon; + } +} diff --git a/src/main/java/net/minecraft/src/BlockStep.java b/src/main/java/net/minecraft/src/BlockStep.java new file mode 100644 index 0000000..5be5c77 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockStep.java @@ -0,0 +1,89 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockStep extends BlockHalfSlab +{ + /** The list of the types of step blocks. */ + public static final String[] blockStepTypes = new String[] {"stone", "sand", "wood", "cobble", "brick", "smoothStoneBrick", "netherBrick", "quartz"}; + private Icon theIcon; + + public BlockStep(int par1, boolean par2) + { + super(par1, par2, Material.rock); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + int var3 = par2 & 7; + + if (this.isDoubleSlab && (par2 & 8) != 0) + { + par1 = 1; + } + + return var3 == 0 ? (par1 != 1 && par1 != 0 ? this.theIcon : this.blockIcon) : (var3 == 1 ? Block.sandStone.getBlockTextureFromSide(par1) : (var3 == 2 ? Block.planks.getBlockTextureFromSide(par1) : (var3 == 3 ? Block.cobblestone.getBlockTextureFromSide(par1) : (var3 == 4 ? Block.brick.getBlockTextureFromSide(par1) : (var3 == 5 ? Block.stoneBrick.getIcon(par1, 0) : (var3 == 6 ? Block.netherBrick.getBlockTextureFromSide(1) : (var3 == 7 ? Block.blockNetherQuartz.getBlockTextureFromSide(par1) : this.blockIcon))))))); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon("stone_slab_top"); + this.theIcon = par1IconRegister.registerIcon("stone_slab_side"); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.stoneSingleSlab.blockID; + } + + /** + * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage + * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null. + */ + protected ItemStack createStackedBlock(int par1) + { + return new ItemStack(Block.stoneSingleSlab.blockID, 2, par1 & 7); + } + + /** + * Returns the slab block name with step type. + */ + public String getFullSlabName(int par1) + { + if (par1 < 0 || par1 >= blockStepTypes.length) + { + par1 = 0; + } + + return super.getUnlocalizedName() + "." + blockStepTypes[par1]; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + if (par1 != Block.stoneDoubleSlab.blockID) + { + for (int var4 = 0; var4 <= 7; ++var4) + { + if (var4 != 2) + { + par3List.add(new ItemStack(par1, 1, var4)); + } + } + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockStone.java b/src/main/java/net/minecraft/src/BlockStone.java new file mode 100644 index 0000000..91a54a9 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockStone.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockStone extends Block +{ + public BlockStone(int par1) + { + super(par1, Material.rock); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.cobblestone.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/BlockStoneBrick.java b/src/main/java/net/minecraft/src/BlockStoneBrick.java new file mode 100644 index 0000000..abedbad --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockStoneBrick.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import java.util.List; + +public class BlockStoneBrick extends Block +{ + public static final String[] STONE_BRICK_TYPES = new String[] {"default", "mossy", "cracked", "chiseled"}; + public static final String[] field_94407_b = new String[] {null, "mossy", "cracked", "carved"}; + private Icon[] field_94408_c; + + public BlockStoneBrick(int par1) + { + super(par1, Material.rock); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + if (par2 < 0 || par2 >= field_94407_b.length) + { + par2 = 0; + } + + return this.field_94408_c[par2]; + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + for (int var4 = 0; var4 < 4; ++var4) + { + par3List.add(new ItemStack(par1, 1, var4)); + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.field_94408_c = new Icon[field_94407_b.length]; + + for (int var2 = 0; var2 < this.field_94408_c.length; ++var2) + { + String var3 = this.getTextureName(); + + if (field_94407_b[var2] != null) + { + var3 = var3 + "_" + field_94407_b[var2]; + } + + this.field_94408_c[var2] = par1IconRegister.registerIcon(var3); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockTNT.java b/src/main/java/net/minecraft/src/BlockTNT.java new file mode 100644 index 0000000..3303dd2 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockTNT.java @@ -0,0 +1,149 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockTNT extends Block +{ + private Icon field_94393_a; + private Icon field_94392_b; + + public BlockTNT(int par1) + { + super(par1, Material.tnt); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 0 ? this.field_94392_b : (par1 == 1 ? this.field_94393_a : this.blockIcon); + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + + if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) + { + this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1); + par1World.setBlockToAir(par2, par3, par4); + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) + { + this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1); + par1World.setBlockToAir(par2, par3, par4); + } + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 1; + } + + /** + * Called upon the block being destroyed by an explosion + */ + public void onBlockDestroyedByExplosion(World par1World, int par2, int par3, int par4, Explosion par5Explosion) + { + if (!par1World.isRemote) + { + EntityTNTPrimed var6 = new EntityTNTPrimed(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), par5Explosion.getExplosivePlacedBy()); + var6.fuse = par1World.rand.nextInt(var6.fuse / 4) + var6.fuse / 8; + par1World.spawnEntityInWorld(var6); + } + } + + /** + * Called right before the block is destroyed by a player. Args: world, x, y, z, metaData + */ + public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) + { + this.primeTnt(par1World, par2, par3, par4, par5, (EntityLivingBase)null); + } + + /** + * spawns the primed tnt and plays the fuse sound. + */ + public void primeTnt(World par1World, int par2, int par3, int par4, int par5, EntityLivingBase par6EntityLivingBase) + { + if (!par1World.isRemote) + { + if ((par5 & 1) == 1) + { + EntityTNTPrimed var7 = new EntityTNTPrimed(par1World, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), par6EntityLivingBase); + par1World.spawnEntityInWorld(var7); + par1World.playSoundAtEntity(var7, "random.fuse", 1.0F, 1.0F); + } + } + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().itemID == Item.flintAndSteel.itemID) + { + this.primeTnt(par1World, par2, par3, par4, 1, par5EntityPlayer); + par1World.setBlockToAir(par2, par3, par4); + par5EntityPlayer.getCurrentEquippedItem().damageItem(1, par5EntityPlayer); + return true; + } + else + { + return super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9); + } + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + if (par5Entity instanceof EntityArrow && !par1World.isRemote) + { + EntityArrow var6 = (EntityArrow)par5Entity; + + if (var6.isBurning()) + { + this.primeTnt(par1World, par2, par3, par4, 1, var6.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase)var6.shootingEntity : null); + par1World.setBlockToAir(par2, par3, par4); + } + } + } + + /** + * Return whether this block can drop from an explosion. + */ + public boolean canDropFromExplosion(Explosion par1Explosion) + { + return false; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + this.field_94393_a = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.field_94392_b = par1IconRegister.registerIcon(this.getTextureName() + "_bottom"); + } +} diff --git a/src/main/java/net/minecraft/src/BlockTallGrass.java b/src/main/java/net/minecraft/src/BlockTallGrass.java new file mode 100644 index 0000000..b393c0f --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockTallGrass.java @@ -0,0 +1,121 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockTallGrass extends BlockFlower +{ + private static final String[] grassTypes = new String[] {"deadbush", "tallgrass", "fern"}; + private Icon[] iconArray; + + protected BlockTallGrass(int par1) + { + super(par1, Material.vine); + float var2 = 0.4F; + this.setBlockBounds(0.5F - var2, 0.0F, 0.5F - var2, 0.5F + var2, 0.8F, 0.5F + var2); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + if (par2 >= this.iconArray.length) + { + par2 = 0; + } + + return this.iconArray[par2]; + } + + public int getBlockColor() + { + double var1 = 0.5D; + double var3 = 1.0D; + return ColorizerGrass.getGrassColor(var1, var3); + } + + /** + * Returns the color this block should be rendered. Used by leaves. + */ + public int getRenderColor(int par1) + { + return par1 == 0 ? 16777215 : ColorizerFoliage.getFoliageColorBasic(); + } + + /** + * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called + * when first determining what to render. + */ + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + return var5 == 0 ? 16777215 : par1IBlockAccess.getBiomeGenForCoords(par2, par4).getBiomeGrassColor(); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return par2Random.nextInt(8) == 0 ? Item.seeds.itemID : -1; + } + + /** + * Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive). + */ + public int quantityDroppedWithBonus(int par1, Random par2Random) + { + return 1 + par2Random.nextInt(par1 * 2 + 1); + } + + /** + * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the + * block and l is the block's subtype/damage. + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) + { + if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) + { + par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); + this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.tallGrass, 1, par6)); + } + else + { + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + } + } + + /** + * Get the block's damage value (for use with pick block). + */ + public int getDamageValue(World par1World, int par2, int par3, int par4) + { + return par1World.getBlockMetadata(par2, par3, par4); + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + for (int var4 = 1; var4 < 3; ++var4) + { + par3List.add(new ItemStack(par1, 1, var4)); + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[grassTypes.length]; + + for (int var2 = 0; var2 < this.iconArray.length; ++var2) + { + this.iconArray[var2] = par1IconRegister.registerIcon(grassTypes[var2]); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockTorch.java b/src/main/java/net/minecraft/src/BlockTorch.java new file mode 100644 index 0000000..1e95db3 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockTorch.java @@ -0,0 +1,304 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockTorch extends Block +{ + protected BlockTorch(int par1) + { + super(par1, Material.circuits); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 2; + } + + /** + * Gets if we can place a torch on a block. + */ + private boolean canPlaceTorchOn(World par1World, int par2, int par3, int par4) + { + if (par1World.doesBlockHaveSolidTopSurface(par2, par3, par4)) + { + return true; + } + else + { + int var5 = par1World.getBlockId(par2, par3, par4); + return var5 == Block.fence.blockID || var5 == Block.netherFence.blockID || var5 == Block.glass.blockID || var5 == Block.cobblestoneWall.blockID; + } + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) ? true : (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) ? true : (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) ? true : (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) ? true : this.canPlaceTorchOn(par1World, par2, par3 - 1, par4)))); + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + int var10 = par9; + + if (par5 == 1 && this.canPlaceTorchOn(par1World, par2, par3 - 1, par4)) + { + var10 = 5; + } + + if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) + { + var10 = 4; + } + + if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) + { + var10 = 3; + } + + if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) + { + var10 = 2; + } + + if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) + { + var10 = 1; + } + + return var10; + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + super.updateTick(par1World, par2, par3, par4, par5Random); + + if (par1World.getBlockMetadata(par2, par3, par4) == 0) + { + this.onBlockAdded(par1World, par2, par3, par4); + } + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + if (par1World.getBlockMetadata(par2, par3, par4) == 0) + { + if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 2); + } + else if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2); + } + else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2); + } + else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2); + } + else if (this.canPlaceTorchOn(par1World, par2, par3 - 1, par4)) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2); + } + } + + this.dropTorchIfCantStay(par1World, par2, par3, par4); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + this.func_94397_d(par1World, par2, par3, par4, par5); + } + + protected boolean func_94397_d(World par1World, int par2, int par3, int par4, int par5) + { + if (this.dropTorchIfCantStay(par1World, par2, par3, par4)) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + boolean var7 = false; + + if (!par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) && var6 == 1) + { + var7 = true; + } + + if (!par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) && var6 == 2) + { + var7 = true; + } + + if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) && var6 == 3) + { + var7 = true; + } + + if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) && var6 == 4) + { + var7 = true; + } + + if (!this.canPlaceTorchOn(par1World, par2, par3 - 1, par4) && var6 == 5) + { + var7 = true; + } + + if (var7) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + return true; + } + else + { + return false; + } + } + else + { + return true; + } + } + + /** + * Tests if the block can remain at its current location and will drop as an item if it is unable to stay. Returns + * True if it can stay and False if it drops. Args: world, x, y, z + */ + protected boolean dropTorchIfCantStay(World par1World, int par2, int par3, int par4) + { + if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) + { + if (par1World.getBlockId(par2, par3, par4) == this.blockID) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + + return false; + } + else + { + return true; + } + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, + * x, y, z, startVec, endVec + */ + public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3) + { + int var7 = par1World.getBlockMetadata(par2, par3, par4) & 7; + float var8 = 0.15F; + + if (var7 == 1) + { + this.setBlockBounds(0.0F, 0.2F, 0.5F - var8, var8 * 2.0F, 0.8F, 0.5F + var8); + } + else if (var7 == 2) + { + this.setBlockBounds(1.0F - var8 * 2.0F, 0.2F, 0.5F - var8, 1.0F, 0.8F, 0.5F + var8); + } + else if (var7 == 3) + { + this.setBlockBounds(0.5F - var8, 0.2F, 0.0F, 0.5F + var8, 0.8F, var8 * 2.0F); + } + else if (var7 == 4) + { + this.setBlockBounds(0.5F - var8, 0.2F, 1.0F - var8 * 2.0F, 0.5F + var8, 0.8F, 1.0F); + } + else + { + var8 = 0.1F; + this.setBlockBounds(0.5F - var8, 0.0F, 0.5F - var8, 0.5F + var8, 0.6F, 0.5F + var8); + } + + return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3); + } + + /** + * A randomly called display update to be able to add particles or other items for display + */ + public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + double var7 = (double)((float)par2 + 0.5F); + double var9 = (double)((float)par3 + 0.7F); + double var11 = (double)((float)par4 + 0.5F); + double var13 = 0.2199999988079071D; + double var15 = 0.27000001072883606D; + + if (var6 == 1) + { + par1World.spawnParticle("smoke", var7 - var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + par1World.spawnParticle("flame", var7 - var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + } + else if (var6 == 2) + { + par1World.spawnParticle("smoke", var7 + var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + par1World.spawnParticle("flame", var7 + var15, var9 + var13, var11, 0.0D, 0.0D, 0.0D); + } + else if (var6 == 3) + { + par1World.spawnParticle("smoke", var7, var9 + var13, var11 - var15, 0.0D, 0.0D, 0.0D); + par1World.spawnParticle("flame", var7, var9 + var13, var11 - var15, 0.0D, 0.0D, 0.0D); + } + else if (var6 == 4) + { + par1World.spawnParticle("smoke", var7, var9 + var13, var11 + var15, 0.0D, 0.0D, 0.0D); + par1World.spawnParticle("flame", var7, var9 + var13, var11 + var15, 0.0D, 0.0D, 0.0D); + } + else + { + par1World.spawnParticle("smoke", var7, var9, var11, 0.0D, 0.0D, 0.0D); + par1World.spawnParticle("flame", var7, var9, var11, 0.0D, 0.0D, 0.0D); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockTrapDoor.java b/src/main/java/net/minecraft/src/BlockTrapDoor.java new file mode 100644 index 0000000..a79eb2c --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockTrapDoor.java @@ -0,0 +1,304 @@ +package net.minecraft.src; + +public class BlockTrapDoor extends Block +{ + protected BlockTrapDoor(int par1, Material par2Material) + { + super(par1, par2Material); + float var3 = 0.5F; + float var4 = 1.0F; + this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var4, 0.5F + var3); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return !isTrapdoorOpen(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 0; + } + + /** + * Returns the bounding box of the wired rectangular prism to render. + */ + public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.getSelectedBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.setBlockBoundsForBlockRender(par1IBlockAccess.getBlockMetadata(par2, par3, par4)); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + float var1 = 0.1875F; + this.setBlockBounds(0.0F, 0.5F - var1 / 2.0F, 0.0F, 1.0F, 0.5F + var1 / 2.0F, 1.0F); + } + + public void setBlockBoundsForBlockRender(int par1) + { + float var2 = 0.1875F; + + if ((par1 & 8) != 0) + { + this.setBlockBounds(0.0F, 1.0F - var2, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, var2, 1.0F); + } + + if (isTrapdoorOpen(par1)) + { + if ((par1 & 3) == 0) + { + this.setBlockBounds(0.0F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F); + } + + if ((par1 & 3) == 1) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var2); + } + + if ((par1 & 3) == 2) + { + this.setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + if ((par1 & 3) == 3) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 1.0F); + } + } + } + + /** + * Called when the block is clicked by a player. Args: x, y, z, entityPlayer + */ + public void onBlockClicked(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) {} + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (this.blockMaterial == Material.iron) + { + return true; + } + else + { + int var10 = par1World.getBlockMetadata(par2, par3, par4); + par1World.setBlockMetadataWithNotify(par2, par3, par4, var10 ^ 4, 2); + par1World.playAuxSFXAtEntity(par5EntityPlayer, 1003, par2, par3, par4, 0); + return true; + } + } + + public void onPoweredBlockChange(World par1World, int par2, int par3, int par4, boolean par5) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + boolean var7 = (var6 & 4) > 0; + + if (var7 != par5) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6 ^ 4, 2); + par1World.playAuxSFXAtEntity((EntityPlayer)null, 1003, par2, par3, par4, 0); + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isRemote) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + int var7 = par2; + int var8 = par4; + + if ((var6 & 3) == 0) + { + var8 = par4 + 1; + } + + if ((var6 & 3) == 1) + { + --var8; + } + + if ((var6 & 3) == 2) + { + var7 = par2 + 1; + } + + if ((var6 & 3) == 3) + { + --var7; + } + + if (!isValidSupportBlock(par1World.getBlockId(var7, par3, var8))) + { + par1World.setBlockToAir(par2, par3, par4); + this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0); + } + + boolean var9 = par1World.isBlockIndirectlyGettingPowered(par2, par3, par4); + + if (var9 || par5 > 0 && Block.blocksList[par5].canProvidePower()) + { + this.onPoweredBlockChange(par1World, par2, par3, par4, var9); + } + } + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, + * x, y, z, startVec, endVec + */ + public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + return super.collisionRayTrace(par1World, par2, par3, par4, par5Vec3, par6Vec3); + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + int var10 = 0; + + if (par5 == 2) + { + var10 = 0; + } + + if (par5 == 3) + { + var10 = 1; + } + + if (par5 == 4) + { + var10 = 2; + } + + if (par5 == 5) + { + var10 = 3; + } + + if (par5 != 1 && par5 != 0 && par7 > 0.5F) + { + var10 |= 8; + } + + return var10; + } + + /** + * checks to see if you can place this block can be placed on that side of a block: BlockLever overrides + */ + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + { + if (par5 == 0) + { + return false; + } + else if (par5 == 1) + { + return false; + } + else + { + if (par5 == 2) + { + ++par4; + } + + if (par5 == 3) + { + --par4; + } + + if (par5 == 4) + { + ++par2; + } + + if (par5 == 5) + { + --par2; + } + + return isValidSupportBlock(par1World.getBlockId(par2, par3, par4)); + } + } + + public static boolean isTrapdoorOpen(int par0) + { + return (par0 & 4) != 0; + } + + /** + * Checks if the block ID is a valid support block for the trap door to connect with. If it is not the trapdoor is + * dropped into the world. + */ + private static boolean isValidSupportBlock(int par0) + { + if (par0 <= 0) + { + return false; + } + else + { + Block var1 = Block.blocksList[par0]; + return var1 != null && var1.blockMaterial.isOpaque() && var1.renderAsNormalBlock() || var1 == Block.glowStone || var1 instanceof BlockHalfSlab || var1 instanceof BlockStairs; + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockTripWire.java b/src/main/java/net/minecraft/src/BlockTripWire.java new file mode 100644 index 0000000..77f7e99 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockTripWire.java @@ -0,0 +1,292 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; +import java.util.Random; + +public class BlockTripWire extends Block +{ + public BlockTripWire(int par1) + { + super(par1, Material.circuits); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F); + this.setTickRandomly(true); + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 10; + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha + */ + public int getRenderBlockPass() + { + return 1; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 30; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.silk.itemID; + } + + /** + * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) + */ + public int idPicked(World par1World, int par2, int par3, int par4) + { + return Item.silk.itemID; + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + boolean var7 = (var6 & 2) == 2; + boolean var8 = !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); + + if (var7 != var8) + { + this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0); + par1World.setBlockToAir(par2, par3, par4); + } + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + boolean var6 = (var5 & 4) == 4; + boolean var7 = (var5 & 2) == 2; + + if (!var7) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.09375F, 1.0F); + } + else if (!var6) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0625F, 0.0F, 1.0F, 0.15625F, 1.0F); + } + } + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? 0 : 2; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var5, 3); + this.func_72149_e(par1World, par2, par3, par4, var5); + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + this.func_72149_e(par1World, par2, par3, par4, par6 | 1); + } + + /** + * Called when the block is attempted to be harvested + */ + public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) + { + if (!par1World.isRemote) + { + if (par6EntityPlayer.getCurrentEquippedItem() != null && par6EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, par5 | 8, 4); + } + } + } + + private void func_72149_e(World par1World, int par2, int par3, int par4, int par5) + { + int var6 = 0; + + while (var6 < 2) + { + int var7 = 1; + + while (true) + { + if (var7 < 42) + { + int var8 = par2 + Direction.offsetX[var6] * var7; + int var9 = par4 + Direction.offsetZ[var6] * var7; + int var10 = par1World.getBlockId(var8, par3, var9); + + if (var10 == Block.tripWireSource.blockID) + { + int var11 = par1World.getBlockMetadata(var8, par3, var9) & 3; + + if (var11 == Direction.rotateOpposite[var6]) + { + Block.tripWireSource.func_72143_a(par1World, var8, par3, var9, var10, par1World.getBlockMetadata(var8, par3, var9), true, var7, par5); + } + } + else if (var10 == Block.tripWire.blockID) + { + ++var7; + continue; + } + } + + ++var6; + break; + } + } + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + if (!par1World.isRemote) + { + if ((par1World.getBlockMetadata(par2, par3, par4) & 1) != 1) + { + this.updateTripWireState(par1World, par2, par3, par4); + } + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote) + { + if ((par1World.getBlockMetadata(par2, par3, par4) & 1) == 1) + { + this.updateTripWireState(par1World, par2, par3, par4); + } + } + } + + private void updateTripWireState(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + boolean var6 = (var5 & 1) == 1; + boolean var7 = false; + List var8 = par1World.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.getAABBPool().getAABB((double)par2 + this.minX, (double)par3 + this.minY, (double)par4 + this.minZ, (double)par2 + this.maxX, (double)par3 + this.maxY, (double)par4 + this.maxZ)); + + if (!var8.isEmpty()) + { + Iterator var9 = var8.iterator(); + + while (var9.hasNext()) + { + Entity var10 = (Entity)var9.next(); + + if (!var10.doesEntityNotTriggerPressurePlate()) + { + var7 = true; + break; + } + } + } + + if (var7 && !var6) + { + var5 |= 1; + } + + if (!var7 && var6) + { + var5 &= -2; + } + + if (var7 != var6) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var5, 3); + this.func_72149_e(par1World, par2, par3, par4, var5); + } + + if (var7) + { + par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID, this.tickRate(par1World)); + } + } + + public static boolean func_72148_a(IBlockAccess par0IBlockAccess, int par1, int par2, int par3, int par4, int par5) + { + int var6 = par1 + Direction.offsetX[par5]; + int var8 = par3 + Direction.offsetZ[par5]; + int var9 = par0IBlockAccess.getBlockId(var6, par2, var8); + boolean var10 = (par4 & 2) == 2; + int var11; + + if (var9 == Block.tripWireSource.blockID) + { + var11 = par0IBlockAccess.getBlockMetadata(var6, par2, var8); + int var13 = var11 & 3; + return var13 == Direction.rotateOpposite[par5]; + } + else if (var9 == Block.tripWire.blockID) + { + var11 = par0IBlockAccess.getBlockMetadata(var6, par2, var8); + boolean var12 = (var11 & 2) == 2; + return var10 == var12; + } + else + { + return false; + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockTripWireSource.java b/src/main/java/net/minecraft/src/BlockTripWireSource.java new file mode 100644 index 0000000..1417ee0 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockTripWireSource.java @@ -0,0 +1,434 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockTripWireSource extends Block +{ + public BlockTripWireSource(int par1) + { + super(par1, Material.circuits); + this.setCreativeTab(CreativeTabs.tabRedstone); + this.setTickRandomly(true); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 29; + } + + /** + * How many world ticks before ticking + */ + public int tickRate(World par1World) + { + return 10; + } + + /** + * checks to see if you can place this block can be placed on that side of a block: BlockLever overrides + */ + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + { + return par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + { + return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1))); + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + byte var10 = 0; + + if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true)) + { + var10 = 2; + } + + if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true)) + { + var10 = 0; + } + + if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) + { + var10 = 1; + } + + if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) + { + var10 = 3; + } + + return var10; + } + + /** + * Called after a block is placed + */ + public void onPostBlockPlaced(World par1World, int par2, int par3, int par4, int par5) + { + this.func_72143_a(par1World, par2, par3, par4, this.blockID, par5, false, -1, 0); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (par5 != this.blockID) + { + if (this.func_72144_l(par1World, par2, par3, par4)) + { + int var6 = par1World.getBlockMetadata(par2, par3, par4); + int var7 = var6 & 3; + boolean var8 = false; + + if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && var7 == 3) + { + var8 = true; + } + + if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var7 == 1) + { + var8 = true; + } + + if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var7 == 0) + { + var8 = true; + } + + if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var7 == 2) + { + var8 = true; + } + + if (var8) + { + this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0); + par1World.setBlockToAir(par2, par3, par4); + } + } + } + } + + public void func_72143_a(World par1World, int par2, int par3, int par4, int par5, int par6, boolean par7, int par8, int par9) + { + int var10 = par6 & 3; + boolean var11 = (par6 & 4) == 4; + boolean var12 = (par6 & 8) == 8; + boolean var13 = par5 == Block.tripWireSource.blockID; + boolean var14 = false; + boolean var15 = !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); + int var16 = Direction.offsetX[var10]; + int var17 = Direction.offsetZ[var10]; + int var18 = 0; + int[] var19 = new int[42]; + int var20; + int var21; + int var22; + int var23; + int var24; + + for (var20 = 1; var20 < 42; ++var20) + { + var21 = par2 + var16 * var20; + var22 = par4 + var17 * var20; + var23 = par1World.getBlockId(var21, par3, var22); + + if (var23 == Block.tripWireSource.blockID) + { + var24 = par1World.getBlockMetadata(var21, par3, var22); + + if ((var24 & 3) == Direction.rotateOpposite[var10]) + { + var18 = var20; + } + + break; + } + + if (var23 != Block.tripWire.blockID && var20 != par8) + { + var19[var20] = -1; + var13 = false; + } + else + { + var24 = var20 == par8 ? par9 : par1World.getBlockMetadata(var21, par3, var22); + boolean var25 = (var24 & 8) != 8; + boolean var26 = (var24 & 1) == 1; + boolean var27 = (var24 & 2) == 2; + var13 &= var27 == var15; + var14 |= var25 && var26; + var19[var20] = var24; + + if (var20 == par8) + { + par1World.scheduleBlockUpdate(par2, par3, par4, par5, this.tickRate(par1World)); + var13 &= var25; + } + } + } + + var13 &= var18 > 1; + var14 &= var13; + var20 = (var13 ? 4 : 0) | (var14 ? 8 : 0); + par6 = var10 | var20; + + if (var18 > 0) + { + var21 = par2 + var16 * var18; + var22 = par4 + var17 * var18; + var23 = Direction.rotateOpposite[var10]; + par1World.setBlockMetadataWithNotify(var21, par3, var22, var23 | var20, 3); + this.notifyNeighborOfChange(par1World, var21, par3, var22, var23); + this.playSoundEffect(par1World, var21, par3, var22, var13, var14, var11, var12); + } + + this.playSoundEffect(par1World, par2, par3, par4, var13, var14, var11, var12); + + if (par5 > 0) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, par6, 3); + + if (par7) + { + this.notifyNeighborOfChange(par1World, par2, par3, par4, var10); + } + } + + if (var11 != var13) + { + for (var21 = 1; var21 < var18; ++var21) + { + var22 = par2 + var16 * var21; + var23 = par4 + var17 * var21; + var24 = var19[var21]; + + if (var24 >= 0) + { + if (var13) + { + var24 |= 4; + } + else + { + var24 &= -5; + } + + par1World.setBlockMetadataWithNotify(var22, par3, var23, var24, 3); + } + } + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + this.func_72143_a(par1World, par2, par3, par4, this.blockID, par1World.getBlockMetadata(par2, par3, par4), true, -1, 0); + } + + /** + * only of the conditions are right + */ + private void playSoundEffect(World par1World, int par2, int par3, int par4, boolean par5, boolean par6, boolean par7, boolean par8) + { + if (par6 && !par8) + { + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.1D, (double)par4 + 0.5D, "random.click", 0.4F, 0.6F); + } + else if (!par6 && par8) + { + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.1D, (double)par4 + 0.5D, "random.click", 0.4F, 0.5F); + } + else if (par5 && !par7) + { + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.1D, (double)par4 + 0.5D, "random.click", 0.4F, 0.7F); + } + else if (!par5 && par7) + { + par1World.playSoundEffect((double)par2 + 0.5D, (double)par3 + 0.1D, (double)par4 + 0.5D, "random.bowhit", 0.4F, 1.2F / (par1World.rand.nextFloat() * 0.2F + 0.9F)); + } + } + + private void notifyNeighborOfChange(World par1World, int par2, int par3, int par4, int par5) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); + + if (par5 == 3) + { + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID); + } + else if (par5 == 1) + { + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID); + } + else if (par5 == 0) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID); + } + else if (par5 == 2) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID); + } + } + + private boolean func_72144_l(World par1World, int par2, int par3, int par4) + { + if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + return false; + } + else + { + return true; + } + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 3; + float var6 = 0.1875F; + + if (var5 == 3) + { + this.setBlockBounds(0.0F, 0.2F, 0.5F - var6, var6 * 2.0F, 0.8F, 0.5F + var6); + } + else if (var5 == 1) + { + this.setBlockBounds(1.0F - var6 * 2.0F, 0.2F, 0.5F - var6, 1.0F, 0.8F, 0.5F + var6); + } + else if (var5 == 0) + { + this.setBlockBounds(0.5F - var6, 0.2F, 0.0F, 0.5F + var6, 0.8F, var6 * 2.0F); + } + else if (var5 == 2) + { + this.setBlockBounds(0.5F - var6, 0.2F, 1.0F - var6 * 2.0F, 0.5F + var6, 0.8F, 1.0F); + } + } + + /** + * Called on server worlds only when the block has been replaced by a different block ID, or the same block with a + * different metadata value, but before the new metadata value is set. Args: World, x, y, z, old block ID, old + * metadata + */ + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) + { + boolean var7 = (par6 & 4) == 4; + boolean var8 = (par6 & 8) == 8; + + if (var7 || var8) + { + this.func_72143_a(par1World, par2, par3, par4, 0, par6, false, -1, 0); + } + + if (var8) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this.blockID); + int var9 = par6 & 3; + + if (var9 == 3) + { + par1World.notifyBlocksOfNeighborChange(par2 - 1, par3, par4, this.blockID); + } + else if (var9 == 1) + { + par1World.notifyBlocksOfNeighborChange(par2 + 1, par3, par4, this.blockID); + } + else if (var9 == 0) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 - 1, this.blockID); + } + else if (var9 == 2) + { + par1World.notifyBlocksOfNeighborChange(par2, par3, par4 + 1, this.blockID); + } + } + + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + /** + * Returns true if the block is emitting indirect/weak redstone power on the specified side. If isBlockNormalCube + * returns true, standard redstone propagation rules will apply instead and this will not be called. Args: World, X, + * Y, Z, side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return (par1IBlockAccess.getBlockMetadata(par2, par3, par4) & 8) == 8 ? 15 : 0; + } + + /** + * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, + * side. Note that the side is reversed - eg it is 1 (up) when checking the bottom of the block. + */ + public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + + if ((var6 & 8) != 8) + { + return 0; + } + else + { + int var7 = var6 & 3; + return var7 == 2 && par5 == 2 ? 15 : (var7 == 0 && par5 == 3 ? 15 : (var7 == 1 && par5 == 4 ? 15 : (var7 == 3 && par5 == 5 ? 15 : 0))); + } + } + + /** + * Can this block provide power. Only wire currently seems to have this change based on its state. + */ + public boolean canProvidePower() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/BlockVine.java b/src/main/java/net/minecraft/src/BlockVine.java new file mode 100644 index 0000000..116ad92 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockVine.java @@ -0,0 +1,443 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockVine extends Block +{ + public BlockVine(int par1) + { + super(par1, Material.vine); + this.setTickRandomly(true); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Sets the block's bounds for rendering it as an item + */ + public void setBlockBoundsForItemRender() + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 20; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + float var5 = 0.0625F; + int var6 = par1IBlockAccess.getBlockMetadata(par2, par3, par4); + float var7 = 1.0F; + float var8 = 1.0F; + float var9 = 1.0F; + float var10 = 0.0F; + float var11 = 0.0F; + float var12 = 0.0F; + boolean var13 = var6 > 0; + + if ((var6 & 2) != 0) + { + var10 = Math.max(var10, 0.0625F); + var7 = 0.0F; + var8 = 0.0F; + var11 = 1.0F; + var9 = 0.0F; + var12 = 1.0F; + var13 = true; + } + + if ((var6 & 8) != 0) + { + var7 = Math.min(var7, 0.9375F); + var10 = 1.0F; + var8 = 0.0F; + var11 = 1.0F; + var9 = 0.0F; + var12 = 1.0F; + var13 = true; + } + + if ((var6 & 4) != 0) + { + var12 = Math.max(var12, 0.0625F); + var9 = 0.0F; + var7 = 0.0F; + var10 = 1.0F; + var8 = 0.0F; + var11 = 1.0F; + var13 = true; + } + + if ((var6 & 1) != 0) + { + var9 = Math.min(var9, 0.9375F); + var12 = 1.0F; + var7 = 0.0F; + var10 = 1.0F; + var8 = 0.0F; + var11 = 1.0F; + var13 = true; + } + + if (!var13 && this.canBePlacedOn(par1IBlockAccess.getBlockId(par2, par3 + 1, par4))) + { + var8 = Math.min(var8, 0.9375F); + var11 = 1.0F; + var7 = 0.0F; + var10 = 1.0F; + var9 = 0.0F; + var12 = 1.0F; + } + + this.setBlockBounds(var7, var8, var9, var10, var11, var12); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * checks to see if you can place this block can be placed on that side of a block: BlockLever overrides + */ + public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + { + switch (par5) + { + case 1: + return this.canBePlacedOn(par1World.getBlockId(par2, par3 + 1, par4)); + + case 2: + return this.canBePlacedOn(par1World.getBlockId(par2, par3, par4 + 1)); + + case 3: + return this.canBePlacedOn(par1World.getBlockId(par2, par3, par4 - 1)); + + case 4: + return this.canBePlacedOn(par1World.getBlockId(par2 + 1, par3, par4)); + + case 5: + return this.canBePlacedOn(par1World.getBlockId(par2 - 1, par3, par4)); + + default: + return false; + } + } + + /** + * returns true if a vine can be placed on that block (checks for render as normal block and if it is solid) + */ + private boolean canBePlacedOn(int par1) + { + if (par1 == 0) + { + return false; + } + else + { + Block var2 = Block.blocksList[par1]; + return var2.renderAsNormalBlock() && var2.blockMaterial.blocksMovement(); + } + } + + /** + * Returns if the vine can stay in the world. It also changes the metadata according to neighboring blocks. + */ + private boolean canVineStay(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockMetadata(par2, par3, par4); + int var6 = var5; + + if (var5 > 0) + { + for (int var7 = 0; var7 <= 3; ++var7) + { + int var8 = 1 << var7; + + if ((var5 & var8) != 0 && !this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var7], par3, par4 + Direction.offsetZ[var7])) && (par1World.getBlockId(par2, par3 + 1, par4) != this.blockID || (par1World.getBlockMetadata(par2, par3 + 1, par4) & var8) == 0)) + { + var6 &= ~var8; + } + } + } + + if (var6 == 0 && !this.canBePlacedOn(par1World.getBlockId(par2, par3 + 1, par4))) + { + return false; + } + else + { + if (var6 != var5) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var6, 2); + } + + return true; + } + } + + public int getBlockColor() + { + return ColorizerFoliage.getFoliageColorBasic(); + } + + /** + * Returns the color this block should be rendered. Used by leaves. + */ + public int getRenderColor(int par1) + { + return ColorizerFoliage.getFoliageColorBasic(); + } + + /** + * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called + * when first determining what to render. + */ + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return par1IBlockAccess.getBiomeGenForCoords(par2, par4).getBiomeFoliageColor(); + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor blockID + */ + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) + { + if (!par1World.isRemote && !this.canVineStay(par1World, par2, par3, par4)) + { + this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0); + par1World.setBlockToAir(par2, par3, par4); + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) + { + if (!par1World.isRemote && par1World.rand.nextInt(4) == 0) + { + byte var6 = 4; + int var7 = 5; + boolean var8 = false; + int var9; + int var10; + int var11; + label138: + + for (var9 = par2 - var6; var9 <= par2 + var6; ++var9) + { + for (var10 = par4 - var6; var10 <= par4 + var6; ++var10) + { + for (var11 = par3 - 1; var11 <= par3 + 1; ++var11) + { + if (par1World.getBlockId(var9, var11, var10) == this.blockID) + { + --var7; + + if (var7 <= 0) + { + var8 = true; + break label138; + } + } + } + } + } + + var9 = par1World.getBlockMetadata(par2, par3, par4); + var10 = par1World.rand.nextInt(6); + var11 = Direction.facingToDirection[var10]; + int var12; + int var13; + + if (var10 == 1 && par3 < 255 && par1World.isAirBlock(par2, par3 + 1, par4)) + { + if (var8) + { + return; + } + + var12 = par1World.rand.nextInt(16) & var9; + + if (var12 > 0) + { + for (var13 = 0; var13 <= 3; ++var13) + { + if (!this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var13], par3 + 1, par4 + Direction.offsetZ[var13]))) + { + var12 &= ~(1 << var13); + } + } + + if (var12 > 0) + { + par1World.setBlock(par2, par3 + 1, par4, this.blockID, var12, 2); + } + } + } + else + { + int var14; + + if (var10 >= 2 && var10 <= 5 && (var9 & 1 << var11) == 0) + { + if (var8) + { + return; + } + + var12 = par1World.getBlockId(par2 + Direction.offsetX[var11], par3, par4 + Direction.offsetZ[var11]); + + if (var12 != 0 && Block.blocksList[var12] != null) + { + if (Block.blocksList[var12].blockMaterial.isOpaque() && Block.blocksList[var12].renderAsNormalBlock()) + { + par1World.setBlockMetadataWithNotify(par2, par3, par4, var9 | 1 << var11, 2); + } + } + else + { + var13 = var11 + 1 & 3; + var14 = var11 + 3 & 3; + + if ((var9 & 1 << var13) != 0 && this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var11] + Direction.offsetX[var13], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var13]))) + { + par1World.setBlock(par2 + Direction.offsetX[var11], par3, par4 + Direction.offsetZ[var11], this.blockID, 1 << var13, 2); + } + else if ((var9 & 1 << var14) != 0 && this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var11] + Direction.offsetX[var14], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var14]))) + { + par1World.setBlock(par2 + Direction.offsetX[var11], par3, par4 + Direction.offsetZ[var11], this.blockID, 1 << var14, 2); + } + else if ((var9 & 1 << var13) != 0 && par1World.isAirBlock(par2 + Direction.offsetX[var11] + Direction.offsetX[var13], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var13]) && this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var13], par3, par4 + Direction.offsetZ[var13]))) + { + par1World.setBlock(par2 + Direction.offsetX[var11] + Direction.offsetX[var13], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var13], this.blockID, 1 << (var11 + 2 & 3), 2); + } + else if ((var9 & 1 << var14) != 0 && par1World.isAirBlock(par2 + Direction.offsetX[var11] + Direction.offsetX[var14], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var14]) && this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var14], par3, par4 + Direction.offsetZ[var14]))) + { + par1World.setBlock(par2 + Direction.offsetX[var11] + Direction.offsetX[var14], par3, par4 + Direction.offsetZ[var11] + Direction.offsetZ[var14], this.blockID, 1 << (var11 + 2 & 3), 2); + } + else if (this.canBePlacedOn(par1World.getBlockId(par2 + Direction.offsetX[var11], par3 + 1, par4 + Direction.offsetZ[var11]))) + { + par1World.setBlock(par2 + Direction.offsetX[var11], par3, par4 + Direction.offsetZ[var11], this.blockID, 0, 2); + } + } + } + else if (par3 > 1) + { + var12 = par1World.getBlockId(par2, par3 - 1, par4); + + if (var12 == 0) + { + var13 = par1World.rand.nextInt(16) & var9; + + if (var13 > 0) + { + par1World.setBlock(par2, par3 - 1, par4, this.blockID, var13, 2); + } + } + else if (var12 == this.blockID) + { + var13 = par1World.rand.nextInt(16) & var9; + var14 = par1World.getBlockMetadata(par2, par3 - 1, par4); + + if (var14 != (var14 | var13)) + { + par1World.setBlockMetadataWithNotify(par2, par3 - 1, par4, var14 | var13, 2); + } + } + } + } + } + } + + /** + * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata + */ + public int onBlockPlaced(World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) + { + byte var10 = 0; + + switch (par5) + { + case 2: + var10 = 1; + break; + + case 3: + var10 = 4; + break; + + case 4: + var10 = 8; + break; + + case 5: + var10 = 2; + } + + return var10 != 0 ? var10 : par9; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return 0; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random par1Random) + { + return 0; + } + + /** + * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the + * block and l is the block's subtype/damage. + */ + public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) + { + if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID) + { + par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); + this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.vine, 1, 0)); + } + else + { + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockWall.java b/src/main/java/net/minecraft/src/BlockWall.java new file mode 100644 index 0000000..031eee5 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockWall.java @@ -0,0 +1,168 @@ +package net.minecraft.src; + +import java.util.List; + +public class BlockWall extends Block +{ + /** The types of the wall. */ + public static final String[] types = new String[] {"normal", "mossy"}; + + public BlockWall(int par1, Block par2Block) + { + super(par1, par2Block.blockMaterial); + this.setHardness(par2Block.blockHardness); + this.setResistance(par2Block.blockResistance / 3.0F); + this.setStepSound(par2Block.stepSound); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par2 == 1 ? Block.cobblestoneMossy.getBlockTextureFromSide(par1) : Block.cobblestone.getBlockTextureFromSide(par1); + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 32; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + return false; + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + boolean var5 = this.canConnectWallTo(par1IBlockAccess, par2, par3, par4 - 1); + boolean var6 = this.canConnectWallTo(par1IBlockAccess, par2, par3, par4 + 1); + boolean var7 = this.canConnectWallTo(par1IBlockAccess, par2 - 1, par3, par4); + boolean var8 = this.canConnectWallTo(par1IBlockAccess, par2 + 1, par3, par4); + float var9 = 0.25F; + float var10 = 0.75F; + float var11 = 0.25F; + float var12 = 0.75F; + float var13 = 1.0F; + + if (var5) + { + var11 = 0.0F; + } + + if (var6) + { + var12 = 1.0F; + } + + if (var7) + { + var9 = 0.0F; + } + + if (var8) + { + var10 = 1.0F; + } + + if (var5 && var6 && !var7 && !var8) + { + var13 = 0.8125F; + var9 = 0.3125F; + var10 = 0.6875F; + } + else if (!var5 && !var6 && var7 && var8) + { + var13 = 0.8125F; + var11 = 0.3125F; + var12 = 0.6875F; + } + + this.setBlockBounds(var9, 0.0F, var11, var10, var13, var12); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); + this.maxY = 1.5D; + return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); + } + + /** + * Return whether an adjacent block can connect to a wall. + */ + public boolean canConnectWallTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var5 = par1IBlockAccess.getBlockId(par2, par3, par4); + + if (var5 != this.blockID && var5 != Block.fenceGate.blockID) + { + Block var6 = Block.blocksList[var5]; + return var6 != null && var6.blockMaterial.isOpaque() && var6.renderAsNormalBlock() ? var6.blockMaterial != Material.pumpkin : false; + } + else + { + return true; + } + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1; + } + + /** + * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given + * coordinates. Args: blockAccess, x, y, z, side + */ + public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return par5 == 0 ? super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5) : true; + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) {} +} diff --git a/src/main/java/net/minecraft/src/BlockWeb.java b/src/main/java/net/minecraft/src/BlockWeb.java new file mode 100644 index 0000000..aa10a7d --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockWeb.java @@ -0,0 +1,70 @@ +package net.minecraft.src; + +import java.util.Random; + +public class BlockWeb extends Block +{ + public BlockWeb(int par1) + { + super(par1, Material.web); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity + */ + public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) + { + par5Entity.setInWeb(); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) + { + return null; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 1; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Item.silk.itemID; + } + + /** + * Return true if a player with Silk Touch can harvest this block directly, and not its normal drops. + */ + protected boolean canSilkHarvest() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/BlockWood.java b/src/main/java/net/minecraft/src/BlockWood.java new file mode 100644 index 0000000..f827f2a --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockWood.java @@ -0,0 +1,62 @@ +package net.minecraft.src; + +import java.util.List; + +public class BlockWood extends Block +{ + /** The type of tree this block came from. */ + public static final String[] woodType = new String[] {"oak", "spruce", "birch", "jungle"}; + private Icon[] iconArray; + + public BlockWood(int par1) + { + super(par1, Material.wood); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + if (par2 < 0 || par2 >= this.iconArray.length) + { + par2 = 0; + } + + return this.iconArray[par2]; + } + + /** + * Determines the damage on the item the block drops. Used in cloth and wood. + */ + public int damageDropped(int par1) + { + return par1; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + par3List.add(new ItemStack(par1, 1, 2)); + par3List.add(new ItemStack(par1, 1, 3)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[woodType.length]; + + for (int var2 = 0; var2 < this.iconArray.length; ++var2) + { + this.iconArray[var2] = par1IconRegister.registerIcon(this.getTextureName() + "_" + woodType[var2]); + } + } +} diff --git a/src/main/java/net/minecraft/src/BlockWoodSlab.java b/src/main/java/net/minecraft/src/BlockWoodSlab.java new file mode 100644 index 0000000..b7ff955 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockWoodSlab.java @@ -0,0 +1,74 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class BlockWoodSlab extends BlockHalfSlab +{ + /** The type of tree this slab came from. */ + public static final String[] woodType = new String[] {"oak", "spruce", "birch", "jungle"}; + + public BlockWoodSlab(int par1, boolean par2) + { + super(par1, par2, Material.wood); + this.setCreativeTab(CreativeTabs.tabBlock); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return Block.planks.getIcon(par1, par2 & 7); + } + + /** + * Returns the ID of the items to drop on destruction. + */ + public int idDropped(int par1, Random par2Random, int par3) + { + return Block.woodSingleSlab.blockID; + } + + /** + * Returns an item stack containing a single instance of the current block type. 'i' is the block's subtype/damage + * and is ignored for blocks which do not support subtypes. Blocks which cannot be harvested should return null. + */ + protected ItemStack createStackedBlock(int par1) + { + return new ItemStack(Block.woodSingleSlab.blockID, 2, par1 & 7); + } + + /** + * Returns the slab block name with step type. + */ + public String getFullSlabName(int par1) + { + if (par1 < 0 || par1 >= woodType.length) + { + par1 = 0; + } + + return super.getUnlocalizedName() + "." + woodType[par1]; + } + + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ + public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + if (par1 != Block.woodDoubleSlab.blockID) + { + for (int var4 = 0; var4 < 4; ++var4) + { + par3List.add(new ItemStack(par1, 1, var4)); + } + } + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) {} +} diff --git a/src/main/java/net/minecraft/src/BlockWorkbench.java b/src/main/java/net/minecraft/src/BlockWorkbench.java new file mode 100644 index 0000000..ea8f3e0 --- /dev/null +++ b/src/main/java/net/minecraft/src/BlockWorkbench.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +public class BlockWorkbench extends Block +{ + private Icon workbenchIconTop; + private Icon workbenchIconFront; + + protected BlockWorkbench(int par1) + { + super(par1, Material.wood); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata + */ + public Icon getIcon(int par1, int par2) + { + return par1 == 1 ? this.workbenchIconTop : (par1 == 0 ? Block.planks.getBlockTextureFromSide(par1) : (par1 != 2 && par1 != 4 ? this.blockIcon : this.workbenchIconFront)); + } + + /** + * When this method is called, your block should register all the icons it needs with the given IconRegister. This + * is the only chance you get to register icons. + */ + public void registerIcons(IconRegister par1IconRegister) + { + this.blockIcon = par1IconRegister.registerIcon(this.getTextureName() + "_side"); + this.workbenchIconTop = par1IconRegister.registerIcon(this.getTextureName() + "_top"); + this.workbenchIconFront = par1IconRegister.registerIcon(this.getTextureName() + "_front"); + } + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par1World.isRemote) + { + return true; + } + else + { + par5EntityPlayer.displayGUIWorkbench(par2, par3, par4); + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/BossStatus.java b/src/main/java/net/minecraft/src/BossStatus.java new file mode 100644 index 0000000..e75a39d --- /dev/null +++ b/src/main/java/net/minecraft/src/BossStatus.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public final class BossStatus +{ + public static float healthScale; + public static int statusBarLength; + public static String bossName; + public static boolean field_82825_d; + + public static void setBossStatus(IBossDisplayData par0IBossDisplayData, boolean par1) + { + healthScale = par0IBossDisplayData.getHealth() / par0IBossDisplayData.getMaxHealth(); + statusBarLength = 100; + bossName = par0IBossDisplayData.getEntityName(); + field_82825_d = par1; + } +} diff --git a/src/main/java/net/minecraft/src/CallableBlockDataValue.java b/src/main/java/net/minecraft/src/CallableBlockDataValue.java new file mode 100644 index 0000000..6f1bc95 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableBlockDataValue.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +final class CallableBlockDataValue implements Callable +{ + final int field_85063_a; + + CallableBlockDataValue(int par1) + { + this.field_85063_a = par1; + } + + public String callBlockDataValue() + { + if (this.field_85063_a < 0) + { + return "Unknown? (Got " + this.field_85063_a + ")"; + } + else + { + String var1 = String.format("%4s", new Object[] {Integer.toBinaryString(this.field_85063_a)}).replace(" ", "0"); + return String.format("%1$d / 0x%1$X / 0b%2$s", new Object[] {Integer.valueOf(this.field_85063_a), var1}); + } + } + + public Object call() + { + return this.callBlockDataValue(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableBlockLocation.java b/src/main/java/net/minecraft/src/CallableBlockLocation.java new file mode 100644 index 0000000..5bed763 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableBlockLocation.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +final class CallableBlockLocation implements Callable +{ + final int blockXCoord; + + final int blockYCoord; + + final int blockZCoord; + + CallableBlockLocation(int par1, int par2, int par3) + { + this.blockXCoord = par1; + this.blockYCoord = par2; + this.blockZCoord = par3; + } + + public String callBlockLocationInfo() + { + return CrashReportCategory.getLocationInfo(this.blockXCoord, this.blockYCoord, this.blockZCoord); + } + + public Object call() + { + return this.callBlockLocationInfo(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableBlockType.java b/src/main/java/net/minecraft/src/CallableBlockType.java new file mode 100644 index 0000000..70c20b0 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableBlockType.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +final class CallableBlockType implements Callable +{ + final int blockID; + + CallableBlockType(int par1) + { + this.blockID = par1; + } + + public String callBlockType() + { + try + { + return String.format("ID #%d (%s // %s)", new Object[] {Integer.valueOf(this.blockID), Block.blocksList[this.blockID].getUnlocalizedName(), Block.blocksList[this.blockID].getClass().getCanonicalName()}); + } + catch (Throwable var2) + { + return "ID #" + this.blockID; + } + } + + public Object call() + { + return this.callBlockType(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableChunkPosHash.java b/src/main/java/net/minecraft/src/CallableChunkPosHash.java new file mode 100644 index 0000000..31bebb4 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableChunkPosHash.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableChunkPosHash implements Callable +{ + final int field_85165_a; + + final int field_85163_b; + + final MapGenStructure theMapStructureGenerator; + + CallableChunkPosHash(MapGenStructure par1MapGenStructure, int par2, int par3) + { + this.theMapStructureGenerator = par1MapGenStructure; + this.field_85165_a = par2; + this.field_85163_b = par3; + } + + public String callChunkPositionHash() + { + return String.valueOf(ChunkCoordIntPair.chunkXZ2Int(this.field_85165_a, this.field_85163_b)); + } + + public Object call() + { + return this.callChunkPositionHash(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableClientMemoryStats.java b/src/main/java/net/minecraft/src/CallableClientMemoryStats.java new file mode 100644 index 0000000..e31bf7b --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableClientMemoryStats.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableClientMemoryStats implements Callable +{ + final Minecraft theMinecraft; + + CallableClientMemoryStats(Minecraft par1Minecraft) + { + this.theMinecraft = par1Minecraft; + } + + public String callClientMemoryStats() + { + return this.theMinecraft.mcProfiler.profilingEnabled ? this.theMinecraft.mcProfiler.getNameOfLastSection() : "N/A (disabled)"; + } + + public Object call() + { + return this.callClientMemoryStats(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableClientProfiler.java b/src/main/java/net/minecraft/src/CallableClientProfiler.java new file mode 100644 index 0000000..cad020e --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableClientProfiler.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableClientProfiler implements Callable +{ + final Minecraft theMinecraft; + + CallableClientProfiler(Minecraft par1Minecraft) + { + this.theMinecraft = par1Minecraft; + } + + public String callClientProfilerInfo() + { + return Minecraft.func_142024_b(this.theMinecraft).getCurrentLanguage().toString(); + } + + public Object call() + { + return this.callClientProfilerInfo(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableConnectionName.java b/src/main/java/net/minecraft/src/CallableConnectionName.java new file mode 100644 index 0000000..c035d58 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableConnectionName.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableConnectionName implements Callable +{ + final NetServerHandler field_111201_a; + + final NetworkListenThread field_111200_b; + + CallableConnectionName(NetworkListenThread par1NetworkListenThread, NetServerHandler par2NetServerHandler) + { + this.field_111200_b = par1NetworkListenThread; + this.field_111201_a = par2NetServerHandler; + } + + public String func_111199_a() + { + return this.field_111201_a.toString(); + } + + public Object call() + { + return this.func_111199_a(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableCrashMemoryReport.java b/src/main/java/net/minecraft/src/CallableCrashMemoryReport.java new file mode 100644 index 0000000..611454d --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableCrashMemoryReport.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableCrashMemoryReport implements Callable +{ + final CrashReport theCrashReport; + + CallableCrashMemoryReport(CrashReport par1CrashReport) + { + this.theCrashReport = par1CrashReport; + } + + /** + * Returns a string with allocated and used memory. + */ + public String getMemoryReport() + { + int var1 = AxisAlignedBB.getAABBPool().getlistAABBsize(); + int var2 = 56 * var1; + int var3 = var2 / 1024 / 1024; + int var4 = AxisAlignedBB.getAABBPool().getnextPoolIndex(); + int var5 = 56 * var4; + int var6 = var5 / 1024 / 1024; + return var1 + " (" + var2 + " bytes; " + var3 + " MB) allocated, " + var4 + " (" + var5 + " bytes; " + var6 + " MB) used"; + } + + public Object call() + { + return this.getMemoryReport(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableEntityName.java b/src/main/java/net/minecraft/src/CallableEntityName.java new file mode 100644 index 0000000..1f0f5a7 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableEntityName.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableEntityName implements Callable +{ + final Entity theEntity; + + CallableEntityName(Entity par1Entity) + { + this.theEntity = par1Entity; + } + + public String callEntityName() + { + return this.theEntity.getEntityName(); + } + + public Object call() + { + return this.callEntityName(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableEntityTracker.java b/src/main/java/net/minecraft/src/CallableEntityTracker.java new file mode 100644 index 0000000..e9b2ec5 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableEntityTracker.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableEntityTracker implements Callable +{ + final int field_96570_a; + + final EntityTracker theEntityTracker; + + CallableEntityTracker(EntityTracker par1EntityTracker, int par2) + { + this.theEntityTracker = par1EntityTracker; + this.field_96570_a = par2; + } + + public String func_96568_a() + { + String var1 = "Once per " + this.field_96570_a + " ticks"; + + if (this.field_96570_a == Integer.MAX_VALUE) + { + var1 = "Maximum (" + var1 + ")"; + } + + return var1; + } + + public Object call() + { + return this.func_96568_a(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableEntityType.java b/src/main/java/net/minecraft/src/CallableEntityType.java new file mode 100644 index 0000000..ffa95a0 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableEntityType.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableEntityType implements Callable +{ + final Entity theEntity; + + CallableEntityType(Entity par1Entity) + { + this.theEntity = par1Entity; + } + + public String callEntityType() + { + return EntityList.getEntityString(this.theEntity) + " (" + this.theEntity.getClass().getCanonicalName() + ")"; + } + + public Object call() + { + return this.callEntityType(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableGLInfo.java b/src/main/java/net/minecraft/src/CallableGLInfo.java new file mode 100644 index 0000000..65f452a --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableGLInfo.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; +import org.lwjgl.opengl.GL11; + +class CallableGLInfo implements Callable +{ + /** The Minecraft instance. */ + final Minecraft mc; + + CallableGLInfo(Minecraft par1Minecraft) + { + this.mc = par1Minecraft; + } + + public String getTexturePack() + { + return GL11.glGetString(GL11.GL_RENDERER) + " GL version " + GL11.glGetString(GL11.GL_VERSION) + ", " + GL11.glGetString(GL11.GL_VENDOR); + } + + public Object call() + { + return this.getTexturePack(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableIntCache.java b/src/main/java/net/minecraft/src/CallableIntCache.java new file mode 100644 index 0000000..208ce5e --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableIntCache.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableIntCache implements Callable +{ + final CrashReport theCrashReport; + + CallableIntCache(CrashReport par1CrashReport) + { + this.theCrashReport = par1CrashReport; + } + + public String func_85083_a() + { + return IntCache.func_85144_b(); + } + + public Object call() + { + return this.func_85083_a(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableIsFeatureChunk.java b/src/main/java/net/minecraft/src/CallableIsFeatureChunk.java new file mode 100644 index 0000000..a59a480 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableIsFeatureChunk.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableIsFeatureChunk implements Callable +{ + final int field_85169_a; + + final int field_85167_b; + + final MapGenStructure theMapStructureGenerator; + + CallableIsFeatureChunk(MapGenStructure par1MapGenStructure, int par2, int par3) + { + this.theMapStructureGenerator = par1MapGenStructure; + this.field_85169_a = par2; + this.field_85167_b = par3; + } + + public String func_85166_a() + { + return this.theMapStructureGenerator.canSpawnStructureAtCoords(this.field_85169_a, this.field_85167_b) ? "True" : "False"; + } + + public Object call() + { + return this.func_85166_a(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableIsModded.java b/src/main/java/net/minecraft/src/CallableIsModded.java new file mode 100644 index 0000000..026789e --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableIsModded.java @@ -0,0 +1,38 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; +import net.minecraft.client.ClientBrandRetriever; + +class CallableIsModded implements Callable +{ + /** Reference to the IntegratedServer object. */ + final IntegratedServer theIntegratedServer; + + CallableIsModded(IntegratedServer par1IntegratedServer) + { + this.theIntegratedServer = par1IntegratedServer; + } + + /** + * Gets if your Minecraft is Modded. + */ + public String getMinecraftIsModded() + { + String var1 = ClientBrandRetriever.getClientModName(); + + if (!var1.equals("vanilla")) + { + return "Definitely; Client brand changed to \'" + var1 + "\'"; + } + else + { + var1 = this.theIntegratedServer.getServerModName(); + return !var1.equals("vanilla") ? "Definitely; Server brand changed to \'" + var1 + "\'" : (Minecraft.class.getSigners() == null ? "Very likely; Jar signature invalidated" : "Probably not. Jar signature remains and both client + server brands are untouched."); + } + } + + public Object call() + { + return this.getMinecraftIsModded(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableIsServerModded.java b/src/main/java/net/minecraft/src/CallableIsServerModded.java new file mode 100644 index 0000000..ec2b587 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableIsServerModded.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; +import net.minecraft.server.MinecraftServer; + +public class CallableIsServerModded implements Callable +{ + /** Reference to the MinecraftServer object. */ + final MinecraftServer mcServer; + + public CallableIsServerModded(MinecraftServer par1MinecraftServer) + { + this.mcServer = par1MinecraftServer; + } + + public String func_96558_a() + { + return this.mcServer.theProfiler.profilingEnabled ? this.mcServer.theProfiler.getNameOfLastSection() : "N/A (disabled)"; + } + + public Object call() + { + return this.func_96558_a(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableItemName.java b/src/main/java/net/minecraft/src/CallableItemName.java new file mode 100644 index 0000000..0750cb3 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableItemName.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableItemName implements Callable +{ + final ItemStack theItemStack; + + final InventoryPlayer playerInventory; + + CallableItemName(InventoryPlayer par1InventoryPlayer, ItemStack par2ItemStack) + { + this.playerInventory = par1InventoryPlayer; + this.theItemStack = par2ItemStack; + } + + public String callItemDisplayName() + { + return this.theItemStack.getDisplayName(); + } + + public Object call() + { + return this.callItemDisplayName(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableJVMFlags.java b/src/main/java/net/minecraft/src/CallableJVMFlags.java new file mode 100644 index 0000000..c806fdf --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableJVMFlags.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.Callable; + +class CallableJVMFlags implements Callable +{ + /** Reference to the CrashReport object. */ + final CrashReport theCrashReport; + + CallableJVMFlags(CrashReport par1CrashReport) + { + this.theCrashReport = par1CrashReport; + } + + /** + * Returns the number of JVM Flags along with the passed JVM Flags. + */ + public String getJVMFlagsAsString() + { + RuntimeMXBean var1 = ManagementFactory.getRuntimeMXBean(); + List var2 = var1.getInputArguments(); + int var3 = 0; + StringBuilder var4 = new StringBuilder(); + Iterator var5 = var2.iterator(); + + while (var5.hasNext()) + { + String var6 = (String)var5.next(); + + if (var6.startsWith("-X")) + { + if (var3++ > 0) + { + var4.append(" "); + } + + var4.append(var6); + } + } + + return String.format("%d total; %s", new Object[] {Integer.valueOf(var3), var4.toString()}); + } + + public Object call() + { + return this.getJVMFlagsAsString(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableJavaInfo.java b/src/main/java/net/minecraft/src/CallableJavaInfo.java new file mode 100644 index 0000000..8f0447f --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableJavaInfo.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableJavaInfo implements Callable +{ + /** Reference to the CrashReport object. */ + final CrashReport theCrashReport; + + CallableJavaInfo(CrashReport par1CrashReport) + { + this.theCrashReport = par1CrashReport; + } + + /** + * Returns the Java VM Information as a String. Includes the Version and Vender. + */ + public String getJavaInfoAsString() + { + return System.getProperty("java.version") + ", " + System.getProperty("java.vendor"); + } + + public Object call() + { + return this.getJavaInfoAsString(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableJavaInfo2.java b/src/main/java/net/minecraft/src/CallableJavaInfo2.java new file mode 100644 index 0000000..a03a665 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableJavaInfo2.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableJavaInfo2 implements Callable +{ + /** Reference to the CrashReport object. */ + final CrashReport theCrashReport; + + CallableJavaInfo2(CrashReport par1CrashReport) + { + this.theCrashReport = par1CrashReport; + } + + /** + * Retuns the Java VM Information as a String. Includes the VM Name, VM Info and VM Vendor. + */ + public String getJavaVMInfoAsString() + { + return System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor"); + } + + public Object call() + { + return this.getJavaVMInfoAsString(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLWJGLVersion.java b/src/main/java/net/minecraft/src/CallableLWJGLVersion.java new file mode 100644 index 0000000..4ca0c2c --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLWJGLVersion.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; +import org.lwjgl.Sys; + +class CallableLWJGLVersion implements Callable +{ + /** Reference to the Minecraft object. */ + final Minecraft mc; + + CallableLWJGLVersion(Minecraft par1Minecraft) + { + this.mc = par1Minecraft; + } + + public String getType() + { + return Sys.getVersion(); + } + + public Object call() + { + return this.getType(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLaunchedVersion.java b/src/main/java/net/minecraft/src/CallableLaunchedVersion.java new file mode 100644 index 0000000..b0b01c7 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLaunchedVersion.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLaunchedVersion implements Callable +{ + /** Reference to the Minecraft object. */ + final Minecraft mc; + + CallableLaunchedVersion(Minecraft par1Minecraft) + { + this.mc = par1Minecraft; + } + + public String getLWJGLVersion() + { + return Minecraft.getLaunchedVersion(this.mc); + } + + public Object call() + { + return this.getLWJGLVersion(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLevelDimension.java b/src/main/java/net/minecraft/src/CallableLevelDimension.java new file mode 100644 index 0000000..8256089 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLevelDimension.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLevelDimension implements Callable +{ + final WorldInfo worldInfoInstance; + + CallableLevelDimension(WorldInfo par1WorldInfo) + { + this.worldInfoInstance = par1WorldInfo; + } + + public String callLevelDimension() + { + return String.valueOf(WorldInfo.func_85122_i(this.worldInfoInstance)); + } + + public Object call() + { + return this.callLevelDimension(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLevelGamemode.java b/src/main/java/net/minecraft/src/CallableLevelGamemode.java new file mode 100644 index 0000000..d8f901c --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLevelGamemode.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLevelGamemode implements Callable +{ + final WorldInfo worldInfoInstance; + + CallableLevelGamemode(WorldInfo par1WorldInfo) + { + this.worldInfoInstance = par1WorldInfo; + } + + public String callLevelGameModeInfo() + { + return String.format("Game mode: %s (ID %d). Hardcore: %b. Cheats: %b", new Object[] {WorldInfo.getGameType(this.worldInfoInstance).getName(), Integer.valueOf(WorldInfo.getGameType(this.worldInfoInstance).getID()), Boolean.valueOf(WorldInfo.func_85117_p(this.worldInfoInstance)), Boolean.valueOf(WorldInfo.func_85131_q(this.worldInfoInstance))}); + } + + public Object call() + { + return this.callLevelGameModeInfo(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLevelGenerator.java b/src/main/java/net/minecraft/src/CallableLevelGenerator.java new file mode 100644 index 0000000..ad7985e --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLevelGenerator.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLevelGenerator implements Callable +{ + final WorldInfo worldInfoInstance; + + CallableLevelGenerator(WorldInfo par1WorldInfo) + { + this.worldInfoInstance = par1WorldInfo; + } + + public String callLevelGeneratorInfo() + { + return String.format("ID %02d - %s, ver %d. Features enabled: %b", new Object[] {Integer.valueOf(WorldInfo.getTerrainTypeOfWorld(this.worldInfoInstance).getWorldTypeID()), WorldInfo.getTerrainTypeOfWorld(this.worldInfoInstance).getWorldTypeName(), Integer.valueOf(WorldInfo.getTerrainTypeOfWorld(this.worldInfoInstance).getGeneratorVersion()), Boolean.valueOf(WorldInfo.getMapFeaturesEnabled(this.worldInfoInstance))}); + } + + public Object call() + { + return this.callLevelGeneratorInfo(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLevelGeneratorOptions.java b/src/main/java/net/minecraft/src/CallableLevelGeneratorOptions.java new file mode 100644 index 0000000..fb8e685 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLevelGeneratorOptions.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLevelGeneratorOptions implements Callable +{ + final WorldInfo worldInfoInstance; + + CallableLevelGeneratorOptions(WorldInfo par1WorldInfo) + { + this.worldInfoInstance = par1WorldInfo; + } + + public String callLevelGeneratorOptions() + { + return WorldInfo.getWorldGeneratorOptions(this.worldInfoInstance); + } + + public Object call() + { + return this.callLevelGeneratorOptions(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLevelSeed.java b/src/main/java/net/minecraft/src/CallableLevelSeed.java new file mode 100644 index 0000000..36c2c23 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLevelSeed.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLevelSeed implements Callable +{ + final WorldInfo worldInfoInstance; + + CallableLevelSeed(WorldInfo par1WorldInfo) + { + this.worldInfoInstance = par1WorldInfo; + } + + public String callLevelSeed() + { + return String.valueOf(this.worldInfoInstance.getSeed()); + } + + public Object call() + { + return this.callLevelSeed(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLevelSpawnLocation.java b/src/main/java/net/minecraft/src/CallableLevelSpawnLocation.java new file mode 100644 index 0000000..6e528f5 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLevelSpawnLocation.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLevelSpawnLocation implements Callable +{ + final WorldInfo worldInfoInstance; + + CallableLevelSpawnLocation(WorldInfo par1WorldInfo) + { + this.worldInfoInstance = par1WorldInfo; + } + + public String callLevelSpawnLocation() + { + return CrashReportCategory.getLocationInfo(WorldInfo.getSpawnXCoordinate(this.worldInfoInstance), WorldInfo.getSpawnYCoordinate(this.worldInfoInstance), WorldInfo.getSpawnZCoordinate(this.worldInfoInstance)); + } + + public Object call() + { + return this.callLevelSpawnLocation(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLevelStorageVersion.java b/src/main/java/net/minecraft/src/CallableLevelStorageVersion.java new file mode 100644 index 0000000..f52dbb9 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLevelStorageVersion.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLevelStorageVersion implements Callable +{ + final WorldInfo worldInfoInstance; + + CallableLevelStorageVersion(WorldInfo par1WorldInfo) + { + this.worldInfoInstance = par1WorldInfo; + } + + public String callLevelStorageFormat() + { + String var1 = "Unknown?"; + + try + { + switch (WorldInfo.getSaveVersion(this.worldInfoInstance)) + { + case 19132: + var1 = "McRegion"; + break; + + case 19133: + var1 = "Anvil"; + } + } + catch (Throwable var3) + { + ; + } + + return String.format("0x%05X - %s", new Object[] {Integer.valueOf(WorldInfo.getSaveVersion(this.worldInfoInstance)), var1}); + } + + public Object call() + { + return this.callLevelStorageFormat(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLevelTime.java b/src/main/java/net/minecraft/src/CallableLevelTime.java new file mode 100644 index 0000000..07d7d33 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLevelTime.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLevelTime implements Callable +{ + final WorldInfo worldInfoInstance; + + CallableLevelTime(WorldInfo par1WorldInfo) + { + this.worldInfoInstance = par1WorldInfo; + } + + public String callLevelTime() + { + return String.format("%d game time, %d day time", new Object[] {Long.valueOf(WorldInfo.func_85126_g(this.worldInfoInstance)), Long.valueOf(WorldInfo.getWorldTime(this.worldInfoInstance))}); + } + + public Object call() + { + return this.callLevelTime(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLevelWeather.java b/src/main/java/net/minecraft/src/CallableLevelWeather.java new file mode 100644 index 0000000..04e3096 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLevelWeather.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLevelWeather implements Callable +{ + final WorldInfo worldInfoInstance; + + CallableLevelWeather(WorldInfo par1WorldInfo) + { + this.worldInfoInstance = par1WorldInfo; + } + + public String callLevelWeatherInfo() + { + return String.format("Rain time: %d (now: %b), thunder time: %d (now: %b)", new Object[] {Integer.valueOf(WorldInfo.getRainTime(this.worldInfoInstance)), Boolean.valueOf(WorldInfo.getRaining(this.worldInfoInstance)), Integer.valueOf(WorldInfo.getThunderTime(this.worldInfoInstance)), Boolean.valueOf(WorldInfo.getThundering(this.worldInfoInstance))}); + } + + public Object call() + { + return this.callLevelWeatherInfo(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLvl1.java b/src/main/java/net/minecraft/src/CallableLvl1.java new file mode 100644 index 0000000..9d1c26f --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLvl1.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLvl1 implements Callable +{ + final int field_85179_a; + + /** Reference to the World object. */ + final World theWorld; + + CallableLvl1(World par1World, int par2) + { + this.theWorld = par1World; + this.field_85179_a = par2; + } + + public String getWorldEntitiesAsString() + { + try + { + return String.format("ID #%d (%s // %s)", new Object[] {Integer.valueOf(this.field_85179_a), Block.blocksList[this.field_85179_a].getUnlocalizedName(), Block.blocksList[this.field_85179_a].getClass().getCanonicalName()}); + } + catch (Throwable var2) + { + return "ID #" + this.field_85179_a; + } + } + + public Object call() + { + return this.getWorldEntitiesAsString(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLvl2.java b/src/main/java/net/minecraft/src/CallableLvl2.java new file mode 100644 index 0000000..671a4b5 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLvl2.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLvl2 implements Callable +{ + /** Reference to the World object. */ + final World theWorld; + + CallableLvl2(World par1World) + { + this.theWorld = par1World; + } + + /** + * Returns the size and contents of the player entity list. + */ + public String getPlayerEntities() + { + return this.theWorld.playerEntities.size() + " total; " + this.theWorld.playerEntities.toString(); + } + + public Object call() + { + return this.getPlayerEntities(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableLvl3.java b/src/main/java/net/minecraft/src/CallableLvl3.java new file mode 100644 index 0000000..86f7fb6 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableLvl3.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableLvl3 implements Callable +{ + /** Reference to the World object. */ + final World theWorld; + + CallableLvl3(World par1World) + { + this.theWorld = par1World; + } + + /** + * Returns the result of the ChunkProvider's makeString + */ + public String getChunkProvider() + { + return this.theWorld.chunkProvider.makeString(); + } + + public Object call() + { + return this.getChunkProvider(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableMPL1.java b/src/main/java/net/minecraft/src/CallableMPL1.java new file mode 100644 index 0000000..c567a5b --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableMPL1.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableMPL1 implements Callable +{ + /** Reference to the WorldClient object. */ + final WorldClient theWorldClient; + + CallableMPL1(WorldClient par1WorldClient) + { + this.theWorldClient = par1WorldClient; + } + + /** + * Returns the size and contents of the entity list. + */ + public String getEntityCountAndList() + { + return WorldClient.getEntityList(this.theWorldClient).size() + " total; " + WorldClient.getEntityList(this.theWorldClient).toString(); + } + + public Object call() + { + return this.getEntityCountAndList(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableMPL2.java b/src/main/java/net/minecraft/src/CallableMPL2.java new file mode 100644 index 0000000..fe457ff --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableMPL2.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableMPL2 implements Callable +{ + /** Reference to the WorldClient object. */ + final WorldClient theWorldClient; + + CallableMPL2(WorldClient par1WorldClient) + { + this.theWorldClient = par1WorldClient; + } + + /** + * Returns the size and contents of the entity spawn queue. + */ + public String getEntitySpawnQueueCountAndList() + { + return WorldClient.getEntitySpawnQueue(this.theWorldClient).size() + " total; " + WorldClient.getEntitySpawnQueue(this.theWorldClient).toString(); + } + + public Object call() + { + return this.getEntitySpawnQueueCountAndList(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableMemoryInfo.java b/src/main/java/net/minecraft/src/CallableMemoryInfo.java new file mode 100644 index 0000000..6085aa2 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableMemoryInfo.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableMemoryInfo implements Callable +{ + /** Reference to the CrashReport object. */ + final CrashReport theCrashReport; + + CallableMemoryInfo(CrashReport par1CrashReport) + { + this.theCrashReport = par1CrashReport; + } + + /** + * Returns the memory information as a String. Includes the Free Memory in bytes and MB, Total Memory in bytes and + * MB, and Max Memory in Bytes and MB. + */ + public String getMemoryInfoAsString() + { + Runtime var1 = Runtime.getRuntime(); + long var2 = var1.maxMemory(); + long var4 = var1.totalMemory(); + long var6 = var1.freeMemory(); + long var8 = var2 / 1024L / 1024L; + long var10 = var4 / 1024L / 1024L; + long var12 = var6 / 1024L / 1024L; + return var6 + " bytes (" + var12 + " MB) / " + var4 + " bytes (" + var10 + " MB) up to " + var2 + " bytes (" + var8 + " MB)"; + } + + public Object call() + { + return this.getMemoryInfoAsString(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableMinecraftVersion.java b/src/main/java/net/minecraft/src/CallableMinecraftVersion.java new file mode 100644 index 0000000..9f92ef3 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableMinecraftVersion.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableMinecraftVersion implements Callable +{ + /** Reference to the CrashReport object. */ + final CrashReport theCrashReport; + + CallableMinecraftVersion(CrashReport par1CrashReport) + { + this.theCrashReport = par1CrashReport; + } + + /** + * The current version of Minecraft + */ + public String minecraftVersion() + { + return "1.6.4"; + } + + public Object call() + { + return this.minecraftVersion(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableModded.java b/src/main/java/net/minecraft/src/CallableModded.java new file mode 100644 index 0000000..370962a --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableModded.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; +import net.minecraft.client.ClientBrandRetriever; + +class CallableModded implements Callable +{ + /** Reference to the Minecraft object. */ + final Minecraft mc; + + CallableModded(Minecraft par1Minecraft) + { + this.mc = par1Minecraft; + } + + /** + * Gets if Client Profiler (aka Snooper) is enabled. + */ + public String getClientProfilerEnabled() + { + String var1 = ClientBrandRetriever.getClientModName(); + return !var1.equals("vanilla") ? "Definitely; Client brand changed to \'" + var1 + "\'" : (Minecraft.class.getSigners() == null ? "Very likely; Jar signature invalidated" : "Probably not. Jar signature remains and client brand is untouched."); + } + + public Object call() + { + return this.getClientProfilerEnabled(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableMouseLocation.java b/src/main/java/net/minecraft/src/CallableMouseLocation.java new file mode 100644 index 0000000..c76084c --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableMouseLocation.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; +import org.lwjgl.input.Mouse; + +class CallableMouseLocation implements Callable +{ + final int field_90026_a; + + final int field_90024_b; + + final EntityRenderer theEntityRenderer; + + CallableMouseLocation(EntityRenderer par1EntityRenderer, int par2, int par3) + { + this.theEntityRenderer = par1EntityRenderer; + this.field_90026_a = par2; + this.field_90024_b = par3; + } + + public String callMouseLocation() + { + return String.format("Scaled: (%d, %d). Absolute: (%d, %d)", new Object[] {Integer.valueOf(this.field_90026_a), Integer.valueOf(this.field_90024_b), Integer.valueOf(Mouse.getX()), Integer.valueOf(Mouse.getY())}); + } + + public Object call() + { + return this.callMouseLocation(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableOSInfo.java b/src/main/java/net/minecraft/src/CallableOSInfo.java new file mode 100644 index 0000000..fd728ee --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableOSInfo.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableOSInfo implements Callable +{ + /** Reference to the CrashReport object. */ + final CrashReport theCrashReport; + + CallableOSInfo(CrashReport par1CrashReport) + { + this.theCrashReport = par1CrashReport; + } + + public String getOsAsString() + { + return System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version"); + } + + public Object call() + { + return this.getOsAsString(); + } +} diff --git a/src/main/java/net/minecraft/src/CallablePacketClass.java b/src/main/java/net/minecraft/src/CallablePacketClass.java new file mode 100644 index 0000000..b060761 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallablePacketClass.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallablePacketClass implements Callable +{ + final Packet thePacket; + + final NetServerHandler theNetServerHandler; + + CallablePacketClass(NetServerHandler par1NetServerHandler, Packet par2Packet) + { + this.theNetServerHandler = par1NetServerHandler; + this.thePacket = par2Packet; + } + + public String getPacketClass() + { + return this.thePacket.getClass().getCanonicalName(); + } + + public Object call() + { + return this.getPacketClass(); + } +} diff --git a/src/main/java/net/minecraft/src/CallablePacketID.java b/src/main/java/net/minecraft/src/CallablePacketID.java new file mode 100644 index 0000000..8f1529f --- /dev/null +++ b/src/main/java/net/minecraft/src/CallablePacketID.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallablePacketID implements Callable +{ + final Packet thePacket; + + final NetServerHandler theNetServerHandler; + + CallablePacketID(NetServerHandler par1NetServerHandler, Packet par2Packet) + { + this.theNetServerHandler = par1NetServerHandler; + this.thePacket = par2Packet; + } + + public String callPacketID() + { + return String.valueOf(this.thePacket.getPacketId()); + } + + public Object call() + { + return this.callPacketID(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableParticlePositionInfo.java b/src/main/java/net/minecraft/src/CallableParticlePositionInfo.java new file mode 100644 index 0000000..d7c8db1 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableParticlePositionInfo.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableParticlePositionInfo implements Callable +{ + final double posX; + + final double posY; + + final double posZ; + + final RenderGlobal globalRenderer; + + CallableParticlePositionInfo(RenderGlobal par1RenderGlobal, double par2, double par4, double par6) + { + this.globalRenderer = par1RenderGlobal; + this.posX = par2; + this.posY = par4; + this.posZ = par6; + } + + public String callParticlePositionInfo() + { + return CrashReportCategory.func_85074_a(this.posX, this.posY, this.posZ); + } + + public Object call() + { + return this.callParticlePositionInfo(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableParticleScreenName.java b/src/main/java/net/minecraft/src/CallableParticleScreenName.java new file mode 100644 index 0000000..0f75c53 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableParticleScreenName.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableParticleScreenName implements Callable +{ + final Minecraft theMinecraft; + + CallableParticleScreenName(Minecraft par1Minecraft) + { + this.theMinecraft = par1Minecraft; + } + + public String callParticleScreenName() + { + return this.theMinecraft.currentScreen.getClass().getCanonicalName(); + } + + public Object call() + { + return this.callParticleScreenName(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableScreenName.java b/src/main/java/net/minecraft/src/CallableScreenName.java new file mode 100644 index 0000000..875ee79 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableScreenName.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableScreenName implements Callable +{ + final EntityRenderer entityRender; + + CallableScreenName(EntityRenderer par1EntityRenderer) + { + this.entityRender = par1EntityRenderer; + } + + public String callScreenName() + { + return EntityRenderer.getRendererMinecraft(this.entityRender).currentScreen.getClass().getCanonicalName(); + } + + public Object call() + { + return this.callScreenName(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableScreenSize.java b/src/main/java/net/minecraft/src/CallableScreenSize.java new file mode 100644 index 0000000..98f34c3 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableScreenSize.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableScreenSize implements Callable +{ + final ScaledResolution theScaledResolution; + + final EntityRenderer theEntityRenderer; + + CallableScreenSize(EntityRenderer par1EntityRenderer, ScaledResolution par2ScaledResolution) + { + this.theEntityRenderer = par1EntityRenderer; + this.theScaledResolution = par2ScaledResolution; + } + + public String callScreenSize() + { + return String.format("Scaled: (%d, %d). Absolute: (%d, %d). Scale factor of %d", new Object[] {Integer.valueOf(this.theScaledResolution.getScaledWidth()), Integer.valueOf(this.theScaledResolution.getScaledHeight()), Integer.valueOf(EntityRenderer.getRendererMinecraft(this.theEntityRenderer).displayWidth), Integer.valueOf(EntityRenderer.getRendererMinecraft(this.theEntityRenderer).displayHeight), Integer.valueOf(this.theScaledResolution.getScaleFactor())}); + } + + public Object call() + { + return this.callScreenSize(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableServerMemoryStats.java b/src/main/java/net/minecraft/src/CallableServerMemoryStats.java new file mode 100644 index 0000000..5e04e76 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableServerMemoryStats.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; +import net.minecraft.server.MinecraftServer; + +public class CallableServerMemoryStats implements Callable +{ + /** Reference to the MinecraftServer object. */ + final MinecraftServer mcServer; + + public CallableServerMemoryStats(MinecraftServer par1MinecraftServer) + { + this.mcServer = par1MinecraftServer; + } + + public String callServerMemoryStats() + { + return MinecraftServer.getServerConfigurationManager(this.mcServer).getCurrentPlayerCount() + " / " + MinecraftServer.getServerConfigurationManager(this.mcServer).getMaxPlayers() + "; " + MinecraftServer.getServerConfigurationManager(this.mcServer).playerEntityList; + } + + public Object call() + { + return this.callServerMemoryStats(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableServerProfiler.java b/src/main/java/net/minecraft/src/CallableServerProfiler.java new file mode 100644 index 0000000..e01ae1c --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableServerProfiler.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; +import net.minecraft.server.MinecraftServer; + +public class CallableServerProfiler implements Callable +{ + /** Reference to the MinecraftServer object. */ + final MinecraftServer mcServer; + + public CallableServerProfiler(MinecraftServer par1MinecraftServer) + { + this.mcServer = par1MinecraftServer; + } + + public String callServerProfiler() + { + int var1 = this.mcServer.worldServers[0].getWorldVec3Pool().getPoolSize(); + int var2 = 56 * var1; + int var3 = var2 / 1024 / 1024; + int var4 = this.mcServer.worldServers[0].getWorldVec3Pool().func_82590_d(); + int var5 = 56 * var4; + int var6 = var5 / 1024 / 1024; + return var1 + " (" + var2 + " bytes; " + var3 + " MB) allocated, " + var4 + " (" + var5 + " bytes; " + var6 + " MB) used"; + } + + public Object call() + { + return this.callServerProfiler(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableServerType.java b/src/main/java/net/minecraft/src/CallableServerType.java new file mode 100644 index 0000000..e9c9a8d --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableServerType.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableServerType implements Callable +{ + final DedicatedServer theDedicatedServer; + + CallableServerType(DedicatedServer par1DedicatedServer) + { + this.theDedicatedServer = par1DedicatedServer; + } + + public String callServerType() + { + return "Dedicated Server (map_server.txt)"; + } + + public Object call() + { + return this.callServerType(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableStructureType.java b/src/main/java/net/minecraft/src/CallableStructureType.java new file mode 100644 index 0000000..cc84afd --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableStructureType.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableStructureType implements Callable +{ + final MapGenStructure theMapStructureGenerator; + + CallableStructureType(MapGenStructure par1MapGenStructure) + { + this.theMapStructureGenerator = par1MapGenStructure; + } + + public String callStructureType() + { + return this.theMapStructureGenerator.getClass().getCanonicalName(); + } + + public Object call() + { + return this.callStructureType(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableSuspiciousClasses.java b/src/main/java/net/minecraft/src/CallableSuspiciousClasses.java new file mode 100644 index 0000000..4977faa --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableSuspiciousClasses.java @@ -0,0 +1,142 @@ +package net.minecraft.src; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Vector; +import java.util.concurrent.Callable; + +class CallableSuspiciousClasses implements Callable +{ + final CrashReport theCrashReport; + + CallableSuspiciousClasses(CrashReport par1CrashReport) + { + this.theCrashReport = par1CrashReport; + } + + public String callSuspiciousClasses() throws SecurityException, NoSuchFieldException, IllegalAccessException, IllegalArgumentException + { + StringBuilder var1 = new StringBuilder(); + ArrayList var3; + + try + { + Field var2 = ClassLoader.class.getDeclaredField("classes"); + var2.setAccessible(true); + var3 = new ArrayList((Vector)var2.get(CrashReport.class.getClassLoader())); + } + catch (Exception ex) + { + return ""; + } + + boolean var4 = true; + boolean var5 = !CrashReport.class.getCanonicalName().equals("net.minecraft.CrashReport"); + HashMap var6 = new HashMap(); + String var7 = ""; + Collections.sort(var3, new ComparatorClassSorter(this)); + Iterator var8 = var3.iterator(); + + while (var8.hasNext()) + { + Class var9 = (Class)var8.next(); + + if (var9 != null) + { + String var10 = var9.getCanonicalName(); + + if (var10 != null && !var10.startsWith("org.lwjgl.") && !var10.startsWith("paulscode.") && !var10.startsWith("org.bouncycastle.") && !var10.startsWith("argo.") && !var10.startsWith("com.jcraft.") && !var10.startsWith("com.fasterxml.") && !var10.startsWith("com.google.") && !var10.startsWith("joptsimple.") && !var10.startsWith("org.apache.") && !var10.equals("util.GLX")) + { + if (var5) + { + if (var10.length() <= 3 || var10.equals("net.minecraft.client.main.Main") || var10.equals("net.minecraft.client.Minecraft") || var10.equals("net.minecraft.client.ClientBrandRetriever") || var10.equals("net.minecraft.server.MinecraftServer")) + { + continue; + } + } + else if (var10.startsWith("net.minecraft")) + { + continue; + } + + Package var11 = var9.getPackage(); + String var12 = var11 == null ? "" : var11.getName(); + + if (var6.containsKey(var12)) + { + int var13 = ((Integer)var6.get(var12)).intValue(); + var6.put(var12, Integer.valueOf(var13 + 1)); + + if (var13 == 3) + { + if (!var4) + { + var1.append(", "); + } + + var1.append("..."); + var4 = false; + continue; + } + + if (var13 > 3) + { + continue; + } + } + else + { + var6.put(var12, Integer.valueOf(1)); + } + + if (!var7.equals(var12) && var7.length() > 0) + { + var1.append("], "); + } + + if (!var4 && var7.equals(var12)) + { + var1.append(", "); + } + + if (!var7.equals(var12)) + { + var1.append("["); + var1.append(var12); + var1.append("."); + } + + var1.append(var9.getSimpleName()); + var7 = var12; + var4 = false; + } + } + } + + if (var4) + { + var1.append("No suspicious classes found."); + } + else + { + var1.append("]"); + } + + return var1.toString(); + } + + public Object call() + { + try + { + return this.callSuspiciousClasses(); + } + catch (Exception ex) + { + return null; + } + } +} diff --git a/src/main/java/net/minecraft/src/CallableTagCompound1.java b/src/main/java/net/minecraft/src/CallableTagCompound1.java new file mode 100644 index 0000000..7495e9c --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableTagCompound1.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableTagCompound1 implements Callable +{ + final String field_82585_a; + + final NBTTagCompound theNBTTagCompound; + + CallableTagCompound1(NBTTagCompound par1NBTTagCompound, String par2Str) + { + this.theNBTTagCompound = par1NBTTagCompound; + this.field_82585_a = par2Str; + } + + public String func_82583_a() + { + return NBTBase.NBTTypes[((NBTBase)NBTTagCompound.getTagMap(this.theNBTTagCompound).get(this.field_82585_a)).getId()]; + } + + public Object call() + { + return this.func_82583_a(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableTagCompound2.java b/src/main/java/net/minecraft/src/CallableTagCompound2.java new file mode 100644 index 0000000..7729fb4 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableTagCompound2.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableTagCompound2 implements Callable +{ + final int field_82588_a; + + final NBTTagCompound theNBTTagCompound; + + CallableTagCompound2(NBTTagCompound par1NBTTagCompound, int par2) + { + this.theNBTTagCompound = par1NBTTagCompound; + this.field_82588_a = par2; + } + + public String func_82586_a() + { + return NBTBase.NBTTypes[this.field_82588_a]; + } + + public Object call() + { + return this.func_82586_a(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableTexturePack.java b/src/main/java/net/minecraft/src/CallableTexturePack.java new file mode 100644 index 0000000..1dd5a14 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableTexturePack.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableTexturePack implements Callable +{ + final Minecraft theMinecraft; + + CallableTexturePack(Minecraft par1Minecraft) + { + this.theMinecraft = par1Minecraft; + } + + public String callTexturePack() + { + return this.theMinecraft.gameSettings.skin; + } + + public Object call() + { + return this.callTexturePack(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableTileEntityData.java b/src/main/java/net/minecraft/src/CallableTileEntityData.java new file mode 100644 index 0000000..69560df --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableTileEntityData.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableTileEntityData implements Callable +{ + final TileEntity theTileEntity; + + CallableTileEntityData(TileEntity par1TileEntity) + { + this.theTileEntity = par1TileEntity; + } + + public String callTileEntityDataInfo() + { + int var1 = this.theTileEntity.worldObj.getBlockMetadata(this.theTileEntity.xCoord, this.theTileEntity.yCoord, this.theTileEntity.zCoord); + + if (var1 < 0) + { + return "Unknown? (Got " + var1 + ")"; + } + else + { + String var2 = String.format("%4s", new Object[] {Integer.toBinaryString(var1)}).replace(" ", "0"); + return String.format("%1$d / 0x%1$X / 0b%2$s", new Object[] {Integer.valueOf(var1), var2}); + } + } + + public Object call() + { + return this.callTileEntityDataInfo(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableTileEntityID.java b/src/main/java/net/minecraft/src/CallableTileEntityID.java new file mode 100644 index 0000000..a8c7879 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableTileEntityID.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableTileEntityID implements Callable +{ + final TileEntity theTileEntity; + + CallableTileEntityID(TileEntity par1TileEntity) + { + this.theTileEntity = par1TileEntity; + } + + public String callTileEntityID() + { + int var1 = this.theTileEntity.worldObj.getBlockId(this.theTileEntity.xCoord, this.theTileEntity.yCoord, this.theTileEntity.zCoord); + + try + { + return String.format("ID #%d (%s // %s)", new Object[] {Integer.valueOf(var1), Block.blocksList[var1].getUnlocalizedName(), Block.blocksList[var1].getClass().getCanonicalName()}); + } + catch (Throwable var3) + { + return "ID #" + var1; + } + } + + public Object call() + { + return this.callTileEntityID(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableTileEntityName.java b/src/main/java/net/minecraft/src/CallableTileEntityName.java new file mode 100644 index 0000000..c2d63ba --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableTileEntityName.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableTileEntityName implements Callable +{ + final TileEntity theTileEntity; + + CallableTileEntityName(TileEntity par1TileEntity) + { + this.theTileEntity = par1TileEntity; + } + + public String callTileEntityName() + { + return (String)TileEntity.getClassToNameMap().get(this.theTileEntity.getClass()) + " // " + this.theTileEntity.getClass().getCanonicalName(); + } + + public Object call() + { + return this.callTileEntityName(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableType.java b/src/main/java/net/minecraft/src/CallableType.java new file mode 100644 index 0000000..f9a173c --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableType.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableType implements Callable +{ + /** Reference to the DecitatedServer object. */ + final DedicatedServer theDecitatedServer; + + CallableType(DedicatedServer par1DedicatedServer) + { + this.theDecitatedServer = par1DedicatedServer; + } + + public String getType() + { + String var1 = this.theDecitatedServer.getServerModName(); + return !var1.equals("vanilla") ? "Definitely; Server brand changed to \'" + var1 + "\'" : "Unknown (can\'t tell)"; + } + + public Object call() + { + return this.getType(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableType2.java b/src/main/java/net/minecraft/src/CallableType2.java new file mode 100644 index 0000000..04150b0 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableType2.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableType2 implements Callable +{ + final Minecraft mc; + + CallableType2(Minecraft par1Minecraft) + { + this.mc = par1Minecraft; + } + + public String func_82886_a() + { + return "Client (map_client.txt)"; + } + + public Object call() + { + return this.func_82886_a(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableType3.java b/src/main/java/net/minecraft/src/CallableType3.java new file mode 100644 index 0000000..39099d0 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableType3.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableType3 implements Callable +{ + /** Reference to the IntegratedServer object. */ + final IntegratedServer theIntegratedServer; + + CallableType3(IntegratedServer par1IntegratedServer) + { + this.theIntegratedServer = par1IntegratedServer; + } + + public String getType() + { + return "Integrated Server (map_client.txt)"; + } + + public Object call() + { + return this.getType(); + } +} diff --git a/src/main/java/net/minecraft/src/CallableUpdatingScreenName.java b/src/main/java/net/minecraft/src/CallableUpdatingScreenName.java new file mode 100644 index 0000000..32e0275 --- /dev/null +++ b/src/main/java/net/minecraft/src/CallableUpdatingScreenName.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class CallableUpdatingScreenName implements Callable +{ + final Minecraft theMinecraft; + + CallableUpdatingScreenName(Minecraft par1Minecraft) + { + this.theMinecraft = par1Minecraft; + } + + public String callUpdatingScreenName() + { + return this.theMinecraft.currentScreen.getClass().getCanonicalName(); + } + + public Object call() + { + return this.callUpdatingScreenName(); + } +} diff --git a/src/main/java/net/minecraft/src/ChatAllowedCharacters.java b/src/main/java/net/minecraft/src/ChatAllowedCharacters.java new file mode 100644 index 0000000..e7ff876 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChatAllowedCharacters.java @@ -0,0 +1,75 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.InputStreamReader; + +public class ChatAllowedCharacters +{ + /** + * This String have the characters allowed in any text drawing of minecraft. + */ + public static final String allowedCharacters = getAllowedCharacters(); + + /** + * Array of the special characters that are allowed in any text drawing of Minecraft. + */ + public static final char[] allowedCharactersArray = new char[] {'/', '\n', '\r', '\t', '\u0000', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':'}; + + /** + * Load the font.txt resource file, that is on UTF-8 format. This file contains the characters that minecraft can + * render Strings on screen. + */ + private static String getAllowedCharacters() + { + String var0 = ""; + + try + { + BufferedReader var1 = new BufferedReader(new InputStreamReader(ChatAllowedCharacters.class.getResourceAsStream("/font.txt"), "UTF-8")); + String var2 = ""; + + while ((var2 = var1.readLine()) != null) + { + if (!var2.startsWith("#")) + { + var0 = var0 + var2; + } + } + + var1.close(); + } + catch (Exception var3) + { + ; + } + + return var0; + } + + public static final boolean isAllowedCharacter(char par0) + { + return par0 != 167 && (allowedCharacters.indexOf(par0) >= 0 || par0 > 32); + } + + /** + * Filter string by only keeping those characters for which isAllowedCharacter() returns true. + */ + public static String filerAllowedCharacters(String par0Str) + { + StringBuilder var1 = new StringBuilder(); + char[] var2 = par0Str.toCharArray(); + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + char var5 = var2[var4]; + + if (isAllowedCharacter(var5)) + { + var1.append(var5); + } + } + + return var1.toString(); + } +} diff --git a/src/main/java/net/minecraft/src/ChatClickData.java b/src/main/java/net/minecraft/src/ChatClickData.java new file mode 100644 index 0000000..e6769a6 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChatClickData.java @@ -0,0 +1,94 @@ +package net.minecraft.src; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class ChatClickData +{ + public static final Pattern pattern = Pattern.compile("^(?:(https?)://)?([-\\w_\\.]{2,}\\.[a-z]{2,4})(/\\S*)?$"); + private final FontRenderer fontR; + private final ChatLine line; + private final int field_78312_d; + private final int field_78313_e; + private final String field_78310_f; + + /** The URL which was clicked on. */ + private final String clickedUrl; + + public ChatClickData(FontRenderer par1FontRenderer, ChatLine par2ChatLine, int par3, int par4) + { + this.fontR = par1FontRenderer; + this.line = par2ChatLine; + this.field_78312_d = par3; + this.field_78313_e = par4; + this.field_78310_f = par1FontRenderer.trimStringToWidth(par2ChatLine.getChatLineString(), par3); + this.clickedUrl = this.findClickedUrl(); + } + + /** + * Gets the URL which was clicked on. + */ + public String getClickedUrl() + { + return this.clickedUrl; + } + + /** + * computes the URI from the clicked chat data object + */ + public URI getURI() + { + String var1 = this.getClickedUrl(); + + if (var1 == null) + { + return null; + } + else + { + Matcher var2 = pattern.matcher(var1); + + if (var2.matches()) + { + try + { + String var3 = var2.group(0); + + if (var2.group(1) == null) + { + var3 = "http://" + var3; + } + + return new URI(var3); + } + catch (URISyntaxException var4) + { + Minecraft.getMinecraft().getLogAgent().logSevereException("Couldn\'t create URI from chat", var4); + } + } + + return null; + } + } + + private String findClickedUrl() + { + int var1 = this.field_78310_f.lastIndexOf(" ", this.field_78310_f.length()) + 1; + + if (var1 < 0) + { + var1 = 0; + } + + int var2 = this.line.getChatLineString().indexOf(" ", var1); + + if (var2 < 0) + { + var2 = this.line.getChatLineString().length(); + } + + return StringUtils.stripControlCodes(this.line.getChatLineString().substring(var1, var2)); + } +} diff --git a/src/main/java/net/minecraft/src/ChatLine.java b/src/main/java/net/minecraft/src/ChatLine.java new file mode 100644 index 0000000..b84718b --- /dev/null +++ b/src/main/java/net/minecraft/src/ChatLine.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +public class ChatLine +{ + /** GUI Update Counter value this Line was created at */ + private final int updateCounterCreated; + private final String lineString; + + /** + * int value to refer to existing Chat Lines, can be 0 which means unreferrable + */ + private final int chatLineID; + + public ChatLine(int par1, String par2Str, int par3) + { + this.lineString = par2Str; + this.updateCounterCreated = par1; + this.chatLineID = par3; + } + + public String getChatLineString() + { + return this.lineString; + } + + public int getUpdatedCounter() + { + return this.updateCounterCreated; + } + + public int getChatLineID() + { + return this.chatLineID; + } +} diff --git a/src/main/java/net/minecraft/src/ChatMessageComponent.java b/src/main/java/net/minecraft/src/ChatMessageComponent.java new file mode 100644 index 0000000..2444439 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChatMessageComponent.java @@ -0,0 +1,375 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import java.util.Iterator; +import java.util.List; + +public class ChatMessageComponent +{ + private static final Gson field_111089_a = (new GsonBuilder()).registerTypeAdapter(ChatMessageComponent.class, new MessageComponentSerializer()).create(); + private EnumChatFormatting color; + private Boolean bold; + private Boolean italic; + private Boolean underline; + private Boolean obfuscated; + private String text; + private String translationKey; + private List field_111091_i; + + public ChatMessageComponent() {} + + public ChatMessageComponent(ChatMessageComponent par1ChatMessageComponent) + { + this.color = par1ChatMessageComponent.color; + this.bold = par1ChatMessageComponent.bold; + this.italic = par1ChatMessageComponent.italic; + this.underline = par1ChatMessageComponent.underline; + this.obfuscated = par1ChatMessageComponent.obfuscated; + this.text = par1ChatMessageComponent.text; + this.translationKey = par1ChatMessageComponent.translationKey; + this.field_111091_i = par1ChatMessageComponent.field_111091_i == null ? null : Lists.newArrayList(par1ChatMessageComponent.field_111091_i); + } + + public ChatMessageComponent setColor(EnumChatFormatting par1EnumChatFormatting) + { + if (par1EnumChatFormatting != null && !par1EnumChatFormatting.isColor()) + { + throw new IllegalArgumentException("Argument is not a valid color!"); + } + else + { + this.color = par1EnumChatFormatting; + return this; + } + } + + public EnumChatFormatting getColor() + { + return this.color; + } + + public ChatMessageComponent setBold(Boolean par1) + { + this.bold = par1; + return this; + } + + public Boolean isBold() + { + return this.bold; + } + + public ChatMessageComponent setItalic(Boolean par1) + { + this.italic = par1; + return this; + } + + public Boolean isItalic() + { + return this.italic; + } + + public ChatMessageComponent setUnderline(Boolean par1) + { + this.underline = par1; + return this; + } + + public Boolean isUnderline() + { + return this.underline; + } + + public ChatMessageComponent setObfuscated(Boolean par1) + { + this.obfuscated = par1; + return this; + } + + public Boolean isObfuscated() + { + return this.obfuscated; + } + + protected String getText() + { + return this.text; + } + + protected String getTranslationKey() + { + return this.translationKey; + } + + protected List getSubComponents() + { + return this.field_111091_i; + } + + public ChatMessageComponent appendComponent(ChatMessageComponent par1ChatMessageComponent) + { + if (this.text == null && this.translationKey == null) + { + if (this.field_111091_i != null) + { + this.field_111091_i.add(par1ChatMessageComponent); + } + else + { + this.field_111091_i = Lists.newArrayList(new ChatMessageComponent[] {par1ChatMessageComponent}); + } + } + else + { + this.field_111091_i = Lists.newArrayList(new ChatMessageComponent[] {new ChatMessageComponent(this), par1ChatMessageComponent}); + this.text = null; + this.translationKey = null; + } + + return this; + } + + public ChatMessageComponent addText(String par1Str) + { + if (this.text == null && this.translationKey == null) + { + if (this.field_111091_i != null) + { + this.field_111091_i.add(createFromText(par1Str)); + } + else + { + this.text = par1Str; + } + } + else + { + this.field_111091_i = Lists.newArrayList(new ChatMessageComponent[] {new ChatMessageComponent(this), createFromText(par1Str)}); + this.text = null; + this.translationKey = null; + } + + return this; + } + + /** + * Appends a translated string. + */ + public ChatMessageComponent addKey(String par1Str) + { + if (this.text == null && this.translationKey == null) + { + if (this.field_111091_i != null) + { + this.field_111091_i.add(createFromTranslationKey(par1Str)); + } + else + { + this.translationKey = par1Str; + } + } + else + { + this.field_111091_i = Lists.newArrayList(new ChatMessageComponent[] {new ChatMessageComponent(this), createFromTranslationKey(par1Str)}); + this.text = null; + this.translationKey = null; + } + + return this; + } + + /** + * Appends a formatted translation key. Args: key, params. The text ultimately displayed is + * String.format(translate(key), params) + */ + public ChatMessageComponent addFormatted(String par1Str, Object ... par2ArrayOfObj) + { + if (this.text == null && this.translationKey == null) + { + if (this.field_111091_i != null) + { + this.field_111091_i.add(createFromTranslationWithSubstitutions(par1Str, par2ArrayOfObj)); + } + else + { + this.translationKey = par1Str; + this.field_111091_i = Lists.newArrayList(); + Object[] var3 = par2ArrayOfObj; + int var4 = par2ArrayOfObj.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + Object var6 = var3[var5]; + + if (var6 instanceof ChatMessageComponent) + { + this.field_111091_i.add((ChatMessageComponent)var6); + } + else + { + this.field_111091_i.add(createFromText(var6.toString())); + } + } + } + } + else + { + this.field_111091_i = Lists.newArrayList(new ChatMessageComponent[] {new ChatMessageComponent(this), createFromTranslationWithSubstitutions(par1Str, par2ArrayOfObj)}); + this.text = null; + this.translationKey = null; + } + + return this; + } + + public String toString() + { + return this.toStringWithFormatting(false); + } + + public String toStringWithFormatting(boolean par1) + { + return this.toStringWithDefaultFormatting(par1, (EnumChatFormatting)null, false, false, false, false); + } + + /** + * args: enableFormat, defaultColor, defaultBold, defaultItalic, defaultUnderline, defaultObfuscated + */ + public String toStringWithDefaultFormatting(boolean par1, EnumChatFormatting par2EnumChatFormatting, boolean par3, boolean par4, boolean par5, boolean par6) + { + StringBuilder var7 = new StringBuilder(); + EnumChatFormatting var8 = this.color == null ? par2EnumChatFormatting : this.color; + boolean var9 = this.bold == null ? par3 : this.bold.booleanValue(); + boolean var10 = this.italic == null ? par4 : this.italic.booleanValue(); + boolean var11 = this.underline == null ? par5 : this.underline.booleanValue(); + boolean var12 = this.obfuscated == null ? par6 : this.obfuscated.booleanValue(); + + if (this.translationKey != null) + { + if (par1) + { + appendFormattingToString(var7, var8, var9, var10, var11, var12); + } + + if (this.field_111091_i != null) + { + String[] var13 = new String[this.field_111091_i.size()]; + + for (int var14 = 0; var14 < this.field_111091_i.size(); ++var14) + { + var13[var14] = ((ChatMessageComponent)this.field_111091_i.get(var14)).toStringWithDefaultFormatting(par1, var8, var9, var10, var11, var12); + } + + var7.append(StatCollector.translateToLocalFormatted(this.translationKey, var13)); + } + else + { + var7.append(StatCollector.translateToLocal(this.translationKey)); + } + } + else if (this.text != null) + { + if (par1) + { + appendFormattingToString(var7, var8, var9, var10, var11, var12); + } + + var7.append(this.text); + } + else + { + ChatMessageComponent var16; + + if (this.field_111091_i != null) + { + for (Iterator var15 = this.field_111091_i.iterator(); var15.hasNext(); var7.append(var16.toStringWithDefaultFormatting(par1, var8, var9, var10, var11, var12))) + { + var16 = (ChatMessageComponent)var15.next(); + + if (par1) + { + appendFormattingToString(var7, var8, var9, var10, var11, var12); + } + } + } + } + + return var7.toString(); + } + + private static void appendFormattingToString(StringBuilder par0StringBuilder, EnumChatFormatting par1EnumChatFormatting, boolean par2, boolean par3, boolean par4, boolean par5) + { + if (par1EnumChatFormatting != null) + { + par0StringBuilder.append(par1EnumChatFormatting); + } + else if (par2 || par3 || par4 || par5) + { + par0StringBuilder.append(EnumChatFormatting.RESET); + } + + if (par2) + { + par0StringBuilder.append(EnumChatFormatting.BOLD); + } + + if (par3) + { + par0StringBuilder.append(EnumChatFormatting.ITALIC); + } + + if (par4) + { + par0StringBuilder.append(EnumChatFormatting.UNDERLINE); + } + + if (par5) + { + par0StringBuilder.append(EnumChatFormatting.OBFUSCATED); + } + } + + public static ChatMessageComponent createFromJson(String par0Str) + { + try + { + return (ChatMessageComponent)field_111089_a.fromJson(par0Str, ChatMessageComponent.class); + } + catch (Throwable var4) + { + CrashReport var2 = CrashReport.makeCrashReport(var4, "Deserializing Message"); + CrashReportCategory var3 = var2.makeCategory("Serialized Message"); + var3.addCrashSection("JSON string", par0Str); + throw new ReportedException(var2); + } + } + + public static ChatMessageComponent createFromText(String par0Str) + { + ChatMessageComponent var1 = new ChatMessageComponent(); + var1.addText(par0Str); + return var1; + } + + public static ChatMessageComponent createFromTranslationKey(String par0Str) + { + ChatMessageComponent var1 = new ChatMessageComponent(); + var1.addKey(par0Str); + return var1; + } + + public static ChatMessageComponent createFromTranslationWithSubstitutions(String par0Str, Object ... par1ArrayOfObj) + { + ChatMessageComponent var2 = new ChatMessageComponent(); + var2.addFormatted(par0Str, par1ArrayOfObj); + return var2; + } + + public String toJson() + { + return field_111089_a.toJson(this); + } +} diff --git a/src/main/java/net/minecraft/src/ChestItemRenderHelper.java b/src/main/java/net/minecraft/src/ChestItemRenderHelper.java new file mode 100644 index 0000000..84fd628 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChestItemRenderHelper.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +public class ChestItemRenderHelper +{ + /** The static instance of ChestItemRenderHelper. */ + public static ChestItemRenderHelper instance = new ChestItemRenderHelper(); + + /** Instance of Chest's Tile Entity. */ + private TileEntityChest theChest = new TileEntityChest(0); + private TileEntityChest field_142033_c = new TileEntityChest(1); + + /** Instance of Ender Chest's Tile Entity. */ + private TileEntityEnderChest theEnderChest = new TileEntityEnderChest(); + + /** + * Renders a chest at 0,0,0 - used for item rendering + */ + public void renderChest(Block par1Block, int par2, float par3) + { + if (par1Block.blockID == Block.enderChest.blockID) + { + TileEntityRenderer.instance.renderTileEntityAt(this.theEnderChest, 0.0D, 0.0D, 0.0D, 0.0F); + } + else if (par1Block.blockID == Block.chestTrapped.blockID) + { + TileEntityRenderer.instance.renderTileEntityAt(this.field_142033_c, 0.0D, 0.0D, 0.0D, 0.0F); + } + else + { + TileEntityRenderer.instance.renderTileEntityAt(this.theChest, 0.0D, 0.0D, 0.0D, 0.0F); + } + } +} diff --git a/src/main/java/net/minecraft/src/Chunk.java b/src/main/java/net/minecraft/src/Chunk.java new file mode 100644 index 0000000..1bf9c58 --- /dev/null +++ b/src/main/java/net/minecraft/src/Chunk.java @@ -0,0 +1,1450 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public class Chunk +{ + /** + * Determines if the chunk is lit or not at a light value greater than 0. + */ + public static boolean isLit; + + /** + * Used to store block IDs, block MSBs, Sky-light maps, Block-light maps, and metadata. Each entry corresponds to a + * logical segment of 16x16x16 blocks, stacked vertically. + */ + private ExtendedBlockStorage[] storageArrays; + + /** + * Contains a 16x16 mapping on the X/Z plane of the biome ID to which each colum belongs. + */ + private byte[] blockBiomeArray; + + /** + * A map, similar to heightMap, that tracks how far down precipitation can fall. + */ + public int[] precipitationHeightMap; + + /** Which columns need their skylightMaps updated. */ + public boolean[] updateSkylightColumns; + + /** Whether or not this Chunk is currently loaded into the World */ + public boolean isChunkLoaded; + + /** Reference to the World object. */ + public World worldObj; + public int[] heightMap; + + /** The x coordinate of the chunk. */ + public final int xPosition; + + /** The z coordinate of the chunk. */ + public final int zPosition; + private boolean isGapLightingUpdated; + + /** A Map of ChunkPositions to TileEntities in this chunk */ + public Map chunkTileEntityMap; + + /** + * Array of Lists containing the entities in this Chunk. Each List represents a 16 block subchunk. + */ + public List[] entityLists; + + /** Boolean value indicating if the terrain is populated. */ + public boolean isTerrainPopulated; + + /** + * Set to true if the chunk has been modified and needs to be updated internally. + */ + public boolean isModified; + + /** + * Whether this Chunk has any Entities and thus requires saving on every tick + */ + public boolean hasEntities; + + /** The time according to World.worldTime when this chunk was last saved */ + public long lastSaveTime; + + /** + * Updates to this chunk will not be sent to clients if this is false. This field is set to true the first time the + * chunk is sent to a client, and never set to false. + */ + public boolean sendUpdates; + + /** Lowest value in the heightmap. */ + public int heightMapMinimum; + + /** the cumulative number of ticks players have been in this chunk */ + public long inhabitedTime; + + /** + * Contains the current round-robin relight check index, and is implied as the relight check location as well. + */ + private int queuedLightChecks; + + public Chunk(World par1World, int par2, int par3) + { + this.storageArrays = new ExtendedBlockStorage[16]; + this.blockBiomeArray = new byte[256]; + this.precipitationHeightMap = new int[256]; + this.updateSkylightColumns = new boolean[256]; + this.chunkTileEntityMap = new HashMap(); + this.queuedLightChecks = 4096; + this.entityLists = new List[16]; + this.worldObj = par1World; + this.xPosition = par2; + this.zPosition = par3; + this.heightMap = new int[256]; + + for (int var4 = 0; var4 < this.entityLists.length; ++var4) + { + this.entityLists[var4] = new ArrayList(); + } + + Arrays.fill(this.precipitationHeightMap, -999); + Arrays.fill(this.blockBiomeArray, (byte) - 1); + } + + public Chunk(World par1World, byte[] par2ArrayOfByte, int par3, int par4) + { + this(par1World, par3, par4); + int var5 = par2ArrayOfByte.length / 256; + + for (int var6 = 0; var6 < 16; ++var6) + { + for (int var7 = 0; var7 < 16; ++var7) + { + for (int var8 = 0; var8 < var5; ++var8) + { + byte var9 = par2ArrayOfByte[var6 << 11 | var7 << 7 | var8]; + + if (var9 != 0) + { + int var10 = var8 >> 4; + + if (this.storageArrays[var10] == null) + { + this.storageArrays[var10] = new ExtendedBlockStorage(var10 << 4, !par1World.provider.hasNoSky); + } + + this.storageArrays[var10].setExtBlockID(var6, var8 & 15, var7, var9); + } + } + } + } + } + + /** + * Checks whether the chunk is at the X/Z location specified + */ + public boolean isAtLocation(int par1, int par2) + { + return par1 == this.xPosition && par2 == this.zPosition; + } + + /** + * Returns the value in the height map at this x, z coordinate in the chunk + */ + public int getHeightValue(int par1, int par2) + { + return this.heightMap[par2 << 4 | par1]; + } + + /** + * Returns the topmost ExtendedBlockStorage instance for this Chunk that actually contains a block. + */ + public int getTopFilledSegment() + { + for (int var1 = this.storageArrays.length - 1; var1 >= 0; --var1) + { + if (this.storageArrays[var1] != null) + { + return this.storageArrays[var1].getYLocation(); + } + } + + return 0; + } + + /** + * Returns the ExtendedBlockStorage array for this Chunk. + */ + public ExtendedBlockStorage[] getBlockStorageArray() + { + return this.storageArrays; + } + + /** + * Generates the height map for a chunk from scratch + */ + public void generateHeightMap() + { + int var1 = this.getTopFilledSegment(); + + for (int var2 = 0; var2 < 16; ++var2) + { + int var3 = 0; + + while (var3 < 16) + { + this.precipitationHeightMap[var2 + (var3 << 4)] = -999; + int var4 = var1 + 16 - 1; + + while (true) + { + if (var4 > 0) + { + int var5 = this.getBlockID(var2, var4 - 1, var3); + + if (Block.lightOpacity[var5] == 0) + { + --var4; + continue; + } + + this.heightMap[var3 << 4 | var2] = var4; + } + + ++var3; + break; + } + } + } + + this.isModified = true; + } + + /** + * Generates the initial skylight map for the chunk upon generation or load. + */ + public void generateSkylightMap() + { + int var1 = this.getTopFilledSegment(); + this.heightMapMinimum = Integer.MAX_VALUE; + int var2; + int var3; + + for (var2 = 0; var2 < 16; ++var2) + { + var3 = 0; + + while (var3 < 16) + { + this.precipitationHeightMap[var2 + (var3 << 4)] = -999; + int var4 = var1 + 16 - 1; + + while (true) + { + if (var4 > 0) + { + if (this.getBlockLightOpacity(var2, var4 - 1, var3) == 0) + { + --var4; + continue; + } + + this.heightMap[var3 << 4 | var2] = var4; + + if (var4 < this.heightMapMinimum) + { + this.heightMapMinimum = var4; + } + } + + if (!this.worldObj.provider.hasNoSky) + { + var4 = 15; + int var5 = var1 + 16 - 1; + + do + { + var4 -= this.getBlockLightOpacity(var2, var5, var3); + + if (var4 > 0) + { + ExtendedBlockStorage var6 = this.storageArrays[var5 >> 4]; + + if (var6 != null) + { + var6.setExtSkylightValue(var2, var5 & 15, var3, var4); + this.worldObj.markBlockForRenderUpdate((this.xPosition << 4) + var2, var5, (this.zPosition << 4) + var3); + } + } + + --var5; + } + while (var5 > 0 && var4 > 0); + } + + ++var3; + break; + } + } + } + + this.isModified = true; + + for (var2 = 0; var2 < 16; ++var2) + { + for (var3 = 0; var3 < 16; ++var3) + { + this.propagateSkylightOcclusion(var2, var3); + } + } + } + + /** + * Propagates a given sky-visible block's light value downward and upward to neighboring blocks as necessary. + */ + private void propagateSkylightOcclusion(int par1, int par2) + { + this.updateSkylightColumns[par1 + par2 * 16] = true; + this.isGapLightingUpdated = true; + } + + /** + * Runs delayed skylight updates. + */ + private void updateSkylight_do() + { + this.worldObj.theProfiler.startSection("recheckGaps"); + + if (this.worldObj.doChunksNearChunkExist(this.xPosition * 16 + 8, 0, this.zPosition * 16 + 8, 16)) + { + for (int var1 = 0; var1 < 16; ++var1) + { + for (int var2 = 0; var2 < 16; ++var2) + { + if (this.updateSkylightColumns[var1 + var2 * 16]) + { + this.updateSkylightColumns[var1 + var2 * 16] = false; + int var3 = this.getHeightValue(var1, var2); + int var4 = this.xPosition * 16 + var1; + int var5 = this.zPosition * 16 + var2; + int var6 = this.worldObj.getChunkHeightMapMinimum(var4 - 1, var5); + int var7 = this.worldObj.getChunkHeightMapMinimum(var4 + 1, var5); + int var8 = this.worldObj.getChunkHeightMapMinimum(var4, var5 - 1); + int var9 = this.worldObj.getChunkHeightMapMinimum(var4, var5 + 1); + + if (var7 < var6) + { + var6 = var7; + } + + if (var8 < var6) + { + var6 = var8; + } + + if (var9 < var6) + { + var6 = var9; + } + + this.checkSkylightNeighborHeight(var4, var5, var6); + this.checkSkylightNeighborHeight(var4 - 1, var5, var3); + this.checkSkylightNeighborHeight(var4 + 1, var5, var3); + this.checkSkylightNeighborHeight(var4, var5 - 1, var3); + this.checkSkylightNeighborHeight(var4, var5 + 1, var3); + } + } + } + + this.isGapLightingUpdated = false; + } + + this.worldObj.theProfiler.endSection(); + } + + /** + * Checks the height of a block next to a sky-visible block and schedules a lighting update as necessary. + */ + private void checkSkylightNeighborHeight(int par1, int par2, int par3) + { + int var4 = this.worldObj.getHeightValue(par1, par2); + + if (var4 > par3) + { + this.updateSkylightNeighborHeight(par1, par2, par3, var4 + 1); + } + else if (var4 < par3) + { + this.updateSkylightNeighborHeight(par1, par2, var4, par3 + 1); + } + } + + private void updateSkylightNeighborHeight(int par1, int par2, int par3, int par4) + { + if (par4 > par3 && this.worldObj.doChunksNearChunkExist(par1, 0, par2, 16)) + { + for (int var5 = par3; var5 < par4; ++var5) + { + this.worldObj.updateLightByType(EnumSkyBlock.Sky, par1, var5, par2); + } + + this.isModified = true; + } + } + + /** + * Initiates the recalculation of both the block-light and sky-light for a given block inside a chunk. + */ + private void relightBlock(int par1, int par2, int par3) + { + int var4 = this.heightMap[par3 << 4 | par1] & 255; + int var5 = var4; + + if (par2 > var4) + { + var5 = par2; + } + + while (var5 > 0 && this.getBlockLightOpacity(par1, var5 - 1, par3) == 0) + { + --var5; + } + + if (var5 != var4) + { + this.worldObj.markBlocksDirtyVertical(par1 + this.xPosition * 16, par3 + this.zPosition * 16, var5, var4); + this.heightMap[par3 << 4 | par1] = var5; + int var6 = this.xPosition * 16 + par1; + int var7 = this.zPosition * 16 + par3; + int var8; + int var12; + + if (!this.worldObj.provider.hasNoSky) + { + ExtendedBlockStorage var9; + + if (var5 < var4) + { + for (var8 = var5; var8 < var4; ++var8) + { + var9 = this.storageArrays[var8 >> 4]; + + if (var9 != null) + { + var9.setExtSkylightValue(par1, var8 & 15, par3, 15); + this.worldObj.markBlockForRenderUpdate((this.xPosition << 4) + par1, var8, (this.zPosition << 4) + par3); + } + } + } + else + { + for (var8 = var4; var8 < var5; ++var8) + { + var9 = this.storageArrays[var8 >> 4]; + + if (var9 != null) + { + var9.setExtSkylightValue(par1, var8 & 15, par3, 0); + this.worldObj.markBlockForRenderUpdate((this.xPosition << 4) + par1, var8, (this.zPosition << 4) + par3); + } + } + } + + var8 = 15; + + while (var5 > 0 && var8 > 0) + { + --var5; + var12 = this.getBlockLightOpacity(par1, var5, par3); + + if (var12 == 0) + { + var12 = 1; + } + + var8 -= var12; + + if (var8 < 0) + { + var8 = 0; + } + + ExtendedBlockStorage var10 = this.storageArrays[var5 >> 4]; + + if (var10 != null) + { + var10.setExtSkylightValue(par1, var5 & 15, par3, var8); + } + } + } + + var8 = this.heightMap[par3 << 4 | par1]; + var12 = var4; + int var13 = var8; + + if (var8 < var4) + { + var12 = var8; + var13 = var4; + } + + if (var8 < this.heightMapMinimum) + { + this.heightMapMinimum = var8; + } + + if (!this.worldObj.provider.hasNoSky) + { + this.updateSkylightNeighborHeight(var6 - 1, var7, var12, var13); + this.updateSkylightNeighborHeight(var6 + 1, var7, var12, var13); + this.updateSkylightNeighborHeight(var6, var7 - 1, var12, var13); + this.updateSkylightNeighborHeight(var6, var7 + 1, var12, var13); + this.updateSkylightNeighborHeight(var6, var7, var12, var13); + } + + this.isModified = true; + } + } + + public int getBlockLightOpacity(int par1, int par2, int par3) + { + return Block.lightOpacity[this.getBlockID(par1, par2, par3)]; + } + + /** + * Return the ID of a block in the chunk. + */ + public int getBlockID(int par1, int par2, int par3) + { + if (par2 >> 4 >= this.storageArrays.length) + { + return 0; + } + else + { + ExtendedBlockStorage var4 = this.storageArrays[par2 >> 4]; + return var4 != null ? var4.getExtBlockID(par1, par2 & 15, par3) : 0; + } + } + + /** + * Return the metadata corresponding to the given coordinates inside a chunk. + */ + public int getBlockMetadata(int par1, int par2, int par3) + { + if (par2 >> 4 >= this.storageArrays.length) + { + return 0; + } + else + { + ExtendedBlockStorage var4 = this.storageArrays[par2 >> 4]; + return var4 != null ? var4.getExtBlockMetadata(par1, par2 & 15, par3) : 0; + } + } + + /** + * Sets a blockID of a position within a chunk with metadata. Args: x, y, z, blockID, metadata + */ + public boolean setBlockIDWithMetadata(int par1, int par2, int par3, int par4, int par5) + { + int var6 = par3 << 4 | par1; + + if (par2 >= this.precipitationHeightMap[var6] - 1) + { + this.precipitationHeightMap[var6] = -999; + } + + int var7 = this.heightMap[var6]; + int var8 = this.getBlockID(par1, par2, par3); + int var9 = this.getBlockMetadata(par1, par2, par3); + + if (var8 == par4 && var9 == par5) + { + return false; + } + else + { + ExtendedBlockStorage var10 = this.storageArrays[par2 >> 4]; + boolean var11 = false; + + if (var10 == null) + { + if (par4 == 0) + { + return false; + } + + var10 = this.storageArrays[par2 >> 4] = new ExtendedBlockStorage(par2 >> 4 << 4, !this.worldObj.provider.hasNoSky); + var11 = par2 >= var7; + } + + int var12 = this.xPosition * 16 + par1; + int var13 = this.zPosition * 16 + par3; + + if (var8 != 0 && !this.worldObj.isRemote) + { + Block.blocksList[var8].onBlockPreDestroy(this.worldObj, var12, par2, var13, var9); + } + + var10.setExtBlockID(par1, par2 & 15, par3, par4); + + if (var8 != 0) + { + if (!this.worldObj.isRemote) + { + Block.blocksList[var8].breakBlock(this.worldObj, var12, par2, var13, var8, var9); + } + else if (Block.blocksList[var8] instanceof ITileEntityProvider && var8 != par4) + { + this.worldObj.removeBlockTileEntity(var12, par2, var13); + } + } + + if (var10.getExtBlockID(par1, par2 & 15, par3) != par4) + { + return false; + } + else + { + var10.setExtBlockMetadata(par1, par2 & 15, par3, par5); + + if (var11) + { + this.generateSkylightMap(); + } + else + { + if (Block.lightOpacity[par4 & 4095] > 0) + { + if (par2 >= var7) + { + this.relightBlock(par1, par2 + 1, par3); + } + } + else if (par2 == var7 - 1) + { + this.relightBlock(par1, par2, par3); + } + + this.propagateSkylightOcclusion(par1, par3); + } + + TileEntity var14; + + if (par4 != 0) + { + if (!this.worldObj.isRemote) + { + Block.blocksList[par4].onBlockAdded(this.worldObj, var12, par2, var13); + } + + if (Block.blocksList[par4] instanceof ITileEntityProvider) + { + var14 = this.getChunkBlockTileEntity(par1, par2, par3); + + if (var14 == null) + { + var14 = ((ITileEntityProvider)Block.blocksList[par4]).createNewTileEntity(this.worldObj); + this.worldObj.setBlockTileEntity(var12, par2, var13, var14); + } + + if (var14 != null) + { + var14.updateContainingBlockInfo(); + } + } + } + else if (var8 > 0 && Block.blocksList[var8] instanceof ITileEntityProvider) + { + var14 = this.getChunkBlockTileEntity(par1, par2, par3); + + if (var14 != null) + { + var14.updateContainingBlockInfo(); + } + } + + this.isModified = true; + return true; + } + } + } + + /** + * Set the metadata of a block in the chunk + */ + public boolean setBlockMetadata(int par1, int par2, int par3, int par4) + { + ExtendedBlockStorage var5 = this.storageArrays[par2 >> 4]; + + if (var5 == null) + { + return false; + } + else + { + int var6 = var5.getExtBlockMetadata(par1, par2 & 15, par3); + + if (var6 == par4) + { + return false; + } + else + { + this.isModified = true; + var5.setExtBlockMetadata(par1, par2 & 15, par3, par4); + int var7 = var5.getExtBlockID(par1, par2 & 15, par3); + + if (var7 > 0 && Block.blocksList[var7] instanceof ITileEntityProvider) + { + TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3); + + if (var8 != null) + { + var8.updateContainingBlockInfo(); + var8.blockMetadata = par4; + } + } + + return true; + } + } + } + + /** + * Gets the amount of light saved in this block (doesn't adjust for daylight) + */ + public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4) + { + ExtendedBlockStorage var5 = this.storageArrays[par3 >> 4]; + return var5 == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? (this.worldObj.provider.hasNoSky ? 0 : var5.getExtSkylightValue(par2, par3 & 15, par4)) : (par1EnumSkyBlock == EnumSkyBlock.Block ? var5.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue)); + } + + /** + * Sets the light value at the coordinate. If enumskyblock is set to sky it sets it in the skylightmap and if its a + * block then into the blocklightmap. Args enumSkyBlock, x, y, z, lightValue + */ + public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5) + { + ExtendedBlockStorage var6 = this.storageArrays[par3 >> 4]; + + if (var6 == null) + { + var6 = this.storageArrays[par3 >> 4] = new ExtendedBlockStorage(par3 >> 4 << 4, !this.worldObj.provider.hasNoSky); + this.generateSkylightMap(); + } + + this.isModified = true; + + if (par1EnumSkyBlock == EnumSkyBlock.Sky) + { + if (!this.worldObj.provider.hasNoSky) + { + var6.setExtSkylightValue(par2, par3 & 15, par4, par5); + } + } + else if (par1EnumSkyBlock == EnumSkyBlock.Block) + { + var6.setExtBlocklightValue(par2, par3 & 15, par4, par5); + } + } + + /** + * Gets the amount of light on a block taking into account sunlight + */ + public int getBlockLightValue(int par1, int par2, int par3, int par4) + { + ExtendedBlockStorage var5 = this.storageArrays[par2 >> 4]; + + if (var5 == null) + { + return !this.worldObj.provider.hasNoSky && par4 < EnumSkyBlock.Sky.defaultLightValue ? EnumSkyBlock.Sky.defaultLightValue - par4 : 0; + } + else + { + int var6 = this.worldObj.provider.hasNoSky ? 0 : var5.getExtSkylightValue(par1, par2 & 15, par3); + + if (var6 > 0) + { + isLit = true; + } + + var6 -= par4; + int var7 = var5.getExtBlocklightValue(par1, par2 & 15, par3); + + if (var7 > var6) + { + var6 = var7; + } + + return var6; + } + } + + /** + * Adds an entity to the chunk. Args: entity + */ + public void addEntity(Entity par1Entity) + { + this.hasEntities = true; + int var2 = MathHelper.floor_double(par1Entity.posX / 16.0D); + int var3 = MathHelper.floor_double(par1Entity.posZ / 16.0D); + + if (var2 != this.xPosition || var3 != this.zPosition) + { + this.worldObj.getWorldLogAgent().logSevere("Wrong location! " + par1Entity); + Thread.dumpStack(); + } + + int var4 = MathHelper.floor_double(par1Entity.posY / 16.0D); + + if (var4 < 0) + { + var4 = 0; + } + + if (var4 >= this.entityLists.length) + { + var4 = this.entityLists.length - 1; + } + + par1Entity.addedToChunk = true; + par1Entity.chunkCoordX = this.xPosition; + par1Entity.chunkCoordY = var4; + par1Entity.chunkCoordZ = this.zPosition; + this.entityLists[var4].add(par1Entity); + } + + /** + * removes entity using its y chunk coordinate as its index + */ + public void removeEntity(Entity par1Entity) + { + this.removeEntityAtIndex(par1Entity, par1Entity.chunkCoordY); + } + + /** + * Removes entity at the specified index from the entity array. + */ + public void removeEntityAtIndex(Entity par1Entity, int par2) + { + if (par2 < 0) + { + par2 = 0; + } + + if (par2 >= this.entityLists.length) + { + par2 = this.entityLists.length - 1; + } + + this.entityLists[par2].remove(par1Entity); + } + + /** + * Returns whether is not a block above this one blocking sight to the sky (done via checking against the heightmap) + */ + public boolean canBlockSeeTheSky(int par1, int par2, int par3) + { + return par2 >= this.heightMap[par3 << 4 | par1]; + } + + /** + * Gets the TileEntity for a given block in this chunk + */ + public TileEntity getChunkBlockTileEntity(int par1, int par2, int par3) + { + ChunkPosition var4 = new ChunkPosition(par1, par2, par3); + TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4); + + if (var5 == null) + { + int var6 = this.getBlockID(par1, par2, par3); + + if (var6 <= 0 || !Block.blocksList[var6].hasTileEntity()) + { + return null; + } + + if (var5 == null) + { + var5 = ((ITileEntityProvider)Block.blocksList[var6]).createNewTileEntity(this.worldObj); + this.worldObj.setBlockTileEntity(this.xPosition * 16 + par1, par2, this.zPosition * 16 + par3, var5); + } + + var5 = (TileEntity)this.chunkTileEntityMap.get(var4); + } + + if (var5 != null && var5.isInvalid()) + { + this.chunkTileEntityMap.remove(var4); + return null; + } + else + { + return var5; + } + } + + /** + * Adds a TileEntity to a chunk + */ + public void addTileEntity(TileEntity par1TileEntity) + { + int var2 = par1TileEntity.xCoord - this.xPosition * 16; + int var3 = par1TileEntity.yCoord; + int var4 = par1TileEntity.zCoord - this.zPosition * 16; + this.setChunkBlockTileEntity(var2, var3, var4, par1TileEntity); + + if (this.isChunkLoaded) + { + this.worldObj.loadedTileEntityList.add(par1TileEntity); + } + } + + /** + * Sets the TileEntity for a given block in this chunk + */ + public void setChunkBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity) + { + ChunkPosition var5 = new ChunkPosition(par1, par2, par3); + par4TileEntity.setWorldObj(this.worldObj); + par4TileEntity.xCoord = this.xPosition * 16 + par1; + par4TileEntity.yCoord = par2; + par4TileEntity.zCoord = this.zPosition * 16 + par3; + + if (this.getBlockID(par1, par2, par3) != 0 && Block.blocksList[this.getBlockID(par1, par2, par3)] instanceof ITileEntityProvider) + { + if (this.chunkTileEntityMap.containsKey(var5)) + { + ((TileEntity)this.chunkTileEntityMap.get(var5)).invalidate(); + } + + par4TileEntity.validate(); + this.chunkTileEntityMap.put(var5, par4TileEntity); + } + } + + /** + * Removes the TileEntity for a given block in this chunk + */ + public void removeChunkBlockTileEntity(int par1, int par2, int par3) + { + ChunkPosition var4 = new ChunkPosition(par1, par2, par3); + + if (this.isChunkLoaded) + { + TileEntity var5 = (TileEntity)this.chunkTileEntityMap.remove(var4); + + if (var5 != null) + { + var5.invalidate(); + } + } + } + + /** + * Called when this Chunk is loaded by the ChunkProvider + */ + public void onChunkLoad() + { + this.isChunkLoaded = true; + this.worldObj.addTileEntity(this.chunkTileEntityMap.values()); + + for (int var1 = 0; var1 < this.entityLists.length; ++var1) + { + Iterator var2 = this.entityLists[var1].iterator(); + + while (var2.hasNext()) + { + Entity var3 = (Entity)var2.next(); + var3.onChunkLoad(); + } + + this.worldObj.addLoadedEntities(this.entityLists[var1]); + } + } + + /** + * Called when this Chunk is unloaded by the ChunkProvider + */ + public void onChunkUnload() + { + this.isChunkLoaded = false; + Iterator var1 = this.chunkTileEntityMap.values().iterator(); + + while (var1.hasNext()) + { + TileEntity var2 = (TileEntity)var1.next(); + this.worldObj.markTileEntityForDespawn(var2); + } + + for (int var3 = 0; var3 < this.entityLists.length; ++var3) + { + this.worldObj.unloadEntities(this.entityLists[var3]); + } + } + + /** + * Sets the isModified flag for this Chunk + */ + public void setChunkModified() + { + this.isModified = true; + } + + /** + * Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity + * Args: entity, aabb, listToFill + */ + public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) + { + int var5 = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D); + int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D); + + if (var5 < 0) + { + var5 = 0; + var6 = Math.max(var5, var6); + } + + if (var6 >= this.entityLists.length) + { + var6 = this.entityLists.length - 1; + var5 = Math.min(var5, var6); + } + + for (int var7 = var5; var7 <= var6; ++var7) + { + List var8 = this.entityLists[var7]; + + for (int var9 = 0; var9 < var8.size(); ++var9) + { + Entity var10 = (Entity)var8.get(var9); + + if (var10 != par1Entity && var10.boundingBox.intersectsWith(par2AxisAlignedBB) && (par4IEntitySelector == null || par4IEntitySelector.isEntityApplicable(var10))) + { + par3List.add(var10); + Entity[] var11 = var10.getParts(); + + if (var11 != null) + { + for (int var12 = 0; var12 < var11.length; ++var12) + { + var10 = var11[var12]; + + if (var10 != par1Entity && var10.boundingBox.intersectsWith(par2AxisAlignedBB) && (par4IEntitySelector == null || par4IEntitySelector.isEntityApplicable(var10))) + { + par3List.add(var10); + } + } + } + } + } + } + } + + /** + * Gets all entities that can be assigned to the specified class. Args: entityClass, aabb, listToFill + */ + public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) + { + int var5 = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D); + int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D); + + if (var5 < 0) + { + var5 = 0; + } + else if (var5 >= this.entityLists.length) + { + var5 = this.entityLists.length - 1; + } + + if (var6 >= this.entityLists.length) + { + var6 = this.entityLists.length - 1; + } + else if (var6 < 0) + { + var6 = 0; + } + + for (int var7 = var5; var7 <= var6; ++var7) + { + List var8 = this.entityLists[var7]; + + for (int var9 = 0; var9 < var8.size(); ++var9) + { + Entity var10 = (Entity)var8.get(var9); + + if (par1Class.isAssignableFrom(var10.getClass()) && var10.boundingBox.intersectsWith(par2AxisAlignedBB) && (par4IEntitySelector == null || par4IEntitySelector.isEntityApplicable(var10))) + { + par3List.add(var10); + } + } + } + } + + /** + * Returns true if this Chunk needs to be saved + */ + public boolean needsSaving(boolean par1) + { + if (par1) + { + if (this.hasEntities && this.worldObj.getTotalWorldTime() != this.lastSaveTime || this.isModified) + { + return true; + } + } + else if (this.hasEntities && this.worldObj.getTotalWorldTime() >= this.lastSaveTime + 600L) + { + return true; + } + + return this.isModified; + } + + public Random getRandomWithSeed(long par1) + { + return new Random(this.worldObj.getSeed() + (long)(this.xPosition * this.xPosition * 4987142) + (long)(this.xPosition * 5947611) + (long)(this.zPosition * this.zPosition) * 4392871L + (long)(this.zPosition * 389711) ^ par1); + } + + public boolean isEmpty() + { + return false; + } + + public void populateChunk(IChunkProvider par1IChunkProvider, IChunkProvider par2IChunkProvider, int par3, int par4) + { + if (!this.isTerrainPopulated && par1IChunkProvider.chunkExists(par3 + 1, par4 + 1) && par1IChunkProvider.chunkExists(par3, par4 + 1) && par1IChunkProvider.chunkExists(par3 + 1, par4)) + { + par1IChunkProvider.populate(par2IChunkProvider, par3, par4); + } + + if (par1IChunkProvider.chunkExists(par3 - 1, par4) && !par1IChunkProvider.provideChunk(par3 - 1, par4).isTerrainPopulated && par1IChunkProvider.chunkExists(par3 - 1, par4 + 1) && par1IChunkProvider.chunkExists(par3, par4 + 1) && par1IChunkProvider.chunkExists(par3 - 1, par4 + 1)) + { + par1IChunkProvider.populate(par2IChunkProvider, par3 - 1, par4); + } + + if (par1IChunkProvider.chunkExists(par3, par4 - 1) && !par1IChunkProvider.provideChunk(par3, par4 - 1).isTerrainPopulated && par1IChunkProvider.chunkExists(par3 + 1, par4 - 1) && par1IChunkProvider.chunkExists(par3 + 1, par4 - 1) && par1IChunkProvider.chunkExists(par3 + 1, par4)) + { + par1IChunkProvider.populate(par2IChunkProvider, par3, par4 - 1); + } + + if (par1IChunkProvider.chunkExists(par3 - 1, par4 - 1) && !par1IChunkProvider.provideChunk(par3 - 1, par4 - 1).isTerrainPopulated && par1IChunkProvider.chunkExists(par3, par4 - 1) && par1IChunkProvider.chunkExists(par3 - 1, par4)) + { + par1IChunkProvider.populate(par2IChunkProvider, par3 - 1, par4 - 1); + } + } + + /** + * Gets the height to which rain/snow will fall. Calculates it if not already stored. + */ + public int getPrecipitationHeight(int par1, int par2) + { + int var3 = par1 | par2 << 4; + int var4 = this.precipitationHeightMap[var3]; + + if (var4 == -999) + { + int var5 = this.getTopFilledSegment() + 15; + var4 = -1; + + while (var5 > 0 && var4 == -1) + { + int var6 = this.getBlockID(par1, var5, par2); + Material var7 = var6 == 0 ? Material.air : Block.blocksList[var6].blockMaterial; + + if (!var7.blocksMovement() && !var7.isLiquid()) + { + --var5; + } + else + { + var4 = var5 + 1; + } + } + + this.precipitationHeightMap[var3] = var4; + } + + return var4; + } + + /** + * Checks whether skylight needs updated; if it does, calls updateSkylight_do + */ + public void updateSkylight() + { + if (this.isGapLightingUpdated && !this.worldObj.provider.hasNoSky) + { + this.updateSkylight_do(); + } + } + + /** + * Gets a ChunkCoordIntPair representing the Chunk's position. + */ + public ChunkCoordIntPair getChunkCoordIntPair() + { + return new ChunkCoordIntPair(this.xPosition, this.zPosition); + } + + /** + * Returns whether the ExtendedBlockStorages containing levels (in blocks) from arg 1 to arg 2 are fully empty + * (true) or not (false). + */ + public boolean getAreLevelsEmpty(int par1, int par2) + { + if (par1 < 0) + { + par1 = 0; + } + + if (par2 >= 256) + { + par2 = 255; + } + + for (int var3 = par1; var3 <= par2; var3 += 16) + { + ExtendedBlockStorage var4 = this.storageArrays[var3 >> 4]; + + if (var4 != null && !var4.isEmpty()) + { + return false; + } + } + + return true; + } + + public void setStorageArrays(ExtendedBlockStorage[] par1ArrayOfExtendedBlockStorage) + { + this.storageArrays = par1ArrayOfExtendedBlockStorage; + } + + /** + * Initialise this chunk with new binary data + */ + public void fillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4) + { + int var5 = 0; + boolean var6 = !this.worldObj.provider.hasNoSky; + int var7; + + for (var7 = 0; var7 < this.storageArrays.length; ++var7) + { + if ((par2 & 1 << var7) != 0) + { + if (this.storageArrays[var7] == null) + { + this.storageArrays[var7] = new ExtendedBlockStorage(var7 << 4, var6); + } + + byte[] var8 = this.storageArrays[var7].getBlockLSBArray(); + System.arraycopy(par1ArrayOfByte, var5, var8, 0, var8.length); + var5 += var8.length; + } + else if (par4 && this.storageArrays[var7] != null) + { + this.storageArrays[var7] = null; + } + } + + NibbleArray var9; + + for (var7 = 0; var7 < this.storageArrays.length; ++var7) + { + if ((par2 & 1 << var7) != 0 && this.storageArrays[var7] != null) + { + var9 = this.storageArrays[var7].getMetadataArray(); + System.arraycopy(par1ArrayOfByte, var5, var9.data, 0, var9.data.length); + var5 += var9.data.length; + } + } + + for (var7 = 0; var7 < this.storageArrays.length; ++var7) + { + if ((par2 & 1 << var7) != 0 && this.storageArrays[var7] != null) + { + var9 = this.storageArrays[var7].getBlocklightArray(); + System.arraycopy(par1ArrayOfByte, var5, var9.data, 0, var9.data.length); + var5 += var9.data.length; + } + } + + if (var6) + { + for (var7 = 0; var7 < this.storageArrays.length; ++var7) + { + if ((par2 & 1 << var7) != 0 && this.storageArrays[var7] != null) + { + var9 = this.storageArrays[var7].getSkylightArray(); + System.arraycopy(par1ArrayOfByte, var5, var9.data, 0, var9.data.length); + var5 += var9.data.length; + } + } + } + + for (var7 = 0; var7 < this.storageArrays.length; ++var7) + { + if ((par3 & 1 << var7) != 0) + { + if (this.storageArrays[var7] == null) + { + var5 += 2048; + } + else + { + var9 = this.storageArrays[var7].getBlockMSBArray(); + + if (var9 == null) + { + var9 = this.storageArrays[var7].createBlockMSBArray(); + } + + System.arraycopy(par1ArrayOfByte, var5, var9.data, 0, var9.data.length); + var5 += var9.data.length; + } + } + else if (par4 && this.storageArrays[var7] != null && this.storageArrays[var7].getBlockMSBArray() != null) + { + this.storageArrays[var7].clearMSBArray(); + } + } + + if (par4) + { + System.arraycopy(par1ArrayOfByte, var5, this.blockBiomeArray, 0, this.blockBiomeArray.length); + int var10000 = var5 + this.blockBiomeArray.length; + } + + for (var7 = 0; var7 < this.storageArrays.length; ++var7) + { + if (this.storageArrays[var7] != null && (par2 & 1 << var7) != 0) + { + this.storageArrays[var7].removeInvalidBlocks(); + } + } + + this.generateHeightMap(); + Iterator var11 = this.chunkTileEntityMap.values().iterator(); + + while (var11.hasNext()) + { + TileEntity var10 = (TileEntity)var11.next(); + var10.updateContainingBlockInfo(); + } + } + + /** + * This method retrieves the biome at a set of coordinates + */ + public BiomeGenBase getBiomeGenForWorldCoords(int par1, int par2, WorldChunkManager par3WorldChunkManager) + { + int var4 = this.blockBiomeArray[par2 << 4 | par1] & 255; + + if (var4 == 255) + { + BiomeGenBase var5 = par3WorldChunkManager.getBiomeGenAt((this.xPosition << 4) + par1, (this.zPosition << 4) + par2); + var4 = var5.biomeID; + this.blockBiomeArray[par2 << 4 | par1] = (byte)(var4 & 255); + } + + return BiomeGenBase.biomeList[var4] == null ? BiomeGenBase.plains : BiomeGenBase.biomeList[var4]; + } + + /** + * Returns an array containing a 16x16 mapping on the X/Z of block positions in this Chunk to biome IDs. + */ + public byte[] getBiomeArray() + { + return this.blockBiomeArray; + } + + /** + * Accepts a 256-entry array that contains a 16x16 mapping on the X/Z plane of block positions in this Chunk to + * biome IDs. + */ + public void setBiomeArray(byte[] par1ArrayOfByte) + { + this.blockBiomeArray = par1ArrayOfByte; + } + + /** + * Resets the relight check index to 0 for this Chunk. + */ + public void resetRelightChecks() + { + this.queuedLightChecks = 0; + } + + /** + * Called once-per-chunk-per-tick, and advances the round-robin relight check index per-storage-block by up to 8 + * blocks at a time. In a worst-case scenario, can potentially take up to 1.6 seconds, calculated via + * (4096/(8*16))/20, to re-check all blocks in a chunk, which could explain both lagging light updates in certain + * cases as well as Nether relight + */ + public void enqueueRelightChecks() + { + for (int var1 = 0; var1 < 8; ++var1) + { + if (this.queuedLightChecks >= 4096) + { + return; + } + + int var2 = this.queuedLightChecks % 16; + int var3 = this.queuedLightChecks / 16 % 16; + int var4 = this.queuedLightChecks / 256; + ++this.queuedLightChecks; + int var5 = (this.xPosition << 4) + var3; + int var6 = (this.zPosition << 4) + var4; + + for (int var7 = 0; var7 < 16; ++var7) + { + int var8 = (var2 << 4) + var7; + + if (this.storageArrays[var2] == null && (var7 == 0 || var7 == 15 || var3 == 0 || var3 == 15 || var4 == 0 || var4 == 15) || this.storageArrays[var2] != null && this.storageArrays[var2].getExtBlockID(var3, var7, var4) == 0) + { + if (Block.lightValue[this.worldObj.getBlockId(var5, var8 - 1, var6)] > 0) + { + this.worldObj.updateAllLightTypes(var5, var8 - 1, var6); + } + + if (Block.lightValue[this.worldObj.getBlockId(var5, var8 + 1, var6)] > 0) + { + this.worldObj.updateAllLightTypes(var5, var8 + 1, var6); + } + + if (Block.lightValue[this.worldObj.getBlockId(var5 - 1, var8, var6)] > 0) + { + this.worldObj.updateAllLightTypes(var5 - 1, var8, var6); + } + + if (Block.lightValue[this.worldObj.getBlockId(var5 + 1, var8, var6)] > 0) + { + this.worldObj.updateAllLightTypes(var5 + 1, var8, var6); + } + + if (Block.lightValue[this.worldObj.getBlockId(var5, var8, var6 - 1)] > 0) + { + this.worldObj.updateAllLightTypes(var5, var8, var6 - 1); + } + + if (Block.lightValue[this.worldObj.getBlockId(var5, var8, var6 + 1)] > 0) + { + this.worldObj.updateAllLightTypes(var5, var8, var6 + 1); + } + + this.worldObj.updateAllLightTypes(var5, var8, var6); + } + } + } + } +} diff --git a/src/main/java/net/minecraft/src/ChunkCache.java b/src/main/java/net/minecraft/src/ChunkCache.java new file mode 100644 index 0000000..2309e32 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChunkCache.java @@ -0,0 +1,418 @@ +package net.minecraft.src; + +public class ChunkCache implements IBlockAccess +{ + private int chunkX; + private int chunkZ; + private Chunk[][] chunkArray; + + /** True if the chunk cache is empty. */ + private boolean isEmpty; + + /** Reference to the World object. */ + private World worldObj; + + public ChunkCache(World par1World, int par2, int par3, int par4, int par5, int par6, int par7, int par8) + { + this.worldObj = par1World; + this.chunkX = par2 - par8 >> 4; + this.chunkZ = par4 - par8 >> 4; + int var9 = par5 + par8 >> 4; + int var10 = par7 + par8 >> 4; + this.chunkArray = new Chunk[var9 - this.chunkX + 1][var10 - this.chunkZ + 1]; + this.isEmpty = true; + int var11; + int var12; + Chunk var13; + + for (var11 = this.chunkX; var11 <= var9; ++var11) + { + for (var12 = this.chunkZ; var12 <= var10; ++var12) + { + var13 = par1World.getChunkFromChunkCoords(var11, var12); + + if (var13 != null) + { + this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ] = var13; + } + } + } + + for (var11 = par2 >> 4; var11 <= par5 >> 4; ++var11) + { + for (var12 = par4 >> 4; var12 <= par7 >> 4; ++var12) + { + var13 = this.chunkArray[var11 - this.chunkX][var12 - this.chunkZ]; + + if (var13 != null && !var13.getAreLevelsEmpty(par3, par6)) + { + this.isEmpty = false; + } + } + } + } + + /** + * set by !chunk.getAreLevelsEmpty + */ + public boolean extendedLevelsInChunkCache() + { + return this.isEmpty; + } + + /** + * Returns the block ID at coords x,y,z + */ + public int getBlockId(int par1, int par2, int par3) + { + if (par2 < 0) + { + return 0; + } + else if (par2 >= 256) + { + return 0; + } + else + { + int var4 = (par1 >> 4) - this.chunkX; + int var5 = (par3 >> 4) - this.chunkZ; + + if (var4 >= 0 && var4 < this.chunkArray.length && var5 >= 0 && var5 < this.chunkArray[var4].length) + { + Chunk var6 = this.chunkArray[var4][var5]; + return var6 == null ? 0 : var6.getBlockID(par1 & 15, par2, par3 & 15); + } + else + { + return 0; + } + } + } + + /** + * Returns the TileEntity associated with a given block in X,Y,Z coordinates, or null if no TileEntity exists + */ + public TileEntity getBlockTileEntity(int par1, int par2, int par3) + { + int var4 = (par1 >> 4) - this.chunkX; + int var5 = (par3 >> 4) - this.chunkZ; + return this.chunkArray[var4][var5].getChunkBlockTileEntity(par1 & 15, par2, par3 & 15); + } + + public float getBrightness(int par1, int par2, int par3, int par4) + { + int var5 = this.getLightValue(par1, par2, par3); + + if (var5 < par4) + { + var5 = par4; + } + + return this.worldObj.provider.lightBrightnessTable[var5]; + } + + /** + * Any Light rendered on a 1.8 Block goes through here + */ + public int getLightBrightnessForSkyBlocks(int par1, int par2, int par3, int par4) + { + int var5 = this.getSkyBlockTypeBrightness(EnumSkyBlock.Sky, par1, par2, par3); + int var6 = this.getSkyBlockTypeBrightness(EnumSkyBlock.Block, par1, par2, par3); + + if (var6 < par4) + { + var6 = par4; + } + + return var5 << 20 | var6 << 4; + } + + /** + * Returns how bright the block is shown as which is the block's light value looked up in a lookup table (light + * values aren't linear for brightness). Args: x, y, z + */ + public float getLightBrightness(int par1, int par2, int par3) + { + return this.worldObj.provider.lightBrightnessTable[this.getLightValue(par1, par2, par3)]; + } + + /** + * Gets the light value of the specified block coords. Args: x, y, z + */ + public int getLightValue(int par1, int par2, int par3) + { + return this.getLightValueExt(par1, par2, par3, true); + } + + /** + * Get light value with flag + */ + public int getLightValueExt(int par1, int par2, int par3, boolean par4) + { + if (par1 >= -30000000 && par3 >= -30000000 && par1 < 30000000 && par3 <= 30000000) + { + int var5; + int var6; + + if (par4) + { + var5 = this.getBlockId(par1, par2, par3); + + if (var5 == Block.stoneSingleSlab.blockID || var5 == Block.woodSingleSlab.blockID || var5 == Block.tilledField.blockID || var5 == Block.stairsWoodOak.blockID || var5 == Block.stairsCobblestone.blockID) + { + var6 = this.getLightValueExt(par1, par2 + 1, par3, false); + int var7 = this.getLightValueExt(par1 + 1, par2, par3, false); + int var8 = this.getLightValueExt(par1 - 1, par2, par3, false); + int var9 = this.getLightValueExt(par1, par2, par3 + 1, false); + int var10 = this.getLightValueExt(par1, par2, par3 - 1, false); + + if (var7 > var6) + { + var6 = var7; + } + + if (var8 > var6) + { + var6 = var8; + } + + if (var9 > var6) + { + var6 = var9; + } + + if (var10 > var6) + { + var6 = var10; + } + + return var6; + } + } + + if (par2 < 0) + { + return 0; + } + else if (par2 >= 256) + { + var5 = 15 - this.worldObj.skylightSubtracted; + + if (var5 < 0) + { + var5 = 0; + } + + return var5; + } + else + { + var5 = (par1 >> 4) - this.chunkX; + var6 = (par3 >> 4) - this.chunkZ; + return this.chunkArray[var5][var6].getBlockLightValue(par1 & 15, par2, par3 & 15, this.worldObj.skylightSubtracted); + } + } + else + { + return 15; + } + } + + /** + * Returns the block metadata at coords x,y,z + */ + public int getBlockMetadata(int par1, int par2, int par3) + { + if (par2 < 0) + { + return 0; + } + else if (par2 >= 256) + { + return 0; + } + else + { + int var4 = (par1 >> 4) - this.chunkX; + int var5 = (par3 >> 4) - this.chunkZ; + return this.chunkArray[var4][var5].getBlockMetadata(par1 & 15, par2, par3 & 15); + } + } + + /** + * Returns the block's material. + */ + public Material getBlockMaterial(int par1, int par2, int par3) + { + int var4 = this.getBlockId(par1, par2, par3); + return var4 == 0 ? Material.air : Block.blocksList[var4].blockMaterial; + } + + /** + * Gets the biome for a given set of x/z coordinates + */ + public BiomeGenBase getBiomeGenForCoords(int par1, int par2) + { + return this.worldObj.getBiomeGenForCoords(par1, par2); + } + + /** + * Returns true if the block at the specified coordinates is an opaque cube. Args: x, y, z + */ + public boolean isBlockOpaqueCube(int par1, int par2, int par3) + { + Block var4 = Block.blocksList[this.getBlockId(par1, par2, par3)]; + return var4 == null ? false : var4.isOpaqueCube(); + } + + /** + * Indicate if a material is a normal solid opaque cube. + */ + public boolean isBlockNormalCube(int par1, int par2, int par3) + { + Block var4 = Block.blocksList[this.getBlockId(par1, par2, par3)]; + return var4 == null ? false : var4.blockMaterial.blocksMovement() && var4.renderAsNormalBlock(); + } + + /** + * Returns true if the block at the given coordinate has a solid (buildable) top surface. + */ + public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3) + { + Block var4 = Block.blocksList[this.getBlockId(par1, par2, par3)]; + return this.worldObj.isBlockTopFacingSurfaceSolid(var4, this.getBlockMetadata(par1, par2, par3)); + } + + /** + * Return the Vec3Pool object for this world. + */ + public Vec3Pool getWorldVec3Pool() + { + return this.worldObj.getWorldVec3Pool(); + } + + /** + * Returns true if the block at the specified coordinates is empty + */ + public boolean isAirBlock(int par1, int par2, int par3) + { + Block var4 = Block.blocksList[this.getBlockId(par1, par2, par3)]; + return var4 == null; + } + + /** + * Brightness for SkyBlock.Sky is clear white and (through color computing it is assumed) DEPENDENT ON DAYTIME. + * Brightness for SkyBlock.Block is yellowish and independent. + */ + public int getSkyBlockTypeBrightness(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4) + { + if (par3 < 0) + { + par3 = 0; + } + + if (par3 >= 256) + { + par3 = 255; + } + + if (par3 >= 0 && par3 < 256 && par2 >= -30000000 && par4 >= -30000000 && par2 < 30000000 && par4 <= 30000000) + { + if (par1EnumSkyBlock == EnumSkyBlock.Sky && this.worldObj.provider.hasNoSky) + { + return 0; + } + else + { + int var5; + int var6; + + if (Block.useNeighborBrightness[this.getBlockId(par2, par3, par4)]) + { + var5 = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3 + 1, par4); + var6 = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2 + 1, par3, par4); + int var7 = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2 - 1, par3, par4); + int var8 = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3, par4 + 1); + int var9 = this.getSpecialBlockBrightness(par1EnumSkyBlock, par2, par3, par4 - 1); + + if (var6 > var5) + { + var5 = var6; + } + + if (var7 > var5) + { + var5 = var7; + } + + if (var8 > var5) + { + var5 = var8; + } + + if (var9 > var5) + { + var5 = var9; + } + + return var5; + } + else + { + var5 = (par2 >> 4) - this.chunkX; + var6 = (par4 >> 4) - this.chunkZ; + return this.chunkArray[var5][var6].getSavedLightValue(par1EnumSkyBlock, par2 & 15, par3, par4 & 15); + } + } + } + else + { + return par1EnumSkyBlock.defaultLightValue; + } + } + + /** + * is only used on stairs and tilled fields + */ + public int getSpecialBlockBrightness(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4) + { + if (par3 < 0) + { + par3 = 0; + } + + if (par3 >= 256) + { + par3 = 255; + } + + if (par3 >= 0 && par3 < 256 && par2 >= -30000000 && par4 >= -30000000 && par2 < 30000000 && par4 <= 30000000) + { + int var5 = (par2 >> 4) - this.chunkX; + int var6 = (par4 >> 4) - this.chunkZ; + return this.chunkArray[var5][var6].getSavedLightValue(par1EnumSkyBlock, par2 & 15, par3, par4 & 15); + } + else + { + return par1EnumSkyBlock.defaultLightValue; + } + } + + /** + * Returns current world height. + */ + public int getHeight() + { + return 256; + } + + /** + * Is this block powering in the specified direction Args: x, y, z, direction + */ + public int isBlockProvidingPowerTo(int par1, int par2, int par3, int par4) + { + int var5 = this.getBlockId(par1, par2, par3); + return var5 == 0 ? 0 : Block.blocksList[var5].isProvidingStrongPower(this, par1, par2, par3, par4); + } +} diff --git a/src/main/java/net/minecraft/src/ChunkCoordIntPair.java b/src/main/java/net/minecraft/src/ChunkCoordIntPair.java new file mode 100644 index 0000000..437b2e1 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChunkCoordIntPair.java @@ -0,0 +1,58 @@ +package net.minecraft.src; + +public class ChunkCoordIntPair +{ + /** The X position of this Chunk Coordinate Pair */ + public final int chunkXPos; + + /** The Z position of this Chunk Coordinate Pair */ + public final int chunkZPos; + + public ChunkCoordIntPair(int par1, int par2) + { + this.chunkXPos = par1; + this.chunkZPos = par2; + } + + /** + * converts a chunk coordinate pair to an integer (suitable for hashing) + */ + public static long chunkXZ2Int(int par0, int par1) + { + return (long)par0 & 4294967295L | ((long)par1 & 4294967295L) << 32; + } + + public int hashCode() + { + long var1 = chunkXZ2Int(this.chunkXPos, this.chunkZPos); + int var3 = (int)var1; + int var4 = (int)(var1 >> 32); + return var3 ^ var4; + } + + public boolean equals(Object par1Obj) + { + ChunkCoordIntPair var2 = (ChunkCoordIntPair)par1Obj; + return var2.chunkXPos == this.chunkXPos && var2.chunkZPos == this.chunkZPos; + } + + public int getCenterXPos() + { + return (this.chunkXPos << 4) + 8; + } + + public int getCenterZPosition() + { + return (this.chunkZPos << 4) + 8; + } + + public ChunkPosition getChunkPosition(int par1) + { + return new ChunkPosition(this.getCenterXPos(), par1, this.getCenterZPosition()); + } + + public String toString() + { + return "[" + this.chunkXPos + ", " + this.chunkZPos + "]"; + } +} diff --git a/src/main/java/net/minecraft/src/ChunkCoordinates.java b/src/main/java/net/minecraft/src/ChunkCoordinates.java new file mode 100644 index 0000000..ea6b428 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChunkCoordinates.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +public class ChunkCoordinates implements Comparable +{ + public int posX; + + /** the y coordinate */ + public int posY; + + /** the z coordinate */ + public int posZ; + + public ChunkCoordinates() {} + + public ChunkCoordinates(int par1, int par2, int par3) + { + this.posX = par1; + this.posY = par2; + this.posZ = par3; + } + + public ChunkCoordinates(ChunkCoordinates par1ChunkCoordinates) + { + this.posX = par1ChunkCoordinates.posX; + this.posY = par1ChunkCoordinates.posY; + this.posZ = par1ChunkCoordinates.posZ; + } + + public boolean equals(Object par1Obj) + { + if (!(par1Obj instanceof ChunkCoordinates)) + { + return false; + } + else + { + ChunkCoordinates var2 = (ChunkCoordinates)par1Obj; + return this.posX == var2.posX && this.posY == var2.posY && this.posZ == var2.posZ; + } + } + + public int hashCode() + { + return this.posX + this.posZ << 8 + this.posY << 16; + } + + /** + * Compare the coordinate with another coordinate + */ + public int compareChunkCoordinate(ChunkCoordinates par1ChunkCoordinates) + { + return this.posY == par1ChunkCoordinates.posY ? (this.posZ == par1ChunkCoordinates.posZ ? this.posX - par1ChunkCoordinates.posX : this.posZ - par1ChunkCoordinates.posZ) : this.posY - par1ChunkCoordinates.posY; + } + + public void set(int par1, int par2, int par3) + { + this.posX = par1; + this.posY = par2; + this.posZ = par3; + } + + /** + * Returns the squared distance between this coordinates and the coordinates given as argument. + */ + public float getDistanceSquared(int par1, int par2, int par3) + { + float var4 = (float)(this.posX - par1); + float var5 = (float)(this.posY - par2); + float var6 = (float)(this.posZ - par3); + return var4 * var4 + var5 * var5 + var6 * var6; + } + + /** + * Return the squared distance between this coordinates and the ChunkCoordinates given as argument. + */ + public float getDistanceSquaredToChunkCoordinates(ChunkCoordinates par1ChunkCoordinates) + { + return this.getDistanceSquared(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ); + } + + public int compareTo(Object par1Obj) + { + return this.compareChunkCoordinate((ChunkCoordinates)par1Obj); + } +} diff --git a/src/main/java/net/minecraft/src/ChunkLoader.java b/src/main/java/net/minecraft/src/ChunkLoader.java new file mode 100644 index 0000000..390ec14 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChunkLoader.java @@ -0,0 +1,136 @@ +package net.minecraft.src; + +public class ChunkLoader +{ + public static AnvilConverterData load(NBTTagCompound par0NBTTagCompound) + { + int var1 = par0NBTTagCompound.getInteger("xPos"); + int var2 = par0NBTTagCompound.getInteger("zPos"); + AnvilConverterData var3 = new AnvilConverterData(var1, var2); + var3.blocks = par0NBTTagCompound.getByteArray("Blocks"); + var3.data = new NibbleArrayReader(par0NBTTagCompound.getByteArray("Data"), 7); + var3.skyLight = new NibbleArrayReader(par0NBTTagCompound.getByteArray("SkyLight"), 7); + var3.blockLight = new NibbleArrayReader(par0NBTTagCompound.getByteArray("BlockLight"), 7); + var3.heightmap = par0NBTTagCompound.getByteArray("HeightMap"); + var3.terrainPopulated = par0NBTTagCompound.getBoolean("TerrainPopulated"); + var3.entities = par0NBTTagCompound.getTagList("Entities"); + var3.tileEntities = par0NBTTagCompound.getTagList("TileEntities"); + var3.tileTicks = par0NBTTagCompound.getTagList("TileTicks"); + + try + { + var3.lastUpdated = par0NBTTagCompound.getLong("LastUpdate"); + } + catch (ClassCastException var5) + { + var3.lastUpdated = (long)par0NBTTagCompound.getInteger("LastUpdate"); + } + + return var3; + } + + public static void convertToAnvilFormat(AnvilConverterData par0AnvilConverterData, NBTTagCompound par1NBTTagCompound, WorldChunkManager par2WorldChunkManager) + { + par1NBTTagCompound.setInteger("xPos", par0AnvilConverterData.x); + par1NBTTagCompound.setInteger("zPos", par0AnvilConverterData.z); + par1NBTTagCompound.setLong("LastUpdate", par0AnvilConverterData.lastUpdated); + int[] var3 = new int[par0AnvilConverterData.heightmap.length]; + + for (int var4 = 0; var4 < par0AnvilConverterData.heightmap.length; ++var4) + { + var3[var4] = par0AnvilConverterData.heightmap[var4]; + } + + par1NBTTagCompound.setIntArray("HeightMap", var3); + par1NBTTagCompound.setBoolean("TerrainPopulated", par0AnvilConverterData.terrainPopulated); + NBTTagList var16 = new NBTTagList("Sections"); + int var7; + + for (int var5 = 0; var5 < 8; ++var5) + { + boolean var6 = true; + + for (var7 = 0; var7 < 16 && var6; ++var7) + { + int var8 = 0; + + while (var8 < 16 && var6) + { + int var9 = 0; + + while (true) + { + if (var9 < 16) + { + int var10 = var7 << 11 | var9 << 7 | var8 + (var5 << 4); + byte var11 = par0AnvilConverterData.blocks[var10]; + + if (var11 == 0) + { + ++var9; + continue; + } + + var6 = false; + } + + ++var8; + break; + } + } + } + + if (!var6) + { + byte[] var19 = new byte[4096]; + NibbleArray var20 = new NibbleArray(var19.length, 4); + NibbleArray var21 = new NibbleArray(var19.length, 4); + NibbleArray var22 = new NibbleArray(var19.length, 4); + + for (int var23 = 0; var23 < 16; ++var23) + { + for (int var12 = 0; var12 < 16; ++var12) + { + for (int var13 = 0; var13 < 16; ++var13) + { + int var14 = var23 << 11 | var13 << 7 | var12 + (var5 << 4); + byte var15 = par0AnvilConverterData.blocks[var14]; + var19[var12 << 8 | var13 << 4 | var23] = (byte)(var15 & 255); + var20.set(var23, var12, var13, par0AnvilConverterData.data.get(var23, var12 + (var5 << 4), var13)); + var21.set(var23, var12, var13, par0AnvilConverterData.skyLight.get(var23, var12 + (var5 << 4), var13)); + var22.set(var23, var12, var13, par0AnvilConverterData.blockLight.get(var23, var12 + (var5 << 4), var13)); + } + } + } + + NBTTagCompound var24 = new NBTTagCompound(); + var24.setByte("Y", (byte)(var5 & 255)); + var24.setByteArray("Blocks", var19); + var24.setByteArray("Data", var20.data); + var24.setByteArray("SkyLight", var21.data); + var24.setByteArray("BlockLight", var22.data); + var16.appendTag(var24); + } + } + + par1NBTTagCompound.setTag("Sections", var16); + byte[] var17 = new byte[256]; + + for (int var18 = 0; var18 < 16; ++var18) + { + for (var7 = 0; var7 < 16; ++var7) + { + var17[var7 << 4 | var18] = (byte)(par2WorldChunkManager.getBiomeGenAt(par0AnvilConverterData.x << 4 | var18, par0AnvilConverterData.z << 4 | var7).biomeID & 255); + } + } + + par1NBTTagCompound.setByteArray("Biomes", var17); + par1NBTTagCompound.setTag("Entities", par0AnvilConverterData.entities); + par1NBTTagCompound.setTag("TileEntities", par0AnvilConverterData.tileEntities); + + if (par0AnvilConverterData.tileTicks != null) + { + par1NBTTagCompound.setTag("TileTicks", par0AnvilConverterData.tileTicks); + } + } +} diff --git a/src/main/java/net/minecraft/src/ChunkPosition.java b/src/main/java/net/minecraft/src/ChunkPosition.java new file mode 100644 index 0000000..d351d9f --- /dev/null +++ b/src/main/java/net/minecraft/src/ChunkPosition.java @@ -0,0 +1,43 @@ +package net.minecraft.src; + +public class ChunkPosition +{ + /** The x coordinate of this ChunkPosition */ + public final int x; + + /** The y coordinate of this ChunkPosition */ + public final int y; + + /** The z coordinate of this ChunkPosition */ + public final int z; + + public ChunkPosition(int par1, int par2, int par3) + { + this.x = par1; + this.y = par2; + this.z = par3; + } + + public ChunkPosition(Vec3 par1Vec3) + { + this(MathHelper.floor_double(par1Vec3.xCoord), MathHelper.floor_double(par1Vec3.yCoord), MathHelper.floor_double(par1Vec3.zCoord)); + } + + public boolean equals(Object par1Obj) + { + if (!(par1Obj instanceof ChunkPosition)) + { + return false; + } + else + { + ChunkPosition var2 = (ChunkPosition)par1Obj; + return var2.x == this.x && var2.y == this.y && var2.z == this.z; + } + } + + public int hashCode() + { + return this.x * 8976890 + this.y * 981131 + this.z; + } +} diff --git a/src/main/java/net/minecraft/src/ChunkProviderClient.java b/src/main/java/net/minecraft/src/ChunkProviderClient.java new file mode 100644 index 0000000..f78817e --- /dev/null +++ b/src/main/java/net/minecraft/src/ChunkProviderClient.java @@ -0,0 +1,146 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class ChunkProviderClient implements IChunkProvider +{ + /** + * The completely empty chunk used by ChunkProviderClient when chunkMapping doesn't contain the requested + * coordinates. + */ + private Chunk blankChunk; + + /** + * The mapping between ChunkCoordinates and Chunks that ChunkProviderClient maintains. + */ + private LongHashMap chunkMapping = new LongHashMap(); + + /** + * This may have been intended to be an iterable version of all currently loaded chunks (MultiplayerChunkCache), + * with identical contents to chunkMapping's values. However it is never actually added to. + */ + private List chunkListing = new ArrayList(); + + /** Reference to the World object. */ + private World worldObj; + + public ChunkProviderClient(World par1World) + { + this.blankChunk = new EmptyChunk(par1World, 0, 0); + this.worldObj = par1World; + } + + /** + * Checks to see if a chunk exists at x, y + */ + public boolean chunkExists(int par1, int par2) + { + return true; + } + + /** + * Unload chunk from ChunkProviderClient's hashmap. Called in response to a Packet50PreChunk with its mode field set + * to false + */ + public void unloadChunk(int par1, int par2) + { + Chunk var3 = this.provideChunk(par1, par2); + + if (!var3.isEmpty()) + { + var3.onChunkUnload(); + } + + this.chunkMapping.remove(ChunkCoordIntPair.chunkXZ2Int(par1, par2)); + this.chunkListing.remove(var3); + } + + /** + * loads or generates the chunk at the chunk location specified + */ + public Chunk loadChunk(int par1, int par2) + { + Chunk var3 = new Chunk(this.worldObj, par1, par2); + this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(par1, par2), var3); + var3.isChunkLoaded = true; + return var3; + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int par1, int par2) + { + Chunk var3 = (Chunk)this.chunkMapping.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(par1, par2)); + return var3 == null ? this.blankChunk : var3; + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() {} + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return false; + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {} + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "MultiplayerChunkCache: " + this.chunkMapping.getNumHashElements(); + } + + /** + * Returns a list of creatures of the specified type that can spawn at the given location. + */ + public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) + { + return null; + } + + /** + * Returns the location of the closest structure of the specified type. If not found returns null. + */ + public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) + { + return null; + } + + public int getLoadedChunkCount() + { + return this.chunkListing.size(); + } + + public void recreateStructures(int par1, int par2) {} +} diff --git a/src/main/java/net/minecraft/src/ChunkProviderEnd.java b/src/main/java/net/minecraft/src/ChunkProviderEnd.java new file mode 100644 index 0000000..52fd4f2 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChunkProviderEnd.java @@ -0,0 +1,410 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ChunkProviderEnd implements IChunkProvider +{ + private Random endRNG; + private NoiseGeneratorOctaves noiseGen1; + private NoiseGeneratorOctaves noiseGen2; + private NoiseGeneratorOctaves noiseGen3; + public NoiseGeneratorOctaves noiseGen4; + public NoiseGeneratorOctaves noiseGen5; + private World endWorld; + private double[] densities; + + /** The biomes that are used to generate the chunk */ + private BiomeGenBase[] biomesForGeneration; + double[] noiseData1; + double[] noiseData2; + double[] noiseData3; + double[] noiseData4; + double[] noiseData5; + int[][] field_73203_h = new int[32][32]; + + public ChunkProviderEnd(World par1World, long par2) + { + this.endWorld = par1World; + this.endRNG = new Random(par2); + this.noiseGen1 = new NoiseGeneratorOctaves(this.endRNG, 16); + this.noiseGen2 = new NoiseGeneratorOctaves(this.endRNG, 16); + this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, 8); + this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10); + this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16); + } + + public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) + { + byte var5 = 2; + int var6 = var5 + 1; + byte var7 = 33; + int var8 = var5 + 1; + this.densities = this.initializeNoiseField(this.densities, par1 * var5, 0, par2 * var5, var6, var7, var8); + + for (int var9 = 0; var9 < var5; ++var9) + { + for (int var10 = 0; var10 < var5; ++var10) + { + for (int var11 = 0; var11 < 32; ++var11) + { + double var12 = 0.25D; + double var14 = this.densities[((var9 + 0) * var8 + var10 + 0) * var7 + var11 + 0]; + double var16 = this.densities[((var9 + 0) * var8 + var10 + 1) * var7 + var11 + 0]; + double var18 = this.densities[((var9 + 1) * var8 + var10 + 0) * var7 + var11 + 0]; + double var20 = this.densities[((var9 + 1) * var8 + var10 + 1) * var7 + var11 + 0]; + double var22 = (this.densities[((var9 + 0) * var8 + var10 + 0) * var7 + var11 + 1] - var14) * var12; + double var24 = (this.densities[((var9 + 0) * var8 + var10 + 1) * var7 + var11 + 1] - var16) * var12; + double var26 = (this.densities[((var9 + 1) * var8 + var10 + 0) * var7 + var11 + 1] - var18) * var12; + double var28 = (this.densities[((var9 + 1) * var8 + var10 + 1) * var7 + var11 + 1] - var20) * var12; + + for (int var30 = 0; var30 < 4; ++var30) + { + double var31 = 0.125D; + double var33 = var14; + double var35 = var16; + double var37 = (var18 - var14) * var31; + double var39 = (var20 - var16) * var31; + + for (int var41 = 0; var41 < 8; ++var41) + { + int var42 = var41 + var9 * 8 << 11 | 0 + var10 * 8 << 7 | var11 * 4 + var30; + short var43 = 128; + double var44 = 0.125D; + double var46 = var33; + double var48 = (var35 - var33) * var44; + + for (int var50 = 0; var50 < 8; ++var50) + { + int var51 = 0; + + if (var46 > 0.0D) + { + var51 = Block.whiteStone.blockID; + } + + par3ArrayOfByte[var42] = (byte)var51; + var42 += var43; + var46 += var48; + } + + var33 += var37; + var35 += var39; + } + + var14 += var22; + var16 += var24; + var18 += var26; + var20 += var28; + } + } + } + } + } + + public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) + { + for (int var5 = 0; var5 < 16; ++var5) + { + for (int var6 = 0; var6 < 16; ++var6) + { + byte var7 = 1; + int var8 = -1; + byte var9 = (byte)Block.whiteStone.blockID; + byte var10 = (byte)Block.whiteStone.blockID; + + for (int var11 = 127; var11 >= 0; --var11) + { + int var12 = (var6 * 16 + var5) * 128 + var11; + byte var13 = par3ArrayOfByte[var12]; + + if (var13 == 0) + { + var8 = -1; + } + else if (var13 == Block.stone.blockID) + { + if (var8 == -1) + { + if (var7 <= 0) + { + var9 = 0; + var10 = (byte)Block.whiteStone.blockID; + } + + var8 = var7; + + if (var11 >= 0) + { + par3ArrayOfByte[var12] = var9; + } + else + { + par3ArrayOfByte[var12] = var10; + } + } + else if (var8 > 0) + { + --var8; + par3ArrayOfByte[var12] = var10; + } + } + } + } + } + } + + /** + * loads or generates the chunk at the chunk location specified + */ + public Chunk loadChunk(int par1, int par2) + { + return this.provideChunk(par1, par2); + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int par1, int par2) + { + this.endRNG.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L); + byte[] var3 = new byte[32768]; + this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16); + this.generateTerrain(par1, par2, var3, this.biomesForGeneration); + this.replaceBlocksForBiome(par1, par2, var3, this.biomesForGeneration); + Chunk var4 = new Chunk(this.endWorld, var3, par1, par2); + byte[] var5 = var4.getBiomeArray(); + + for (int var6 = 0; var6 < var5.length; ++var6) + { + var5[var6] = (byte)this.biomesForGeneration[var6].biomeID; + } + + var4.generateSkylightMap(); + return var4; + } + + /** + * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the + * size. + */ + private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) + { + if (par1ArrayOfDouble == null) + { + par1ArrayOfDouble = new double[par5 * par6 * par7]; + } + + double var8 = 684.412D; + double var10 = 684.412D; + this.noiseData4 = this.noiseGen4.generateNoiseOctaves(this.noiseData4, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D); + this.noiseData5 = this.noiseGen5.generateNoiseOctaves(this.noiseData5, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D); + var8 *= 2.0D; + this.noiseData1 = this.noiseGen3.generateNoiseOctaves(this.noiseData1, par2, par3, par4, par5, par6, par7, var8 / 80.0D, var10 / 160.0D, var8 / 80.0D); + this.noiseData2 = this.noiseGen1.generateNoiseOctaves(this.noiseData2, par2, par3, par4, par5, par6, par7, var8, var10, var8); + this.noiseData3 = this.noiseGen2.generateNoiseOctaves(this.noiseData3, par2, par3, par4, par5, par6, par7, var8, var10, var8); + int var12 = 0; + int var13 = 0; + + for (int var14 = 0; var14 < par5; ++var14) + { + for (int var15 = 0; var15 < par7; ++var15) + { + double var16 = (this.noiseData4[var13] + 256.0D) / 512.0D; + + if (var16 > 1.0D) + { + var16 = 1.0D; + } + + double var18 = this.noiseData5[var13] / 8000.0D; + + if (var18 < 0.0D) + { + var18 = -var18 * 0.3D; + } + + var18 = var18 * 3.0D - 2.0D; + float var20 = (float)(var14 + par2 - 0) / 1.0F; + float var21 = (float)(var15 + par4 - 0) / 1.0F; + float var22 = 100.0F - MathHelper.sqrt_float(var20 * var20 + var21 * var21) * 8.0F; + + if (var22 > 80.0F) + { + var22 = 80.0F; + } + + if (var22 < -100.0F) + { + var22 = -100.0F; + } + + if (var18 > 1.0D) + { + var18 = 1.0D; + } + + var18 /= 8.0D; + var18 = 0.0D; + + if (var16 < 0.0D) + { + var16 = 0.0D; + } + + var16 += 0.5D; + var18 = var18 * (double)par6 / 16.0D; + ++var13; + double var23 = (double)par6 / 2.0D; + + for (int var25 = 0; var25 < par6; ++var25) + { + double var26 = 0.0D; + double var28 = ((double)var25 - var23) * 8.0D / var16; + + if (var28 < 0.0D) + { + var28 *= -1.0D; + } + + double var30 = this.noiseData2[var12] / 512.0D; + double var32 = this.noiseData3[var12] / 512.0D; + double var34 = (this.noiseData1[var12] / 10.0D + 1.0D) / 2.0D; + + if (var34 < 0.0D) + { + var26 = var30; + } + else if (var34 > 1.0D) + { + var26 = var32; + } + else + { + var26 = var30 + (var32 - var30) * var34; + } + + var26 -= 8.0D; + var26 += (double)var22; + byte var36 = 2; + double var37; + + if (var25 > par6 / 2 - var36) + { + var37 = (double)((float)(var25 - (par6 / 2 - var36)) / 64.0F); + + if (var37 < 0.0D) + { + var37 = 0.0D; + } + + if (var37 > 1.0D) + { + var37 = 1.0D; + } + + var26 = var26 * (1.0D - var37) + -3000.0D * var37; + } + + var36 = 8; + + if (var25 < var36) + { + var37 = (double)((float)(var36 - var25) / ((float)var36 - 1.0F)); + var26 = var26 * (1.0D - var37) + -30.0D * var37; + } + + par1ArrayOfDouble[var12] = var26; + ++var12; + } + } + } + + return par1ArrayOfDouble; + } + + /** + * Checks to see if a chunk exists at x, y + */ + public boolean chunkExists(int par1, int par2) + { + return true; + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) + { + BlockSand.fallInstantly = true; + int var4 = par2 * 16; + int var5 = par3 * 16; + BiomeGenBase var6 = this.endWorld.getBiomeGenForCoords(var4 + 16, var5 + 16); + var6.decorate(this.endWorld, this.endWorld.rand, var4, var5); + BlockSand.fallInstantly = false; + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() {} + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return true; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "RandomLevelSource"; + } + + /** + * Returns a list of creatures of the specified type that can spawn at the given location. + */ + public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) + { + BiomeGenBase var5 = this.endWorld.getBiomeGenForCoords(par2, par4); + return var5 == null ? null : var5.getSpawnableList(par1EnumCreatureType); + } + + /** + * Returns the location of the closest structure of the specified type. If not found returns null. + */ + public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) + { + return null; + } + + public int getLoadedChunkCount() + { + return 0; + } + + public void recreateStructures(int par1, int par2) {} +} diff --git a/src/main/java/net/minecraft/src/ChunkProviderFlat.java b/src/main/java/net/minecraft/src/ChunkProviderFlat.java new file mode 100644 index 0000000..0d7aa98 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChunkProviderFlat.java @@ -0,0 +1,306 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public class ChunkProviderFlat implements IChunkProvider +{ + private World worldObj; + private Random random; + private final byte[] cachedBlockIDs = new byte[256]; + private final byte[] cachedBlockMetadata = new byte[256]; + private final FlatGeneratorInfo flatWorldGenInfo; + private final List structureGenerators = new ArrayList(); + private final boolean hasDecoration; + private final boolean hasDungeons; + private WorldGenLakes waterLakeGenerator; + private WorldGenLakes lavaLakeGenerator; + + public ChunkProviderFlat(World par1World, long par2, boolean par4, String par5Str) + { + this.worldObj = par1World; + this.random = new Random(par2); + this.flatWorldGenInfo = FlatGeneratorInfo.createFlatGeneratorFromString(par5Str); + + if (par4) + { + Map var6 = this.flatWorldGenInfo.getWorldFeatures(); + + if (var6.containsKey("village")) + { + Map var7 = (Map)var6.get("village"); + + if (!var7.containsKey("size")) + { + var7.put("size", "1"); + } + + this.structureGenerators.add(new MapGenVillage(var7)); + } + + if (var6.containsKey("biome_1")) + { + this.structureGenerators.add(new MapGenScatteredFeature((Map)var6.get("biome_1"))); + } + + if (var6.containsKey("mineshaft")) + { + this.structureGenerators.add(new MapGenMineshaft((Map)var6.get("mineshaft"))); + } + + if (var6.containsKey("stronghold")) + { + this.structureGenerators.add(new MapGenStronghold((Map)var6.get("stronghold"))); + } + } + + this.hasDecoration = this.flatWorldGenInfo.getWorldFeatures().containsKey("decoration"); + + if (this.flatWorldGenInfo.getWorldFeatures().containsKey("lake")) + { + this.waterLakeGenerator = new WorldGenLakes(Block.waterStill.blockID); + } + + if (this.flatWorldGenInfo.getWorldFeatures().containsKey("lava_lake")) + { + this.lavaLakeGenerator = new WorldGenLakes(Block.lavaStill.blockID); + } + + this.hasDungeons = this.flatWorldGenInfo.getWorldFeatures().containsKey("dungeon"); + Iterator var9 = this.flatWorldGenInfo.getFlatLayers().iterator(); + + while (var9.hasNext()) + { + FlatLayerInfo var10 = (FlatLayerInfo)var9.next(); + + for (int var8 = var10.getMinY(); var8 < var10.getMinY() + var10.getLayerCount(); ++var8) + { + this.cachedBlockIDs[var8] = (byte)(var10.getFillBlock() & 255); + this.cachedBlockMetadata[var8] = (byte)var10.getFillBlockMeta(); + } + } + } + + /** + * loads or generates the chunk at the chunk location specified + */ + public Chunk loadChunk(int par1, int par2) + { + return this.provideChunk(par1, par2); + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int par1, int par2) + { + Chunk var3 = new Chunk(this.worldObj, par1, par2); + + for (int var4 = 0; var4 < this.cachedBlockIDs.length; ++var4) + { + int var5 = var4 >> 4; + ExtendedBlockStorage var6 = var3.getBlockStorageArray()[var5]; + + if (var6 == null) + { + var6 = new ExtendedBlockStorage(var4, !this.worldObj.provider.hasNoSky); + var3.getBlockStorageArray()[var5] = var6; + } + + for (int var7 = 0; var7 < 16; ++var7) + { + for (int var8 = 0; var8 < 16; ++var8) + { + var6.setExtBlockID(var7, var4 & 15, var8, this.cachedBlockIDs[var4] & 255); + var6.setExtBlockMetadata(var7, var4 & 15, var8, this.cachedBlockMetadata[var4]); + } + } + } + + var3.generateSkylightMap(); + BiomeGenBase[] var9 = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, par1 * 16, par2 * 16, 16, 16); + byte[] var10 = var3.getBiomeArray(); + + for (int var11 = 0; var11 < var10.length; ++var11) + { + var10[var11] = (byte)var9[var11].biomeID; + } + + Iterator var12 = this.structureGenerators.iterator(); + + while (var12.hasNext()) + { + MapGenStructure var13 = (MapGenStructure)var12.next(); + var13.generate(this, this.worldObj, par1, par2, (byte[])null); + } + + var3.generateSkylightMap(); + return var3; + } + + /** + * Checks to see if a chunk exists at x, y + */ + public boolean chunkExists(int par1, int par2) + { + return true; + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) + { + int var4 = par2 * 16; + int var5 = par3 * 16; + BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16); + boolean var7 = false; + this.random.setSeed(this.worldObj.getSeed()); + long var8 = this.random.nextLong() / 2L * 2L + 1L; + long var10 = this.random.nextLong() / 2L * 2L + 1L; + this.random.setSeed((long)par2 * var8 + (long)par3 * var10 ^ this.worldObj.getSeed()); + Iterator var12 = this.structureGenerators.iterator(); + + while (var12.hasNext()) + { + MapGenStructure var13 = (MapGenStructure)var12.next(); + boolean var14 = var13.generateStructuresInChunk(this.worldObj, this.random, par2, par3); + + if (var13 instanceof MapGenVillage) + { + var7 |= var14; + } + } + + int var16; + int var17; + int var18; + + if (this.waterLakeGenerator != null && !var7 && this.random.nextInt(4) == 0) + { + var16 = var4 + this.random.nextInt(16) + 8; + var17 = this.random.nextInt(128); + var18 = var5 + this.random.nextInt(16) + 8; + this.waterLakeGenerator.generate(this.worldObj, this.random, var16, var17, var18); + } + + if (this.lavaLakeGenerator != null && !var7 && this.random.nextInt(8) == 0) + { + var16 = var4 + this.random.nextInt(16) + 8; + var17 = this.random.nextInt(this.random.nextInt(120) + 8); + var18 = var5 + this.random.nextInt(16) + 8; + + if (var17 < 63 || this.random.nextInt(10) == 0) + { + this.lavaLakeGenerator.generate(this.worldObj, this.random, var16, var17, var18); + } + } + + if (this.hasDungeons) + { + for (var16 = 0; var16 < 8; ++var16) + { + var17 = var4 + this.random.nextInt(16) + 8; + var18 = this.random.nextInt(128); + int var15 = var5 + this.random.nextInt(16) + 8; + (new WorldGenDungeons()).generate(this.worldObj, this.random, var17, var18, var15); + } + } + + if (this.hasDecoration) + { + var6.decorate(this.worldObj, this.random, var4, var5); + } + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() {} + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return true; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "FlatLevelSource"; + } + + /** + * Returns a list of creatures of the specified type that can spawn at the given location. + */ + public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) + { + BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(par2, par4); + return var5 == null ? null : var5.getSpawnableList(par1EnumCreatureType); + } + + /** + * Returns the location of the closest structure of the specified type. If not found returns null. + */ + public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) + { + if ("Stronghold".equals(par2Str)) + { + Iterator var6 = this.structureGenerators.iterator(); + + while (var6.hasNext()) + { + MapGenStructure var7 = (MapGenStructure)var6.next(); + + if (var7 instanceof MapGenStronghold) + { + return var7.getNearestInstance(par1World, par3, par4, par5); + } + } + } + + return null; + } + + public int getLoadedChunkCount() + { + return 0; + } + + public void recreateStructures(int par1, int par2) + { + Iterator var3 = this.structureGenerators.iterator(); + + while (var3.hasNext()) + { + MapGenStructure var4 = (MapGenStructure)var3.next(); + var4.generate(this, this.worldObj, par1, par2, (byte[])null); + } + } +} diff --git a/src/main/java/net/minecraft/src/ChunkProviderGenerate.java b/src/main/java/net/minecraft/src/ChunkProviderGenerate.java new file mode 100644 index 0000000..f8fa351 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChunkProviderGenerate.java @@ -0,0 +1,615 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ChunkProviderGenerate implements IChunkProvider +{ + /** RNG. */ + private Random rand; + + /** A NoiseGeneratorOctaves used in generating terrain */ + private NoiseGeneratorOctaves noiseGen1; + + /** A NoiseGeneratorOctaves used in generating terrain */ + private NoiseGeneratorOctaves noiseGen2; + + /** A NoiseGeneratorOctaves used in generating terrain */ + private NoiseGeneratorOctaves noiseGen3; + + /** A NoiseGeneratorOctaves used in generating terrain */ + private NoiseGeneratorOctaves noiseGen4; + + /** A NoiseGeneratorOctaves used in generating terrain */ + public NoiseGeneratorOctaves noiseGen5; + + /** A NoiseGeneratorOctaves used in generating terrain */ + public NoiseGeneratorOctaves noiseGen6; + public NoiseGeneratorOctaves mobSpawnerNoise; + + /** Reference to the World object. */ + private World worldObj; + + /** are map structures going to be generated (e.g. strongholds) */ + private final boolean mapFeaturesEnabled; + + /** Holds the overall noise array used in chunk generation */ + private double[] noiseArray; + private double[] stoneNoise = new double[256]; + private MapGenBase caveGenerator = new MapGenCaves(); + + /** Holds Stronghold Generator */ + private MapGenStronghold strongholdGenerator = new MapGenStronghold(); + + /** Holds Village Generator */ + private MapGenVillage villageGenerator = new MapGenVillage(); + + /** Holds Mineshaft Generator */ + private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft(); + private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature(); + + /** Holds ravine generator */ + private MapGenBase ravineGenerator = new MapGenRavine(); + + /** The biomes that are used to generate the chunk */ + private BiomeGenBase[] biomesForGeneration; + + /** A double array that hold terrain noise from noiseGen3 */ + double[] noise3; + + /** A double array that hold terrain noise */ + double[] noise1; + + /** A double array that hold terrain noise from noiseGen2 */ + double[] noise2; + + /** A double array that hold terrain noise from noiseGen5 */ + double[] noise5; + + /** A double array that holds terrain noise from noiseGen6 */ + double[] noise6; + + /** + * Used to store the 5x5 parabolic field that is used during terrain generation. + */ + float[] parabolicField; + int[][] field_73219_j = new int[32][32]; + + public ChunkProviderGenerate(World par1World, long par2, boolean par4) + { + this.worldObj = par1World; + this.mapFeaturesEnabled = par4; + this.rand = new Random(par2); + this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); + this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); + this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 8); + this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 4); + this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); + this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); + this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); + } + + /** + * Generates the shape of the terrain for the chunk though its all stone though the water is frozen if the + * temperature is low enough + */ + public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte) + { + byte var4 = 4; + byte var5 = 16; + byte var6 = 63; + int var7 = var4 + 1; + byte var8 = 17; + int var9 = var4 + 1; + this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, var7 + 5, var9 + 5); + this.noiseArray = this.initializeNoiseField(this.noiseArray, par1 * var4, 0, par2 * var4, var7, var8, var9); + + for (int var10 = 0; var10 < var4; ++var10) + { + for (int var11 = 0; var11 < var4; ++var11) + { + for (int var12 = 0; var12 < var5; ++var12) + { + double var13 = 0.125D; + double var15 = this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 0]; + double var17 = this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 0]; + double var19 = this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 0]; + double var21 = this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 0]; + double var23 = (this.noiseArray[((var10 + 0) * var9 + var11 + 0) * var8 + var12 + 1] - var15) * var13; + double var25 = (this.noiseArray[((var10 + 0) * var9 + var11 + 1) * var8 + var12 + 1] - var17) * var13; + double var27 = (this.noiseArray[((var10 + 1) * var9 + var11 + 0) * var8 + var12 + 1] - var19) * var13; + double var29 = (this.noiseArray[((var10 + 1) * var9 + var11 + 1) * var8 + var12 + 1] - var21) * var13; + + for (int var31 = 0; var31 < 8; ++var31) + { + double var32 = 0.25D; + double var34 = var15; + double var36 = var17; + double var38 = (var19 - var15) * var32; + double var40 = (var21 - var17) * var32; + + for (int var42 = 0; var42 < 4; ++var42) + { + int var43 = var42 + var10 * 4 << 11 | 0 + var11 * 4 << 7 | var12 * 8 + var31; + short var44 = 128; + var43 -= var44; + double var45 = 0.25D; + double var49 = (var36 - var34) * var45; + double var47 = var34 - var49; + + for (int var51 = 0; var51 < 4; ++var51) + { + if ((var47 += var49) > 0.0D) + { + par3ArrayOfByte[var43 += var44] = (byte)Block.stone.blockID; + } + else if (var12 * 8 + var31 < var6) + { + par3ArrayOfByte[var43 += var44] = (byte)Block.waterStill.blockID; + } + else + { + par3ArrayOfByte[var43 += var44] = 0; + } + } + + var34 += var38; + var36 += var40; + } + + var15 += var23; + var17 += var25; + var19 += var27; + var21 += var29; + } + } + } + } + } + + /** + * Replaces the stone that was placed in with blocks that match the biome + */ + public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) + { + byte var5 = 63; + double var6 = 0.03125D; + this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, var6 * 2.0D, var6 * 2.0D, var6 * 2.0D); + + for (int var8 = 0; var8 < 16; ++var8) + { + for (int var9 = 0; var9 < 16; ++var9) + { + BiomeGenBase var10 = par4ArrayOfBiomeGenBase[var9 + var8 * 16]; + float var11 = var10.getFloatTemperature(); + int var12 = (int)(this.stoneNoise[var8 + var9 * 16] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); + int var13 = -1; + byte var14 = var10.topBlock; + byte var15 = var10.fillerBlock; + + for (int var16 = 127; var16 >= 0; --var16) + { + int var17 = (var9 * 16 + var8) * 128 + var16; + + if (var16 <= 0 + this.rand.nextInt(5)) + { + par3ArrayOfByte[var17] = (byte)Block.bedrock.blockID; + } + else + { + byte var18 = par3ArrayOfByte[var17]; + + if (var18 == 0) + { + var13 = -1; + } + else if (var18 == Block.stone.blockID) + { + if (var13 == -1) + { + if (var12 <= 0) + { + var14 = 0; + var15 = (byte)Block.stone.blockID; + } + else if (var16 >= var5 - 4 && var16 <= var5 + 1) + { + var14 = var10.topBlock; + var15 = var10.fillerBlock; + } + + if (var16 < var5 && var14 == 0) + { + if (var11 < 0.15F) + { + var14 = (byte)Block.ice.blockID; + } + else + { + var14 = (byte)Block.waterStill.blockID; + } + } + + var13 = var12; + + if (var16 >= var5 - 1) + { + par3ArrayOfByte[var17] = var14; + } + else + { + par3ArrayOfByte[var17] = var15; + } + } + else if (var13 > 0) + { + --var13; + par3ArrayOfByte[var17] = var15; + + if (var13 == 0 && var15 == Block.sand.blockID) + { + var13 = this.rand.nextInt(4); + var15 = (byte)Block.sandStone.blockID; + } + } + } + } + } + } + } + } + + /** + * loads or generates the chunk at the chunk location specified + */ + public Chunk loadChunk(int par1, int par2) + { + return this.provideChunk(par1, par2); + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int par1, int par2) + { + this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L); + byte[] var3 = new byte[32768]; + this.generateTerrain(par1, par2, var3); + this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16); + this.replaceBlocksForBiome(par1, par2, var3, this.biomesForGeneration); + this.caveGenerator.generate(this, this.worldObj, par1, par2, var3); + this.ravineGenerator.generate(this, this.worldObj, par1, par2, var3); + + if (this.mapFeaturesEnabled) + { + this.mineshaftGenerator.generate(this, this.worldObj, par1, par2, var3); + this.villageGenerator.generate(this, this.worldObj, par1, par2, var3); + this.strongholdGenerator.generate(this, this.worldObj, par1, par2, var3); + this.scatteredFeatureGenerator.generate(this, this.worldObj, par1, par2, var3); + } + + Chunk var4 = new Chunk(this.worldObj, var3, par1, par2); + byte[] var5 = var4.getBiomeArray(); + + for (int var6 = 0; var6 < var5.length; ++var6) + { + var5[var6] = (byte)this.biomesForGeneration[var6].biomeID; + } + + var4.generateSkylightMap(); + return var4; + } + + /** + * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the + * size. + */ + private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) + { + if (par1ArrayOfDouble == null) + { + par1ArrayOfDouble = new double[par5 * par6 * par7]; + } + + if (this.parabolicField == null) + { + this.parabolicField = new float[25]; + + for (int var8 = -2; var8 <= 2; ++var8) + { + for (int var9 = -2; var9 <= 2; ++var9) + { + float var10 = 10.0F / MathHelper.sqrt_float((float)(var8 * var8 + var9 * var9) + 0.2F); + this.parabolicField[var8 + 2 + (var9 + 2) * 5] = var10; + } + } + } + + double var44 = 684.412D; + double var45 = 684.412D; + this.noise5 = this.noiseGen5.generateNoiseOctaves(this.noise5, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D); + this.noise6 = this.noiseGen6.generateNoiseOctaves(this.noise6, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D); + this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, par2, par3, par4, par5, par6, par7, var44 / 80.0D, var45 / 160.0D, var44 / 80.0D); + this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, par2, par3, par4, par5, par6, par7, var44, var45, var44); + this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, par2, par3, par4, par5, par6, par7, var44, var45, var44); + boolean var43 = false; + boolean var42 = false; + int var12 = 0; + int var13 = 0; + + for (int var14 = 0; var14 < par5; ++var14) + { + for (int var15 = 0; var15 < par7; ++var15) + { + float var16 = 0.0F; + float var17 = 0.0F; + float var18 = 0.0F; + byte var19 = 2; + BiomeGenBase var20 = this.biomesForGeneration[var14 + 2 + (var15 + 2) * (par5 + 5)]; + + for (int var21 = -var19; var21 <= var19; ++var21) + { + for (int var22 = -var19; var22 <= var19; ++var22) + { + BiomeGenBase var23 = this.biomesForGeneration[var14 + var21 + 2 + (var15 + var22 + 2) * (par5 + 5)]; + float var24 = this.parabolicField[var21 + 2 + (var22 + 2) * 5] / (var23.minHeight + 2.0F); + + if (var23.minHeight > var20.minHeight) + { + var24 /= 2.0F; + } + + var16 += var23.maxHeight * var24; + var17 += var23.minHeight * var24; + var18 += var24; + } + } + + var16 /= var18; + var17 /= var18; + var16 = var16 * 0.9F + 0.1F; + var17 = (var17 * 4.0F - 1.0F) / 8.0F; + double var46 = this.noise6[var13] / 8000.0D; + + if (var46 < 0.0D) + { + var46 = -var46 * 0.3D; + } + + var46 = var46 * 3.0D - 2.0D; + + if (var46 < 0.0D) + { + var46 /= 2.0D; + + if (var46 < -1.0D) + { + var46 = -1.0D; + } + + var46 /= 1.4D; + var46 /= 2.0D; + } + else + { + if (var46 > 1.0D) + { + var46 = 1.0D; + } + + var46 /= 8.0D; + } + + ++var13; + + for (int var47 = 0; var47 < par6; ++var47) + { + double var48 = (double)var17; + double var26 = (double)var16; + var48 += var46 * 0.2D; + var48 = var48 * (double)par6 / 16.0D; + double var28 = (double)par6 / 2.0D + var48 * 4.0D; + double var30 = 0.0D; + double var32 = ((double)var47 - var28) * 12.0D * 128.0D / 128.0D / var26; + + if (var32 < 0.0D) + { + var32 *= 4.0D; + } + + double var34 = this.noise1[var12] / 512.0D; + double var36 = this.noise2[var12] / 512.0D; + double var38 = (this.noise3[var12] / 10.0D + 1.0D) / 2.0D; + + if (var38 < 0.0D) + { + var30 = var34; + } + else if (var38 > 1.0D) + { + var30 = var36; + } + else + { + var30 = var34 + (var36 - var34) * var38; + } + + var30 -= var32; + + if (var47 > par6 - 4) + { + double var40 = (double)((float)(var47 - (par6 - 4)) / 3.0F); + var30 = var30 * (1.0D - var40) + -10.0D * var40; + } + + par1ArrayOfDouble[var12] = var30; + ++var12; + } + } + } + + return par1ArrayOfDouble; + } + + /** + * Checks to see if a chunk exists at x, y + */ + public boolean chunkExists(int par1, int par2) + { + return true; + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) + { + BlockSand.fallInstantly = true; + int var4 = par2 * 16; + int var5 = par3 * 16; + BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16, var5 + 16); + this.rand.setSeed(this.worldObj.getSeed()); + long var7 = this.rand.nextLong() / 2L * 2L + 1L; + long var9 = this.rand.nextLong() / 2L * 2L + 1L; + this.rand.setSeed((long)par2 * var7 + (long)par3 * var9 ^ this.worldObj.getSeed()); + boolean var11 = false; + + if (this.mapFeaturesEnabled) + { + this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); + var11 = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); + this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); + this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); + } + + int var12; + int var13; + int var14; + + if (var6 != BiomeGenBase.desert && var6 != BiomeGenBase.desertHills && !var11 && this.rand.nextInt(4) == 0) + { + var12 = var4 + this.rand.nextInt(16) + 8; + var13 = this.rand.nextInt(128); + var14 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenLakes(Block.waterStill.blockID)).generate(this.worldObj, this.rand, var12, var13, var14); + } + + if (!var11 && this.rand.nextInt(8) == 0) + { + var12 = var4 + this.rand.nextInt(16) + 8; + var13 = this.rand.nextInt(this.rand.nextInt(120) + 8); + var14 = var5 + this.rand.nextInt(16) + 8; + + if (var13 < 63 || this.rand.nextInt(10) == 0) + { + (new WorldGenLakes(Block.lavaStill.blockID)).generate(this.worldObj, this.rand, var12, var13, var14); + } + } + + for (var12 = 0; var12 < 8; ++var12) + { + var13 = var4 + this.rand.nextInt(16) + 8; + var14 = this.rand.nextInt(128); + int var15 = var5 + this.rand.nextInt(16) + 8; + (new WorldGenDungeons()).generate(this.worldObj, this.rand, var13, var14, var15); + } + + var6.decorate(this.worldObj, this.rand, var4, var5); + SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand); + var4 += 8; + var5 += 8; + + for (var12 = 0; var12 < 16; ++var12) + { + for (var13 = 0; var13 < 16; ++var13) + { + var14 = this.worldObj.getPrecipitationHeight(var4 + var12, var5 + var13); + + if (this.worldObj.isBlockFreezable(var12 + var4, var14 - 1, var13 + var5)) + { + this.worldObj.setBlock(var12 + var4, var14 - 1, var13 + var5, Block.ice.blockID, 0, 2); + } + + if (this.worldObj.canSnowAt(var12 + var4, var14, var13 + var5)) + { + this.worldObj.setBlock(var12 + var4, var14, var13 + var5, Block.snow.blockID, 0, 2); + } + } + } + + BlockSand.fallInstantly = false; + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() {} + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return true; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "RandomLevelSource"; + } + + /** + * Returns a list of creatures of the specified type that can spawn at the given location. + */ + public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) + { + BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(par2, par4); + return var5 == null ? null : (par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.func_143030_a(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : var5.getSpawnableList(par1EnumCreatureType)); + } + + /** + * Returns the location of the closest structure of the specified type. If not found returns null. + */ + public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) + { + return "Stronghold".equals(par2Str) && this.strongholdGenerator != null ? this.strongholdGenerator.getNearestInstance(par1World, par3, par4, par5) : null; + } + + public int getLoadedChunkCount() + { + return 0; + } + + public void recreateStructures(int par1, int par2) + { + if (this.mapFeaturesEnabled) + { + this.mineshaftGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); + this.villageGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); + this.strongholdGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); + this.scatteredFeatureGenerator.generate(this, this.worldObj, par1, par2, (byte[])null); + } + } +} diff --git a/src/main/java/net/minecraft/src/ChunkProviderHell.java b/src/main/java/net/minecraft/src/ChunkProviderHell.java new file mode 100644 index 0000000..da837d6 --- /dev/null +++ b/src/main/java/net/minecraft/src/ChunkProviderHell.java @@ -0,0 +1,590 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ChunkProviderHell implements IChunkProvider +{ + private Random hellRNG; + + /** A NoiseGeneratorOctaves used in generating nether terrain */ + private NoiseGeneratorOctaves netherNoiseGen1; + private NoiseGeneratorOctaves netherNoiseGen2; + private NoiseGeneratorOctaves netherNoiseGen3; + + /** Determines whether slowsand or gravel can be generated at a location */ + private NoiseGeneratorOctaves slowsandGravelNoiseGen; + + /** + * Determines whether something other than nettherack can be generated at a location + */ + private NoiseGeneratorOctaves netherrackExculsivityNoiseGen; + public NoiseGeneratorOctaves netherNoiseGen6; + public NoiseGeneratorOctaves netherNoiseGen7; + + /** Is the world that the nether is getting generated. */ + private World worldObj; + private double[] noiseField; + public MapGenNetherBridge genNetherBridge = new MapGenNetherBridge(); + + /** + * Holds the noise used to determine whether slowsand can be generated at a location + */ + private double[] slowsandNoise = new double[256]; + private double[] gravelNoise = new double[256]; + + /** + * Holds the noise used to determine whether something other than netherrack can be generated at a location + */ + private double[] netherrackExclusivityNoise = new double[256]; + private MapGenBase netherCaveGenerator = new MapGenCavesHell(); + double[] noiseData1; + double[] noiseData2; + double[] noiseData3; + double[] noiseData4; + double[] noiseData5; + + public ChunkProviderHell(World par1World, long par2) + { + this.worldObj = par1World; + this.hellRNG = new Random(par2); + this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); + this.netherNoiseGen2 = new NoiseGeneratorOctaves(this.hellRNG, 16); + this.netherNoiseGen3 = new NoiseGeneratorOctaves(this.hellRNG, 8); + this.slowsandGravelNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); + this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4); + this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10); + this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16); + } + + /** + * Generates the shape of the terrain in the nether. + */ + public void generateNetherTerrain(int par1, int par2, byte[] par3ArrayOfByte) + { + byte var4 = 4; + byte var5 = 32; + int var6 = var4 + 1; + byte var7 = 17; + int var8 = var4 + 1; + this.noiseField = this.initializeNoiseField(this.noiseField, par1 * var4, 0, par2 * var4, var6, var7, var8); + + for (int var9 = 0; var9 < var4; ++var9) + { + for (int var10 = 0; var10 < var4; ++var10) + { + for (int var11 = 0; var11 < 16; ++var11) + { + double var12 = 0.125D; + double var14 = this.noiseField[((var9 + 0) * var8 + var10 + 0) * var7 + var11 + 0]; + double var16 = this.noiseField[((var9 + 0) * var8 + var10 + 1) * var7 + var11 + 0]; + double var18 = this.noiseField[((var9 + 1) * var8 + var10 + 0) * var7 + var11 + 0]; + double var20 = this.noiseField[((var9 + 1) * var8 + var10 + 1) * var7 + var11 + 0]; + double var22 = (this.noiseField[((var9 + 0) * var8 + var10 + 0) * var7 + var11 + 1] - var14) * var12; + double var24 = (this.noiseField[((var9 + 0) * var8 + var10 + 1) * var7 + var11 + 1] - var16) * var12; + double var26 = (this.noiseField[((var9 + 1) * var8 + var10 + 0) * var7 + var11 + 1] - var18) * var12; + double var28 = (this.noiseField[((var9 + 1) * var8 + var10 + 1) * var7 + var11 + 1] - var20) * var12; + + for (int var30 = 0; var30 < 8; ++var30) + { + double var31 = 0.25D; + double var33 = var14; + double var35 = var16; + double var37 = (var18 - var14) * var31; + double var39 = (var20 - var16) * var31; + + for (int var41 = 0; var41 < 4; ++var41) + { + int var42 = var41 + var9 * 4 << 11 | 0 + var10 * 4 << 7 | var11 * 8 + var30; + short var43 = 128; + double var44 = 0.25D; + double var46 = var33; + double var48 = (var35 - var33) * var44; + + for (int var50 = 0; var50 < 4; ++var50) + { + int var51 = 0; + + if (var11 * 8 + var30 < var5) + { + var51 = Block.lavaStill.blockID; + } + + if (var46 > 0.0D) + { + var51 = Block.netherrack.blockID; + } + + par3ArrayOfByte[var42] = (byte)var51; + var42 += var43; + var46 += var48; + } + + var33 += var37; + var35 += var39; + } + + var14 += var22; + var16 += var24; + var18 += var26; + var20 += var28; + } + } + } + } + } + + /** + * name based on ChunkProviderGenerate + */ + public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte) + { + byte var4 = 64; + double var5 = 0.03125D; + this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, var5, var5, 1.0D); + this.gravelNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.gravelNoise, par1 * 16, 109, par2 * 16, 16, 1, 16, var5, 1.0D, var5); + this.netherrackExclusivityNoise = this.netherrackExculsivityNoiseGen.generateNoiseOctaves(this.netherrackExclusivityNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, var5 * 2.0D, var5 * 2.0D, var5 * 2.0D); + + for (int var7 = 0; var7 < 16; ++var7) + { + for (int var8 = 0; var8 < 16; ++var8) + { + boolean var9 = this.slowsandNoise[var7 + var8 * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D; + boolean var10 = this.gravelNoise[var7 + var8 * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D; + int var11 = (int)(this.netherrackExclusivityNoise[var7 + var8 * 16] / 3.0D + 3.0D + this.hellRNG.nextDouble() * 0.25D); + int var12 = -1; + byte var13 = (byte)Block.netherrack.blockID; + byte var14 = (byte)Block.netherrack.blockID; + + for (int var15 = 127; var15 >= 0; --var15) + { + int var16 = (var8 * 16 + var7) * 128 + var15; + + if (var15 < 127 - this.hellRNG.nextInt(5) && var15 > 0 + this.hellRNG.nextInt(5)) + { + byte var17 = par3ArrayOfByte[var16]; + + if (var17 == 0) + { + var12 = -1; + } + else if (var17 == Block.netherrack.blockID) + { + if (var12 == -1) + { + if (var11 <= 0) + { + var13 = 0; + var14 = (byte)Block.netherrack.blockID; + } + else if (var15 >= var4 - 4 && var15 <= var4 + 1) + { + var13 = (byte)Block.netherrack.blockID; + var14 = (byte)Block.netherrack.blockID; + + if (var10) + { + var13 = (byte)Block.gravel.blockID; + } + + if (var10) + { + var14 = (byte)Block.netherrack.blockID; + } + + if (var9) + { + var13 = (byte)Block.slowSand.blockID; + } + + if (var9) + { + var14 = (byte)Block.slowSand.blockID; + } + } + + if (var15 < var4 && var13 == 0) + { + var13 = (byte)Block.lavaStill.blockID; + } + + var12 = var11; + + if (var15 >= var4 - 1) + { + par3ArrayOfByte[var16] = var13; + } + else + { + par3ArrayOfByte[var16] = var14; + } + } + else if (var12 > 0) + { + --var12; + par3ArrayOfByte[var16] = var14; + } + } + } + else + { + par3ArrayOfByte[var16] = (byte)Block.bedrock.blockID; + } + } + } + } + } + + /** + * loads or generates the chunk at the chunk location specified + */ + public Chunk loadChunk(int par1, int par2) + { + return this.provideChunk(par1, par2); + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int par1, int par2) + { + this.hellRNG.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L); + byte[] var3 = new byte[32768]; + this.generateNetherTerrain(par1, par2, var3); + this.replaceBlocksForBiome(par1, par2, var3); + this.netherCaveGenerator.generate(this, this.worldObj, par1, par2, var3); + this.genNetherBridge.generate(this, this.worldObj, par1, par2, var3); + Chunk var4 = new Chunk(this.worldObj, var3, par1, par2); + BiomeGenBase[] var5 = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[])null, par1 * 16, par2 * 16, 16, 16); + byte[] var6 = var4.getBiomeArray(); + + for (int var7 = 0; var7 < var6.length; ++var7) + { + var6[var7] = (byte)var5[var7].biomeID; + } + + var4.resetRelightChecks(); + return var4; + } + + /** + * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the + * size. + */ + private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) + { + if (par1ArrayOfDouble == null) + { + par1ArrayOfDouble = new double[par5 * par6 * par7]; + } + + double var8 = 684.412D; + double var10 = 2053.236D; + this.noiseData4 = this.netherNoiseGen6.generateNoiseOctaves(this.noiseData4, par2, par3, par4, par5, 1, par7, 1.0D, 0.0D, 1.0D); + this.noiseData5 = this.netherNoiseGen7.generateNoiseOctaves(this.noiseData5, par2, par3, par4, par5, 1, par7, 100.0D, 0.0D, 100.0D); + this.noiseData1 = this.netherNoiseGen3.generateNoiseOctaves(this.noiseData1, par2, par3, par4, par5, par6, par7, var8 / 80.0D, var10 / 60.0D, var8 / 80.0D); + this.noiseData2 = this.netherNoiseGen1.generateNoiseOctaves(this.noiseData2, par2, par3, par4, par5, par6, par7, var8, var10, var8); + this.noiseData3 = this.netherNoiseGen2.generateNoiseOctaves(this.noiseData3, par2, par3, par4, par5, par6, par7, var8, var10, var8); + int var12 = 0; + int var13 = 0; + double[] var14 = new double[par6]; + int var15; + + for (var15 = 0; var15 < par6; ++var15) + { + var14[var15] = Math.cos((double)var15 * Math.PI * 6.0D / (double)par6) * 2.0D; + double var16 = (double)var15; + + if (var15 > par6 / 2) + { + var16 = (double)(par6 - 1 - var15); + } + + if (var16 < 4.0D) + { + var16 = 4.0D - var16; + var14[var15] -= var16 * var16 * var16 * 10.0D; + } + } + + for (var15 = 0; var15 < par5; ++var15) + { + for (int var36 = 0; var36 < par7; ++var36) + { + double var17 = (this.noiseData4[var13] + 256.0D) / 512.0D; + + if (var17 > 1.0D) + { + var17 = 1.0D; + } + + double var19 = 0.0D; + double var21 = this.noiseData5[var13] / 8000.0D; + + if (var21 < 0.0D) + { + var21 = -var21; + } + + var21 = var21 * 3.0D - 3.0D; + + if (var21 < 0.0D) + { + var21 /= 2.0D; + + if (var21 < -1.0D) + { + var21 = -1.0D; + } + + var21 /= 1.4D; + var21 /= 2.0D; + var17 = 0.0D; + } + else + { + if (var21 > 1.0D) + { + var21 = 1.0D; + } + + var21 /= 6.0D; + } + + var17 += 0.5D; + var21 = var21 * (double)par6 / 16.0D; + ++var13; + + for (int var23 = 0; var23 < par6; ++var23) + { + double var24 = 0.0D; + double var26 = var14[var23]; + double var28 = this.noiseData2[var12] / 512.0D; + double var30 = this.noiseData3[var12] / 512.0D; + double var32 = (this.noiseData1[var12] / 10.0D + 1.0D) / 2.0D; + + if (var32 < 0.0D) + { + var24 = var28; + } + else if (var32 > 1.0D) + { + var24 = var30; + } + else + { + var24 = var28 + (var30 - var28) * var32; + } + + var24 -= var26; + double var34; + + if (var23 > par6 - 4) + { + var34 = (double)((float)(var23 - (par6 - 4)) / 3.0F); + var24 = var24 * (1.0D - var34) + -10.0D * var34; + } + + if ((double)var23 < var19) + { + var34 = (var19 - (double)var23) / 4.0D; + + if (var34 < 0.0D) + { + var34 = 0.0D; + } + + if (var34 > 1.0D) + { + var34 = 1.0D; + } + + var24 = var24 * (1.0D - var34) + -10.0D * var34; + } + + par1ArrayOfDouble[var12] = var24; + ++var12; + } + } + } + + return par1ArrayOfDouble; + } + + /** + * Checks to see if a chunk exists at x, y + */ + public boolean chunkExists(int par1, int par2) + { + return true; + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) + { + BlockSand.fallInstantly = true; + int var4 = par2 * 16; + int var5 = par3 * 16; + this.genNetherBridge.generateStructuresInChunk(this.worldObj, this.hellRNG, par2, par3); + int var6; + int var7; + int var8; + int var9; + + for (var6 = 0; var6 < 8; ++var6) + { + var7 = var4 + this.hellRNG.nextInt(16) + 8; + var8 = this.hellRNG.nextInt(120) + 4; + var9 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenHellLava(Block.lavaMoving.blockID, false)).generate(this.worldObj, this.hellRNG, var7, var8, var9); + } + + var6 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1; + int var10; + + for (var7 = 0; var7 < var6; ++var7) + { + var8 = var4 + this.hellRNG.nextInt(16) + 8; + var9 = this.hellRNG.nextInt(120) + 4; + var10 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenFire()).generate(this.worldObj, this.hellRNG, var8, var9, var10); + } + + var6 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); + + for (var7 = 0; var7 < var6; ++var7) + { + var8 = var4 + this.hellRNG.nextInt(16) + 8; + var9 = this.hellRNG.nextInt(120) + 4; + var10 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenGlowStone1()).generate(this.worldObj, this.hellRNG, var8, var9, var10); + } + + for (var7 = 0; var7 < 10; ++var7) + { + var8 = var4 + this.hellRNG.nextInt(16) + 8; + var9 = this.hellRNG.nextInt(128); + var10 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenGlowStone2()).generate(this.worldObj, this.hellRNG, var8, var9, var10); + } + + if (this.hellRNG.nextInt(1) == 0) + { + var7 = var4 + this.hellRNG.nextInt(16) + 8; + var8 = this.hellRNG.nextInt(128); + var9 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenFlowers(Block.mushroomBrown.blockID)).generate(this.worldObj, this.hellRNG, var7, var8, var9); + } + + if (this.hellRNG.nextInt(1) == 0) + { + var7 = var4 + this.hellRNG.nextInt(16) + 8; + var8 = this.hellRNG.nextInt(128); + var9 = var5 + this.hellRNG.nextInt(16) + 8; + (new WorldGenFlowers(Block.mushroomRed.blockID)).generate(this.worldObj, this.hellRNG, var7, var8, var9); + } + + WorldGenMinable var12 = new WorldGenMinable(Block.oreNetherQuartz.blockID, 13, Block.netherrack.blockID); + int var11; + + for (var8 = 0; var8 < 16; ++var8) + { + var9 = var4 + this.hellRNG.nextInt(16); + var10 = this.hellRNG.nextInt(108) + 10; + var11 = var5 + this.hellRNG.nextInt(16); + var12.generate(this.worldObj, this.hellRNG, var9, var10, var11); + } + + for (var8 = 0; var8 < 16; ++var8) + { + var9 = var4 + this.hellRNG.nextInt(16); + var10 = this.hellRNG.nextInt(108) + 10; + var11 = var5 + this.hellRNG.nextInt(16); + (new WorldGenHellLava(Block.lavaMoving.blockID, true)).generate(this.worldObj, this.hellRNG, var9, var10, var11); + } + + BlockSand.fallInstantly = false; + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) + { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() {} + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return true; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "HellRandomLevelSource"; + } + + /** + * Returns a list of creatures of the specified type that can spawn at the given location. + */ + public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) + { + if (par1EnumCreatureType == EnumCreatureType.monster) + { + if (this.genNetherBridge.hasStructureAt(par2, par3, par4)) + { + return this.genNetherBridge.getSpawnList(); + } + + if (this.genNetherBridge.func_142038_b(par2, par3, par4) && this.worldObj.getBlockId(par2, par3 - 1, par4) == Block.netherBrick.blockID) + { + return this.genNetherBridge.getSpawnList(); + } + } + + BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(par2, par4); + return var5 == null ? null : var5.getSpawnableList(par1EnumCreatureType); + } + + /** + * Returns the location of the closest structure of the specified type. If not found returns null. + */ + public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) + { + return null; + } + + public int getLoadedChunkCount() + { + return 0; + } + + public void recreateStructures(int par1, int par2) + { + this.genNetherBridge.generate(this, this.worldObj, par1, par2, (byte[])null); + } +} diff --git a/src/main/java/net/minecraft/src/ChunkProviderServer.java b/src/main/java/net/minecraft/src/ChunkProviderServer.java new file mode 100644 index 0000000..ad6525c --- /dev/null +++ b/src/main/java/net/minecraft/src/ChunkProviderServer.java @@ -0,0 +1,353 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +public class ChunkProviderServer implements IChunkProvider +{ + /** + * used by unload100OldestChunks to iterate the loadedChunkHashMap for unload (underlying assumption, first in, + * first out) + */ + private Set chunksToUnload = new HashSet(); + private Chunk defaultEmptyChunk; + private IChunkProvider currentChunkProvider; + private IChunkLoader currentChunkLoader; + + /** + * if this is false, the defaultEmptyChunk will be returned by the provider + */ + public boolean loadChunkOnProvideRequest = true; + private LongHashMap loadedChunkHashMap = new LongHashMap(); + private List loadedChunks = new ArrayList(); + private WorldServer worldObj; + + public ChunkProviderServer(WorldServer par1WorldServer, IChunkLoader par2IChunkLoader, IChunkProvider par3IChunkProvider) + { + this.defaultEmptyChunk = new EmptyChunk(par1WorldServer, 0, 0); + this.worldObj = par1WorldServer; + this.currentChunkLoader = par2IChunkLoader; + this.currentChunkProvider = par3IChunkProvider; + } + + /** + * Checks to see if a chunk exists at x, y + */ + public boolean chunkExists(int par1, int par2) + { + return this.loadedChunkHashMap.containsItem(ChunkCoordIntPair.chunkXZ2Int(par1, par2)); + } + + /** + * marks chunk for unload by "unload100OldestChunks" if there is no spawn point, or if the center of the chunk is + * outside 200 blocks (x or z) of the spawn + */ + public void unloadChunksIfNotNearSpawn(int par1, int par2) + { + if (this.worldObj.provider.canRespawnHere()) + { + ChunkCoordinates var3 = this.worldObj.getSpawnPoint(); + int var4 = par1 * 16 + 8 - var3.posX; + int var5 = par2 * 16 + 8 - var3.posZ; + short var6 = 128; + + if (var4 < -var6 || var4 > var6 || var5 < -var6 || var5 > var6) + { + this.chunksToUnload.add(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par1, par2))); + } + } + else + { + this.chunksToUnload.add(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par1, par2))); + } + } + + /** + * marks all chunks for unload, ignoring those near the spawn + */ + public void unloadAllChunks() + { + Iterator var1 = this.loadedChunks.iterator(); + + while (var1.hasNext()) + { + Chunk var2 = (Chunk)var1.next(); + this.unloadChunksIfNotNearSpawn(var2.xPosition, var2.zPosition); + } + } + + /** + * loads or generates the chunk at the chunk location specified + */ + public Chunk loadChunk(int par1, int par2) + { + long var3 = ChunkCoordIntPair.chunkXZ2Int(par1, par2); + this.chunksToUnload.remove(Long.valueOf(var3)); + Chunk var5 = (Chunk)this.loadedChunkHashMap.getValueByKey(var3); + + if (var5 == null) + { + var5 = this.safeLoadChunk(par1, par2); + + if (var5 == null) + { + if (this.currentChunkProvider == null) + { + var5 = this.defaultEmptyChunk; + } + else + { + try + { + var5 = this.currentChunkProvider.provideChunk(par1, par2); + } + catch (Throwable var9) + { + CrashReport var7 = CrashReport.makeCrashReport(var9, "Exception generating new chunk"); + CrashReportCategory var8 = var7.makeCategory("Chunk to be generated"); + var8.addCrashSection("Location", String.format("%d,%d", new Object[] {Integer.valueOf(par1), Integer.valueOf(par2)})); + var8.addCrashSection("Position hash", Long.valueOf(var3)); + var8.addCrashSection("Generator", this.currentChunkProvider.makeString()); + throw new ReportedException(var7); + } + } + } + + this.loadedChunkHashMap.add(var3, var5); + this.loadedChunks.add(var5); + + if (var5 != null) + { + var5.onChunkLoad(); + } + + var5.populateChunk(this, this, par1, par2); + } + + return var5; + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + public Chunk provideChunk(int par1, int par2) + { + Chunk var3 = (Chunk)this.loadedChunkHashMap.getValueByKey(ChunkCoordIntPair.chunkXZ2Int(par1, par2)); + return var3 == null ? (!this.worldObj.findingSpawnPoint && !this.loadChunkOnProvideRequest ? this.defaultEmptyChunk : this.loadChunk(par1, par2)) : var3; + } + + /** + * used by loadChunk, but catches any exceptions if the load fails. + */ + private Chunk safeLoadChunk(int par1, int par2) + { + if (this.currentChunkLoader == null) + { + return null; + } + else + { + try + { + Chunk var3 = this.currentChunkLoader.loadChunk(this.worldObj, par1, par2); + + if (var3 != null) + { + var3.lastSaveTime = this.worldObj.getTotalWorldTime(); + + if (this.currentChunkProvider != null) + { + this.currentChunkProvider.recreateStructures(par1, par2); + } + } + + return var3; + } + catch (Exception var4) + { + var4.printStackTrace(); + return null; + } + } + } + + /** + * used by saveChunks, but catches any exceptions if the save fails. + */ + private void safeSaveExtraChunkData(Chunk par1Chunk) + { + if (this.currentChunkLoader != null) + { + try + { + this.currentChunkLoader.saveExtraChunkData(this.worldObj, par1Chunk); + } + catch (Exception var3) + { + var3.printStackTrace(); + } + } + } + + /** + * used by saveChunks, but catches any exceptions if the save fails. + */ + private void safeSaveChunk(Chunk par1Chunk) + { + if (this.currentChunkLoader != null) + { + try + { + par1Chunk.lastSaveTime = this.worldObj.getTotalWorldTime(); + this.currentChunkLoader.saveChunk(this.worldObj, par1Chunk); + } + catch (IOException var3) + { + var3.printStackTrace(); + } + catch (MinecraftException var4) + { + var4.printStackTrace(); + } + } + } + + /** + * Populates chunk with ores etc etc + */ + public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) + { + Chunk var4 = this.provideChunk(par2, par3); + + if (!var4.isTerrainPopulated) + { + var4.isTerrainPopulated = true; + + if (this.currentChunkProvider != null) + { + this.currentChunkProvider.populate(par1IChunkProvider, par2, par3); + var4.setChunkModified(); + } + } + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) + { + int var3 = 0; + + for (int var4 = 0; var4 < this.loadedChunks.size(); ++var4) + { + Chunk var5 = (Chunk)this.loadedChunks.get(var4); + + if (par1) + { + this.safeSaveExtraChunkData(var5); + } + + if (var5.needsSaving(par1)) + { + this.safeSaveChunk(var5); + var5.isModified = false; + ++var3; + + if (var3 == 24 && !par1) + { + return false; + } + } + } + + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + public void saveExtraData() + { + if (this.currentChunkLoader != null) + { + this.currentChunkLoader.saveExtraData(); + } + } + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + public boolean unloadQueuedChunks() + { + if (!this.worldObj.canNotSave) + { + for (int var1 = 0; var1 < 100; ++var1) + { + if (!this.chunksToUnload.isEmpty()) + { + Long var2 = (Long)this.chunksToUnload.iterator().next(); + Chunk var3 = (Chunk)this.loadedChunkHashMap.getValueByKey(var2.longValue()); + var3.onChunkUnload(); + this.safeSaveChunk(var3); + this.safeSaveExtraChunkData(var3); + this.chunksToUnload.remove(var2); + this.loadedChunkHashMap.remove(var2.longValue()); + this.loadedChunks.remove(var3); + } + } + + if (this.currentChunkLoader != null) + { + this.currentChunkLoader.chunkTick(); + } + } + + return this.currentChunkProvider.unloadQueuedChunks(); + } + + /** + * Returns if the IChunkProvider supports saving. + */ + public boolean canSave() + { + return !this.worldObj.canNotSave; + } + + /** + * Converts the instance data to a readable string. + */ + public String makeString() + { + return "ServerChunkCache: " + this.loadedChunkHashMap.getNumHashElements() + " Drop: " + this.chunksToUnload.size(); + } + + /** + * Returns a list of creatures of the specified type that can spawn at the given location. + */ + public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) + { + return this.currentChunkProvider.getPossibleCreatures(par1EnumCreatureType, par2, par3, par4); + } + + /** + * Returns the location of the closest structure of the specified type. If not found returns null. + */ + public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5) + { + return this.currentChunkProvider.findClosestStructure(par1World, par2Str, par3, par4, par5); + } + + public int getLoadedChunkCount() + { + return this.loadedChunkHashMap.getNumHashElements(); + } + + public void recreateStructures(int par1, int par2) {} +} diff --git a/src/main/java/net/minecraft/src/ClippingHelper.java b/src/main/java/net/minecraft/src/ClippingHelper.java new file mode 100644 index 0000000..fc073f2 --- /dev/null +++ b/src/main/java/net/minecraft/src/ClippingHelper.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public class ClippingHelper +{ + public float[][] frustum = new float[16][16]; + public float[] projectionMatrix = new float[16]; + public float[] modelviewMatrix = new float[16]; + public float[] clippingMatrix = new float[16]; + + /** + * Returns true if the box is inside all 6 clipping planes, otherwise returns false. + */ + public boolean isBoxInFrustum(double par1, double par3, double par5, double par7, double par9, double par11) + { + for (int var13 = 0; var13 < 6; ++var13) + { + if ((double)this.frustum[var13][0] * par1 + (double)this.frustum[var13][1] * par3 + (double)this.frustum[var13][2] * par5 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * par7 + (double)this.frustum[var13][1] * par3 + (double)this.frustum[var13][2] * par5 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * par1 + (double)this.frustum[var13][1] * par9 + (double)this.frustum[var13][2] * par5 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * par7 + (double)this.frustum[var13][1] * par9 + (double)this.frustum[var13][2] * par5 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * par1 + (double)this.frustum[var13][1] * par3 + (double)this.frustum[var13][2] * par11 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * par7 + (double)this.frustum[var13][1] * par3 + (double)this.frustum[var13][2] * par11 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * par1 + (double)this.frustum[var13][1] * par9 + (double)this.frustum[var13][2] * par11 + (double)this.frustum[var13][3] <= 0.0D && (double)this.frustum[var13][0] * par7 + (double)this.frustum[var13][1] * par9 + (double)this.frustum[var13][2] * par11 + (double)this.frustum[var13][3] <= 0.0D) + { + return false; + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ClippingHelperImpl.java b/src/main/java/net/minecraft/src/ClippingHelperImpl.java new file mode 100644 index 0000000..afa0229 --- /dev/null +++ b/src/main/java/net/minecraft/src/ClippingHelperImpl.java @@ -0,0 +1,92 @@ +package net.minecraft.src; + +import java.nio.FloatBuffer; +import org.lwjgl.opengl.GL11; + +public class ClippingHelperImpl extends ClippingHelper +{ + private static ClippingHelperImpl instance = new ClippingHelperImpl(); + private FloatBuffer projectionMatrixBuffer = GLAllocation.createDirectFloatBuffer(16); + private FloatBuffer modelviewMatrixBuffer = GLAllocation.createDirectFloatBuffer(16); + private FloatBuffer field_78564_h = GLAllocation.createDirectFloatBuffer(16); + + /** + * Initialises the ClippingHelper object then returns an instance of it. + */ + public static ClippingHelper getInstance() + { + instance.init(); + return instance; + } + + /** + * Normalize the frustum. + */ + private void normalize(float[][] par1ArrayOfFloat, int par2) + { + float var3 = MathHelper.sqrt_float(par1ArrayOfFloat[par2][0] * par1ArrayOfFloat[par2][0] + par1ArrayOfFloat[par2][1] * par1ArrayOfFloat[par2][1] + par1ArrayOfFloat[par2][2] * par1ArrayOfFloat[par2][2]); + par1ArrayOfFloat[par2][0] /= var3; + par1ArrayOfFloat[par2][1] /= var3; + par1ArrayOfFloat[par2][2] /= var3; + par1ArrayOfFloat[par2][3] /= var3; + } + + private void init() + { + this.projectionMatrixBuffer.clear(); + this.modelviewMatrixBuffer.clear(); + this.field_78564_h.clear(); + GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, this.projectionMatrixBuffer); + GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, this.modelviewMatrixBuffer); + this.projectionMatrixBuffer.flip().limit(16); + this.projectionMatrixBuffer.get(this.projectionMatrix); + this.modelviewMatrixBuffer.flip().limit(16); + this.modelviewMatrixBuffer.get(this.modelviewMatrix); + this.clippingMatrix[0] = this.modelviewMatrix[0] * this.projectionMatrix[0] + this.modelviewMatrix[1] * this.projectionMatrix[4] + this.modelviewMatrix[2] * this.projectionMatrix[8] + this.modelviewMatrix[3] * this.projectionMatrix[12]; + this.clippingMatrix[1] = this.modelviewMatrix[0] * this.projectionMatrix[1] + this.modelviewMatrix[1] * this.projectionMatrix[5] + this.modelviewMatrix[2] * this.projectionMatrix[9] + this.modelviewMatrix[3] * this.projectionMatrix[13]; + this.clippingMatrix[2] = this.modelviewMatrix[0] * this.projectionMatrix[2] + this.modelviewMatrix[1] * this.projectionMatrix[6] + this.modelviewMatrix[2] * this.projectionMatrix[10] + this.modelviewMatrix[3] * this.projectionMatrix[14]; + this.clippingMatrix[3] = this.modelviewMatrix[0] * this.projectionMatrix[3] + this.modelviewMatrix[1] * this.projectionMatrix[7] + this.modelviewMatrix[2] * this.projectionMatrix[11] + this.modelviewMatrix[3] * this.projectionMatrix[15]; + this.clippingMatrix[4] = this.modelviewMatrix[4] * this.projectionMatrix[0] + this.modelviewMatrix[5] * this.projectionMatrix[4] + this.modelviewMatrix[6] * this.projectionMatrix[8] + this.modelviewMatrix[7] * this.projectionMatrix[12]; + this.clippingMatrix[5] = this.modelviewMatrix[4] * this.projectionMatrix[1] + this.modelviewMatrix[5] * this.projectionMatrix[5] + this.modelviewMatrix[6] * this.projectionMatrix[9] + this.modelviewMatrix[7] * this.projectionMatrix[13]; + this.clippingMatrix[6] = this.modelviewMatrix[4] * this.projectionMatrix[2] + this.modelviewMatrix[5] * this.projectionMatrix[6] + this.modelviewMatrix[6] * this.projectionMatrix[10] + this.modelviewMatrix[7] * this.projectionMatrix[14]; + this.clippingMatrix[7] = this.modelviewMatrix[4] * this.projectionMatrix[3] + this.modelviewMatrix[5] * this.projectionMatrix[7] + this.modelviewMatrix[6] * this.projectionMatrix[11] + this.modelviewMatrix[7] * this.projectionMatrix[15]; + this.clippingMatrix[8] = this.modelviewMatrix[8] * this.projectionMatrix[0] + this.modelviewMatrix[9] * this.projectionMatrix[4] + this.modelviewMatrix[10] * this.projectionMatrix[8] + this.modelviewMatrix[11] * this.projectionMatrix[12]; + this.clippingMatrix[9] = this.modelviewMatrix[8] * this.projectionMatrix[1] + this.modelviewMatrix[9] * this.projectionMatrix[5] + this.modelviewMatrix[10] * this.projectionMatrix[9] + this.modelviewMatrix[11] * this.projectionMatrix[13]; + this.clippingMatrix[10] = this.modelviewMatrix[8] * this.projectionMatrix[2] + this.modelviewMatrix[9] * this.projectionMatrix[6] + this.modelviewMatrix[10] * this.projectionMatrix[10] + this.modelviewMatrix[11] * this.projectionMatrix[14]; + this.clippingMatrix[11] = this.modelviewMatrix[8] * this.projectionMatrix[3] + this.modelviewMatrix[9] * this.projectionMatrix[7] + this.modelviewMatrix[10] * this.projectionMatrix[11] + this.modelviewMatrix[11] * this.projectionMatrix[15]; + this.clippingMatrix[12] = this.modelviewMatrix[12] * this.projectionMatrix[0] + this.modelviewMatrix[13] * this.projectionMatrix[4] + this.modelviewMatrix[14] * this.projectionMatrix[8] + this.modelviewMatrix[15] * this.projectionMatrix[12]; + this.clippingMatrix[13] = this.modelviewMatrix[12] * this.projectionMatrix[1] + this.modelviewMatrix[13] * this.projectionMatrix[5] + this.modelviewMatrix[14] * this.projectionMatrix[9] + this.modelviewMatrix[15] * this.projectionMatrix[13]; + this.clippingMatrix[14] = this.modelviewMatrix[12] * this.projectionMatrix[2] + this.modelviewMatrix[13] * this.projectionMatrix[6] + this.modelviewMatrix[14] * this.projectionMatrix[10] + this.modelviewMatrix[15] * this.projectionMatrix[14]; + this.clippingMatrix[15] = this.modelviewMatrix[12] * this.projectionMatrix[3] + this.modelviewMatrix[13] * this.projectionMatrix[7] + this.modelviewMatrix[14] * this.projectionMatrix[11] + this.modelviewMatrix[15] * this.projectionMatrix[15]; + this.frustum[0][0] = this.clippingMatrix[3] - this.clippingMatrix[0]; + this.frustum[0][1] = this.clippingMatrix[7] - this.clippingMatrix[4]; + this.frustum[0][2] = this.clippingMatrix[11] - this.clippingMatrix[8]; + this.frustum[0][3] = this.clippingMatrix[15] - this.clippingMatrix[12]; + this.normalize(this.frustum, 0); + this.frustum[1][0] = this.clippingMatrix[3] + this.clippingMatrix[0]; + this.frustum[1][1] = this.clippingMatrix[7] + this.clippingMatrix[4]; + this.frustum[1][2] = this.clippingMatrix[11] + this.clippingMatrix[8]; + this.frustum[1][3] = this.clippingMatrix[15] + this.clippingMatrix[12]; + this.normalize(this.frustum, 1); + this.frustum[2][0] = this.clippingMatrix[3] + this.clippingMatrix[1]; + this.frustum[2][1] = this.clippingMatrix[7] + this.clippingMatrix[5]; + this.frustum[2][2] = this.clippingMatrix[11] + this.clippingMatrix[9]; + this.frustum[2][3] = this.clippingMatrix[15] + this.clippingMatrix[13]; + this.normalize(this.frustum, 2); + this.frustum[3][0] = this.clippingMatrix[3] - this.clippingMatrix[1]; + this.frustum[3][1] = this.clippingMatrix[7] - this.clippingMatrix[5]; + this.frustum[3][2] = this.clippingMatrix[11] - this.clippingMatrix[9]; + this.frustum[3][3] = this.clippingMatrix[15] - this.clippingMatrix[13]; + this.normalize(this.frustum, 3); + this.frustum[4][0] = this.clippingMatrix[3] - this.clippingMatrix[2]; + this.frustum[4][1] = this.clippingMatrix[7] - this.clippingMatrix[6]; + this.frustum[4][2] = this.clippingMatrix[11] - this.clippingMatrix[10]; + this.frustum[4][3] = this.clippingMatrix[15] - this.clippingMatrix[14]; + this.normalize(this.frustum, 4); + this.frustum[5][0] = this.clippingMatrix[3] + this.clippingMatrix[2]; + this.frustum[5][1] = this.clippingMatrix[7] + this.clippingMatrix[6]; + this.frustum[5][2] = this.clippingMatrix[11] + this.clippingMatrix[10]; + this.frustum[5][3] = this.clippingMatrix[15] + this.clippingMatrix[14]; + this.normalize(this.frustum, 5); + } +} diff --git a/src/main/java/net/minecraft/src/ColorizerFoliage.java b/src/main/java/net/minecraft/src/ColorizerFoliage.java new file mode 100644 index 0000000..d3cb5ef --- /dev/null +++ b/src/main/java/net/minecraft/src/ColorizerFoliage.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +public class ColorizerFoliage +{ + /** Color buffer for foliage */ + private static int[] foliageBuffer = new int[65536]; + + public static void setFoliageBiomeColorizer(int[] par0ArrayOfInteger) + { + foliageBuffer = par0ArrayOfInteger; + } + + /** + * Gets foliage color from temperature and humidity. Args: temperature, humidity + */ + public static int getFoliageColor(double par0, double par2) + { + par2 *= par0; + int var4 = (int)((1.0D - par0) * 255.0D); + int var5 = (int)((1.0D - par2) * 255.0D); + return foliageBuffer[var5 << 8 | var4]; + } + + /** + * Gets the foliage color for pine type (metadata 1) trees + */ + public static int getFoliageColorPine() + { + return 6396257; + } + + /** + * Gets the foliage color for birch type (metadata 2) trees + */ + public static int getFoliageColorBirch() + { + return 8431445; + } + + public static int getFoliageColorBasic() + { + return 4764952; + } +} diff --git a/src/main/java/net/minecraft/src/ColorizerGrass.java b/src/main/java/net/minecraft/src/ColorizerGrass.java new file mode 100644 index 0000000..0d26a66 --- /dev/null +++ b/src/main/java/net/minecraft/src/ColorizerGrass.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +public class ColorizerGrass +{ + /** Color buffer for grass */ + private static int[] grassBuffer = new int[65536]; + + public static void setGrassBiomeColorizer(int[] par0ArrayOfInteger) + { + grassBuffer = par0ArrayOfInteger; + } + + /** + * Gets grass color from temperature and humidity. Args: temperature, humidity + */ + public static int getGrassColor(double par0, double par2) + { + par2 *= par0; + int var4 = (int)((1.0D - par0) * 255.0D); + int var5 = (int)((1.0D - par2) * 255.0D); + return grassBuffer[var5 << 8 | var4]; + } +} diff --git a/src/main/java/net/minecraft/src/CombatEntry.java b/src/main/java/net/minecraft/src/CombatEntry.java new file mode 100644 index 0000000..e415a1a --- /dev/null +++ b/src/main/java/net/minecraft/src/CombatEntry.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +public class CombatEntry +{ + private final DamageSource damageSrc; + private final int field_94567_b; + private final float field_94568_c; + private final float field_94565_d; + private final String field_94566_e; + private final float field_94564_f; + + public CombatEntry(DamageSource par1DamageSource, int par2, float par3, float par4, String par5Str, float par6) + { + this.damageSrc = par1DamageSource; + this.field_94567_b = par2; + this.field_94568_c = par4; + this.field_94565_d = par3; + this.field_94566_e = par5Str; + this.field_94564_f = par6; + } + + /** + * Get the DamageSource of the CombatEntry instance. + */ + public DamageSource getDamageSrc() + { + return this.damageSrc; + } + + public float func_94563_c() + { + return this.field_94568_c; + } + + public boolean func_94559_f() + { + return this.damageSrc.getEntity() instanceof EntityLivingBase; + } + + public String func_94562_g() + { + return this.field_94566_e; + } + + public String func_94558_h() + { + return this.getDamageSrc().getEntity() == null ? null : this.getDamageSrc().getEntity().getTranslatedEntityName(); + } + + public float func_94561_i() + { + return this.damageSrc == DamageSource.outOfWorld ? Float.MAX_VALUE : this.field_94564_f; + } +} diff --git a/src/main/java/net/minecraft/src/CombatTracker.java b/src/main/java/net/minecraft/src/CombatTracker.java new file mode 100644 index 0000000..4cc3549 --- /dev/null +++ b/src/main/java/net/minecraft/src/CombatTracker.java @@ -0,0 +1,225 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class CombatTracker +{ + private final List field_94556_a = new ArrayList(); + + /** The entity tracked. */ + private final EntityLivingBase fighter; + private int field_94555_c; + private boolean field_94552_d; + private boolean field_94553_e; + private String field_94551_f; + + public CombatTracker(EntityLivingBase par1EntityLivingBase) + { + this.fighter = par1EntityLivingBase; + } + + public void func_94545_a() + { + this.func_94542_g(); + + if (this.fighter.isOnLadder()) + { + int var1 = this.fighter.worldObj.getBlockId(MathHelper.floor_double(this.fighter.posX), MathHelper.floor_double(this.fighter.boundingBox.minY), MathHelper.floor_double(this.fighter.posZ)); + + if (var1 == Block.ladder.blockID) + { + this.field_94551_f = "ladder"; + } + else if (var1 == Block.vine.blockID) + { + this.field_94551_f = "vines"; + } + } + else if (this.fighter.isInWater()) + { + this.field_94551_f = "water"; + } + } + + public void func_94547_a(DamageSource par1DamageSource, float par2, float par3) + { + this.func_94549_h(); + this.func_94545_a(); + CombatEntry var4 = new CombatEntry(par1DamageSource, this.fighter.ticksExisted, par2, par3, this.field_94551_f, this.fighter.fallDistance); + this.field_94556_a.add(var4); + this.field_94555_c = this.fighter.ticksExisted; + this.field_94553_e = true; + this.field_94552_d |= var4.func_94559_f(); + } + + public ChatMessageComponent func_94546_b() + { + if (this.field_94556_a.size() == 0) + { + return ChatMessageComponent.createFromTranslationWithSubstitutions("death.attack.generic", new Object[] {this.fighter.getTranslatedEntityName()}); + } + else + { + CombatEntry var1 = this.func_94544_f(); + CombatEntry var2 = (CombatEntry)this.field_94556_a.get(this.field_94556_a.size() - 1); + String var4 = var2.func_94558_h(); + Entity var5 = var2.getDamageSrc().getEntity(); + ChatMessageComponent var3; + + if (var1 != null && var2.getDamageSrc() == DamageSource.fall) + { + String var6 = var1.func_94558_h(); + + if (var1.getDamageSrc() != DamageSource.fall && var1.getDamageSrc() != DamageSource.outOfWorld) + { + if (var6 != null && (var4 == null || !var6.equals(var4))) + { + Entity var9 = var1.getDamageSrc().getEntity(); + ItemStack var8 = var9 instanceof EntityLivingBase ? ((EntityLivingBase)var9).getHeldItem() : null; + + if (var8 != null && var8.hasDisplayName()) + { + var3 = ChatMessageComponent.createFromTranslationWithSubstitutions("death.fell.assist.item", new Object[] {this.fighter.getTranslatedEntityName(), var6, var8.getDisplayName()}); + } + else + { + var3 = ChatMessageComponent.createFromTranslationWithSubstitutions("death.fell.assist", new Object[] {this.fighter.getTranslatedEntityName(), var6}); + } + } + else if (var4 != null) + { + ItemStack var7 = var5 instanceof EntityLivingBase ? ((EntityLivingBase)var5).getHeldItem() : null; + + if (var7 != null && var7.hasDisplayName()) + { + var3 = ChatMessageComponent.createFromTranslationWithSubstitutions("death.fell.finish.item", new Object[] {this.fighter.getTranslatedEntityName(), var4, var7.getDisplayName()}); + } + else + { + var3 = ChatMessageComponent.createFromTranslationWithSubstitutions("death.fell.finish", new Object[] {this.fighter.getTranslatedEntityName(), var4}); + } + } + else + { + var3 = ChatMessageComponent.createFromTranslationWithSubstitutions("death.fell.killer", new Object[] {this.fighter.getTranslatedEntityName()}); + } + } + else + { + var3 = ChatMessageComponent.createFromTranslationWithSubstitutions("death.fell.accident." + this.func_94548_b(var1), new Object[] {this.fighter.getTranslatedEntityName()}); + } + } + else + { + var3 = var2.getDamageSrc().getDeathMessage(this.fighter); + } + + return var3; + } + } + + public EntityLivingBase func_94550_c() + { + EntityLivingBase var1 = null; + EntityPlayer var2 = null; + float var3 = 0.0F; + float var4 = 0.0F; + Iterator var5 = this.field_94556_a.iterator(); + + while (var5.hasNext()) + { + CombatEntry var6 = (CombatEntry)var5.next(); + + if (var6.getDamageSrc().getEntity() instanceof EntityPlayer && (var2 == null || var6.func_94563_c() > var4)) + { + var4 = var6.func_94563_c(); + var2 = (EntityPlayer)var6.getDamageSrc().getEntity(); + } + + if (var6.getDamageSrc().getEntity() instanceof EntityLivingBase && (var1 == null || var6.func_94563_c() > var3)) + { + var3 = var6.func_94563_c(); + var1 = (EntityLivingBase)var6.getDamageSrc().getEntity(); + } + } + + if (var2 != null && var4 >= var3 / 3.0F) + { + return var2; + } + else + { + return var1; + } + } + + private CombatEntry func_94544_f() + { + CombatEntry var1 = null; + CombatEntry var2 = null; + byte var3 = 0; + float var4 = 0.0F; + + for (int var5 = 0; var5 < this.field_94556_a.size(); ++var5) + { + CombatEntry var6 = (CombatEntry)this.field_94556_a.get(var5); + CombatEntry var7 = var5 > 0 ? (CombatEntry)this.field_94556_a.get(var5 - 1) : null; + + if ((var6.getDamageSrc() == DamageSource.fall || var6.getDamageSrc() == DamageSource.outOfWorld) && var6.func_94561_i() > 0.0F && (var1 == null || var6.func_94561_i() > var4)) + { + if (var5 > 0) + { + var1 = var7; + } + else + { + var1 = var6; + } + + var4 = var6.func_94561_i(); + } + + if (var6.func_94562_g() != null && (var2 == null || var6.func_94563_c() > (float)var3)) + { + var2 = var6; + } + } + + if (var4 > 5.0F && var1 != null) + { + return var1; + } + else if (var3 > 5 && var2 != null) + { + return var2; + } + else + { + return null; + } + } + + private String func_94548_b(CombatEntry par1CombatEntry) + { + return par1CombatEntry.func_94562_g() == null ? "generic" : par1CombatEntry.func_94562_g(); + } + + private void func_94542_g() + { + this.field_94551_f = null; + } + + private void func_94549_h() + { + int var1 = this.field_94552_d ? 300 : 100; + + if (this.field_94553_e && this.fighter.ticksExisted - this.field_94555_c > var1) + { + this.field_94556_a.clear(); + this.field_94553_e = false; + this.field_94552_d = false; + } + } +} diff --git a/src/main/java/net/minecraft/src/CommandBase.java b/src/main/java/net/minecraft/src/CommandBase.java new file mode 100644 index 0000000..5e68756 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandBase.java @@ -0,0 +1,442 @@ +package net.minecraft.src; + +import com.google.common.primitives.Doubles; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public abstract class CommandBase implements ICommand +{ + private static IAdminCommand theAdmin; + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 4; + } + + public List getCommandAliases() + { + return null; + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) + { + return par1ICommandSender.canCommandSenderUseCommand(this.getRequiredPermissionLevel(), this.getCommandName()); + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return null; + } + + /** + * Parses an int from the given string. + */ + public static int parseInt(ICommandSender par0ICommandSender, String par1Str) + { + try + { + return Integer.parseInt(par1Str); + } + catch (NumberFormatException var3) + { + throw new NumberInvalidException("commands.generic.num.invalid", new Object[] {par1Str}); + } + } + + /** + * Parses an int from the given sring with a specified minimum. + */ + public static int parseIntWithMin(ICommandSender par0ICommandSender, String par1Str, int par2) + { + return parseIntBounded(par0ICommandSender, par1Str, par2, Integer.MAX_VALUE); + } + + /** + * Parses an int from the given string within a specified bound. + */ + public static int parseIntBounded(ICommandSender par0ICommandSender, String par1Str, int par2, int par3) + { + int var4 = parseInt(par0ICommandSender, par1Str); + + if (var4 < par2) + { + throw new NumberInvalidException("commands.generic.num.tooSmall", new Object[] {Integer.valueOf(var4), Integer.valueOf(par2)}); + } + else if (var4 > par3) + { + throw new NumberInvalidException("commands.generic.num.tooBig", new Object[] {Integer.valueOf(var4), Integer.valueOf(par3)}); + } + else + { + return var4; + } + } + + /** + * Parses a double from the given string or throws an exception if it's not a double. + */ + public static double parseDouble(ICommandSender par0ICommandSender, String par1Str) + { + try + { + double var2 = Double.parseDouble(par1Str); + + if (!Doubles.isFinite(var2)) + { + throw new NumberInvalidException("commands.generic.double.invalid", new Object[] {par1Str}); + } + else + { + return var2; + } + } + catch (NumberFormatException var4) + { + throw new NumberInvalidException("commands.generic.double.invalid", new Object[] {par1Str}); + } + } + + public static double func_110664_a(ICommandSender par0ICommandSender, String par1Str, double par2) + { + return func_110661_a(par0ICommandSender, par1Str, par2, Double.MAX_VALUE); + } + + public static double func_110661_a(ICommandSender par0ICommandSender, String par1Str, double par2, double par4) + { + double var6 = parseDouble(par0ICommandSender, par1Str); + + if (var6 < par2) + { + throw new NumberInvalidException("commands.generic.double.tooSmall", new Object[] {Double.valueOf(var6), Double.valueOf(par2)}); + } + else if (var6 > par4) + { + throw new NumberInvalidException("commands.generic.double.tooBig", new Object[] {Double.valueOf(var6), Double.valueOf(par4)}); + } + else + { + return var6; + } + } + + public static boolean func_110662_c(ICommandSender par0ICommandSender, String par1Str) + { + if (!par1Str.equals("true") && !par1Str.equals("1")) + { + if (!par1Str.equals("false") && !par1Str.equals("0")) + { + throw new CommandException("commands.generic.boolean.invalid", new Object[] {par1Str}); + } + else + { + return false; + } + } + else + { + return true; + } + } + + /** + * Returns the given ICommandSender as a EntityPlayer or throw an exception. + */ + public static EntityPlayerMP getCommandSenderAsPlayer(ICommandSender par0ICommandSender) + { + if (par0ICommandSender instanceof EntityPlayerMP) + { + return (EntityPlayerMP)par0ICommandSender; + } + else + { + throw new PlayerNotFoundException("You must specify which player you wish to perform this action on.", new Object[0]); + } + } + + public static EntityPlayerMP getPlayer(ICommandSender par0ICommandSender, String par1Str) + { + EntityPlayerMP var2 = PlayerSelector.matchOnePlayer(par0ICommandSender, par1Str); + + if (var2 != null) + { + return var2; + } + else + { + var2 = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(par1Str); + + if (var2 == null) + { + throw new PlayerNotFoundException(); + } + else + { + return var2; + } + } + } + + public static String func_96332_d(ICommandSender par0ICommandSender, String par1Str) + { + EntityPlayerMP var2 = PlayerSelector.matchOnePlayer(par0ICommandSender, par1Str); + + if (var2 != null) + { + return var2.getEntityName(); + } + else if (PlayerSelector.hasArguments(par1Str)) + { + throw new PlayerNotFoundException(); + } + else + { + return par1Str; + } + } + + public static String func_82360_a(ICommandSender par0ICommandSender, String[] par1ArrayOfStr, int par2) + { + return func_82361_a(par0ICommandSender, par1ArrayOfStr, par2, false); + } + + public static String func_82361_a(ICommandSender par0ICommandSender, String[] par1ArrayOfStr, int par2, boolean par3) + { + StringBuilder var4 = new StringBuilder(); + + for (int var5 = par2; var5 < par1ArrayOfStr.length; ++var5) + { + if (var5 > par2) + { + var4.append(" "); + } + + String var6 = par1ArrayOfStr[var5]; + + if (par3) + { + String var7 = PlayerSelector.matchPlayersAsString(par0ICommandSender, var6); + + if (var7 != null) + { + var6 = var7; + } + else if (PlayerSelector.hasArguments(var6)) + { + throw new PlayerNotFoundException(); + } + } + + var4.append(var6); + } + + return var4.toString(); + } + + public static double func_110666_a(ICommandSender par0ICommandSender, double par1, String par3Str) + { + return func_110665_a(par0ICommandSender, par1, par3Str, -30000000, 30000000); + } + + public static double func_110665_a(ICommandSender par0ICommandSender, double par1, String par3Str, int par4, int par5) + { + boolean var6 = par3Str.startsWith("~"); + + if (var6 && Double.isNaN(par1)) + { + throw new NumberInvalidException("commands.generic.num.invalid", new Object[] {Double.valueOf(par1)}); + } + else + { + double var7 = var6 ? par1 : 0.0D; + + if (!var6 || par3Str.length() > 1) + { + boolean var9 = par3Str.contains("."); + + if (var6) + { + par3Str = par3Str.substring(1); + } + + var7 += parseDouble(par0ICommandSender, par3Str); + + if (!var9 && !var6) + { + var7 += 0.5D; + } + } + + if (par4 != 0 || par5 != 0) + { + if (var7 < (double)par4) + { + throw new NumberInvalidException("commands.generic.double.tooSmall", new Object[] {Double.valueOf(var7), Integer.valueOf(par4)}); + } + + if (var7 > (double)par5) + { + throw new NumberInvalidException("commands.generic.double.tooBig", new Object[] {Double.valueOf(var7), Integer.valueOf(par5)}); + } + } + + return var7; + } + } + + /** + * Joins the given string array into a "x, y, and z" seperated string. + */ + public static String joinNiceString(Object[] par0ArrayOfObj) + { + StringBuilder var1 = new StringBuilder(); + + for (int var2 = 0; var2 < par0ArrayOfObj.length; ++var2) + { + String var3 = par0ArrayOfObj[var2].toString(); + + if (var2 > 0) + { + if (var2 == par0ArrayOfObj.length - 1) + { + var1.append(" and "); + } + else + { + var1.append(", "); + } + } + + var1.append(var3); + } + + return var1.toString(); + } + + public static String func_96333_a(Collection par0Collection) + { + return joinNiceString(par0Collection.toArray(new String[par0Collection.size()])); + } + + public static String func_110663_b(Collection par0Collection) + { + String[] var1 = new String[par0Collection.size()]; + int var2 = 0; + EntityLivingBase var4; + + for (Iterator var3 = par0Collection.iterator(); var3.hasNext(); var1[var2++] = var4.getTranslatedEntityName()) + { + var4 = (EntityLivingBase)var3.next(); + } + + return joinNiceString(var1); + } + + /** + * Returns true if the given substring is exactly equal to the start of the given string (case insensitive). + */ + public static boolean doesStringStartWith(String par0Str, String par1Str) + { + return par1Str.regionMatches(true, 0, par0Str, 0, par0Str.length()); + } + + /** + * Returns a List of strings (chosen from the given strings) which the last word in the given string array is a + * beginning-match for. (Tab completion). + */ + public static List getListOfStringsMatchingLastWord(String[] par0ArrayOfStr, String ... par1ArrayOfStr) + { + String var2 = par0ArrayOfStr[par0ArrayOfStr.length - 1]; + ArrayList var3 = new ArrayList(); + String[] var4 = par1ArrayOfStr; + int var5 = par1ArrayOfStr.length; + + for (int var6 = 0; var6 < var5; ++var6) + { + String var7 = var4[var6]; + + if (doesStringStartWith(var2, var7)) + { + var3.add(var7); + } + } + + return var3; + } + + /** + * Returns a List of strings (chosen from the given string iterable) which the last word in the given string array + * is a beginning-match for. (Tab completion). + */ + public static List getListOfStringsFromIterableMatchingLastWord(String[] par0ArrayOfStr, Iterable par1Iterable) + { + String var2 = par0ArrayOfStr[par0ArrayOfStr.length - 1]; + ArrayList var3 = new ArrayList(); + Iterator var4 = par1Iterable.iterator(); + + while (var4.hasNext()) + { + String var5 = (String)var4.next(); + + if (doesStringStartWith(var2, var5)) + { + var3.add(var5); + } + } + + return var3; + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] par1ArrayOfStr, int par2) + { + return false; + } + + public static void notifyAdmins(ICommandSender par0ICommandSender, String par1Str, Object ... par2ArrayOfObj) + { + notifyAdmins(par0ICommandSender, 0, par1Str, par2ArrayOfObj); + } + + public static void notifyAdmins(ICommandSender par0ICommandSender, int par1, String par2Str, Object ... par3ArrayOfObj) + { + if (theAdmin != null) + { + theAdmin.notifyAdmins(par0ICommandSender, par1, par2Str, par3ArrayOfObj); + } + } + + /** + * Sets the static IAdminCommander. + */ + public static void setAdminCommander(IAdminCommand par0IAdminCommand) + { + theAdmin = par0IAdminCommand; + } + + /** + * Compares the name of this command to the name of the given command. + */ + public int compareTo(ICommand par1ICommand) + { + return this.getCommandName().compareTo(par1ICommand.getCommandName()); + } + + public int compareTo(Object par1Obj) + { + return this.compareTo((ICommand)par1Obj); + } +} diff --git a/src/main/java/net/minecraft/src/CommandClearInventory.java b/src/main/java/net/minecraft/src/CommandClearInventory.java new file mode 100644 index 0000000..64f7efc --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandClearInventory.java @@ -0,0 +1,72 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandClearInventory extends CommandBase +{ + public String getCommandName() + { + return "clear"; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.clear.usage"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + EntityPlayerMP var3 = par2ArrayOfStr.length == 0 ? getCommandSenderAsPlayer(par1ICommandSender) : getPlayer(par1ICommandSender, par2ArrayOfStr[0]); + int var4 = par2ArrayOfStr.length >= 2 ? parseIntWithMin(par1ICommandSender, par2ArrayOfStr[1], 1) : -1; + int var5 = par2ArrayOfStr.length >= 3 ? parseIntWithMin(par1ICommandSender, par2ArrayOfStr[2], 0) : -1; + int var6 = var3.inventory.clearInventory(var4, var5); + var3.inventoryContainer.detectAndSendChanges(); + + if (!var3.capabilities.isCreativeMode) + { + var3.updateHeldItem(); + } + + if (var6 == 0) + { + throw new CommandException("commands.clear.failure", new Object[] {var3.getEntityName()}); + } + else + { + notifyAdmins(par1ICommandSender, "commands.clear.success", new Object[] {var3.getEntityName(), Integer.valueOf(var6)}); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, this.getAllOnlineUsernames()) : null; + } + + /** + * Return all usernames currently connected to the server. + */ + protected String[] getAllOnlineUsernames() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] par1ArrayOfStr, int par2) + { + return par2 == 0; + } +} diff --git a/src/main/java/net/minecraft/src/CommandDebug.java b/src/main/java/net/minecraft/src/CommandDebug.java new file mode 100644 index 0000000..261872c --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandDebug.java @@ -0,0 +1,165 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.FileWriter; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandDebug extends CommandBase +{ + /** Time the debugging started in milliseconds. */ + private long startTime; + + /** The number of ticks when debugging started. */ + private int startTicks; + + public String getCommandName() + { + return "debug"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.debug.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length == 1) + { + if (par2ArrayOfStr[0].equals("start")) + { + notifyAdmins(par1ICommandSender, "commands.debug.start", new Object[0]); + MinecraftServer.getServer().enableProfiling(); + this.startTime = MinecraftServer.getSystemTimeMillis(); + this.startTicks = MinecraftServer.getServer().getTickCounter(); + return; + } + + if (par2ArrayOfStr[0].equals("stop")) + { + if (!MinecraftServer.getServer().theProfiler.profilingEnabled) + { + throw new CommandException("commands.debug.notStarted", new Object[0]); + } + + long var3 = MinecraftServer.getSystemTimeMillis(); + int var5 = MinecraftServer.getServer().getTickCounter(); + long var6 = var3 - this.startTime; + int var8 = var5 - this.startTicks; + this.saveProfilerResults(var6, var8); + MinecraftServer.getServer().theProfiler.profilingEnabled = false; + notifyAdmins(par1ICommandSender, "commands.debug.stop", new Object[] {Float.valueOf((float)var6 / 1000.0F), Integer.valueOf(var8)}); + return; + } + } + + throw new WrongUsageException("commands.debug.usage", new Object[0]); + } + + private void saveProfilerResults(long par1, int par3) + { + File var4 = new File(MinecraftServer.getServer().getFile("debug"), "profile-results-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + ".txt"); + var4.getParentFile().mkdirs(); + + try + { + FileWriter var5 = new FileWriter(var4); + var5.write(this.getProfilerResults(par1, par3)); + var5.close(); + } + catch (Throwable var6) + { + MinecraftServer.getServer().getLogAgent().logSevereException("Could not save profiler results to " + var4, var6); + } + } + + private String getProfilerResults(long par1, int par3) + { + StringBuilder var4 = new StringBuilder(); + var4.append("---- Minecraft Profiler Results ----\n"); + var4.append("// "); + var4.append(getWittyComment()); + var4.append("\n\n"); + var4.append("Time span: ").append(par1).append(" ms\n"); + var4.append("Tick span: ").append(par3).append(" ticks\n"); + var4.append("// This is approximately ").append(String.format("%.2f", new Object[] {Float.valueOf((float)par3 / ((float)par1 / 1000.0F))})).append(" ticks per second. It should be ").append(20).append(" ticks per second\n\n"); + var4.append("--- BEGIN PROFILE DUMP ---\n\n"); + this.getProfileDump(0, "root", var4); + var4.append("--- END PROFILE DUMP ---\n\n"); + return var4.toString(); + } + + private void getProfileDump(int par1, String par2Str, StringBuilder par3StringBuilder) + { + List var4 = MinecraftServer.getServer().theProfiler.getProfilingData(par2Str); + + if (var4 != null && var4.size() >= 3) + { + for (int var5 = 1; var5 < var4.size(); ++var5) + { + ProfilerResult var6 = (ProfilerResult)var4.get(var5); + par3StringBuilder.append(String.format("[%02d] ", new Object[] {Integer.valueOf(par1)})); + + for (int var7 = 0; var7 < par1; ++var7) + { + par3StringBuilder.append(" "); + } + + par3StringBuilder.append(var6.field_76331_c); + par3StringBuilder.append(" - "); + par3StringBuilder.append(String.format("%.2f", new Object[] {Double.valueOf(var6.field_76332_a)})); + par3StringBuilder.append("%/"); + par3StringBuilder.append(String.format("%.2f", new Object[] {Double.valueOf(var6.field_76330_b)})); + par3StringBuilder.append("%\n"); + + if (!var6.field_76331_c.equals("unspecified")) + { + try + { + this.getProfileDump(par1 + 1, par2Str + "." + var6.field_76331_c, par3StringBuilder); + } + catch (Exception var8) + { + par3StringBuilder.append("[[ EXCEPTION " + var8 + " ]]"); + } + } + } + } + } + + /** + * Returns a random "witty" comment. + */ + private static String getWittyComment() + { + String[] var0 = new String[] {"Shiny numbers!", "Am I not running fast enough? :(", "I\'m working as hard as I can!", "Will I ever be good enough for you? :(", "Speedy. Zoooooom!", "Hello world", "40% better than a crash report.", "Now with extra numbers", "Now with less numbers", "Now with the same numbers", "You should add flames to things, it makes them go faster!", "Do you feel the need for... optimization?", "*cracks redstone whip*", "Maybe if you treated it better then it\'ll have more motivation to work faster! Poor server."}; + + try + { + return var0[(int)(System.nanoTime() % (long)var0.length)]; + } + catch (Throwable var2) + { + return "Witty comment unavailable :("; + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, new String[] {"start", "stop"}): null; + } +} diff --git a/src/main/java/net/minecraft/src/CommandDefaultGameMode.java b/src/main/java/net/minecraft/src/CommandDefaultGameMode.java new file mode 100644 index 0000000..dde10b2 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandDefaultGameMode.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +import java.util.Iterator; +import net.minecraft.server.MinecraftServer; + +public class CommandDefaultGameMode extends CommandGameMode +{ + public String getCommandName() + { + return "defaultgamemode"; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.defaultgamemode.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length > 0) + { + EnumGameType var3 = this.getGameModeFromCommand(par1ICommandSender, par2ArrayOfStr[0]); + this.setGameType(var3); + notifyAdmins(par1ICommandSender, "commands.defaultgamemode.success", new Object[] {ChatMessageComponent.createFromTranslationKey("gameMode." + var3.getName())}); + } + else + { + throw new WrongUsageException("commands.defaultgamemode.usage", new Object[0]); + } + } + + protected void setGameType(EnumGameType par1EnumGameType) + { + MinecraftServer var2 = MinecraftServer.getServer(); + var2.setGameType(par1EnumGameType); + EntityPlayerMP var4; + + if (var2.getForceGamemode()) + { + for (Iterator var3 = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator(); var3.hasNext(); var4.fallDistance = 0.0F) + { + var4 = (EntityPlayerMP)var3.next(); + var4.setGameType(par1EnumGameType); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/CommandDifficulty.java b/src/main/java/net/minecraft/src/CommandDifficulty.java new file mode 100644 index 0000000..6bb92fb --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandDifficulty.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandDifficulty extends CommandBase +{ + private static final String[] difficulties = new String[] {"options.difficulty.peaceful", "options.difficulty.easy", "options.difficulty.normal", "options.difficulty.hard"}; + + public String getCommandName() + { + return "difficulty"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.difficulty.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length > 0) + { + int var3 = this.getDifficultyForName(par1ICommandSender, par2ArrayOfStr[0]); + MinecraftServer.getServer().setDifficultyForAllWorlds(var3); + notifyAdmins(par1ICommandSender, "commands.difficulty.success", new Object[] {ChatMessageComponent.createFromTranslationKey(difficulties[var3])}); + } + else + { + throw new WrongUsageException("commands.difficulty.usage", new Object[0]); + } + } + + /** + * Return the difficulty value for the specified string. + */ + protected int getDifficultyForName(ICommandSender par1ICommandSender, String par2Str) + { + return !par2Str.equalsIgnoreCase("peaceful") && !par2Str.equalsIgnoreCase("p") ? (!par2Str.equalsIgnoreCase("easy") && !par2Str.equalsIgnoreCase("e") ? (!par2Str.equalsIgnoreCase("normal") && !par2Str.equalsIgnoreCase("n") ? (!par2Str.equalsIgnoreCase("hard") && !par2Str.equalsIgnoreCase("h") ? parseIntBounded(par1ICommandSender, par2Str, 0, 3) : 3) : 2) : 1) : 0; + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, new String[] {"peaceful", "easy", "normal", "hard"}): null; + } +} diff --git a/src/main/java/net/minecraft/src/CommandEffect.java b/src/main/java/net/minecraft/src/CommandEffect.java new file mode 100644 index 0000000..d41167d --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandEffect.java @@ -0,0 +1,121 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandEffect extends CommandBase +{ + public String getCommandName() + { + return "effect"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.effect.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length < 2) + { + throw new WrongUsageException("commands.effect.usage", new Object[0]); + } + else + { + EntityPlayerMP var3 = getPlayer(par1ICommandSender, par2ArrayOfStr[0]); + + if (par2ArrayOfStr[1].equals("clear")) + { + if (var3.getActivePotionEffects().isEmpty()) + { + throw new CommandException("commands.effect.failure.notActive.all", new Object[] {var3.getEntityName()}); + } + + var3.clearActivePotions(); + notifyAdmins(par1ICommandSender, "commands.effect.success.removed.all", new Object[] {var3.getEntityName()}); + } + else + { + int var4 = parseIntWithMin(par1ICommandSender, par2ArrayOfStr[1], 1); + int var5 = 600; + int var6 = 30; + int var7 = 0; + + if (var4 < 0 || var4 >= Potion.potionTypes.length || Potion.potionTypes[var4] == null) + { + throw new NumberInvalidException("commands.effect.notFound", new Object[] {Integer.valueOf(var4)}); + } + + if (par2ArrayOfStr.length >= 3) + { + var6 = parseIntBounded(par1ICommandSender, par2ArrayOfStr[2], 0, 1000000); + + if (Potion.potionTypes[var4].isInstant()) + { + var5 = var6; + } + else + { + var5 = var6 * 20; + } + } + else if (Potion.potionTypes[var4].isInstant()) + { + var5 = 1; + } + + if (par2ArrayOfStr.length >= 4) + { + var7 = parseIntBounded(par1ICommandSender, par2ArrayOfStr[3], 0, 255); + } + + if (var6 == 0) + { + if (!var3.isPotionActive(var4)) + { + throw new CommandException("commands.effect.failure.notActive", new Object[] {ChatMessageComponent.createFromTranslationKey(Potion.potionTypes[var4].getName()), var3.getEntityName()}); + } + + var3.removePotionEffect(var4); + notifyAdmins(par1ICommandSender, "commands.effect.success.removed", new Object[] {ChatMessageComponent.createFromTranslationKey(Potion.potionTypes[var4].getName()), var3.getEntityName()}); + } + else + { + PotionEffect var8 = new PotionEffect(var4, var5, var7); + var3.addPotionEffect(var8); + notifyAdmins(par1ICommandSender, "commands.effect.success", new Object[] {ChatMessageComponent.createFromTranslationKey(var8.getEffectName()), Integer.valueOf(var4), Integer.valueOf(var7), var3.getEntityName(), Integer.valueOf(var6)}); + } + } + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, this.getAllUsernames()) : null; + } + + protected String[] getAllUsernames() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] par1ArrayOfStr, int par2) + { + return par2 == 0; + } +} diff --git a/src/main/java/net/minecraft/src/CommandEnchant.java b/src/main/java/net/minecraft/src/CommandEnchant.java new file mode 100644 index 0000000..35b2b45 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandEnchant.java @@ -0,0 +1,112 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandEnchant extends CommandBase +{ + public String getCommandName() + { + return "enchant"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.enchant.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length < 2) + { + throw new WrongUsageException("commands.enchant.usage", new Object[0]); + } + else + { + EntityPlayerMP var3 = getPlayer(par1ICommandSender, par2ArrayOfStr[0]); + int var4 = parseIntBounded(par1ICommandSender, par2ArrayOfStr[1], 0, Enchantment.enchantmentsList.length - 1); + int var5 = 1; + ItemStack var6 = var3.getCurrentEquippedItem(); + + if (var6 == null) + { + throw new CommandException("commands.enchant.noItem", new Object[0]); + } + else + { + Enchantment var7 = Enchantment.enchantmentsList[var4]; + + if (var7 == null) + { + throw new NumberInvalidException("commands.enchant.notFound", new Object[] {Integer.valueOf(var4)}); + } + else if (!var7.canApply(var6)) + { + throw new CommandException("commands.enchant.cantEnchant", new Object[0]); + } + else + { + if (par2ArrayOfStr.length >= 3) + { + var5 = parseIntBounded(par1ICommandSender, par2ArrayOfStr[2], var7.getMinLevel(), var7.getMaxLevel()); + } + + if (var6.hasTagCompound()) + { + NBTTagList var8 = var6.getEnchantmentTagList(); + + if (var8 != null) + { + for (int var9 = 0; var9 < var8.tagCount(); ++var9) + { + short var10 = ((NBTTagCompound)var8.tagAt(var9)).getShort("id"); + + if (Enchantment.enchantmentsList[var10] != null) + { + Enchantment var11 = Enchantment.enchantmentsList[var10]; + + if (!var11.canApplyTogether(var7)) + { + throw new CommandException("commands.enchant.cantCombine", new Object[] {var7.getTranslatedName(var5), var11.getTranslatedName(((NBTTagCompound)var8.tagAt(var9)).getShort("lvl"))}); + } + } + } + } + } + + var6.addEnchantment(var7, var5); + notifyAdmins(par1ICommandSender, "commands.enchant.success", new Object[0]); + } + } + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, this.getListOfPlayers()) : null; + } + + protected String[] getListOfPlayers() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] par1ArrayOfStr, int par2) + { + return par2 == 0; + } +} diff --git a/src/main/java/net/minecraft/src/CommandException.java b/src/main/java/net/minecraft/src/CommandException.java new file mode 100644 index 0000000..84a4786 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandException.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class CommandException extends RuntimeException +{ + private Object[] errorObjects; + + public CommandException(String par1Str, Object ... par2ArrayOfObj) + { + super(par1Str); + this.errorObjects = par2ArrayOfObj; + } + + public Object[] getErrorOjbects() + { + return this.errorObjects; + } +} diff --git a/src/main/java/net/minecraft/src/CommandGameMode.java b/src/main/java/net/minecraft/src/CommandGameMode.java new file mode 100644 index 0000000..fe28a24 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandGameMode.java @@ -0,0 +1,82 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandGameMode extends CommandBase +{ + public String getCommandName() + { + return "gamemode"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.gamemode.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length > 0) + { + EnumGameType var3 = this.getGameModeFromCommand(par1ICommandSender, par2ArrayOfStr[0]); + EntityPlayerMP var4 = par2ArrayOfStr.length >= 2 ? getPlayer(par1ICommandSender, par2ArrayOfStr[1]) : getCommandSenderAsPlayer(par1ICommandSender); + var4.setGameType(var3); + var4.fallDistance = 0.0F; + ChatMessageComponent var5 = ChatMessageComponent.createFromTranslationKey("gameMode." + var3.getName()); + + if (var4 != par1ICommandSender) + { + notifyAdmins(par1ICommandSender, 1, "commands.gamemode.success.other", new Object[] {var4.getEntityName(), var5}); + } + else + { + notifyAdmins(par1ICommandSender, 1, "commands.gamemode.success.self", new Object[] {var5}); + } + } + else + { + throw new WrongUsageException("commands.gamemode.usage", new Object[0]); + } + } + + /** + * Gets the Game Mode specified in the command. + */ + protected EnumGameType getGameModeFromCommand(ICommandSender par1ICommandSender, String par2Str) + { + return !par2Str.equalsIgnoreCase(EnumGameType.SURVIVAL.getName()) && !par2Str.equalsIgnoreCase("s") ? (!par2Str.equalsIgnoreCase(EnumGameType.CREATIVE.getName()) && !par2Str.equalsIgnoreCase("c") ? (!par2Str.equalsIgnoreCase(EnumGameType.ADVENTURE.getName()) && !par2Str.equalsIgnoreCase("a") ? WorldSettings.getGameTypeById(parseIntBounded(par1ICommandSender, par2Str, 0, EnumGameType.values().length - 2)) : EnumGameType.ADVENTURE) : EnumGameType.CREATIVE) : EnumGameType.SURVIVAL; + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, new String[] {"survival", "creative", "adventure"}): (par2ArrayOfStr.length == 2 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, this.getListOfPlayerUsernames()) : null); + } + + /** + * Returns String array containing all player usernames in the server. + */ + protected String[] getListOfPlayerUsernames() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] par1ArrayOfStr, int par2) + { + return par2 == 1; + } +} diff --git a/src/main/java/net/minecraft/src/CommandGameRule.java b/src/main/java/net/minecraft/src/CommandGameRule.java new file mode 100644 index 0000000..21c6a08 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandGameRule.java @@ -0,0 +1,87 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandGameRule extends CommandBase +{ + public String getCommandName() + { + return "gamerule"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.gamerule.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + String var6; + + if (par2ArrayOfStr.length == 2) + { + var6 = par2ArrayOfStr[0]; + String var7 = par2ArrayOfStr[1]; + GameRules var8 = this.getGameRules(); + + if (var8.hasRule(var6)) + { + var8.setOrCreateGameRule(var6, var7); + notifyAdmins(par1ICommandSender, "commands.gamerule.success", new Object[0]); + } + else + { + notifyAdmins(par1ICommandSender, "commands.gamerule.norule", new Object[] {var6}); + } + } + else if (par2ArrayOfStr.length == 1) + { + var6 = par2ArrayOfStr[0]; + GameRules var4 = this.getGameRules(); + + if (var4.hasRule(var6)) + { + String var5 = var4.getGameRuleStringValue(var6); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromText(var6).addText(" = ").addText(var5)); + } + else + { + notifyAdmins(par1ICommandSender, "commands.gamerule.norule", new Object[] {var6}); + } + } + else if (par2ArrayOfStr.length == 0) + { + GameRules var3 = this.getGameRules(); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromText(joinNiceString(var3.getRules()))); + } + else + { + throw new WrongUsageException("commands.gamerule.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, this.getGameRules().getRules()) : (par2ArrayOfStr.length == 2 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, new String[] {"true", "false"}): null); + } + + /** + * Return the game rule set this command should be able to manipulate. + */ + private GameRules getGameRules() + { + return MinecraftServer.getServer().worldServerForDimension(0).getGameRules(); + } +} diff --git a/src/main/java/net/minecraft/src/CommandGive.java b/src/main/java/net/minecraft/src/CommandGive.java new file mode 100644 index 0000000..09cc09d --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandGive.java @@ -0,0 +1,83 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandGive extends CommandBase +{ + public String getCommandName() + { + return "give"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.give.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length >= 2) + { + EntityPlayerMP var3 = getPlayer(par1ICommandSender, par2ArrayOfStr[0]); + int var4 = parseIntWithMin(par1ICommandSender, par2ArrayOfStr[1], 1); + int var5 = 1; + int var6 = 0; + + if (Item.itemsList[var4] == null) + { + throw new NumberInvalidException("commands.give.notFound", new Object[] {Integer.valueOf(var4)}); + } + else + { + if (par2ArrayOfStr.length >= 3) + { + var5 = parseIntBounded(par1ICommandSender, par2ArrayOfStr[2], 1, 64); + } + + if (par2ArrayOfStr.length >= 4) + { + var6 = parseInt(par1ICommandSender, par2ArrayOfStr[3]); + } + + ItemStack var7 = new ItemStack(var4, var5, var6); + EntityItem var8 = var3.dropPlayerItem(var7); + var8.delayBeforeCanPickup = 0; + notifyAdmins(par1ICommandSender, "commands.give.success", new Object[] {Item.itemsList[var4].getItemStackDisplayName(var7), Integer.valueOf(var4), Integer.valueOf(var5), var3.getEntityName()}); + } + } + else + { + throw new WrongUsageException("commands.give.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, this.getPlayers()) : null; + } + + protected String[] getPlayers() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] par1ArrayOfStr, int par2) + { + return par2 == 0; + } +} diff --git a/src/main/java/net/minecraft/src/CommandHandler.java b/src/main/java/net/minecraft/src/CommandHandler.java new file mode 100644 index 0000000..504be13 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandHandler.java @@ -0,0 +1,233 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; + +public class CommandHandler implements ICommandManager +{ + /** Map of Strings to the ICommand objects they represent */ + private final Map commandMap = new HashMap(); + + /** The set of ICommand objects currently loaded. */ + private final Set commandSet = new HashSet(); + + public int executeCommand(ICommandSender par1ICommandSender, String par2Str) + { + par2Str = par2Str.trim(); + + if (par2Str.startsWith("/")) + { + par2Str = par2Str.substring(1); + } + + String[] var3 = par2Str.split(" "); + String var4 = var3[0]; + var3 = dropFirstString(var3); + ICommand var5 = (ICommand)this.commandMap.get(var4); + int var6 = this.getUsernameIndex(var5, var3); + int var7 = 0; + + try + { + if (var5 == null) + { + throw new CommandNotFoundException(); + } + + if (var5.canCommandSenderUseCommand(par1ICommandSender)) + { + if (var6 > -1) + { + EntityPlayerMP[] var8 = PlayerSelector.matchPlayers(par1ICommandSender, var3[var6]); + String var9 = var3[var6]; + EntityPlayerMP[] var10 = var8; + int var11 = var8.length; + + for (int var12 = 0; var12 < var11; ++var12) + { + EntityPlayerMP var13 = var10[var12]; + var3[var6] = var13.getEntityName(); + + try + { + var5.processCommand(par1ICommandSender, var3); + ++var7; + } + catch (CommandException var15) + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions(var15.getMessage(), var15.getErrorOjbects()).setColor(EnumChatFormatting.RED)); + } + } + + var3[var6] = var9; + } + else + { + var5.processCommand(par1ICommandSender, var3); + ++var7; + } + } + else + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("commands.generic.permission").setColor(EnumChatFormatting.RED)); + } + } + catch (WrongUsageException var16) + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.generic.usage", new Object[] {ChatMessageComponent.createFromTranslationWithSubstitutions(var16.getMessage(), var16.getErrorOjbects())}).setColor(EnumChatFormatting.RED)); + } + catch (CommandException var17) + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions(var17.getMessage(), var17.getErrorOjbects()).setColor(EnumChatFormatting.RED)); + } + catch (Throwable var18) + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("commands.generic.exception").setColor(EnumChatFormatting.RED)); + var18.printStackTrace(); + } + + return var7; + } + + /** + * adds the command and any aliases it has to the internal map of available commands + */ + public ICommand registerCommand(ICommand par1ICommand) + { + List var2 = par1ICommand.getCommandAliases(); + this.commandMap.put(par1ICommand.getCommandName(), par1ICommand); + this.commandSet.add(par1ICommand); + + if (var2 != null) + { + Iterator var3 = var2.iterator(); + + while (var3.hasNext()) + { + String var4 = (String)var3.next(); + ICommand var5 = (ICommand)this.commandMap.get(var4); + + if (var5 == null || !var5.getCommandName().equals(var4)) + { + this.commandMap.put(var4, par1ICommand); + } + } + } + + return par1ICommand; + } + + /** + * creates a new array and sets elements 0..n-2 to be 0..n-1 of the input (n elements) + */ + private static String[] dropFirstString(String[] par0ArrayOfStr) + { + String[] var1 = new String[par0ArrayOfStr.length - 1]; + + for (int var2 = 1; var2 < par0ArrayOfStr.length; ++var2) + { + var1[var2 - 1] = par0ArrayOfStr[var2]; + } + + return var1; + } + + /** + * Performs a "begins with" string match on each token in par2. Only returns commands that par1 can use. + */ + public List getPossibleCommands(ICommandSender par1ICommandSender, String par2Str) + { + String[] var3 = par2Str.split(" ", -1); + String var4 = var3[0]; + + if (var3.length == 1) + { + ArrayList var8 = new ArrayList(); + Iterator var6 = this.commandMap.entrySet().iterator(); + + while (var6.hasNext()) + { + Entry var7 = (Entry)var6.next(); + + if (CommandBase.doesStringStartWith(var4, (String)var7.getKey()) && ((ICommand)var7.getValue()).canCommandSenderUseCommand(par1ICommandSender)) + { + var8.add(var7.getKey()); + } + } + + return var8; + } + else + { + if (var3.length > 1) + { + ICommand var5 = (ICommand)this.commandMap.get(var4); + + if (var5 != null) + { + return var5.addTabCompletionOptions(par1ICommandSender, dropFirstString(var3)); + } + } + + return null; + } + } + + /** + * returns all commands that the commandSender can use + */ + public List getPossibleCommands(ICommandSender par1ICommandSender) + { + ArrayList var2 = new ArrayList(); + Iterator var3 = this.commandSet.iterator(); + + while (var3.hasNext()) + { + ICommand var4 = (ICommand)var3.next(); + + if (var4.canCommandSenderUseCommand(par1ICommandSender)) + { + var2.add(var4); + } + } + + return var2; + } + + /** + * returns a map of string to commads. All commands are returned, not just ones which someone has permission to use. + */ + public Map getCommands() + { + return this.commandMap; + } + + /** + * Return a command's first parameter index containing a valid username. + */ + private int getUsernameIndex(ICommand par1ICommand, String[] par2ArrayOfStr) + { + if (par1ICommand == null) + { + return -1; + } + else + { + for (int var3 = 0; var3 < par2ArrayOfStr.length; ++var3) + { + if (par1ICommand.isUsernameIndex(par2ArrayOfStr, var3) && PlayerSelector.matchesMultiplePlayers(par2ArrayOfStr[var3])) + { + return var3; + } + } + + return -1; + } + } +} diff --git a/src/main/java/net/minecraft/src/CommandHelp.java b/src/main/java/net/minecraft/src/CommandHelp.java new file mode 100644 index 0000000..c752697 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandHelp.java @@ -0,0 +1,89 @@ +package net.minecraft.src; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import net.minecraft.server.MinecraftServer; + +public class CommandHelp extends CommandBase +{ + public String getCommandName() + { + return "help"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 0; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.help.usage"; + } + + public List getCommandAliases() + { + return Arrays.asList(new String[] {"?"}); + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + List var3 = this.getSortedPossibleCommands(par1ICommandSender); + byte var4 = 7; + int var5 = (var3.size() - 1) / var4; + boolean var6 = false; + ICommand var9; + int var11; + + try + { + var11 = par2ArrayOfStr.length == 0 ? 0 : parseIntBounded(par1ICommandSender, par2ArrayOfStr[0], 1, var5 + 1) - 1; + } + catch (NumberInvalidException var10) + { + Map var8 = this.getCommands(); + var9 = (ICommand)var8.get(par2ArrayOfStr[0]); + + if (var9 != null) + { + throw new WrongUsageException(var9.getCommandUsage(par1ICommandSender), new Object[0]); + } + + throw new CommandNotFoundException(); + } + + int var7 = Math.min((var11 + 1) * var4, var3.size()); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.help.header", new Object[] {Integer.valueOf(var11 + 1), Integer.valueOf(var5 + 1)}).setColor(EnumChatFormatting.DARK_GREEN)); + + for (int var12 = var11 * var4; var12 < var7; ++var12) + { + var9 = (ICommand)var3.get(var12); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(var9.getCommandUsage(par1ICommandSender))); + } + + if (var11 == 0 && par1ICommandSender instanceof EntityPlayer) + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("commands.help.footer").setColor(EnumChatFormatting.GREEN)); + } + } + + /** + * Returns a sorted list of all possible commands for the given ICommandSender. + */ + protected List getSortedPossibleCommands(ICommandSender par1ICommandSender) + { + List var2 = MinecraftServer.getServer().getCommandManager().getPossibleCommands(par1ICommandSender); + Collections.sort(var2); + return var2; + } + + protected Map getCommands() + { + return MinecraftServer.getServer().getCommandManager().getCommands(); + } +} diff --git a/src/main/java/net/minecraft/src/CommandKill.java b/src/main/java/net/minecraft/src/CommandKill.java new file mode 100644 index 0000000..31cdae6 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandKill.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +public class CommandKill extends CommandBase +{ + public String getCommandName() + { + return "kill"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 0; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.kill.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + EntityPlayerMP var3 = getCommandSenderAsPlayer(par1ICommandSender); + var3.attackEntityFrom(DamageSource.outOfWorld, Float.MAX_VALUE); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("commands.kill.success")); + } +} diff --git a/src/main/java/net/minecraft/src/CommandNotFoundException.java b/src/main/java/net/minecraft/src/CommandNotFoundException.java new file mode 100644 index 0000000..5dc285c --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandNotFoundException.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +public class CommandNotFoundException extends CommandException +{ + public CommandNotFoundException() + { + this("commands.generic.notFound", new Object[0]); + } + + public CommandNotFoundException(String par1Str, Object ... par2ArrayOfObj) + { + super(par1Str, par2ArrayOfObj); + } +} diff --git a/src/main/java/net/minecraft/src/CommandPlaySound.java b/src/main/java/net/minecraft/src/CommandPlaySound.java new file mode 100644 index 0000000..5add1ec --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandPlaySound.java @@ -0,0 +1,115 @@ +package net.minecraft.src; + +public class CommandPlaySound extends CommandBase +{ + public String getCommandName() + { + return "playsound"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.playsound.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length < 2) + { + throw new WrongUsageException(this.getCommandUsage(par1ICommandSender), new Object[0]); + } + else + { + byte var3 = 0; + int var36 = var3 + 1; + String var4 = par2ArrayOfStr[var3]; + EntityPlayerMP var5 = getPlayer(par1ICommandSender, par2ArrayOfStr[var36++]); + double var6 = (double)var5.getPlayerCoordinates().posX; + double var8 = (double)var5.getPlayerCoordinates().posY; + double var10 = (double)var5.getPlayerCoordinates().posZ; + double var12 = 1.0D; + double var14 = 1.0D; + double var16 = 0.0D; + + if (par2ArrayOfStr.length > var36) + { + var6 = func_110666_a(par1ICommandSender, var6, par2ArrayOfStr[var36++]); + } + + if (par2ArrayOfStr.length > var36) + { + var8 = func_110665_a(par1ICommandSender, var8, par2ArrayOfStr[var36++], 0, 0); + } + + if (par2ArrayOfStr.length > var36) + { + var10 = func_110666_a(par1ICommandSender, var10, par2ArrayOfStr[var36++]); + } + + if (par2ArrayOfStr.length > var36) + { + var12 = func_110661_a(par1ICommandSender, par2ArrayOfStr[var36++], 0.0D, 3.4028234663852886E38D); + } + + if (par2ArrayOfStr.length > var36) + { + var14 = func_110661_a(par1ICommandSender, par2ArrayOfStr[var36++], 0.0D, 2.0D); + } + + if (par2ArrayOfStr.length > var36) + { + var16 = func_110661_a(par1ICommandSender, par2ArrayOfStr[var36++], 0.0D, 1.0D); + } + + double var18 = var12 > 1.0D ? var12 * 16.0D : 16.0D; + double var20 = var5.getDistance(var6, var8, var10); + + if (var20 > var18) + { + if (var16 <= 0.0D) + { + throw new CommandException("commands.playsound.playerTooFar", new Object[] {var5.getEntityName()}); + } + + double var22 = var6 - var5.posX; + double var24 = var8 - var5.posY; + double var26 = var10 - var5.posZ; + double var28 = Math.sqrt(var22 * var22 + var24 * var24 + var26 * var26); + double var30 = var5.posX; + double var32 = var5.posY; + double var34 = var5.posZ; + + if (var28 > 0.0D) + { + var30 += var22 / var28 * 2.0D; + var32 += var24 / var28 * 2.0D; + var34 += var26 / var28 * 2.0D; + } + + var5.playerNetServerHandler.sendPacketToPlayer(new Packet62LevelSound(var4, var30, var32, var34, (float)var16, (float)var14)); + } + else + { + var5.playerNetServerHandler.sendPacketToPlayer(new Packet62LevelSound(var4, var6, var8, var10, (float)var12, (float)var14)); + } + + notifyAdmins(par1ICommandSender, "commands.playsound.success", new Object[] {var4, var5.getEntityName()}); + } + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] par1ArrayOfStr, int par2) + { + return par2 == 1; + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerBan.java b/src/main/java/net/minecraft/src/CommandServerBan.java new file mode 100644 index 0000000..ea9a764 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerBan.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandServerBan extends CommandBase +{ + public String getCommandName() + { + return "ban"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.ban.usage"; + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) + { + return MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().isListActive() && super.canCommandSenderUseCommand(par1ICommandSender); + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr[0].length() > 0) + { + EntityPlayerMP var3 = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(par2ArrayOfStr[0]); + BanEntry var4 = new BanEntry(par2ArrayOfStr[0]); + var4.setBannedBy(par1ICommandSender.getCommandSenderName()); + + if (par2ArrayOfStr.length >= 2) + { + var4.setBanReason(func_82360_a(par1ICommandSender, par2ArrayOfStr, 1)); + } + + MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().put(var4); + + if (var3 != null) + { + var3.playerNetServerHandler.kickPlayerFromServer("You are banned from this server."); + } + + notifyAdmins(par1ICommandSender, "commands.ban.success", new Object[] {par2ArrayOfStr[0]}); + } + else + { + throw new WrongUsageException("commands.ban.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length >= 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames()) : null; + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerBanIp.java b/src/main/java/net/minecraft/src/CommandServerBanIp.java new file mode 100644 index 0000000..c64940f --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerBanIp.java @@ -0,0 +1,115 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import net.minecraft.server.MinecraftServer; + +public class CommandServerBanIp extends CommandBase +{ + public static final Pattern IPv4Pattern = Pattern.compile("^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"); + + public String getCommandName() + { + return "ban-ip"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) + { + return MinecraftServer.getServer().getConfigurationManager().getBannedIPs().isListActive() && super.canCommandSenderUseCommand(par1ICommandSender); + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.banip.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr[0].length() > 1) + { + Matcher var3 = IPv4Pattern.matcher(par2ArrayOfStr[0]); + String var4 = null; + + if (par2ArrayOfStr.length >= 2) + { + var4 = func_82360_a(par1ICommandSender, par2ArrayOfStr, 1); + } + + if (var3.matches()) + { + this.banIP(par1ICommandSender, par2ArrayOfStr[0], var4); + } + else + { + EntityPlayerMP var5 = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(par2ArrayOfStr[0]); + + if (var5 == null) + { + throw new PlayerNotFoundException("commands.banip.invalid", new Object[0]); + } + + this.banIP(par1ICommandSender, var5.getPlayerIP(), var4); + } + } + else + { + throw new WrongUsageException("commands.banip.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames()) : null; + } + + /** + * Actually does the banning work. + */ + protected void banIP(ICommandSender par1ICommandSender, String par2Str, String par3Str) + { + BanEntry var4 = new BanEntry(par2Str); + var4.setBannedBy(par1ICommandSender.getCommandSenderName()); + + if (par3Str != null) + { + var4.setBanReason(par3Str); + } + + MinecraftServer.getServer().getConfigurationManager().getBannedIPs().put(var4); + List var5 = MinecraftServer.getServer().getConfigurationManager().getPlayerList(par2Str); + String[] var6 = new String[var5.size()]; + int var7 = 0; + EntityPlayerMP var9; + + for (Iterator var8 = var5.iterator(); var8.hasNext(); var6[var7++] = var9.getEntityName()) + { + var9 = (EntityPlayerMP)var8.next(); + var9.playerNetServerHandler.kickPlayerFromServer("You have been IP banned."); + } + + if (var5.isEmpty()) + { + notifyAdmins(par1ICommandSender, "commands.banip.success", new Object[] {par2Str}); + } + else + { + notifyAdmins(par1ICommandSender, "commands.banip.success.players", new Object[] {par2Str, joinNiceString(var6)}); + } + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerBanlist.java b/src/main/java/net/minecraft/src/CommandServerBanlist.java new file mode 100644 index 0000000..c868ba6 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerBanlist.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandServerBanlist extends CommandBase +{ + public String getCommandName() + { + return "banlist"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) + { + return (MinecraftServer.getServer().getConfigurationManager().getBannedIPs().isListActive() || MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().isListActive()) && super.canCommandSenderUseCommand(par1ICommandSender); + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.banlist.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr[0].equalsIgnoreCase("ips")) + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.banlist.ips", new Object[] {Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getBannedList().size())})); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromText(joinNiceString(MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getBannedList().keySet().toArray()))); + } + else + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.banlist.players", new Object[] {Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getBannedList().size())})); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromText(joinNiceString(MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getBannedList().keySet().toArray()))); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, new String[] {"players", "ips"}): null; + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerDeop.java b/src/main/java/net/minecraft/src/CommandServerDeop.java new file mode 100644 index 0000000..537b694 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerDeop.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandServerDeop extends CommandBase +{ + public String getCommandName() + { + return "deop"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.deop.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length == 1 && par2ArrayOfStr[0].length() > 0) + { + MinecraftServer.getServer().getConfigurationManager().removeOp(par2ArrayOfStr[0]); + notifyAdmins(par1ICommandSender, "commands.deop.success", new Object[] {par2ArrayOfStr[0]}); + } + else + { + throw new WrongUsageException("commands.deop.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsFromIterableMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getConfigurationManager().getOps()) : null; + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerEmote.java b/src/main/java/net/minecraft/src/CommandServerEmote.java new file mode 100644 index 0000000..e35a60c --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerEmote.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandServerEmote extends CommandBase +{ + public String getCommandName() + { + return "me"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 0; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.me.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length > 0) + { + String var3 = func_82361_a(par1ICommandSender, par2ArrayOfStr, 0, par1ICommandSender.canCommandSenderUseCommand(1, "me")); + MinecraftServer.getServer().getConfigurationManager().sendChatMsg(ChatMessageComponent.createFromTranslationWithSubstitutions("chat.type.emote", new Object[] {par1ICommandSender.getCommandSenderName(), var3})); + } + else + { + throw new WrongUsageException("commands.me.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return getListOfStringsMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames()); + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerKick.java b/src/main/java/net/minecraft/src/CommandServerKick.java new file mode 100644 index 0000000..bdd4fc2 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerKick.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandServerKick extends CommandBase +{ + public String getCommandName() + { + return "kick"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.kick.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length > 0 && par2ArrayOfStr[0].length() > 1) + { + EntityPlayerMP var3 = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(par2ArrayOfStr[0]); + String var4 = "Kicked by an operator."; + boolean var5 = false; + + if (var3 == null) + { + throw new PlayerNotFoundException(); + } + else + { + if (par2ArrayOfStr.length >= 2) + { + var4 = func_82360_a(par1ICommandSender, par2ArrayOfStr, 1); + var5 = true; + } + + var3.playerNetServerHandler.kickPlayerFromServer(var4); + + if (var5) + { + notifyAdmins(par1ICommandSender, "commands.kick.success.reason", new Object[] {var3.getEntityName(), var4}); + } + else + { + notifyAdmins(par1ICommandSender, "commands.kick.success", new Object[] {var3.getEntityName()}); + } + } + } + else + { + throw new WrongUsageException("commands.kick.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length >= 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames()) : null; + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerList.java b/src/main/java/net/minecraft/src/CommandServerList.java new file mode 100644 index 0000000..4a34787 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerList.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class CommandServerList extends CommandBase +{ + public String getCommandName() + { + return "list"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 0; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.players.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.players.list", new Object[] {Integer.valueOf(MinecraftServer.getServer().getCurrentPlayerCount()), Integer.valueOf(MinecraftServer.getServer().getMaxPlayers())})); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromText(MinecraftServer.getServer().getConfigurationManager().getPlayerListAsString())); + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerMessage.java b/src/main/java/net/minecraft/src/CommandServerMessage.java new file mode 100644 index 0000000..5527954 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerMessage.java @@ -0,0 +1,74 @@ +package net.minecraft.src; + +import java.util.Arrays; +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandServerMessage extends CommandBase +{ + public List getCommandAliases() + { + return Arrays.asList(new String[] {"w", "msg"}); + } + + public String getCommandName() + { + return "tell"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 0; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.message.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length < 2) + { + throw new WrongUsageException("commands.message.usage", new Object[0]); + } + else + { + EntityPlayerMP var3 = getPlayer(par1ICommandSender, par2ArrayOfStr[0]); + + if (var3 == null) + { + throw new PlayerNotFoundException(); + } + else if (var3 == par1ICommandSender) + { + throw new PlayerNotFoundException("commands.message.sameTarget", new Object[0]); + } + else + { + String var4 = func_82361_a(par1ICommandSender, par2ArrayOfStr, 1, !(par1ICommandSender instanceof EntityPlayer)); + var3.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.message.display.incoming", new Object[] {par1ICommandSender.getCommandSenderName(), var4}).setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true))); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.message.display.outgoing", new Object[] {var3.getCommandSenderName(), var4}).setColor(EnumChatFormatting.GRAY).setItalic(Boolean.valueOf(true))); + } + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return getListOfStringsMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames()); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] par1ArrayOfStr, int par2) + { + return par2 == 0; + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerOp.java b/src/main/java/net/minecraft/src/CommandServerOp.java new file mode 100644 index 0000000..46ed839 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerOp.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandServerOp extends CommandBase +{ + public String getCommandName() + { + return "op"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.op.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length == 1 && par2ArrayOfStr[0].length() > 0) + { + MinecraftServer.getServer().getConfigurationManager().addOp(par2ArrayOfStr[0]); + notifyAdmins(par1ICommandSender, "commands.op.success", new Object[] {par2ArrayOfStr[0]}); + } + else + { + throw new WrongUsageException("commands.op.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length == 1) + { + String var3 = par2ArrayOfStr[par2ArrayOfStr.length - 1]; + ArrayList var4 = new ArrayList(); + String[] var5 = MinecraftServer.getServer().getAllUsernames(); + int var6 = var5.length; + + for (int var7 = 0; var7 < var6; ++var7) + { + String var8 = var5[var7]; + + if (!MinecraftServer.getServer().getConfigurationManager().isPlayerOpped(var8) && doesStringStartWith(var3, var8)) + { + var4.add(var8); + } + } + + return var4; + } + else + { + return null; + } + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerPardon.java b/src/main/java/net/minecraft/src/CommandServerPardon.java new file mode 100644 index 0000000..76a64d2 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerPardon.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandServerPardon extends CommandBase +{ + public String getCommandName() + { + return "pardon"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.unban.usage"; + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) + { + return MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().isListActive() && super.canCommandSenderUseCommand(par1ICommandSender); + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length == 1 && par2ArrayOfStr[0].length() > 0) + { + MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().remove(par2ArrayOfStr[0]); + notifyAdmins(par1ICommandSender, "commands.unban.success", new Object[] {par2ArrayOfStr[0]}); + } + else + { + throw new WrongUsageException("commands.unban.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsFromIterableMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getConfigurationManager().getBannedPlayers().getBannedList().keySet()) : null; + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerPardonIp.java b/src/main/java/net/minecraft/src/CommandServerPardonIp.java new file mode 100644 index 0000000..c45dd6b --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerPardonIp.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.regex.Matcher; +import net.minecraft.server.MinecraftServer; + +public class CommandServerPardonIp extends CommandBase +{ + public String getCommandName() + { + return "pardon-ip"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) + { + return MinecraftServer.getServer().getConfigurationManager().getBannedIPs().isListActive() && super.canCommandSenderUseCommand(par1ICommandSender); + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.unbanip.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length == 1 && par2ArrayOfStr[0].length() > 1) + { + Matcher var3 = CommandServerBanIp.IPv4Pattern.matcher(par2ArrayOfStr[0]); + + if (var3.matches()) + { + MinecraftServer.getServer().getConfigurationManager().getBannedIPs().remove(par2ArrayOfStr[0]); + notifyAdmins(par1ICommandSender, "commands.unbanip.success", new Object[] {par2ArrayOfStr[0]}); + } + else + { + throw new SyntaxErrorException("commands.unbanip.invalid", new Object[0]); + } + } + else + { + throw new WrongUsageException("commands.unbanip.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsFromIterableMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getConfigurationManager().getBannedIPs().getBannedList().keySet()) : null; + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerPublishLocal.java b/src/main/java/net/minecraft/src/CommandServerPublishLocal.java new file mode 100644 index 0000000..e6c3c13 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerPublishLocal.java @@ -0,0 +1,38 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class CommandServerPublishLocal extends CommandBase +{ + public String getCommandName() + { + return "publish"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 4; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.publish.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + String var3 = MinecraftServer.getServer().shareToLAN(EnumGameType.SURVIVAL, false); + + if (var3 != null) + { + notifyAdmins(par1ICommandSender, "commands.publish.started", new Object[] {var3}); + } + else + { + notifyAdmins(par1ICommandSender, "commands.publish.failed", new Object[0]); + } + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerSaveAll.java b/src/main/java/net/minecraft/src/CommandServerSaveAll.java new file mode 100644 index 0000000..943503e --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerSaveAll.java @@ -0,0 +1,80 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class CommandServerSaveAll extends CommandBase +{ + public String getCommandName() + { + return "save-all"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 4; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.save.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + MinecraftServer var3 = MinecraftServer.getServer(); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("commands.save.start")); + + if (var3.getConfigurationManager() != null) + { + var3.getConfigurationManager().saveAllPlayerData(); + } + + try + { + int var4; + WorldServer var5; + boolean var6; + + for (var4 = 0; var4 < var3.worldServers.length; ++var4) + { + if (var3.worldServers[var4] != null) + { + var5 = var3.worldServers[var4]; + var6 = var5.canNotSave; + var5.canNotSave = false; + var5.saveAllChunks(true, (IProgressUpdate)null); + var5.canNotSave = var6; + } + } + + if (par2ArrayOfStr.length > 0 && "flush".equals(par2ArrayOfStr[0])) + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("commands.save.flushStart")); + + for (var4 = 0; var4 < var3.worldServers.length; ++var4) + { + if (var3.worldServers[var4] != null) + { + var5 = var3.worldServers[var4]; + var6 = var5.canNotSave; + var5.canNotSave = false; + var5.saveChunkData(); + var5.canNotSave = var6; + } + } + + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("commands.save.flushEnd")); + } + } + catch (MinecraftException var7) + { + notifyAdmins(par1ICommandSender, "commands.save.failed", new Object[] {var7.getMessage()}); + return; + } + + notifyAdmins(par1ICommandSender, "commands.save.success", new Object[0]); + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerSaveOff.java b/src/main/java/net/minecraft/src/CommandServerSaveOff.java new file mode 100644 index 0000000..e495c09 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerSaveOff.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class CommandServerSaveOff extends CommandBase +{ + public String getCommandName() + { + return "save-off"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 4; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.save-off.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + MinecraftServer var3 = MinecraftServer.getServer(); + boolean var4 = false; + + for (int var5 = 0; var5 < var3.worldServers.length; ++var5) + { + if (var3.worldServers[var5] != null) + { + WorldServer var6 = var3.worldServers[var5]; + + if (!var6.canNotSave) + { + var6.canNotSave = true; + var4 = true; + } + } + } + + if (var4) + { + notifyAdmins(par1ICommandSender, "commands.save.disabled", new Object[0]); + } + else + { + throw new CommandException("commands.save-off.alreadyOff", new Object[0]); + } + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerSaveOn.java b/src/main/java/net/minecraft/src/CommandServerSaveOn.java new file mode 100644 index 0000000..9ded386 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerSaveOn.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class CommandServerSaveOn extends CommandBase +{ + public String getCommandName() + { + return "save-on"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 4; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.save-on.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + MinecraftServer var3 = MinecraftServer.getServer(); + boolean var4 = false; + + for (int var5 = 0; var5 < var3.worldServers.length; ++var5) + { + if (var3.worldServers[var5] != null) + { + WorldServer var6 = var3.worldServers[var5]; + + if (var6.canNotSave) + { + var6.canNotSave = false; + var4 = true; + } + } + } + + if (var4) + { + notifyAdmins(par1ICommandSender, "commands.save.enabled", new Object[0]); + } + else + { + throw new CommandException("commands.save-on.alreadyOn", new Object[0]); + } + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerSay.java b/src/main/java/net/minecraft/src/CommandServerSay.java new file mode 100644 index 0000000..c666d23 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerSay.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandServerSay extends CommandBase +{ + public String getCommandName() + { + return "say"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 1; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.say.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length > 0 && par2ArrayOfStr[0].length() > 0) + { + String var3 = func_82361_a(par1ICommandSender, par2ArrayOfStr, 0, true); + MinecraftServer.getServer().getConfigurationManager().sendChatMsg(ChatMessageComponent.createFromTranslationWithSubstitutions("chat.type.announcement", new Object[] {par1ICommandSender.getCommandSenderName(), var3})); + } + else + { + throw new WrongUsageException("commands.say.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length >= 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames()) : null; + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerStop.java b/src/main/java/net/minecraft/src/CommandServerStop.java new file mode 100644 index 0000000..4af611a --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerStop.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class CommandServerStop extends CommandBase +{ + public String getCommandName() + { + return "stop"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 4; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.stop.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + notifyAdmins(par1ICommandSender, "commands.stop.start", new Object[0]); + MinecraftServer.getServer().initiateShutdown(); + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerTp.java b/src/main/java/net/minecraft/src/CommandServerTp.java new file mode 100644 index 0000000..6fa895e --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerTp.java @@ -0,0 +1,100 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandServerTp extends CommandBase +{ + public String getCommandName() + { + return "tp"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.tp.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length < 1) + { + throw new WrongUsageException("commands.tp.usage", new Object[0]); + } + else + { + EntityPlayerMP var3; + + if (par2ArrayOfStr.length != 2 && par2ArrayOfStr.length != 4) + { + var3 = getCommandSenderAsPlayer(par1ICommandSender); + } + else + { + var3 = getPlayer(par1ICommandSender, par2ArrayOfStr[0]); + + if (var3 == null) + { + throw new PlayerNotFoundException(); + } + } + + if (par2ArrayOfStr.length != 3 && par2ArrayOfStr.length != 4) + { + if (par2ArrayOfStr.length == 1 || par2ArrayOfStr.length == 2) + { + EntityPlayerMP var11 = getPlayer(par1ICommandSender, par2ArrayOfStr[par2ArrayOfStr.length - 1]); + + if (var11 == null) + { + throw new PlayerNotFoundException(); + } + + if (var11.worldObj != var3.worldObj) + { + notifyAdmins(par1ICommandSender, "commands.tp.notSameDimension", new Object[0]); + return; + } + + var3.mountEntity((Entity)null); + var3.playerNetServerHandler.setPlayerLocation(var11.posX, var11.posY, var11.posZ, var11.rotationYaw, var11.rotationPitch); + notifyAdmins(par1ICommandSender, "commands.tp.success", new Object[] {var3.getEntityName(), var11.getEntityName()}); + } + } + else if (var3.worldObj != null) + { + int var4 = par2ArrayOfStr.length - 3; + double var5 = func_110666_a(par1ICommandSender, var3.posX, par2ArrayOfStr[var4++]); + double var7 = func_110665_a(par1ICommandSender, var3.posY, par2ArrayOfStr[var4++], 0, 0); + double var9 = func_110666_a(par1ICommandSender, var3.posZ, par2ArrayOfStr[var4++]); + var3.mountEntity((Entity)null); + var3.setPositionAndUpdate(var5, var7, var9); + notifyAdmins(par1ICommandSender, "commands.tp.success.coordinates", new Object[] {var3.getEntityName(), Double.valueOf(var5), Double.valueOf(var7), Double.valueOf(var9)}); + } + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length != 1 && par2ArrayOfStr.length != 2 ? null : getListOfStringsMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames()); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] par1ArrayOfStr, int par2) + { + return par2 == 0; + } +} diff --git a/src/main/java/net/minecraft/src/CommandServerWhitelist.java b/src/main/java/net/minecraft/src/CommandServerWhitelist.java new file mode 100644 index 0000000..39c6279 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandServerWhitelist.java @@ -0,0 +1,132 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import net.minecraft.server.MinecraftServer; + +public class CommandServerWhitelist extends CommandBase +{ + public String getCommandName() + { + return "whitelist"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.whitelist.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length >= 1) + { + if (par2ArrayOfStr[0].equals("on")) + { + MinecraftServer.getServer().getConfigurationManager().setWhiteListEnabled(true); + notifyAdmins(par1ICommandSender, "commands.whitelist.enabled", new Object[0]); + return; + } + + if (par2ArrayOfStr[0].equals("off")) + { + MinecraftServer.getServer().getConfigurationManager().setWhiteListEnabled(false); + notifyAdmins(par1ICommandSender, "commands.whitelist.disabled", new Object[0]); + return; + } + + if (par2ArrayOfStr[0].equals("list")) + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.whitelist.list", new Object[] {Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getWhiteListedPlayers().size()), Integer.valueOf(MinecraftServer.getServer().getConfigurationManager().getAvailablePlayerDat().length)})); + Set var3 = MinecraftServer.getServer().getConfigurationManager().getWhiteListedPlayers(); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromText(joinNiceString(var3.toArray(new String[var3.size()])))); + return; + } + + if (par2ArrayOfStr[0].equals("add")) + { + if (par2ArrayOfStr.length < 2) + { + throw new WrongUsageException("commands.whitelist.add.usage", new Object[0]); + } + + MinecraftServer.getServer().getConfigurationManager().addToWhiteList(par2ArrayOfStr[1]); + notifyAdmins(par1ICommandSender, "commands.whitelist.add.success", new Object[] {par2ArrayOfStr[1]}); + return; + } + + if (par2ArrayOfStr[0].equals("remove")) + { + if (par2ArrayOfStr.length < 2) + { + throw new WrongUsageException("commands.whitelist.remove.usage", new Object[0]); + } + + MinecraftServer.getServer().getConfigurationManager().removeFromWhitelist(par2ArrayOfStr[1]); + notifyAdmins(par1ICommandSender, "commands.whitelist.remove.success", new Object[] {par2ArrayOfStr[1]}); + return; + } + + if (par2ArrayOfStr[0].equals("reload")) + { + MinecraftServer.getServer().getConfigurationManager().loadWhiteList(); + notifyAdmins(par1ICommandSender, "commands.whitelist.reloaded", new Object[0]); + return; + } + } + + throw new WrongUsageException("commands.whitelist.usage", new Object[0]); + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length == 1) + { + return getListOfStringsMatchingLastWord(par2ArrayOfStr, new String[] {"on", "off", "list", "add", "remove", "reload"}); + } + else + { + if (par2ArrayOfStr.length == 2) + { + if (par2ArrayOfStr[0].equals("add")) + { + String[] var3 = MinecraftServer.getServer().getConfigurationManager().getAvailablePlayerDat(); + ArrayList var4 = new ArrayList(); + String var5 = par2ArrayOfStr[par2ArrayOfStr.length - 1]; + String[] var6 = var3; + int var7 = var3.length; + + for (int var8 = 0; var8 < var7; ++var8) + { + String var9 = var6[var8]; + + if (doesStringStartWith(var5, var9) && !MinecraftServer.getServer().getConfigurationManager().getWhiteListedPlayers().contains(var9)) + { + var4.add(var9); + } + } + + return var4; + } + + if (par2ArrayOfStr[0].equals("remove")) + { + return getListOfStringsFromIterableMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getConfigurationManager().getWhiteListedPlayers()); + } + } + + return null; + } + } +} diff --git a/src/main/java/net/minecraft/src/CommandSetPlayerTimeout.java b/src/main/java/net/minecraft/src/CommandSetPlayerTimeout.java new file mode 100644 index 0000000..e117a3b --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandSetPlayerTimeout.java @@ -0,0 +1,38 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class CommandSetPlayerTimeout extends CommandBase +{ + public String getCommandName() + { + return "setidletimeout"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 3; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.setidletimeout.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length == 1) + { + int var3 = parseIntWithMin(par1ICommandSender, par2ArrayOfStr[0], 0); + MinecraftServer.getServer().func_143006_e(var3); + notifyAdmins(par1ICommandSender, "commands.setidletimeout.success", new Object[] {Integer.valueOf(var3)}); + } + else + { + throw new WrongUsageException("commands.setidletimeout.usage", new Object[0]); + } + } +} diff --git a/src/main/java/net/minecraft/src/CommandSetSpawnpoint.java b/src/main/java/net/minecraft/src/CommandSetSpawnpoint.java new file mode 100644 index 0000000..6a8429d --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandSetSpawnpoint.java @@ -0,0 +1,72 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandSetSpawnpoint extends CommandBase +{ + public String getCommandName() + { + return "spawnpoint"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.spawnpoint.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + EntityPlayerMP var3 = par2ArrayOfStr.length == 0 ? getCommandSenderAsPlayer(par1ICommandSender) : getPlayer(par1ICommandSender, par2ArrayOfStr[0]); + + if (par2ArrayOfStr.length == 4) + { + if (var3.worldObj != null) + { + byte var4 = 1; + int var5 = 30000000; + int var9 = var4 + 1; + int var6 = parseIntBounded(par1ICommandSender, par2ArrayOfStr[var4], -var5, var5); + int var7 = parseIntBounded(par1ICommandSender, par2ArrayOfStr[var9++], 0, 256); + int var8 = parseIntBounded(par1ICommandSender, par2ArrayOfStr[var9++], -var5, var5); + var3.setSpawnChunk(new ChunkCoordinates(var6, var7, var8), true); + notifyAdmins(par1ICommandSender, "commands.spawnpoint.success", new Object[] {var3.getEntityName(), Integer.valueOf(var6), Integer.valueOf(var7), Integer.valueOf(var8)}); + } + } + else + { + if (par2ArrayOfStr.length > 1) + { + throw new WrongUsageException("commands.spawnpoint.usage", new Object[0]); + } + + ChunkCoordinates var10 = var3.getPlayerCoordinates(); + var3.setSpawnChunk(var10, true); + notifyAdmins(par1ICommandSender, "commands.spawnpoint.success", new Object[] {var3.getEntityName(), Integer.valueOf(var10.posX), Integer.valueOf(var10.posY), Integer.valueOf(var10.posZ)}); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length != 1 && par2ArrayOfStr.length != 2 ? null : getListOfStringsMatchingLastWord(par2ArrayOfStr, MinecraftServer.getServer().getAllUsernames()); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] par1ArrayOfStr, int par2) + { + return par2 == 0; + } +} diff --git a/src/main/java/net/minecraft/src/CommandShowSeed.java b/src/main/java/net/minecraft/src/CommandShowSeed.java new file mode 100644 index 0000000..f383fbf --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandShowSeed.java @@ -0,0 +1,38 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class CommandShowSeed extends CommandBase +{ + /** + * Returns true if the given command sender is allowed to use this command. + */ + public boolean canCommandSenderUseCommand(ICommandSender par1ICommandSender) + { + return MinecraftServer.getServer().isSinglePlayer() || super.canCommandSenderUseCommand(par1ICommandSender); + } + + public String getCommandName() + { + return "seed"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.seed.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + Object var3 = par1ICommandSender instanceof EntityPlayer ? ((EntityPlayer)par1ICommandSender).worldObj : MinecraftServer.getServer().worldServerForDimension(0); + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.seed.success", new Object[] {Long.valueOf(((World)var3).getSeed())})); + } +} diff --git a/src/main/java/net/minecraft/src/CommandSpreadPlayers.java b/src/main/java/net/minecraft/src/CommandSpreadPlayers.java new file mode 100644 index 0000000..2303a22 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandSpreadPlayers.java @@ -0,0 +1,282 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import net.minecraft.server.MinecraftServer; + +public class CommandSpreadPlayers extends CommandBase +{ + public String getCommandName() + { + return "spreadplayers"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.spreadplayers.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length < 6) + { + throw new WrongUsageException("commands.spreadplayers.usage", new Object[0]); + } + else + { + byte var3 = 0; + int var16 = var3 + 1; + double var4 = func_110666_a(par1ICommandSender, Double.NaN, par2ArrayOfStr[var3]); + double var6 = func_110666_a(par1ICommandSender, Double.NaN, par2ArrayOfStr[var16++]); + double var8 = func_110664_a(par1ICommandSender, par2ArrayOfStr[var16++], 0.0D); + double var10 = func_110664_a(par1ICommandSender, par2ArrayOfStr[var16++], var8 + 1.0D); + boolean var12 = func_110662_c(par1ICommandSender, par2ArrayOfStr[var16++]); + ArrayList var13 = Lists.newArrayList(); + + while (true) + { + while (var16 < par2ArrayOfStr.length) + { + String var14 = par2ArrayOfStr[var16++]; + + if (PlayerSelector.hasArguments(var14)) + { + EntityPlayerMP[] var17 = PlayerSelector.matchPlayers(par1ICommandSender, var14); + + if (var17 == null || var17.length == 0) + { + throw new PlayerNotFoundException(); + } + + Collections.addAll(var13, var17); + } + else + { + EntityPlayerMP var15 = MinecraftServer.getServer().getConfigurationManager().getPlayerForUsername(var14); + + if (var15 == null) + { + throw new PlayerNotFoundException(); + } + + var13.add(var15); + } + } + + if (var13.isEmpty()) + { + throw new PlayerNotFoundException(); + } + + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.spreadplayers.spreading." + (var12 ? "teams" : "players"), new Object[] {func_110663_b(var13), Double.valueOf(var4), Double.valueOf(var6), Double.valueOf(var8), Double.valueOf(var10)})); + this.func_110669_a(par1ICommandSender, var13, new CommandSpreadPlayersPosition(var4, var6), var8, var10, ((EntityLivingBase)var13.get(0)).worldObj, var12); + return; + } + } + } + + private void func_110669_a(ICommandSender par1ICommandSender, List par2List, CommandSpreadPlayersPosition par3CommandSpreadPlayersPosition, double par4, double par6, World par8World, boolean par9) + { + Random var10 = new Random(); + double var11 = par3CommandSpreadPlayersPosition.field_111101_a - par6; + double var13 = par3CommandSpreadPlayersPosition.field_111100_b - par6; + double var15 = par3CommandSpreadPlayersPosition.field_111101_a + par6; + double var17 = par3CommandSpreadPlayersPosition.field_111100_b + par6; + CommandSpreadPlayersPosition[] var19 = this.func_110670_a(var10, par9 ? this.func_110667_a(par2List) : par2List.size(), var11, var13, var15, var17); + int var20 = this.func_110668_a(par3CommandSpreadPlayersPosition, par4, par8World, var10, var11, var13, var15, var17, var19, par9); + double var21 = this.func_110671_a(par2List, par8World, var19, par9); + notifyAdmins(par1ICommandSender, "commands.spreadplayers.success." + (par9 ? "teams" : "players"), new Object[] {Integer.valueOf(var19.length), Double.valueOf(par3CommandSpreadPlayersPosition.field_111101_a), Double.valueOf(par3CommandSpreadPlayersPosition.field_111100_b)}); + + if (var19.length > 1) + { + par1ICommandSender.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("commands.spreadplayers.info." + (par9 ? "teams" : "players"), new Object[] {String.format("%.2f", new Object[]{Double.valueOf(var21)}), Integer.valueOf(var20)})); + } + } + + private int func_110667_a(List par1List) + { + HashSet var2 = Sets.newHashSet(); + Iterator var3 = par1List.iterator(); + + while (var3.hasNext()) + { + EntityLivingBase var4 = (EntityLivingBase)var3.next(); + + if (var4 instanceof EntityPlayer) + { + var2.add(((EntityPlayer)var4).getTeam()); + } + else + { + var2.add((Object)null); + } + } + + return var2.size(); + } + + private int func_110668_a(CommandSpreadPlayersPosition par1CommandSpreadPlayersPosition, double par2, World par4World, Random par5Random, double par6, double par8, double par10, double par12, CommandSpreadPlayersPosition[] par14ArrayOfCommandSpreadPlayersPosition, boolean par15) + { + boolean var16 = true; + double var18 = 3.4028234663852886E38D; + int var17; + + for (var17 = 0; var17 < 10000 && var16; ++var17) + { + var16 = false; + var18 = 3.4028234663852886E38D; + int var22; + CommandSpreadPlayersPosition var23; + + for (int var20 = 0; var20 < par14ArrayOfCommandSpreadPlayersPosition.length; ++var20) + { + CommandSpreadPlayersPosition var21 = par14ArrayOfCommandSpreadPlayersPosition[var20]; + var22 = 0; + var23 = new CommandSpreadPlayersPosition(); + + for (int var24 = 0; var24 < par14ArrayOfCommandSpreadPlayersPosition.length; ++var24) + { + if (var20 != var24) + { + CommandSpreadPlayersPosition var25 = par14ArrayOfCommandSpreadPlayersPosition[var24]; + double var26 = var21.func_111099_a(var25); + var18 = Math.min(var26, var18); + + if (var26 < par2) + { + ++var22; + var23.field_111101_a += var25.field_111101_a - var21.field_111101_a; + var23.field_111100_b += var25.field_111100_b - var21.field_111100_b; + } + } + } + + if (var22 > 0) + { + var23.field_111101_a /= (double)var22; + var23.field_111100_b /= (double)var22; + double var30 = (double)var23.func_111096_b(); + + if (var30 > 0.0D) + { + var23.func_111095_a(); + var21.func_111094_b(var23); + } + else + { + var21.func_111097_a(par5Random, par6, par8, par10, par12); + } + + var16 = true; + } + + if (var21.func_111093_a(par6, par8, par10, par12)) + { + var16 = true; + } + } + + if (!var16) + { + CommandSpreadPlayersPosition[] var28 = par14ArrayOfCommandSpreadPlayersPosition; + int var29 = par14ArrayOfCommandSpreadPlayersPosition.length; + + for (var22 = 0; var22 < var29; ++var22) + { + var23 = var28[var22]; + + if (!var23.func_111098_b(par4World)) + { + var23.func_111097_a(par5Random, par6, par8, par10, par12); + var16 = true; + } + } + } + } + + if (var17 >= 10000) + { + throw new CommandException("commands.spreadplayers.failure." + (par15 ? "teams" : "players"), new Object[] {Integer.valueOf(par14ArrayOfCommandSpreadPlayersPosition.length), Double.valueOf(par1CommandSpreadPlayersPosition.field_111101_a), Double.valueOf(par1CommandSpreadPlayersPosition.field_111100_b), String.format("%.2f", new Object[]{Double.valueOf(var18)})}); + } + else + { + return var17; + } + } + + private double func_110671_a(List par1List, World par2World, CommandSpreadPlayersPosition[] par3ArrayOfCommandSpreadPlayersPosition, boolean par4) + { + double var5 = 0.0D; + int var7 = 0; + HashMap var8 = Maps.newHashMap(); + + for (int var9 = 0; var9 < par1List.size(); ++var9) + { + EntityLivingBase var10 = (EntityLivingBase)par1List.get(var9); + CommandSpreadPlayersPosition var11; + + if (par4) + { + Team var12 = var10 instanceof EntityPlayer ? ((EntityPlayer)var10).getTeam() : null; + + if (!var8.containsKey(var12)) + { + var8.put(var12, par3ArrayOfCommandSpreadPlayersPosition[var7++]); + } + + var11 = (CommandSpreadPlayersPosition)var8.get(var12); + } + else + { + var11 = par3ArrayOfCommandSpreadPlayersPosition[var7++]; + } + + var10.setPositionAndUpdate((double)((float)MathHelper.floor_double(var11.field_111101_a) + 0.5F), (double)var11.func_111092_a(par2World), (double)MathHelper.floor_double(var11.field_111100_b) + 0.5D); + double var17 = Double.MAX_VALUE; + + for (int var14 = 0; var14 < par3ArrayOfCommandSpreadPlayersPosition.length; ++var14) + { + if (var11 != par3ArrayOfCommandSpreadPlayersPosition[var14]) + { + double var15 = var11.func_111099_a(par3ArrayOfCommandSpreadPlayersPosition[var14]); + var17 = Math.min(var15, var17); + } + } + + var5 += var17; + } + + var5 /= (double)par1List.size(); + return var5; + } + + private CommandSpreadPlayersPosition[] func_110670_a(Random par1Random, int par2, double par3, double par5, double par7, double par9) + { + CommandSpreadPlayersPosition[] var11 = new CommandSpreadPlayersPosition[par2]; + + for (int var12 = 0; var12 < var11.length; ++var12) + { + CommandSpreadPlayersPosition var13 = new CommandSpreadPlayersPosition(); + var13.func_111097_a(par1Random, par3, par5, par7, par9); + var11[var12] = var13; + } + + return var11; + } +} diff --git a/src/main/java/net/minecraft/src/CommandSpreadPlayersPosition.java b/src/main/java/net/minecraft/src/CommandSpreadPlayersPosition.java new file mode 100644 index 0000000..84eb0b8 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandSpreadPlayersPosition.java @@ -0,0 +1,114 @@ +package net.minecraft.src; + +import java.util.Random; + +class CommandSpreadPlayersPosition +{ + double field_111101_a; + double field_111100_b; + + CommandSpreadPlayersPosition() {} + + CommandSpreadPlayersPosition(double par1, double par3) + { + this.field_111101_a = par1; + this.field_111100_b = par3; + } + + double func_111099_a(CommandSpreadPlayersPosition par1CommandSpreadPlayersPosition) + { + double var2 = this.field_111101_a - par1CommandSpreadPlayersPosition.field_111101_a; + double var4 = this.field_111100_b - par1CommandSpreadPlayersPosition.field_111100_b; + return Math.sqrt(var2 * var2 + var4 * var4); + } + + void func_111095_a() + { + double var1 = (double)this.func_111096_b(); + this.field_111101_a /= var1; + this.field_111100_b /= var1; + } + + float func_111096_b() + { + return MathHelper.sqrt_double(this.field_111101_a * this.field_111101_a + this.field_111100_b * this.field_111100_b); + } + + public void func_111094_b(CommandSpreadPlayersPosition par1CommandSpreadPlayersPosition) + { + this.field_111101_a -= par1CommandSpreadPlayersPosition.field_111101_a; + this.field_111100_b -= par1CommandSpreadPlayersPosition.field_111100_b; + } + + public boolean func_111093_a(double par1, double par3, double par5, double par7) + { + boolean var9 = false; + + if (this.field_111101_a < par1) + { + this.field_111101_a = par1; + var9 = true; + } + else if (this.field_111101_a > par5) + { + this.field_111101_a = par5; + var9 = true; + } + + if (this.field_111100_b < par3) + { + this.field_111100_b = par3; + var9 = true; + } + else if (this.field_111100_b > par7) + { + this.field_111100_b = par7; + var9 = true; + } + + return var9; + } + + public int func_111092_a(World par1World) + { + int var2 = MathHelper.floor_double(this.field_111101_a); + int var3 = MathHelper.floor_double(this.field_111100_b); + + for (int var4 = 256; var4 > 0; --var4) + { + int var5 = par1World.getBlockId(var2, var4, var3); + + if (var5 != 0) + { + return var4 + 1; + } + } + + return 257; + } + + public boolean func_111098_b(World par1World) + { + int var2 = MathHelper.floor_double(this.field_111101_a); + int var3 = MathHelper.floor_double(this.field_111100_b); + + for (int var4 = 256; var4 > 0; --var4) + { + int var5 = par1World.getBlockId(var2, var4, var3); + + if (var5 != 0) + { + Material var6 = Block.blocksList[var5].blockMaterial; + return !var6.isLiquid() && var6 != Material.fire; + } + } + + return false; + } + + public void func_111097_a(Random par1Random, double par2, double par4, double par6, double par8) + { + this.field_111101_a = MathHelper.getRandomDoubleInRange(par1Random, par2, par6); + this.field_111100_b = MathHelper.getRandomDoubleInRange(par1Random, par4, par8); + } +} diff --git a/src/main/java/net/minecraft/src/CommandTime.java b/src/main/java/net/minecraft/src/CommandTime.java new file mode 100644 index 0000000..045d9e2 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandTime.java @@ -0,0 +1,94 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandTime extends CommandBase +{ + public String getCommandName() + { + return "time"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.time.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length > 1) + { + int var3; + + if (par2ArrayOfStr[0].equals("set")) + { + if (par2ArrayOfStr[1].equals("day")) + { + var3 = 0; + } + else if (par2ArrayOfStr[1].equals("night")) + { + var3 = 12500; + } + else + { + var3 = parseIntWithMin(par1ICommandSender, par2ArrayOfStr[1], 0); + } + + this.setTime(par1ICommandSender, var3); + notifyAdmins(par1ICommandSender, "commands.time.set", new Object[] {Integer.valueOf(var3)}); + return; + } + + if (par2ArrayOfStr[0].equals("add")) + { + var3 = parseIntWithMin(par1ICommandSender, par2ArrayOfStr[1], 0); + this.addTime(par1ICommandSender, var3); + notifyAdmins(par1ICommandSender, "commands.time.added", new Object[] {Integer.valueOf(var3)}); + return; + } + } + + throw new WrongUsageException("commands.time.usage", new Object[0]); + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, new String[] {"set", "add"}): (par2ArrayOfStr.length == 2 && par2ArrayOfStr[0].equals("set") ? getListOfStringsMatchingLastWord(par2ArrayOfStr, new String[] {"day", "night"}): null); + } + + /** + * Set the time in the server object. + */ + protected void setTime(ICommandSender par1ICommandSender, int par2) + { + for (int var3 = 0; var3 < MinecraftServer.getServer().worldServers.length; ++var3) + { + MinecraftServer.getServer().worldServers[var3].setWorldTime((long)par2); + } + } + + /** + * Adds (or removes) time in the server object. + */ + protected void addTime(ICommandSender par1ICommandSender, int par2) + { + for (int var3 = 0; var3 < MinecraftServer.getServer().worldServers.length; ++var3) + { + WorldServer var4 = MinecraftServer.getServer().worldServers[var3]; + var4.setWorldTime(var4.getWorldTime() + (long)par2); + } + } +} diff --git a/src/main/java/net/minecraft/src/CommandToggleDownfall.java b/src/main/java/net/minecraft/src/CommandToggleDownfall.java new file mode 100644 index 0000000..42257a8 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandToggleDownfall.java @@ -0,0 +1,39 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class CommandToggleDownfall extends CommandBase +{ + public String getCommandName() + { + return "toggledownfall"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.downfall.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + this.toggleDownfall(); + notifyAdmins(par1ICommandSender, "commands.downfall.success", new Object[0]); + } + + /** + * Toggle rain and enable thundering. + */ + protected void toggleDownfall() + { + MinecraftServer.getServer().worldServers[0].toggleRain(); + MinecraftServer.getServer().worldServers[0].getWorldInfo().setThundering(true); + } +} diff --git a/src/main/java/net/minecraft/src/CommandWeather.java b/src/main/java/net/minecraft/src/CommandWeather.java new file mode 100644 index 0000000..797c736 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandWeather.java @@ -0,0 +1,80 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; +import net.minecraft.server.MinecraftServer; + +public class CommandWeather extends CommandBase +{ + public String getCommandName() + { + return "weather"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.weather.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length >= 1 && par2ArrayOfStr.length <= 2) + { + int var3 = (300 + (new Random()).nextInt(600)) * 20; + + if (par2ArrayOfStr.length >= 2) + { + var3 = parseIntBounded(par1ICommandSender, par2ArrayOfStr[1], 1, 1000000) * 20; + } + + WorldServer var4 = MinecraftServer.getServer().worldServers[0]; + WorldInfo var5 = var4.getWorldInfo(); + var5.setRainTime(var3); + var5.setThunderTime(var3); + + if ("clear".equalsIgnoreCase(par2ArrayOfStr[0])) + { + var5.setRaining(false); + var5.setThundering(false); + notifyAdmins(par1ICommandSender, "commands.weather.clear", new Object[0]); + } + else if ("rain".equalsIgnoreCase(par2ArrayOfStr[0])) + { + var5.setRaining(true); + var5.setThundering(false); + notifyAdmins(par1ICommandSender, "commands.weather.rain", new Object[0]); + } + else + { + if (!"thunder".equalsIgnoreCase(par2ArrayOfStr[0])) + { + throw new WrongUsageException("commands.weather.usage", new Object[0]); + } + + var5.setRaining(true); + var5.setThundering(true); + notifyAdmins(par1ICommandSender, "commands.weather.thunder", new Object[0]); + } + } + else + { + throw new WrongUsageException("commands.weather.usage", new Object[0]); + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 1 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, new String[] {"clear", "rain", "thunder"}): null; + } +} diff --git a/src/main/java/net/minecraft/src/CommandXP.java b/src/main/java/net/minecraft/src/CommandXP.java new file mode 100644 index 0000000..562bcf0 --- /dev/null +++ b/src/main/java/net/minecraft/src/CommandXP.java @@ -0,0 +1,107 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class CommandXP extends CommandBase +{ + public String getCommandName() + { + return "xp"; + } + + /** + * Return the required permission level for this command. + */ + public int getRequiredPermissionLevel() + { + return 2; + } + + public String getCommandUsage(ICommandSender par1ICommandSender) + { + return "commands.xp.usage"; + } + + public void processCommand(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + if (par2ArrayOfStr.length <= 0) + { + throw new WrongUsageException("commands.xp.usage", new Object[0]); + } + else + { + String var4 = par2ArrayOfStr[0]; + boolean var5 = var4.endsWith("l") || var4.endsWith("L"); + + if (var5 && var4.length() > 1) + { + var4 = var4.substring(0, var4.length() - 1); + } + + int var6 = parseInt(par1ICommandSender, var4); + boolean var7 = var6 < 0; + + if (var7) + { + var6 *= -1; + } + + EntityPlayerMP var3; + + if (par2ArrayOfStr.length > 1) + { + var3 = getPlayer(par1ICommandSender, par2ArrayOfStr[1]); + } + else + { + var3 = getCommandSenderAsPlayer(par1ICommandSender); + } + + if (var5) + { + if (var7) + { + var3.addExperienceLevel(-var6); + notifyAdmins(par1ICommandSender, "commands.xp.success.negative.levels", new Object[] {Integer.valueOf(var6), var3.getEntityName()}); + } + else + { + var3.addExperienceLevel(var6); + notifyAdmins(par1ICommandSender, "commands.xp.success.levels", new Object[] {Integer.valueOf(var6), var3.getEntityName()}); + } + } + else + { + if (var7) + { + throw new WrongUsageException("commands.xp.failure.widthdrawXp", new Object[0]); + } + + var3.addExperience(var6); + notifyAdmins(par1ICommandSender, "commands.xp.success", new Object[] {Integer.valueOf(var6), var3.getEntityName()}); + } + } + } + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + public List addTabCompletionOptions(ICommandSender par1ICommandSender, String[] par2ArrayOfStr) + { + return par2ArrayOfStr.length == 2 ? getListOfStringsMatchingLastWord(par2ArrayOfStr, this.getAllUsernames()) : null; + } + + protected String[] getAllUsernames() + { + return MinecraftServer.getServer().getAllUsernames(); + } + + /** + * Return whether the specified command parameter index is a username parameter. + */ + public boolean isUsernameIndex(String[] par1ArrayOfStr, int par2) + { + return par2 == 1; + } +} diff --git a/src/main/java/net/minecraft/src/ComparatorClassSorter.java b/src/main/java/net/minecraft/src/ComparatorClassSorter.java new file mode 100644 index 0000000..5dc38fc --- /dev/null +++ b/src/main/java/net/minecraft/src/ComparatorClassSorter.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.util.Comparator; + +class ComparatorClassSorter implements Comparator +{ + final CallableSuspiciousClasses theSuspiciousClasses; + + ComparatorClassSorter(CallableSuspiciousClasses par1CallableSuspiciousClasses) + { + this.theSuspiciousClasses = par1CallableSuspiciousClasses; + } + + public int func_85081_a(Class par1Class, Class par2Class) + { + String var3 = par1Class.getPackage() == null ? "" : par1Class.getPackage().getName(); + String var4 = par2Class.getPackage() == null ? "" : par2Class.getPackage().getName(); + return var3.compareTo(var4); + } + + public int compare(Object par1Obj, Object par2Obj) + { + return this.func_85081_a((Class)par1Obj, (Class)par2Obj); + } +} diff --git a/src/main/java/net/minecraft/src/ComponentMineshaftCorridor.java b/src/main/java/net/minecraft/src/ComponentMineshaftCorridor.java new file mode 100644 index 0000000..e5dcfaf --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentMineshaftCorridor.java @@ -0,0 +1,345 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentMineshaftCorridor extends StructureComponent +{ + private boolean hasRails; + private boolean hasSpiders; + private boolean spawnerPlaced; + + /** + * A count of the different sections of this mine. The space between ceiling supports. + */ + private int sectionCount; + + public ComponentMineshaftCorridor() {} + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setBoolean("hr", this.hasRails); + par1NBTTagCompound.setBoolean("sc", this.hasSpiders); + par1NBTTagCompound.setBoolean("hps", this.spawnerPlaced); + par1NBTTagCompound.setInteger("Num", this.sectionCount); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + this.hasRails = par1NBTTagCompound.getBoolean("hr"); + this.hasSpiders = par1NBTTagCompound.getBoolean("sc"); + this.spawnerPlaced = par1NBTTagCompound.getBoolean("hps"); + this.sectionCount = par1NBTTagCompound.getInteger("Num"); + } + + public ComponentMineshaftCorridor(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + this.hasRails = par2Random.nextInt(3) == 0; + this.hasSpiders = !this.hasRails && par2Random.nextInt(23) == 0; + + if (this.coordBaseMode != 2 && this.coordBaseMode != 0) + { + this.sectionCount = par3StructureBoundingBox.getXSize() / 5; + } + else + { + this.sectionCount = par3StructureBoundingBox.getZSize() / 5; + } + } + + public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5) + { + StructureBoundingBox var6 = new StructureBoundingBox(par2, par3, par4, par2, par3 + 2, par4); + int var7; + + for (var7 = par1Random.nextInt(3) + 2; var7 > 0; --var7) + { + int var8 = var7 * 5; + + switch (par5) + { + case 0: + var6.maxX = par2 + 2; + var6.maxZ = par4 + (var8 - 1); + break; + + case 1: + var6.minX = par2 - (var8 - 1); + var6.maxZ = par4 + 2; + break; + + case 2: + var6.maxX = par2 + 2; + var6.minZ = par4 - (var8 - 1); + break; + + case 3: + var6.maxX = par2 + (var8 - 1); + var6.maxZ = par4 + 2; + } + + if (StructureComponent.findIntersecting(par0List, var6) == null) + { + break; + } + } + + return var7 > 0 ? var6 : null; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + int var4 = this.getComponentType(); + int var5 = par3Random.nextInt(4); + + switch (this.coordBaseMode) + { + case 0: + if (var5 <= 1) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ + 1, this.coordBaseMode, var4); + } + else if (var5 == 2) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ - 3, 1, var4); + } + else + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ - 3, 3, var4); + } + + break; + + case 1: + if (var5 <= 1) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, this.coordBaseMode, var4); + } + else if (var5 == 2) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ - 1, 2, var4); + } + else + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ + 1, 0, var4); + } + + break; + + case 2: + if (var5 <= 1) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ - 1, this.coordBaseMode, var4); + } + else if (var5 == 2) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, 1, var4); + } + else + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, 3, var4); + } + + break; + + case 3: + if (var5 <= 1) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ, this.coordBaseMode, var4); + } + else if (var5 == 2) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX - 3, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.minZ - 1, 2, var4); + } + else + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX - 3, this.boundingBox.minY - 1 + par3Random.nextInt(3), this.boundingBox.maxZ + 1, 0, var4); + } + } + + if (var4 < 8) + { + int var6; + int var7; + + if (this.coordBaseMode != 2 && this.coordBaseMode != 0) + { + for (var6 = this.boundingBox.minX + 3; var6 + 3 <= this.boundingBox.maxX; var6 += 5) + { + var7 = par3Random.nextInt(5); + + if (var7 == 0) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, var6, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4 + 1); + } + else if (var7 == 1) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, var6, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4 + 1); + } + } + } + else + { + for (var6 = this.boundingBox.minZ + 3; var6 + 3 <= this.boundingBox.maxZ; var6 += 5) + { + var7 = par3Random.nextInt(5); + + if (var7 == 0) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, var6, 1, var4 + 1); + } + else if (var7 == 1) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, var6, 3, var4 + 1); + } + } + } + } + } + + /** + * Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests. + */ + protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8) + { + int var9 = this.getXWithOffset(par4, par6); + int var10 = this.getYWithOffset(par5); + int var11 = this.getZWithOffset(par4, par6); + + if (par2StructureBoundingBox.isVecInside(var9, var10, var11) && par1World.getBlockId(var9, var10, var11) == 0) + { + par1World.setBlock(var9, var10, var11, Block.rail.blockID, this.getMetadataWithOffset(Block.rail.blockID, par3Random.nextBoolean() ? 1 : 0), 2); + EntityMinecartChest var12 = new EntityMinecartChest(par1World, (double)((float)var9 + 0.5F), (double)((float)var10 + 0.5F), (double)((float)var11 + 0.5F)); + WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, var12, par8); + par1World.spawnEntityInWorld(var12); + return true; + } + else + { + return false; + } + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + boolean var4 = false; + boolean var5 = true; + boolean var6 = false; + boolean var7 = true; + int var8 = this.sectionCount * 5 - 1; + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 1, var8, 0, 0, false); + this.randomlyFillWithBlocks(par1World, par3StructureBoundingBox, par2Random, 0.8F, 0, 2, 0, 2, 2, var8, 0, 0, false); + + if (this.hasSpiders) + { + this.randomlyFillWithBlocks(par1World, par3StructureBoundingBox, par2Random, 0.6F, 0, 0, 0, 2, 1, var8, Block.web.blockID, 0, false); + } + + int var9; + int var10; + int var11; + + for (var9 = 0; var9 < this.sectionCount; ++var9) + { + var10 = 2 + var9 * 5; + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, var10, 0, 1, var10, Block.fence.blockID, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 0, var10, 2, 1, var10, Block.fence.blockID, 0, false); + + if (par2Random.nextInt(4) == 0) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, var10, 0, 2, var10, Block.planks.blockID, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 2, var10, 2, 2, var10, Block.planks.blockID, 0, false); + } + else + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, var10, 2, 2, var10, Block.planks.blockID, 0, false); + } + + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 0, 2, var10 - 1, Block.web.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 2, 2, var10 - 1, Block.web.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 0, 2, var10 + 1, Block.web.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 2, 2, var10 + 1, Block.web.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 0, 2, var10 - 2, Block.web.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 2, 2, var10 - 2, Block.web.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 0, 2, var10 + 2, Block.web.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 2, 2, var10 + 2, Block.web.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, var10 - 1, Block.torchWood.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, var10 + 1, Block.torchWood.blockID, 0); + + if (par2Random.nextInt(100) == 0) + { + this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, var10 - 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); + } + + if (par2Random.nextInt(100) == 0) + { + this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, var10 + 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4)); + } + + if (this.hasSpiders && !this.spawnerPlaced) + { + var11 = this.getYWithOffset(0); + int var12 = var10 - 1 + par2Random.nextInt(3); + int var13 = this.getXWithOffset(1, var12); + var12 = this.getZWithOffset(1, var12); + + if (par3StructureBoundingBox.isVecInside(var13, var11, var12)) + { + this.spawnerPlaced = true; + par1World.setBlock(var13, var11, var12, Block.mobSpawner.blockID, 0, 2); + TileEntityMobSpawner var14 = (TileEntityMobSpawner)par1World.getBlockTileEntity(var13, var11, var12); + + if (var14 != null) + { + var14.getSpawnerLogic().setMobID("CaveSpider"); + } + } + } + } + + for (var9 = 0; var9 <= 2; ++var9) + { + for (var10 = 0; var10 <= var8; ++var10) + { + var11 = this.getBlockIdAtCurrentPosition(par1World, var9, -1, var10, par3StructureBoundingBox); + + if (var11 == 0) + { + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, var9, -1, var10, par3StructureBoundingBox); + } + } + } + + if (this.hasRails) + { + for (var9 = 0; var9 <= var8; ++var9) + { + var10 = this.getBlockIdAtCurrentPosition(par1World, 1, -1, var9, par3StructureBoundingBox); + + if (var10 > 0 && Block.opaqueCubeLookup[var10]) + { + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.7F, 1, 0, var9, Block.rail.blockID, this.getMetadataWithOffset(Block.rail.blockID, 0)); + } + } + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentMineshaftCross.java b/src/main/java/net/minecraft/src/ComponentMineshaftCross.java new file mode 100644 index 0000000..d5487a0 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentMineshaftCross.java @@ -0,0 +1,175 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentMineshaftCross extends StructureComponent +{ + private int corridorDirection; + private boolean isMultipleFloors; + + public ComponentMineshaftCross() {} + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setBoolean("tf", this.isMultipleFloors); + par1NBTTagCompound.setInteger("D", this.corridorDirection); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + this.isMultipleFloors = par1NBTTagCompound.getBoolean("tf"); + this.corridorDirection = par1NBTTagCompound.getInteger("D"); + } + + public ComponentMineshaftCross(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.corridorDirection = par4; + this.boundingBox = par3StructureBoundingBox; + this.isMultipleFloors = par3StructureBoundingBox.getYSize() > 3; + } + + public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5) + { + StructureBoundingBox var6 = new StructureBoundingBox(par2, par3, par4, par2, par3 + 2, par4); + + if (par1Random.nextInt(4) == 0) + { + var6.maxY += 4; + } + + switch (par5) + { + case 0: + var6.minX = par2 - 1; + var6.maxX = par2 + 3; + var6.maxZ = par4 + 4; + break; + + case 1: + var6.minX = par2 - 4; + var6.minZ = par4 - 1; + var6.maxZ = par4 + 3; + break; + + case 2: + var6.minX = par2 - 1; + var6.maxX = par2 + 3; + var6.minZ = par4 - 4; + break; + + case 3: + var6.maxX = par2 + 4; + var6.minZ = par4 - 1; + var6.maxZ = par4 + 3; + } + + return StructureComponent.findIntersecting(par0List, var6) != null ? null : var6; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + int var4 = this.getComponentType(); + + switch (this.corridorDirection) + { + case 0: + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 1, var4); + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 3, var4); + break; + + case 1: + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 1, var4); + break; + + case 2: + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 1, var4); + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 3, var4); + break; + + case 3: + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, 3, var4); + } + + if (this.isMultipleFloors) + { + if (par3Random.nextBoolean()) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ - 1, 2, var4); + } + + if (par3Random.nextBoolean()) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ + 1, 1, var4); + } + + if (par3Random.nextBoolean()) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.minZ + 1, 3, var4); + } + + if (par3Random.nextBoolean()) + { + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.minY + 3 + 1, this.boundingBox.maxZ + 1, 0, var4); + } + } + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + if (this.isMultipleFloors) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.minY + 3 - 1, this.boundingBox.maxZ, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.minY + 3 - 1, this.boundingBox.maxZ - 1, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.maxY - 2, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.maxY - 2, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ - 1, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY + 3, this.boundingBox.minZ + 1, this.boundingBox.maxX - 1, this.boundingBox.minY + 3, this.boundingBox.maxZ - 1, 0, 0, false); + } + else + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ - 1, 0, 0, false); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.minX + 1, this.boundingBox.maxY, this.boundingBox.minZ + 1, Block.planks.blockID, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 1, this.boundingBox.minX + 1, this.boundingBox.maxY, this.boundingBox.maxZ - 1, Block.planks.blockID, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.maxX - 1, this.boundingBox.minY, this.boundingBox.minZ + 1, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.minZ + 1, Block.planks.blockID, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.maxX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 1, this.boundingBox.maxX - 1, this.boundingBox.maxY, this.boundingBox.maxZ - 1, Block.planks.blockID, 0, false); + + for (int var4 = this.boundingBox.minX; var4 <= this.boundingBox.maxX; ++var4) + { + for (int var5 = this.boundingBox.minZ; var5 <= this.boundingBox.maxZ; ++var5) + { + int var6 = this.getBlockIdAtCurrentPosition(par1World, var4, this.boundingBox.minY - 1, var5, par3StructureBoundingBox); + + if (var6 == 0) + { + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, var4, this.boundingBox.minY - 1, var5, par3StructureBoundingBox); + } + } + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentMineshaftRoom.java b/src/main/java/net/minecraft/src/ComponentMineshaftRoom.java new file mode 100644 index 0000000..10658a3 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentMineshaftRoom.java @@ -0,0 +1,161 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Random; + +public class ComponentMineshaftRoom extends StructureComponent +{ + /** List of other Mineshaft components linked to this room. */ + private List roomsLinkedToTheRoom = new LinkedList(); + + public ComponentMineshaftRoom() {} + + public ComponentMineshaftRoom(int par1, Random par2Random, int par3, int par4) + { + super(par1); + this.boundingBox = new StructureBoundingBox(par3, 50, par4, par3 + 7 + par2Random.nextInt(6), 54 + par2Random.nextInt(6), par4 + 7 + par2Random.nextInt(6)); + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + int var4 = this.getComponentType(); + int var6 = this.boundingBox.getYSize() - 3 - 1; + + if (var6 <= 0) + { + var6 = 1; + } + + int var5; + StructureComponent var7; + StructureBoundingBox var8; + + for (var5 = 0; var5 < this.boundingBox.getXSize(); var5 += 4) + { + var5 += par3Random.nextInt(this.boundingBox.getXSize()); + + if (var5 + 3 > this.boundingBox.getXSize()) + { + break; + } + + var7 = StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + var5, this.boundingBox.minY + par3Random.nextInt(var6) + 1, this.boundingBox.minZ - 1, 2, var4); + + if (var7 != null) + { + var8 = var7.getBoundingBox(); + this.roomsLinkedToTheRoom.add(new StructureBoundingBox(var8.minX, var8.minY, this.boundingBox.minZ, var8.maxX, var8.maxY, this.boundingBox.minZ + 1)); + } + } + + for (var5 = 0; var5 < this.boundingBox.getXSize(); var5 += 4) + { + var5 += par3Random.nextInt(this.boundingBox.getXSize()); + + if (var5 + 3 > this.boundingBox.getXSize()) + { + break; + } + + var7 = StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX + var5, this.boundingBox.minY + par3Random.nextInt(var6) + 1, this.boundingBox.maxZ + 1, 0, var4); + + if (var7 != null) + { + var8 = var7.getBoundingBox(); + this.roomsLinkedToTheRoom.add(new StructureBoundingBox(var8.minX, var8.minY, this.boundingBox.maxZ - 1, var8.maxX, var8.maxY, this.boundingBox.maxZ)); + } + } + + for (var5 = 0; var5 < this.boundingBox.getZSize(); var5 += 4) + { + var5 += par3Random.nextInt(this.boundingBox.getZSize()); + + if (var5 + 3 > this.boundingBox.getZSize()) + { + break; + } + + var7 = StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + par3Random.nextInt(var6) + 1, this.boundingBox.minZ + var5, 1, var4); + + if (var7 != null) + { + var8 = var7.getBoundingBox(); + this.roomsLinkedToTheRoom.add(new StructureBoundingBox(this.boundingBox.minX, var8.minY, var8.minZ, this.boundingBox.minX + 1, var8.maxY, var8.maxZ)); + } + } + + for (var5 = 0; var5 < this.boundingBox.getZSize(); var5 += 4) + { + var5 += par3Random.nextInt(this.boundingBox.getZSize()); + + if (var5 + 3 > this.boundingBox.getZSize()) + { + break; + } + + var7 = StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + par3Random.nextInt(var6) + 1, this.boundingBox.minZ + var5, 3, var4); + + if (var7 != null) + { + var8 = var7.getBoundingBox(); + this.roomsLinkedToTheRoom.add(new StructureBoundingBox(this.boundingBox.maxX - 1, var8.minY, var8.minZ, this.boundingBox.maxX, var8.maxY, var8.maxZ)); + } + } + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ, this.boundingBox.maxX, this.boundingBox.minY, this.boundingBox.maxZ, Block.dirt.blockID, 0, true); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY + 1, this.boundingBox.minZ, this.boundingBox.maxX, Math.min(this.boundingBox.minY + 3, this.boundingBox.maxY), this.boundingBox.maxZ, 0, 0, false); + Iterator var4 = this.roomsLinkedToTheRoom.iterator(); + + while (var4.hasNext()) + { + StructureBoundingBox var5 = (StructureBoundingBox)var4.next(); + this.fillWithBlocks(par1World, par3StructureBoundingBox, var5.minX, var5.maxY - 2, var5.minZ, var5.maxX, var5.maxY, var5.maxZ, 0, 0, false); + } + + this.randomlyRareFillWithBlocks(par1World, par3StructureBoundingBox, this.boundingBox.minX, this.boundingBox.minY + 4, this.boundingBox.minZ, this.boundingBox.maxX, this.boundingBox.maxY, this.boundingBox.maxZ, 0, false); + return true; + } + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + NBTTagList var2 = new NBTTagList("Entrances"); + Iterator var3 = this.roomsLinkedToTheRoom.iterator(); + + while (var3.hasNext()) + { + StructureBoundingBox var4 = (StructureBoundingBox)var3.next(); + var2.appendTag(var4.func_143047_a("")); + } + + par1NBTTagCompound.setTag("Entrances", var2); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + NBTTagList var2 = par1NBTTagCompound.getTagList("Entrances"); + + for (int var3 = 0; var3 < var2.tagCount(); ++var3) + { + this.roomsLinkedToTheRoom.add(new StructureBoundingBox(((NBTTagIntArray)var2.tagAt(var3)).intArray)); + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentMineshaftStairs.java b/src/main/java/net/minecraft/src/ComponentMineshaftStairs.java new file mode 100644 index 0000000..c7b8d0e --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentMineshaftStairs.java @@ -0,0 +1,102 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentMineshaftStairs extends StructureComponent +{ + public ComponentMineshaftStairs() {} + + public ComponentMineshaftStairs(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) {} + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) {} + + /** + * Trys to find a valid place to put this component. + */ + public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5) + { + StructureBoundingBox var6 = new StructureBoundingBox(par2, par3 - 5, par4, par2, par3 + 2, par4); + + switch (par5) + { + case 0: + var6.maxX = par2 + 2; + var6.maxZ = par4 + 8; + break; + + case 1: + var6.minX = par2 - 8; + var6.maxZ = par4 + 2; + break; + + case 2: + var6.maxX = par2 + 2; + var6.minZ = par4 - 8; + break; + + case 3: + var6.maxX = par2 + 8; + var6.maxZ = par4 + 2; + } + + return StructureComponent.findIntersecting(par0List, var6) != null ? null : var6; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + int var4 = this.getComponentType(); + + switch (this.coordBaseMode) + { + case 0: + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, var4); + break; + + case 1: + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, 1, var4); + break; + + case 2: + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, var4); + break; + + case 3: + StructureMineshaftPieces.getNextComponent(par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, 3, var4); + } + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 2, 7, 1, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 7, 2, 2, 8, 0, 0, false); + + for (int var4 = 0; var4 < 5; ++var4) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5 - var4 - (var4 < 4 ? 1 : 0), 2 + var4, 2, 7 - var4, 2 + var4, 0, 0, false); + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor.java new file mode 100644 index 0000000..73a741b --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor.java @@ -0,0 +1,92 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeCorridor extends ComponentNetherBridgePiece +{ + private boolean field_111021_b; + + public ComponentNetherBridgeCorridor() {} + + public ComponentNetherBridgeCorridor(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + this.field_111021_b = par2Random.nextInt(3) == 0; + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.field_111021_b = par1NBTTagCompound.getBoolean("Chest"); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Chest", this.field_111021_b); + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentX((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 0, 1, true); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeCorridor createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, 0, 0, 5, 7, 5, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeCorridor(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 1, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 4, 5, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 2, 0, 4, 5, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 1, 4, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 3, 4, 4, 3, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 0, 5, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 4, 3, 5, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 4, 1, 4, 4, Block.netherFence.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 3, 4, 3, 4, 4, Block.netherFence.blockID, Block.netherBrick.blockID, false); + int var4; + int var5; + + if (this.field_111021_b) + { + var4 = this.getYWithOffset(2); + var5 = this.getXWithOffset(3, 3); + int var6 = this.getZWithOffset(3, 3); + + if (par3StructureBoundingBox.isVecInside(var5, var4, var6)) + { + this.field_111021_b = false; + this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 2, 3, field_111019_a, 2 + par2Random.nextInt(4)); + } + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 0, 4, 6, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + + for (var4 = 0; var4 <= 4; ++var4) + { + for (var5 = 0; var5 <= 4; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor2.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor2.java new file mode 100644 index 0000000..f975214 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor2.java @@ -0,0 +1,92 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeCorridor2 extends ComponentNetherBridgePiece +{ + private boolean field_111020_b; + + public ComponentNetherBridgeCorridor2() {} + + public ComponentNetherBridgeCorridor2(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + this.field_111020_b = par2Random.nextInt(3) == 0; + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.field_111020_b = par1NBTTagCompound.getBoolean("Chest"); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Chest", this.field_111020_b); + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentZ((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 0, 1, true); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeCorridor2 createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, 0, 0, 5, 7, 5, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeCorridor2(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 1, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 4, 5, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 0, 5, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 1, 0, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 3, 0, 4, 3, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 2, 0, 4, 5, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 4, 4, 5, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 4, 1, 4, 4, Block.netherFence.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 3, 4, 3, 4, 4, Block.netherFence.blockID, Block.netherBrick.blockID, false); + int var4; + int var5; + + if (this.field_111020_b) + { + var4 = this.getYWithOffset(2); + var5 = this.getXWithOffset(1, 3); + int var6 = this.getZWithOffset(1, 3); + + if (par3StructureBoundingBox.isVecInside(var5, var4, var6)) + { + this.field_111020_b = false; + this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 1, 2, 3, field_111019_a, 2 + par2Random.nextInt(4)); + } + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 0, 4, 6, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + + for (var4 = 0; var4 <= 4; ++var4) + { + for (var5 = 0; var5 <= 4; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor3.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor3.java new file mode 100644 index 0000000..6c94377 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor3.java @@ -0,0 +1,75 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeCorridor3 extends ComponentNetherBridgePiece +{ + public ComponentNetherBridgeCorridor3() {} + + public ComponentNetherBridgeCorridor3(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 1, 0, true); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeCorridor3 createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -7, 0, 5, 14, 10, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeCorridor3(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + int var4 = this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 2); + + for (int var5 = 0; var5 <= 9; ++var5) + { + int var6 = Math.max(1, 7 - var5); + int var7 = Math.min(Math.max(var6 + 5, 14 - var5), 13); + int var8 = var5; + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, var5, 4, var6, var5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, var6 + 1, var5, 3, var7 - 1, var5, 0, 0, false); + + if (var5 <= 6) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var4, 1, var6 + 1, var5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var4, 2, var6 + 1, var5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var4, 3, var6 + 1, var5, par3StructureBoundingBox); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, var7, var5, 4, var7, var5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, var6 + 1, var5, 0, var7 - 1, var5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, var6 + 1, var5, 4, var7 - 1, var5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + + if ((var5 & 1) == 0) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, var6 + 2, var5, 0, var6 + 3, var5, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, var6 + 2, var5, 4, var6 + 3, var5, Block.netherFence.blockID, Block.netherFence.blockID, false); + } + + for (int var9 = 0; var9 <= 4; ++var9) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var9, -1, var8, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor4.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor4.java new file mode 100644 index 0000000..0174503 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor4.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeCorridor4 extends ComponentNetherBridgePiece +{ + public ComponentNetherBridgeCorridor4() {} + + public ComponentNetherBridgeCorridor4(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + byte var4 = 1; + + if (this.coordBaseMode == 1 || this.coordBaseMode == 2) + { + var4 = 5; + } + + this.getNextComponentX((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 0, var4, par3Random.nextInt(8) > 0); + this.getNextComponentZ((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 0, var4, par3Random.nextInt(8) > 0); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeCorridor4 createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -3, 0, 0, 9, 7, 9, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeCorridor4(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 8, 1, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 8, 5, 8, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 0, 8, 6, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 2, 5, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 2, 0, 8, 5, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 0, 1, 4, 0, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 3, 0, 7, 4, 0, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 4, 8, 2, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 4, 2, 2, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 1, 4, 7, 2, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 8, 8, 3, 8, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 6, 0, 3, 7, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 3, 6, 8, 3, 7, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 4, 0, 5, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 3, 4, 8, 5, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 5, 2, 5, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 3, 5, 7, 5, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 5, 1, 5, 5, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 4, 5, 7, 5, 5, Block.netherFence.blockID, Block.netherFence.blockID, false); + + for (int var4 = 0; var4 <= 5; ++var4) + { + for (int var5 = 0; var5 <= 8; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var5, -1, var4, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor5.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor5.java new file mode 100644 index 0000000..0530211 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeCorridor5.java @@ -0,0 +1,60 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeCorridor5 extends ComponentNetherBridgePiece +{ + public ComponentNetherBridgeCorridor5() {} + + public ComponentNetherBridgeCorridor5(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 1, 0, true); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeCorridor5 createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, 0, 0, 5, 7, 5, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeCorridor5(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 1, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 4, 5, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 0, 5, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 2, 0, 4, 5, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 1, 0, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 3, 0, 4, 3, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 1, 4, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 3, 4, 4, 3, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 0, 4, 6, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + + for (int var4 = 0; var4 <= 4; ++var4) + { + for (int var5 = 0; var5 <= 4; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeCrossing.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeCrossing.java new file mode 100644 index 0000000..ff7db09 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeCrossing.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeCrossing extends ComponentNetherBridgePiece +{ + public ComponentNetherBridgeCrossing() {} + + public ComponentNetherBridgeCrossing(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 2, 0, false); + this.getNextComponentX((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 0, 2, false); + this.getNextComponentZ((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 0, 2, false); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeCrossing createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -2, 0, 0, 7, 9, 7, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeCrossing(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 6, 1, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 6, 7, 6, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 1, 6, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 6, 1, 6, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 2, 0, 6, 6, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 2, 6, 6, 6, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 0, 6, 1, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 5, 0, 6, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 2, 0, 6, 6, 1, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 2, 5, 6, 6, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 6, 0, 4, 6, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 0, 4, 5, 0, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 6, 6, 4, 6, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 6, 4, 5, 6, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 2, 0, 6, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 2, 0, 5, 4, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 6, 2, 6, 6, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 5, 2, 6, 5, 4, Block.netherFence.blockID, Block.netherFence.blockID, false); + + for (int var4 = 0; var4 <= 6; ++var4) + { + for (int var5 = 0; var5 <= 6; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeCrossing2.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeCrossing2.java new file mode 100644 index 0000000..a10b104 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeCrossing2.java @@ -0,0 +1,60 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeCrossing2 extends ComponentNetherBridgePiece +{ + public ComponentNetherBridgeCrossing2() {} + + public ComponentNetherBridgeCrossing2(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 1, 0, true); + this.getNextComponentX((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 0, 1, true); + this.getNextComponentZ((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 0, 1, true); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeCrossing2 createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, 0, 0, 5, 7, 5, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeCrossing2(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 1, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 4, 5, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 0, 5, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 2, 0, 4, 5, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 4, 0, 5, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 2, 4, 4, 5, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 0, 4, 6, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + + for (int var4 = 0; var4 <= 4; ++var4) + { + for (int var5 = 0; var5 <= 4; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeCrossing3.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeCrossing3.java new file mode 100644 index 0000000..a78d029 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeCrossing3.java @@ -0,0 +1,103 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeCrossing3 extends ComponentNetherBridgePiece +{ + public ComponentNetherBridgeCrossing3() {} + + public ComponentNetherBridgeCrossing3(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + protected ComponentNetherBridgeCrossing3(Random par1Random, int par2, int par3) + { + super(0); + this.coordBaseMode = par1Random.nextInt(4); + + switch (this.coordBaseMode) + { + case 0: + case 2: + this.boundingBox = new StructureBoundingBox(par2, 64, par3, par2 + 19 - 1, 73, par3 + 19 - 1); + break; + + default: + this.boundingBox = new StructureBoundingBox(par2, 64, par3, par2 + 19 - 1, 73, par3 + 19 - 1); + } + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 8, 3, false); + this.getNextComponentX((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 3, 8, false); + this.getNextComponentZ((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 3, 8, false); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeCrossing3 createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -8, -3, 0, 19, 10, 19, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeCrossing3(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 3, 0, 11, 4, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 7, 18, 4, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 0, 10, 7, 18, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 8, 18, 7, 10, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 5, 0, 7, 5, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 5, 11, 7, 5, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 5, 0, 11, 5, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 5, 11, 11, 5, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 7, 7, 5, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 5, 7, 18, 5, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 11, 7, 5, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 5, 11, 18, 5, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 2, 0, 11, 2, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 2, 13, 11, 2, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 0, 11, 1, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 15, 11, 1, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + int var4; + int var5; + + for (var4 = 7; var4 <= 11; ++var4) + { + for (var5 = 0; var5 <= 2; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, 18 - var5, par3StructureBoundingBox); + } + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 7, 5, 2, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 13, 2, 7, 18, 2, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 7, 3, 1, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 15, 0, 7, 18, 1, 11, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + + for (var4 = 0; var4 <= 2; ++var4) + { + for (var5 = 7; var5 <= 11; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, 18 - var4, -1, var5, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeEnd.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeEnd.java new file mode 100644 index 0000000..3ed9794 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeEnd.java @@ -0,0 +1,80 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeEnd extends ComponentNetherBridgePiece +{ + private int fillSeed; + + public ComponentNetherBridgeEnd() {} + + public ComponentNetherBridgeEnd(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + this.fillSeed = par2Random.nextInt(); + } + + public static ComponentNetherBridgeEnd func_74971_a(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -3, 0, 5, 10, 8, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeEnd(par6, par1Random, var7, par5) : null; + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.fillSeed = par1NBTTagCompound.getInteger("Seed"); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setInteger("Seed", this.fillSeed); + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + Random var4 = new Random((long)this.fillSeed); + int var5; + int var6; + int var7; + + for (var5 = 0; var5 <= 4; ++var5) + { + for (var6 = 3; var6 <= 4; ++var6) + { + var7 = var4.nextInt(8); + this.fillWithBlocks(par1World, par3StructureBoundingBox, var5, var6, 0, var5, var6, var7, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + } + } + + var5 = var4.nextInt(8); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 0, 5, var5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + var5 = var4.nextInt(8); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 5, 0, 4, 5, var5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + + for (var5 = 0; var5 <= 4; ++var5) + { + var6 = var4.nextInt(5); + this.fillWithBlocks(par1World, par3StructureBoundingBox, var5, 2, 0, var5, 2, var6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + } + + for (var5 = 0; var5 <= 4; ++var5) + { + for (var6 = 0; var6 <= 1; ++var6) + { + var7 = var4.nextInt(3); + this.fillWithBlocks(par1World, par3StructureBoundingBox, var5, var6, 0, var5, var6, var7, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeEntrance.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeEntrance.java new file mode 100644 index 0000000..b65ecb2 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeEntrance.java @@ -0,0 +1,124 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeEntrance extends ComponentNetherBridgePiece +{ + public ComponentNetherBridgeEntrance() {} + + public ComponentNetherBridgeEntrance(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 5, 3, true); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeEntrance createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -5, -3, 0, 13, 14, 13, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeEntrance(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 0, 12, 4, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 12, 13, 12, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 1, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 5, 0, 12, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 11, 4, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 11, 10, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 9, 11, 7, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 0, 4, 12, 1, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 0, 10, 12, 1, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 9, 0, 7, 12, 1, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 11, 2, 10, 12, 10, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 8, 0, 7, 8, 0, Block.netherFence.blockID, Block.netherFence.blockID, false); + int var4; + + for (var4 = 1; var4 <= 11; var4 += 2) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, var4, 10, 0, var4, 11, 0, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, var4, 10, 12, var4, 11, 12, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 10, var4, 0, 11, var4, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 10, var4, 12, 11, var4, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, var4, 13, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, var4, 13, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, 0, 13, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, 12, 13, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, var4 + 1, 13, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, var4 + 1, 13, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, var4 + 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 12, 13, var4 + 1, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 12, 13, 0, par3StructureBoundingBox); + + for (var4 = 3; var4 <= 9; var4 += 2) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 7, var4, 1, 8, var4, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 7, var4, 11, 8, var4, Block.netherFence.blockID, Block.netherFence.blockID, false); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 2, 0, 8, 2, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 4, 12, 2, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 0, 8, 1, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 9, 8, 1, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 4, 3, 1, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 0, 4, 12, 1, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + int var5; + + for (var4 = 4; var4 <= 8; ++var4) + { + for (var5 = 0; var5 <= 2; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, 12 - var5, par3StructureBoundingBox); + } + } + + for (var4 = 0; var4 <= 2; ++var4) + { + for (var5 = 4; var5 <= 8; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, 12 - var4, -1, var5, par3StructureBoundingBox); + } + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 5, 5, 7, 5, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 1, 6, 6, 4, 6, 0, 0, false); + this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, 6, 0, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.lavaMoving.blockID, 0, 6, 5, 6, par3StructureBoundingBox); + var4 = this.getXWithOffset(6, 6); + var5 = this.getYWithOffset(5); + int var6 = this.getZWithOffset(6, 6); + + if (par3StructureBoundingBox.isVecInside(var4, var5, var6)) + { + par1World.scheduledUpdatesAreImmediate = true; + Block.blocksList[Block.lavaMoving.blockID].updateTick(par1World, var4, var5, var6, par2Random); + par1World.scheduledUpdatesAreImmediate = false; + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeNetherStalkRoom.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeNetherStalkRoom.java new file mode 100644 index 0000000..7202596 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeNetherStalkRoom.java @@ -0,0 +1,166 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeNetherStalkRoom extends ComponentNetherBridgePiece +{ + public ComponentNetherBridgeNetherStalkRoom() {} + + public ComponentNetherBridgeNetherStalkRoom(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 5, 3, true); + this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 5, 11, true); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeNetherStalkRoom createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -5, -3, 0, 13, 14, 13, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeNetherStalkRoom(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 0, 12, 4, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 12, 13, 12, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 1, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 5, 0, 12, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 11, 4, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 11, 10, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 9, 11, 7, 12, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 0, 4, 12, 1, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 0, 10, 12, 1, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 9, 0, 7, 12, 1, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 11, 2, 10, 12, 10, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + int var4; + + for (var4 = 1; var4 <= 11; var4 += 2) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, var4, 10, 0, var4, 11, 0, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, var4, 10, 12, var4, 11, 12, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 10, var4, 0, 11, var4, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 10, var4, 12, 11, var4, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, var4, 13, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, var4, 13, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, 0, 13, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, 12, 13, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, var4 + 1, 13, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, var4 + 1, 13, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, var4 + 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 12, 13, var4 + 1, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 0, 13, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 12, 13, 0, par3StructureBoundingBox); + + for (var4 = 3; var4 <= 9; var4 += 2) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 7, var4, 1, 8, var4, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 11, 7, var4, 11, 8, var4, Block.netherFence.blockID, Block.netherFence.blockID, false); + } + + var4 = this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 3); + int var5; + int var6; + int var7; + + for (var5 = 0; var5 <= 6; ++var5) + { + var6 = var5 + 4; + + for (var7 = 5; var7 <= 7; ++var7) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var4, var7, 5 + var5, var6, par3StructureBoundingBox); + } + + if (var6 >= 5 && var6 <= 8) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 5, var6, 7, var5 + 4, var6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + } + else if (var6 >= 9 && var6 <= 10) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 8, var6, 7, var5 + 4, var6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + } + + if (var5 >= 1) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 6 + var5, var6, 7, 9 + var5, var6, 0, 0, false); + } + } + + for (var5 = 5; var5 <= 7; ++var5) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var4, var5, 12, 11, par3StructureBoundingBox); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 6, 7, 5, 7, 7, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 6, 7, 7, 7, 7, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 13, 12, 7, 13, 12, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 2, 3, 5, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 9, 3, 5, 10, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 4, 2, 5, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 5, 2, 10, 5, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 5, 9, 10, 5, 10, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 10, 5, 4, 10, 5, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + var5 = this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 0); + var6 = this.getMetadataWithOffset(Block.stairsNetherBrick.blockID, 1); + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var6, 4, 5, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var6, 4, 5, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var6, 4, 5, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var6, 4, 5, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var5, 8, 5, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var5, 8, 5, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var5, 8, 5, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsNetherBrick.blockID, var5, 8, 5, 10, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 4, 4, 4, 4, 8, Block.slowSand.blockID, Block.slowSand.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 4, 4, 9, 4, 8, Block.slowSand.blockID, Block.slowSand.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 5, 4, 4, 5, 8, Block.netherStalk.blockID, Block.netherStalk.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 4, 9, 5, 8, Block.netherStalk.blockID, Block.netherStalk.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 2, 0, 8, 2, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 4, 12, 2, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 0, 8, 1, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 9, 8, 1, 12, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 4, 3, 1, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 0, 4, 12, 1, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + int var8; + + for (var7 = 4; var7 <= 8; ++var7) + { + for (var8 = 0; var8 <= 2; ++var8) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var7, -1, var8, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var7, -1, 12 - var8, par3StructureBoundingBox); + } + } + + for (var7 = 0; var7 <= 2; ++var7) + { + for (var8 = 4; var8 <= 8; ++var8) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var7, -1, var8, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, 12 - var7, -1, var8, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgePiece.java b/src/main/java/net/minecraft/src/ComponentNetherBridgePiece.java new file mode 100644 index 0000000..c9f9f2c --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgePiece.java @@ -0,0 +1,195 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; +import java.util.Random; + +abstract class ComponentNetherBridgePiece extends StructureComponent +{ + protected static final WeightedRandomChestContent[] field_111019_a = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.diamond.itemID, 0, 1, 3, 5), new WeightedRandomChestContent(Item.ingotIron.itemID, 0, 1, 5, 5), new WeightedRandomChestContent(Item.ingotGold.itemID, 0, 1, 3, 15), new WeightedRandomChestContent(Item.swordGold.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.plateGold.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.flintAndSteel.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.netherStalkSeeds.itemID, 0, 3, 7, 5), new WeightedRandomChestContent(Item.saddle.itemID, 0, 1, 1, 10), new WeightedRandomChestContent(Item.horseArmorGold.itemID, 0, 1, 1, 8), new WeightedRandomChestContent(Item.horseArmorIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.horseArmorDiamond.itemID, 0, 1, 1, 3)}; + + public ComponentNetherBridgePiece() {} + + protected ComponentNetherBridgePiece(int par1) + { + super(par1); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) {} + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) {} + + private int getTotalWeight(List par1List) + { + boolean var2 = false; + int var3 = 0; + StructureNetherBridgePieceWeight var5; + + for (Iterator var4 = par1List.iterator(); var4.hasNext(); var3 += var5.field_78826_b) + { + var5 = (StructureNetherBridgePieceWeight)var4.next(); + + if (var5.field_78824_d > 0 && var5.field_78827_c < var5.field_78824_d) + { + var2 = true; + } + } + + return var2 ? var3 : -1; + } + + private ComponentNetherBridgePiece getNextComponent(ComponentNetherBridgeStartPiece par1ComponentNetherBridgeStartPiece, List par2List, List par3List, Random par4Random, int par5, int par6, int par7, int par8, int par9) + { + int var10 = this.getTotalWeight(par2List); + boolean var11 = var10 > 0 && par9 <= 30; + int var12 = 0; + + while (var12 < 5 && var11) + { + ++var12; + int var13 = par4Random.nextInt(var10); + Iterator var14 = par2List.iterator(); + + while (var14.hasNext()) + { + StructureNetherBridgePieceWeight var15 = (StructureNetherBridgePieceWeight)var14.next(); + var13 -= var15.field_78826_b; + + if (var13 < 0) + { + if (!var15.func_78822_a(par9) || var15 == par1ComponentNetherBridgeStartPiece.theNetherBridgePieceWeight && !var15.field_78825_e) + { + break; + } + + ComponentNetherBridgePiece var16 = StructureNetherBridgePieces.createNextComponent(var15, par3List, par4Random, par5, par6, par7, par8, par9); + + if (var16 != null) + { + ++var15.field_78827_c; + par1ComponentNetherBridgeStartPiece.theNetherBridgePieceWeight = var15; + + if (!var15.func_78823_a()) + { + par2List.remove(var15); + } + + return var16; + } + } + } + } + + return ComponentNetherBridgeEnd.func_74971_a(par3List, par4Random, par5, par6, par7, par8, par9); + } + + /** + * Finds a random component to tack on to the bridge. Or builds the end. + */ + private StructureComponent getNextComponent(ComponentNetherBridgeStartPiece par1ComponentNetherBridgeStartPiece, List par2List, Random par3Random, int par4, int par5, int par6, int par7, int par8, boolean par9) + { + if (Math.abs(par4 - par1ComponentNetherBridgeStartPiece.getBoundingBox().minX) <= 112 && Math.abs(par6 - par1ComponentNetherBridgeStartPiece.getBoundingBox().minZ) <= 112) + { + List var10 = par1ComponentNetherBridgeStartPiece.primaryWeights; + + if (par9) + { + var10 = par1ComponentNetherBridgeStartPiece.secondaryWeights; + } + + ComponentNetherBridgePiece var11 = this.getNextComponent(par1ComponentNetherBridgeStartPiece, var10, par2List, par3Random, par4, par5, par6, par7, par8 + 1); + + if (var11 != null) + { + par2List.add(var11); + par1ComponentNetherBridgeStartPiece.field_74967_d.add(var11); + } + + return var11; + } + else + { + return ComponentNetherBridgeEnd.func_74971_a(par2List, par3Random, par4, par5, par6, par7, par8); + } + } + + /** + * Gets the next component in any cardinal direction + */ + protected StructureComponent getNextComponentNormal(ComponentNetherBridgeStartPiece par1ComponentNetherBridgeStartPiece, List par2List, Random par3Random, int par4, int par5, boolean par6) + { + switch (this.coordBaseMode) + { + case 0: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.minX + par4, this.boundingBox.minY + par5, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType(), par6); + + case 1: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + par5, this.boundingBox.minZ + par4, this.coordBaseMode, this.getComponentType(), par6); + + case 2: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.minX + par4, this.boundingBox.minY + par5, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType(), par6); + + case 3: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + par5, this.boundingBox.minZ + par4, this.coordBaseMode, this.getComponentType(), par6); + + default: + return null; + } + } + + /** + * Gets the next component in the +/- X direction + */ + protected StructureComponent getNextComponentX(ComponentNetherBridgeStartPiece par1ComponentNetherBridgeStartPiece, List par2List, Random par3Random, int par4, int par5, boolean par6) + { + switch (this.coordBaseMode) + { + case 0: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 1, this.getComponentType(), par6); + + case 1: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.minZ - 1, 2, this.getComponentType(), par6); + + case 2: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 1, this.getComponentType(), par6); + + case 3: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.minZ - 1, 2, this.getComponentType(), par6); + + default: + return null; + } + } + + /** + * Gets the next component in the +/- Z direction + */ + protected StructureComponent getNextComponentZ(ComponentNetherBridgeStartPiece par1ComponentNetherBridgeStartPiece, List par2List, Random par3Random, int par4, int par5, boolean par6) + { + switch (this.coordBaseMode) + { + case 0: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 3, this.getComponentType(), par6); + + case 1: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.maxZ + 1, 0, this.getComponentType(), par6); + + case 2: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 3, this.getComponentType(), par6); + + case 3: + return this.getNextComponent(par1ComponentNetherBridgeStartPiece, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.maxZ + 1, 0, this.getComponentType(), par6); + + default: + return null; + } + } + + /** + * Checks if the bounding box's minY is > 10 + */ + protected static boolean isAboveGround(StructureBoundingBox par0StructureBoundingBox) + { + return par0StructureBoundingBox != null && par0StructureBoundingBox.minY > 10; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeStairs.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeStairs.java new file mode 100644 index 0000000..fdf37a4 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeStairs.java @@ -0,0 +1,70 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeStairs extends ComponentNetherBridgePiece +{ + public ComponentNetherBridgeStairs() {} + + public ComponentNetherBridgeStairs(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentZ((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 6, 2, false); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeStairs createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -2, 0, 0, 7, 11, 7, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeStairs(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 6, 1, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 6, 10, 6, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 1, 8, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 2, 0, 6, 8, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 1, 0, 8, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 2, 1, 6, 8, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 6, 5, 8, 6, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 2, 0, 5, 4, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 3, 2, 6, 5, 2, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 3, 4, 6, 5, 4, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.netherBrick.blockID, 0, 5, 2, 5, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 2, 5, 4, 3, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 2, 5, 3, 4, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 2, 5, 2, 5, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 5, 1, 6, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 7, 1, 5, 7, 4, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 8, 2, 6, 8, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 6, 0, 4, 8, 0, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 5, 0, 4, 5, 0, Block.netherFence.blockID, Block.netherFence.blockID, false); + + for (int var4 = 0; var4 <= 6; ++var4) + { + for (int var5 = 0; var5 <= 6; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeStartPiece.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeStartPiece.java new file mode 100644 index 0000000..138824f --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeStartPiece.java @@ -0,0 +1,62 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeStartPiece extends ComponentNetherBridgeCrossing3 +{ + /** Instance of StructureNetherBridgePieceWeight. */ + public StructureNetherBridgePieceWeight theNetherBridgePieceWeight; + + /** + * Contains the list of valid piece weights for the set of nether bridge structure pieces. + */ + public List primaryWeights; + + /** + * Contains the list of valid piece weights for the secondary set of nether bridge structure pieces. + */ + public List secondaryWeights; + public ArrayList field_74967_d = new ArrayList(); + + public ComponentNetherBridgeStartPiece() {} + + public ComponentNetherBridgeStartPiece(Random par1Random, int par2, int par3) + { + super(par1Random, par2, par3); + this.primaryWeights = new ArrayList(); + StructureNetherBridgePieceWeight[] var4 = StructureNetherBridgePieces.getPrimaryComponents(); + int var5 = var4.length; + int var6; + StructureNetherBridgePieceWeight var7; + + for (var6 = 0; var6 < var5; ++var6) + { + var7 = var4[var6]; + var7.field_78827_c = 0; + this.primaryWeights.add(var7); + } + + this.secondaryWeights = new ArrayList(); + var4 = StructureNetherBridgePieces.getSecondaryComponents(); + var5 = var4.length; + + for (var6 = 0; var6 < var5; ++var6) + { + var7 = var4[var6]; + var7.field_78827_c = 0; + this.secondaryWeights.add(var7); + } + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeStraight.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeStraight.java new file mode 100644 index 0000000..c6621a9 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeStraight.java @@ -0,0 +1,68 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeStraight extends ComponentNetherBridgePiece +{ + public ComponentNetherBridgeStraight() {} + + public ComponentNetherBridgeStraight(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 1, 3, false); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeStraight createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -3, 0, 5, 10, 19, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeStraight(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 0, 4, 4, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 0, 3, 7, 18, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 0, 5, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 5, 0, 4, 5, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 4, 2, 5, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 13, 4, 2, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 1, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 15, 4, 1, 18, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + + for (int var4 = 0; var4 <= 4; ++var4) + { + for (int var5 = 0; var5 <= 2; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, 18 - var5, par3StructureBoundingBox); + } + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 1, 0, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 4, 0, 4, 4, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 14, 0, 4, 14, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 17, 0, 4, 17, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 4, 4, 1, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 4, 4, 4, 4, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 14, 4, 4, 14, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 17, 4, 4, 17, Block.netherFence.blockID, Block.netherFence.blockID, false); + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentNetherBridgeThrone.java b/src/main/java/net/minecraft/src/ComponentNetherBridgeThrone.java new file mode 100644 index 0000000..27d6258 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentNetherBridgeThrone.java @@ -0,0 +1,96 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentNetherBridgeThrone extends ComponentNetherBridgePiece +{ + private boolean hasSpawner; + + public ComponentNetherBridgeThrone() {} + + public ComponentNetherBridgeThrone(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.hasSpawner = par1NBTTagCompound.getBoolean("Mob"); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Mob", this.hasSpawner); + } + + /** + * Creates and returns a new component piece. Or null if it could not find enough room to place it. + */ + public static ComponentNetherBridgeThrone createValidComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -2, 0, 0, 7, 8, 9, par5); + return isAboveGround(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentNetherBridgeThrone(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 6, 7, 7, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 5, 1, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 1, 5, 2, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 2, 5, 3, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 3, 5, 4, 7, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 0, 1, 4, 2, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 2, 0, 5, 4, 2, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 2, 1, 5, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 5, 2, 5, 5, 3, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 3, 0, 5, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 5, 3, 6, 5, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 8, 5, 5, 8, Block.netherBrick.blockID, Block.netherBrick.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 1, 6, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.netherFence.blockID, 0, 5, 6, 3, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 3, 0, 6, 8, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 6, 3, 6, 6, 8, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 6, 8, 5, 7, 8, Block.netherFence.blockID, Block.netherFence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 8, 8, 4, 8, 8, Block.netherFence.blockID, Block.netherFence.blockID, false); + int var4; + int var5; + + if (!this.hasSpawner) + { + var4 = this.getYWithOffset(5); + var5 = this.getXWithOffset(3, 5); + int var6 = this.getZWithOffset(3, 5); + + if (par3StructureBoundingBox.isVecInside(var5, var4, var6)) + { + this.hasSpawner = true; + par1World.setBlock(var5, var4, var6, Block.mobSpawner.blockID, 0, 2); + TileEntityMobSpawner var7 = (TileEntityMobSpawner)par1World.getBlockTileEntity(var5, var4, var6); + + if (var7 != null) + { + var7.getSpawnerLogic().setMobID("Blaze"); + } + } + } + + for (var4 = 0; var4 <= 6; ++var4) + { + for (var5 = 0; var5 <= 6; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.netherBrick.blockID, 0, var4, -1, var5, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentScatteredFeature.java b/src/main/java/net/minecraft/src/ComponentScatteredFeature.java new file mode 100644 index 0000000..cdc0477 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentScatteredFeature.java @@ -0,0 +1,90 @@ +package net.minecraft.src; + +import java.util.Random; + +abstract class ComponentScatteredFeature extends StructureComponent +{ + /** The size of the bounding box for this feature in the X axis */ + protected int scatteredFeatureSizeX; + + /** The size of the bounding box for this feature in the Y axis */ + protected int scatteredFeatureSizeY; + + /** The size of the bounding box for this feature in the Z axis */ + protected int scatteredFeatureSizeZ; + protected int field_74936_d = -1; + + public ComponentScatteredFeature() {} + + protected ComponentScatteredFeature(Random par1Random, int par2, int par3, int par4, int par5, int par6, int par7) + { + super(0); + this.scatteredFeatureSizeX = par5; + this.scatteredFeatureSizeY = par6; + this.scatteredFeatureSizeZ = par7; + this.coordBaseMode = par1Random.nextInt(4); + + switch (this.coordBaseMode) + { + case 0: + case 2: + this.boundingBox = new StructureBoundingBox(par2, par3, par4, par2 + par5 - 1, par3 + par6 - 1, par4 + par7 - 1); + break; + + default: + this.boundingBox = new StructureBoundingBox(par2, par3, par4, par2 + par7 - 1, par3 + par6 - 1, par4 + par5 - 1); + } + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setInteger("Width", this.scatteredFeatureSizeX); + par1NBTTagCompound.setInteger("Height", this.scatteredFeatureSizeY); + par1NBTTagCompound.setInteger("Depth", this.scatteredFeatureSizeZ); + par1NBTTagCompound.setInteger("HPos", this.field_74936_d); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + this.scatteredFeatureSizeX = par1NBTTagCompound.getInteger("Width"); + this.scatteredFeatureSizeY = par1NBTTagCompound.getInteger("Height"); + this.scatteredFeatureSizeZ = par1NBTTagCompound.getInteger("Depth"); + this.field_74936_d = par1NBTTagCompound.getInteger("HPos"); + } + + protected boolean func_74935_a(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3) + { + if (this.field_74936_d >= 0) + { + return true; + } + else + { + int var4 = 0; + int var5 = 0; + + for (int var6 = this.boundingBox.minZ; var6 <= this.boundingBox.maxZ; ++var6) + { + for (int var7 = this.boundingBox.minX; var7 <= this.boundingBox.maxX; ++var7) + { + if (par2StructureBoundingBox.isVecInside(var7, 64, var6)) + { + var4 += Math.max(par1World.getTopSolidOrLiquidBlock(var7, var6), par1World.provider.getAverageGroundLevel()); + ++var5; + } + } + } + + if (var5 == 0) + { + return false; + } + else + { + this.field_74936_d = var4 / var5; + this.boundingBox.offset(0, this.field_74936_d - this.boundingBox.minY + par3, 0); + return true; + } + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentScatteredFeatureDesertPyramid.java b/src/main/java/net/minecraft/src/ComponentScatteredFeatureDesertPyramid.java new file mode 100644 index 0000000..c56d494 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentScatteredFeatureDesertPyramid.java @@ -0,0 +1,245 @@ +package net.minecraft.src; + +import java.util.Random; + +public class ComponentScatteredFeatureDesertPyramid extends ComponentScatteredFeature +{ + private boolean[] field_74940_h = new boolean[4]; + + /** List of items to generate in chests of Temples. */ + private static final WeightedRandomChestContent[] itemsToGenerateInTemple = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.diamond.itemID, 0, 1, 3, 3), new WeightedRandomChestContent(Item.ingotIron.itemID, 0, 1, 5, 10), new WeightedRandomChestContent(Item.ingotGold.itemID, 0, 2, 7, 15), new WeightedRandomChestContent(Item.emerald.itemID, 0, 1, 3, 2), new WeightedRandomChestContent(Item.bone.itemID, 0, 4, 6, 20), new WeightedRandomChestContent(Item.rottenFlesh.itemID, 0, 3, 7, 16), new WeightedRandomChestContent(Item.saddle.itemID, 0, 1, 1, 3), new WeightedRandomChestContent(Item.horseArmorIron.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Item.horseArmorGold.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Item.horseArmorDiamond.itemID, 0, 1, 1, 1)}; + + public ComponentScatteredFeatureDesertPyramid() {} + + public ComponentScatteredFeatureDesertPyramid(Random par1Random, int par2, int par3) + { + super(par1Random, par2, 64, par3, 21, 15, 21); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("hasPlacedChest0", this.field_74940_h[0]); + par1NBTTagCompound.setBoolean("hasPlacedChest1", this.field_74940_h[1]); + par1NBTTagCompound.setBoolean("hasPlacedChest2", this.field_74940_h[2]); + par1NBTTagCompound.setBoolean("hasPlacedChest3", this.field_74940_h[3]); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.field_74940_h[0] = par1NBTTagCompound.getBoolean("hasPlacedChest0"); + this.field_74940_h[1] = par1NBTTagCompound.getBoolean("hasPlacedChest1"); + this.field_74940_h[2] = par1NBTTagCompound.getBoolean("hasPlacedChest2"); + this.field_74940_h[3] = par1NBTTagCompound.getBoolean("hasPlacedChest3"); + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, -4, 0, this.scatteredFeatureSizeX - 1, 0, this.scatteredFeatureSizeZ - 1, Block.sandStone.blockID, Block.sandStone.blockID, false); + int var4; + + for (var4 = 1; var4 <= 9; ++var4) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, var4, var4, var4, this.scatteredFeatureSizeX - 1 - var4, var4, this.scatteredFeatureSizeZ - 1 - var4, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, var4 + 1, var4, var4 + 1, this.scatteredFeatureSizeX - 2 - var4, var4, this.scatteredFeatureSizeZ - 2 - var4, 0, 0, false); + } + + int var5; + + for (var4 = 0; var4 < this.scatteredFeatureSizeX; ++var4) + { + for (var5 = 0; var5 < this.scatteredFeatureSizeZ; ++var5) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.sandStone.blockID, 0, var4, -5, var5, par3StructureBoundingBox); + } + } + + var4 = this.getMetadataWithOffset(Block.stairsSandStone.blockID, 3); + var5 = this.getMetadataWithOffset(Block.stairsSandStone.blockID, 2); + int var6 = this.getMetadataWithOffset(Block.stairsSandStone.blockID, 0); + int var7 = this.getMetadataWithOffset(Block.stairsSandStone.blockID, 1); + byte var8 = 1; + byte var9 = 11; + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 9, 4, Block.sandStone.blockID, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 10, 1, 3, 10, 3, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var4, 2, 10, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var5, 2, 10, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var6, 0, 10, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var7, 4, 10, 2, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 5, 0, 0, this.scatteredFeatureSizeX - 1, 9, 4, Block.sandStone.blockID, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 4, 10, 1, this.scatteredFeatureSizeX - 2, 10, 3, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var4, this.scatteredFeatureSizeX - 3, 10, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var5, this.scatteredFeatureSizeX - 3, 10, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var6, this.scatteredFeatureSizeX - 5, 10, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var7, this.scatteredFeatureSizeX - 1, 10, 2, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 0, 0, 12, 4, 4, Block.sandStone.blockID, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 1, 0, 11, 3, 4, 0, 0, false); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 9, 1, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 9, 2, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 9, 3, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 10, 3, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 11, 3, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 11, 2, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 11, 1, 1, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 8, 3, 3, Block.sandStone.blockID, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 2, 8, 2, 2, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 1, 1, 16, 3, 3, Block.sandStone.blockID, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 1, 2, 16, 2, 2, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 4, 5, this.scatteredFeatureSizeX - 6, 4, this.scatteredFeatureSizeZ - 6, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 4, 9, 11, 4, 11, 0, 0, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, 1, 8, 8, 3, 8, Block.sandStone.blockID, 2, Block.sandStone.blockID, 2, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 12, 1, 8, 12, 3, 8, Block.sandStone.blockID, 2, Block.sandStone.blockID, 2, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, 1, 12, 8, 3, 12, Block.sandStone.blockID, 2, Block.sandStone.blockID, 2, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 12, 1, 12, 12, 3, 12, Block.sandStone.blockID, 2, Block.sandStone.blockID, 2, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 5, 4, 4, 11, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 5, 1, 5, this.scatteredFeatureSizeX - 2, 4, 11, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 7, 9, 6, 7, 11, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 7, 7, 9, this.scatteredFeatureSizeX - 7, 7, 11, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 5, 5, 9, 5, 7, 11, Block.sandStone.blockID, 2, Block.sandStone.blockID, 2, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 6, 5, 9, this.scatteredFeatureSizeX - 6, 7, 11, Block.sandStone.blockID, 2, Block.sandStone.blockID, 2, false); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 5, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 6, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 6, 6, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, this.scatteredFeatureSizeX - 6, 5, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, this.scatteredFeatureSizeX - 6, 6, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, this.scatteredFeatureSizeX - 7, 6, 10, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 4, 4, 2, 6, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 3, 4, 4, this.scatteredFeatureSizeX - 3, 6, 4, 0, 0, false); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var4, 2, 4, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var4, 2, 3, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var4, this.scatteredFeatureSizeX - 3, 4, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var4, this.scatteredFeatureSizeX - 3, 3, 4, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 3, 2, 2, 3, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 3, 1, 3, this.scatteredFeatureSizeX - 2, 2, 3, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, 0, 1, 1, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, 0, this.scatteredFeatureSizeX - 2, 1, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 1, 1, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 1, this.scatteredFeatureSizeX - 2, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var7, 2, 1, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsSandStone.blockID, var6, this.scatteredFeatureSizeX - 3, 1, 2, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 3, 5, 4, 3, 18, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 5, 3, 5, this.scatteredFeatureSizeX - 5, 3, 17, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 1, 5, 4, 2, 16, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, this.scatteredFeatureSizeX - 6, 1, 5, this.scatteredFeatureSizeX - 5, 2, 16, 0, 0, false); + int var10; + + for (var10 = 5; var10 <= 17; var10 += 2) + { + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 4, 1, var10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, 4, 2, var10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, this.scatteredFeatureSizeX - 5, 1, var10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, this.scatteredFeatureSizeX - 5, 2, var10, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 10, 0, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 10, 0, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 9, 0, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 11, 0, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 8, 0, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 12, 0, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 7, 0, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 13, 0, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 9, 0, 11, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 11, 0, 11, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 10, 0, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 10, 0, 13, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var9, 10, 0, 10, par3StructureBoundingBox); + + for (var10 = 0; var10 <= this.scatteredFeatureSizeX - 1; var10 += this.scatteredFeatureSizeX - 1) + { + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10, 2, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10, 3, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 3, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10, 3, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 4, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, var10, 4, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 4, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10, 5, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 5, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10, 5, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 6, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, var10, 6, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 6, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 7, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 7, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 7, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10, 8, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10, 8, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10, 8, 3, par3StructureBoundingBox); + } + + for (var10 = 2; var10 <= this.scatteredFeatureSizeX - 3; var10 += this.scatteredFeatureSizeX - 3 - 2) + { + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10 - 1, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10 + 1, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10 - 1, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10 + 1, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10 - 1, 4, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, var10, 4, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10 + 1, 4, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10 - 1, 5, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 5, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10 + 1, 5, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10 - 1, 6, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, var10, 6, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10 + 1, 6, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10 - 1, 7, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10, 7, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, var10 + 1, 7, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10 - 1, 8, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10, 8, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, var10 + 1, 8, 0, par3StructureBoundingBox); + } + + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, 4, 0, 12, 6, 0, Block.sandStone.blockID, 2, Block.sandStone.blockID, 2, false); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 8, 6, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, 6, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 9, 5, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, 10, 5, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, var8, 11, 5, 0, par3StructureBoundingBox); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, -14, 8, 12, -11, 12, Block.sandStone.blockID, 2, Block.sandStone.blockID, 2, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, -10, 8, 12, -10, 12, Block.sandStone.blockID, 1, Block.sandStone.blockID, 1, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 8, -9, 8, 12, -9, 12, Block.sandStone.blockID, 2, Block.sandStone.blockID, 2, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, -8, 8, 12, -1, 12, Block.sandStone.blockID, Block.sandStone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, -11, 9, 11, -1, 11, 0, 0, false); + this.placeBlockAtCurrentPosition(par1World, Block.pressurePlateStone.blockID, 0, 10, -11, 10, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, -13, 9, 11, -13, 11, Block.tnt.blockID, 0, false); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 8, -11, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 8, -10, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, 7, -10, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 7, -11, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, -11, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, -10, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, 13, -10, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 13, -11, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -11, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -10, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, 10, -10, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 10, -11, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -11, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, -10, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 1, 10, -10, 13, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.sandStone.blockID, 2, 10, -11, 13, par3StructureBoundingBox); + + for (var10 = 0; var10 < 4; ++var10) + { + if (!this.field_74940_h[var10]) + { + int var11 = Direction.offsetX[var10] * 2; + int var12 = Direction.offsetZ[var10] * 2; + this.field_74940_h[var10] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + var11, -11, 10 + var12, WeightedRandomChestContent.func_92080_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5)); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentScatteredFeatureJunglePyramid.java b/src/main/java/net/minecraft/src/ComponentScatteredFeatureJunglePyramid.java new file mode 100644 index 0000000..67da175 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentScatteredFeatureJunglePyramid.java @@ -0,0 +1,248 @@ +package net.minecraft.src; + +import java.util.Random; + +public class ComponentScatteredFeatureJunglePyramid extends ComponentScatteredFeature +{ + private boolean field_74947_h; + private boolean field_74948_i; + private boolean field_74945_j; + private boolean field_74946_k; + + /** List of Chest contents to be generated in the Jungle Pyramid chests. */ + private static final WeightedRandomChestContent[] junglePyramidsChestContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.diamond.itemID, 0, 1, 3, 3), new WeightedRandomChestContent(Item.ingotIron.itemID, 0, 1, 5, 10), new WeightedRandomChestContent(Item.ingotGold.itemID, 0, 2, 7, 15), new WeightedRandomChestContent(Item.emerald.itemID, 0, 1, 3, 2), new WeightedRandomChestContent(Item.bone.itemID, 0, 4, 6, 20), new WeightedRandomChestContent(Item.rottenFlesh.itemID, 0, 3, 7, 16), new WeightedRandomChestContent(Item.saddle.itemID, 0, 1, 1, 3), new WeightedRandomChestContent(Item.horseArmorIron.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Item.horseArmorGold.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Item.horseArmorDiamond.itemID, 0, 1, 1, 1)}; + + /** + * List of Dispenser contents to be generated in the Jungle Pyramid dispensers. + */ + private static final WeightedRandomChestContent[] junglePyramidsDispenserContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.arrow.itemID, 0, 2, 7, 30)}; + + /** List of random stones to be generated in the Jungle Pyramid. */ + private static StructureScatteredFeatureStones junglePyramidsRandomScatteredStones = new StructureScatteredFeatureStones((ComponentScatteredFeaturePieces2)null); + + public ComponentScatteredFeatureJunglePyramid() {} + + public ComponentScatteredFeatureJunglePyramid(Random par1Random, int par2, int par3) + { + super(par1Random, par2, 64, par3, 12, 10, 15); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("placedMainChest", this.field_74947_h); + par1NBTTagCompound.setBoolean("placedHiddenChest", this.field_74948_i); + par1NBTTagCompound.setBoolean("placedTrap1", this.field_74945_j); + par1NBTTagCompound.setBoolean("placedTrap2", this.field_74946_k); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.field_74947_h = par1NBTTagCompound.getBoolean("placedMainChest"); + this.field_74948_i = par1NBTTagCompound.getBoolean("placedHiddenChest"); + this.field_74945_j = par1NBTTagCompound.getBoolean("placedTrap1"); + this.field_74946_k = par1NBTTagCompound.getBoolean("placedTrap2"); + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (!this.func_74935_a(par1World, par3StructureBoundingBox, 0)) + { + return false; + } + else + { + int var4 = this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3); + int var5 = this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 2); + int var6 = this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 0); + int var7 = this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 1); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, -4, 0, this.scatteredFeatureSizeX - 1, 0, this.scatteredFeatureSizeZ - 1, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, 1, 2, 9, 2, 2, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, 1, 12, 9, 2, 12, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, 1, 3, 2, 2, 11, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 9, 1, 3, 9, 2, 11, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, 3, 1, 10, 6, 1, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, 3, 13, 10, 6, 13, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, 3, 2, 1, 6, 12, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 10, 3, 2, 10, 6, 12, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, 3, 2, 9, 3, 12, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, 6, 2, 9, 6, 12, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 3, 7, 3, 8, 7, 11, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 8, 4, 7, 8, 10, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithAir(par1World, par3StructureBoundingBox, 3, 1, 3, 8, 2, 11); + this.fillWithAir(par1World, par3StructureBoundingBox, 4, 3, 6, 7, 3, 9); + this.fillWithAir(par1World, par3StructureBoundingBox, 2, 4, 2, 9, 5, 12); + this.fillWithAir(par1World, par3StructureBoundingBox, 4, 6, 5, 7, 6, 9); + this.fillWithAir(par1World, par3StructureBoundingBox, 5, 7, 6, 6, 7, 8); + this.fillWithAir(par1World, par3StructureBoundingBox, 5, 1, 2, 6, 2, 2); + this.fillWithAir(par1World, par3StructureBoundingBox, 5, 2, 12, 6, 2, 12); + this.fillWithAir(par1World, par3StructureBoundingBox, 5, 5, 1, 6, 5, 1); + this.fillWithAir(par1World, par3StructureBoundingBox, 5, 5, 13, 6, 5, 13); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 5, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, 5, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 5, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 10, 5, 9, par3StructureBoundingBox); + int var8; + + for (var8 = 0; var8 <= 14; var8 += 14) + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, 4, var8, 2, 5, var8, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 4, var8, 4, 5, var8, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 7, 4, var8, 7, 5, var8, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 9, 4, var8, 9, 5, var8, false, par2Random, junglePyramidsRandomScatteredStones); + } + + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 5, 6, 0, 6, 6, 0, false, par2Random, junglePyramidsRandomScatteredStones); + + for (var8 = 0; var8 <= 11; var8 += 11) + { + for (int var9 = 2; var9 <= 12; var9 += 2) + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, var8, 4, var9, var8, 5, var9, false, par2Random, junglePyramidsRandomScatteredStones); + } + + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, var8, 6, 5, var8, 6, 5, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, var8, 6, 9, var8, 6, 9, false, par2Random, junglePyramidsRandomScatteredStones); + } + + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, 7, 2, 2, 9, 2, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 9, 7, 2, 9, 9, 2, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, 7, 12, 2, 9, 12, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 9, 7, 12, 9, 9, 12, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 9, 4, 4, 9, 4, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 7, 9, 4, 7, 9, 4, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 9, 10, 4, 9, 10, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 7, 9, 10, 7, 9, 10, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 5, 9, 7, 6, 9, 7, false, par2Random, junglePyramidsRandomScatteredStones); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 5, 9, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 6, 9, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var5, 5, 9, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var5, 6, 9, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 4, 0, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 5, 0, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 6, 0, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 7, 0, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 4, 1, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 4, 2, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 4, 3, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 7, 1, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 7, 2, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 7, 3, 10, par3StructureBoundingBox); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 1, 9, 4, 1, 9, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 7, 1, 9, 7, 1, 9, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 1, 10, 7, 2, 10, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 5, 4, 5, 6, 4, 5, false, par2Random, junglePyramidsRandomScatteredStones); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var6, 4, 4, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var7, 7, 4, 5, par3StructureBoundingBox); + + for (var8 = 0; var8 < 4; ++var8) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var5, 5, 0 - var8, 6 + var8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var5, 6, 0 - var8, 6 + var8, par3StructureBoundingBox); + this.fillWithAir(par1World, par3StructureBoundingBox, 5, 0 - var8, 7 + var8, 6, 0 - var8, 9 + var8); + } + + this.fillWithAir(par1World, par3StructureBoundingBox, 1, -3, 12, 10, -1, 13); + this.fillWithAir(par1World, par3StructureBoundingBox, 1, -3, 1, 3, -1, 13); + this.fillWithAir(par1World, par3StructureBoundingBox, 1, -3, 1, 9, -1, 5); + + for (var8 = 1; var8 <= 13; var8 += 2) + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, -3, var8, 1, -2, var8, false, par2Random, junglePyramidsRandomScatteredStones); + } + + for (var8 = 2; var8 <= 12; var8 += 2) + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, -1, var8, 3, -1, var8, false, par2Random, junglePyramidsRandomScatteredStones); + } + + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, -2, 1, 5, -2, 1, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 7, -2, 1, 9, -2, 1, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 6, -3, 1, 6, -3, 1, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 6, -1, 1, 6, -1, 1, false, par2Random, junglePyramidsRandomScatteredStones); + this.placeBlockAtCurrentPosition(par1World, Block.tripWireSource.blockID, this.getMetadataWithOffset(Block.tripWireSource.blockID, 3) | 4, 1, -3, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.tripWireSource.blockID, this.getMetadataWithOffset(Block.tripWireSource.blockID, 1) | 4, 4, -3, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.tripWire.blockID, 4, 2, -3, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.tripWire.blockID, 4, 3, -3, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 5, -3, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 5, -3, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 5, -3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 5, -3, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 5, -3, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 5, -3, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 5, -3, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 4, -3, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 3, -3, 1, par3StructureBoundingBox); + + if (!this.field_74945_j) + { + this.field_74945_j = this.generateStructureDispenserContents(par1World, par3StructureBoundingBox, par2Random, 3, -2, 1, 2, junglePyramidsDispenserContents, 2); + } + + this.placeBlockAtCurrentPosition(par1World, Block.vine.blockID, 15, 3, -2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.tripWireSource.blockID, this.getMetadataWithOffset(Block.tripWireSource.blockID, 2) | 4, 7, -3, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.tripWireSource.blockID, this.getMetadataWithOffset(Block.tripWireSource.blockID, 0) | 4, 7, -3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.tripWire.blockID, 4, 7, -3, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.tripWire.blockID, 4, 7, -3, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.tripWire.blockID, 4, 7, -3, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 8, -3, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 9, -3, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 9, -3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 9, -3, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 9, -2, 4, par3StructureBoundingBox); + + if (!this.field_74946_k) + { + this.field_74946_k = this.generateStructureDispenserContents(par1World, par3StructureBoundingBox, par2Random, 9, -2, 3, 4, junglePyramidsDispenserContents, 2); + } + + this.placeBlockAtCurrentPosition(par1World, Block.vine.blockID, 15, 8, -1, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.vine.blockID, 15, 8, -2, 3, par3StructureBoundingBox); + + if (!this.field_74947_h) + { + this.field_74947_h = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 8, -3, 3, WeightedRandomChestContent.func_92080_a(junglePyramidsChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5)); + } + + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 9, -3, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 8, -3, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 4, -3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 5, -2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 5, -1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 6, -3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 7, -2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 7, -1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 8, -3, 5, par3StructureBoundingBox); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 9, -1, 1, 9, -1, 5, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithAir(par1World, par3StructureBoundingBox, 8, -3, 8, 10, -1, 10); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 3, 8, -2, 11, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 3, 9, -2, 11, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 3, 10, -2, 11, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.lever.blockID, BlockLever.invertMetadata(this.getMetadataWithOffset(Block.lever.blockID, 2)), 8, -2, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.lever.blockID, BlockLever.invertMetadata(this.getMetadataWithOffset(Block.lever.blockID, 2)), 9, -2, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.lever.blockID, BlockLever.invertMetadata(this.getMetadataWithOffset(Block.lever.blockID, 2)), 10, -2, 12, par3StructureBoundingBox); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 8, -3, 8, 8, -3, 10, false, par2Random, junglePyramidsRandomScatteredStones); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 10, -3, 8, 10, -3, 10, false, par2Random, junglePyramidsRandomScatteredStones); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestoneMossy.blockID, 0, 10, -2, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 8, -2, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 8, -2, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneWire.blockID, 0, 10, -1, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.pistonStickyBase.blockID, 1, 9, -2, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.pistonStickyBase.blockID, this.getMetadataWithOffset(Block.pistonStickyBase.blockID, 4), 10, -2, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.pistonStickyBase.blockID, this.getMetadataWithOffset(Block.pistonStickyBase.blockID, 4), 10, -1, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.redstoneRepeaterIdle.blockID, this.getMetadataWithOffset(Block.redstoneRepeaterIdle.blockID, 2), 10, -2, 10, par3StructureBoundingBox); + + if (!this.field_74948_i) + { + this.field_74948_i = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 9, -3, 10, WeightedRandomChestContent.func_92080_a(junglePyramidsChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5)); + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentScatteredFeaturePieces.java b/src/main/java/net/minecraft/src/ComponentScatteredFeaturePieces.java new file mode 100644 index 0000000..d39749b --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentScatteredFeaturePieces.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public class ComponentScatteredFeaturePieces +{ + public static void func_143045_a() + { + MapGenStructureIO.func_143031_a(ComponentScatteredFeatureDesertPyramid.class, "TeDP"); + MapGenStructureIO.func_143031_a(ComponentScatteredFeatureJunglePyramid.class, "TeJP"); + MapGenStructureIO.func_143031_a(ComponentScatteredFeatureSwampHut.class, "TeSH"); + } +} diff --git a/src/main/java/net/minecraft/src/ComponentScatteredFeaturePieces2.java b/src/main/java/net/minecraft/src/ComponentScatteredFeaturePieces2.java new file mode 100644 index 0000000..16db7da --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentScatteredFeaturePieces2.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +class ComponentScatteredFeaturePieces2 +{ +} diff --git a/src/main/java/net/minecraft/src/ComponentScatteredFeatureSwampHut.java b/src/main/java/net/minecraft/src/ComponentScatteredFeatureSwampHut.java new file mode 100644 index 0000000..4049f97 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentScatteredFeatureSwampHut.java @@ -0,0 +1,100 @@ +package net.minecraft.src; + +import java.util.Random; + +public class ComponentScatteredFeatureSwampHut extends ComponentScatteredFeature +{ + /** Whether this swamp hut has a witch. */ + private boolean hasWitch; + + public ComponentScatteredFeatureSwampHut() {} + + public ComponentScatteredFeatureSwampHut(Random par1Random, int par2, int par3) + { + super(par1Random, par2, 64, par3, 7, 5, 9); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Witch", this.hasWitch); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.hasWitch = par1NBTTagCompound.getBoolean("Witch"); + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (!this.func_74935_a(par1World, par3StructureBoundingBox, 0)) + { + return false; + } + else + { + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 5, 1, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 4, 2, 5, 4, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 1, 0, 4, 1, 0, Block.planks.blockID, 1, Block.planks.blockID, 1, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 2, 2, 3, 3, 2, Block.planks.blockID, 1, Block.planks.blockID, 1, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 1, 2, 3, 1, 3, 6, Block.planks.blockID, 1, Block.planks.blockID, 1, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 5, 2, 3, 5, 3, 6, Block.planks.blockID, 1, Block.planks.blockID, 1, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 2, 2, 7, 4, 3, 7, Block.planks.blockID, 1, Block.planks.blockID, 1, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 2, 1, 3, 2, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 0, 2, 5, 3, 2, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 7, 1, 3, 7, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 0, 7, 5, 3, 7, Block.wood.blockID, Block.wood.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 2, 3, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 3, 3, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 3, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 3, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 5, 3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.flowerPot.blockID, 7, 1, 3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.workbench.blockID, 0, 3, 2, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cauldron.blockID, 0, 4, 2, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 2, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 5, 2, 1, par3StructureBoundingBox); + int var4 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3); + int var5 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 1); + int var6 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 0); + int var7 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 2); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 1, 6, 4, 1, Block.stairsWoodSpruce.blockID, var4, Block.stairsWoodSpruce.blockID, var4, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 2, 0, 4, 7, Block.stairsWoodSpruce.blockID, var6, Block.stairsWoodSpruce.blockID, var6, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 6, 4, 2, 6, 4, 7, Block.stairsWoodSpruce.blockID, var5, Block.stairsWoodSpruce.blockID, var5, false); + this.fillWithMetadataBlocks(par1World, par3StructureBoundingBox, 0, 4, 8, 6, 4, 8, Block.stairsWoodSpruce.blockID, var7, Block.stairsWoodSpruce.blockID, var7, false); + int var8; + int var9; + + for (var8 = 2; var8 <= 7; var8 += 5) + { + for (var9 = 1; var9 <= 5; var9 += 4) + { + this.fillCurrentPositionBlocksDownwards(par1World, Block.wood.blockID, 0, var9, -1, var8, par3StructureBoundingBox); + } + } + + if (!this.hasWitch) + { + var8 = this.getXWithOffset(2, 5); + var9 = this.getYWithOffset(2); + int var10 = this.getZWithOffset(2, 5); + + if (par3StructureBoundingBox.isVecInside(var8, var9, var10)) + { + this.hasWitch = true; + EntityWitch var11 = new EntityWitch(par1World); + var11.setLocationAndAngles((double)var8 + 0.5D, (double)var9, (double)var10 + 0.5D, 0.0F, 0.0F); + var11.onSpawnWithEgg((EntityLivingData)null); + par1World.spawnEntityInWorld(var11); + } + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStronghold.java b/src/main/java/net/minecraft/src/ComponentStronghold.java new file mode 100644 index 0000000..57ff08a --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStronghold.java @@ -0,0 +1,183 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +abstract class ComponentStronghold extends StructureComponent +{ + protected EnumDoor field_143013_d; + + public ComponentStronghold() + { + this.field_143013_d = EnumDoor.OPENING; + } + + protected ComponentStronghold(int par1) + { + super(par1); + this.field_143013_d = EnumDoor.OPENING; + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setString("EntryDoor", this.field_143013_d.name()); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + this.field_143013_d = EnumDoor.valueOf(par1NBTTagCompound.getString("EntryDoor")); + } + + /** + * builds a door of the enumerated types (empty opening is a door) + */ + protected void placeDoor(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox, EnumDoor par4EnumDoor, int par5, int par6, int par7) + { + switch (EnumDoorHelper.doorEnum[par4EnumDoor.ordinal()]) + { + case 1: + default: + this.fillWithBlocks(par1World, par3StructureBoundingBox, par5, par6, par7, par5 + 3 - 1, par6 + 3 - 1, par7, 0, 0, false); + break; + + case 2: + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5, par6, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5, par6 + 1, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5, par6 + 2, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5 + 1, par6 + 2, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5 + 2, par6 + 2, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5 + 2, par6 + 1, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5 + 2, par6, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.doorWood.blockID, 0, par5 + 1, par6, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.doorWood.blockID, 8, par5 + 1, par6 + 1, par7, par3StructureBoundingBox); + break; + + case 3: + this.placeBlockAtCurrentPosition(par1World, 0, 0, par5 + 1, par6, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, par5 + 1, par6 + 1, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fenceIron.blockID, 0, par5, par6, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fenceIron.blockID, 0, par5, par6 + 1, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fenceIron.blockID, 0, par5, par6 + 2, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fenceIron.blockID, 0, par5 + 1, par6 + 2, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fenceIron.blockID, 0, par5 + 2, par6 + 2, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fenceIron.blockID, 0, par5 + 2, par6 + 1, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fenceIron.blockID, 0, par5 + 2, par6, par7, par3StructureBoundingBox); + break; + + case 4: + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5, par6, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5, par6 + 1, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5, par6 + 2, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5 + 1, par6 + 2, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5 + 2, par6 + 2, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5 + 2, par6 + 1, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, par5 + 2, par6, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.doorIron.blockID, 0, par5 + 1, par6, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.doorIron.blockID, 8, par5 + 1, par6 + 1, par7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneButton.blockID, this.getMetadataWithOffset(Block.stoneButton.blockID, 4), par5 + 2, par6 + 1, par7 + 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneButton.blockID, this.getMetadataWithOffset(Block.stoneButton.blockID, 3), par5 + 2, par6 + 1, par7 - 1, par3StructureBoundingBox); + } + } + + protected EnumDoor getRandomDoor(Random par1Random) + { + int var2 = par1Random.nextInt(5); + + switch (var2) + { + case 0: + case 1: + default: + return EnumDoor.OPENING; + + case 2: + return EnumDoor.WOOD_DOOR; + + case 3: + return EnumDoor.GRATES; + + case 4: + return EnumDoor.IRON_DOOR; + } + } + + /** + * Gets the next component in any cardinal direction + */ + protected StructureComponent getNextComponentNormal(ComponentStrongholdStairs2 par1ComponentStrongholdStairs2, List par2List, Random par3Random, int par4, int par5) + { + switch (this.coordBaseMode) + { + case 0: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.minX + par4, this.boundingBox.minY + par5, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType()); + + case 1: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + par5, this.boundingBox.minZ + par4, this.coordBaseMode, this.getComponentType()); + + case 2: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.minX + par4, this.boundingBox.minY + par5, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType()); + + case 3: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + par5, this.boundingBox.minZ + par4, this.coordBaseMode, this.getComponentType()); + + default: + return null; + } + } + + /** + * Gets the next component in the +/- X direction + */ + protected StructureComponent getNextComponentX(ComponentStrongholdStairs2 par1ComponentStrongholdStairs2, List par2List, Random par3Random, int par4, int par5) + { + switch (this.coordBaseMode) + { + case 0: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 1, this.getComponentType()); + + case 1: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.minZ - 1, 2, this.getComponentType()); + + case 2: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 1, this.getComponentType()); + + case 3: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.minZ - 1, 2, this.getComponentType()); + + default: + return null; + } + } + + /** + * Gets the next component in the +/- Z direction + */ + protected StructureComponent getNextComponentZ(ComponentStrongholdStairs2 par1ComponentStrongholdStairs2, List par2List, Random par3Random, int par4, int par5) + { + switch (this.coordBaseMode) + { + case 0: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 3, this.getComponentType()); + + case 1: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + + case 2: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 3, this.getComponentType()); + + case 3: + return StructureStrongholdPieces.getNextValidComponentAccess(par1ComponentStrongholdStairs2, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + + default: + return null; + } + } + + /** + * returns false if the Structure Bounding Box goes below 10 + */ + protected static boolean canStrongholdGoDeeper(StructureBoundingBox par0StructureBoundingBox) + { + return par0StructureBoundingBox != null && par0StructureBoundingBox.minY > 10; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdChestCorridor.java b/src/main/java/net/minecraft/src/ComponentStrongholdChestCorridor.java new file mode 100644 index 0000000..7d688c6 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdChestCorridor.java @@ -0,0 +1,91 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdChestCorridor extends ComponentStronghold +{ + /** List of items that Stronghold chests can contain. */ + private static final WeightedRandomChestContent[] strongholdChestContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.enderPearl.itemID, 0, 1, 1, 10), new WeightedRandomChestContent(Item.diamond.itemID, 0, 1, 3, 3), new WeightedRandomChestContent(Item.ingotIron.itemID, 0, 1, 5, 10), new WeightedRandomChestContent(Item.ingotGold.itemID, 0, 1, 3, 5), new WeightedRandomChestContent(Item.redstone.itemID, 0, 4, 9, 5), new WeightedRandomChestContent(Item.bread.itemID, 0, 1, 3, 15), new WeightedRandomChestContent(Item.appleRed.itemID, 0, 1, 3, 15), new WeightedRandomChestContent(Item.pickaxeIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.swordIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.plateIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.helmetIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.legsIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.bootsIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.appleGold.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Item.saddle.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Item.horseArmorIron.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Item.horseArmorGold.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Item.horseArmorDiamond.itemID, 0, 1, 1, 1)}; + private boolean hasMadeChest; + + public ComponentStrongholdChestCorridor() {} + + public ComponentStrongholdChestCorridor(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.field_143013_d = this.getRandomDoor(par2Random); + this.boundingBox = par3StructureBoundingBox; + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Chest", this.hasMadeChest); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.hasMadeChest = par1NBTTagCompound.getBoolean("Chest"); + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1); + } + + public static ComponentStrongholdChestCorridor findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, 7, par5); + return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdChestCorridor(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 4, 6, true, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.field_143013_d, 1, 1, 0); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, EnumDoor.OPENING, 1, 1, 6); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 1, 2, 3, 1, 4, Block.stoneBrick.blockID, Block.stoneBrick.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 5, 3, 1, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 5, 3, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 5, 3, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 5, 3, 2, 4, par3StructureBoundingBox); + int var4; + + for (var4 = 2; var4 <= 4; ++var4) + { + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 5, 2, 1, var4, par3StructureBoundingBox); + } + + if (!this.hasMadeChest) + { + var4 = this.getYWithOffset(2); + int var5 = this.getXWithOffset(3, 3); + int var6 = this.getZWithOffset(3, 3); + + if (par3StructureBoundingBox.isVecInside(var5, var4, var6)) + { + this.hasMadeChest = true; + this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 2, 3, WeightedRandomChestContent.func_92080_a(strongholdChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(2)); + } + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdCorridor.java b/src/main/java/net/minecraft/src/ComponentStrongholdCorridor.java new file mode 100644 index 0000000..9cfaf5f --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdCorridor.java @@ -0,0 +1,100 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdCorridor extends ComponentStronghold +{ + private int field_74993_a; + + public ComponentStrongholdCorridor() {} + + public ComponentStrongholdCorridor(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + this.field_74993_a = par4 != 2 && par4 != 0 ? par3StructureBoundingBox.getXSize() : par3StructureBoundingBox.getZSize(); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setInteger("Steps", this.field_74993_a); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.field_74993_a = par1NBTTagCompound.getInteger("Steps"); + } + + public static StructureBoundingBox func_74992_a(List par0List, Random par1Random, int par2, int par3, int par4, int par5) + { + boolean var6 = true; + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, 4, par5); + StructureComponent var8 = StructureComponent.findIntersecting(par0List, var7); + + if (var8 == null) + { + return null; + } + else + { + if (var8.getBoundingBox().minY == var7.minY) + { + for (int var9 = 3; var9 >= 1; --var9) + { + var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, var9 - 1, par5); + + if (!var8.getBoundingBox().intersectsWith(var7)) + { + return StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, var9, par5); + } + } + } + + return null; + } + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + for (int var4 = 0; var4 < this.field_74993_a; ++var4) + { + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 0, 0, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 0, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 0, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 0, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 4, 0, var4, par3StructureBoundingBox); + + for (int var5 = 1; var5 <= 3; ++var5) + { + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 0, var5, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, var5, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, var5, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 3, var5, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 4, var5, var4, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 0, 4, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 4, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 4, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 4, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 4, 4, var4, par3StructureBoundingBox); + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdCrossing.java b/src/main/java/net/minecraft/src/ComponentStrongholdCrossing.java new file mode 100644 index 0000000..9f39c4b --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdCrossing.java @@ -0,0 +1,141 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdCrossing extends ComponentStronghold +{ + private boolean field_74996_b; + private boolean field_74997_c; + private boolean field_74995_d; + private boolean field_74999_h; + + public ComponentStrongholdCrossing() {} + + public ComponentStrongholdCrossing(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.field_143013_d = this.getRandomDoor(par2Random); + this.boundingBox = par3StructureBoundingBox; + this.field_74996_b = par2Random.nextBoolean(); + this.field_74997_c = par2Random.nextBoolean(); + this.field_74995_d = par2Random.nextBoolean(); + this.field_74999_h = par2Random.nextInt(3) > 0; + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("leftLow", this.field_74996_b); + par1NBTTagCompound.setBoolean("leftHigh", this.field_74997_c); + par1NBTTagCompound.setBoolean("rightLow", this.field_74995_d); + par1NBTTagCompound.setBoolean("rightHigh", this.field_74999_h); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.field_74996_b = par1NBTTagCompound.getBoolean("leftLow"); + this.field_74997_c = par1NBTTagCompound.getBoolean("leftHigh"); + this.field_74995_d = par1NBTTagCompound.getBoolean("rightLow"); + this.field_74999_h = par1NBTTagCompound.getBoolean("rightHigh"); + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + int var4 = 3; + int var5 = 5; + + if (this.coordBaseMode == 1 || this.coordBaseMode == 2) + { + var4 = 8 - var4; + var5 = 8 - var5; + } + + this.getNextComponentNormal((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 5, 1); + + if (this.field_74996_b) + { + this.getNextComponentX((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, var4, 1); + } + + if (this.field_74997_c) + { + this.getNextComponentX((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, var5, 7); + } + + if (this.field_74995_d) + { + this.getNextComponentZ((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, var4, 1); + } + + if (this.field_74999_h) + { + this.getNextComponentZ((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, var5, 7); + } + } + + public static ComponentStrongholdCrossing findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -4, -3, 0, 10, 9, 11, par5); + return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdCrossing(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 9, 8, 10, true, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.field_143013_d, 4, 3, 0); + + if (this.field_74996_b) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, 1, 0, 5, 3, 0, 0, false); + } + + if (this.field_74995_d) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 3, 1, 9, 5, 3, 0, 0, false); + } + + if (this.field_74997_c) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 7, 0, 7, 9, 0, 0, false); + } + + if (this.field_74999_h) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 5, 7, 9, 7, 9, 0, 0, false); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 1, 10, 7, 3, 10, 0, 0, false); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, 2, 1, 8, 2, 6, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 1, 5, 4, 4, 9, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 8, 1, 5, 8, 4, 9, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, 4, 7, 3, 4, 9, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, 3, 5, 3, 3, 6, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 4, 3, 3, 4, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 6, 3, 4, 6, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 5, 1, 7, 7, 1, 8, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 1, 9, 7, 1, 9, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 2, 7, 7, 2, 7, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 5, 7, 4, 5, 9, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 5, 7, 8, 5, 9, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 5, 7, 7, 5, 9, Block.stoneDoubleSlab.blockID, Block.stoneDoubleSlab.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 6, 5, 6, par3StructureBoundingBox); + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdLeftTurn.java b/src/main/java/net/minecraft/src/ComponentStrongholdLeftTurn.java new file mode 100644 index 0000000..f94c5ff --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdLeftTurn.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdLeftTurn extends ComponentStronghold +{ + public ComponentStrongholdLeftTurn() {} + + public ComponentStrongholdLeftTurn(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.field_143013_d = this.getRandomDoor(par2Random); + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + if (this.coordBaseMode != 2 && this.coordBaseMode != 3) + { + this.getNextComponentZ((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1); + } + else + { + this.getNextComponentX((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1); + } + } + + public static ComponentStrongholdLeftTurn findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, 5, par5); + return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdLeftTurn(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 4, 4, true, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.field_143013_d, 1, 1, 0); + + if (this.coordBaseMode != 2 && this.coordBaseMode != 3) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 4, 3, 3, 0, 0, false); + } + else + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 1, 0, 3, 3, 0, 0, false); + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdLibrary.java b/src/main/java/net/minecraft/src/ComponentStrongholdLibrary.java new file mode 100644 index 0000000..479ece0 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdLibrary.java @@ -0,0 +1,170 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdLibrary extends ComponentStronghold +{ + /** List of items that Stronghold Library chests can contain. */ + private static final WeightedRandomChestContent[] strongholdLibraryChestContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.book.itemID, 0, 1, 3, 20), new WeightedRandomChestContent(Item.paper.itemID, 0, 2, 7, 20), new WeightedRandomChestContent(Item.emptyMap.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Item.compass.itemID, 0, 1, 1, 1)}; + private boolean isLargeRoom; + + public ComponentStrongholdLibrary() {} + + public ComponentStrongholdLibrary(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.field_143013_d = this.getRandomDoor(par2Random); + this.boundingBox = par3StructureBoundingBox; + this.isLargeRoom = par3StructureBoundingBox.getYSize() > 6; + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Tall", this.isLargeRoom); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.isLargeRoom = par1NBTTagCompound.getBoolean("Tall"); + } + + public static ComponentStrongholdLibrary findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -4, -1, 0, 14, 11, 15, par5); + + if (!canStrongholdGoDeeper(var7) || StructureComponent.findIntersecting(par0List, var7) != null) + { + var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -4, -1, 0, 14, 6, 15, par5); + + if (!canStrongholdGoDeeper(var7) || StructureComponent.findIntersecting(par0List, var7) != null) + { + return null; + } + } + + return new ComponentStrongholdLibrary(par6, par1Random, var7, par5); + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + byte var4 = 11; + + if (!this.isLargeRoom) + { + var4 = 6; + } + + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 13, var4 - 1, 14, true, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.field_143013_d, 4, 1, 0); + this.randomlyFillWithBlocks(par1World, par3StructureBoundingBox, par2Random, 0.07F, 2, 1, 1, 11, 4, 13, Block.web.blockID, Block.web.blockID, false); + boolean var5 = true; + boolean var6 = true; + int var7; + + for (var7 = 1; var7 <= 13; ++var7) + { + if ((var7 - 1) % 4 == 0) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, var7, 1, 4, var7, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 1, var7, 12, 4, var7, Block.planks.blockID, Block.planks.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 2, 3, var7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 11, 3, var7, par3StructureBoundingBox); + + if (this.isLargeRoom) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 6, var7, 1, 9, var7, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 6, var7, 12, 9, var7, Block.planks.blockID, Block.planks.blockID, false); + } + } + else + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, var7, 1, 4, var7, Block.bookShelf.blockID, Block.bookShelf.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 1, var7, 12, 4, var7, Block.bookShelf.blockID, Block.bookShelf.blockID, false); + + if (this.isLargeRoom) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 6, var7, 1, 9, var7, Block.bookShelf.blockID, Block.bookShelf.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 6, var7, 12, 9, var7, Block.bookShelf.blockID, Block.bookShelf.blockID, false); + } + } + } + + for (var7 = 3; var7 < 12; var7 += 2) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 1, var7, 4, 3, var7, Block.bookShelf.blockID, Block.bookShelf.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 1, var7, 7, 3, var7, Block.bookShelf.blockID, Block.bookShelf.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 1, var7, 10, 3, var7, Block.bookShelf.blockID, Block.bookShelf.blockID, false); + } + + if (this.isLargeRoom) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 1, 3, 5, 13, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 10, 5, 1, 12, 5, 13, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 5, 1, 9, 5, 2, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 5, 12, 9, 5, 13, Block.planks.blockID, Block.planks.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 9, 5, 11, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 8, 5, 11, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 9, 5, 10, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 6, 2, 3, 6, 12, Block.fence.blockID, Block.fence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 10, 6, 2, 10, 6, 10, Block.fence.blockID, Block.fence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 6, 2, 9, 6, 2, Block.fence.blockID, Block.fence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 6, 12, 8, 6, 12, Block.fence.blockID, Block.fence.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 9, 6, 11, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 8, 6, 11, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 9, 6, 10, par3StructureBoundingBox); + var7 = this.getMetadataWithOffset(Block.ladder.blockID, 3); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var7, 10, 1, 13, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var7, 10, 2, 13, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var7, 10, 3, 13, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var7, 10, 4, 13, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var7, 10, 5, 13, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var7, 10, 6, 13, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var7, 10, 7, 13, par3StructureBoundingBox); + byte var8 = 7; + byte var9 = 7; + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8 - 1, 9, var9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8, 9, var9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8 - 1, 8, var9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8, 8, var9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8 - 1, 7, var9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8, 7, var9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8 - 2, 7, var9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8 + 1, 7, var9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8 - 1, 7, var9 - 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8 - 1, 7, var9 + 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8, 7, var9 - 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, var8, 7, var9 + 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, var8 - 2, 8, var9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, var8 + 1, 8, var9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, var8 - 1, 8, var9 - 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, var8 - 1, 8, var9 + 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, var8, 8, var9 - 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, var8, 8, var9 + 1, par3StructureBoundingBox); + } + + this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 3, 5, WeightedRandomChestContent.func_92080_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92112_a(par2Random, 1, 5, 2)}), 1 + par2Random.nextInt(4)); + + if (this.isLargeRoom) + { + this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, 9, 1, par3StructureBoundingBox); + this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 12, 8, 1, WeightedRandomChestContent.func_92080_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92112_a(par2Random, 1, 5, 2)}), 1 + par2Random.nextInt(4)); + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdPortalRoom.java b/src/main/java/net/minecraft/src/ComponentStrongholdPortalRoom.java new file mode 100644 index 0000000..d7612aa --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdPortalRoom.java @@ -0,0 +1,155 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdPortalRoom extends ComponentStronghold +{ + private boolean hasSpawner; + + public ComponentStrongholdPortalRoom() {} + + public ComponentStrongholdPortalRoom(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.boundingBox = par3StructureBoundingBox; + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Mob", this.hasSpawner); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.hasSpawner = par1NBTTagCompound.getBoolean("Mob"); + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + if (par1StructureComponent != null) + { + ((ComponentStrongholdStairs2)par1StructureComponent).strongholdPortalRoom = this; + } + } + + public static ComponentStrongholdPortalRoom findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -4, -1, 0, 11, 8, 16, par5); + return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdPortalRoom(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 10, 7, 15, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, EnumDoor.GRATES, 4, 1, 0); + byte var4 = 6; + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, var4, 1, 1, var4, 14, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 9, var4, 1, 9, var4, 14, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, var4, 1, 8, var4, 2, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 2, var4, 14, 8, var4, 14, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 2, 1, 4, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 8, 1, 1, 9, 1, 4, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 1, 1, 3, Block.lavaMoving.blockID, Block.lavaMoving.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 1, 1, 9, 1, 3, Block.lavaMoving.blockID, Block.lavaMoving.blockID, false); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 3, 1, 8, 7, 1, 12, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 9, 6, 1, 11, Block.lavaMoving.blockID, Block.lavaMoving.blockID, false); + int var5; + + for (var5 = 3; var5 < 14; var5 += 2) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 3, var5, 0, 4, var5, Block.fenceIron.blockID, Block.fenceIron.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 10, 3, var5, 10, 4, var5, Block.fenceIron.blockID, Block.fenceIron.blockID, false); + } + + for (var5 = 2; var5 < 9; var5 += 2) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, var5, 3, 15, var5, 4, 15, Block.fenceIron.blockID, Block.fenceIron.blockID, false); + } + + var5 = this.getMetadataWithOffset(Block.stairsStoneBrick.blockID, 3); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 1, 5, 6, 1, 7, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 2, 6, 6, 2, 7, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 3, 7, 6, 3, 7, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + + for (int var6 = 4; var6 <= 6; ++var6) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsStoneBrick.blockID, var5, var6, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsStoneBrick.blockID, var5, var6, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsStoneBrick.blockID, var5, var6, 3, 6, par3StructureBoundingBox); + } + + byte var14 = 2; + byte var7 = 0; + byte var8 = 3; + byte var9 = 1; + + switch (this.coordBaseMode) + { + case 0: + var14 = 0; + var7 = 2; + break; + + case 1: + var14 = 1; + var7 = 3; + var8 = 0; + var9 = 2; + + case 2: + default: + break; + + case 3: + var14 = 3; + var7 = 1; + var8 = 0; + var9 = 2; + } + + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var14 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 4, 3, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var14 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 5, 3, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var14 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 6, 3, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var7 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 4, 3, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var7 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 5, 3, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var7 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 6, 3, 12, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var8 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 3, 3, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var8 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 3, 3, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var8 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 3, 3, 11, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var9 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 7, 3, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var9 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 7, 3, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.endPortalFrame.blockID, var9 + (par2Random.nextFloat() > 0.9F ? 4 : 0), 7, 3, 11, par3StructureBoundingBox); + + if (!this.hasSpawner) + { + int var13 = this.getYWithOffset(3); + int var10 = this.getXWithOffset(5, 6); + int var11 = this.getZWithOffset(5, 6); + + if (par3StructureBoundingBox.isVecInside(var10, var13, var11)) + { + this.hasSpawner = true; + par1World.setBlock(var10, var13, var11, Block.mobSpawner.blockID, 0, 2); + TileEntityMobSpawner var12 = (TileEntityMobSpawner)par1World.getBlockTileEntity(var10, var13, var11); + + if (var12 != null) + { + var12.getSpawnerLogic().setMobID("Silverfish"); + } + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdPrison.java b/src/main/java/net/minecraft/src/ComponentStrongholdPrison.java new file mode 100644 index 0000000..9071c3b --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdPrison.java @@ -0,0 +1,62 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdPrison extends ComponentStronghold +{ + public ComponentStrongholdPrison() {} + + public ComponentStrongholdPrison(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.field_143013_d = this.getRandomDoor(par2Random); + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1); + } + + public static ComponentStrongholdPrison findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 9, 5, 11, par5); + return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdPrison(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 8, 4, 10, true, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.field_143013_d, 1, 1, 0); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 10, 3, 3, 10, 0, 0, false); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 4, 3, 1, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 1, 3, 4, 3, 3, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 1, 7, 4, 3, 7, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 4, 1, 9, 4, 3, 9, false, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 4, 4, 3, 6, Block.fenceIron.blockID, Block.fenceIron.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 1, 5, 7, 3, 5, Block.fenceIron.blockID, Block.fenceIron.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.fenceIron.blockID, 0, 4, 3, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fenceIron.blockID, 0, 4, 3, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.doorIron.blockID, this.getMetadataWithOffset(Block.doorIron.blockID, 3), 4, 1, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.doorIron.blockID, this.getMetadataWithOffset(Block.doorIron.blockID, 3) + 8, 4, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.doorIron.blockID, this.getMetadataWithOffset(Block.doorIron.blockID, 3), 4, 1, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.doorIron.blockID, this.getMetadataWithOffset(Block.doorIron.blockID, 3) + 8, 4, 2, 8, par3StructureBoundingBox); + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdRightTurn.java b/src/main/java/net/minecraft/src/ComponentStrongholdRightTurn.java new file mode 100644 index 0000000..86690d0 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdRightTurn.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdRightTurn extends ComponentStrongholdLeftTurn +{ + public ComponentStrongholdRightTurn(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1, par2Random, par3StructureBoundingBox, par4); + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + if (this.coordBaseMode != 2 && this.coordBaseMode != 3) + { + this.getNextComponentX((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1); + } + else + { + this.getNextComponentZ((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1); + } + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 4, 4, true, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.field_143013_d, 1, 1, 0); + + if (this.coordBaseMode != 2 && this.coordBaseMode != 3) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 1, 0, 3, 3, 0, 0, false); + } + else + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 4, 3, 3, 0, 0, false); + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdRoomCrossing.java b/src/main/java/net/minecraft/src/ComponentStrongholdRoomCrossing.java new file mode 100644 index 0000000..9be3a1c --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdRoomCrossing.java @@ -0,0 +1,164 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdRoomCrossing extends ComponentStronghold +{ + /** + * Items that could generate in the chest that is located in Stronghold Room Crossing. + */ + private static final WeightedRandomChestContent[] strongholdRoomCrossingChestContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.ingotIron.itemID, 0, 1, 5, 10), new WeightedRandomChestContent(Item.ingotGold.itemID, 0, 1, 3, 5), new WeightedRandomChestContent(Item.redstone.itemID, 0, 4, 9, 5), new WeightedRandomChestContent(Item.coal.itemID, 0, 3, 8, 10), new WeightedRandomChestContent(Item.bread.itemID, 0, 1, 3, 15), new WeightedRandomChestContent(Item.appleRed.itemID, 0, 1, 3, 15), new WeightedRandomChestContent(Item.pickaxeIron.itemID, 0, 1, 1, 1)}; + protected int roomType; + + public ComponentStrongholdRoomCrossing() {} + + public ComponentStrongholdRoomCrossing(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.field_143013_d = this.getRandomDoor(par2Random); + this.boundingBox = par3StructureBoundingBox; + this.roomType = par2Random.nextInt(5); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setInteger("Type", this.roomType); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.roomType = par1NBTTagCompound.getInteger("Type"); + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 4, 1); + this.getNextComponentX((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 4); + this.getNextComponentZ((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 4); + } + + public static ComponentStrongholdRoomCrossing findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -4, -1, 0, 11, 7, 11, par5); + return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdRoomCrossing(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 10, 6, 10, true, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.field_143013_d, 4, 1, 0); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 10, 6, 3, 10, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 4, 0, 3, 6, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 10, 1, 4, 10, 3, 6, 0, 0, false); + int var4; + + switch (this.roomType) + { + case 0: + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 5, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 5, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 5, 3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 4, 3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 6, 3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 5, 3, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 5, 3, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 4, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 4, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 4, 1, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 6, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 6, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 6, 1, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 5, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 5, 1, 6, par3StructureBoundingBox); + break; + + case 1: + for (var4 = 0; var4 < 5; ++var4) + { + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 1, 3 + var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 7, 1, 3 + var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3 + var4, 1, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3 + var4, 1, 7, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 5, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 5, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 5, 3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.waterMoving.blockID, 0, 5, 4, 5, par3StructureBoundingBox); + break; + + case 2: + for (var4 = 1; var4 <= 9; ++var4) + { + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 1, 3, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 9, 3, var4, par3StructureBoundingBox); + } + + for (var4 = 1; var4 <= 9; ++var4) + { + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, var4, 3, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, var4, 3, 9, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 5, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 5, 1, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 5, 3, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 5, 3, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 4, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 6, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 4, 3, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 6, 3, 5, par3StructureBoundingBox); + + for (var4 = 1; var4 <= 3; ++var4) + { + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 4, var4, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 6, var4, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 4, var4, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 6, var4, 6, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 5, 3, 5, par3StructureBoundingBox); + + for (var4 = 2; var4 <= 8; ++var4) + { + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 2, 3, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 3, 3, var4, par3StructureBoundingBox); + + if (var4 <= 3 || var4 >= 7) + { + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 4, 3, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 5, 3, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 6, 3, var4, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 7, 3, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 8, 3, var4, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, this.getMetadataWithOffset(Block.ladder.blockID, 4), 9, 1, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, this.getMetadataWithOffset(Block.ladder.blockID, 4), 9, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, this.getMetadataWithOffset(Block.ladder.blockID, 4), 9, 3, 3, par3StructureBoundingBox); + this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 4, 8, WeightedRandomChestContent.func_92080_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 1 + par2Random.nextInt(4)); + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdStairs.java b/src/main/java/net/minecraft/src/ComponentStrongholdStairs.java new file mode 100644 index 0000000..34b7a07 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdStairs.java @@ -0,0 +1,109 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdStairs extends ComponentStronghold +{ + private boolean field_75024_a; + + public ComponentStrongholdStairs() {} + + public ComponentStrongholdStairs(int par1, Random par2Random, int par3, int par4) + { + super(par1); + this.field_75024_a = true; + this.coordBaseMode = par2Random.nextInt(4); + this.field_143013_d = EnumDoor.OPENING; + + switch (this.coordBaseMode) + { + case 0: + case 2: + this.boundingBox = new StructureBoundingBox(par3, 64, par4, par3 + 5 - 1, 74, par4 + 5 - 1); + break; + + default: + this.boundingBox = new StructureBoundingBox(par3, 64, par4, par3 + 5 - 1, 74, par4 + 5 - 1); + } + } + + public ComponentStrongholdStairs(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.field_75024_a = false; + this.coordBaseMode = par4; + this.field_143013_d = this.getRandomDoor(par2Random); + this.boundingBox = par3StructureBoundingBox; + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Source", this.field_75024_a); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.field_75024_a = par1NBTTagCompound.getBoolean("Source"); + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + if (this.field_75024_a) + { + StructureStrongholdPieces.setComponentType(ComponentStrongholdCrossing.class); + } + + this.getNextComponentNormal((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1); + } + + /** + * performs some checks, then gives out a fresh Stairs component + */ + public static ComponentStrongholdStairs getStrongholdStairsComponent(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -7, 0, 5, 11, 5, par5); + return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdStairs(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 10, 4, true, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.field_143013_d, 1, 7, 0); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, EnumDoor.OPENING, 1, 1, 4); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 6, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 5, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 1, 6, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 5, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 4, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 1, 5, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 4, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 3, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 3, 4, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 3, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 2, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 3, 3, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 2, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 1, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 1, 2, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 1, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneSingleSlab.blockID, 0, 1, 1, 3, par3StructureBoundingBox); + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdStairs2.java b/src/main/java/net/minecraft/src/ComponentStrongholdStairs2.java new file mode 100644 index 0000000..178c497 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdStairs2.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdStairs2 extends ComponentStrongholdStairs +{ + public StructureStrongholdPieceWeight strongholdPieceWeight; + public ComponentStrongholdPortalRoom strongholdPortalRoom; + public List field_75026_c = new ArrayList(); + + public ComponentStrongholdStairs2() {} + + public ComponentStrongholdStairs2(int par1, Random par2Random, int par3, int par4) + { + super(0, par2Random, par3, par4); + } + + public ChunkPosition getCenter() + { + return this.strongholdPortalRoom != null ? this.strongholdPortalRoom.getCenter() : super.getCenter(); + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdStairsStraight.java b/src/main/java/net/minecraft/src/ComponentStrongholdStairsStraight.java new file mode 100644 index 0000000..8d27134 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdStairsStraight.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdStairsStraight extends ComponentStronghold +{ + public ComponentStrongholdStairsStraight() {} + + public ComponentStrongholdStairsStraight(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.field_143013_d = this.getRandomDoor(par2Random); + this.boundingBox = par3StructureBoundingBox; + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1); + } + + public static ComponentStrongholdStairsStraight findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -7, 0, 5, 11, 8, par5); + return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdStairsStraight(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 10, 7, true, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.field_143013_d, 1, 7, 0); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, EnumDoor.OPENING, 1, 1, 7); + int var4 = this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 2); + + for (int var5 = 0; var5 < 6; ++var5) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 1, 6 - var5, 1 + var5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 2, 6 - var5, 1 + var5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, var4, 3, 6 - var5, 1 + var5, par3StructureBoundingBox); + + if (var5 < 5) + { + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 1, 5 - var5, 1 + var5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 2, 5 - var5, 1 + var5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneBrick.blockID, 0, 3, 5 - var5, 1 + var5, par3StructureBoundingBox); + } + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentStrongholdStraight.java b/src/main/java/net/minecraft/src/ComponentStrongholdStraight.java new file mode 100644 index 0000000..e3fface --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentStrongholdStraight.java @@ -0,0 +1,94 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentStrongholdStraight extends ComponentStronghold +{ + private boolean expandsX; + private boolean expandsZ; + + public ComponentStrongholdStraight() {} + + public ComponentStrongholdStraight(int par1, Random par2Random, StructureBoundingBox par3StructureBoundingBox, int par4) + { + super(par1); + this.coordBaseMode = par4; + this.field_143013_d = this.getRandomDoor(par2Random); + this.boundingBox = par3StructureBoundingBox; + this.expandsX = par2Random.nextInt(2) == 0; + this.expandsZ = par2Random.nextInt(2) == 0; + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Left", this.expandsX); + par1NBTTagCompound.setBoolean("Right", this.expandsZ); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.expandsX = par1NBTTagCompound.getBoolean("Left"); + this.expandsZ = par1NBTTagCompound.getBoolean("Right"); + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + this.getNextComponentNormal((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 1); + + if (this.expandsX) + { + this.getNextComponentX((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 2); + } + + if (this.expandsZ) + { + this.getNextComponentZ((ComponentStrongholdStairs2)par1StructureComponent, par2List, par3Random, 1, 2); + } + } + + public static ComponentStrongholdStraight findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par2, par3, par4, -1, -1, 0, 5, 5, 7, par5); + return canStrongholdGoDeeper(var7) && StructureComponent.findIntersecting(par0List, var7) == null ? new ComponentStrongholdStraight(par6, par1Random, var7, par5) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.isLiquidInStructureBoundingBox(par1World, par3StructureBoundingBox)) + { + return false; + } + else + { + this.fillWithRandomizedBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 4, 6, true, par2Random, StructureStrongholdPieces.getStrongholdStones()); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, this.field_143013_d, 1, 1, 0); + this.placeDoor(par1World, par2Random, par3StructureBoundingBox, EnumDoor.OPENING, 1, 1, 6); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 1, 2, 1, Block.torchWood.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 3, 2, 1, Block.torchWood.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 1, 2, 5, Block.torchWood.blockID, 0); + this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.1F, 3, 2, 5, Block.torchWood.blockID, 0); + + if (this.expandsX) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 2, 0, 3, 4, 0, 0, false); + } + + if (this.expandsZ) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 2, 4, 3, 4, 0, 0, false); + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillage.java b/src/main/java/net/minecraft/src/ComponentVillage.java new file mode 100644 index 0000000..6209fad --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillage.java @@ -0,0 +1,258 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +abstract class ComponentVillage extends StructureComponent +{ + protected int field_143015_k = -1; + + /** The number of villagers that have been spawned in this component. */ + private int villagersSpawned; + private boolean field_143014_b; + + public ComponentVillage() {} + + protected ComponentVillage(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2) + { + super(par2); + + if (par1ComponentVillageStartPiece != null) + { + this.field_143014_b = par1ComponentVillageStartPiece.inDesert; + } + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setInteger("HPos", this.field_143015_k); + par1NBTTagCompound.setInteger("VCount", this.villagersSpawned); + par1NBTTagCompound.setBoolean("Desert", this.field_143014_b); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + this.field_143015_k = par1NBTTagCompound.getInteger("HPos"); + this.villagersSpawned = par1NBTTagCompound.getInteger("VCount"); + this.field_143014_b = par1NBTTagCompound.getBoolean("Desert"); + } + + /** + * Gets the next village component, with the bounding box shifted -1 in the X and Z direction. + */ + protected StructureComponent getNextComponentNN(ComponentVillageStartPiece par1ComponentVillageStartPiece, List par2List, Random par3Random, int par4, int par5) + { + switch (this.coordBaseMode) + { + case 0: + return StructureVillagePieces.getNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 1, this.getComponentType()); + + case 1: + return StructureVillagePieces.getNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.minZ - 1, 2, this.getComponentType()); + + case 2: + return StructureVillagePieces.getNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 1, this.getComponentType()); + + case 3: + return StructureVillagePieces.getNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.minZ - 1, 2, this.getComponentType()); + + default: + return null; + } + } + + /** + * Gets the next village component, with the bounding box shifted +1 in the X and Z direction. + */ + protected StructureComponent getNextComponentPP(ComponentVillageStartPiece par1ComponentVillageStartPiece, List par2List, Random par3Random, int par4, int par5) + { + switch (this.coordBaseMode) + { + case 0: + return StructureVillagePieces.getNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 3, this.getComponentType()); + + case 1: + return StructureVillagePieces.getNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + + case 2: + return StructureVillagePieces.getNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, 3, this.getComponentType()); + + case 3: + return StructureVillagePieces.getNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, this.boundingBox.minX + par5, this.boundingBox.minY + par4, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + + default: + return null; + } + } + + /** + * Discover the y coordinate that will serve as the ground level of the supplied BoundingBox. (A median of all the + * levels in the BB's horizontal rectangle). + */ + protected int getAverageGroundLevel(World par1World, StructureBoundingBox par2StructureBoundingBox) + { + int var3 = 0; + int var4 = 0; + + for (int var5 = this.boundingBox.minZ; var5 <= this.boundingBox.maxZ; ++var5) + { + for (int var6 = this.boundingBox.minX; var6 <= this.boundingBox.maxX; ++var6) + { + if (par2StructureBoundingBox.isVecInside(var6, 64, var5)) + { + var3 += Math.max(par1World.getTopSolidOrLiquidBlock(var6, var5), par1World.provider.getAverageGroundLevel()); + ++var4; + } + } + } + + if (var4 == 0) + { + return -1; + } + else + { + return var3 / var4; + } + } + + protected static boolean canVillageGoDeeper(StructureBoundingBox par0StructureBoundingBox) + { + return par0StructureBoundingBox != null && par0StructureBoundingBox.minY > 10; + } + + /** + * Spawns a number of villagers in this component. Parameters: world, component bounding box, x offset, y offset, z + * offset, number of villagers + */ + protected void spawnVillagers(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6) + { + if (this.villagersSpawned < par6) + { + for (int var7 = this.villagersSpawned; var7 < par6; ++var7) + { + int var8 = this.getXWithOffset(par3 + var7, par5); + int var9 = this.getYWithOffset(par4); + int var10 = this.getZWithOffset(par3 + var7, par5); + + if (!par2StructureBoundingBox.isVecInside(var8, var9, var10)) + { + break; + } + + ++this.villagersSpawned; + EntityVillager var11 = new EntityVillager(par1World, this.getVillagerType(var7)); + var11.setLocationAndAngles((double)var8 + 0.5D, (double)var9, (double)var10 + 0.5D, 0.0F, 0.0F); + par1World.spawnEntityInWorld(var11); + } + } + } + + /** + * Returns the villager type to spawn in this component, based on the number of villagers already spawned. + */ + protected int getVillagerType(int par1) + { + return 0; + } + + /** + * Gets the replacement block for the current biome + */ + protected int getBiomeSpecificBlock(int par1, int par2) + { + if (this.field_143014_b) + { + if (par1 == Block.wood.blockID) + { + return Block.sandStone.blockID; + } + + if (par1 == Block.cobblestone.blockID) + { + return Block.sandStone.blockID; + } + + if (par1 == Block.planks.blockID) + { + return Block.sandStone.blockID; + } + + if (par1 == Block.stairsWoodOak.blockID) + { + return Block.stairsSandStone.blockID; + } + + if (par1 == Block.stairsCobblestone.blockID) + { + return Block.stairsSandStone.blockID; + } + + if (par1 == Block.gravel.blockID) + { + return Block.sandStone.blockID; + } + } + + return par1; + } + + /** + * Gets the replacement block metadata for the current biome + */ + protected int getBiomeSpecificBlockMetadata(int par1, int par2) + { + if (this.field_143014_b) + { + if (par1 == Block.wood.blockID) + { + return 0; + } + + if (par1 == Block.cobblestone.blockID) + { + return 0; + } + + if (par1 == Block.planks.blockID) + { + return 2; + } + } + + return par2; + } + + /** + * current Position depends on currently set Coordinates mode, is computed here + */ + protected void placeBlockAtCurrentPosition(World par1World, int par2, int par3, int par4, int par5, int par6, StructureBoundingBox par7StructureBoundingBox) + { + int var8 = this.getBiomeSpecificBlock(par2, par3); + int var9 = this.getBiomeSpecificBlockMetadata(par2, par3); + super.placeBlockAtCurrentPosition(par1World, var8, var9, par4, par5, par6, par7StructureBoundingBox); + } + + /** + * arguments: (World worldObj, StructureBoundingBox structBB, int minX, int minY, int minZ, int maxX, int maxY, int + * maxZ, int placeBlockId, int replaceBlockId, boolean alwaysreplace) + */ + protected void fillWithBlocks(World par1World, StructureBoundingBox par2StructureBoundingBox, int par3, int par4, int par5, int par6, int par7, int par8, int par9, int par10, boolean par11) + { + int var12 = this.getBiomeSpecificBlock(par9, 0); + int var13 = this.getBiomeSpecificBlockMetadata(par9, 0); + int var14 = this.getBiomeSpecificBlock(par10, 0); + int var15 = this.getBiomeSpecificBlockMetadata(par10, 0); + super.fillWithMetadataBlocks(par1World, par2StructureBoundingBox, par3, par4, par5, par6, par7, par8, var12, var13, var14, var15, par11); + } + + /** + * Overwrites air and liquids from selected position downwards, stops at hitting anything else. + */ + protected void fillCurrentPositionBlocksDownwards(World par1World, int par2, int par3, int par4, int par5, int par6, StructureBoundingBox par7StructureBoundingBox) + { + int var8 = this.getBiomeSpecificBlock(par2, par3); + int var9 = this.getBiomeSpecificBlockMetadata(par2, par3); + super.fillCurrentPositionBlocksDownwards(par1World, var8, var9, par4, par5, par6, par7StructureBoundingBox); + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageChurch.java b/src/main/java/net/minecraft/src/ComponentVillageChurch.java new file mode 100644 index 0000000..3279ea2 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageChurch.java @@ -0,0 +1,124 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillageChurch extends ComponentVillage +{ + public ComponentVillageChurch() {} + + public ComponentVillageChurch(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par5; + this.boundingBox = par4StructureBoundingBox; + } + + public static ComponentVillageChurch func_74919_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) + { + StructureBoundingBox var8 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 5, 12, 9, par6); + return canVillageGoDeeper(var8) && StructureComponent.findIntersecting(par1List, var8) == null ? new ComponentVillageChurch(par0ComponentVillageStartPiece, par7, par2Random, var8, par6) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 12 - 1, 0); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 3, 3, 7, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 1, 3, 9, 3, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 3, 0, 8, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 0, 3, 10, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 1, 0, 10, 3, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 4, 10, 3, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 4, 0, 4, 7, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 4, 4, 4, 7, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 8, 3, 4, 8, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 4, 3, 10, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 5, 3, 5, 7, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 9, 0, 4, 9, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 4, 0, 4, 4, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 0, 11, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 4, 11, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 2, 11, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 2, 11, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 1, 1, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 1, 1, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 2, 1, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 3, 1, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 3, 1, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), 1, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), 2, 1, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), 3, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 1), 1, 2, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 0), 3, 2, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 3, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 3, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 6, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 7, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 6, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 7, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 6, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 7, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 6, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 7, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 3, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 3, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 3, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 2, 4, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 1, 4, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 3, 4, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 2, 4, 5, par3StructureBoundingBox); + int var4 = this.getMetadataWithOffset(Block.ladder.blockID, 4); + int var5; + + for (var5 = 1; var5 <= 9; ++var5) + { + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var4, 3, var5, 3, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, 1, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, 2, 0, par3StructureBoundingBox); + this.placeDoorAtCurrentPosition(par1World, par3StructureBoundingBox, par2Random, 2, 1, 0, this.getMetadataWithOffset(Block.doorWood.blockID, 1)); + + if (this.getBlockIdAtCurrentPosition(par1World, 2, 0, -1, par3StructureBoundingBox) == 0 && this.getBlockIdAtCurrentPosition(par1World, 2, -1, -1, par3StructureBoundingBox) != 0) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), 2, 0, -1, par3StructureBoundingBox); + } + + for (var5 = 0; var5 < 9; ++var5) + { + for (int var6 = 0; var6 < 5; ++var6) + { + this.clearCurrentPositionBlocksUpwards(par1World, var6, 12, var5, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.cobblestone.blockID, 0, var6, -1, var5, par3StructureBoundingBox); + } + } + + this.spawnVillagers(par1World, par3StructureBoundingBox, 2, 1, 2, 1); + return true; + } + + /** + * Returns the villager type to spawn in this component, based on the number of villagers already spawned. + */ + protected int getVillagerType(int par1) + { + return 2; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageField.java b/src/main/java/net/minecraft/src/ComponentVillageField.java new file mode 100644 index 0000000..b04d0eb --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageField.java @@ -0,0 +1,130 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillageField extends ComponentVillage +{ + /** First crop type for this field. */ + private int cropTypeA; + + /** Second crop type for this field. */ + private int cropTypeB; + + /** Third crop type for this field. */ + private int cropTypeC; + + /** Fourth crop type for this field. */ + private int cropTypeD; + + public ComponentVillageField() {} + + public ComponentVillageField(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par5; + this.boundingBox = par4StructureBoundingBox; + this.cropTypeA = this.getRandomCrop(par3Random); + this.cropTypeB = this.getRandomCrop(par3Random); + this.cropTypeC = this.getRandomCrop(par3Random); + this.cropTypeD = this.getRandomCrop(par3Random); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setInteger("CA", this.cropTypeA); + par1NBTTagCompound.setInteger("CB", this.cropTypeB); + par1NBTTagCompound.setInteger("CC", this.cropTypeC); + par1NBTTagCompound.setInteger("CD", this.cropTypeD); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.cropTypeA = par1NBTTagCompound.getInteger("CA"); + this.cropTypeB = par1NBTTagCompound.getInteger("CB"); + this.cropTypeC = par1NBTTagCompound.getInteger("CC"); + this.cropTypeD = par1NBTTagCompound.getInteger("CD"); + } + + /** + * Returns a crop type to be planted on this field. + */ + private int getRandomCrop(Random par1Random) + { + switch (par1Random.nextInt(5)) + { + case 0: + return Block.carrot.blockID; + + case 1: + return Block.potato.blockID; + + default: + return Block.crops.blockID; + } + } + + public static ComponentVillageField func_74900_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) + { + StructureBoundingBox var8 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 13, 4, 9, par6); + return canVillageGoDeeper(var8) && StructureComponent.findIntersecting(par1List, var8) == null ? new ComponentVillageField(par0ComponentVillageStartPiece, par7, par2Random, var8, par6) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 12, 4, 8, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 2, 0, 7, Block.tilledField.blockID, Block.tilledField.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 1, 5, 0, 7, Block.tilledField.blockID, Block.tilledField.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 1, 8, 0, 7, Block.tilledField.blockID, Block.tilledField.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 10, 0, 1, 11, 0, 7, Block.tilledField.blockID, Block.tilledField.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 0, 0, 8, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 0, 0, 6, 0, 8, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 0, 0, 12, 0, 8, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 11, 0, 0, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 8, 11, 0, 8, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 0, 1, 3, 0, 7, Block.waterMoving.blockID, Block.waterMoving.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 0, 1, 9, 0, 7, Block.waterMoving.blockID, Block.waterMoving.blockID, false); + int var4; + + for (var4 = 1; var4 <= 7; ++var4) + { + this.placeBlockAtCurrentPosition(par1World, this.cropTypeA, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 1, 1, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, this.cropTypeA, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 2, 1, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, this.cropTypeB, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 4, 1, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, this.cropTypeB, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 5, 1, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, this.cropTypeC, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 7, 1, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, this.cropTypeC, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 8, 1, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, this.cropTypeD, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 10, 1, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, this.cropTypeD, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 11, 1, var4, par3StructureBoundingBox); + } + + for (var4 = 0; var4 < 9; ++var4) + { + for (int var5 = 0; var5 < 13; ++var5) + { + this.clearCurrentPositionBlocksUpwards(par1World, var5, 4, var4, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.dirt.blockID, 0, var5, -1, var4, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageField2.java b/src/main/java/net/minecraft/src/ComponentVillageField2.java new file mode 100644 index 0000000..e4a9747 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageField2.java @@ -0,0 +1,110 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillageField2 extends ComponentVillage +{ + /** First crop type for this field. */ + private int cropTypeA; + + /** Second crop type for this field. */ + private int cropTypeB; + + public ComponentVillageField2() {} + + public ComponentVillageField2(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par5; + this.boundingBox = par4StructureBoundingBox; + this.cropTypeA = this.pickRandomCrop(par3Random); + this.cropTypeB = this.pickRandomCrop(par3Random); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setInteger("CA", this.cropTypeA); + par1NBTTagCompound.setInteger("CB", this.cropTypeB); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.cropTypeA = par1NBTTagCompound.getInteger("CA"); + this.cropTypeB = par1NBTTagCompound.getInteger("CB"); + } + + /** + * Returns a crop type to be planted on this field. + */ + private int pickRandomCrop(Random par1Random) + { + switch (par1Random.nextInt(5)) + { + case 0: + return Block.carrot.blockID; + + case 1: + return Block.potato.blockID; + + default: + return Block.crops.blockID; + } + } + + public static ComponentVillageField2 func_74902_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) + { + StructureBoundingBox var8 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 7, 4, 9, par6); + return canVillageGoDeeper(var8) && StructureComponent.findIntersecting(par1List, var8) == null ? new ComponentVillageField2(par0ComponentVillageStartPiece, par7, par2Random, var8, par6) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 6, 4, 8, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 2, 0, 7, Block.tilledField.blockID, Block.tilledField.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 1, 5, 0, 7, Block.tilledField.blockID, Block.tilledField.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 0, 0, 8, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 0, 0, 6, 0, 8, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 5, 0, 0, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 8, 5, 0, 8, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 0, 1, 3, 0, 7, Block.waterMoving.blockID, Block.waterMoving.blockID, false); + int var4; + + for (var4 = 1; var4 <= 7; ++var4) + { + this.placeBlockAtCurrentPosition(par1World, this.cropTypeA, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 1, 1, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, this.cropTypeA, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 2, 1, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, this.cropTypeB, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 4, 1, var4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, this.cropTypeB, MathHelper.getRandomIntegerInRange(par2Random, 2, 7), 5, 1, var4, par3StructureBoundingBox); + } + + for (var4 = 0; var4 < 9; ++var4) + { + for (int var5 = 0; var5 < 7; ++var5) + { + this.clearCurrentPositionBlocksUpwards(par1World, var5, 4, var4, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.dirt.blockID, 0, var5, -1, var4, par3StructureBoundingBox); + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageHall.java b/src/main/java/net/minecraft/src/ComponentVillageHall.java new file mode 100644 index 0000000..07852d1 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageHall.java @@ -0,0 +1,131 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillageHall extends ComponentVillage +{ + public ComponentVillageHall() {} + + public ComponentVillageHall(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par5; + this.boundingBox = par4StructureBoundingBox; + } + + public static ComponentVillageHall func_74906_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) + { + StructureBoundingBox var8 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 9, 7, 11, par6); + return canVillageGoDeeper(var8) && StructureComponent.findIntersecting(par1List, var8) == null ? new ComponentVillageHall(par0ComponentVillageStartPiece, par7, par2Random, var8, par6) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 7 - 1, 0); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 7, 4, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 1, 6, 8, 4, 10, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 0, 6, 8, 0, 10, Block.dirt.blockID, Block.dirt.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 6, 0, 6, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 1, 6, 2, 1, 10, Block.fence.blockID, Block.fence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 1, 6, 8, 1, 10, Block.fence.blockID, Block.fence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 1, 10, 7, 1, 10, Block.fence.blockID, Block.fence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 7, 0, 4, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 0, 3, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 0, 0, 8, 3, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 7, 1, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 5, 7, 1, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 0, 7, 3, 0, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 5, 7, 3, 5, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 4, 1, 8, 4, 1, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 4, 4, 8, 4, 4, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 2, 8, 5, 3, Block.planks.blockID, Block.planks.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 0, 4, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 0, 4, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 8, 4, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 8, 4, 3, par3StructureBoundingBox); + int var4 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3); + int var5 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 2); + int var6; + int var7; + + for (var6 = -1; var6 <= 2; ++var6) + { + for (var7 = 0; var7 <= 8; ++var7) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var4, var7, 4 + var6, var6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var5, var7, 4 + var6, 5 - var6, par3StructureBoundingBox); + } + } + + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 0, 2, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 0, 2, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 8, 2, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 8, 2, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 3, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 6, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 2, 1, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.pressurePlatePlanks.blockID, 0, 2, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 1, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3), 2, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 1), 1, 1, 3, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 0, 1, 7, 0, 3, Block.stoneDoubleSlab.blockID, Block.stoneDoubleSlab.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.stoneDoubleSlab.blockID, 0, 6, 1, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneDoubleSlab.blockID, 0, 6, 1, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, 1, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 2, 3, 1, par3StructureBoundingBox); + this.placeDoorAtCurrentPosition(par1World, par3StructureBoundingBox, par2Random, 2, 1, 0, this.getMetadataWithOffset(Block.doorWood.blockID, 1)); + + if (this.getBlockIdAtCurrentPosition(par1World, 2, 0, -1, par3StructureBoundingBox) == 0 && this.getBlockIdAtCurrentPosition(par1World, 2, -1, -1, par3StructureBoundingBox) != 0) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), 2, 0, -1, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, 0, 0, 6, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 6, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 6, 3, 4, par3StructureBoundingBox); + this.placeDoorAtCurrentPosition(par1World, par3StructureBoundingBox, par2Random, 6, 1, 5, this.getMetadataWithOffset(Block.doorWood.blockID, 1)); + + for (var6 = 0; var6 < 5; ++var6) + { + for (var7 = 0; var7 < 9; ++var7) + { + this.clearCurrentPositionBlocksUpwards(par1World, var7, 7, var6, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.cobblestone.blockID, 0, var7, -1, var6, par3StructureBoundingBox); + } + } + + this.spawnVillagers(par1World, par3StructureBoundingBox, 4, 1, 2, 2); + return true; + } + + /** + * Returns the villager type to spawn in this component, based on the number of villagers already spawned. + */ + protected int getVillagerType(int par1) + { + return par1 == 0 ? 4 : 0; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageHouse1.java b/src/main/java/net/minecraft/src/ComponentVillageHouse1.java new file mode 100644 index 0000000..b07dd38 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageHouse1.java @@ -0,0 +1,134 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillageHouse1 extends ComponentVillage +{ + public ComponentVillageHouse1() {} + + public ComponentVillageHouse1(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par5; + this.boundingBox = par4StructureBoundingBox; + } + + public static ComponentVillageHouse1 func_74898_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) + { + StructureBoundingBox var8 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 9, 9, 6, par6); + return canVillageGoDeeper(var8) && StructureComponent.findIntersecting(par1List, var8) == null ? new ComponentVillageHouse1(par0ComponentVillageStartPiece, par7, par2Random, var8, par6) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 9 - 1, 0); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 7, 5, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 8, 0, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 8, 5, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 6, 1, 8, 6, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 7, 2, 8, 7, 3, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + int var4 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3); + int var5 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 2); + int var6; + int var7; + + for (var6 = -1; var6 <= 2; ++var6) + { + for (var7 = 0; var7 <= 8; ++var7) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var4, var7, 6 + var6, var6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var5, var7, 6 + var6, 5 - var6, par3StructureBoundingBox); + } + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 0, 1, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 5, 8, 1, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 1, 0, 8, 1, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 1, 0, 7, 1, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 0, 0, 4, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 5, 0, 4, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 2, 5, 8, 4, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 2, 0, 8, 4, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 2, 1, 0, 4, 4, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 5, 7, 4, 5, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 2, 1, 8, 4, 4, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 0, 7, 4, 0, Block.planks.blockID, Block.planks.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 6, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 6, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 3, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 3, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 3, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 3, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 3, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 6, 2, 5, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 1, 7, 4, 1, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 4, 7, 4, 4, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 3, 4, 7, 3, 4, Block.bookShelf.blockID, Block.bookShelf.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 7, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 0), 7, 1, 3, par3StructureBoundingBox); + var6 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var6, 6, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var6, 5, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var6, 4, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var6, 3, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 6, 1, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.pressurePlatePlanks.blockID, 0, 6, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 1, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.pressurePlatePlanks.blockID, 0, 4, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.workbench.blockID, 0, 7, 1, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 1, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 2, 0, par3StructureBoundingBox); + this.placeDoorAtCurrentPosition(par1World, par3StructureBoundingBox, par2Random, 1, 1, 0, this.getMetadataWithOffset(Block.doorWood.blockID, 1)); + + if (this.getBlockIdAtCurrentPosition(par1World, 1, 0, -1, par3StructureBoundingBox) == 0 && this.getBlockIdAtCurrentPosition(par1World, 1, -1, -1, par3StructureBoundingBox) != 0) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), 1, 0, -1, par3StructureBoundingBox); + } + + for (var7 = 0; var7 < 6; ++var7) + { + for (int var8 = 0; var8 < 9; ++var8) + { + this.clearCurrentPositionBlocksUpwards(par1World, var8, 9, var7, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.cobblestone.blockID, 0, var8, -1, var7, par3StructureBoundingBox); + } + } + + this.spawnVillagers(par1World, par3StructureBoundingBox, 2, 1, 2, 1); + return true; + } + + /** + * Returns the villager type to spawn in this component, based on the number of villagers already spawned. + */ + protected int getVillagerType(int par1) + { + return 1; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageHouse2.java b/src/main/java/net/minecraft/src/ComponentVillageHouse2.java new file mode 100644 index 0000000..74920c3 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageHouse2.java @@ -0,0 +1,136 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillageHouse2 extends ComponentVillage +{ + /** List of items that Village's Blacksmith chest can contain. */ + private static final WeightedRandomChestContent[] villageBlacksmithChestContents = new WeightedRandomChestContent[] {new WeightedRandomChestContent(Item.diamond.itemID, 0, 1, 3, 3), new WeightedRandomChestContent(Item.ingotIron.itemID, 0, 1, 5, 10), new WeightedRandomChestContent(Item.ingotGold.itemID, 0, 1, 3, 5), new WeightedRandomChestContent(Item.bread.itemID, 0, 1, 3, 15), new WeightedRandomChestContent(Item.appleRed.itemID, 0, 1, 3, 15), new WeightedRandomChestContent(Item.pickaxeIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.swordIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.plateIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.helmetIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.legsIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Item.bootsIron.itemID, 0, 1, 1, 5), new WeightedRandomChestContent(Block.obsidian.blockID, 0, 3, 7, 5), new WeightedRandomChestContent(Block.sapling.blockID, 0, 3, 7, 5), new WeightedRandomChestContent(Item.saddle.itemID, 0, 1, 1, 3), new WeightedRandomChestContent(Item.horseArmorIron.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Item.horseArmorGold.itemID, 0, 1, 1, 1), new WeightedRandomChestContent(Item.horseArmorDiamond.itemID, 0, 1, 1, 1)}; + private boolean hasMadeChest; + + public ComponentVillageHouse2() {} + + public ComponentVillageHouse2(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par5; + this.boundingBox = par4StructureBoundingBox; + } + + public static ComponentVillageHouse2 func_74915_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) + { + StructureBoundingBox var8 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 10, 6, 7, par6); + return canVillageGoDeeper(var8) && StructureComponent.findIntersecting(par1List, var8) == null ? new ComponentVillageHouse2(par0ComponentVillageStartPiece, par7, par2Random, var8, par6) : null; + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Chest", this.hasMadeChest); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.hasMadeChest = par1NBTTagCompound.getBoolean("Chest"); + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 9, 4, 6, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 9, 0, 6, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 4, 0, 9, 4, 6, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 0, 9, 5, 6, Block.stoneSingleSlab.blockID, Block.stoneSingleSlab.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 1, 8, 5, 5, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 0, 2, 3, 0, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 0, 4, 0, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 1, 0, 3, 4, 0, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 6, 0, 4, 6, Block.wood.blockID, Block.wood.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 3, 3, 1, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 1, 2, 3, 3, 2, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 3, 5, 3, 3, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 1, 0, 3, 5, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 6, 5, 3, 6, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 1, 0, 5, 3, 0, Block.fence.blockID, Block.fence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 1, 0, 9, 3, 0, Block.fence.blockID, Block.fence.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 1, 4, 9, 4, 6, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.lavaMoving.blockID, 0, 7, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.lavaMoving.blockID, 0, 8, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fenceIron.blockID, 0, 9, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fenceIron.blockID, 0, 9, 2, 4, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 2, 4, 8, 2, 5, 0, 0, false); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 6, 1, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.furnaceIdle.blockID, 0, 6, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.furnaceIdle.blockID, 0, 6, 3, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stoneDoubleSlab.blockID, 0, 8, 1, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 2, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 2, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 2, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.pressurePlatePlanks.blockID, 0, 2, 2, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 1, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3), 2, 1, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 1), 1, 1, 4, par3StructureBoundingBox); + int var4; + int var5; + + if (!this.hasMadeChest) + { + var4 = this.getYWithOffset(1); + var5 = this.getXWithOffset(5, 5); + int var6 = this.getZWithOffset(5, 5); + + if (par3StructureBoundingBox.isVecInside(var5, var4, var6)) + { + this.hasMadeChest = true; + this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 5, 1, 5, villageBlacksmithChestContents, 3 + par2Random.nextInt(6)); + } + } + + for (var4 = 6; var4 <= 8; ++var4) + { + if (this.getBlockIdAtCurrentPosition(par1World, var4, 0, -1, par3StructureBoundingBox) == 0 && this.getBlockIdAtCurrentPosition(par1World, var4, -1, -1, par3StructureBoundingBox) != 0) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), var4, 0, -1, par3StructureBoundingBox); + } + } + + for (var4 = 0; var4 < 7; ++var4) + { + for (var5 = 0; var5 < 10; ++var5) + { + this.clearCurrentPositionBlocksUpwards(par1World, var5, 6, var4, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.cobblestone.blockID, 0, var5, -1, var4, par3StructureBoundingBox); + } + } + + this.spawnVillagers(par1World, par3StructureBoundingBox, 7, 1, 1, 1); + return true; + } + + /** + * Returns the villager type to spawn in this component, based on the number of villagers already spawned. + */ + protected int getVillagerType(int par1) + { + return 3; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageHouse3.java b/src/main/java/net/minecraft/src/ComponentVillageHouse3.java new file mode 100644 index 0000000..eca2e8a --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageHouse3.java @@ -0,0 +1,167 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillageHouse3 extends ComponentVillage +{ + public ComponentVillageHouse3() {} + + public ComponentVillageHouse3(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par5; + this.boundingBox = par4StructureBoundingBox; + } + + public static ComponentVillageHouse3 func_74921_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) + { + StructureBoundingBox var8 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 9, 7, 12, par6); + return canVillageGoDeeper(var8) && StructureComponent.findIntersecting(par1List, var8) == null ? new ComponentVillageHouse3(par0ComponentVillageStartPiece, par7, par2Random, var8, par6) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 7 - 1, 0); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 7, 4, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 1, 6, 8, 4, 10, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 0, 5, 8, 0, 10, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 7, 0, 4, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 0, 3, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 8, 0, 0, 8, 3, 10, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 7, 2, 0, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 5, 2, 1, 5, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 2, 0, 6, 2, 3, 10, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 0, 10, 7, 3, 10, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 0, 7, 3, 0, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 2, 5, 2, 3, 5, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 4, 1, 8, 4, 1, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 4, 4, 3, 4, 4, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 5, 2, 8, 5, 3, Block.planks.blockID, Block.planks.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 0, 4, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 0, 4, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 8, 4, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 8, 4, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 8, 4, 4, par3StructureBoundingBox); + int var4 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 3); + int var5 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 2); + int var6; + int var7; + + for (var6 = -1; var6 <= 2; ++var6) + { + for (var7 = 0; var7 <= 8; ++var7) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var4, var7, 4 + var6, var6, par3StructureBoundingBox); + + if ((var6 > -1 || var7 <= 1) && (var6 > 0 || var7 <= 3) && (var6 > 1 || var7 <= 4 || var7 >= 6)) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var5, var7, 4 + var6, 5 - var6, par3StructureBoundingBox); + } + } + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 4, 5, 3, 4, 10, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 4, 2, 7, 4, 10, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 5, 4, 4, 5, 10, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 5, 4, 6, 5, 10, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 5, 6, 3, 5, 6, 10, Block.planks.blockID, Block.planks.blockID, false); + var6 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 0); + int var8; + + for (var7 = 4; var7 >= 1; --var7) + { + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, var7, 2 + var7, 7 - var7, par3StructureBoundingBox); + + for (var8 = 8 - var7; var8 <= 10; ++var8) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var6, var7, 2 + var7, var8, par3StructureBoundingBox); + } + } + + var7 = this.getMetadataWithOffset(Block.stairsWoodOak.blockID, 1); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 6, 6, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 7, 5, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var7, 6, 6, 4, par3StructureBoundingBox); + int var9; + + for (var8 = 6; var8 <= 8; ++var8) + { + for (var9 = 5; var9 <= 10; ++var9) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsWoodOak.blockID, var7, var8, 12 - var8, var9, par3StructureBoundingBox); + } + } + + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 0, 2, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 0, 2, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 4, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 6, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 8, 2, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 8, 2, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 8, 2, 5, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 8, 2, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 8, 2, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 8, 2, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 2, 2, 6, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 2, 7, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 2, 8, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 2, 2, 9, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 4, 4, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 5, 4, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 6, 4, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 5, 5, 10, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, 1, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 2, 3, 1, par3StructureBoundingBox); + this.placeDoorAtCurrentPosition(par1World, par3StructureBoundingBox, par2Random, 2, 1, 0, this.getMetadataWithOffset(Block.doorWood.blockID, 1)); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, -1, 3, 2, -1, 0, 0, false); + + if (this.getBlockIdAtCurrentPosition(par1World, 2, 0, -1, par3StructureBoundingBox) == 0 && this.getBlockIdAtCurrentPosition(par1World, 2, -1, -1, par3StructureBoundingBox) != 0) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), 2, 0, -1, par3StructureBoundingBox); + } + + for (var8 = 0; var8 < 5; ++var8) + { + for (var9 = 0; var9 < 9; ++var9) + { + this.clearCurrentPositionBlocksUpwards(par1World, var9, 7, var8, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.cobblestone.blockID, 0, var9, -1, var8, par3StructureBoundingBox); + } + } + + for (var8 = 5; var8 < 11; ++var8) + { + for (var9 = 2; var9 < 9; ++var9) + { + this.clearCurrentPositionBlocksUpwards(par1World, var9, 7, var8, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.cobblestone.blockID, 0, var9, -1, var8, par3StructureBoundingBox); + } + } + + this.spawnVillagers(par1World, par3StructureBoundingBox, 4, 1, 2, 2); + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageHouse4_Garden.java b/src/main/java/net/minecraft/src/ComponentVillageHouse4_Garden.java new file mode 100644 index 0000000..d965629 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageHouse4_Garden.java @@ -0,0 +1,137 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillageHouse4_Garden extends ComponentVillage +{ + private boolean isRoofAccessible; + + public ComponentVillageHouse4_Garden() {} + + public ComponentVillageHouse4_Garden(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par5; + this.boundingBox = par4StructureBoundingBox; + this.isRoofAccessible = par3Random.nextBoolean(); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Terrace", this.isRoofAccessible); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.isRoofAccessible = par1NBTTagCompound.getBoolean("Terrace"); + } + + public static ComponentVillageHouse4_Garden func_74912_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) + { + StructureBoundingBox var8 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 5, 6, 5, par6); + return StructureComponent.findIntersecting(par1List, var8) != null ? null : new ComponentVillageHouse4_Garden(par0ComponentVillageStartPiece, par7, par2Random, var8, par6); + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 4, 0, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 4, 0, 4, 4, 4, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 1, 3, 4, 3, Block.planks.blockID, Block.planks.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 0, 1, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 0, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 0, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 4, 1, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 4, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 4, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 0, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 0, 2, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 0, 3, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 4, 1, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 4, 2, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cobblestone.blockID, 0, 4, 3, 4, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 1, 0, 3, 3, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 1, 1, 4, 3, 3, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 4, 3, 3, 4, Block.planks.blockID, Block.planks.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 2, 2, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 4, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 1, 1, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 1, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 1, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 2, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 3, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 3, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.planks.blockID, 0, 3, 1, 0, par3StructureBoundingBox); + + if (this.getBlockIdAtCurrentPosition(par1World, 2, 0, -1, par3StructureBoundingBox) == 0 && this.getBlockIdAtCurrentPosition(par1World, 2, -1, -1, par3StructureBoundingBox) != 0) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), 2, 0, -1, par3StructureBoundingBox); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 3, 3, 3, 0, 0, false); + + if (this.isRoofAccessible) + { + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 0, 5, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 5, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 2, 5, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 3, 5, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 5, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 0, 5, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 5, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 2, 5, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 3, 5, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 5, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 5, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 5, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 5, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 0, 5, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 0, 5, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 0, 5, 3, par3StructureBoundingBox); + } + + int var4; + + if (this.isRoofAccessible) + { + var4 = this.getMetadataWithOffset(Block.ladder.blockID, 3); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var4, 3, 1, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var4, 3, 2, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var4, 3, 3, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, var4, 3, 4, 3, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 2, 3, 1, par3StructureBoundingBox); + + for (var4 = 0; var4 < 5; ++var4) + { + for (int var5 = 0; var5 < 5; ++var5) + { + this.clearCurrentPositionBlocksUpwards(par1World, var5, 6, var4, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.cobblestone.blockID, 0, var5, -1, var4, par3StructureBoundingBox); + } + } + + this.spawnVillagers(par1World, par3StructureBoundingBox, 1, 1, 2, 1); + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillagePathGen.java b/src/main/java/net/minecraft/src/ComponentVillagePathGen.java new file mode 100644 index 0000000..3b8d25a --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillagePathGen.java @@ -0,0 +1,143 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillagePathGen extends ComponentVillageRoadPiece +{ + private int averageGroundLevel; + + public ComponentVillagePathGen() {} + + public ComponentVillagePathGen(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par5; + this.boundingBox = par4StructureBoundingBox; + this.averageGroundLevel = Math.max(par4StructureBoundingBox.getXSize(), par4StructureBoundingBox.getZSize()); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setInteger("Length", this.averageGroundLevel); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.averageGroundLevel = par1NBTTagCompound.getInteger("Length"); + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + boolean var4 = false; + int var5; + StructureComponent var6; + + for (var5 = par3Random.nextInt(5); var5 < this.averageGroundLevel - 8; var5 += 2 + par3Random.nextInt(5)) + { + var6 = this.getNextComponentNN((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, 0, var5); + + if (var6 != null) + { + var5 += Math.max(var6.boundingBox.getXSize(), var6.boundingBox.getZSize()); + var4 = true; + } + } + + for (var5 = par3Random.nextInt(5); var5 < this.averageGroundLevel - 8; var5 += 2 + par3Random.nextInt(5)) + { + var6 = this.getNextComponentPP((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, 0, var5); + + if (var6 != null) + { + var5 += Math.max(var6.boundingBox.getXSize(), var6.boundingBox.getZSize()); + var4 = true; + } + } + + if (var4 && par3Random.nextInt(3) > 0) + { + switch (this.coordBaseMode) + { + case 0: + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, 1, this.getComponentType()); + break; + + case 1: + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, this.getComponentType()); + break; + + case 2: + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, 1, this.getComponentType()); + break; + + case 3: + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.minZ - 1, 2, this.getComponentType()); + } + } + + if (var4 && par3Random.nextInt(3) > 0) + { + switch (this.coordBaseMode) + { + case 0: + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, 3, this.getComponentType()); + break; + + case 1: + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + break; + + case 2: + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, 3, this.getComponentType()); + break; + + case 3: + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + } + } + } + + public static StructureBoundingBox func_74933_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6) + { + for (int var7 = 7 * MathHelper.getRandomIntegerInRange(par2Random, 3, 5); var7 >= 7; var7 -= 7) + { + StructureBoundingBox var8 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 3, 3, var7, par6); + + if (StructureComponent.findIntersecting(par1List, var8) == null) + { + return var8; + } + } + + return null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + int var4 = this.getBiomeSpecificBlock(Block.gravel.blockID, 0); + + for (int var5 = this.boundingBox.minX; var5 <= this.boundingBox.maxX; ++var5) + { + for (int var6 = this.boundingBox.minZ; var6 <= this.boundingBox.maxZ; ++var6) + { + if (par3StructureBoundingBox.isVecInside(var5, 64, var6)) + { + int var7 = par1World.getTopSolidOrLiquidBlock(var5, var6) - 1; + par1World.setBlock(var5, var7, var6, var4, 0, 2); + } + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageRoadPiece.java b/src/main/java/net/minecraft/src/ComponentVillageRoadPiece.java new file mode 100644 index 0000000..132898b --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageRoadPiece.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public abstract class ComponentVillageRoadPiece extends ComponentVillage +{ + public ComponentVillageRoadPiece() {} + + protected ComponentVillageRoadPiece(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2) + { + super(par1ComponentVillageStartPiece, par2); + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageStartPiece.java b/src/main/java/net/minecraft/src/ComponentVillageStartPiece.java new file mode 100644 index 0000000..137d2ef --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageStartPiece.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class ComponentVillageStartPiece extends ComponentVillageWell +{ + public WorldChunkManager worldChunkMngr; + + /** Boolean that determines if the village is in a desert or not. */ + public boolean inDesert; + + /** World terrain type, 0 for normal, 1 for flap map */ + public int terrainType; + public StructureVillagePieceWeight structVillagePieceWeight; + + /** + * Contains List of all spawnable Structure Piece Weights. If no more Pieces of a type can be spawned, they are + * removed from this list + */ + public List structureVillageWeightedPieceList; + public List field_74932_i = new ArrayList(); + public List field_74930_j = new ArrayList(); + + public ComponentVillageStartPiece() {} + + public ComponentVillageStartPiece(WorldChunkManager par1WorldChunkManager, int par2, Random par3Random, int par4, int par5, List par6List, int par7) + { + super((ComponentVillageStartPiece)null, 0, par3Random, par4, par5); + this.worldChunkMngr = par1WorldChunkManager; + this.structureVillageWeightedPieceList = par6List; + this.terrainType = par7; + BiomeGenBase var8 = par1WorldChunkManager.getBiomeGenAt(par4, par5); + this.inDesert = var8 == BiomeGenBase.desert || var8 == BiomeGenBase.desertHills; + } + + public WorldChunkManager getWorldChunkManager() + { + return this.worldChunkMngr; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageTorch.java b/src/main/java/net/minecraft/src/ComponentVillageTorch.java new file mode 100644 index 0000000..f594b18 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageTorch.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillageTorch extends ComponentVillage +{ + public ComponentVillageTorch() {} + + public ComponentVillageTorch(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par5; + this.boundingBox = par4StructureBoundingBox; + } + + public static StructureBoundingBox func_74904_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6) + { + StructureBoundingBox var7 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 3, 4, 2, par6); + return StructureComponent.findIntersecting(par1List, var7) != null ? null : var7; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 3, 1, 0, 0, false); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 0, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 1, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 2, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.cloth.blockID, 15, 1, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 0, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 1, 3, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 2, 3, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, 1, 3, -1, par3StructureBoundingBox); + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageWell.java b/src/main/java/net/minecraft/src/ComponentVillageWell.java new file mode 100644 index 0000000..32df257 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageWell.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillageWell extends ComponentVillage +{ + public ComponentVillageWell() {} + + public ComponentVillageWell(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, int par4, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par3Random.nextInt(4); + + switch (this.coordBaseMode) + { + case 0: + case 2: + this.boundingBox = new StructureBoundingBox(par4, 64, par5, par4 + 6 - 1, 78, par5 + 6 - 1); + break; + + default: + this.boundingBox = new StructureBoundingBox(par4, 64, par5, par4 + 6 - 1, 78, par5 + 6 - 1); + } + } + + /** + * Initiates construction of the Structure Component picked, at the current Location of StructGen + */ + public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random) + { + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, 1, this.getComponentType()); + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, 3, this.getComponentType()); + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ - 1, 2, this.getComponentType()); + StructureVillagePieces.getNextStructureComponentVillagePath((ComponentVillageStartPiece)par1StructureComponent, par2List, par3Random, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 3, 0); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 4, 12, 4, Block.cobblestone.blockID, Block.waterMoving.blockID, false); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, 12, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 3, 12, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 2, 12, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 3, 12, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 13, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 14, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 13, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 14, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 13, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 1, 14, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 13, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, 4, 14, 4, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 15, 1, 4, 15, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + + for (int var4 = 0; var4 <= 5; ++var4) + { + for (int var5 = 0; var5 <= 5; ++var5) + { + if (var5 == 0 || var5 == 5 || var4 == 0 || var4 == 5) + { + this.placeBlockAtCurrentPosition(par1World, Block.gravel.blockID, 0, var5, 11, var4, par3StructureBoundingBox); + this.clearCurrentPositionBlocksUpwards(par1World, var5, 12, var4, par3StructureBoundingBox); + } + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ComponentVillageWoodHut.java b/src/main/java/net/minecraft/src/ComponentVillageWoodHut.java new file mode 100644 index 0000000..8911034 --- /dev/null +++ b/src/main/java/net/minecraft/src/ComponentVillageWoodHut.java @@ -0,0 +1,121 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ComponentVillageWoodHut extends ComponentVillage +{ + private boolean isTallHouse; + private int tablePosition; + + public ComponentVillageWoodHut() {} + + public ComponentVillageWoodHut(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) + { + super(par1ComponentVillageStartPiece, par2); + this.coordBaseMode = par5; + this.boundingBox = par4StructureBoundingBox; + this.isTallHouse = par3Random.nextBoolean(); + this.tablePosition = par3Random.nextInt(3); + } + + protected void func_143012_a(NBTTagCompound par1NBTTagCompound) + { + super.func_143012_a(par1NBTTagCompound); + par1NBTTagCompound.setInteger("T", this.tablePosition); + par1NBTTagCompound.setBoolean("C", this.isTallHouse); + } + + protected void func_143011_b(NBTTagCompound par1NBTTagCompound) + { + super.func_143011_b(par1NBTTagCompound); + this.tablePosition = par1NBTTagCompound.getInteger("T"); + this.isTallHouse = par1NBTTagCompound.getBoolean("C"); + } + + public static ComponentVillageWoodHut func_74908_a(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) + { + StructureBoundingBox var8 = StructureBoundingBox.getComponentToAddBoundingBox(par3, par4, par5, 0, 0, 0, 4, 6, 5, par6); + return canVillageGoDeeper(var8) && StructureComponent.findIntersecting(par1List, var8) == null ? new ComponentVillageWoodHut(par0ComponentVillageStartPiece, par7, par2Random, var8, par6) : null; + } + + /** + * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at + * the end, it adds Fences... + */ + public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) + { + if (this.field_143015_k < 0) + { + this.field_143015_k = this.getAverageGroundLevel(par1World, par3StructureBoundingBox); + + if (this.field_143015_k < 0) + { + return true; + } + + this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0); + } + + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 1, 3, 5, 4, 0, 0, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 3, 0, 4, Block.cobblestone.blockID, Block.cobblestone.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 2, 0, 3, Block.dirt.blockID, Block.dirt.blockID, false); + + if (this.isTallHouse) + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 4, 1, 2, 4, 3, Block.wood.blockID, Block.wood.blockID, false); + } + else + { + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 5, 1, 2, 5, 3, Block.wood.blockID, Block.wood.blockID, false); + } + + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 1, 4, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 2, 4, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 1, 4, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 2, 4, 4, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 0, 4, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 0, 4, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 0, 4, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 3, 4, 1, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 3, 4, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.wood.blockID, 0, 3, 4, 3, par3StructureBoundingBox); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 0, 3, 0, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 1, 0, 3, 3, 0, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 4, 0, 3, 4, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 1, 4, 3, 3, 4, Block.wood.blockID, Block.wood.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 1, 0, 3, 3, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 1, 1, 3, 3, 3, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 0, 2, 3, 0, Block.planks.blockID, Block.planks.blockID, false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 1, 4, 2, 3, 4, Block.planks.blockID, Block.planks.blockID, false); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 0, 2, 2, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.thinGlass.blockID, 0, 3, 2, 2, par3StructureBoundingBox); + + if (this.tablePosition > 0) + { + this.placeBlockAtCurrentPosition(par1World, Block.fence.blockID, 0, this.tablePosition, 1, 3, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, Block.pressurePlatePlanks.blockID, 0, this.tablePosition, 2, 3, par3StructureBoundingBox); + } + + this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 1, 0, par3StructureBoundingBox); + this.placeBlockAtCurrentPosition(par1World, 0, 0, 1, 2, 0, par3StructureBoundingBox); + this.placeDoorAtCurrentPosition(par1World, par3StructureBoundingBox, par2Random, 1, 1, 0, this.getMetadataWithOffset(Block.doorWood.blockID, 1)); + + if (this.getBlockIdAtCurrentPosition(par1World, 1, 0, -1, par3StructureBoundingBox) == 0 && this.getBlockIdAtCurrentPosition(par1World, 1, -1, -1, par3StructureBoundingBox) != 0) + { + this.placeBlockAtCurrentPosition(par1World, Block.stairsCobblestone.blockID, this.getMetadataWithOffset(Block.stairsCobblestone.blockID, 3), 1, 0, -1, par3StructureBoundingBox); + } + + for (int var4 = 0; var4 < 5; ++var4) + { + for (int var5 = 0; var5 < 4; ++var5) + { + this.clearCurrentPositionBlocksUpwards(par1World, var5, 6, var4, par3StructureBoundingBox); + this.fillCurrentPositionBlocksDownwards(par1World, Block.cobblestone.blockID, 0, var5, -1, var4, par3StructureBoundingBox); + } + } + + this.spawnVillagers(par1World, par3StructureBoundingBox, 1, 1, 2, 1); + return true; + } +} diff --git a/src/main/java/net/minecraft/src/CompressedStreamTools.java b/src/main/java/net/minecraft/src/CompressedStreamTools.java new file mode 100644 index 0000000..985d08f --- /dev/null +++ b/src/main/java/net/minecraft/src/CompressedStreamTools.java @@ -0,0 +1,177 @@ +package net.minecraft.src; + +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInput; +import java.io.DataInputStream; +import java.io.DataOutput; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +public class CompressedStreamTools +{ + /** + * Load the gzipped compound from the inputstream. + */ + public static NBTTagCompound readCompressed(InputStream par0InputStream) throws IOException + { + DataInputStream var1 = new DataInputStream(new BufferedInputStream(new GZIPInputStream(par0InputStream))); + NBTTagCompound var2; + + try + { + var2 = read(var1); + } + finally + { + var1.close(); + } + + return var2; + } + + /** + * Write the compound, gzipped, to the outputstream. + */ + public static void writeCompressed(NBTTagCompound par0NBTTagCompound, OutputStream par1OutputStream) throws IOException + { + DataOutputStream var2 = new DataOutputStream(new GZIPOutputStream(par1OutputStream)); + + try + { + write(par0NBTTagCompound, var2); + } + finally + { + var2.close(); + } + } + + public static NBTTagCompound decompress(byte[] par0ArrayOfByte) throws IOException + { + DataInputStream var1 = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(par0ArrayOfByte)))); + NBTTagCompound var2; + + try + { + var2 = read(var1); + } + finally + { + var1.close(); + } + + return var2; + } + + public static byte[] compress(NBTTagCompound par0NBTTagCompound) throws IOException + { + ByteArrayOutputStream var1 = new ByteArrayOutputStream(); + DataOutputStream var2 = new DataOutputStream(new GZIPOutputStream(var1)); + + try + { + write(par0NBTTagCompound, var2); + } + finally + { + var2.close(); + } + + return var1.toByteArray(); + } + + public static void safeWrite(NBTTagCompound par0NBTTagCompound, File par1File) throws IOException + { + File var2 = new File(par1File.getAbsolutePath() + "_tmp"); + + if (var2.exists()) + { + var2.delete(); + } + + write(par0NBTTagCompound, var2); + + if (par1File.exists()) + { + par1File.delete(); + } + + if (par1File.exists()) + { + throw new IOException("Failed to delete " + par1File); + } + else + { + var2.renameTo(par1File); + } + } + + public static void write(NBTTagCompound par0NBTTagCompound, File par1File) throws IOException + { + DataOutputStream var2 = new DataOutputStream(new FileOutputStream(par1File)); + + try + { + write(par0NBTTagCompound, var2); + } + finally + { + var2.close(); + } + } + + public static NBTTagCompound read(File par0File) throws IOException + { + if (!par0File.exists()) + { + return null; + } + else + { + DataInputStream var1 = new DataInputStream(new FileInputStream(par0File)); + NBTTagCompound var2; + + try + { + var2 = read(var1); + } + finally + { + var1.close(); + } + + return var2; + } + } + + /** + * Reads from a CompressedStream. + */ + public static NBTTagCompound read(DataInput par0DataInput) throws IOException + { + NBTBase var1 = NBTBase.readNamedTag(par0DataInput); + + if (var1 instanceof NBTTagCompound) + { + return (NBTTagCompound)var1; + } + else + { + throw new IOException("Root tag must be a named compound tag"); + } + } + + public static void write(NBTTagCompound par0NBTTagCompound, DataOutput par1DataOutput) throws IOException + { + NBTBase.writeNamedTag(par0NBTTagCompound, par1DataOutput); + } +} diff --git a/src/main/java/net/minecraft/src/Container.java b/src/main/java/net/minecraft/src/Container.java new file mode 100644 index 0000000..5cdeb2e --- /dev/null +++ b/src/main/java/net/minecraft/src/Container.java @@ -0,0 +1,773 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +public abstract class Container +{ + /** the list of all items(stacks) for the corresponding slot */ + public List inventoryItemStacks = new ArrayList(); + + /** the list of all slots in the inventory */ + public List inventorySlots = new ArrayList(); + public int windowId; + private short transactionID; + private int field_94535_f = -1; + private int field_94536_g; + private final Set field_94537_h = new HashSet(); + + /** + * list of all people that need to be notified when this craftinventory changes + */ + protected List crafters = new ArrayList(); + private Set playerList = new HashSet(); + + /** + * the slot is assumed empty + */ + protected Slot addSlotToContainer(Slot par1Slot) + { + par1Slot.slotNumber = this.inventorySlots.size(); + this.inventorySlots.add(par1Slot); + this.inventoryItemStacks.add((Object)null); + return par1Slot; + } + + public void addCraftingToCrafters(ICrafting par1ICrafting) + { + if (this.crafters.contains(par1ICrafting)) + { + throw new IllegalArgumentException("Listener already listening"); + } + else + { + this.crafters.add(par1ICrafting); + par1ICrafting.sendContainerAndContentsToPlayer(this, this.getInventory()); + this.detectAndSendChanges(); + } + } + + /** + * Remove this crafting listener from the listener list. + */ + public void removeCraftingFromCrafters(ICrafting par1ICrafting) + { + this.crafters.remove(par1ICrafting); + } + + /** + * returns a list if itemStacks, for each slot. + */ + public List getInventory() + { + ArrayList var1 = new ArrayList(); + + for (int var2 = 0; var2 < this.inventorySlots.size(); ++var2) + { + var1.add(((Slot)this.inventorySlots.get(var2)).getStack()); + } + + return var1; + } + + /** + * Looks for changes made in the container, sends them to every listener. + */ + public void detectAndSendChanges() + { + for (int var1 = 0; var1 < this.inventorySlots.size(); ++var1) + { + ItemStack var2 = ((Slot)this.inventorySlots.get(var1)).getStack(); + ItemStack var3 = (ItemStack)this.inventoryItemStacks.get(var1); + + if (!ItemStack.areItemStacksEqual(var3, var2)) + { + var3 = var2 == null ? null : var2.copy(); + this.inventoryItemStacks.set(var1, var3); + + for (int var4 = 0; var4 < this.crafters.size(); ++var4) + { + ((ICrafting)this.crafters.get(var4)).sendSlotContents(this, var1, var3); + } + } + } + } + + /** + * enchants the item on the table using the specified slot; also deducts XP from player + */ + public boolean enchantItem(EntityPlayer par1EntityPlayer, int par2) + { + return false; + } + + public Slot getSlotFromInventory(IInventory par1IInventory, int par2) + { + for (int var3 = 0; var3 < this.inventorySlots.size(); ++var3) + { + Slot var4 = (Slot)this.inventorySlots.get(var3); + + if (var4.isSlotInInventory(par1IInventory, par2)) + { + return var4; + } + } + + return null; + } + + public Slot getSlot(int par1) + { + return (Slot)this.inventorySlots.get(par1); + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + Slot var3 = (Slot)this.inventorySlots.get(par2); + return var3 != null ? var3.getStack() : null; + } + + public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer) + { + ItemStack var5 = null; + InventoryPlayer var6 = par4EntityPlayer.inventory; + int var9; + ItemStack var17; + + if (par3 == 5) + { + int var7 = this.field_94536_g; + this.field_94536_g = func_94532_c(par2); + + if ((var7 != 1 || this.field_94536_g != 2) && var7 != this.field_94536_g) + { + this.func_94533_d(); + } + else if (var6.getItemStack() == null) + { + this.func_94533_d(); + } + else if (this.field_94536_g == 0) + { + this.field_94535_f = func_94529_b(par2); + + if (func_94528_d(this.field_94535_f)) + { + this.field_94536_g = 1; + this.field_94537_h.clear(); + } + else + { + this.func_94533_d(); + } + } + else if (this.field_94536_g == 1) + { + Slot var8 = (Slot)this.inventorySlots.get(par1); + + if (var8 != null && func_94527_a(var8, var6.getItemStack(), true) && var8.isItemValid(var6.getItemStack()) && var6.getItemStack().stackSize > this.field_94537_h.size() && this.canDragIntoSlot(var8)) + { + this.field_94537_h.add(var8); + } + } + else if (this.field_94536_g == 2) + { + if (!this.field_94537_h.isEmpty()) + { + var17 = var6.getItemStack().copy(); + var9 = var6.getItemStack().stackSize; + Iterator var10 = this.field_94537_h.iterator(); + + while (var10.hasNext()) + { + Slot var11 = (Slot)var10.next(); + + if (var11 != null && func_94527_a(var11, var6.getItemStack(), true) && var11.isItemValid(var6.getItemStack()) && var6.getItemStack().stackSize >= this.field_94537_h.size() && this.canDragIntoSlot(var11)) + { + ItemStack var12 = var17.copy(); + int var13 = var11.getHasStack() ? var11.getStack().stackSize : 0; + func_94525_a(this.field_94537_h, this.field_94535_f, var12, var13); + + if (var12.stackSize > var12.getMaxStackSize()) + { + var12.stackSize = var12.getMaxStackSize(); + } + + if (var12.stackSize > var11.getSlotStackLimit()) + { + var12.stackSize = var11.getSlotStackLimit(); + } + + var9 -= var12.stackSize - var13; + var11.putStack(var12); + } + } + + var17.stackSize = var9; + + if (var17.stackSize <= 0) + { + var17 = null; + } + + var6.setItemStack(var17); + } + + this.func_94533_d(); + } + else + { + this.func_94533_d(); + } + } + else if (this.field_94536_g != 0) + { + this.func_94533_d(); + } + else + { + Slot var16; + int var19; + ItemStack var22; + + if ((par3 == 0 || par3 == 1) && (par2 == 0 || par2 == 1)) + { + if (par1 == -999) + { + if (var6.getItemStack() != null && par1 == -999) + { + if (par2 == 0) + { + par4EntityPlayer.dropPlayerItem(var6.getItemStack()); + var6.setItemStack((ItemStack)null); + } + + if (par2 == 1) + { + par4EntityPlayer.dropPlayerItem(var6.getItemStack().splitStack(1)); + + if (var6.getItemStack().stackSize == 0) + { + var6.setItemStack((ItemStack)null); + } + } + } + } + else if (par3 == 1) + { + if (par1 < 0) + { + return null; + } + + var16 = (Slot)this.inventorySlots.get(par1); + + if (var16 != null && var16.canTakeStack(par4EntityPlayer)) + { + var17 = this.transferStackInSlot(par4EntityPlayer, par1); + + if (var17 != null) + { + var9 = var17.itemID; + var5 = var17.copy(); + + if (var16 != null && var16.getStack() != null && var16.getStack().itemID == var9) + { + this.retrySlotClick(par1, par2, true, par4EntityPlayer); + } + } + } + } + else + { + if (par1 < 0) + { + return null; + } + + var16 = (Slot)this.inventorySlots.get(par1); + + if (var16 != null) + { + var17 = var16.getStack(); + ItemStack var20 = var6.getItemStack(); + + if (var17 != null) + { + var5 = var17.copy(); + } + + if (var17 == null) + { + if (var20 != null && var16.isItemValid(var20)) + { + var19 = par2 == 0 ? var20.stackSize : 1; + + if (var19 > var16.getSlotStackLimit()) + { + var19 = var16.getSlotStackLimit(); + } + + if (var20.stackSize >= var19) + { + var16.putStack(var20.splitStack(var19)); + } + + if (var20.stackSize == 0) + { + var6.setItemStack((ItemStack)null); + } + } + } + else if (var16.canTakeStack(par4EntityPlayer)) + { + if (var20 == null) + { + var19 = par2 == 0 ? var17.stackSize : (var17.stackSize + 1) / 2; + var22 = var16.decrStackSize(var19); + var6.setItemStack(var22); + + if (var17.stackSize == 0) + { + var16.putStack((ItemStack)null); + } + + var16.onPickupFromSlot(par4EntityPlayer, var6.getItemStack()); + } + else if (var16.isItemValid(var20)) + { + if (var17.itemID == var20.itemID && var17.getItemDamage() == var20.getItemDamage() && ItemStack.areItemStackTagsEqual(var17, var20)) + { + var19 = par2 == 0 ? var20.stackSize : 1; + + if (var19 > var16.getSlotStackLimit() - var17.stackSize) + { + var19 = var16.getSlotStackLimit() - var17.stackSize; + } + + if (var19 > var20.getMaxStackSize() - var17.stackSize) + { + var19 = var20.getMaxStackSize() - var17.stackSize; + } + + var20.splitStack(var19); + + if (var20.stackSize == 0) + { + var6.setItemStack((ItemStack)null); + } + + var17.stackSize += var19; + } + else if (var20.stackSize <= var16.getSlotStackLimit()) + { + var16.putStack(var20); + var6.setItemStack(var17); + } + } + else if (var17.itemID == var20.itemID && var20.getMaxStackSize() > 1 && (!var17.getHasSubtypes() || var17.getItemDamage() == var20.getItemDamage()) && ItemStack.areItemStackTagsEqual(var17, var20)) + { + var19 = var17.stackSize; + + if (var19 > 0 && var19 + var20.stackSize <= var20.getMaxStackSize()) + { + var20.stackSize += var19; + var17 = var16.decrStackSize(var19); + + if (var17.stackSize == 0) + { + var16.putStack((ItemStack)null); + } + + var16.onPickupFromSlot(par4EntityPlayer, var6.getItemStack()); + } + } + } + + var16.onSlotChanged(); + } + } + } + else if (par3 == 2 && par2 >= 0 && par2 < 9) + { + var16 = (Slot)this.inventorySlots.get(par1); + + if (var16.canTakeStack(par4EntityPlayer)) + { + var17 = var6.getStackInSlot(par2); + boolean var18 = var17 == null || var16.inventory == var6 && var16.isItemValid(var17); + var19 = -1; + + if (!var18) + { + var19 = var6.getFirstEmptyStack(); + var18 |= var19 > -1; + } + + if (var16.getHasStack() && var18) + { + var22 = var16.getStack(); + var6.setInventorySlotContents(par2, var22.copy()); + + if ((var16.inventory != var6 || !var16.isItemValid(var17)) && var17 != null) + { + if (var19 > -1) + { + var6.addItemStackToInventory(var17); + var16.decrStackSize(var22.stackSize); + var16.putStack((ItemStack)null); + var16.onPickupFromSlot(par4EntityPlayer, var22); + } + } + else + { + var16.decrStackSize(var22.stackSize); + var16.putStack(var17); + var16.onPickupFromSlot(par4EntityPlayer, var22); + } + } + else if (!var16.getHasStack() && var17 != null && var16.isItemValid(var17)) + { + var6.setInventorySlotContents(par2, (ItemStack)null); + var16.putStack(var17); + } + } + } + else if (par3 == 3 && par4EntityPlayer.capabilities.isCreativeMode && var6.getItemStack() == null && par1 >= 0) + { + var16 = (Slot)this.inventorySlots.get(par1); + + if (var16 != null && var16.getHasStack()) + { + var17 = var16.getStack().copy(); + var17.stackSize = var17.getMaxStackSize(); + var6.setItemStack(var17); + } + } + else if (par3 == 4 && var6.getItemStack() == null && par1 >= 0) + { + var16 = (Slot)this.inventorySlots.get(par1); + + if (var16 != null && var16.getHasStack() && var16.canTakeStack(par4EntityPlayer)) + { + var17 = var16.decrStackSize(par2 == 0 ? 1 : var16.getStack().stackSize); + var16.onPickupFromSlot(par4EntityPlayer, var17); + par4EntityPlayer.dropPlayerItem(var17); + } + } + else if (par3 == 6 && par1 >= 0) + { + var16 = (Slot)this.inventorySlots.get(par1); + var17 = var6.getItemStack(); + + if (var17 != null && (var16 == null || !var16.getHasStack() || !var16.canTakeStack(par4EntityPlayer))) + { + var9 = par2 == 0 ? 0 : this.inventorySlots.size() - 1; + var19 = par2 == 0 ? 1 : -1; + + for (int var21 = 0; var21 < 2; ++var21) + { + for (int var23 = var9; var23 >= 0 && var23 < this.inventorySlots.size() && var17.stackSize < var17.getMaxStackSize(); var23 += var19) + { + Slot var24 = (Slot)this.inventorySlots.get(var23); + + if (var24.getHasStack() && func_94527_a(var24, var17, true) && var24.canTakeStack(par4EntityPlayer) && this.func_94530_a(var17, var24) && (var21 != 0 || var24.getStack().stackSize != var24.getStack().getMaxStackSize())) + { + int var14 = Math.min(var17.getMaxStackSize() - var17.stackSize, var24.getStack().stackSize); + ItemStack var15 = var24.decrStackSize(var14); + var17.stackSize += var14; + + if (var15.stackSize <= 0) + { + var24.putStack((ItemStack)null); + } + + var24.onPickupFromSlot(par4EntityPlayer, var15); + } + } + } + } + + this.detectAndSendChanges(); + } + } + + return var5; + } + + public boolean func_94530_a(ItemStack par1ItemStack, Slot par2Slot) + { + return true; + } + + protected void retrySlotClick(int par1, int par2, boolean par3, EntityPlayer par4EntityPlayer) + { + this.slotClick(par1, par2, 1, par4EntityPlayer); + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + InventoryPlayer var2 = par1EntityPlayer.inventory; + + if (var2.getItemStack() != null) + { + par1EntityPlayer.dropPlayerItem(var2.getItemStack()); + var2.setItemStack((ItemStack)null); + } + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory par1IInventory) + { + this.detectAndSendChanges(); + } + + /** + * args: slotID, itemStack to put in slot + */ + public void putStackInSlot(int par1, ItemStack par2ItemStack) + { + this.getSlot(par1).putStack(par2ItemStack); + } + + /** + * places itemstacks in first x slots, x being aitemstack.lenght + */ + public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack) + { + for (int var2 = 0; var2 < par1ArrayOfItemStack.length; ++var2) + { + this.getSlot(var2).putStack(par1ArrayOfItemStack[var2]); + } + } + + public void updateProgressBar(int par1, int par2) {} + + /** + * Gets a unique transaction ID. Parameter is unused. + */ + public short getNextTransactionID(InventoryPlayer par1InventoryPlayer) + { + ++this.transactionID; + return this.transactionID; + } + + /** + * NotUsing because adding a player twice is an error + */ + public boolean isPlayerNotUsingContainer(EntityPlayer par1EntityPlayer) + { + return !this.playerList.contains(par1EntityPlayer); + } + + /** + * adds or removes the player from the container based on par2 + */ + public void setPlayerIsPresent(EntityPlayer par1EntityPlayer, boolean par2) + { + if (par2) + { + this.playerList.remove(par1EntityPlayer); + } + else + { + this.playerList.add(par1EntityPlayer); + } + } + + public abstract boolean canInteractWith(EntityPlayer var1); + + /** + * merges provided ItemStack with the first avaliable one in the container/player inventory + */ + protected boolean mergeItemStack(ItemStack par1ItemStack, int par2, int par3, boolean par4) + { + boolean var5 = false; + int var6 = par2; + + if (par4) + { + var6 = par3 - 1; + } + + Slot var7; + ItemStack var8; + + if (par1ItemStack.isStackable()) + { + while (par1ItemStack.stackSize > 0 && (!par4 && var6 < par3 || par4 && var6 >= par2)) + { + var7 = (Slot)this.inventorySlots.get(var6); + var8 = var7.getStack(); + + if (var8 != null && var8.itemID == par1ItemStack.itemID && (!par1ItemStack.getHasSubtypes() || par1ItemStack.getItemDamage() == var8.getItemDamage()) && ItemStack.areItemStackTagsEqual(par1ItemStack, var8)) + { + int var9 = var8.stackSize + par1ItemStack.stackSize; + + if (var9 <= par1ItemStack.getMaxStackSize()) + { + par1ItemStack.stackSize = 0; + var8.stackSize = var9; + var7.onSlotChanged(); + var5 = true; + } + else if (var8.stackSize < par1ItemStack.getMaxStackSize()) + { + par1ItemStack.stackSize -= par1ItemStack.getMaxStackSize() - var8.stackSize; + var8.stackSize = par1ItemStack.getMaxStackSize(); + var7.onSlotChanged(); + var5 = true; + } + } + + if (par4) + { + --var6; + } + else + { + ++var6; + } + } + } + + if (par1ItemStack.stackSize > 0) + { + if (par4) + { + var6 = par3 - 1; + } + else + { + var6 = par2; + } + + while (!par4 && var6 < par3 || par4 && var6 >= par2) + { + var7 = (Slot)this.inventorySlots.get(var6); + var8 = var7.getStack(); + + if (var8 == null) + { + var7.putStack(par1ItemStack.copy()); + var7.onSlotChanged(); + par1ItemStack.stackSize = 0; + var5 = true; + break; + } + + if (par4) + { + --var6; + } + else + { + ++var6; + } + } + } + + return var5; + } + + public static int func_94529_b(int par0) + { + return par0 >> 2 & 3; + } + + public static int func_94532_c(int par0) + { + return par0 & 3; + } + + public static int func_94534_d(int par0, int par1) + { + return par0 & 3 | (par1 & 3) << 2; + } + + public static boolean func_94528_d(int par0) + { + return par0 == 0 || par0 == 1; + } + + protected void func_94533_d() + { + this.field_94536_g = 0; + this.field_94537_h.clear(); + } + + public static boolean func_94527_a(Slot par0Slot, ItemStack par1ItemStack, boolean par2) + { + boolean var3 = par0Slot == null || !par0Slot.getHasStack(); + + if (par0Slot != null && par0Slot.getHasStack() && par1ItemStack != null && par1ItemStack.isItemEqual(par0Slot.getStack()) && ItemStack.areItemStackTagsEqual(par0Slot.getStack(), par1ItemStack)) + { + int var10002 = par2 ? 0 : par1ItemStack.stackSize; + var3 |= par0Slot.getStack().stackSize + var10002 <= par1ItemStack.getMaxStackSize(); + } + + return var3; + } + + public static void func_94525_a(Set par0Set, int par1, ItemStack par2ItemStack, int par3) + { + switch (par1) + { + case 0: + par2ItemStack.stackSize = MathHelper.floor_float((float)par2ItemStack.stackSize / (float)par0Set.size()); + break; + + case 1: + par2ItemStack.stackSize = 1; + } + + par2ItemStack.stackSize += par3; + } + + /** + * Returns true if the player can "drag-spilt" items into this slot,. returns true by default. Called to check if + * the slot can be added to a list of Slots to split the held ItemStack across. + */ + public boolean canDragIntoSlot(Slot par1Slot) + { + return true; + } + + public static int calcRedstoneFromInventory(IInventory par0IInventory) + { + if (par0IInventory == null) + { + return 0; + } + else + { + int var1 = 0; + float var2 = 0.0F; + + for (int var3 = 0; var3 < par0IInventory.getSizeInventory(); ++var3) + { + ItemStack var4 = par0IInventory.getStackInSlot(var3); + + if (var4 != null) + { + var2 += (float)var4.stackSize / (float)Math.min(par0IInventory.getInventoryStackLimit(), var4.getMaxStackSize()); + ++var1; + } + } + + var2 /= (float)par0IInventory.getSizeInventory(); + return MathHelper.floor_float(var2 * 14.0F) + (var1 > 0 ? 1 : 0); + } + } +} diff --git a/src/main/java/net/minecraft/src/ContainerBeacon.java b/src/main/java/net/minecraft/src/ContainerBeacon.java new file mode 100644 index 0000000..f416b0a --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerBeacon.java @@ -0,0 +1,147 @@ +package net.minecraft.src; + +public class ContainerBeacon extends Container +{ + private TileEntityBeacon theBeacon; + + /** + * This beacon's slot where you put in Emerald, Diamond, Gold or Iron Ingot. + */ + private final SlotBeacon beaconSlot; + private int field_82865_g; + private int field_82867_h; + private int field_82868_i; + + public ContainerBeacon(InventoryPlayer par1InventoryPlayer, TileEntityBeacon par2TileEntityBeacon) + { + this.theBeacon = par2TileEntityBeacon; + this.addSlotToContainer(this.beaconSlot = new SlotBeacon(this, par2TileEntityBeacon, 0, 136, 110)); + byte var3 = 36; + short var4 = 137; + int var5; + + for (var5 = 0; var5 < 3; ++var5) + { + for (int var6 = 0; var6 < 9; ++var6) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var6 + var5 * 9 + 9, var3 + var6 * 18, var4 + var5 * 18)); + } + } + + for (var5 = 0; var5 < 9; ++var5) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var5, var3 + var5 * 18, 58 + var4)); + } + + this.field_82865_g = par2TileEntityBeacon.getLevels(); + this.field_82867_h = par2TileEntityBeacon.getPrimaryEffect(); + this.field_82868_i = par2TileEntityBeacon.getSecondaryEffect(); + } + + public void addCraftingToCrafters(ICrafting par1ICrafting) + { + super.addCraftingToCrafters(par1ICrafting); + par1ICrafting.sendProgressBarUpdate(this, 0, this.field_82865_g); + par1ICrafting.sendProgressBarUpdate(this, 1, this.field_82867_h); + par1ICrafting.sendProgressBarUpdate(this, 2, this.field_82868_i); + } + + public void updateProgressBar(int par1, int par2) + { + if (par1 == 0) + { + this.theBeacon.setLevels(par2); + } + + if (par1 == 1) + { + this.theBeacon.setPrimaryEffect(par2); + } + + if (par1 == 2) + { + this.theBeacon.setSecondaryEffect(par2); + } + } + + /** + * Returns the Tile Entity behind this beacon inventory / container + */ + public TileEntityBeacon getBeacon() + { + return this.theBeacon; + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.theBeacon.isUseableByPlayer(par1EntityPlayer); + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 == 0) + { + if (!this.mergeItemStack(var5, 1, 37, true)) + { + return null; + } + + var4.onSlotChange(var5, var3); + } + else if (!this.beaconSlot.getHasStack() && this.beaconSlot.isItemValid(var5) && var5.stackSize == 1) + { + if (!this.mergeItemStack(var5, 0, 1, false)) + { + return null; + } + } + else if (par2 >= 1 && par2 < 28) + { + if (!this.mergeItemStack(var5, 28, 37, false)) + { + return null; + } + } + else if (par2 >= 28 && par2 < 37) + { + if (!this.mergeItemStack(var5, 1, 28, false)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 1, 37, false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) + { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } +} diff --git a/src/main/java/net/minecraft/src/ContainerBrewingStand.java b/src/main/java/net/minecraft/src/ContainerBrewingStand.java new file mode 100644 index 0000000..1d070ea --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerBrewingStand.java @@ -0,0 +1,150 @@ +package net.minecraft.src; + +public class ContainerBrewingStand extends Container +{ + private TileEntityBrewingStand tileBrewingStand; + + /** Instance of Slot. */ + private final Slot theSlot; + private int brewTime; + + public ContainerBrewingStand(InventoryPlayer par1InventoryPlayer, TileEntityBrewingStand par2TileEntityBrewingStand) + { + this.tileBrewingStand = par2TileEntityBrewingStand; + this.addSlotToContainer(new SlotBrewingStandPotion(par1InventoryPlayer.player, par2TileEntityBrewingStand, 0, 56, 46)); + this.addSlotToContainer(new SlotBrewingStandPotion(par1InventoryPlayer.player, par2TileEntityBrewingStand, 1, 79, 53)); + this.addSlotToContainer(new SlotBrewingStandPotion(par1InventoryPlayer.player, par2TileEntityBrewingStand, 2, 102, 46)); + this.theSlot = this.addSlotToContainer(new SlotBrewingStandIngredient(this, par2TileEntityBrewingStand, 3, 79, 17)); + int var3; + + for (var3 = 0; var3 < 3; ++var3) + { + for (int var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); + } + } + + for (var3 = 0; var3 < 9; ++var3) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142)); + } + } + + public void addCraftingToCrafters(ICrafting par1ICrafting) + { + super.addCraftingToCrafters(par1ICrafting); + par1ICrafting.sendProgressBarUpdate(this, 0, this.tileBrewingStand.getBrewTime()); + } + + /** + * Looks for changes made in the container, sends them to every listener. + */ + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + + for (int var1 = 0; var1 < this.crafters.size(); ++var1) + { + ICrafting var2 = (ICrafting)this.crafters.get(var1); + + if (this.brewTime != this.tileBrewingStand.getBrewTime()) + { + var2.sendProgressBarUpdate(this, 0, this.tileBrewingStand.getBrewTime()); + } + } + + this.brewTime = this.tileBrewingStand.getBrewTime(); + } + + public void updateProgressBar(int par1, int par2) + { + if (par1 == 0) + { + this.tileBrewingStand.setBrewTime(par2); + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.tileBrewingStand.isUseableByPlayer(par1EntityPlayer); + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if ((par2 < 0 || par2 > 2) && par2 != 3) + { + if (!this.theSlot.getHasStack() && this.theSlot.isItemValid(var5)) + { + if (!this.mergeItemStack(var5, 3, 4, false)) + { + return null; + } + } + else if (SlotBrewingStandPotion.canHoldPotion(var3)) + { + if (!this.mergeItemStack(var5, 0, 3, false)) + { + return null; + } + } + else if (par2 >= 4 && par2 < 31) + { + if (!this.mergeItemStack(var5, 31, 40, false)) + { + return null; + } + } + else if (par2 >= 31 && par2 < 40) + { + if (!this.mergeItemStack(var5, 4, 31, false)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 4, 40, false)) + { + return null; + } + } + else + { + if (!this.mergeItemStack(var5, 4, 40, true)) + { + return null; + } + + var4.onSlotChange(var5, var3); + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) + { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } +} diff --git a/src/main/java/net/minecraft/src/ContainerChest.java b/src/main/java/net/minecraft/src/ContainerChest.java new file mode 100644 index 0000000..0c6f799 --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerChest.java @@ -0,0 +1,98 @@ +package net.minecraft.src; + +public class ContainerChest extends Container +{ + private IInventory lowerChestInventory; + private int numRows; + + public ContainerChest(IInventory par1IInventory, IInventory par2IInventory) + { + this.lowerChestInventory = par2IInventory; + this.numRows = par2IInventory.getSizeInventory() / 9; + par2IInventory.openChest(); + int var3 = (this.numRows - 4) * 18; + int var4; + int var5; + + for (var4 = 0; var4 < this.numRows; ++var4) + { + for (var5 = 0; var5 < 9; ++var5) + { + this.addSlotToContainer(new Slot(par2IInventory, var5 + var4 * 9, 8 + var5 * 18, 18 + var4 * 18)); + } + } + + for (var4 = 0; var4 < 3; ++var4) + { + for (var5 = 0; var5 < 9; ++var5) + { + this.addSlotToContainer(new Slot(par1IInventory, var5 + var4 * 9 + 9, 8 + var5 * 18, 103 + var4 * 18 + var3)); + } + } + + for (var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(par1IInventory, var4, 8 + var4 * 18, 161 + var3)); + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.lowerChestInventory.isUseableByPlayer(par1EntityPlayer); + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 < this.numRows * 9) + { + if (!this.mergeItemStack(var5, this.numRows * 9, this.inventorySlots.size(), true)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 0, this.numRows * 9, false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + } + + return var3; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + this.lowerChestInventory.closeChest(); + } + + /** + * Return this chest container's lower chest inventory. + */ + public IInventory getLowerChestInventory() + { + return this.lowerChestInventory; + } +} diff --git a/src/main/java/net/minecraft/src/ContainerCreative.java b/src/main/java/net/minecraft/src/ContainerCreative.java new file mode 100644 index 0000000..b4119a4 --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerCreative.java @@ -0,0 +1,109 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +class ContainerCreative extends Container +{ + /** the list of items in this container */ + public List itemList = new ArrayList(); + + public ContainerCreative(EntityPlayer par1EntityPlayer) + { + InventoryPlayer var2 = par1EntityPlayer.inventory; + int var3; + + for (var3 = 0; var3 < 5; ++var3) + { + for (int var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(GuiContainerCreative.getInventory(), var3 * 9 + var4, 9 + var4 * 18, 18 + var3 * 18)); + } + } + + for (var3 = 0; var3 < 9; ++var3) + { + this.addSlotToContainer(new Slot(var2, var3, 9 + var3 * 18, 112)); + } + + this.scrollTo(0.0F); + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return true; + } + + /** + * Updates the gui slots ItemStack's based on scroll position. + */ + public void scrollTo(float par1) + { + int var2 = this.itemList.size() / 9 - 5 + 1; + int var3 = (int)((double)(par1 * (float)var2) + 0.5D); + + if (var3 < 0) + { + var3 = 0; + } + + for (int var4 = 0; var4 < 5; ++var4) + { + for (int var5 = 0; var5 < 9; ++var5) + { + int var6 = var5 + (var4 + var3) * 9; + + if (var6 >= 0 && var6 < this.itemList.size()) + { + GuiContainerCreative.getInventory().setInventorySlotContents(var5 + var4 * 9, (ItemStack)this.itemList.get(var6)); + } + else + { + GuiContainerCreative.getInventory().setInventorySlotContents(var5 + var4 * 9, (ItemStack)null); + } + } + } + } + + /** + * theCreativeContainer seems to be hard coded to 9x5 items + */ + public boolean hasMoreThan1PageOfItemsInList() + { + return this.itemList.size() > 45; + } + + protected void retrySlotClick(int par1, int par2, boolean par3, EntityPlayer par4EntityPlayer) {} + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + if (par2 >= this.inventorySlots.size() - 9 && par2 < this.inventorySlots.size()) + { + Slot var3 = (Slot)this.inventorySlots.get(par2); + + if (var3 != null && var3.getHasStack()) + { + var3.putStack((ItemStack)null); + } + } + + return null; + } + + public boolean func_94530_a(ItemStack par1ItemStack, Slot par2Slot) + { + return par2Slot.yDisplayPosition > 90; + } + + /** + * Returns true if the player can "drag-spilt" items into this slot,. returns true by default. Called to check if + * the slot can be added to a list of Slots to split the held ItemStack across. + */ + public boolean canDragIntoSlot(Slot par1Slot) + { + return par1Slot.inventory instanceof InventoryPlayer || par1Slot.yDisplayPosition > 90 && par1Slot.xDisplayPosition <= 162; + } +} diff --git a/src/main/java/net/minecraft/src/ContainerDispenser.java b/src/main/java/net/minecraft/src/ContainerDispenser.java new file mode 100644 index 0000000..35bfdc7 --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerDispenser.java @@ -0,0 +1,84 @@ +package net.minecraft.src; + +public class ContainerDispenser extends Container +{ + private TileEntityDispenser tileEntityDispenser; + + public ContainerDispenser(IInventory par1IInventory, TileEntityDispenser par2TileEntityDispenser) + { + this.tileEntityDispenser = par2TileEntityDispenser; + int var3; + int var4; + + for (var3 = 0; var3 < 3; ++var3) + { + for (var4 = 0; var4 < 3; ++var4) + { + this.addSlotToContainer(new Slot(par2TileEntityDispenser, var4 + var3 * 3, 62 + var4 * 18, 17 + var3 * 18)); + } + } + + for (var3 = 0; var3 < 3; ++var3) + { + for (var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(par1IInventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); + } + } + + for (var3 = 0; var3 < 9; ++var3) + { + this.addSlotToContainer(new Slot(par1IInventory, var3, 8 + var3 * 18, 142)); + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.tileEntityDispenser.isUseableByPlayer(par1EntityPlayer); + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 < 9) + { + if (!this.mergeItemStack(var5, 9, 45, true)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 0, 9, false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) + { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } +} diff --git a/src/main/java/net/minecraft/src/ContainerEnchantment.java b/src/main/java/net/minecraft/src/ContainerEnchantment.java new file mode 100644 index 0000000..aca3cb6 --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerEnchantment.java @@ -0,0 +1,297 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ContainerEnchantment extends Container +{ + /** SlotEnchantmentTable object with ItemStack to be enchanted */ + public IInventory tableInventory = new SlotEnchantmentTable(this, "Enchant", true, 1); + + /** current world (for bookshelf counting) */ + private World worldPointer; + private int posX; + private int posY; + private int posZ; + private Random rand = new Random(); + + /** used as seed for EnchantmentNameParts (see GuiEnchantment) */ + public long nameSeed; + + /** 3-member array storing the enchantment levels of each slot */ + public int[] enchantLevels = new int[3]; + + public ContainerEnchantment(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) + { + this.worldPointer = par2World; + this.posX = par3; + this.posY = par4; + this.posZ = par5; + this.addSlotToContainer(new SlotEnchantment(this, this.tableInventory, 0, 25, 47)); + int var6; + + for (var6 = 0; var6 < 3; ++var6) + { + for (int var7 = 0; var7 < 9; ++var7) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18)); + } + } + + for (var6 = 0; var6 < 9; ++var6) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var6, 8 + var6 * 18, 142)); + } + } + + public void addCraftingToCrafters(ICrafting par1ICrafting) + { + super.addCraftingToCrafters(par1ICrafting); + par1ICrafting.sendProgressBarUpdate(this, 0, this.enchantLevels[0]); + par1ICrafting.sendProgressBarUpdate(this, 1, this.enchantLevels[1]); + par1ICrafting.sendProgressBarUpdate(this, 2, this.enchantLevels[2]); + } + + /** + * Looks for changes made in the container, sends them to every listener. + */ + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + + for (int var1 = 0; var1 < this.crafters.size(); ++var1) + { + ICrafting var2 = (ICrafting)this.crafters.get(var1); + var2.sendProgressBarUpdate(this, 0, this.enchantLevels[0]); + var2.sendProgressBarUpdate(this, 1, this.enchantLevels[1]); + var2.sendProgressBarUpdate(this, 2, this.enchantLevels[2]); + } + } + + public void updateProgressBar(int par1, int par2) + { + if (par1 >= 0 && par1 <= 2) + { + this.enchantLevels[par1] = par2; + } + else + { + super.updateProgressBar(par1, par2); + } + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory par1IInventory) + { + if (par1IInventory == this.tableInventory) + { + ItemStack var2 = par1IInventory.getStackInSlot(0); + int var3; + + if (var2 != null && var2.isItemEnchantable()) + { + this.nameSeed = this.rand.nextLong(); + + if (!this.worldPointer.isRemote) + { + var3 = 0; + int var4; + + for (var4 = -1; var4 <= 1; ++var4) + { + for (int var5 = -1; var5 <= 1; ++var5) + { + if ((var4 != 0 || var5 != 0) && this.worldPointer.isAirBlock(this.posX + var5, this.posY, this.posZ + var4) && this.worldPointer.isAirBlock(this.posX + var5, this.posY + 1, this.posZ + var4)) + { + if (this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY, this.posZ + var4 * 2) == Block.bookShelf.blockID) + { + ++var3; + } + + if (this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY + 1, this.posZ + var4 * 2) == Block.bookShelf.blockID) + { + ++var3; + } + + if (var5 != 0 && var4 != 0) + { + if (this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY, this.posZ + var4) == Block.bookShelf.blockID) + { + ++var3; + } + + if (this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY + 1, this.posZ + var4) == Block.bookShelf.blockID) + { + ++var3; + } + + if (this.worldPointer.getBlockId(this.posX + var5, this.posY, this.posZ + var4 * 2) == Block.bookShelf.blockID) + { + ++var3; + } + + if (this.worldPointer.getBlockId(this.posX + var5, this.posY + 1, this.posZ + var4 * 2) == Block.bookShelf.blockID) + { + ++var3; + } + } + } + } + } + + for (var4 = 0; var4 < 3; ++var4) + { + this.enchantLevels[var4] = EnchantmentHelper.calcItemStackEnchantability(this.rand, var4, var3, var2); + } + + this.detectAndSendChanges(); + } + } + else + { + for (var3 = 0; var3 < 3; ++var3) + { + this.enchantLevels[var3] = 0; + } + } + } + } + + /** + * enchants the item on the table using the specified slot; also deducts XP from player + */ + public boolean enchantItem(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = this.tableInventory.getStackInSlot(0); + + if (this.enchantLevels[par2] > 0 && var3 != null && (par1EntityPlayer.experienceLevel >= this.enchantLevels[par2] || par1EntityPlayer.capabilities.isCreativeMode)) + { + if (!this.worldPointer.isRemote) + { + List var4 = EnchantmentHelper.buildEnchantmentList(this.rand, var3, this.enchantLevels[par2]); + boolean var5 = var3.itemID == Item.book.itemID; + + if (var4 != null) + { + par1EntityPlayer.addExperienceLevel(-this.enchantLevels[par2]); + + if (var5) + { + var3.itemID = Item.enchantedBook.itemID; + } + + int var6 = var5 ? this.rand.nextInt(var4.size()) : -1; + + for (int var7 = 0; var7 < var4.size(); ++var7) + { + EnchantmentData var8 = (EnchantmentData)var4.get(var7); + + if (!var5 || var7 == var6) + { + if (var5) + { + Item.enchantedBook.addEnchantment(var3, var8); + } + else + { + var3.addEnchantment(var8.enchantmentobj, var8.enchantmentLevel); + } + } + } + + this.onCraftMatrixChanged(this.tableInventory); + } + } + + return true; + } + else + { + return false; + } + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + + if (!this.worldPointer.isRemote) + { + ItemStack var2 = this.tableInventory.getStackInSlotOnClosing(0); + + if (var2 != null) + { + par1EntityPlayer.dropPlayerItem(var2); + } + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.worldPointer.getBlockId(this.posX, this.posY, this.posZ) != Block.enchantmentTable.blockID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D; + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 == 0) + { + if (!this.mergeItemStack(var5, 1, 37, true)) + { + return null; + } + } + else + { + if (((Slot)this.inventorySlots.get(0)).getHasStack() || !((Slot)this.inventorySlots.get(0)).isItemValid(var5)) + { + return null; + } + + if (var5.hasTagCompound() && var5.stackSize == 1) + { + ((Slot)this.inventorySlots.get(0)).putStack(var5.copy()); + var5.stackSize = 0; + } + else if (var5.stackSize >= 1) + { + ((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(var5.itemID, 1, var5.getItemDamage())); + --var5.stackSize; + } + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) + { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } +} diff --git a/src/main/java/net/minecraft/src/ContainerFurnace.java b/src/main/java/net/minecraft/src/ContainerFurnace.java new file mode 100644 index 0000000..2ced02d --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerFurnace.java @@ -0,0 +1,169 @@ +package net.minecraft.src; + +public class ContainerFurnace extends Container +{ + private TileEntityFurnace furnace; + private int lastCookTime; + private int lastBurnTime; + private int lastItemBurnTime; + + public ContainerFurnace(InventoryPlayer par1InventoryPlayer, TileEntityFurnace par2TileEntityFurnace) + { + this.furnace = par2TileEntityFurnace; + this.addSlotToContainer(new Slot(par2TileEntityFurnace, 0, 56, 17)); + this.addSlotToContainer(new Slot(par2TileEntityFurnace, 1, 56, 53)); + this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, par2TileEntityFurnace, 2, 116, 35)); + int var3; + + for (var3 = 0; var3 < 3; ++var3) + { + for (int var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); + } + } + + for (var3 = 0; var3 < 9; ++var3) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142)); + } + } + + public void addCraftingToCrafters(ICrafting par1ICrafting) + { + super.addCraftingToCrafters(par1ICrafting); + par1ICrafting.sendProgressBarUpdate(this, 0, this.furnace.furnaceCookTime); + par1ICrafting.sendProgressBarUpdate(this, 1, this.furnace.furnaceBurnTime); + par1ICrafting.sendProgressBarUpdate(this, 2, this.furnace.currentItemBurnTime); + } + + /** + * Looks for changes made in the container, sends them to every listener. + */ + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + + for (int var1 = 0; var1 < this.crafters.size(); ++var1) + { + ICrafting var2 = (ICrafting)this.crafters.get(var1); + + if (this.lastCookTime != this.furnace.furnaceCookTime) + { + var2.sendProgressBarUpdate(this, 0, this.furnace.furnaceCookTime); + } + + if (this.lastBurnTime != this.furnace.furnaceBurnTime) + { + var2.sendProgressBarUpdate(this, 1, this.furnace.furnaceBurnTime); + } + + if (this.lastItemBurnTime != this.furnace.currentItemBurnTime) + { + var2.sendProgressBarUpdate(this, 2, this.furnace.currentItemBurnTime); + } + } + + this.lastCookTime = this.furnace.furnaceCookTime; + this.lastBurnTime = this.furnace.furnaceBurnTime; + this.lastItemBurnTime = this.furnace.currentItemBurnTime; + } + + public void updateProgressBar(int par1, int par2) + { + if (par1 == 0) + { + this.furnace.furnaceCookTime = par2; + } + + if (par1 == 1) + { + this.furnace.furnaceBurnTime = par2; + } + + if (par1 == 2) + { + this.furnace.currentItemBurnTime = par2; + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.furnace.isUseableByPlayer(par1EntityPlayer); + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 == 2) + { + if (!this.mergeItemStack(var5, 3, 39, true)) + { + return null; + } + + var4.onSlotChange(var5, var3); + } + else if (par2 != 1 && par2 != 0) + { + if (FurnaceRecipes.smelting().getSmeltingResult(var5.getItem().itemID) != null) + { + if (!this.mergeItemStack(var5, 0, 1, false)) + { + return null; + } + } + else if (TileEntityFurnace.isItemFuel(var5)) + { + if (!this.mergeItemStack(var5, 1, 2, false)) + { + return null; + } + } + else if (par2 >= 3 && par2 < 30) + { + if (!this.mergeItemStack(var5, 30, 39, false)) + { + return null; + } + } + else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(var5, 3, 30, false)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 3, 39, false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) + { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } +} diff --git a/src/main/java/net/minecraft/src/ContainerHopper.java b/src/main/java/net/minecraft/src/ContainerHopper.java new file mode 100644 index 0000000..d3dfe74 --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerHopper.java @@ -0,0 +1,84 @@ +package net.minecraft.src; + +public class ContainerHopper extends Container +{ + private final IInventory field_94538_a; + + public ContainerHopper(InventoryPlayer par1InventoryPlayer, IInventory par2IInventory) + { + this.field_94538_a = par2IInventory; + par2IInventory.openChest(); + byte var3 = 51; + int var4; + + for (var4 = 0; var4 < par2IInventory.getSizeInventory(); ++var4) + { + this.addSlotToContainer(new Slot(par2IInventory, var4, 44 + var4 * 18, 20)); + } + + for (var4 = 0; var4 < 3; ++var4) + { + for (int var5 = 0; var5 < 9; ++var5) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var5 + var4 * 9 + 9, 8 + var5 * 18, var4 * 18 + var3)); + } + } + + for (var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var4, 8 + var4 * 18, 58 + var3)); + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.field_94538_a.isUseableByPlayer(par1EntityPlayer); + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 < this.field_94538_a.getSizeInventory()) + { + if (!this.mergeItemStack(var5, this.field_94538_a.getSizeInventory(), this.inventorySlots.size(), true)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 0, this.field_94538_a.getSizeInventory(), false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + } + + return var3; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + this.field_94538_a.closeChest(); + } +} diff --git a/src/main/java/net/minecraft/src/ContainerHorseInventory.java b/src/main/java/net/minecraft/src/ContainerHorseInventory.java new file mode 100644 index 0000000..bde1ef9 --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerHorseInventory.java @@ -0,0 +1,110 @@ +package net.minecraft.src; + +public class ContainerHorseInventory extends Container +{ + private IInventory field_111243_a; + private EntityHorse theHorse; + + public ContainerHorseInventory(IInventory par1IInventory, IInventory par2IInventory, EntityHorse par3EntityHorse) + { + this.field_111243_a = par2IInventory; + this.theHorse = par3EntityHorse; + byte var4 = 3; + par2IInventory.openChest(); + int var5 = (var4 - 4) * 18; + this.addSlotToContainer(new ContainerHorseInventorySlotSaddle(this, par2IInventory, 0, 8, 18)); + this.addSlotToContainer(new ContainerHorseInventorySlotArmor(this, par2IInventory, 1, 8, 36, par3EntityHorse)); + int var6; + int var7; + + if (par3EntityHorse.isChested()) + { + for (var6 = 0; var6 < var4; ++var6) + { + for (var7 = 0; var7 < 5; ++var7) + { + this.addSlotToContainer(new Slot(par2IInventory, 2 + var7 + var6 * 5, 80 + var7 * 18, 18 + var6 * 18)); + } + } + } + + for (var6 = 0; var6 < 3; ++var6) + { + for (var7 = 0; var7 < 9; ++var7) + { + this.addSlotToContainer(new Slot(par1IInventory, var7 + var6 * 9 + 9, 8 + var7 * 18, 102 + var6 * 18 + var5)); + } + } + + for (var6 = 0; var6 < 9; ++var6) + { + this.addSlotToContainer(new Slot(par1IInventory, var6, 8 + var6 * 18, 160 + var5)); + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.field_111243_a.isUseableByPlayer(par1EntityPlayer) && this.theHorse.isEntityAlive() && this.theHorse.getDistanceToEntity(par1EntityPlayer) < 8.0F; + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 < this.field_111243_a.getSizeInventory()) + { + if (!this.mergeItemStack(var5, this.field_111243_a.getSizeInventory(), this.inventorySlots.size(), true)) + { + return null; + } + } + else if (this.getSlot(1).isItemValid(var5) && !this.getSlot(1).getHasStack()) + { + if (!this.mergeItemStack(var5, 1, 2, false)) + { + return null; + } + } + else if (this.getSlot(0).isItemValid(var5)) + { + if (!this.mergeItemStack(var5, 0, 1, false)) + { + return null; + } + } + else if (this.field_111243_a.getSizeInventory() <= 2 || !this.mergeItemStack(var5, 2, this.field_111243_a.getSizeInventory(), false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + } + + return var3; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + this.field_111243_a.closeChest(); + } +} diff --git a/src/main/java/net/minecraft/src/ContainerHorseInventorySlotArmor.java b/src/main/java/net/minecraft/src/ContainerHorseInventorySlotArmor.java new file mode 100644 index 0000000..7a0df47 --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerHorseInventorySlotArmor.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +class ContainerHorseInventorySlotArmor extends Slot +{ + final EntityHorse theHorse; + + final ContainerHorseInventory field_111240_b; + + ContainerHorseInventorySlotArmor(ContainerHorseInventory par1ContainerHorseInventory, IInventory par2IInventory, int par3, int par4, int par5, EntityHorse par6EntityHorse) + { + super(par2IInventory, par3, par4, par5); + this.field_111240_b = par1ContainerHorseInventory; + this.theHorse = par6EntityHorse; + } + + /** + * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + */ + public boolean isItemValid(ItemStack par1ItemStack) + { + return super.isItemValid(par1ItemStack) && this.theHorse.func_110259_cr() && EntityHorse.func_110211_v(par1ItemStack.itemID); + } + + public boolean func_111238_b() + { + return this.theHorse.func_110259_cr(); + } +} diff --git a/src/main/java/net/minecraft/src/ContainerHorseInventorySlotSaddle.java b/src/main/java/net/minecraft/src/ContainerHorseInventorySlotSaddle.java new file mode 100644 index 0000000..6b24732 --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerHorseInventorySlotSaddle.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +class ContainerHorseInventorySlotSaddle extends Slot +{ + final ContainerHorseInventory field_111239_a; + + ContainerHorseInventorySlotSaddle(ContainerHorseInventory par1ContainerHorseInventory, IInventory par2IInventory, int par3, int par4, int par5) + { + super(par2IInventory, par3, par4, par5); + this.field_111239_a = par1ContainerHorseInventory; + } + + /** + * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + */ + public boolean isItemValid(ItemStack par1ItemStack) + { + return super.isItemValid(par1ItemStack) && par1ItemStack.itemID == Item.saddle.itemID && !this.getHasStack(); + } +} diff --git a/src/main/java/net/minecraft/src/ContainerMerchant.java b/src/main/java/net/minecraft/src/ContainerMerchant.java new file mode 100644 index 0000000..fd03580 --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerMerchant.java @@ -0,0 +1,162 @@ +package net.minecraft.src; + +public class ContainerMerchant extends Container +{ + /** Instance of Merchant. */ + private IMerchant theMerchant; + private InventoryMerchant merchantInventory; + + /** Instance of World. */ + private final World theWorld; + + public ContainerMerchant(InventoryPlayer par1InventoryPlayer, IMerchant par2IMerchant, World par3World) + { + this.theMerchant = par2IMerchant; + this.theWorld = par3World; + this.merchantInventory = new InventoryMerchant(par1InventoryPlayer.player, par2IMerchant); + this.addSlotToContainer(new Slot(this.merchantInventory, 0, 36, 53)); + this.addSlotToContainer(new Slot(this.merchantInventory, 1, 62, 53)); + this.addSlotToContainer(new SlotMerchantResult(par1InventoryPlayer.player, par2IMerchant, this.merchantInventory, 2, 120, 53)); + int var4; + + for (var4 = 0; var4 < 3; ++var4) + { + for (int var5 = 0; var5 < 9; ++var5) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var5 + var4 * 9 + 9, 8 + var5 * 18, 84 + var4 * 18)); + } + } + + for (var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var4, 8 + var4 * 18, 142)); + } + } + + public InventoryMerchant getMerchantInventory() + { + return this.merchantInventory; + } + + public void addCraftingToCrafters(ICrafting par1ICrafting) + { + super.addCraftingToCrafters(par1ICrafting); + } + + /** + * Looks for changes made in the container, sends them to every listener. + */ + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory par1IInventory) + { + this.merchantInventory.resetRecipeAndSlots(); + super.onCraftMatrixChanged(par1IInventory); + } + + public void setCurrentRecipeIndex(int par1) + { + this.merchantInventory.setCurrentRecipeIndex(par1); + } + + public void updateProgressBar(int par1, int par2) {} + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.theMerchant.getCustomer() == par1EntityPlayer; + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 == 2) + { + if (!this.mergeItemStack(var5, 3, 39, true)) + { + return null; + } + + var4.onSlotChange(var5, var3); + } + else if (par2 != 0 && par2 != 1) + { + if (par2 >= 3 && par2 < 30) + { + if (!this.mergeItemStack(var5, 30, 39, false)) + { + return null; + } + } + else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(var5, 3, 30, false)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 3, 39, false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) + { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + this.theMerchant.setCustomer((EntityPlayer)null); + super.onContainerClosed(par1EntityPlayer); + + if (!this.theWorld.isRemote) + { + ItemStack var2 = this.merchantInventory.getStackInSlotOnClosing(0); + + if (var2 != null) + { + par1EntityPlayer.dropPlayerItem(var2); + } + + var2 = this.merchantInventory.getStackInSlotOnClosing(1); + + if (var2 != null) + { + par1EntityPlayer.dropPlayerItem(var2); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/ContainerPlayer.java b/src/main/java/net/minecraft/src/ContainerPlayer.java new file mode 100644 index 0000000..ce0bb24 --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerPlayer.java @@ -0,0 +1,171 @@ +package net.minecraft.src; + +public class ContainerPlayer extends Container +{ + /** The crafting matrix inventory. */ + public InventoryCrafting craftMatrix = new InventoryCrafting(this, 2, 2); + public IInventory craftResult = new InventoryCraftResult(); + + /** Determines if inventory manipulation should be handled. */ + public boolean isLocalWorld; + private final EntityPlayer thePlayer; + + public ContainerPlayer(InventoryPlayer par1InventoryPlayer, boolean par2, EntityPlayer par3EntityPlayer) + { + this.isLocalWorld = par2; + this.thePlayer = par3EntityPlayer; + this.addSlotToContainer(new SlotCrafting(par1InventoryPlayer.player, this.craftMatrix, this.craftResult, 0, 144, 36)); + int var4; + int var5; + + for (var4 = 0; var4 < 2; ++var4) + { + for (var5 = 0; var5 < 2; ++var5) + { + this.addSlotToContainer(new Slot(this.craftMatrix, var5 + var4 * 2, 88 + var5 * 18, 26 + var4 * 18)); + } + } + + for (var4 = 0; var4 < 4; ++var4) + { + this.addSlotToContainer(new SlotArmor(this, par1InventoryPlayer, par1InventoryPlayer.getSizeInventory() - 1 - var4, 8, 8 + var4 * 18, var4)); + } + + for (var4 = 0; var4 < 3; ++var4) + { + for (var5 = 0; var5 < 9; ++var5) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var5 + (var4 + 1) * 9, 8 + var5 * 18, 84 + var4 * 18)); + } + } + + for (var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var4, 8 + var4 * 18, 142)); + } + + this.onCraftMatrixChanged(this.craftMatrix); + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory par1IInventory) + { + this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.thePlayer.worldObj)); + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + + for (int var2 = 0; var2 < 4; ++var2) + { + ItemStack var3 = this.craftMatrix.getStackInSlotOnClosing(var2); + + if (var3 != null) + { + par1EntityPlayer.dropPlayerItem(var3); + } + } + + this.craftResult.setInventorySlotContents(0, (ItemStack)null); + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return true; + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 == 0) + { + if (!this.mergeItemStack(var5, 9, 45, true)) + { + return null; + } + + var4.onSlotChange(var5, var3); + } + else if (par2 >= 1 && par2 < 5) + { + if (!this.mergeItemStack(var5, 9, 45, false)) + { + return null; + } + } + else if (par2 >= 5 && par2 < 9) + { + if (!this.mergeItemStack(var5, 9, 45, false)) + { + return null; + } + } + else if (var3.getItem() instanceof ItemArmor && !((Slot)this.inventorySlots.get(5 + ((ItemArmor)var3.getItem()).armorType)).getHasStack()) + { + int var6 = 5 + ((ItemArmor)var3.getItem()).armorType; + + if (!this.mergeItemStack(var5, var6, var6 + 1, false)) + { + return null; + } + } + else if (par2 >= 9 && par2 < 36) + { + if (!this.mergeItemStack(var5, 36, 45, false)) + { + return null; + } + } + else if (par2 >= 36 && par2 < 45) + { + if (!this.mergeItemStack(var5, 9, 36, false)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 9, 45, false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) + { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } + + public boolean func_94530_a(ItemStack par1ItemStack, Slot par2Slot) + { + return par2Slot.inventory != this.craftResult && super.func_94530_a(par1ItemStack, par2Slot); + } +} diff --git a/src/main/java/net/minecraft/src/ContainerRepair.java b/src/main/java/net/minecraft/src/ContainerRepair.java new file mode 100644 index 0000000..80c0129 --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerRepair.java @@ -0,0 +1,487 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.Map; + +public class ContainerRepair extends Container +{ + /** Here comes out item you merged and/or renamed. */ + private IInventory outputSlot = new InventoryCraftResult(); + + /** + * The 2slots where you put your items in that you want to merge and/or rename. + */ + private IInventory inputSlots = new ContainerRepairINNER1(this, "Repair", true, 2); + private World theWorld; + private int field_82861_i; + private int field_82858_j; + private int field_82859_k; + + /** The maximum cost of repairing/renaming in the anvil. */ + public int maximumCost; + + /** determined by damage of input item and stackSize of repair materials */ + private int stackSizeToBeUsedInRepair; + private String repairedItemName; + + /** The player that has this container open. */ + private final EntityPlayer thePlayer; + + public ContainerRepair(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) + { + this.theWorld = par2World; + this.field_82861_i = par3; + this.field_82858_j = par4; + this.field_82859_k = par5; + this.thePlayer = par6EntityPlayer; + this.addSlotToContainer(new Slot(this.inputSlots, 0, 27, 47)); + this.addSlotToContainer(new Slot(this.inputSlots, 1, 76, 47)); + this.addSlotToContainer(new ContainerRepairINNER2(this, this.outputSlot, 2, 134, 47, par2World, par3, par4, par5)); + int var7; + + for (var7 = 0; var7 < 3; ++var7) + { + for (int var8 = 0; var8 < 9; ++var8) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var8 + var7 * 9 + 9, 8 + var8 * 18, 84 + var7 * 18)); + } + } + + for (var7 = 0; var7 < 9; ++var7) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var7, 8 + var7 * 18, 142)); + } + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory par1IInventory) + { + super.onCraftMatrixChanged(par1IInventory); + + if (par1IInventory == this.inputSlots) + { + this.updateRepairOutput(); + } + } + + /** + * called when the Anvil Input Slot changes, calculates the new result and puts it in the output slot + */ + public void updateRepairOutput() + { + ItemStack var1 = this.inputSlots.getStackInSlot(0); + this.maximumCost = 0; + int var2 = 0; + byte var3 = 0; + int var4 = 0; + + if (var1 == null) + { + this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + this.maximumCost = 0; + } + else + { + ItemStack var5 = var1.copy(); + ItemStack var6 = this.inputSlots.getStackInSlot(1); + Map var7 = EnchantmentHelper.getEnchantments(var5); + boolean var8 = false; + int var19 = var3 + var1.getRepairCost() + (var6 == null ? 0 : var6.getRepairCost()); + this.stackSizeToBeUsedInRepair = 0; + int var9; + int var10; + int var11; + int var13; + int var14; + Iterator var21; + Enchantment var22; + + if (var6 != null) + { + var8 = var6.itemID == Item.enchantedBook.itemID && Item.enchantedBook.func_92110_g(var6).tagCount() > 0; + + if (var5.isItemStackDamageable() && Item.itemsList[var5.itemID].getIsRepairable(var1, var6)) + { + var9 = Math.min(var5.getItemDamageForDisplay(), var5.getMaxDamage() / 4); + + if (var9 <= 0) + { + this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + this.maximumCost = 0; + return; + } + + for (var10 = 0; var9 > 0 && var10 < var6.stackSize; ++var10) + { + var11 = var5.getItemDamageForDisplay() - var9; + var5.setItemDamage(var11); + var2 += Math.max(1, var9 / 100) + var7.size(); + var9 = Math.min(var5.getItemDamageForDisplay(), var5.getMaxDamage() / 4); + } + + this.stackSizeToBeUsedInRepair = var10; + } + else + { + if (!var8 && (var5.itemID != var6.itemID || !var5.isItemStackDamageable())) + { + this.outputSlot.setInventorySlotContents(0, (ItemStack)null); + this.maximumCost = 0; + return; + } + + if (var5.isItemStackDamageable() && !var8) + { + var9 = var1.getMaxDamage() - var1.getItemDamageForDisplay(); + var10 = var6.getMaxDamage() - var6.getItemDamageForDisplay(); + var11 = var10 + var5.getMaxDamage() * 12 / 100; + int var12 = var9 + var11; + var13 = var5.getMaxDamage() - var12; + + if (var13 < 0) + { + var13 = 0; + } + + if (var13 < var5.getItemDamage()) + { + var5.setItemDamage(var13); + var2 += Math.max(1, var11 / 100); + } + } + + Map var20 = EnchantmentHelper.getEnchantments(var6); + var21 = var20.keySet().iterator(); + + while (var21.hasNext()) + { + var11 = ((Integer)var21.next()).intValue(); + var22 = Enchantment.enchantmentsList[var11]; + var13 = var7.containsKey(Integer.valueOf(var11)) ? ((Integer)var7.get(Integer.valueOf(var11))).intValue() : 0; + var14 = ((Integer)var20.get(Integer.valueOf(var11))).intValue(); + int var10000; + + if (var13 == var14) + { + ++var14; + var10000 = var14; + } + else + { + var10000 = Math.max(var14, var13); + } + + var14 = var10000; + int var15 = var14 - var13; + boolean var16 = var22.canApply(var1); + + if (this.thePlayer.capabilities.isCreativeMode || var1.itemID == ItemEnchantedBook.enchantedBook.itemID) + { + var16 = true; + } + + Iterator var17 = var7.keySet().iterator(); + + while (var17.hasNext()) + { + int var18 = ((Integer)var17.next()).intValue(); + + if (var18 != var11 && !var22.canApplyTogether(Enchantment.enchantmentsList[var18])) + { + var16 = false; + var2 += var15; + } + } + + if (var16) + { + if (var14 > var22.getMaxLevel()) + { + var14 = var22.getMaxLevel(); + } + + var7.put(Integer.valueOf(var11), Integer.valueOf(var14)); + int var23 = 0; + + switch (var22.getWeight()) + { + case 1: + var23 = 8; + break; + + case 2: + var23 = 4; + + case 3: + case 4: + case 6: + case 7: + case 8: + case 9: + default: + break; + + case 5: + var23 = 2; + break; + + case 10: + var23 = 1; + } + + if (var8) + { + var23 = Math.max(1, var23 / 2); + } + + var2 += var23 * var15; + } + } + } + } + + if (org.apache.commons.lang3.StringUtils.isBlank(this.repairedItemName)) + { + if (var1.hasDisplayName()) + { + var4 = var1.isItemStackDamageable() ? 7 : var1.stackSize * 5; + var2 += var4; + var5.func_135074_t(); + } + } + else if (!this.repairedItemName.equals(var1.getDisplayName())) + { + var4 = var1.isItemStackDamageable() ? 7 : var1.stackSize * 5; + var2 += var4; + + if (var1.hasDisplayName()) + { + var19 += var4 / 2; + } + + var5.setItemName(this.repairedItemName); + } + + var9 = 0; + + for (var21 = var7.keySet().iterator(); var21.hasNext(); var19 += var9 + var13 * var14) + { + var11 = ((Integer)var21.next()).intValue(); + var22 = Enchantment.enchantmentsList[var11]; + var13 = ((Integer)var7.get(Integer.valueOf(var11))).intValue(); + var14 = 0; + ++var9; + + switch (var22.getWeight()) + { + case 1: + var14 = 8; + break; + + case 2: + var14 = 4; + + case 3: + case 4: + case 6: + case 7: + case 8: + case 9: + default: + break; + + case 5: + var14 = 2; + break; + + case 10: + var14 = 1; + } + + if (var8) + { + var14 = Math.max(1, var14 / 2); + } + } + + if (var8) + { + var19 = Math.max(1, var19 / 2); + } + + this.maximumCost = var19 + var2; + + if (var2 <= 0) + { + var5 = null; + } + + if (var4 == var2 && var4 > 0 && this.maximumCost >= 40) + { + this.maximumCost = 39; + } + + if (this.maximumCost >= 40 && !this.thePlayer.capabilities.isCreativeMode) + { + var5 = null; + } + + if (var5 != null) + { + var10 = var5.getRepairCost(); + + if (var6 != null && var10 < var6.getRepairCost()) + { + var10 = var6.getRepairCost(); + } + + if (var5.hasDisplayName()) + { + var10 -= 9; + } + + if (var10 < 0) + { + var10 = 0; + } + + var10 += 2; + var5.setRepairCost(var10); + EnchantmentHelper.setEnchantments(var7, var5); + } + + this.outputSlot.setInventorySlotContents(0, var5); + this.detectAndSendChanges(); + } + } + + public void addCraftingToCrafters(ICrafting par1ICrafting) + { + super.addCraftingToCrafters(par1ICrafting); + par1ICrafting.sendProgressBarUpdate(this, 0, this.maximumCost); + } + + public void updateProgressBar(int par1, int par2) + { + if (par1 == 0) + { + this.maximumCost = par2; + } + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + + if (!this.theWorld.isRemote) + { + for (int var2 = 0; var2 < this.inputSlots.getSizeInventory(); ++var2) + { + ItemStack var3 = this.inputSlots.getStackInSlotOnClosing(var2); + + if (var3 != null) + { + par1EntityPlayer.dropPlayerItem(var3); + } + } + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.theWorld.getBlockId(this.field_82861_i, this.field_82858_j, this.field_82859_k) != Block.anvil.blockID ? false : par1EntityPlayer.getDistanceSq((double)this.field_82861_i + 0.5D, (double)this.field_82858_j + 0.5D, (double)this.field_82859_k + 0.5D) <= 64.0D; + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 == 2) + { + if (!this.mergeItemStack(var5, 3, 39, true)) + { + return null; + } + + var4.onSlotChange(var5, var3); + } + else if (par2 != 0 && par2 != 1) + { + if (par2 >= 3 && par2 < 39 && !this.mergeItemStack(var5, 0, 2, false)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 3, 39, false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) + { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } + + /** + * used by the Anvil GUI to update the Item Name being typed by the player + */ + public void updateItemName(String par1Str) + { + this.repairedItemName = par1Str; + + if (this.getSlot(2).getHasStack()) + { + ItemStack var2 = this.getSlot(2).getStack(); + + if (org.apache.commons.lang3.StringUtils.isBlank(par1Str)) + { + var2.func_135074_t(); + } + else + { + var2.setItemName(this.repairedItemName); + } + } + + this.updateRepairOutput(); + } + + static IInventory getRepairInputInventory(ContainerRepair par0ContainerRepair) + { + return par0ContainerRepair.inputSlots; + } + + static int getStackSizeUsedInRepair(ContainerRepair par0ContainerRepair) + { + return par0ContainerRepair.stackSizeToBeUsedInRepair; + } +} diff --git a/src/main/java/net/minecraft/src/ContainerRepairINNER1.java b/src/main/java/net/minecraft/src/ContainerRepairINNER1.java new file mode 100644 index 0000000..fa31f0d --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerRepairINNER1.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +class ContainerRepairINNER1 extends InventoryBasic +{ + final ContainerRepair repairContainer; + + ContainerRepairINNER1(ContainerRepair par1ContainerRepair, String par2Str, boolean par3, int par4) + { + super(par2Str, par3, par4); + this.repairContainer = par1ContainerRepair; + } + + /** + * Called when an the contents of an Inventory change, usually + */ + public void onInventoryChanged() + { + super.onInventoryChanged(); + this.repairContainer.onCraftMatrixChanged(this); + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ContainerRepairINNER2.java b/src/main/java/net/minecraft/src/ContainerRepairINNER2.java new file mode 100644 index 0000000..7157b2f --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerRepairINNER2.java @@ -0,0 +1,94 @@ +package net.minecraft.src; + +class ContainerRepairINNER2 extends Slot +{ + final World field_135071_a; + + final int field_135069_b; + + final int field_135070_c; + + final int field_135067_d; + + final ContainerRepair repairContainer; + + ContainerRepairINNER2(ContainerRepair par1ContainerRepair, IInventory par2IInventory, int par3, int par4, int par5, World par6World, int par7, int par8, int par9) + { + super(par2IInventory, par3, par4, par5); + this.repairContainer = par1ContainerRepair; + this.field_135071_a = par6World; + this.field_135069_b = par7; + this.field_135070_c = par8; + this.field_135067_d = par9; + } + + /** + * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + */ + public boolean isItemValid(ItemStack par1ItemStack) + { + return false; + } + + /** + * Return whether this slot's stack can be taken from this slot. + */ + public boolean canTakeStack(EntityPlayer par1EntityPlayer) + { + return (par1EntityPlayer.capabilities.isCreativeMode || par1EntityPlayer.experienceLevel >= this.repairContainer.maximumCost) && this.repairContainer.maximumCost > 0 && this.getHasStack(); + } + + public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) + { + if (!par1EntityPlayer.capabilities.isCreativeMode) + { + par1EntityPlayer.addExperienceLevel(-this.repairContainer.maximumCost); + } + + ContainerRepair.getRepairInputInventory(this.repairContainer).setInventorySlotContents(0, (ItemStack)null); + + if (ContainerRepair.getStackSizeUsedInRepair(this.repairContainer) > 0) + { + ItemStack var3 = ContainerRepair.getRepairInputInventory(this.repairContainer).getStackInSlot(1); + + if (var3 != null && var3.stackSize > ContainerRepair.getStackSizeUsedInRepair(this.repairContainer)) + { + var3.stackSize -= ContainerRepair.getStackSizeUsedInRepair(this.repairContainer); + ContainerRepair.getRepairInputInventory(this.repairContainer).setInventorySlotContents(1, var3); + } + else + { + ContainerRepair.getRepairInputInventory(this.repairContainer).setInventorySlotContents(1, (ItemStack)null); + } + } + else + { + ContainerRepair.getRepairInputInventory(this.repairContainer).setInventorySlotContents(1, (ItemStack)null); + } + + this.repairContainer.maximumCost = 0; + + if (!par1EntityPlayer.capabilities.isCreativeMode && !this.field_135071_a.isRemote && this.field_135071_a.getBlockId(this.field_135069_b, this.field_135070_c, this.field_135067_d) == Block.anvil.blockID && par1EntityPlayer.getRNG().nextFloat() < 0.12F) + { + int var6 = this.field_135071_a.getBlockMetadata(this.field_135069_b, this.field_135070_c, this.field_135067_d); + int var4 = var6 & 3; + int var5 = var6 >> 2; + ++var5; + + if (var5 > 2) + { + this.field_135071_a.setBlockToAir(this.field_135069_b, this.field_135070_c, this.field_135067_d); + this.field_135071_a.playAuxSFX(1020, this.field_135069_b, this.field_135070_c, this.field_135067_d, 0); + } + else + { + this.field_135071_a.setBlockMetadataWithNotify(this.field_135069_b, this.field_135070_c, this.field_135067_d, var4 | var5 << 2, 2); + this.field_135071_a.playAuxSFX(1021, this.field_135069_b, this.field_135070_c, this.field_135067_d, 0); + } + } + else if (!this.field_135071_a.isRemote) + { + this.field_135071_a.playAuxSFX(1021, this.field_135069_b, this.field_135070_c, this.field_135067_d, 0); + } + } +} diff --git a/src/main/java/net/minecraft/src/ContainerSheep.java b/src/main/java/net/minecraft/src/ContainerSheep.java new file mode 100644 index 0000000..fbd1caa --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerSheep.java @@ -0,0 +1,16 @@ +package net.minecraft.src; + +class ContainerSheep extends Container +{ + final EntitySheep field_90034_a; + + ContainerSheep(EntitySheep par1EntitySheep) + { + this.field_90034_a = par1EntitySheep; + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/ContainerWorkbench.java b/src/main/java/net/minecraft/src/ContainerWorkbench.java new file mode 100644 index 0000000..d78459d --- /dev/null +++ b/src/main/java/net/minecraft/src/ContainerWorkbench.java @@ -0,0 +1,146 @@ +package net.minecraft.src; + +public class ContainerWorkbench extends Container +{ + /** The crafting matrix inventory (3x3). */ + public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); + public IInventory craftResult = new InventoryCraftResult(); + private World worldObj; + private int posX; + private int posY; + private int posZ; + + public ContainerWorkbench(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) + { + this.worldObj = par2World; + this.posX = par3; + this.posY = par4; + this.posZ = par5; + this.addSlotToContainer(new SlotCrafting(par1InventoryPlayer.player, this.craftMatrix, this.craftResult, 0, 124, 35)); + int var6; + int var7; + + for (var6 = 0; var6 < 3; ++var6) + { + for (var7 = 0; var7 < 3; ++var7) + { + this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 30 + var7 * 18, 17 + var6 * 18)); + } + } + + for (var6 = 0; var6 < 3; ++var6) + { + for (var7 = 0; var7 < 9; ++var7) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18)); + } + } + + for (var6 = 0; var6 < 9; ++var6) + { + this.addSlotToContainer(new Slot(par1InventoryPlayer, var6, 8 + var6 * 18, 142)); + } + + this.onCraftMatrixChanged(this.craftMatrix); + } + + /** + * Callback for when the crafting matrix is changed. + */ + public void onCraftMatrixChanged(IInventory par1IInventory) + { + this.craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); + } + + /** + * Called when the container is closed. + */ + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + + if (!this.worldObj.isRemote) + { + for (int var2 = 0; var2 < 9; ++var2) + { + ItemStack var3 = this.craftMatrix.getStackInSlotOnClosing(var2); + + if (var3 != null) + { + par1EntityPlayer.dropPlayerItem(var3); + } + } + } + } + + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != Block.workbench.blockID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D; + } + + /** + * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. + */ + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 == 0) + { + if (!this.mergeItemStack(var5, 10, 46, true)) + { + return null; + } + + var4.onSlotChange(var5, var3); + } + else if (par2 >= 10 && par2 < 37) + { + if (!this.mergeItemStack(var5, 37, 46, false)) + { + return null; + } + } + else if (par2 >= 37 && par2 < 46) + { + if (!this.mergeItemStack(var5, 10, 37, false)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, 10, 46, false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) + { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } + + public boolean func_94530_a(ItemStack par1ItemStack, Slot par2Slot) + { + return par2Slot.inventory != this.craftResult && super.func_94530_a(par1ItemStack, par2Slot); + } +} diff --git a/src/main/java/net/minecraft/src/ConvertingProgressUpdate.java b/src/main/java/net/minecraft/src/ConvertingProgressUpdate.java new file mode 100644 index 0000000..b2cefa1 --- /dev/null +++ b/src/main/java/net/minecraft/src/ConvertingProgressUpdate.java @@ -0,0 +1,39 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class ConvertingProgressUpdate implements IProgressUpdate +{ + private long field_96245_b; + + /** Reference to the MinecraftServer object. */ + final MinecraftServer mcServer; + + public ConvertingProgressUpdate(MinecraftServer par1MinecraftServer) + { + this.mcServer = par1MinecraftServer; + this.field_96245_b = MinecraftServer.getSystemTimeMillis(); + } + + /** + * "Saving level", or the loading,or downloading equivelent + */ + public void displayProgressMessage(String par1Str) {} + + /** + * Updates the progress bar on the loading screen to the specified amount. Args: loadProgress + */ + public void setLoadingProgress(int par1) + { + if (MinecraftServer.getSystemTimeMillis() - this.field_96245_b >= 1000L) + { + this.field_96245_b = MinecraftServer.getSystemTimeMillis(); + this.mcServer.getLogAgent().logInfo("Converting... " + par1 + "%"); + } + } + + /** + * This is called with "Working..." by resetProgressAndMessage + */ + public void resetProgresAndWorkingMessage(String par1Str) {} +} diff --git a/src/main/java/net/minecraft/src/CraftingManager.java b/src/main/java/net/minecraft/src/CraftingManager.java new file mode 100644 index 0000000..b6421ba --- /dev/null +++ b/src/main/java/net/minecraft/src/CraftingManager.java @@ -0,0 +1,319 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +public class CraftingManager +{ + /** The static instance of this class */ + private static final CraftingManager instance = new CraftingManager(); + + /** A list of all the recipes added */ + private List recipes = new ArrayList(); + + /** + * Returns the static instance of this class + */ + public static final CraftingManager getInstance() + { + return instance; + } + + private CraftingManager() + { + (new RecipesTools()).addRecipes(this); + (new RecipesWeapons()).addRecipes(this); + (new RecipesIngots()).addRecipes(this); + (new RecipesFood()).addRecipes(this); + (new RecipesCrafting()).addRecipes(this); + (new RecipesArmor()).addRecipes(this); + (new RecipesDyes()).addRecipes(this); + this.recipes.add(new RecipesArmorDyes()); + this.recipes.add(new RecipesMapCloning()); + this.recipes.add(new RecipesMapExtending()); + this.recipes.add(new RecipeFireworks()); + this.addRecipe(new ItemStack(Item.paper, 3), new Object[] {"###", '#', Item.reed}); + this.addShapelessRecipe(new ItemStack(Item.book, 1), new Object[] {Item.paper, Item.paper, Item.paper, Item.leather}); + this.addShapelessRecipe(new ItemStack(Item.writableBook, 1), new Object[] {Item.book, new ItemStack(Item.dyePowder, 1, 0), Item.feather}); + this.addRecipe(new ItemStack(Block.fence, 2), new Object[] {"###", "###", '#', Item.stick}); + this.addRecipe(new ItemStack(Block.cobblestoneWall, 6, 0), new Object[] {"###", "###", '#', Block.cobblestone}); + this.addRecipe(new ItemStack(Block.cobblestoneWall, 6, 1), new Object[] {"###", "###", '#', Block.cobblestoneMossy}); + this.addRecipe(new ItemStack(Block.netherFence, 6), new Object[] {"###", "###", '#', Block.netherBrick}); + this.addRecipe(new ItemStack(Block.fenceGate, 1), new Object[] {"#W#", "#W#", '#', Item.stick, 'W', Block.planks}); + this.addRecipe(new ItemStack(Block.jukebox, 1), new Object[] {"###", "#X#", "###", '#', Block.planks, 'X', Item.diamond}); + this.addRecipe(new ItemStack(Item.leash, 2), new Object[] {"~~ ", "~O ", " ~", '~', Item.silk, 'O', Item.slimeBall}); + this.addRecipe(new ItemStack(Block.music, 1), new Object[] {"###", "#X#", "###", '#', Block.planks, 'X', Item.redstone}); + this.addRecipe(new ItemStack(Block.bookShelf, 1), new Object[] {"###", "XXX", "###", '#', Block.planks, 'X', Item.book}); + this.addRecipe(new ItemStack(Block.blockSnow, 1), new Object[] {"##", "##", '#', Item.snowball}); + this.addRecipe(new ItemStack(Block.snow, 6), new Object[] {"###", '#', Block.blockSnow}); + this.addRecipe(new ItemStack(Block.blockClay, 1), new Object[] {"##", "##", '#', Item.clay}); + this.addRecipe(new ItemStack(Block.brick, 1), new Object[] {"##", "##", '#', Item.brick}); + this.addRecipe(new ItemStack(Block.glowStone, 1), new Object[] {"##", "##", '#', Item.glowstone}); + this.addRecipe(new ItemStack(Block.blockNetherQuartz, 1), new Object[] {"##", "##", '#', Item.netherQuartz}); + this.addRecipe(new ItemStack(Block.cloth, 1), new Object[] {"##", "##", '#', Item.silk}); + this.addRecipe(new ItemStack(Block.tnt, 1), new Object[] {"X#X", "#X#", "X#X", 'X', Item.gunpowder, '#', Block.sand}); + this.addRecipe(new ItemStack(Block.stoneSingleSlab, 6, 3), new Object[] {"###", '#', Block.cobblestone}); + this.addRecipe(new ItemStack(Block.stoneSingleSlab, 6, 0), new Object[] {"###", '#', Block.stone}); + this.addRecipe(new ItemStack(Block.stoneSingleSlab, 6, 1), new Object[] {"###", '#', Block.sandStone}); + this.addRecipe(new ItemStack(Block.stoneSingleSlab, 6, 4), new Object[] {"###", '#', Block.brick}); + this.addRecipe(new ItemStack(Block.stoneSingleSlab, 6, 5), new Object[] {"###", '#', Block.stoneBrick}); + this.addRecipe(new ItemStack(Block.stoneSingleSlab, 6, 6), new Object[] {"###", '#', Block.netherBrick}); + this.addRecipe(new ItemStack(Block.stoneSingleSlab, 6, 7), new Object[] {"###", '#', Block.blockNetherQuartz}); + this.addRecipe(new ItemStack(Block.woodSingleSlab, 6, 0), new Object[] {"###", '#', new ItemStack(Block.planks, 1, 0)}); + this.addRecipe(new ItemStack(Block.woodSingleSlab, 6, 2), new Object[] {"###", '#', new ItemStack(Block.planks, 1, 2)}); + this.addRecipe(new ItemStack(Block.woodSingleSlab, 6, 1), new Object[] {"###", '#', new ItemStack(Block.planks, 1, 1)}); + this.addRecipe(new ItemStack(Block.woodSingleSlab, 6, 3), new Object[] {"###", '#', new ItemStack(Block.planks, 1, 3)}); + this.addRecipe(new ItemStack(Block.ladder, 3), new Object[] {"# #", "###", "# #", '#', Item.stick}); + this.addRecipe(new ItemStack(Item.doorWood, 1), new Object[] {"##", "##", "##", '#', Block.planks}); + this.addRecipe(new ItemStack(Block.trapdoor, 2), new Object[] {"###", "###", '#', Block.planks}); + this.addRecipe(new ItemStack(Item.doorIron, 1), new Object[] {"##", "##", "##", '#', Item.ingotIron}); + this.addRecipe(new ItemStack(Item.sign, 3), new Object[] {"###", "###", " X ", '#', Block.planks, 'X', Item.stick}); + this.addRecipe(new ItemStack(Item.cake, 1), new Object[] {"AAA", "BEB", "CCC", 'A', Item.bucketMilk, 'B', Item.sugar, 'C', Item.wheat, 'E', Item.egg}); + this.addRecipe(new ItemStack(Item.sugar, 1), new Object[] {"#", '#', Item.reed}); + this.addRecipe(new ItemStack(Block.planks, 4, 0), new Object[] {"#", '#', new ItemStack(Block.wood, 1, 0)}); + this.addRecipe(new ItemStack(Block.planks, 4, 1), new Object[] {"#", '#', new ItemStack(Block.wood, 1, 1)}); + this.addRecipe(new ItemStack(Block.planks, 4, 2), new Object[] {"#", '#', new ItemStack(Block.wood, 1, 2)}); + this.addRecipe(new ItemStack(Block.planks, 4, 3), new Object[] {"#", '#', new ItemStack(Block.wood, 1, 3)}); + this.addRecipe(new ItemStack(Item.stick, 4), new Object[] {"#", "#", '#', Block.planks}); + this.addRecipe(new ItemStack(Block.torchWood, 4), new Object[] {"X", "#", 'X', Item.coal, '#', Item.stick}); + this.addRecipe(new ItemStack(Block.torchWood, 4), new Object[] {"X", "#", 'X', new ItemStack(Item.coal, 1, 1), '#', Item.stick}); + this.addRecipe(new ItemStack(Item.bowlEmpty, 4), new Object[] {"# #", " # ", '#', Block.planks}); + this.addRecipe(new ItemStack(Item.glassBottle, 3), new Object[] {"# #", " # ", '#', Block.glass}); + this.addRecipe(new ItemStack(Block.rail, 16), new Object[] {"X X", "X#X", "X X", 'X', Item.ingotIron, '#', Item.stick}); + this.addRecipe(new ItemStack(Block.railPowered, 6), new Object[] {"X X", "X#X", "XRX", 'X', Item.ingotGold, 'R', Item.redstone, '#', Item.stick}); + this.addRecipe(new ItemStack(Block.railActivator, 6), new Object[] {"XSX", "X#X", "XSX", 'X', Item.ingotIron, '#', Block.torchRedstoneActive, 'S', Item.stick}); + this.addRecipe(new ItemStack(Block.railDetector, 6), new Object[] {"X X", "X#X", "XRX", 'X', Item.ingotIron, 'R', Item.redstone, '#', Block.pressurePlateStone}); + this.addRecipe(new ItemStack(Item.minecartEmpty, 1), new Object[] {"# #", "###", '#', Item.ingotIron}); + this.addRecipe(new ItemStack(Item.cauldron, 1), new Object[] {"# #", "# #", "###", '#', Item.ingotIron}); + this.addRecipe(new ItemStack(Item.brewingStand, 1), new Object[] {" B ", "###", '#', Block.cobblestone, 'B', Item.blazeRod}); + this.addRecipe(new ItemStack(Block.pumpkinLantern, 1), new Object[] {"A", "B", 'A', Block.pumpkin, 'B', Block.torchWood}); + this.addRecipe(new ItemStack(Item.minecartCrate, 1), new Object[] {"A", "B", 'A', Block.chest, 'B', Item.minecartEmpty}); + this.addRecipe(new ItemStack(Item.minecartPowered, 1), new Object[] {"A", "B", 'A', Block.furnaceIdle, 'B', Item.minecartEmpty}); + this.addRecipe(new ItemStack(Item.minecartTnt, 1), new Object[] {"A", "B", 'A', Block.tnt, 'B', Item.minecartEmpty}); + this.addRecipe(new ItemStack(Item.minecartHopper, 1), new Object[] {"A", "B", 'A', Block.hopperBlock, 'B', Item.minecartEmpty}); + this.addRecipe(new ItemStack(Item.boat, 1), new Object[] {"# #", "###", '#', Block.planks}); + this.addRecipe(new ItemStack(Item.bucketEmpty, 1), new Object[] {"# #", " # ", '#', Item.ingotIron}); + this.addRecipe(new ItemStack(Item.flowerPot, 1), new Object[] {"# #", " # ", '#', Item.brick}); + this.addRecipe(new ItemStack(Item.flintAndSteel, 1), new Object[] {"A ", " B", 'A', Item.ingotIron, 'B', Item.flint}); + this.addRecipe(new ItemStack(Item.bread, 1), new Object[] {"###", '#', Item.wheat}); + this.addRecipe(new ItemStack(Block.stairsWoodOak, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Block.planks, 1, 0)}); + this.addRecipe(new ItemStack(Block.stairsWoodBirch, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Block.planks, 1, 2)}); + this.addRecipe(new ItemStack(Block.stairsWoodSpruce, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Block.planks, 1, 1)}); + this.addRecipe(new ItemStack(Block.stairsWoodJungle, 4), new Object[] {"# ", "## ", "###", '#', new ItemStack(Block.planks, 1, 3)}); + this.addRecipe(new ItemStack(Item.fishingRod, 1), new Object[] {" #", " #X", "# X", '#', Item.stick, 'X', Item.silk}); + this.addRecipe(new ItemStack(Item.carrotOnAStick, 1), new Object[] {"# ", " X", '#', Item.fishingRod, 'X', Item.carrot}).func_92100_c(); + this.addRecipe(new ItemStack(Block.stairsCobblestone, 4), new Object[] {"# ", "## ", "###", '#', Block.cobblestone}); + this.addRecipe(new ItemStack(Block.stairsBrick, 4), new Object[] {"# ", "## ", "###", '#', Block.brick}); + this.addRecipe(new ItemStack(Block.stairsStoneBrick, 4), new Object[] {"# ", "## ", "###", '#', Block.stoneBrick}); + this.addRecipe(new ItemStack(Block.stairsNetherBrick, 4), new Object[] {"# ", "## ", "###", '#', Block.netherBrick}); + this.addRecipe(new ItemStack(Block.stairsSandStone, 4), new Object[] {"# ", "## ", "###", '#', Block.sandStone}); + this.addRecipe(new ItemStack(Block.stairsNetherQuartz, 4), new Object[] {"# ", "## ", "###", '#', Block.blockNetherQuartz}); + this.addRecipe(new ItemStack(Item.painting, 1), new Object[] {"###", "#X#", "###", '#', Item.stick, 'X', Block.cloth}); + this.addRecipe(new ItemStack(Item.itemFrame, 1), new Object[] {"###", "#X#", "###", '#', Item.stick, 'X', Item.leather}); + this.addRecipe(new ItemStack(Item.appleGold, 1, 0), new Object[] {"###", "#X#", "###", '#', Item.ingotGold, 'X', Item.appleRed}); + this.addRecipe(new ItemStack(Item.appleGold, 1, 1), new Object[] {"###", "#X#", "###", '#', Block.blockGold, 'X', Item.appleRed}); + this.addRecipe(new ItemStack(Item.goldenCarrot, 1, 0), new Object[] {"###", "#X#", "###", '#', Item.goldNugget, 'X', Item.carrot}); + this.addRecipe(new ItemStack(Item.speckledMelon, 1), new Object[] {"###", "#X#", "###", '#', Item.goldNugget, 'X', Item.melon}); + this.addRecipe(new ItemStack(Block.lever, 1), new Object[] {"X", "#", '#', Block.cobblestone, 'X', Item.stick}); + this.addRecipe(new ItemStack(Block.tripWireSource, 2), new Object[] {"I", "S", "#", '#', Block.planks, 'S', Item.stick, 'I', Item.ingotIron}); + this.addRecipe(new ItemStack(Block.torchRedstoneActive, 1), new Object[] {"X", "#", '#', Item.stick, 'X', Item.redstone}); + this.addRecipe(new ItemStack(Item.redstoneRepeater, 1), new Object[] {"#X#", "III", '#', Block.torchRedstoneActive, 'X', Item.redstone, 'I', Block.stone}); + this.addRecipe(new ItemStack(Item.comparator, 1), new Object[] {" # ", "#X#", "III", '#', Block.torchRedstoneActive, 'X', Item.netherQuartz, 'I', Block.stone}); + this.addRecipe(new ItemStack(Item.pocketSundial, 1), new Object[] {" # ", "#X#", " # ", '#', Item.ingotGold, 'X', Item.redstone}); + this.addRecipe(new ItemStack(Item.compass, 1), new Object[] {" # ", "#X#", " # ", '#', Item.ingotIron, 'X', Item.redstone}); + this.addRecipe(new ItemStack(Item.emptyMap, 1), new Object[] {"###", "#X#", "###", '#', Item.paper, 'X', Item.compass}); + this.addRecipe(new ItemStack(Block.stoneButton, 1), new Object[] {"#", '#', Block.stone}); + this.addRecipe(new ItemStack(Block.woodenButton, 1), new Object[] {"#", '#', Block.planks}); + this.addRecipe(new ItemStack(Block.pressurePlateStone, 1), new Object[] {"##", '#', Block.stone}); + this.addRecipe(new ItemStack(Block.pressurePlatePlanks, 1), new Object[] {"##", '#', Block.planks}); + this.addRecipe(new ItemStack(Block.pressurePlateIron, 1), new Object[] {"##", '#', Item.ingotIron}); + this.addRecipe(new ItemStack(Block.pressurePlateGold, 1), new Object[] {"##", '#', Item.ingotGold}); + this.addRecipe(new ItemStack(Block.dispenser, 1), new Object[] {"###", "#X#", "#R#", '#', Block.cobblestone, 'X', Item.bow, 'R', Item.redstone}); + this.addRecipe(new ItemStack(Block.dropper, 1), new Object[] {"###", "# #", "#R#", '#', Block.cobblestone, 'R', Item.redstone}); + this.addRecipe(new ItemStack(Block.pistonBase, 1), new Object[] {"TTT", "#X#", "#R#", '#', Block.cobblestone, 'X', Item.ingotIron, 'R', Item.redstone, 'T', Block.planks}); + this.addRecipe(new ItemStack(Block.pistonStickyBase, 1), new Object[] {"S", "P", 'S', Item.slimeBall, 'P', Block.pistonBase}); + this.addRecipe(new ItemStack(Item.bed, 1), new Object[] {"###", "XXX", '#', Block.cloth, 'X', Block.planks}); + this.addRecipe(new ItemStack(Block.enchantmentTable, 1), new Object[] {" B ", "D#D", "###", '#', Block.obsidian, 'B', Item.book, 'D', Item.diamond}); + this.addRecipe(new ItemStack(Block.anvil, 1), new Object[] {"III", " i ", "iii", 'I', Block.blockIron, 'i', Item.ingotIron}); + this.addShapelessRecipe(new ItemStack(Item.eyeOfEnder, 1), new Object[] {Item.enderPearl, Item.blazePowder}); + this.addShapelessRecipe(new ItemStack(Item.fireballCharge, 3), new Object[] {Item.gunpowder, Item.blazePowder, Item.coal}); + this.addShapelessRecipe(new ItemStack(Item.fireballCharge, 3), new Object[] {Item.gunpowder, Item.blazePowder, new ItemStack(Item.coal, 1, 1)}); + this.addRecipe(new ItemStack(Block.daylightSensor), new Object[] {"GGG", "QQQ", "WWW", 'G', Block.glass, 'Q', Item.netherQuartz, 'W', Block.woodSingleSlab}); + this.addRecipe(new ItemStack(Block.hopperBlock), new Object[] {"I I", "ICI", " I ", 'I', Item.ingotIron, 'C', Block.chest}); + Collections.sort(this.recipes, new RecipeSorter(this)); + } + + ShapedRecipes addRecipe(ItemStack par1ItemStack, Object ... par2ArrayOfObj) + { + String var3 = ""; + int var4 = 0; + int var5 = 0; + int var6 = 0; + + if (par2ArrayOfObj[var4] instanceof String[]) + { + String[] var7 = (String[])((String[])par2ArrayOfObj[var4++]); + + for (int var8 = 0; var8 < var7.length; ++var8) + { + String var9 = var7[var8]; + ++var6; + var5 = var9.length(); + var3 = var3 + var9; + } + } + else + { + while (par2ArrayOfObj[var4] instanceof String) + { + String var11 = (String)par2ArrayOfObj[var4++]; + ++var6; + var5 = var11.length(); + var3 = var3 + var11; + } + } + + HashMap var12; + + for (var12 = new HashMap(); var4 < par2ArrayOfObj.length; var4 += 2) + { + Character var13 = (Character)par2ArrayOfObj[var4]; + ItemStack var15 = null; + + if (par2ArrayOfObj[var4 + 1] instanceof Item) + { + var15 = new ItemStack((Item)par2ArrayOfObj[var4 + 1]); + } + else if (par2ArrayOfObj[var4 + 1] instanceof Block) + { + var15 = new ItemStack((Block)par2ArrayOfObj[var4 + 1], 1, 32767); + } + else if (par2ArrayOfObj[var4 + 1] instanceof ItemStack) + { + var15 = (ItemStack)par2ArrayOfObj[var4 + 1]; + } + + var12.put(var13, var15); + } + + ItemStack[] var14 = new ItemStack[var5 * var6]; + + for (int var16 = 0; var16 < var5 * var6; ++var16) + { + char var10 = var3.charAt(var16); + + if (var12.containsKey(Character.valueOf(var10))) + { + var14[var16] = ((ItemStack)var12.get(Character.valueOf(var10))).copy(); + } + else + { + var14[var16] = null; + } + } + + ShapedRecipes var17 = new ShapedRecipes(var5, var6, var14, par1ItemStack); + this.recipes.add(var17); + return var17; + } + + void addShapelessRecipe(ItemStack par1ItemStack, Object ... par2ArrayOfObj) + { + ArrayList var3 = new ArrayList(); + Object[] var4 = par2ArrayOfObj; + int var5 = par2ArrayOfObj.length; + + for (int var6 = 0; var6 < var5; ++var6) + { + Object var7 = var4[var6]; + + if (var7 instanceof ItemStack) + { + var3.add(((ItemStack)var7).copy()); + } + else if (var7 instanceof Item) + { + var3.add(new ItemStack((Item)var7)); + } + else + { + if (!(var7 instanceof Block)) + { + throw new RuntimeException("Invalid shapeless recipy!"); + } + + var3.add(new ItemStack((Block)var7)); + } + } + + this.recipes.add(new ShapelessRecipes(par1ItemStack, var3)); + } + + public ItemStack findMatchingRecipe(InventoryCrafting par1InventoryCrafting, World par2World) + { + int var3 = 0; + ItemStack var4 = null; + ItemStack var5 = null; + int var6; + + for (var6 = 0; var6 < par1InventoryCrafting.getSizeInventory(); ++var6) + { + ItemStack var7 = par1InventoryCrafting.getStackInSlot(var6); + + if (var7 != null) + { + if (var3 == 0) + { + var4 = var7; + } + + if (var3 == 1) + { + var5 = var7; + } + + ++var3; + } + } + + if (var3 == 2 && var4.itemID == var5.itemID && var4.stackSize == 1 && var5.stackSize == 1 && Item.itemsList[var4.itemID].isDamageable()) + { + Item var11 = Item.itemsList[var4.itemID]; + int var13 = var11.getMaxDamage() - var4.getItemDamageForDisplay(); + int var8 = var11.getMaxDamage() - var5.getItemDamageForDisplay(); + int var9 = var13 + var8 + var11.getMaxDamage() * 5 / 100; + int var10 = var11.getMaxDamage() - var9; + + if (var10 < 0) + { + var10 = 0; + } + + return new ItemStack(var4.itemID, 1, var10); + } + else + { + for (var6 = 0; var6 < this.recipes.size(); ++var6) + { + IRecipe var12 = (IRecipe)this.recipes.get(var6); + + if (var12.matches(par1InventoryCrafting, par2World)) + { + return var12.getCraftingResult(par1InventoryCrafting); + } + } + + return null; + } + } + + /** + * returns the List<> of all recipes + */ + public List getRecipeList() + { + return this.recipes; + } +} diff --git a/src/main/java/net/minecraft/src/CrashReport.java b/src/main/java/net/minecraft/src/CrashReport.java new file mode 100644 index 0000000..5ff0c36 --- /dev/null +++ b/src/main/java/net/minecraft/src/CrashReport.java @@ -0,0 +1,307 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +public class CrashReport +{ + /** Description of the crash report. */ + private final String description; + + /** The Throwable that is the "cause" for this crash and Crash Report. */ + private final Throwable cause; + private final CrashReportCategory field_85061_c = new CrashReportCategory(this, "System Details"); + + /** Holds the keys and values of all crash report sections. */ + private final List crashReportSections = new ArrayList(); + + /** File of crash report. */ + private File crashReportFile; + private boolean field_85059_f = true; + private StackTraceElement[] field_85060_g = new StackTraceElement[0]; + + public CrashReport(String par1Str, Throwable par2Throwable) + { + this.description = par1Str; + this.cause = par2Throwable; + this.populateEnvironment(); + } + + /** + * Populates this crash report with initial information about the running server and operating system / java + * environment + */ + private void populateEnvironment() + { + this.field_85061_c.addCrashSectionCallable("Minecraft Version", new CallableMinecraftVersion(this)); + this.field_85061_c.addCrashSectionCallable("Operating System", new CallableOSInfo(this)); + this.field_85061_c.addCrashSectionCallable("Java Version", new CallableJavaInfo(this)); + this.field_85061_c.addCrashSectionCallable("Java VM Version", new CallableJavaInfo2(this)); + this.field_85061_c.addCrashSectionCallable("Memory", new CallableMemoryInfo(this)); + this.field_85061_c.addCrashSectionCallable("JVM Flags", new CallableJVMFlags(this)); + this.field_85061_c.addCrashSectionCallable("AABB Pool Size", new CallableCrashMemoryReport(this)); + this.field_85061_c.addCrashSectionCallable("Suspicious classes", new CallableSuspiciousClasses(this)); + this.field_85061_c.addCrashSectionCallable("IntCache", new CallableIntCache(this)); + } + + /** + * Returns the description of the Crash Report. + */ + public String getDescription() + { + return this.description; + } + + /** + * Returns the Throwable object that is the cause for the crash and Crash Report. + */ + public Throwable getCrashCause() + { + return this.cause; + } + + /** + * Gets the various sections of the crash report into the given StringBuilder + */ + public void getSectionsInStringBuilder(StringBuilder par1StringBuilder) + { + if (this.field_85060_g != null && this.field_85060_g.length > 0) + { + par1StringBuilder.append("-- Head --\n"); + par1StringBuilder.append("Stacktrace:\n"); + StackTraceElement[] var2 = this.field_85060_g; + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + StackTraceElement var5 = var2[var4]; + par1StringBuilder.append("\t").append("at ").append(var5.toString()); + par1StringBuilder.append("\n"); + } + + par1StringBuilder.append("\n"); + } + + Iterator var6 = this.crashReportSections.iterator(); + + while (var6.hasNext()) + { + CrashReportCategory var7 = (CrashReportCategory)var6.next(); + var7.func_85072_a(par1StringBuilder); + par1StringBuilder.append("\n\n"); + } + + this.field_85061_c.func_85072_a(par1StringBuilder); + } + + /** + * Gets the stack trace of the Throwable that caused this crash report, or if that fails, the cause .toString(). + */ + public String getCauseStackTraceOrString() + { + StringWriter var1 = null; + PrintWriter var2 = null; + String var3 = this.cause.toString(); + + try + { + var1 = new StringWriter(); + var2 = new PrintWriter(var1); + this.cause.printStackTrace(var2); + var3 = var1.toString(); + } + finally + { + try + { + if (var1 != null) + { + var1.close(); + } + + if (var2 != null) + { + var2.close(); + } + } + catch (IOException var10) + { + ; + } + } + + return var3; + } + + /** + * Gets the complete report with headers, stack trace, and different sections as a string. + */ + public String getCompleteReport() + { + StringBuilder var1 = new StringBuilder(); + var1.append("---- Minecraft Crash Report ----\n"); + var1.append("// "); + var1.append(getWittyComment()); + var1.append("\n\n"); + var1.append("Time: "); + var1.append((new SimpleDateFormat()).format(new Date())); + var1.append("\n"); + var1.append("Description: "); + var1.append(this.description); + var1.append("\n\n"); + var1.append(this.getCauseStackTraceOrString()); + var1.append("\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n"); + + for (int var2 = 0; var2 < 87; ++var2) + { + var1.append("-"); + } + + var1.append("\n\n"); + this.getSectionsInStringBuilder(var1); + return var1.toString(); + } + + /** + * Gets the file this crash report is saved into. + */ + public File getFile() + { + return this.crashReportFile; + } + + /** + * Saves the complete crash report to the given File. + */ + public boolean saveToFile(File par1File, ILogAgent par2ILogAgent) + { + if (this.crashReportFile != null) + { + return false; + } + else + { + if (par1File.getParentFile() != null) + { + par1File.getParentFile().mkdirs(); + } + + try + { + FileWriter var3 = new FileWriter(par1File); + var3.write(this.getCompleteReport()); + var3.close(); + this.crashReportFile = par1File; + return true; + } + catch (Throwable var4) + { + par2ILogAgent.logSevereException("Could not save crash report to " + par1File, var4); + return false; + } + } + } + + public CrashReportCategory getCategory() + { + return this.field_85061_c; + } + + /** + * Creates a CrashReportCategory + */ + public CrashReportCategory makeCategory(String par1Str) + { + return this.makeCategoryDepth(par1Str, 1); + } + + /** + * Creates a CrashReportCategory for the given stack trace depth + */ + public CrashReportCategory makeCategoryDepth(String par1Str, int par2) + { + CrashReportCategory var3 = new CrashReportCategory(this, par1Str); + + if (this.field_85059_f) + { + int var4 = var3.func_85073_a(par2); + StackTraceElement[] var5 = this.cause.getStackTrace(); + StackTraceElement var6 = null; + StackTraceElement var7 = null; + + if (var5 != null && var5.length - var4 < var5.length) + { + var6 = var5[var5.length - var4]; + + if (var5.length + 1 - var4 < var5.length) + { + var7 = var5[var5.length + 1 - var4]; + } + } + + this.field_85059_f = var3.func_85069_a(var6, var7); + + if (var4 > 0 && !this.crashReportSections.isEmpty()) + { + CrashReportCategory var8 = (CrashReportCategory)this.crashReportSections.get(this.crashReportSections.size() - 1); + var8.func_85070_b(var4); + } + else if (var5 != null && var5.length >= var4) + { + this.field_85060_g = new StackTraceElement[var5.length - var4]; + System.arraycopy(var5, 0, this.field_85060_g, 0, this.field_85060_g.length); + } + else + { + this.field_85059_f = false; + } + } + + this.crashReportSections.add(var3); + return var3; + } + + /** + * Gets a random witty comment for inclusion in this CrashReport + */ + private static String getWittyComment() + { + String[] var0 = new String[] {"Who set us up the TNT?", "Everything\'s going to plan. No, really, that was supposed to happen.", "Uh... Did I do that?", "Oops.", "Why did you do that?", "I feel sad now :(", "My bad.", "I\'m sorry, Dave.", "I let you down. Sorry :(", "On the bright side, I bought you a teddy bear!", "Daisy, daisy...", "Oh - I know what I did wrong!", "Hey, that tickles! Hehehe!", "I blame Dinnerbone.", "You should try our sister game, Minceraft!", "Don\'t be sad. I\'ll do better next time, I promise!", "Don\'t be sad, have a hug! <3", "I just don\'t know what went wrong :(", "Shall we play a game?", "Quite honestly, I wouldn\'t worry myself about that.", "I bet Cylons wouldn\'t have this problem.", "Sorry :(", "Surprise! Haha. Well, this is awkward.", "Would you like a cupcake?", "Hi. I\'m Minecraft, and I\'m a crashaholic.", "Ooh. Shiny.", "This doesn\'t make any sense!", "Why is it breaking :(", "Don\'t do that.", "Ouch. That hurt :(", "You\'re mean.", "This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]", "There are four lights!"}; + + try + { + return var0[(int)(System.nanoTime() % (long)var0.length)]; + } + catch (Throwable var2) + { + return "Witty comment unavailable :("; + } + } + + /** + * Creates a crash report for the exception + */ + public static CrashReport makeCrashReport(Throwable par0Throwable, String par1Str) + { + CrashReport var2; + + if (par0Throwable instanceof ReportedException) + { + var2 = ((ReportedException)par0Throwable).getCrashReport(); + } + else + { + var2 = new CrashReport(par1Str, par0Throwable); + } + + return var2; + } +} diff --git a/src/main/java/net/minecraft/src/CrashReportCategory.java b/src/main/java/net/minecraft/src/CrashReportCategory.java new file mode 100644 index 0000000..f7e9319 --- /dev/null +++ b/src/main/java/net/minecraft/src/CrashReportCategory.java @@ -0,0 +1,210 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.Callable; + +public class CrashReportCategory +{ + private final CrashReport theCrashReport; + private final String field_85076_b; + private final List field_85077_c = new ArrayList(); + private StackTraceElement[] stackTrace = new StackTraceElement[0]; + + public CrashReportCategory(CrashReport par1CrashReport, String par2Str) + { + this.theCrashReport = par1CrashReport; + this.field_85076_b = par2Str; + } + + public static String func_85074_a(double par0, double par2, double par4) + { + return String.format("%.2f,%.2f,%.2f - %s", new Object[] {Double.valueOf(par0), Double.valueOf(par2), Double.valueOf(par4), getLocationInfo(MathHelper.floor_double(par0), MathHelper.floor_double(par2), MathHelper.floor_double(par4))}); + } + + /** + * Returns a string with world information on location.Args:x,y,z + */ + public static String getLocationInfo(int par0, int par1, int par2) + { + StringBuilder var3 = new StringBuilder(); + + try + { + var3.append(String.format("World: (%d,%d,%d)", new Object[] {Integer.valueOf(par0), Integer.valueOf(par1), Integer.valueOf(par2)})); + } + catch (Throwable var16) + { + var3.append("(Error finding world loc)"); + } + + var3.append(", "); + int var4; + int var5; + int var6; + int var7; + int var8; + int var9; + int var10; + int var11; + int var12; + + try + { + var4 = par0 >> 4; + var5 = par2 >> 4; + var6 = par0 & 15; + var7 = par1 >> 4; + var8 = par2 & 15; + var9 = var4 << 4; + var10 = var5 << 4; + var11 = (var4 + 1 << 4) - 1; + var12 = (var5 + 1 << 4) - 1; + var3.append(String.format("Chunk: (at %d,%d,%d in %d,%d; contains blocks %d,0,%d to %d,255,%d)", new Object[] {Integer.valueOf(var6), Integer.valueOf(var7), Integer.valueOf(var8), Integer.valueOf(var4), Integer.valueOf(var5), Integer.valueOf(var9), Integer.valueOf(var10), Integer.valueOf(var11), Integer.valueOf(var12)})); + } + catch (Throwable var15) + { + var3.append("(Error finding chunk loc)"); + } + + var3.append(", "); + + try + { + var4 = par0 >> 9; + var5 = par2 >> 9; + var6 = var4 << 5; + var7 = var5 << 5; + var8 = (var4 + 1 << 5) - 1; + var9 = (var5 + 1 << 5) - 1; + var10 = var4 << 9; + var11 = var5 << 9; + var12 = (var4 + 1 << 9) - 1; + int var13 = (var5 + 1 << 9) - 1; + var3.append(String.format("Region: (%d,%d; contains chunks %d,%d to %d,%d, blocks %d,0,%d to %d,255,%d)", new Object[] {Integer.valueOf(var4), Integer.valueOf(var5), Integer.valueOf(var6), Integer.valueOf(var7), Integer.valueOf(var8), Integer.valueOf(var9), Integer.valueOf(var10), Integer.valueOf(var11), Integer.valueOf(var12), Integer.valueOf(var13)})); + } + catch (Throwable var14) + { + var3.append("(Error finding world loc)"); + } + + return var3.toString(); + } + + /** + * Adds a Crashreport section with the given name with the value set to the result of the given Callable; + */ + public void addCrashSectionCallable(String par1Str, Callable par2Callable) + { + try + { + this.addCrashSection(par1Str, par2Callable.call()); + } + catch (Throwable var4) + { + this.addCrashSectionThrowable(par1Str, var4); + } + } + + /** + * Adds a Crashreport section with the given name with the given value (convered .toString()) + */ + public void addCrashSection(String par1Str, Object par2Obj) + { + this.field_85077_c.add(new CrashReportCategoryEntry(par1Str, par2Obj)); + } + + /** + * Adds a Crashreport section with the given name with the given Throwable + */ + public void addCrashSectionThrowable(String par1Str, Throwable par2Throwable) + { + this.addCrashSection(par1Str, par2Throwable); + } + + public int func_85073_a(int par1) + { + StackTraceElement[] var2 = Thread.currentThread().getStackTrace(); + this.stackTrace = new StackTraceElement[var2.length - 3 - par1]; + System.arraycopy(var2, 3 + par1, this.stackTrace, 0, this.stackTrace.length); + return this.stackTrace.length; + } + + public boolean func_85069_a(StackTraceElement par1StackTraceElement, StackTraceElement par2StackTraceElement) + { + if (this.stackTrace.length != 0 && par1StackTraceElement != null) + { + StackTraceElement var3 = this.stackTrace[0]; + + if (var3.isNativeMethod() == par1StackTraceElement.isNativeMethod() && var3.getClassName().equals(par1StackTraceElement.getClassName()) && var3.getFileName().equals(par1StackTraceElement.getFileName()) && var3.getMethodName().equals(par1StackTraceElement.getMethodName())) + { + if (par2StackTraceElement != null != this.stackTrace.length > 1) + { + return false; + } + else if (par2StackTraceElement != null && !this.stackTrace[1].equals(par2StackTraceElement)) + { + return false; + } + else + { + this.stackTrace[0] = par1StackTraceElement; + return true; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + + public void func_85070_b(int par1) + { + StackTraceElement[] var2 = new StackTraceElement[this.stackTrace.length - par1]; + System.arraycopy(this.stackTrace, 0, var2, 0, var2.length); + this.stackTrace = var2; + } + + public void func_85072_a(StringBuilder par1StringBuilder) + { + par1StringBuilder.append("-- ").append(this.field_85076_b).append(" --\n"); + par1StringBuilder.append("Details:"); + Iterator var2 = this.field_85077_c.iterator(); + + while (var2.hasNext()) + { + CrashReportCategoryEntry var3 = (CrashReportCategoryEntry)var2.next(); + par1StringBuilder.append("\n\t"); + par1StringBuilder.append(var3.func_85089_a()); + par1StringBuilder.append(": "); + par1StringBuilder.append(var3.func_85090_b()); + } + + if (this.stackTrace != null && this.stackTrace.length > 0) + { + par1StringBuilder.append("\nStacktrace:"); + StackTraceElement[] var6 = this.stackTrace; + int var7 = var6.length; + + for (int var4 = 0; var4 < var7; ++var4) + { + StackTraceElement var5 = var6[var4]; + par1StringBuilder.append("\n\tat "); + par1StringBuilder.append(var5.toString()); + } + } + } + + public static void addBlockCrashInfo(CrashReportCategory par0CrashReportCategory, int par1, int par2, int par3, int par4, int par5) + { + par0CrashReportCategory.addCrashSectionCallable("Block type", new CallableBlockType(par4)); + par0CrashReportCategory.addCrashSectionCallable("Block data value", new CallableBlockDataValue(par5)); + par0CrashReportCategory.addCrashSectionCallable("Block location", new CallableBlockLocation(par1, par2, par3)); + } +} diff --git a/src/main/java/net/minecraft/src/CrashReportCategoryEntry.java b/src/main/java/net/minecraft/src/CrashReportCategoryEntry.java new file mode 100644 index 0000000..339f988 --- /dev/null +++ b/src/main/java/net/minecraft/src/CrashReportCategoryEntry.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +class CrashReportCategoryEntry +{ + private final String field_85092_a; + private final String field_85091_b; + + public CrashReportCategoryEntry(String par1Str, Object par2Obj) + { + this.field_85092_a = par1Str; + + if (par2Obj == null) + { + this.field_85091_b = "~~NULL~~"; + } + else if (par2Obj instanceof Throwable) + { + Throwable var3 = (Throwable)par2Obj; + this.field_85091_b = "~~ERROR~~ " + var3.getClass().getSimpleName() + ": " + var3.getMessage(); + } + else + { + this.field_85091_b = par2Obj.toString(); + } + } + + public String func_85089_a() + { + return this.field_85092_a; + } + + public String func_85090_b() + { + return this.field_85091_b; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeCrafting.java b/src/main/java/net/minecraft/src/CreativeCrafting.java new file mode 100644 index 0000000..563ceb0 --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeCrafting.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +import java.util.List; + +public class CreativeCrafting implements ICrafting +{ + private final Minecraft mc; + + public CreativeCrafting(Minecraft par1Minecraft) + { + this.mc = par1Minecraft; + } + + public void sendContainerAndContentsToPlayer(Container par1Container, List par2List) {} + + /** + * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual + * contents of that slot. Args: Container, slot number, slot contents + */ + public void sendSlotContents(Container par1Container, int par2, ItemStack par3ItemStack) + { + this.mc.playerController.sendSlotPacket(par3ItemStack, par2); + } + + /** + * Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress, + * and enchanting level. Normally the first int identifies which variable to update, and the second contains the new + * value. Both are truncated to shorts in non-local SMP. + */ + public void sendProgressBarUpdate(Container par1Container, int par2, int par3) {} +} diff --git a/src/main/java/net/minecraft/src/CreativeTabBlock.java b/src/main/java/net/minecraft/src/CreativeTabBlock.java new file mode 100644 index 0000000..4ab7602 --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabBlock.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabBlock extends CreativeTabs +{ + CreativeTabBlock(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Block.plantRed.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabBrewing.java b/src/main/java/net/minecraft/src/CreativeTabBrewing.java new file mode 100644 index 0000000..0b99503 --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabBrewing.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabBrewing extends CreativeTabs +{ + CreativeTabBrewing(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Item.potion.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabCombat.java b/src/main/java/net/minecraft/src/CreativeTabCombat.java new file mode 100644 index 0000000..7000a10 --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabCombat.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabCombat extends CreativeTabs +{ + CreativeTabCombat(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Block.brick.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabDeco.java b/src/main/java/net/minecraft/src/CreativeTabDeco.java new file mode 100644 index 0000000..5acbd4d --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabDeco.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabDeco extends CreativeTabs +{ + CreativeTabDeco(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Item.redstone.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabFood.java b/src/main/java/net/minecraft/src/CreativeTabFood.java new file mode 100644 index 0000000..9786a3d --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabFood.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabFood extends CreativeTabs +{ + CreativeTabFood(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Item.axeIron.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabInventory.java b/src/main/java/net/minecraft/src/CreativeTabInventory.java new file mode 100644 index 0000000..220d0d8 --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabInventory.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabInventory extends CreativeTabs +{ + CreativeTabInventory(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Block.chest.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabMaterial.java b/src/main/java/net/minecraft/src/CreativeTabMaterial.java new file mode 100644 index 0000000..d22b102 --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabMaterial.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabMaterial extends CreativeTabs +{ + CreativeTabMaterial(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Item.stick.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabMisc.java b/src/main/java/net/minecraft/src/CreativeTabMisc.java new file mode 100644 index 0000000..391b09e --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabMisc.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabMisc extends CreativeTabs +{ + CreativeTabMisc(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Item.compass.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabRedstone.java b/src/main/java/net/minecraft/src/CreativeTabRedstone.java new file mode 100644 index 0000000..10e3ea5 --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabRedstone.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabRedstone extends CreativeTabs +{ + CreativeTabRedstone(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Block.railPowered.blockID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabSearch.java b/src/main/java/net/minecraft/src/CreativeTabSearch.java new file mode 100644 index 0000000..87e511c --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabSearch.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabSearch extends CreativeTabs +{ + CreativeTabSearch(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Item.appleRed.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabTools.java b/src/main/java/net/minecraft/src/CreativeTabTools.java new file mode 100644 index 0000000..023bf9b --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabTools.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabTools extends CreativeTabs +{ + CreativeTabTools(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Item.swordGold.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabTransport.java b/src/main/java/net/minecraft/src/CreativeTabTransport.java new file mode 100644 index 0000000..125129d --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabTransport.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class CreativeTabTransport extends CreativeTabs +{ + CreativeTabTransport(int par1, String par2Str) + { + super(par1, par2Str); + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return Item.bucketLava.itemID; + } +} diff --git a/src/main/java/net/minecraft/src/CreativeTabs.java b/src/main/java/net/minecraft/src/CreativeTabs.java new file mode 100644 index 0000000..6963b67 --- /dev/null +++ b/src/main/java/net/minecraft/src/CreativeTabs.java @@ -0,0 +1,209 @@ +package net.minecraft.src; + +import java.util.List; + +public class CreativeTabs +{ + public static final CreativeTabs[] creativeTabArray = new CreativeTabs[12]; + public static final CreativeTabs tabBlock = new CreativeTabCombat(0, "buildingBlocks"); + public static final CreativeTabs tabDecorations = new CreativeTabBlock(1, "decorations"); + public static final CreativeTabs tabRedstone = new CreativeTabDeco(2, "redstone"); + public static final CreativeTabs tabTransport = new CreativeTabRedstone(3, "transportation"); + public static final CreativeTabs tabMisc = (new CreativeTabTransport(4, "misc")).func_111229_a(new EnumEnchantmentType[] {EnumEnchantmentType.all}); + public static final CreativeTabs tabAllSearch = (new CreativeTabMisc(5, "search")).setBackgroundImageName("item_search.png"); + public static final CreativeTabs tabFood = new CreativeTabSearch(6, "food"); + public static final CreativeTabs tabTools = (new CreativeTabFood(7, "tools")).func_111229_a(new EnumEnchantmentType[] {EnumEnchantmentType.digger}); + public static final CreativeTabs tabCombat = (new CreativeTabTools(8, "combat")).func_111229_a(new EnumEnchantmentType[] {EnumEnchantmentType.armor, EnumEnchantmentType.armor_feet, EnumEnchantmentType.armor_head, EnumEnchantmentType.armor_legs, EnumEnchantmentType.armor_torso, EnumEnchantmentType.bow, EnumEnchantmentType.weapon}); + public static final CreativeTabs tabBrewing = new CreativeTabBrewing(9, "brewing"); + public static final CreativeTabs tabMaterials = new CreativeTabMaterial(10, "materials"); + public static final CreativeTabs tabInventory = (new CreativeTabInventory(11, "inventory")).setBackgroundImageName("inventory.png").setNoScrollbar().setNoTitle(); + private final int tabIndex; + private final String tabLabel; + + /** Texture to use. */ + private String backgroundImageName = "items.png"; + private boolean hasScrollbar = true; + + /** Whether to draw the title in the foreground of the creative GUI */ + private boolean drawTitle = true; + private EnumEnchantmentType[] field_111230_s; + + public CreativeTabs(int par1, String par2Str) + { + this.tabIndex = par1; + this.tabLabel = par2Str; + creativeTabArray[par1] = this; + } + + public int getTabIndex() + { + return this.tabIndex; + } + + public String getTabLabel() + { + return this.tabLabel; + } + + /** + * Gets the translated Label. + */ + public String getTranslatedTabLabel() + { + return "itemGroup." + this.getTabLabel(); + } + + public Item getTabIconItem() + { + return Item.itemsList[this.getTabIconItemIndex()]; + } + + /** + * the itemID for the item to be displayed on the tab + */ + public int getTabIconItemIndex() + { + return 1; + } + + public String getBackgroundImageName() + { + return this.backgroundImageName; + } + + public CreativeTabs setBackgroundImageName(String par1Str) + { + this.backgroundImageName = par1Str; + return this; + } + + public boolean drawInForegroundOfTab() + { + return this.drawTitle; + } + + public CreativeTabs setNoTitle() + { + this.drawTitle = false; + return this; + } + + public boolean shouldHidePlayerInventory() + { + return this.hasScrollbar; + } + + public CreativeTabs setNoScrollbar() + { + this.hasScrollbar = false; + return this; + } + + /** + * returns index % 6 + */ + public int getTabColumn() + { + return this.tabIndex % 6; + } + + /** + * returns tabIndex < 6 + */ + public boolean isTabInFirstRow() + { + return this.tabIndex < 6; + } + + public EnumEnchantmentType[] func_111225_m() + { + return this.field_111230_s; + } + + public CreativeTabs func_111229_a(EnumEnchantmentType ... par1ArrayOfEnumEnchantmentType) + { + this.field_111230_s = par1ArrayOfEnumEnchantmentType; + return this; + } + + public boolean func_111226_a(EnumEnchantmentType par1EnumEnchantmentType) + { + if (this.field_111230_s == null) + { + return false; + } + else + { + EnumEnchantmentType[] var2 = this.field_111230_s; + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + EnumEnchantmentType var5 = var2[var4]; + + if (var5 == par1EnumEnchantmentType) + { + return true; + } + } + + return false; + } + } + + /** + * only shows items which have tabToDisplayOn == this + */ + public void displayAllReleventItems(List par1List) + { + Item[] var2 = Item.itemsList; + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + Item var5 = var2[var4]; + + if (var5 != null && var5.getCreativeTab() == this) + { + var5.getSubItems(var5.itemID, this, par1List); + } + } + + if (this.func_111225_m() != null) + { + this.addEnchantmentBooksToList(par1List, this.func_111225_m()); + } + } + + /** + * Adds the enchantment books from the supplied EnumEnchantmentType to the given list. + */ + public void addEnchantmentBooksToList(List par1List, EnumEnchantmentType ... par2ArrayOfEnumEnchantmentType) + { + Enchantment[] var3 = Enchantment.enchantmentsList; + int var4 = var3.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + Enchantment var6 = var3[var5]; + + if (var6 != null && var6.type != null) + { + boolean var7 = false; + + for (int var8 = 0; var8 < par2ArrayOfEnumEnchantmentType.length && !var7; ++var8) + { + if (var6.type == par2ArrayOfEnumEnchantmentType[var8]) + { + var7 = true; + } + } + + if (var7) + { + par1List.add(Item.enchantedBook.getEnchantedItemStack(new EnchantmentData(var6, var6.getMaxLevel()))); + } + } + } + } +} diff --git a/src/main/java/net/minecraft/src/CryptManager.java b/src/main/java/net/minecraft/src/CryptManager.java new file mode 100644 index 0000000..fc1f8bf --- /dev/null +++ b/src/main/java/net/minecraft/src/CryptManager.java @@ -0,0 +1,228 @@ +package net.minecraft.src; + +import java.io.InputStream; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.security.InvalidKeyException; +import java.security.Key; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.SecureRandom; +import java.security.Security; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.X509EncodedKeySpec; +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import org.bouncycastle.crypto.BufferedBlockCipher; +import org.bouncycastle.crypto.CipherKeyGenerator; +import org.bouncycastle.crypto.KeyGenerationParameters; +import org.bouncycastle.crypto.engines.AESFastEngine; +import org.bouncycastle.crypto.io.CipherInputStream; +import org.bouncycastle.crypto.io.CipherOutputStream; +import org.bouncycastle.crypto.modes.CFBBlockCipher; +import org.bouncycastle.crypto.params.KeyParameter; +import org.bouncycastle.crypto.params.ParametersWithIV; +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +public class CryptManager +{ + /** + * Generate a new shared secret AES key from a secure random source + */ + public static SecretKey createNewSharedKey() + { + CipherKeyGenerator var0 = new CipherKeyGenerator(); + var0.init(new KeyGenerationParameters(new SecureRandom(), 128)); + return new SecretKeySpec(var0.generateKey(), "AES"); + } + + public static KeyPair createNewKeyPair() + { + try + { + KeyPairGenerator var0 = KeyPairGenerator.getInstance("RSA"); + var0.initialize(1024); + return var0.generateKeyPair(); + } + catch (NoSuchAlgorithmException var1) + { + var1.printStackTrace(); + System.err.println("Key pair generation failed!"); + return null; + } + } + + /** + * Compute a serverId hash for use by sendSessionRequest() + */ + public static byte[] getServerIdHash(String par0Str, PublicKey par1PublicKey, SecretKey par2SecretKey) + { + try + { + return digestOperation("SHA-1", new byte[][] {par0Str.getBytes("ISO_8859_1"), par2SecretKey.getEncoded(), par1PublicKey.getEncoded()}); + } + catch (UnsupportedEncodingException var4) + { + var4.printStackTrace(); + return null; + } + } + + /** + * Compute a message digest on arbitrary byte[] data + */ + private static byte[] digestOperation(String par0Str, byte[] ... par1ArrayOfByte) + { + try + { + MessageDigest var2 = MessageDigest.getInstance(par0Str); + byte[][] var3 = par1ArrayOfByte; + int var4 = par1ArrayOfByte.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + byte[] var6 = var3[var5]; + var2.update(var6); + } + + return var2.digest(); + } + catch (NoSuchAlgorithmException var7) + { + var7.printStackTrace(); + return null; + } + } + + /** + * Create a new PublicKey from encoded X.509 data + */ + public static PublicKey decodePublicKey(byte[] par0ArrayOfByte) + { + try + { + X509EncodedKeySpec var1 = new X509EncodedKeySpec(par0ArrayOfByte); + KeyFactory var2 = KeyFactory.getInstance("RSA"); + return var2.generatePublic(var1); + } + catch (NoSuchAlgorithmException var3) + { + var3.printStackTrace(); + } + catch (InvalidKeySpecException var4) + { + var4.printStackTrace(); + } + + System.err.println("Public key reconstitute failed!"); + return null; + } + + /** + * Decrypt shared secret AES key using RSA private key + */ + public static SecretKey decryptSharedKey(PrivateKey par0PrivateKey, byte[] par1ArrayOfByte) + { + return new SecretKeySpec(decryptData(par0PrivateKey, par1ArrayOfByte), "AES"); + } + + /** + * Encrypt byte[] data with RSA public key + */ + public static byte[] encryptData(Key par0Key, byte[] par1ArrayOfByte) + { + return cipherOperation(1, par0Key, par1ArrayOfByte); + } + + /** + * Decrypt byte[] data with RSA private key + */ + public static byte[] decryptData(Key par0Key, byte[] par1ArrayOfByte) + { + return cipherOperation(2, par0Key, par1ArrayOfByte); + } + + /** + * Encrypt or decrypt byte[] data using the specified key + */ + private static byte[] cipherOperation(int par0, Key par1Key, byte[] par2ArrayOfByte) + { + try + { + return createTheCipherInstance(par0, par1Key.getAlgorithm(), par1Key).doFinal(par2ArrayOfByte); + } + catch (IllegalBlockSizeException var4) + { + var4.printStackTrace(); + } + catch (BadPaddingException var5) + { + var5.printStackTrace(); + } + + System.err.println("Cipher data failed!"); + return null; + } + + /** + * Creates the Cipher Instance. + */ + private static Cipher createTheCipherInstance(int par0, String par1Str, Key par2Key) + { + try + { + Cipher var3 = Cipher.getInstance(par1Str); + var3.init(par0, par2Key); + return var3; + } + catch (InvalidKeyException var4) + { + var4.printStackTrace(); + } + catch (NoSuchAlgorithmException var5) + { + var5.printStackTrace(); + } + catch (NoSuchPaddingException var6) + { + var6.printStackTrace(); + } + + System.err.println("Cipher creation failed!"); + return null; + } + + /** + * Create a new BufferedBlockCipher instance + */ + private static BufferedBlockCipher createBufferedBlockCipher(boolean par0, Key par1Key) + { + BufferedBlockCipher var2 = new BufferedBlockCipher(new CFBBlockCipher(new AESFastEngine(), 8)); + var2.init(par0, new ParametersWithIV(new KeyParameter(par1Key.getEncoded()), par1Key.getEncoded(), 0, 16)); + return var2; + } + + public static OutputStream encryptOuputStream(SecretKey par0SecretKey, OutputStream par1OutputStream) + { + return new CipherOutputStream(par1OutputStream, createBufferedBlockCipher(true, par0SecretKey)); + } + + public static InputStream decryptInputStream(SecretKey par0SecretKey, InputStream par1InputStream) + { + return new CipherInputStream(par1InputStream, createBufferedBlockCipher(false, par0SecretKey)); + } + + static + { + Security.addProvider(new BouncyCastleProvider()); + } +} diff --git a/src/main/java/net/minecraft/src/DamageSource.java b/src/main/java/net/minecraft/src/DamageSource.java new file mode 100644 index 0000000..1710957 --- /dev/null +++ b/src/main/java/net/minecraft/src/DamageSource.java @@ -0,0 +1,234 @@ +package net.minecraft.src; + +public class DamageSource +{ + public static DamageSource inFire = (new DamageSource("inFire")).setFireDamage(); + public static DamageSource onFire = (new DamageSource("onFire")).setDamageBypassesArmor().setFireDamage(); + public static DamageSource lava = (new DamageSource("lava")).setFireDamage(); + public static DamageSource inWall = (new DamageSource("inWall")).setDamageBypassesArmor(); + public static DamageSource drown = (new DamageSource("drown")).setDamageBypassesArmor(); + public static DamageSource starve = (new DamageSource("starve")).setDamageBypassesArmor(); + public static DamageSource cactus = new DamageSource("cactus"); + public static DamageSource fall = (new DamageSource("fall")).setDamageBypassesArmor(); + public static DamageSource outOfWorld = (new DamageSource("outOfWorld")).setDamageBypassesArmor().setDamageAllowedInCreativeMode(); + public static DamageSource generic = (new DamageSource("generic")).setDamageBypassesArmor(); + public static DamageSource magic = (new DamageSource("magic")).setDamageBypassesArmor().setMagicDamage(); + public static DamageSource wither = (new DamageSource("wither")).setDamageBypassesArmor(); + public static DamageSource anvil = new DamageSource("anvil"); + public static DamageSource fallingBlock = new DamageSource("fallingBlock"); + + /** This kind of damage can be blocked or not. */ + private boolean isUnblockable; + private boolean isDamageAllowedInCreativeMode; + private float hungerDamage = 0.3F; + + /** This kind of damage is based on fire or not. */ + private boolean fireDamage; + + /** This kind of damage is based on a projectile or not. */ + private boolean projectile; + + /** + * Whether this damage source will have its damage amount scaled based on the current difficulty. + */ + private boolean difficultyScaled; + private boolean magicDamage; + private boolean explosion; + public String damageType; + + public static DamageSource causeMobDamage(EntityLivingBase par0EntityLivingBase) + { + return new EntityDamageSource("mob", par0EntityLivingBase); + } + + /** + * returns an EntityDamageSource of type player + */ + public static DamageSource causePlayerDamage(EntityPlayer par0EntityPlayer) + { + return new EntityDamageSource("player", par0EntityPlayer); + } + + /** + * returns EntityDamageSourceIndirect of an arrow + */ + public static DamageSource causeArrowDamage(EntityArrow par0EntityArrow, Entity par1Entity) + { + return (new EntityDamageSourceIndirect("arrow", par0EntityArrow, par1Entity)).setProjectile(); + } + + /** + * returns EntityDamageSourceIndirect of a fireball + */ + public static DamageSource causeFireballDamage(EntityFireball par0EntityFireball, Entity par1Entity) + { + return par1Entity == null ? (new EntityDamageSourceIndirect("onFire", par0EntityFireball, par0EntityFireball)).setFireDamage().setProjectile() : (new EntityDamageSourceIndirect("fireball", par0EntityFireball, par1Entity)).setFireDamage().setProjectile(); + } + + public static DamageSource causeThrownDamage(Entity par0Entity, Entity par1Entity) + { + return (new EntityDamageSourceIndirect("thrown", par0Entity, par1Entity)).setProjectile(); + } + + public static DamageSource causeIndirectMagicDamage(Entity par0Entity, Entity par1Entity) + { + return (new EntityDamageSourceIndirect("indirectMagic", par0Entity, par1Entity)).setDamageBypassesArmor().setMagicDamage(); + } + + /** + * Returns the EntityDamageSource of the Thorns enchantment + */ + public static DamageSource causeThornsDamage(Entity par0Entity) + { + return (new EntityDamageSource("thorns", par0Entity)).setMagicDamage(); + } + + public static DamageSource setExplosionSource(Explosion par0Explosion) + { + return par0Explosion != null && par0Explosion.getExplosivePlacedBy() != null ? (new EntityDamageSource("explosion.player", par0Explosion.getExplosivePlacedBy())).setDifficultyScaled().setExplosion() : (new DamageSource("explosion")).setDifficultyScaled().setExplosion(); + } + + /** + * Returns true if the damage is projectile based. + */ + public boolean isProjectile() + { + return this.projectile; + } + + /** + * Define the damage type as projectile based. + */ + public DamageSource setProjectile() + { + this.projectile = true; + return this; + } + + public boolean isExplosion() + { + return this.explosion; + } + + public DamageSource setExplosion() + { + this.explosion = true; + return this; + } + + public boolean isUnblockable() + { + return this.isUnblockable; + } + + /** + * How much satiate(food) is consumed by this DamageSource + */ + public float getHungerDamage() + { + return this.hungerDamage; + } + + public boolean canHarmInCreative() + { + return this.isDamageAllowedInCreativeMode; + } + + protected DamageSource(String par1Str) + { + this.damageType = par1Str; + } + + public Entity getSourceOfDamage() + { + return this.getEntity(); + } + + public Entity getEntity() + { + return null; + } + + protected DamageSource setDamageBypassesArmor() + { + this.isUnblockable = true; + this.hungerDamage = 0.0F; + return this; + } + + protected DamageSource setDamageAllowedInCreativeMode() + { + this.isDamageAllowedInCreativeMode = true; + return this; + } + + /** + * Define the damage type as fire based. + */ + protected DamageSource setFireDamage() + { + this.fireDamage = true; + return this; + } + + /** + * Returns the message to be displayed on player death. + */ + public ChatMessageComponent getDeathMessage(EntityLivingBase par1EntityLivingBase) + { + EntityLivingBase var2 = par1EntityLivingBase.func_94060_bK(); + String var3 = "death.attack." + this.damageType; + String var4 = var3 + ".player"; + return var2 != null && StatCollector.func_94522_b(var4) ? ChatMessageComponent.createFromTranslationWithSubstitutions(var4, new Object[] {par1EntityLivingBase.getTranslatedEntityName(), var2.getTranslatedEntityName()}): ChatMessageComponent.createFromTranslationWithSubstitutions(var3, new Object[] {par1EntityLivingBase.getTranslatedEntityName()}); + } + + /** + * Returns true if the damage is fire based. + */ + public boolean isFireDamage() + { + return this.fireDamage; + } + + /** + * Return the name of damage type. + */ + public String getDamageType() + { + return this.damageType; + } + + /** + * Set whether this damage source will have its damage amount scaled based on the current difficulty. + */ + public DamageSource setDifficultyScaled() + { + this.difficultyScaled = true; + return this; + } + + /** + * Return whether this damage source will have its damage amount scaled based on the current difficulty. + */ + public boolean isDifficultyScaled() + { + return this.difficultyScaled; + } + + /** + * Returns true if the damage is magic based. + */ + public boolean isMagicDamage() + { + return this.magicDamage; + } + + /** + * Define the damage type as magic based. + */ + public DamageSource setMagicDamage() + { + this.magicDamage = true; + return this; + } +} diff --git a/src/main/java/net/minecraft/src/DataWatcher.java b/src/main/java/net/minecraft/src/DataWatcher.java new file mode 100644 index 0000000..2a1cada --- /dev/null +++ b/src/main/java/net/minecraft/src/DataWatcher.java @@ -0,0 +1,380 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +public class DataWatcher +{ + /** When isBlank is true the DataWatcher is not watching any objects */ + private boolean isBlank = true; + private static final HashMap dataTypes = new HashMap(); + private final Map watchedObjects = new HashMap(); + + /** true if one or more object was changed */ + private boolean objectChanged; + private ReadWriteLock lock = new ReentrantReadWriteLock(); + + /** + * adds a new object to dataWatcher to watch, to update an already existing object see updateObject. Arguments: data + * Value Id, Object to add + */ + public void addObject(int par1, Object par2Obj) + { + Integer var3 = (Integer)dataTypes.get(par2Obj.getClass()); + + if (var3 == null) + { + throw new IllegalArgumentException("Unknown data type: " + par2Obj.getClass()); + } + else if (par1 > 31) + { + throw new IllegalArgumentException("Data value id is too big with " + par1 + "! (Max is " + 31 + ")"); + } + else if (this.watchedObjects.containsKey(Integer.valueOf(par1))) + { + throw new IllegalArgumentException("Duplicate id value for " + par1 + "!"); + } + else + { + WatchableObject var4 = new WatchableObject(var3.intValue(), par1, par2Obj); + this.lock.writeLock().lock(); + this.watchedObjects.put(Integer.valueOf(par1), var4); + this.lock.writeLock().unlock(); + this.isBlank = false; + } + } + + /** + * Add a new object for the DataWatcher to watch, using the specified data type. + */ + public void addObjectByDataType(int par1, int par2) + { + WatchableObject var3 = new WatchableObject(par2, par1, (Object)null); + this.lock.writeLock().lock(); + this.watchedObjects.put(Integer.valueOf(par1), var3); + this.lock.writeLock().unlock(); + this.isBlank = false; + } + + /** + * gets the bytevalue of a watchable object + */ + public byte getWatchableObjectByte(int par1) + { + return ((Byte)this.getWatchedObject(par1).getObject()).byteValue(); + } + + public short getWatchableObjectShort(int par1) + { + return ((Short)this.getWatchedObject(par1).getObject()).shortValue(); + } + + /** + * gets a watchable object and returns it as a Integer + */ + public int getWatchableObjectInt(int par1) + { + return ((Integer)this.getWatchedObject(par1).getObject()).intValue(); + } + + public float getWatchableObjectFloat(int par1) + { + return ((Float)this.getWatchedObject(par1).getObject()).floatValue(); + } + + /** + * gets a watchable object and returns it as a String + */ + public String getWatchableObjectString(int par1) + { + return (String)this.getWatchedObject(par1).getObject(); + } + + /** + * Get a watchable object as an ItemStack. + */ + public ItemStack getWatchableObjectItemStack(int par1) + { + return (ItemStack)this.getWatchedObject(par1).getObject(); + } + + /** + * is threadsafe, unless it throws an exception, then + */ + private WatchableObject getWatchedObject(int par1) + { + this.lock.readLock().lock(); + WatchableObject var2; + + try + { + var2 = (WatchableObject)this.watchedObjects.get(Integer.valueOf(par1)); + } + catch (Throwable var6) + { + CrashReport var4 = CrashReport.makeCrashReport(var6, "Getting synched entity data"); + CrashReportCategory var5 = var4.makeCategory("Synched entity data"); + var5.addCrashSection("Data ID", Integer.valueOf(par1)); + throw new ReportedException(var4); + } + + this.lock.readLock().unlock(); + return var2; + } + + /** + * updates an already existing object + */ + public void updateObject(int par1, Object par2Obj) + { + WatchableObject var3 = this.getWatchedObject(par1); + + if (!par2Obj.equals(var3.getObject())) + { + var3.setObject(par2Obj); + var3.setWatched(true); + this.objectChanged = true; + } + } + + public void setObjectWatched(int par1) + { + WatchableObject.setWatchableObjectWatched(this.getWatchedObject(par1), true); + this.objectChanged = true; + } + + public boolean hasChanges() + { + return this.objectChanged; + } + + /** + * writes every object in passed list to dataoutputstream, terminated by 0x7F + */ + public static void writeObjectsInListToStream(List par0List, DataOutput par1DataOutput) throws IOException + { + if (par0List != null) + { + Iterator var2 = par0List.iterator(); + + while (var2.hasNext()) + { + WatchableObject var3 = (WatchableObject)var2.next(); + writeWatchableObject(par1DataOutput, var3); + } + } + + par1DataOutput.writeByte(127); + } + + public List unwatchAndReturnAllWatched() + { + ArrayList var1 = null; + + if (this.objectChanged) + { + this.lock.readLock().lock(); + Iterator var2 = this.watchedObjects.values().iterator(); + + while (var2.hasNext()) + { + WatchableObject var3 = (WatchableObject)var2.next(); + + if (var3.isWatched()) + { + var3.setWatched(false); + + if (var1 == null) + { + var1 = new ArrayList(); + } + + var1.add(var3); + } + } + + this.lock.readLock().unlock(); + } + + this.objectChanged = false; + return var1; + } + + public void writeWatchableObjects(DataOutput par1DataOutput) throws IOException + { + this.lock.readLock().lock(); + Iterator var2 = this.watchedObjects.values().iterator(); + + while (var2.hasNext()) + { + WatchableObject var3 = (WatchableObject)var2.next(); + writeWatchableObject(par1DataOutput, var3); + } + + this.lock.readLock().unlock(); + par1DataOutput.writeByte(127); + } + + public List getAllWatched() + { + ArrayList var1 = null; + this.lock.readLock().lock(); + WatchableObject var3; + + for (Iterator var2 = this.watchedObjects.values().iterator(); var2.hasNext(); var1.add(var3)) + { + var3 = (WatchableObject)var2.next(); + + if (var1 == null) + { + var1 = new ArrayList(); + } + } + + this.lock.readLock().unlock(); + return var1; + } + + private static void writeWatchableObject(DataOutput par0DataOutput, WatchableObject par1WatchableObject) throws IOException + { + int var2 = (par1WatchableObject.getObjectType() << 5 | par1WatchableObject.getDataValueId() & 31) & 255; + par0DataOutput.writeByte(var2); + + switch (par1WatchableObject.getObjectType()) + { + case 0: + par0DataOutput.writeByte(((Byte)par1WatchableObject.getObject()).byteValue()); + break; + + case 1: + par0DataOutput.writeShort(((Short)par1WatchableObject.getObject()).shortValue()); + break; + + case 2: + par0DataOutput.writeInt(((Integer)par1WatchableObject.getObject()).intValue()); + break; + + case 3: + par0DataOutput.writeFloat(((Float)par1WatchableObject.getObject()).floatValue()); + break; + + case 4: + Packet.writeString((String)par1WatchableObject.getObject(), par0DataOutput); + break; + + case 5: + ItemStack var4 = (ItemStack)par1WatchableObject.getObject(); + Packet.writeItemStack(var4, par0DataOutput); + break; + + case 6: + ChunkCoordinates var3 = (ChunkCoordinates)par1WatchableObject.getObject(); + par0DataOutput.writeInt(var3.posX); + par0DataOutput.writeInt(var3.posY); + par0DataOutput.writeInt(var3.posZ); + } + } + + public static List readWatchableObjects(DataInput par0DataInput) throws IOException + { + ArrayList var1 = null; + + for (byte var2 = par0DataInput.readByte(); var2 != 127; var2 = par0DataInput.readByte()) + { + if (var1 == null) + { + var1 = new ArrayList(); + } + + int var3 = (var2 & 224) >> 5; + int var4 = var2 & 31; + WatchableObject var5 = null; + + switch (var3) + { + case 0: + var5 = new WatchableObject(var3, var4, Byte.valueOf(par0DataInput.readByte())); + break; + + case 1: + var5 = new WatchableObject(var3, var4, Short.valueOf(par0DataInput.readShort())); + break; + + case 2: + var5 = new WatchableObject(var3, var4, Integer.valueOf(par0DataInput.readInt())); + break; + + case 3: + var5 = new WatchableObject(var3, var4, Float.valueOf(par0DataInput.readFloat())); + break; + + case 4: + var5 = new WatchableObject(var3, var4, Packet.readString(par0DataInput, 64)); + break; + + case 5: + var5 = new WatchableObject(var3, var4, Packet.readItemStack(par0DataInput)); + break; + + case 6: + int var6 = par0DataInput.readInt(); + int var7 = par0DataInput.readInt(); + int var8 = par0DataInput.readInt(); + var5 = new WatchableObject(var3, var4, new ChunkCoordinates(var6, var7, var8)); + } + + var1.add(var5); + } + + return var1; + } + + public void updateWatchedObjectsFromList(List par1List) + { + this.lock.writeLock().lock(); + Iterator var2 = par1List.iterator(); + + while (var2.hasNext()) + { + WatchableObject var3 = (WatchableObject)var2.next(); + WatchableObject var4 = (WatchableObject)this.watchedObjects.get(Integer.valueOf(var3.getDataValueId())); + + if (var4 != null) + { + var4.setObject(var3.getObject()); + } + } + + this.lock.writeLock().unlock(); + this.objectChanged = true; + } + + public boolean getIsBlank() + { + return this.isBlank; + } + + public void func_111144_e() + { + this.objectChanged = false; + } + + static + { + dataTypes.put(Byte.class, Integer.valueOf(0)); + dataTypes.put(Short.class, Integer.valueOf(1)); + dataTypes.put(Integer.class, Integer.valueOf(2)); + dataTypes.put(Float.class, Integer.valueOf(3)); + dataTypes.put(String.class, Integer.valueOf(4)); + dataTypes.put(ItemStack.class, Integer.valueOf(5)); + dataTypes.put(ChunkCoordinates.class, Integer.valueOf(6)); + } +} diff --git a/src/main/java/net/minecraft/src/DedicatedPlayerList.java b/src/main/java/net/minecraft/src/DedicatedPlayerList.java new file mode 100644 index 0000000..3ffbb26 --- /dev/null +++ b/src/main/java/net/minecraft/src/DedicatedPlayerList.java @@ -0,0 +1,198 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.util.Iterator; +import net.minecraft.server.MinecraftServer; + +public class DedicatedPlayerList extends ServerConfigurationManager +{ + private File opsList; + private File whiteList; + + public DedicatedPlayerList(DedicatedServer par1DedicatedServer) + { + super(par1DedicatedServer); + this.opsList = par1DedicatedServer.getFile("ops.txt"); + this.whiteList = par1DedicatedServer.getFile("white-list.txt"); + this.viewDistance = par1DedicatedServer.getIntProperty("view-distance", 10); + this.maxPlayers = par1DedicatedServer.getIntProperty("max-players", 20); + this.setWhiteListEnabled(par1DedicatedServer.getBooleanProperty("white-list", false)); + + if (!par1DedicatedServer.isSinglePlayer()) + { + this.getBannedPlayers().setListActive(true); + this.getBannedIPs().setListActive(true); + } + + this.getBannedPlayers().loadBanList(); + this.getBannedPlayers().saveToFileWithHeader(); + this.getBannedIPs().loadBanList(); + this.getBannedIPs().saveToFileWithHeader(); + this.loadOpsList(); + this.readWhiteList(); + this.saveOpsList(); + + if (!this.whiteList.exists()) + { + this.saveWhiteList(); + } + } + + public void setWhiteListEnabled(boolean par1) + { + super.setWhiteListEnabled(par1); + this.getDedicatedServerInstance().setProperty("white-list", Boolean.valueOf(par1)); + this.getDedicatedServerInstance().saveProperties(); + } + + /** + * This adds a username to the ops list, then saves the op list + */ + public void addOp(String par1Str) + { + super.addOp(par1Str); + this.saveOpsList(); + } + + /** + * This removes a username from the ops list, then saves the op list + */ + public void removeOp(String par1Str) + { + super.removeOp(par1Str); + this.saveOpsList(); + } + + /** + * Remove the specified player from the whitelist. + */ + public void removeFromWhitelist(String par1Str) + { + super.removeFromWhitelist(par1Str); + this.saveWhiteList(); + } + + /** + * Add the specified player to the white list. + */ + public void addToWhiteList(String par1Str) + { + super.addToWhiteList(par1Str); + this.saveWhiteList(); + } + + /** + * Either does nothing, or calls readWhiteList. + */ + public void loadWhiteList() + { + this.readWhiteList(); + } + + private void loadOpsList() + { + try + { + this.getOps().clear(); + BufferedReader var1 = new BufferedReader(new FileReader(this.opsList)); + String var2 = ""; + + while ((var2 = var1.readLine()) != null) + { + this.getOps().add(var2.trim().toLowerCase()); + } + + var1.close(); + } + catch (Exception var3) + { + this.getDedicatedServerInstance().getLogAgent().logWarning("Failed to load operators list: " + var3); + } + } + + private void saveOpsList() + { + try + { + PrintWriter var1 = new PrintWriter(new FileWriter(this.opsList, false)); + Iterator var2 = this.getOps().iterator(); + + while (var2.hasNext()) + { + String var3 = (String)var2.next(); + var1.println(var3); + } + + var1.close(); + } + catch (Exception var4) + { + this.getDedicatedServerInstance().getLogAgent().logWarning("Failed to save operators list: " + var4); + } + } + + private void readWhiteList() + { + try + { + this.getWhiteListedPlayers().clear(); + BufferedReader var1 = new BufferedReader(new FileReader(this.whiteList)); + String var2 = ""; + + while ((var2 = var1.readLine()) != null) + { + this.getWhiteListedPlayers().add(var2.trim().toLowerCase()); + } + + var1.close(); + } + catch (Exception var3) + { + this.getDedicatedServerInstance().getLogAgent().logWarning("Failed to load white-list: " + var3); + } + } + + private void saveWhiteList() + { + try + { + PrintWriter var1 = new PrintWriter(new FileWriter(this.whiteList, false)); + Iterator var2 = this.getWhiteListedPlayers().iterator(); + + while (var2.hasNext()) + { + String var3 = (String)var2.next(); + var1.println(var3); + } + + var1.close(); + } + catch (Exception var4) + { + this.getDedicatedServerInstance().getLogAgent().logWarning("Failed to save white-list: " + var4); + } + } + + /** + * Determine if the player is allowed to connect based on current server settings. + */ + public boolean isAllowedToLogin(String par1Str) + { + par1Str = par1Str.trim().toLowerCase(); + return !this.isWhiteListEnabled() || this.isPlayerOpped(par1Str) || this.getWhiteListedPlayers().contains(par1Str); + } + + public DedicatedServer getDedicatedServerInstance() + { + return (DedicatedServer)super.getServerInstance(); + } + + public MinecraftServer getServerInstance() + { + return this.getDedicatedServerInstance(); + } +} diff --git a/src/main/java/net/minecraft/src/DedicatedServer.java b/src/main/java/net/minecraft/src/DedicatedServer.java new file mode 100644 index 0000000..cc47200 --- /dev/null +++ b/src/main/java/net/minecraft/src/DedicatedServer.java @@ -0,0 +1,436 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.IOException; +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Random; +import net.minecraft.server.MinecraftServer; + +public class DedicatedServer extends MinecraftServer implements IServer +{ + private final List pendingCommandList = Collections.synchronizedList(new ArrayList()); + private final ILogAgent field_98131_l; + private RConThreadQuery theRConThreadQuery; + private RConThreadMain theRConThreadMain; + private PropertyManager settings; + private boolean canSpawnStructures; + private EnumGameType gameType; + private NetworkListenThread networkThread; + private boolean guiIsEnabled; + + public DedicatedServer(File par1File) + { + super(par1File); + this.field_98131_l = new LogAgent("Minecraft-Server", (String)null, (new File(par1File, "server.log")).getAbsolutePath()); + new DedicatedServerSleepThread(this); + } + + /** + * Initialises the server and starts it. + */ + protected boolean startServer() throws IOException + { + DedicatedServerCommandThread var1 = new DedicatedServerCommandThread(this); + var1.setDaemon(true); + var1.start(); + this.getLogAgent().logInfo("Starting minecraft server version 1.6.4"); + + if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) + { + this.getLogAgent().logWarning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); + } + + this.getLogAgent().logInfo("Loading properties"); + this.settings = new PropertyManager(new File("server.properties"), this.getLogAgent()); + + if (this.isSinglePlayer()) + { + this.setHostname("127.0.0.1"); + } + else + { + this.setOnlineMode(this.settings.getBooleanProperty("online-mode", true)); + this.setHostname(this.settings.getProperty("server-ip", "")); + } + + this.setCanSpawnAnimals(this.settings.getBooleanProperty("spawn-animals", true)); + this.setCanSpawnNPCs(this.settings.getBooleanProperty("spawn-npcs", true)); + this.setAllowPvp(this.settings.getBooleanProperty("pvp", true)); + this.setAllowFlight(this.settings.getBooleanProperty("allow-flight", false)); + this.setTexturePack(this.settings.getProperty("texture-pack", "")); + this.setMOTD(this.settings.getProperty("motd", "A Minecraft Server")); + this.setForceGamemode(this.settings.getBooleanProperty("force-gamemode", false)); + this.func_143006_e(this.settings.getIntProperty("player-idle-timeout", 0)); + + if (this.settings.getIntProperty("difficulty", 1) < 0) + { + this.settings.setProperty("difficulty", Integer.valueOf(0)); + } + else if (this.settings.getIntProperty("difficulty", 1) > 3) + { + this.settings.setProperty("difficulty", Integer.valueOf(3)); + } + + this.canSpawnStructures = this.settings.getBooleanProperty("generate-structures", true); + int var2 = this.settings.getIntProperty("gamemode", EnumGameType.SURVIVAL.getID()); + this.gameType = WorldSettings.getGameTypeById(var2); + this.getLogAgent().logInfo("Default game type: " + this.gameType); + InetAddress var3 = null; + + if (this.getServerHostname().length() > 0) + { + var3 = InetAddress.getByName(this.getServerHostname()); + } + + if (this.getServerPort() < 0) + { + this.setServerPort(this.settings.getIntProperty("server-port", 25565)); + } + + this.getLogAgent().logInfo("Generating keypair"); + this.setKeyPair(CryptManager.createNewKeyPair()); + this.getLogAgent().logInfo("Starting Minecraft server on " + (this.getServerHostname().length() == 0 ? "*" : this.getServerHostname()) + ":" + this.getServerPort()); + + try + { + this.networkThread = new DedicatedServerListenThread(this, var3, this.getServerPort()); + } + catch (IOException var16) + { + this.getLogAgent().logWarning("**** FAILED TO BIND TO PORT!"); + this.getLogAgent().logWarningFormatted("The exception was: {0}", new Object[] {var16.toString()}); + this.getLogAgent().logWarning("Perhaps a server is already running on that port?"); + return false; + } + + if (!this.isServerInOnlineMode()) + { + this.getLogAgent().logWarning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); + this.getLogAgent().logWarning("The server will make no attempt to authenticate usernames. Beware."); + this.getLogAgent().logWarning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose."); + this.getLogAgent().logWarning("To change this, set \"online-mode\" to \"true\" in the server.properties file."); + } + + this.setConfigurationManager(new DedicatedPlayerList(this)); + long var4 = System.nanoTime(); + + if (this.getFolderName() == null) + { + this.setFolderName(this.settings.getProperty("level-name", "world")); + } + + String var6 = this.settings.getProperty("level-seed", ""); + String var7 = this.settings.getProperty("level-type", "DEFAULT"); + String var8 = this.settings.getProperty("generator-settings", ""); + long var9 = (new Random()).nextLong(); + + if (var6.length() > 0) + { + try + { + long var11 = Long.parseLong(var6); + + if (var11 != 0L) + { + var9 = var11; + } + } + catch (NumberFormatException var15) + { + var9 = (long)var6.hashCode(); + } + } + + WorldType var17 = WorldType.parseWorldType(var7); + + if (var17 == null) + { + var17 = WorldType.DEFAULT; + } + + this.setBuildLimit(this.settings.getIntProperty("max-build-height", 256)); + this.setBuildLimit((this.getBuildLimit() + 8) / 16 * 16); + this.setBuildLimit(MathHelper.clamp_int(this.getBuildLimit(), 64, 256)); + this.settings.setProperty("max-build-height", Integer.valueOf(this.getBuildLimit())); + this.getLogAgent().logInfo("Preparing level \"" + this.getFolderName() + "\""); + this.loadAllWorlds(this.getFolderName(), this.getFolderName(), var9, var17, var8); + long var12 = System.nanoTime() - var4; + String var14 = String.format("%.3fs", new Object[] {Double.valueOf((double)var12 / 1.0E9D)}); + this.getLogAgent().logInfo("Done (" + var14 + ")! For help, type \"help\" or \"?\""); + + if (this.settings.getBooleanProperty("enable-query", false)) + { + this.getLogAgent().logInfo("Starting GS4 status listener"); + this.theRConThreadQuery = new RConThreadQuery(this); + this.theRConThreadQuery.startThread(); + } + + if (this.settings.getBooleanProperty("enable-rcon", false)) + { + this.getLogAgent().logInfo("Starting remote control listener"); + this.theRConThreadMain = new RConThreadMain(this); + this.theRConThreadMain.startThread(); + } + + return true; + } + + public boolean canStructuresSpawn() + { + return this.canSpawnStructures; + } + + public EnumGameType getGameType() + { + return this.gameType; + } + + /** + * Defaults to "1" (Easy) for the dedicated server, defaults to "2" (Normal) on the client. + */ + public int getDifficulty() + { + return this.settings.getIntProperty("difficulty", 1); + } + + /** + * Defaults to false. + */ + public boolean isHardcore() + { + return this.settings.getBooleanProperty("hardcore", false); + } + + /** + * Called on exit from the main run() loop. + */ + protected void finalTick(CrashReport par1CrashReport) + { + while (this.isServerRunning()) + { + this.executePendingCommands(); + + try + { + Thread.sleep(10L); + } + catch (InterruptedException var3) + { + var3.printStackTrace(); + } + } + } + + /** + * Adds the server info, including from theWorldServer, to the crash report. + */ + public CrashReport addServerInfoToCrashReport(CrashReport par1CrashReport) + { + par1CrashReport = super.addServerInfoToCrashReport(par1CrashReport); + par1CrashReport.getCategory().addCrashSectionCallable("Is Modded", new CallableType(this)); + par1CrashReport.getCategory().addCrashSectionCallable("Type", new CallableServerType(this)); + return par1CrashReport; + } + + /** + * Directly calls System.exit(0), instantly killing the program. + */ + protected void systemExitNow() + { + System.exit(0); + } + + public void updateTimeLightAndEntities() + { + super.updateTimeLightAndEntities(); + this.executePendingCommands(); + } + + public boolean getAllowNether() + { + return this.settings.getBooleanProperty("allow-nether", true); + } + + public boolean allowSpawnMonsters() + { + return this.settings.getBooleanProperty("spawn-monsters", true); + } + + public void addServerStatsToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper) + { + par1PlayerUsageSnooper.addData("whitelist_enabled", Boolean.valueOf(this.getDedicatedPlayerList().isWhiteListEnabled())); + par1PlayerUsageSnooper.addData("whitelist_count", Integer.valueOf(this.getDedicatedPlayerList().getWhiteListedPlayers().size())); + super.addServerStatsToSnooper(par1PlayerUsageSnooper); + } + + /** + * Returns whether snooping is enabled or not. + */ + public boolean isSnooperEnabled() + { + return this.settings.getBooleanProperty("snooper-enabled", true); + } + + public void addPendingCommand(String par1Str, ICommandSender par2ICommandSender) + { + this.pendingCommandList.add(new ServerCommand(par1Str, par2ICommandSender)); + } + + public void executePendingCommands() + { + while (!this.pendingCommandList.isEmpty()) + { + ServerCommand var1 = (ServerCommand)this.pendingCommandList.remove(0); + this.getCommandManager().executeCommand(var1.sender, var1.command); + } + } + + public boolean isDedicatedServer() + { + return true; + } + + public DedicatedPlayerList getDedicatedPlayerList() + { + return (DedicatedPlayerList)super.getConfigurationManager(); + } + + public NetworkListenThread getNetworkThread() + { + return this.networkThread; + } + + /** + * Gets an integer property. If it does not exist, set it to the specified value. + */ + public int getIntProperty(String par1Str, int par2) + { + return this.settings.getIntProperty(par1Str, par2); + } + + /** + * Gets a string property. If it does not exist, set it to the specified value. + */ + public String getStringProperty(String par1Str, String par2Str) + { + return this.settings.getProperty(par1Str, par2Str); + } + + /** + * Gets a boolean property. If it does not exist, set it to the specified value. + */ + public boolean getBooleanProperty(String par1Str, boolean par2) + { + return this.settings.getBooleanProperty(par1Str, par2); + } + + /** + * Saves an Object with the given property name. + */ + public void setProperty(String par1Str, Object par2Obj) + { + this.settings.setProperty(par1Str, par2Obj); + } + + /** + * Saves all of the server properties to the properties file. + */ + public void saveProperties() + { + this.settings.saveProperties(); + } + + /** + * Returns the filename where server properties are stored + */ + public String getSettingsFilename() + { + File var1 = this.settings.getPropertiesFile(); + return var1 != null ? var1.getAbsolutePath() : "No settings file"; + } + + public boolean getGuiEnabled() + { + return this.guiIsEnabled; + } + + /** + * On dedicated does nothing. On integrated, sets commandsAllowedForAll, gameType and allows external connections. + */ + public String shareToLAN(EnumGameType par1EnumGameType, boolean par2) + { + return ""; + } + + /** + * Return whether command blocks are enabled. + */ + public boolean isCommandBlockEnabled() + { + return this.settings.getBooleanProperty("enable-command-block", false); + } + + /** + * Return the spawn protection area's size. + */ + public int getSpawnProtectionSize() + { + return this.settings.getIntProperty("spawn-protection", super.getSpawnProtectionSize()); + } + + /** + * Returns true if a player does not have permission to edit the block at the given coordinates. + */ + public boolean isBlockProtected(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) + { + if (par1World.provider.dimensionId != 0) + { + return false; + } + else if (this.getDedicatedPlayerList().getOps().isEmpty()) + { + return false; + } + else if (this.getDedicatedPlayerList().isPlayerOpped(par5EntityPlayer.getCommandSenderName())) + { + return false; + } + else if (this.getSpawnProtectionSize() <= 0) + { + return false; + } + else + { + ChunkCoordinates var6 = par1World.getSpawnPoint(); + int var7 = MathHelper.abs_int(par2 - var6.posX); + int var8 = MathHelper.abs_int(par4 - var6.posZ); + int var9 = Math.max(var7, var8); + return var9 <= this.getSpawnProtectionSize(); + } + } + + public ILogAgent getLogAgent() + { + return this.field_98131_l; + } + + public int func_110455_j() + { + return this.settings.getIntProperty("op-permission-level", 4); + } + + public void func_143006_e(int par1) + { + super.func_143006_e(par1); + this.settings.setProperty("player-idle-timeout", Integer.valueOf(par1)); + this.saveProperties(); + } + + public ServerConfigurationManager getConfigurationManager() + { + return this.getDedicatedPlayerList(); + } +} diff --git a/src/main/java/net/minecraft/src/DedicatedServerCommandThread.java b/src/main/java/net/minecraft/src/DedicatedServerCommandThread.java new file mode 100644 index 0000000..10c147c --- /dev/null +++ b/src/main/java/net/minecraft/src/DedicatedServerCommandThread.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +class DedicatedServerCommandThread extends Thread +{ + final DedicatedServer server; + + DedicatedServerCommandThread(DedicatedServer par1DedicatedServer) + { + this.server = par1DedicatedServer; + } + + public void run() + { + BufferedReader var1 = new BufferedReader(new InputStreamReader(System.in)); + String var2; + + try + { + while (!this.server.isServerStopped() && this.server.isServerRunning() && (var2 = var1.readLine()) != null) + { + this.server.addPendingCommand(var2, this.server); + } + } + catch (IOException var4) + { + var4.printStackTrace(); + } + } +} diff --git a/src/main/java/net/minecraft/src/DedicatedServerListenThread.java b/src/main/java/net/minecraft/src/DedicatedServerListenThread.java new file mode 100644 index 0000000..07ce30c --- /dev/null +++ b/src/main/java/net/minecraft/src/DedicatedServerListenThread.java @@ -0,0 +1,49 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.net.InetAddress; +import net.minecraft.server.MinecraftServer; + +public class DedicatedServerListenThread extends NetworkListenThread +{ + /** Instance of ServerListenThread. */ + private final ServerListenThread theServerListenThread; + + public DedicatedServerListenThread(MinecraftServer par1MinecraftServer, InetAddress par2InetAddress, int par3) throws IOException + { + super(par1MinecraftServer); + this.theServerListenThread = new ServerListenThread(this, par2InetAddress, par3); + this.theServerListenThread.start(); + } + + public void stopListening() + { + super.stopListening(); + this.theServerListenThread.func_71768_b(); + this.theServerListenThread.interrupt(); + } + + /** + * processes packets and pending connections + */ + public void networkTick() + { + this.theServerListenThread.processPendingConnections(); + super.networkTick(); + } + + public DedicatedServer getDedicatedServer() + { + return (DedicatedServer)super.getServer(); + } + + public void func_71761_a(InetAddress par1InetAddress) + { + this.theServerListenThread.func_71769_a(par1InetAddress); + } + + public MinecraftServer getServer() + { + return this.getDedicatedServer(); + } +} diff --git a/src/main/java/net/minecraft/src/DedicatedServerSleepThread.java b/src/main/java/net/minecraft/src/DedicatedServerSleepThread.java new file mode 100644 index 0000000..faf75e9 --- /dev/null +++ b/src/main/java/net/minecraft/src/DedicatedServerSleepThread.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +class DedicatedServerSleepThread extends Thread +{ + /** Instance of the DecitatedServer. */ + final DedicatedServer theDecitatedServer; + + DedicatedServerSleepThread(DedicatedServer par1DedicatedServer) + { + this.theDecitatedServer = par1DedicatedServer; + this.setDaemon(true); + this.start(); + } + + public void run() + { + while (true) + { + try + { + while (true) + { + Thread.sleep(2147483647L); + } + } + catch (InterruptedException var2) + { + ; + } + } + } +} diff --git a/src/main/java/net/minecraft/src/DefaultResourcePack.java b/src/main/java/net/minecraft/src/DefaultResourcePack.java new file mode 100644 index 0000000..561245a --- /dev/null +++ b/src/main/java/net/minecraft/src/DefaultResourcePack.java @@ -0,0 +1,103 @@ +package net.minecraft.src; + +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Maps; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; +import java.util.Set; +import javax.imageio.ImageIO; + +public class DefaultResourcePack implements ResourcePack +{ + public static final Set defaultResourceDomains = ImmutableSet.of("minecraft"); + private final Map mapResourceFiles = Maps.newHashMap(); + private final File fileAssets; + + public DefaultResourcePack(File par1File) + { + this.fileAssets = par1File; + this.readAssetsDir(this.fileAssets); + } + + public InputStream getInputStream(ResourceLocation par1ResourceLocation) throws IOException + { + InputStream var2 = this.getResourceStream(par1ResourceLocation); + + if (var2 != null) + { + return var2; + } + else + { + File var3 = (File)this.mapResourceFiles.get(par1ResourceLocation.toString()); + + if (var3 != null) + { + return new FileInputStream(var3); + } + else + { + throw new FileNotFoundException(par1ResourceLocation.getResourcePath()); + } + } + } + + private InputStream getResourceStream(ResourceLocation par1ResourceLocation) + { + return DefaultResourcePack.class.getResourceAsStream("/assets/minecraft/" + par1ResourceLocation.getResourcePath()); + } + + public void addResourceFile(String par1Str, File par2File) + { + this.mapResourceFiles.put((new ResourceLocation(par1Str)).toString(), par2File); + } + + public boolean resourceExists(ResourceLocation par1ResourceLocation) + { + return this.getResourceStream(par1ResourceLocation) != null || this.mapResourceFiles.containsKey(par1ResourceLocation.toString()); + } + + public Set getResourceDomains() + { + return defaultResourceDomains; + } + + public void readAssetsDir(File par1File) + { + if (par1File.isDirectory()) + { + File[] var2 = par1File.listFiles(); + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + File var5 = var2[var4]; + this.readAssetsDir(var5); + } + } + else + { + this.addResourceFile(AbstractResourcePack.getRelativeName(this.fileAssets, par1File), par1File); + } + } + + public MetadataSection getPackMetadata(MetadataSerializer par1MetadataSerializer, String par2Str) throws IOException + { + return AbstractResourcePack.readMetadata(par1MetadataSerializer, DefaultResourcePack.class.getResourceAsStream("/" + (new ResourceLocation("pack.mcmeta")).getResourcePath()), par2Str); + } + + public BufferedImage getPackImage() throws IOException + { + return ImageIO.read(DefaultResourcePack.class.getResourceAsStream("/" + (new ResourceLocation("pack.png")).getResourcePath())); + } + + public String getPackName() + { + return "Default"; + } +} diff --git a/src/main/java/net/minecraft/src/DemoWorldManager.java b/src/main/java/net/minecraft/src/DemoWorldManager.java new file mode 100644 index 0000000..426db2b --- /dev/null +++ b/src/main/java/net/minecraft/src/DemoWorldManager.java @@ -0,0 +1,139 @@ +package net.minecraft.src; + +public class DemoWorldManager extends ItemInWorldManager +{ + private boolean field_73105_c; + private boolean demoTimeExpired; + private int field_73104_e; + private int field_73102_f; + + public DemoWorldManager(World par1World) + { + super(par1World); + } + + public void updateBlockRemoving() + { + super.updateBlockRemoving(); + ++this.field_73102_f; + long var1 = this.theWorld.getTotalWorldTime(); + long var3 = var1 / 24000L + 1L; + + if (!this.field_73105_c && this.field_73102_f > 20) + { + this.field_73105_c = true; + this.thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(5, 0)); + } + + this.demoTimeExpired = var1 > 120500L; + + if (this.demoTimeExpired) + { + ++this.field_73104_e; + } + + if (var1 % 24000L == 500L) + { + if (var3 <= 6L) + { + this.thisPlayerMP.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("demo.day." + var3)); + } + } + else if (var3 == 1L) + { + if (var1 == 100L) + { + this.thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(5, 101)); + } + else if (var1 == 175L) + { + this.thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(5, 102)); + } + else if (var1 == 250L) + { + this.thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(5, 103)); + } + } + else if (var3 == 5L && var1 % 24000L == 22000L) + { + this.thisPlayerMP.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("demo.day.warning")); + } + } + + /** + * Sends a message to the player reminding them that this is the demo version + */ + private void sendDemoReminder() + { + if (this.field_73104_e > 100) + { + this.thisPlayerMP.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("demo.reminder")); + this.field_73104_e = 0; + } + } + + /** + * if not creative, it calls destroyBlockInWorldPartially untill the block is broken first. par4 is the specific + * side. tryHarvestBlock can also be the result of this call + */ + public void onBlockClicked(int par1, int par2, int par3, int par4) + { + if (this.demoTimeExpired) + { + this.sendDemoReminder(); + } + else + { + super.onBlockClicked(par1, par2, par3, par4); + } + } + + public void uncheckedTryHarvestBlock(int par1, int par2, int par3) + { + if (!this.demoTimeExpired) + { + super.uncheckedTryHarvestBlock(par1, par2, par3); + } + } + + /** + * Attempts to harvest a block at the given coordinate + */ + public boolean tryHarvestBlock(int par1, int par2, int par3) + { + return this.demoTimeExpired ? false : super.tryHarvestBlock(par1, par2, par3); + } + + /** + * Attempts to right-click use an item by the given EntityPlayer in the given World + */ + public boolean tryUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack) + { + if (this.demoTimeExpired) + { + this.sendDemoReminder(); + return false; + } + else + { + return super.tryUseItem(par1EntityPlayer, par2World, par3ItemStack); + } + } + + /** + * Activate the clicked on block, otherwise use the held item. Args: player, world, itemStack, x, y, z, side, + * xOffset, yOffset, zOffset + */ + public boolean activateBlockOrUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (this.demoTimeExpired) + { + this.sendDemoReminder(); + return false; + } + else + { + return super.activateBlockOrUseItem(par1EntityPlayer, par2World, par3ItemStack, par4, par5, par6, par7, par8, par9, par10); + } + } +} diff --git a/src/main/java/net/minecraft/src/DemoWorldServer.java b/src/main/java/net/minecraft/src/DemoWorldServer.java new file mode 100644 index 0000000..ff3aabb --- /dev/null +++ b/src/main/java/net/minecraft/src/DemoWorldServer.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class DemoWorldServer extends WorldServer +{ + private static final long demoWorldSeed = (long)"North Carolina".hashCode(); + public static final WorldSettings demoWorldSettings = (new WorldSettings(demoWorldSeed, EnumGameType.SURVIVAL, true, false, WorldType.DEFAULT)).enableBonusChest(); + + public DemoWorldServer(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, Profiler par5Profiler, ILogAgent par6ILogAgent) + { + super(par1MinecraftServer, par2ISaveHandler, par3Str, par4, demoWorldSettings, par5Profiler, par6ILogAgent); + } +} diff --git a/src/main/java/net/minecraft/src/DerivedWorldInfo.java b/src/main/java/net/minecraft/src/DerivedWorldInfo.java new file mode 100644 index 0000000..d4c09f3 --- /dev/null +++ b/src/main/java/net/minecraft/src/DerivedWorldInfo.java @@ -0,0 +1,265 @@ +package net.minecraft.src; + +public class DerivedWorldInfo extends WorldInfo +{ + /** Instance of WorldInfo. */ + private final WorldInfo theWorldInfo; + + public DerivedWorldInfo(WorldInfo par1WorldInfo) + { + this.theWorldInfo = par1WorldInfo; + } + + /** + * Gets the NBTTagCompound for the worldInfo + */ + public NBTTagCompound getNBTTagCompound() + { + return this.theWorldInfo.getNBTTagCompound(); + } + + /** + * Creates a new NBTTagCompound for the world, with the given NBTTag as the "Player" + */ + public NBTTagCompound cloneNBTCompound(NBTTagCompound par1NBTTagCompound) + { + return this.theWorldInfo.cloneNBTCompound(par1NBTTagCompound); + } + + /** + * Returns the seed of current world. + */ + public long getSeed() + { + return this.theWorldInfo.getSeed(); + } + + /** + * Returns the x spawn position + */ + public int getSpawnX() + { + return this.theWorldInfo.getSpawnX(); + } + + /** + * Return the Y axis spawning point of the player. + */ + public int getSpawnY() + { + return this.theWorldInfo.getSpawnY(); + } + + /** + * Returns the z spawn position + */ + public int getSpawnZ() + { + return this.theWorldInfo.getSpawnZ(); + } + + public long getWorldTotalTime() + { + return this.theWorldInfo.getWorldTotalTime(); + } + + /** + * Get current world time + */ + public long getWorldTime() + { + return this.theWorldInfo.getWorldTime(); + } + + public long getSizeOnDisk() + { + return this.theWorldInfo.getSizeOnDisk(); + } + + /** + * Returns the player's NBTTagCompound to be loaded + */ + public NBTTagCompound getPlayerNBTTagCompound() + { + return this.theWorldInfo.getPlayerNBTTagCompound(); + } + + /** + * Returns vanilla MC dimension (-1,0,1). For custom dimension compatibility, always prefer + * WorldProvider.dimensionID accessed from World.provider.dimensionID + */ + public int getVanillaDimension() + { + return this.theWorldInfo.getVanillaDimension(); + } + + /** + * Get current world name + */ + public String getWorldName() + { + return this.theWorldInfo.getWorldName(); + } + + /** + * Returns the save version of this world + */ + public int getSaveVersion() + { + return this.theWorldInfo.getSaveVersion(); + } + + /** + * Return the last time the player was in this world. + */ + public long getLastTimePlayed() + { + return this.theWorldInfo.getLastTimePlayed(); + } + + /** + * Returns true if it is thundering, false otherwise. + */ + public boolean isThundering() + { + return this.theWorldInfo.isThundering(); + } + + /** + * Returns the number of ticks until next thunderbolt. + */ + public int getThunderTime() + { + return this.theWorldInfo.getThunderTime(); + } + + /** + * Returns true if it is raining, false otherwise. + */ + public boolean isRaining() + { + return this.theWorldInfo.isRaining(); + } + + /** + * Return the number of ticks until rain. + */ + public int getRainTime() + { + return this.theWorldInfo.getRainTime(); + } + + /** + * Gets the GameType. + */ + public EnumGameType getGameType() + { + return this.theWorldInfo.getGameType(); + } + + /** + * Set the x spawn position to the passed in value + */ + public void setSpawnX(int par1) {} + + /** + * Sets the y spawn position + */ + public void setSpawnY(int par1) {} + + /** + * Set the z spawn position to the passed in value + */ + public void setSpawnZ(int par1) {} + + public void incrementTotalWorldTime(long par1) {} + + /** + * Set current world time + */ + public void setWorldTime(long par1) {} + + /** + * Sets the spawn zone position. Args: x, y, z + */ + public void setSpawnPosition(int par1, int par2, int par3) {} + + public void setWorldName(String par1Str) {} + + /** + * Sets the save version of the world + */ + public void setSaveVersion(int par1) {} + + /** + * Sets whether it is thundering or not. + */ + public void setThundering(boolean par1) {} + + /** + * Defines the number of ticks until next thunderbolt. + */ + public void setThunderTime(int par1) {} + + /** + * Sets whether it is raining or not. + */ + public void setRaining(boolean par1) {} + + /** + * Sets the number of ticks until rain. + */ + public void setRainTime(int par1) {} + + /** + * Get whether the map features (e.g. strongholds) generation is enabled or disabled. + */ + public boolean isMapFeaturesEnabled() + { + return this.theWorldInfo.isMapFeaturesEnabled(); + } + + /** + * Returns true if hardcore mode is enabled, otherwise false + */ + public boolean isHardcoreModeEnabled() + { + return this.theWorldInfo.isHardcoreModeEnabled(); + } + + public WorldType getTerrainType() + { + return this.theWorldInfo.getTerrainType(); + } + + public void setTerrainType(WorldType par1WorldType) {} + + /** + * Returns true if commands are allowed on this World. + */ + public boolean areCommandsAllowed() + { + return this.theWorldInfo.areCommandsAllowed(); + } + + /** + * Returns true if the World is initialized. + */ + public boolean isInitialized() + { + return this.theWorldInfo.isInitialized(); + } + + /** + * Sets the initialization status of the World. + */ + public void setServerInitialized(boolean par1) {} + + /** + * Gets the GameRules class Instance. + */ + public GameRules getGameRulesInstance() + { + return this.theWorldInfo.getGameRulesInstance(); + } +} diff --git a/src/main/java/net/minecraft/src/DestroyBlockProgress.java b/src/main/java/net/minecraft/src/DestroyBlockProgress.java new file mode 100644 index 0000000..9bb1ed8 --- /dev/null +++ b/src/main/java/net/minecraft/src/DestroyBlockProgress.java @@ -0,0 +1,81 @@ +package net.minecraft.src; + +public class DestroyBlockProgress +{ + /** + * entity ID of the player associated with this partially destroyed Block. Used to identify the Blocks in the client + * Renderer, max 1 per player on a server + */ + private final int miningPlayerEntId; + private final int partialBlockX; + private final int partialBlockY; + private final int partialBlockZ; + + /** + * damage ranges from 1 to 10. -1 causes the client to delete the partial block renderer. + */ + private int partialBlockProgress; + + /** + * keeps track of how many ticks this PartiallyDestroyedBlock already exists + */ + private int createdAtCloudUpdateTick; + + public DestroyBlockProgress(int par1, int par2, int par3, int par4) + { + this.miningPlayerEntId = par1; + this.partialBlockX = par2; + this.partialBlockY = par3; + this.partialBlockZ = par4; + } + + public int getPartialBlockX() + { + return this.partialBlockX; + } + + public int getPartialBlockY() + { + return this.partialBlockY; + } + + public int getPartialBlockZ() + { + return this.partialBlockZ; + } + + /** + * inserts damage value into this partially destroyed Block. -1 causes client renderer to delete it, otherwise + * ranges from 1 to 10 + */ + public void setPartialBlockDamage(int par1) + { + if (par1 > 10) + { + par1 = 10; + } + + this.partialBlockProgress = par1; + } + + public int getPartialBlockDamage() + { + return this.partialBlockProgress; + } + + /** + * saves the current Cloud update tick into the PartiallyDestroyedBlock + */ + public void setCloudUpdateTick(int par1) + { + this.createdAtCloudUpdateTick = par1; + } + + /** + * retrieves the 'date' at which the PartiallyDestroyedBlock was created + */ + public int getCreationCloudUpdateTick() + { + return this.createdAtCloudUpdateTick; + } +} diff --git a/src/main/java/net/minecraft/src/Direction.java b/src/main/java/net/minecraft/src/Direction.java new file mode 100644 index 0000000..f027436 --- /dev/null +++ b/src/main/java/net/minecraft/src/Direction.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +public class Direction +{ + public static final int[] offsetX = new int[] {0, -1, 0, 1}; + public static final int[] offsetZ = new int[] {1, 0, -1, 0}; + public static final String[] directions = new String[] {"SOUTH", "WEST", "NORTH", "EAST"}; + + /** Maps a Direction value (2D) to a Facing value (3D). */ + public static final int[] directionToFacing = new int[] {3, 4, 2, 5}; + + /** Maps a Facing value (3D) to a Direction value (2D). */ + public static final int[] facingToDirection = new int[] { -1, -1, 2, 0, 1, 3}; + + /** Maps a direction to that opposite of it. */ + public static final int[] rotateOpposite = new int[] {2, 3, 0, 1}; + + /** Maps a direction to that to the right of it. */ + public static final int[] rotateRight = new int[] {1, 2, 3, 0}; + + /** Maps a direction to that to the left of it. */ + public static final int[] rotateLeft = new int[] {3, 0, 1, 2}; + public static final int[][] bedDirection = new int[][] {{1, 0, 3, 2, 5, 4}, {1, 0, 5, 4, 2, 3}, {1, 0, 2, 3, 4, 5}, {1, 0, 4, 5, 3, 2}}; + + /** + * Returns the movement direction from a velocity vector. + */ + public static int getMovementDirection(double par0, double par2) + { + return MathHelper.abs((float)par0) > MathHelper.abs((float)par2) ? (par0 > 0.0D ? 1 : 3) : (par2 > 0.0D ? 2 : 0); + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorArrow.java b/src/main/java/net/minecraft/src/DispenserBehaviorArrow.java new file mode 100644 index 0000000..baff7a2 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorArrow.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +final class DispenserBehaviorArrow extends BehaviorProjectileDispense +{ + /** + * Return the projectile entity spawned by this dispense behavior. + */ + protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition) + { + EntityArrow var3 = new EntityArrow(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ()); + var3.canBePickedUp = 1; + return var3; + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorBoat.java b/src/main/java/net/minecraft/src/DispenserBehaviorBoat.java new file mode 100644 index 0000000..9c076a6 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorBoat.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +final class DispenserBehaviorBoat extends BehaviorDefaultDispenseItem +{ + private final BehaviorDefaultDispenseItem defaultDispenserItemBehavior = new BehaviorDefaultDispenseItem(); + + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + World var4 = par1IBlockSource.getWorld(); + double var5 = par1IBlockSource.getX() + (double)((float)var3.getFrontOffsetX() * 1.125F); + double var7 = par1IBlockSource.getY() + (double)((float)var3.getFrontOffsetY() * 1.125F); + double var9 = par1IBlockSource.getZ() + (double)((float)var3.getFrontOffsetZ() * 1.125F); + int var11 = par1IBlockSource.getXInt() + var3.getFrontOffsetX(); + int var12 = par1IBlockSource.getYInt() + var3.getFrontOffsetY(); + int var13 = par1IBlockSource.getZInt() + var3.getFrontOffsetZ(); + Material var14 = var4.getBlockMaterial(var11, var12, var13); + double var15; + + if (Material.water.equals(var14)) + { + var15 = 1.0D; + } + else + { + if (!Material.air.equals(var14) || !Material.water.equals(var4.getBlockMaterial(var11, var12 - 1, var13))) + { + return this.defaultDispenserItemBehavior.dispense(par1IBlockSource, par2ItemStack); + } + + var15 = 0.0D; + } + + EntityBoat var17 = new EntityBoat(var4, var5, var7 + var15, var9); + var4.spawnEntityInWorld(var17); + par2ItemStack.splitStack(1); + return par2ItemStack; + } + + /** + * Play the dispense sound from the specified block. + */ + protected void playDispenseSound(IBlockSource par1IBlockSource) + { + par1IBlockSource.getWorld().playAuxSFX(1000, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0); + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorDye.java b/src/main/java/net/minecraft/src/DispenserBehaviorDye.java new file mode 100644 index 0000000..8a31fc2 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorDye.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +final class DispenserBehaviorDye extends BehaviorDefaultDispenseItem +{ + private boolean field_96461_b = true; + + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + if (par2ItemStack.getItemDamage() == 15) + { + EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + World var4 = par1IBlockSource.getWorld(); + int var5 = par1IBlockSource.getXInt() + var3.getFrontOffsetX(); + int var6 = par1IBlockSource.getYInt() + var3.getFrontOffsetY(); + int var7 = par1IBlockSource.getZInt() + var3.getFrontOffsetZ(); + + if (ItemDye.func_96604_a(par2ItemStack, var4, var5, var6, var7)) + { + if (!var4.isRemote) + { + var4.playAuxSFX(2005, var5, var6, var7, 0); + } + } + else + { + this.field_96461_b = false; + } + + return par2ItemStack; + } + else + { + return super.dispenseStack(par1IBlockSource, par2ItemStack); + } + } + + /** + * Play the dispense sound from the specified block. + */ + protected void playDispenseSound(IBlockSource par1IBlockSource) + { + if (this.field_96461_b) + { + par1IBlockSource.getWorld().playAuxSFX(1000, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0); + } + else + { + par1IBlockSource.getWorld().playAuxSFX(1001, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0); + } + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorEgg.java b/src/main/java/net/minecraft/src/DispenserBehaviorEgg.java new file mode 100644 index 0000000..efffc50 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorEgg.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +final class DispenserBehaviorEgg extends BehaviorProjectileDispense +{ + /** + * Return the projectile entity spawned by this dispense behavior. + */ + protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition) + { + return new EntityEgg(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ()); + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorEmptyBucket.java b/src/main/java/net/minecraft/src/DispenserBehaviorEmptyBucket.java new file mode 100644 index 0000000..ecca50f --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorEmptyBucket.java @@ -0,0 +1,49 @@ +package net.minecraft.src; + +final class DispenserBehaviorEmptyBucket extends BehaviorDefaultDispenseItem +{ + private final BehaviorDefaultDispenseItem defaultDispenserItemBehavior = new BehaviorDefaultDispenseItem(); + + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + World var4 = par1IBlockSource.getWorld(); + int var5 = par1IBlockSource.getXInt() + var3.getFrontOffsetX(); + int var6 = par1IBlockSource.getYInt() + var3.getFrontOffsetY(); + int var7 = par1IBlockSource.getZInt() + var3.getFrontOffsetZ(); + Material var8 = var4.getBlockMaterial(var5, var6, var7); + int var9 = var4.getBlockMetadata(var5, var6, var7); + Item var10; + + if (Material.water.equals(var8) && var9 == 0) + { + var10 = Item.bucketWater; + } + else + { + if (!Material.lava.equals(var8) || var9 != 0) + { + return super.dispenseStack(par1IBlockSource, par2ItemStack); + } + + var10 = Item.bucketLava; + } + + var4.setBlockToAir(var5, var6, var7); + + if (--par2ItemStack.stackSize == 0) + { + par2ItemStack.itemID = var10.itemID; + par2ItemStack.stackSize = 1; + } + else if (((TileEntityDispenser)par1IBlockSource.getBlockTileEntity()).addItem(new ItemStack(var10)) < 0) + { + this.defaultDispenserItemBehavior.dispense(par1IBlockSource, new ItemStack(var10)); + } + + return par2ItemStack; + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorExperience.java b/src/main/java/net/minecraft/src/DispenserBehaviorExperience.java new file mode 100644 index 0000000..7637d88 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorExperience.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +final class DispenserBehaviorExperience extends BehaviorProjectileDispense +{ + /** + * Return the projectile entity spawned by this dispense behavior. + */ + protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition) + { + return new EntityExpBottle(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ()); + } + + protected float func_82498_a() + { + return super.func_82498_a() * 0.5F; + } + + protected float func_82500_b() + { + return super.func_82500_b() * 1.25F; + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorFilledBucket.java b/src/main/java/net/minecraft/src/DispenserBehaviorFilledBucket.java new file mode 100644 index 0000000..05eee27 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorFilledBucket.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +final class DispenserBehaviorFilledBucket extends BehaviorDefaultDispenseItem +{ + private final BehaviorDefaultDispenseItem defaultDispenserItemBehavior = new BehaviorDefaultDispenseItem(); + + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + ItemBucket var3 = (ItemBucket)par2ItemStack.getItem(); + int var4 = par1IBlockSource.getXInt(); + int var5 = par1IBlockSource.getYInt(); + int var6 = par1IBlockSource.getZInt(); + EnumFacing var7 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + + if (var3.tryPlaceContainedLiquid(par1IBlockSource.getWorld(), var4 + var7.getFrontOffsetX(), var5 + var7.getFrontOffsetY(), var6 + var7.getFrontOffsetZ())) + { + par2ItemStack.itemID = Item.bucketEmpty.itemID; + par2ItemStack.stackSize = 1; + return par2ItemStack; + } + else + { + return this.defaultDispenserItemBehavior.dispense(par1IBlockSource, par2ItemStack); + } + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorFire.java b/src/main/java/net/minecraft/src/DispenserBehaviorFire.java new file mode 100644 index 0000000..75748a1 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorFire.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +final class DispenserBehaviorFire extends BehaviorDefaultDispenseItem +{ + private boolean field_96466_b = true; + + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + World var4 = par1IBlockSource.getWorld(); + int var5 = par1IBlockSource.getXInt() + var3.getFrontOffsetX(); + int var6 = par1IBlockSource.getYInt() + var3.getFrontOffsetY(); + int var7 = par1IBlockSource.getZInt() + var3.getFrontOffsetZ(); + + if (var4.isAirBlock(var5, var6, var7)) + { + var4.setBlock(var5, var6, var7, Block.fire.blockID); + + if (par2ItemStack.attemptDamageItem(1, var4.rand)) + { + par2ItemStack.stackSize = 0; + } + } + else if (var4.getBlockId(var5, var6, var7) == Block.tnt.blockID) + { + Block.tnt.onBlockDestroyedByPlayer(var4, var5, var6, var7, 1); + var4.setBlockToAir(var5, var6, var7); + } + else + { + this.field_96466_b = false; + } + + return par2ItemStack; + } + + /** + * Play the dispense sound from the specified block. + */ + protected void playDispenseSound(IBlockSource par1IBlockSource) + { + if (this.field_96466_b) + { + par1IBlockSource.getWorld().playAuxSFX(1000, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0); + } + else + { + par1IBlockSource.getWorld().playAuxSFX(1001, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0); + } + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorFireball.java b/src/main/java/net/minecraft/src/DispenserBehaviorFireball.java new file mode 100644 index 0000000..9b577b1 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorFireball.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +import java.util.Random; + +final class DispenserBehaviorFireball extends BehaviorDefaultDispenseItem +{ + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + IPosition var4 = BlockDispenser.getIPositionFromBlockSource(par1IBlockSource); + double var5 = var4.getX() + (double)((float)var3.getFrontOffsetX() * 0.3F); + double var7 = var4.getY() + (double)((float)var3.getFrontOffsetX() * 0.3F); + double var9 = var4.getZ() + (double)((float)var3.getFrontOffsetZ() * 0.3F); + World var11 = par1IBlockSource.getWorld(); + Random var12 = var11.rand; + double var13 = var12.nextGaussian() * 0.05D + (double)var3.getFrontOffsetX(); + double var15 = var12.nextGaussian() * 0.05D + (double)var3.getFrontOffsetY(); + double var17 = var12.nextGaussian() * 0.05D + (double)var3.getFrontOffsetZ(); + var11.spawnEntityInWorld(new EntitySmallFireball(var11, var5, var7, var9, var13, var15, var17)); + par2ItemStack.splitStack(1); + return par2ItemStack; + } + + /** + * Play the dispense sound from the specified block. + */ + protected void playDispenseSound(IBlockSource par1IBlockSource) + { + par1IBlockSource.getWorld().playAuxSFX(1009, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0); + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorFireworks.java b/src/main/java/net/minecraft/src/DispenserBehaviorFireworks.java new file mode 100644 index 0000000..3f395b2 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorFireworks.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +final class DispenserBehaviorFireworks extends BehaviorDefaultDispenseItem +{ + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + double var4 = par1IBlockSource.getX() + (double)var3.getFrontOffsetX(); + double var6 = (double)((float)par1IBlockSource.getYInt() + 0.2F); + double var8 = par1IBlockSource.getZ() + (double)var3.getFrontOffsetZ(); + EntityFireworkRocket var10 = new EntityFireworkRocket(par1IBlockSource.getWorld(), var4, var6, var8, par2ItemStack); + par1IBlockSource.getWorld().spawnEntityInWorld(var10); + par2ItemStack.splitStack(1); + return par2ItemStack; + } + + /** + * Play the dispense sound from the specified block. + */ + protected void playDispenseSound(IBlockSource par1IBlockSource) + { + par1IBlockSource.getWorld().playAuxSFX(1002, par1IBlockSource.getXInt(), par1IBlockSource.getYInt(), par1IBlockSource.getZInt(), 0); + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorMobEgg.java b/src/main/java/net/minecraft/src/DispenserBehaviorMobEgg.java new file mode 100644 index 0000000..b907330 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorMobEgg.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +final class DispenserBehaviorMobEgg extends BehaviorDefaultDispenseItem +{ + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + double var4 = par1IBlockSource.getX() + (double)var3.getFrontOffsetX(); + double var6 = (double)((float)par1IBlockSource.getYInt() + 0.2F); + double var8 = par1IBlockSource.getZ() + (double)var3.getFrontOffsetZ(); + Entity var10 = ItemMonsterPlacer.spawnCreature(par1IBlockSource.getWorld(), par2ItemStack.getItemDamage(), var4, var6, var8); + + if (var10 instanceof EntityLivingBase && par2ItemStack.hasDisplayName()) + { + ((EntityLiving)var10).setCustomNameTag(par2ItemStack.getDisplayName()); + } + + par2ItemStack.splitStack(1); + return par2ItemStack; + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorPotion.java b/src/main/java/net/minecraft/src/DispenserBehaviorPotion.java new file mode 100644 index 0000000..5778fad --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorPotion.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +final class DispenserBehaviorPotion implements IBehaviorDispenseItem +{ + private final BehaviorDefaultDispenseItem defaultDispenserItemBehavior = new BehaviorDefaultDispenseItem(); + + /** + * Dispenses the specified ItemStack from a dispenser. + */ + public ItemStack dispense(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + return ItemPotion.isSplash(par2ItemStack.getItemDamage()) ? (new DispenserBehaviorPotionProjectile(this, par2ItemStack)).dispense(par1IBlockSource, par2ItemStack) : this.defaultDispenserItemBehavior.dispense(par1IBlockSource, par2ItemStack); + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorPotionProjectile.java b/src/main/java/net/minecraft/src/DispenserBehaviorPotionProjectile.java new file mode 100644 index 0000000..df7d848 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorPotionProjectile.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +class DispenserBehaviorPotionProjectile extends BehaviorProjectileDispense +{ + final ItemStack potionItemStack; + + final DispenserBehaviorPotion dispenserPotionBehavior; + + DispenserBehaviorPotionProjectile(DispenserBehaviorPotion par1DispenserBehaviorPotion, ItemStack par2ItemStack) + { + this.dispenserPotionBehavior = par1DispenserBehaviorPotion; + this.potionItemStack = par2ItemStack; + } + + /** + * Return the projectile entity spawned by this dispense behavior. + */ + protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition) + { + return new EntityPotion(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ(), this.potionItemStack.copy()); + } + + protected float func_82498_a() + { + return super.func_82498_a() * 0.5F; + } + + protected float func_82500_b() + { + return super.func_82500_b() * 1.25F; + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorSnowball.java b/src/main/java/net/minecraft/src/DispenserBehaviorSnowball.java new file mode 100644 index 0000000..9978cf3 --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorSnowball.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +final class DispenserBehaviorSnowball extends BehaviorProjectileDispense +{ + /** + * Return the projectile entity spawned by this dispense behavior. + */ + protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition) + { + return new EntitySnowball(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ()); + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviorTNT.java b/src/main/java/net/minecraft/src/DispenserBehaviorTNT.java new file mode 100644 index 0000000..e27225a --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviorTNT.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +final class DispenserBehaviorTNT extends BehaviorDefaultDispenseItem +{ + /** + * Dispense the specified stack, play the dispense sound and spawn particles. + */ + protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + { + EnumFacing var3 = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); + World var4 = par1IBlockSource.getWorld(); + int var5 = par1IBlockSource.getXInt() + var3.getFrontOffsetX(); + int var6 = par1IBlockSource.getYInt() + var3.getFrontOffsetY(); + int var7 = par1IBlockSource.getZInt() + var3.getFrontOffsetZ(); + EntityTNTPrimed var8 = new EntityTNTPrimed(var4, (double)((float)var5 + 0.5F), (double)((float)var6 + 0.5F), (double)((float)var7 + 0.5F), (EntityLivingBase)null); + var4.spawnEntityInWorld(var8); + --par2ItemStack.stackSize; + return par2ItemStack; + } +} diff --git a/src/main/java/net/minecraft/src/DispenserBehaviors.java b/src/main/java/net/minecraft/src/DispenserBehaviors.java new file mode 100644 index 0000000..2d5659f --- /dev/null +++ b/src/main/java/net/minecraft/src/DispenserBehaviors.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +public class DispenserBehaviors +{ + public static void registerDispenserBehaviours() + { + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.arrow, new DispenserBehaviorArrow()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.egg, new DispenserBehaviorEgg()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.snowball, new DispenserBehaviorSnowball()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.expBottle, new DispenserBehaviorExperience()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.potion, new DispenserBehaviorPotion()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.monsterPlacer, new DispenserBehaviorMobEgg()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.firework, new DispenserBehaviorFireworks()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.fireballCharge, new DispenserBehaviorFireball()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.boat, new DispenserBehaviorBoat()); + DispenserBehaviorFilledBucket var0 = new DispenserBehaviorFilledBucket(); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.bucketLava, var0); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.bucketWater, var0); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.bucketEmpty, new DispenserBehaviorEmptyBucket()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.flintAndSteel, new DispenserBehaviorFire()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.dyePowder, new DispenserBehaviorDye()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Item.itemsList[Block.tnt.blockID], new DispenserBehaviorTNT()); + } +} diff --git a/src/main/java/net/minecraft/src/DynamicTexture.java b/src/main/java/net/minecraft/src/DynamicTexture.java new file mode 100644 index 0000000..c7cbfda --- /dev/null +++ b/src/main/java/net/minecraft/src/DynamicTexture.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; +import java.io.IOException; + +public class DynamicTexture extends AbstractTexture +{ + private final int[] dynamicTextureData; + + /** width of this icon in pixels */ + private final int width; + + /** height of this icon in pixels */ + private final int height; + + public DynamicTexture(BufferedImage par1BufferedImage) + { + this(par1BufferedImage.getWidth(), par1BufferedImage.getHeight()); + par1BufferedImage.getRGB(0, 0, par1BufferedImage.getWidth(), par1BufferedImage.getHeight(), this.dynamicTextureData, 0, par1BufferedImage.getWidth()); + this.updateDynamicTexture(); + } + + public DynamicTexture(int par1, int par2) + { + this.width = par1; + this.height = par2; + this.dynamicTextureData = new int[par1 * par2]; + TextureUtil.allocateTexture(this.getGlTextureId(), par1, par2); + } + + public void loadTexture(ResourceManager par1ResourceManager) throws IOException {} + + public void updateDynamicTexture() + { + TextureUtil.uploadTexture(this.getGlTextureId(), this.dynamicTextureData, this.width, this.height); + } + + public int[] getTextureData() + { + return this.dynamicTextureData; + } +} diff --git a/src/main/java/net/minecraft/src/EffectRenderer.java b/src/main/java/net/minecraft/src/EffectRenderer.java new file mode 100644 index 0000000..91292ab --- /dev/null +++ b/src/main/java/net/minecraft/src/EffectRenderer.java @@ -0,0 +1,230 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import org.lwjgl.opengl.GL11; + +public class EffectRenderer +{ + private static final ResourceLocation particleTextures = new ResourceLocation("textures/particle/particles.png"); + + /** Reference to the World object. */ + protected World worldObj; + private List[] fxLayers = new List[4]; + private TextureManager renderer; + + /** RNG. */ + private Random rand = new Random(); + + public EffectRenderer(World par1World, TextureManager par2TextureManager) + { + if (par1World != null) + { + this.worldObj = par1World; + } + + this.renderer = par2TextureManager; + + for (int var3 = 0; var3 < 4; ++var3) + { + this.fxLayers[var3] = new ArrayList(); + } + } + + public void addEffect(EntityFX par1EntityFX) + { + int var2 = par1EntityFX.getFXLayer(); + + if (this.fxLayers[var2].size() >= 4000) + { + this.fxLayers[var2].remove(0); + } + + this.fxLayers[var2].add(par1EntityFX); + } + + public void updateEffects() + { + for (int var1 = 0; var1 < 4; ++var1) + { + for (int var2 = 0; var2 < this.fxLayers[var1].size(); ++var2) + { + EntityFX var3 = (EntityFX)this.fxLayers[var1].get(var2); + var3.onUpdate(); + + if (var3.isDead) + { + this.fxLayers[var1].remove(var2--); + } + } + } + } + + /** + * Renders all current particles. Args player, partialTickTime + */ + public void renderParticles(Entity par1Entity, float par2) + { + float var3 = ActiveRenderInfo.rotationX; + float var4 = ActiveRenderInfo.rotationZ; + float var5 = ActiveRenderInfo.rotationYZ; + float var6 = ActiveRenderInfo.rotationXY; + float var7 = ActiveRenderInfo.rotationXZ; + EntityFX.interpPosX = par1Entity.lastTickPosX + (par1Entity.posX - par1Entity.lastTickPosX) * (double)par2; + EntityFX.interpPosY = par1Entity.lastTickPosY + (par1Entity.posY - par1Entity.lastTickPosY) * (double)par2; + EntityFX.interpPosZ = par1Entity.lastTickPosZ + (par1Entity.posZ - par1Entity.lastTickPosZ) * (double)par2; + + for (int var8 = 0; var8 < 3; ++var8) + { + if (!this.fxLayers[var8].isEmpty()) + { + switch (var8) + { + case 0: + default: + this.renderer.bindTexture(particleTextures); + break; + + case 1: + this.renderer.bindTexture(TextureMap.locationBlocksTexture); + break; + + case 2: + this.renderer.bindTexture(TextureMap.locationItemsTexture); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDepthMask(false); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); + Tessellator var9 = Tessellator.instance; + var9.startDrawingQuads(); + + for (int var10 = 0; var10 < this.fxLayers[var8].size(); ++var10) + { + EntityFX var11 = (EntityFX)this.fxLayers[var8].get(var10); + var9.setBrightness(var11.getBrightnessForRender(par2)); + var11.renderParticle(var9, par2, var3, var7, var4, var5, var6); + } + + var9.draw(); + GL11.glDisable(GL11.GL_BLEND); + GL11.glDepthMask(true); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + } + } + } + + public void renderLitParticles(Entity par1Entity, float par2) + { + float var3 = 0.017453292F; + float var4 = MathHelper.cos(par1Entity.rotationYaw * 0.017453292F); + float var5 = MathHelper.sin(par1Entity.rotationYaw * 0.017453292F); + float var6 = -var5 * MathHelper.sin(par1Entity.rotationPitch * 0.017453292F); + float var7 = var4 * MathHelper.sin(par1Entity.rotationPitch * 0.017453292F); + float var8 = MathHelper.cos(par1Entity.rotationPitch * 0.017453292F); + byte var9 = 3; + List var10 = this.fxLayers[var9]; + + if (!var10.isEmpty()) + { + Tessellator var11 = Tessellator.instance; + + for (int var12 = 0; var12 < var10.size(); ++var12) + { + EntityFX var13 = (EntityFX)var10.get(var12); + var11.setBrightness(var13.getBrightnessForRender(par2)); + var13.renderParticle(var11, par2, var4, var8, var5, var6, var7); + } + } + } + + public void clearEffects(World par1World) + { + this.worldObj = par1World; + + for (int var2 = 0; var2 < 4; ++var2) + { + this.fxLayers[var2].clear(); + } + } + + public void addBlockDestroyEffects(int par1, int par2, int par3, int par4, int par5) + { + if (par4 != 0) + { + Block var6 = Block.blocksList[par4]; + byte var7 = 4; + + for (int var8 = 0; var8 < var7; ++var8) + { + for (int var9 = 0; var9 < var7; ++var9) + { + for (int var10 = 0; var10 < var7; ++var10) + { + double var11 = (double)par1 + ((double)var8 + 0.5D) / (double)var7; + double var13 = (double)par2 + ((double)var9 + 0.5D) / (double)var7; + double var15 = (double)par3 + ((double)var10 + 0.5D) / (double)var7; + this.addEffect((new EntityDiggingFX(this.worldObj, var11, var13, var15, var11 - (double)par1 - 0.5D, var13 - (double)par2 - 0.5D, var15 - (double)par3 - 0.5D, var6, par5)).applyColourMultiplier(par1, par2, par3)); + } + } + } + } + } + + /** + * Adds block hit particles for the specified block. Args: x, y, z, sideHit + */ + public void addBlockHitEffects(int par1, int par2, int par3, int par4) + { + int var5 = this.worldObj.getBlockId(par1, par2, par3); + + if (var5 != 0) + { + Block var6 = Block.blocksList[var5]; + float var7 = 0.1F; + double var8 = (double)par1 + this.rand.nextDouble() * (var6.getBlockBoundsMaxX() - var6.getBlockBoundsMinX() - (double)(var7 * 2.0F)) + (double)var7 + var6.getBlockBoundsMinX(); + double var10 = (double)par2 + this.rand.nextDouble() * (var6.getBlockBoundsMaxY() - var6.getBlockBoundsMinY() - (double)(var7 * 2.0F)) + (double)var7 + var6.getBlockBoundsMinY(); + double var12 = (double)par3 + this.rand.nextDouble() * (var6.getBlockBoundsMaxZ() - var6.getBlockBoundsMinZ() - (double)(var7 * 2.0F)) + (double)var7 + var6.getBlockBoundsMinZ(); + + if (par4 == 0) + { + var10 = (double)par2 + var6.getBlockBoundsMinY() - (double)var7; + } + + if (par4 == 1) + { + var10 = (double)par2 + var6.getBlockBoundsMaxY() + (double)var7; + } + + if (par4 == 2) + { + var12 = (double)par3 + var6.getBlockBoundsMinZ() - (double)var7; + } + + if (par4 == 3) + { + var12 = (double)par3 + var6.getBlockBoundsMaxZ() + (double)var7; + } + + if (par4 == 4) + { + var8 = (double)par1 + var6.getBlockBoundsMinX() - (double)var7; + } + + if (par4 == 5) + { + var8 = (double)par1 + var6.getBlockBoundsMaxX() + (double)var7; + } + + this.addEffect((new EntityDiggingFX(this.worldObj, var8, var10, var12, 0.0D, 0.0D, 0.0D, var6, this.worldObj.getBlockMetadata(par1, par2, par3))).applyColourMultiplier(par1, par2, par3).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); + } + } + + public String getStatistics() + { + return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size()); + } +} diff --git a/src/main/java/net/minecraft/src/Empty3.java b/src/main/java/net/minecraft/src/Empty3.java new file mode 100644 index 0000000..6b06a34 --- /dev/null +++ b/src/main/java/net/minecraft/src/Empty3.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +class Empty3 +{ +} diff --git a/src/main/java/net/minecraft/src/EmptyChunk.java b/src/main/java/net/minecraft/src/EmptyChunk.java new file mode 100644 index 0000000..8d8489b --- /dev/null +++ b/src/main/java/net/minecraft/src/EmptyChunk.java @@ -0,0 +1,196 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class EmptyChunk extends Chunk +{ + public EmptyChunk(World par1World, int par2, int par3) + { + super(par1World, par2, par3); + } + + /** + * Checks whether the chunk is at the X/Z location specified + */ + public boolean isAtLocation(int par1, int par2) + { + return par1 == this.xPosition && par2 == this.zPosition; + } + + /** + * Returns the value in the height map at this x, z coordinate in the chunk + */ + public int getHeightValue(int par1, int par2) + { + return 0; + } + + /** + * Generates the height map for a chunk from scratch + */ + public void generateHeightMap() {} + + /** + * Generates the initial skylight map for the chunk upon generation or load. + */ + public void generateSkylightMap() {} + + /** + * Return the ID of a block in the chunk. + */ + public int getBlockID(int par1, int par2, int par3) + { + return 0; + } + + public int getBlockLightOpacity(int par1, int par2, int par3) + { + return 255; + } + + /** + * Sets a blockID of a position within a chunk with metadata. Args: x, y, z, blockID, metadata + */ + public boolean setBlockIDWithMetadata(int par1, int par2, int par3, int par4, int par5) + { + return true; + } + + /** + * Return the metadata corresponding to the given coordinates inside a chunk. + */ + public int getBlockMetadata(int par1, int par2, int par3) + { + return 0; + } + + /** + * Set the metadata of a block in the chunk + */ + public boolean setBlockMetadata(int par1, int par2, int par3, int par4) + { + return false; + } + + /** + * Gets the amount of light saved in this block (doesn't adjust for daylight) + */ + public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4) + { + return 0; + } + + /** + * Sets the light value at the coordinate. If enumskyblock is set to sky it sets it in the skylightmap and if its a + * block then into the blocklightmap. Args enumSkyBlock, x, y, z, lightValue + */ + public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5) {} + + /** + * Gets the amount of light on a block taking into account sunlight + */ + public int getBlockLightValue(int par1, int par2, int par3, int par4) + { + return 0; + } + + /** + * Adds an entity to the chunk. Args: entity + */ + public void addEntity(Entity par1Entity) {} + + /** + * removes entity using its y chunk coordinate as its index + */ + public void removeEntity(Entity par1Entity) {} + + /** + * Removes entity at the specified index from the entity array. + */ + public void removeEntityAtIndex(Entity par1Entity, int par2) {} + + /** + * Returns whether is not a block above this one blocking sight to the sky (done via checking against the heightmap) + */ + public boolean canBlockSeeTheSky(int par1, int par2, int par3) + { + return false; + } + + /** + * Gets the TileEntity for a given block in this chunk + */ + public TileEntity getChunkBlockTileEntity(int par1, int par2, int par3) + { + return null; + } + + /** + * Adds a TileEntity to a chunk + */ + public void addTileEntity(TileEntity par1TileEntity) {} + + /** + * Sets the TileEntity for a given block in this chunk + */ + public void setChunkBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity) {} + + /** + * Removes the TileEntity for a given block in this chunk + */ + public void removeChunkBlockTileEntity(int par1, int par2, int par3) {} + + /** + * Called when this Chunk is loaded by the ChunkProvider + */ + public void onChunkLoad() {} + + /** + * Called when this Chunk is unloaded by the ChunkProvider + */ + public void onChunkUnload() {} + + /** + * Sets the isModified flag for this Chunk + */ + public void setChunkModified() {} + + /** + * Fills the given list of all entities that intersect within the given bounding box that aren't the passed entity + * Args: entity, aabb, listToFill + */ + public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) {} + + /** + * Gets all entities that can be assigned to the specified class. Args: entityClass, aabb, listToFill + */ + public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector) {} + + /** + * Returns true if this Chunk needs to be saved + */ + public boolean needsSaving(boolean par1) + { + return false; + } + + public Random getRandomWithSeed(long par1) + { + return new Random(this.worldObj.getSeed() + (long)(this.xPosition * this.xPosition * 4987142) + (long)(this.xPosition * 5947611) + (long)(this.zPosition * this.zPosition) * 4392871L + (long)(this.zPosition * 389711) ^ par1); + } + + public boolean isEmpty() + { + return true; + } + + /** + * Returns whether the ExtendedBlockStorages containing levels (in blocks) from arg 1 to arg 2 are fully empty + * (true) or not (false). + */ + public boolean getAreLevelsEmpty(int par1, int par2) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Enchantment.java b/src/main/java/net/minecraft/src/Enchantment.java new file mode 100644 index 0000000..8fa560b --- /dev/null +++ b/src/main/java/net/minecraft/src/Enchantment.java @@ -0,0 +1,224 @@ +package net.minecraft.src; + +import java.util.ArrayList; + +public abstract class Enchantment +{ + public static final Enchantment[] enchantmentsList = new Enchantment[256]; + + /** The list of enchantments applicable by the anvil from a book */ + public static final Enchantment[] enchantmentsBookList; + + /** Converts environmental damage to armour damage */ + public static final Enchantment protection = new EnchantmentProtection(0, 10, 0); + + /** Protection against fire */ + public static final Enchantment fireProtection = new EnchantmentProtection(1, 5, 1); + + /** Less fall damage */ + public static final Enchantment featherFalling = new EnchantmentProtection(2, 5, 2); + + /** Protection against explosions */ + public static final Enchantment blastProtection = new EnchantmentProtection(3, 2, 3); + + /** Protection against projectile entities (e.g. arrows) */ + public static final Enchantment projectileProtection = new EnchantmentProtection(4, 5, 4); + + /** + * Decreases the rate of air loss underwater; increases time between damage while suffocating + */ + public static final Enchantment respiration = new EnchantmentOxygen(5, 2); + + /** Increases underwater mining rate */ + public static final Enchantment aquaAffinity = new EnchantmentWaterWorker(6, 2); + public static final Enchantment thorns = new EnchantmentThorns(7, 1); + + /** Extra damage to mobs */ + public static final Enchantment sharpness = new EnchantmentDamage(16, 10, 0); + + /** Extra damage to zombies, zombie pigmen and skeletons */ + public static final Enchantment smite = new EnchantmentDamage(17, 5, 1); + + /** Extra damage to spiders, cave spiders and silverfish */ + public static final Enchantment baneOfArthropods = new EnchantmentDamage(18, 5, 2); + + /** Knocks mob and players backwards upon hit */ + public static final Enchantment knockback = new EnchantmentKnockback(19, 5); + + /** Lights mobs on fire */ + public static final Enchantment fireAspect = new EnchantmentFireAspect(20, 2); + + /** Mobs have a chance to drop more loot */ + public static final Enchantment looting = new EnchantmentLootBonus(21, 2, EnumEnchantmentType.weapon); + + /** Faster resource gathering while in use */ + public static final Enchantment efficiency = new EnchantmentDigging(32, 10); + + /** + * Blocks mined will drop themselves, even if it should drop something else (e.g. stone will drop stone, not + * cobblestone) + */ + public static final Enchantment silkTouch = new EnchantmentUntouching(33, 1); + + /** + * Sometimes, the tool's durability will not be spent when the tool is used + */ + public static final Enchantment unbreaking = new EnchantmentDurability(34, 5); + + /** Can multiply the drop rate of items from blocks */ + public static final Enchantment fortune = new EnchantmentLootBonus(35, 2, EnumEnchantmentType.digger); + + /** Power enchantment for bows, add's extra damage to arrows. */ + public static final Enchantment power = new EnchantmentArrowDamage(48, 10); + + /** + * Knockback enchantments for bows, the arrows will knockback the target when hit. + */ + public static final Enchantment punch = new EnchantmentArrowKnockback(49, 2); + + /** + * Flame enchantment for bows. Arrows fired by the bow will be on fire. Any target hit will also set on fire. + */ + public static final Enchantment flame = new EnchantmentArrowFire(50, 2); + + /** + * Infinity enchantment for bows. The bow will not consume arrows anymore, but will still required at least one + * arrow on inventory use the bow. + */ + public static final Enchantment infinity = new EnchantmentArrowInfinite(51, 1); + public final int effectId; + private final int weight; + + /** The EnumEnchantmentType given to this Enchantment. */ + public EnumEnchantmentType type; + + /** Used in localisation and stats. */ + protected String name; + + protected Enchantment(int par1, int par2, EnumEnchantmentType par3EnumEnchantmentType) + { + this.effectId = par1; + this.weight = par2; + this.type = par3EnumEnchantmentType; + + if (enchantmentsList[par1] != null) + { + throw new IllegalArgumentException("Duplicate enchantment id!"); + } + else + { + enchantmentsList[par1] = this; + } + } + + public int getWeight() + { + return this.weight; + } + + /** + * Returns the minimum level that the enchantment can have. + */ + public int getMinLevel() + { + return 1; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 1; + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 1 + par1 * 10; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return this.getMinEnchantability(par1) + 5; + } + + /** + * Calculates de damage protection of the enchantment based on level and damage source passed. + */ + public int calcModifierDamage(int par1, DamageSource par2DamageSource) + { + return 0; + } + + /** + * Calculates de (magic) damage done by the enchantment on a living entity based on level and entity passed. + */ + public float calcModifierLiving(int par1, EntityLivingBase par2EntityLivingBase) + { + return 0.0F; + } + + /** + * Determines if the enchantment passed can be applyied together with this enchantment. + */ + public boolean canApplyTogether(Enchantment par1Enchantment) + { + return this != par1Enchantment; + } + + /** + * Sets the enchantment name + */ + public Enchantment setName(String par1Str) + { + this.name = par1Str; + return this; + } + + /** + * Return the name of key in translation table of this enchantment. + */ + public String getName() + { + return "enchantment." + this.name; + } + + /** + * Returns the correct traslated name of the enchantment and the level in roman numbers. + */ + public String getTranslatedName(int par1) + { + String var2 = StatCollector.translateToLocal(this.getName()); + return var2 + " " + StatCollector.translateToLocal("enchantment.level." + par1); + } + + public boolean canApply(ItemStack par1ItemStack) + { + return this.type.canEnchantItem(par1ItemStack.getItem()); + } + + static + { + ArrayList var0 = new ArrayList(); + Enchantment[] var1 = enchantmentsList; + int var2 = var1.length; + + for (int var3 = 0; var3 < var2; ++var3) + { + Enchantment var4 = var1[var3]; + + if (var4 != null) + { + var0.add(var4); + } + } + + enchantmentsBookList = (Enchantment[])var0.toArray(new Enchantment[0]); + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentArrowDamage.java b/src/main/java/net/minecraft/src/EnchantmentArrowDamage.java new file mode 100644 index 0000000..870ba7a --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentArrowDamage.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class EnchantmentArrowDamage extends Enchantment +{ + public EnchantmentArrowDamage(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.bow); + this.setName("arrowDamage"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 1 + (par1 - 1) * 10; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return this.getMinEnchantability(par1) + 15; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 5; + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentArrowFire.java b/src/main/java/net/minecraft/src/EnchantmentArrowFire.java new file mode 100644 index 0000000..4ab94e8 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentArrowFire.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class EnchantmentArrowFire extends Enchantment +{ + public EnchantmentArrowFire(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.bow); + this.setName("arrowFire"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 20; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 1; + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentArrowInfinite.java b/src/main/java/net/minecraft/src/EnchantmentArrowInfinite.java new file mode 100644 index 0000000..261dc41 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentArrowInfinite.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class EnchantmentArrowInfinite extends Enchantment +{ + public EnchantmentArrowInfinite(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.bow); + this.setName("arrowInfinite"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 20; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 1; + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentArrowKnockback.java b/src/main/java/net/minecraft/src/EnchantmentArrowKnockback.java new file mode 100644 index 0000000..dd86fda --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentArrowKnockback.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class EnchantmentArrowKnockback extends Enchantment +{ + public EnchantmentArrowKnockback(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.bow); + this.setName("arrowKnockback"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 12 + (par1 - 1) * 20; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return this.getMinEnchantability(par1) + 25; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 2; + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentDamage.java b/src/main/java/net/minecraft/src/EnchantmentDamage.java new file mode 100644 index 0000000..12aa2d7 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentDamage.java @@ -0,0 +1,87 @@ +package net.minecraft.src; + +public class EnchantmentDamage extends Enchantment +{ + /** Holds the name to be translated of each protection type. */ + private static final String[] protectionName = new String[] {"all", "undead", "arthropods"}; + + /** + * Holds the base factor of enchantability needed to be able to use the enchant. + */ + private static final int[] baseEnchantability = new int[] {1, 5, 5}; + + /** + * Holds how much each level increased the enchantability factor to be able to use this enchant. + */ + private static final int[] levelEnchantability = new int[] {11, 8, 8}; + + /** + * Used on the formula of base enchantability, this is the 'window' factor of values to be able to use thing + * enchant. + */ + private static final int[] thresholdEnchantability = new int[] {20, 20, 20}; + + /** + * Defines the type of damage of the enchantment, 0 = all, 1 = undead, 3 = arthropods + */ + public final int damageType; + + public EnchantmentDamage(int par1, int par2, int par3) + { + super(par1, par2, EnumEnchantmentType.weapon); + this.damageType = par3; + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return baseEnchantability[this.damageType] + (par1 - 1) * levelEnchantability[this.damageType]; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return this.getMinEnchantability(par1) + thresholdEnchantability[this.damageType]; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 5; + } + + /** + * Calculates de (magic) damage done by the enchantment on a living entity based on level and entity passed. + */ + public float calcModifierLiving(int par1, EntityLivingBase par2EntityLivingBase) + { + return this.damageType == 0 ? (float)par1 * 1.25F : (this.damageType == 1 && par2EntityLivingBase.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD ? (float)par1 * 2.5F : (this.damageType == 2 && par2EntityLivingBase.getCreatureAttribute() == EnumCreatureAttribute.ARTHROPOD ? (float)par1 * 2.5F : 0.0F)); + } + + /** + * Return the name of key in translation table of this enchantment. + */ + public String getName() + { + return "enchantment.damage." + protectionName[this.damageType]; + } + + /** + * Determines if the enchantment passed can be applyied together with this enchantment. + */ + public boolean canApplyTogether(Enchantment par1Enchantment) + { + return !(par1Enchantment instanceof EnchantmentDamage); + } + + public boolean canApply(ItemStack par1ItemStack) + { + return par1ItemStack.getItem() instanceof ItemAxe ? true : super.canApply(par1ItemStack); + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentData.java b/src/main/java/net/minecraft/src/EnchantmentData.java new file mode 100644 index 0000000..2fd2c56 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentData.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +public class EnchantmentData extends WeightedRandomItem +{ + /** Enchantment object associated with this EnchantmentData */ + public final Enchantment enchantmentobj; + + /** Enchantment level associated with this EnchantmentData */ + public final int enchantmentLevel; + + public EnchantmentData(Enchantment par1Enchantment, int par2) + { + super(par1Enchantment.getWeight()); + this.enchantmentobj = par1Enchantment; + this.enchantmentLevel = par2; + } + + public EnchantmentData(int par1, int par2) + { + this(Enchantment.enchantmentsList[par1], par2); + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentDigging.java b/src/main/java/net/minecraft/src/EnchantmentDigging.java new file mode 100644 index 0000000..b7f5515 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentDigging.java @@ -0,0 +1,39 @@ +package net.minecraft.src; + +public class EnchantmentDigging extends Enchantment +{ + protected EnchantmentDigging(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.digger); + this.setName("digging"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 1 + 10 * (par1 - 1); + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return super.getMinEnchantability(par1) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 5; + } + + public boolean canApply(ItemStack par1ItemStack) + { + return par1ItemStack.getItem().itemID == Item.shears.itemID ? true : super.canApply(par1ItemStack); + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentDurability.java b/src/main/java/net/minecraft/src/EnchantmentDurability.java new file mode 100644 index 0000000..7c494b1 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentDurability.java @@ -0,0 +1,51 @@ +package net.minecraft.src; + +import java.util.Random; + +public class EnchantmentDurability extends Enchantment +{ + protected EnchantmentDurability(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.digger); + this.setName("durability"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 5 + (par1 - 1) * 8; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return super.getMinEnchantability(par1) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 3; + } + + public boolean canApply(ItemStack par1ItemStack) + { + return par1ItemStack.isItemStackDamageable() ? true : super.canApply(par1ItemStack); + } + + /** + * Used by ItemStack.attemptDamageItem. Randomly determines if a point of damage should be negated using the + * enchantment level (par1). If the ItemStack is Armor then there is a flat 60% chance for damage to be negated no + * matter the enchantment level, otherwise there is a 1-(par/1) chance for damage to be negated. + */ + public static boolean negateDamage(ItemStack par0ItemStack, int par1, Random par2Random) + { + return par0ItemStack.getItem() instanceof ItemArmor && par2Random.nextFloat() < 0.6F ? false : par2Random.nextInt(par1 + 1) > 0; + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentFireAspect.java b/src/main/java/net/minecraft/src/EnchantmentFireAspect.java new file mode 100644 index 0000000..756d266 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentFireAspect.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class EnchantmentFireAspect extends Enchantment +{ + protected EnchantmentFireAspect(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.weapon); + this.setName("fire"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 10 + 20 * (par1 - 1); + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return super.getMinEnchantability(par1) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 2; + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentHelper.java b/src/main/java/net/minecraft/src/EnchantmentHelper.java new file mode 100644 index 0000000..cacf914 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentHelper.java @@ -0,0 +1,478 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public class EnchantmentHelper +{ + /** Is the random seed of enchantment effects. */ + private static final Random enchantmentRand = new Random(); + + /** + * Used to calculate the extra armor of enchantments on armors equipped on player. + */ + private static final EnchantmentModifierDamage enchantmentModifierDamage = new EnchantmentModifierDamage((Empty3)null); + + /** + * Used to calculate the (magic) extra damage done by enchantments on current equipped item of player. + */ + private static final EnchantmentModifierLiving enchantmentModifierLiving = new EnchantmentModifierLiving((Empty3)null); + + /** + * Returns the level of enchantment on the ItemStack passed. + */ + public static int getEnchantmentLevel(int par0, ItemStack par1ItemStack) + { + if (par1ItemStack == null) + { + return 0; + } + else + { + NBTTagList var2 = par1ItemStack.getEnchantmentTagList(); + + if (var2 == null) + { + return 0; + } + else + { + for (int var3 = 0; var3 < var2.tagCount(); ++var3) + { + short var4 = ((NBTTagCompound)var2.tagAt(var3)).getShort("id"); + short var5 = ((NBTTagCompound)var2.tagAt(var3)).getShort("lvl"); + + if (var4 == par0) + { + return var5; + } + } + + return 0; + } + } + } + + /** + * Return the enchantments for the specified stack. + */ + public static Map getEnchantments(ItemStack par0ItemStack) + { + LinkedHashMap var1 = new LinkedHashMap(); + NBTTagList var2 = par0ItemStack.itemID == Item.enchantedBook.itemID ? Item.enchantedBook.func_92110_g(par0ItemStack) : par0ItemStack.getEnchantmentTagList(); + + if (var2 != null) + { + for (int var3 = 0; var3 < var2.tagCount(); ++var3) + { + short var4 = ((NBTTagCompound)var2.tagAt(var3)).getShort("id"); + short var5 = ((NBTTagCompound)var2.tagAt(var3)).getShort("lvl"); + var1.put(Integer.valueOf(var4), Integer.valueOf(var5)); + } + } + + return var1; + } + + /** + * Set the enchantments for the specified stack. + */ + public static void setEnchantments(Map par0Map, ItemStack par1ItemStack) + { + NBTTagList var2 = new NBTTagList(); + Iterator var3 = par0Map.keySet().iterator(); + + while (var3.hasNext()) + { + int var4 = ((Integer)var3.next()).intValue(); + NBTTagCompound var5 = new NBTTagCompound(); + var5.setShort("id", (short)var4); + var5.setShort("lvl", (short)((Integer)par0Map.get(Integer.valueOf(var4))).intValue()); + var2.appendTag(var5); + + if (par1ItemStack.itemID == Item.enchantedBook.itemID) + { + Item.enchantedBook.addEnchantment(par1ItemStack, new EnchantmentData(var4, ((Integer)par0Map.get(Integer.valueOf(var4))).intValue())); + } + } + + if (var2.tagCount() > 0) + { + if (par1ItemStack.itemID != Item.enchantedBook.itemID) + { + par1ItemStack.setTagInfo("ench", var2); + } + } + else if (par1ItemStack.hasTagCompound()) + { + par1ItemStack.getTagCompound().removeTag("ench"); + } + } + + /** + * Returns the biggest level of the enchantment on the array of ItemStack passed. + */ + public static int getMaxEnchantmentLevel(int par0, ItemStack[] par1ArrayOfItemStack) + { + if (par1ArrayOfItemStack == null) + { + return 0; + } + else + { + int var2 = 0; + ItemStack[] var3 = par1ArrayOfItemStack; + int var4 = par1ArrayOfItemStack.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + ItemStack var6 = var3[var5]; + int var7 = getEnchantmentLevel(par0, var6); + + if (var7 > var2) + { + var2 = var7; + } + } + + return var2; + } + } + + /** + * Executes the enchantment modifier on the ItemStack passed. + */ + private static void applyEnchantmentModifier(IEnchantmentModifier par0IEnchantmentModifier, ItemStack par1ItemStack) + { + if (par1ItemStack != null) + { + NBTTagList var2 = par1ItemStack.getEnchantmentTagList(); + + if (var2 != null) + { + for (int var3 = 0; var3 < var2.tagCount(); ++var3) + { + short var4 = ((NBTTagCompound)var2.tagAt(var3)).getShort("id"); + short var5 = ((NBTTagCompound)var2.tagAt(var3)).getShort("lvl"); + + if (Enchantment.enchantmentsList[var4] != null) + { + par0IEnchantmentModifier.calculateModifier(Enchantment.enchantmentsList[var4], var5); + } + } + } + } + } + + /** + * Executes the enchantment modifier on the array of ItemStack passed. + */ + private static void applyEnchantmentModifierArray(IEnchantmentModifier par0IEnchantmentModifier, ItemStack[] par1ArrayOfItemStack) + { + ItemStack[] var2 = par1ArrayOfItemStack; + int var3 = par1ArrayOfItemStack.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + ItemStack var5 = var2[var4]; + applyEnchantmentModifier(par0IEnchantmentModifier, var5); + } + } + + /** + * Returns the modifier of protection enchantments on armors equipped on player. + */ + public static int getEnchantmentModifierDamage(ItemStack[] par0ArrayOfItemStack, DamageSource par1DamageSource) + { + enchantmentModifierDamage.damageModifier = 0; + enchantmentModifierDamage.source = par1DamageSource; + applyEnchantmentModifierArray(enchantmentModifierDamage, par0ArrayOfItemStack); + + if (enchantmentModifierDamage.damageModifier > 25) + { + enchantmentModifierDamage.damageModifier = 25; + } + + return (enchantmentModifierDamage.damageModifier + 1 >> 1) + enchantmentRand.nextInt((enchantmentModifierDamage.damageModifier >> 1) + 1); + } + + /** + * Return the (magic) extra damage of the enchantments on player equipped item. + */ + public static float getEnchantmentModifierLiving(EntityLivingBase par0EntityLivingBase, EntityLivingBase par1EntityLivingBase) + { + enchantmentModifierLiving.livingModifier = 0.0F; + enchantmentModifierLiving.entityLiving = par1EntityLivingBase; + applyEnchantmentModifier(enchantmentModifierLiving, par0EntityLivingBase.getHeldItem()); + return enchantmentModifierLiving.livingModifier; + } + + /** + * Returns the knockback value of enchantments on equipped player item. + */ + public static int getKnockbackModifier(EntityLivingBase par0EntityLivingBase, EntityLivingBase par1EntityLivingBase) + { + return getEnchantmentLevel(Enchantment.knockback.effectId, par0EntityLivingBase.getHeldItem()); + } + + public static int getFireAspectModifier(EntityLivingBase par0EntityLivingBase) + { + return getEnchantmentLevel(Enchantment.fireAspect.effectId, par0EntityLivingBase.getHeldItem()); + } + + /** + * Returns the 'Water Breathing' modifier of enchantments on player equipped armors. + */ + public static int getRespiration(EntityLivingBase par0EntityLivingBase) + { + return getMaxEnchantmentLevel(Enchantment.respiration.effectId, par0EntityLivingBase.getLastActiveItems()); + } + + /** + * Return the extra efficiency of tools based on enchantments on equipped player item. + */ + public static int getEfficiencyModifier(EntityLivingBase par0EntityLivingBase) + { + return getEnchantmentLevel(Enchantment.efficiency.effectId, par0EntityLivingBase.getHeldItem()); + } + + /** + * Returns the silk touch status of enchantments on current equipped item of player. + */ + public static boolean getSilkTouchModifier(EntityLivingBase par0EntityLivingBase) + { + return getEnchantmentLevel(Enchantment.silkTouch.effectId, par0EntityLivingBase.getHeldItem()) > 0; + } + + /** + * Returns the fortune enchantment modifier of the current equipped item of player. + */ + public static int getFortuneModifier(EntityLivingBase par0EntityLivingBase) + { + return getEnchantmentLevel(Enchantment.fortune.effectId, par0EntityLivingBase.getHeldItem()); + } + + /** + * Returns the looting enchantment modifier of the current equipped item of player. + */ + public static int getLootingModifier(EntityLivingBase par0EntityLivingBase) + { + return getEnchantmentLevel(Enchantment.looting.effectId, par0EntityLivingBase.getHeldItem()); + } + + /** + * Returns the aqua affinity status of enchantments on current equipped item of player. + */ + public static boolean getAquaAffinityModifier(EntityLivingBase par0EntityLivingBase) + { + return getMaxEnchantmentLevel(Enchantment.aquaAffinity.effectId, par0EntityLivingBase.getLastActiveItems()) > 0; + } + + public static int func_92098_i(EntityLivingBase par0EntityLivingBase) + { + return getMaxEnchantmentLevel(Enchantment.thorns.effectId, par0EntityLivingBase.getLastActiveItems()); + } + + public static ItemStack func_92099_a(Enchantment par0Enchantment, EntityLivingBase par1EntityLivingBase) + { + ItemStack[] var2 = par1EntityLivingBase.getLastActiveItems(); + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + ItemStack var5 = var2[var4]; + + if (var5 != null && getEnchantmentLevel(par0Enchantment.effectId, var5) > 0) + { + return var5; + } + } + + return null; + } + + /** + * Returns the enchantability of itemstack, it's uses a singular formula for each index (2nd parameter: 0, 1 and 2), + * cutting to the max enchantability power of the table (3rd parameter) + */ + public static int calcItemStackEnchantability(Random par0Random, int par1, int par2, ItemStack par3ItemStack) + { + Item var4 = par3ItemStack.getItem(); + int var5 = var4.getItemEnchantability(); + + if (var5 <= 0) + { + return 0; + } + else + { + if (par2 > 15) + { + par2 = 15; + } + + int var6 = par0Random.nextInt(8) + 1 + (par2 >> 1) + par0Random.nextInt(par2 + 1); + return par1 == 0 ? Math.max(var6 / 3, 1) : (par1 == 1 ? var6 * 2 / 3 + 1 : Math.max(var6, par2 * 2)); + } + } + + /** + * Adds a random enchantment to the specified item. Args: random, itemStack, enchantabilityLevel + */ + public static ItemStack addRandomEnchantment(Random par0Random, ItemStack par1ItemStack, int par2) + { + List var3 = buildEnchantmentList(par0Random, par1ItemStack, par2); + boolean var4 = par1ItemStack.itemID == Item.book.itemID; + + if (var4) + { + par1ItemStack.itemID = Item.enchantedBook.itemID; + } + + if (var3 != null) + { + Iterator var5 = var3.iterator(); + + while (var5.hasNext()) + { + EnchantmentData var6 = (EnchantmentData)var5.next(); + + if (var4) + { + Item.enchantedBook.addEnchantment(par1ItemStack, var6); + } + else + { + par1ItemStack.addEnchantment(var6.enchantmentobj, var6.enchantmentLevel); + } + } + } + + return par1ItemStack; + } + + /** + * Create a list of random EnchantmentData (enchantments) that can be added together to the ItemStack, the 3rd + * parameter is the total enchantability level. + */ + public static List buildEnchantmentList(Random par0Random, ItemStack par1ItemStack, int par2) + { + Item var3 = par1ItemStack.getItem(); + int var4 = var3.getItemEnchantability(); + + if (var4 <= 0) + { + return null; + } + else + { + var4 /= 2; + var4 = 1 + par0Random.nextInt((var4 >> 1) + 1) + par0Random.nextInt((var4 >> 1) + 1); + int var5 = var4 + par2; + float var6 = (par0Random.nextFloat() + par0Random.nextFloat() - 1.0F) * 0.15F; + int var7 = (int)((float)var5 * (1.0F + var6) + 0.5F); + + if (var7 < 1) + { + var7 = 1; + } + + ArrayList var8 = null; + Map var9 = mapEnchantmentData(var7, par1ItemStack); + + if (var9 != null && !var9.isEmpty()) + { + EnchantmentData var10 = (EnchantmentData)WeightedRandom.getRandomItem(par0Random, var9.values()); + + if (var10 != null) + { + var8 = new ArrayList(); + var8.add(var10); + + for (int var11 = var7; par0Random.nextInt(50) <= var11; var11 >>= 1) + { + Iterator var12 = var9.keySet().iterator(); + + while (var12.hasNext()) + { + Integer var13 = (Integer)var12.next(); + boolean var14 = true; + Iterator var15 = var8.iterator(); + + while (true) + { + if (var15.hasNext()) + { + EnchantmentData var16 = (EnchantmentData)var15.next(); + + if (var16.enchantmentobj.canApplyTogether(Enchantment.enchantmentsList[var13.intValue()])) + { + continue; + } + + var14 = false; + } + + if (!var14) + { + var12.remove(); + } + + break; + } + } + + if (!var9.isEmpty()) + { + EnchantmentData var17 = (EnchantmentData)WeightedRandom.getRandomItem(par0Random, var9.values()); + var8.add(var17); + } + } + } + } + + return var8; + } + } + + /** + * Creates a 'Map' of EnchantmentData (enchantments) possible to add on the ItemStack and the enchantability level + * passed. + */ + public static Map mapEnchantmentData(int par0, ItemStack par1ItemStack) + { + Item var2 = par1ItemStack.getItem(); + HashMap var3 = null; + boolean var4 = par1ItemStack.itemID == Item.book.itemID; + Enchantment[] var5 = Enchantment.enchantmentsList; + int var6 = var5.length; + + for (int var7 = 0; var7 < var6; ++var7) + { + Enchantment var8 = var5[var7]; + + if (var8 != null && (var8.type.canEnchantItem(var2) || var4)) + { + for (int var9 = var8.getMinLevel(); var9 <= var8.getMaxLevel(); ++var9) + { + if (par0 >= var8.getMinEnchantability(var9) && par0 <= var8.getMaxEnchantability(var9)) + { + if (var3 == null) + { + var3 = new HashMap(); + } + + var3.put(Integer.valueOf(var8.effectId), new EnchantmentData(var8, var9)); + } + } + } + } + + return var3; + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentKnockback.java b/src/main/java/net/minecraft/src/EnchantmentKnockback.java new file mode 100644 index 0000000..234f172 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentKnockback.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class EnchantmentKnockback extends Enchantment +{ + protected EnchantmentKnockback(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.weapon); + this.setName("knockback"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 5 + 20 * (par1 - 1); + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return super.getMinEnchantability(par1) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 2; + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentLootBonus.java b/src/main/java/net/minecraft/src/EnchantmentLootBonus.java new file mode 100644 index 0000000..f9abce7 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentLootBonus.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +public class EnchantmentLootBonus extends Enchantment +{ + protected EnchantmentLootBonus(int par1, int par2, EnumEnchantmentType par3EnumEnchantmentType) + { + super(par1, par2, par3EnumEnchantmentType); + this.setName("lootBonus"); + + if (par3EnumEnchantmentType == EnumEnchantmentType.digger) + { + this.setName("lootBonusDigger"); + } + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 15 + (par1 - 1) * 9; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return super.getMinEnchantability(par1) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 3; + } + + /** + * Determines if the enchantment passed can be applyied together with this enchantment. + */ + public boolean canApplyTogether(Enchantment par1Enchantment) + { + return super.canApplyTogether(par1Enchantment) && par1Enchantment.effectId != silkTouch.effectId; + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentModifierDamage.java b/src/main/java/net/minecraft/src/EnchantmentModifierDamage.java new file mode 100644 index 0000000..97269a7 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentModifierDamage.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +final class EnchantmentModifierDamage implements IEnchantmentModifier +{ + /** + * Used to calculate the damage modifier (extra armor) on enchantments that the player have on equipped armors. + */ + public int damageModifier; + + /** + * Used as parameter to calculate the damage modifier (extra armor) on enchantments that the player have on equipped + * armors. + */ + public DamageSource source; + + private EnchantmentModifierDamage() {} + + /** + * Generic method use to calculate modifiers of offensive or defensive enchantment values. + */ + public void calculateModifier(Enchantment par1Enchantment, int par2) + { + this.damageModifier += par1Enchantment.calcModifierDamage(par2, this.source); + } + + EnchantmentModifierDamage(Empty3 par1Empty3) + { + this(); + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentModifierLiving.java b/src/main/java/net/minecraft/src/EnchantmentModifierLiving.java new file mode 100644 index 0000000..19fcc5e --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentModifierLiving.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +final class EnchantmentModifierLiving implements IEnchantmentModifier +{ + /** + * Used to calculate the (magic) extra damage based on enchantments of current equipped player item. + */ + public float livingModifier; + + /** + * Used as parameter to calculate the (magic) extra damage based on enchantments of current equipped player item. + */ + public EntityLivingBase entityLiving; + + private EnchantmentModifierLiving() {} + + /** + * Generic method use to calculate modifiers of offensive or defensive enchantment values. + */ + public void calculateModifier(Enchantment par1Enchantment, int par2) + { + this.livingModifier += par1Enchantment.calcModifierLiving(par2, this.entityLiving); + } + + EnchantmentModifierLiving(Empty3 par1Empty3) + { + this(); + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentNameParts.java b/src/main/java/net/minecraft/src/EnchantmentNameParts.java new file mode 100644 index 0000000..aaf0493 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentNameParts.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +import java.util.Random; + +public class EnchantmentNameParts +{ + /** The static instance of this class. */ + public static final EnchantmentNameParts instance = new EnchantmentNameParts(); + + /** The RNG used to generate enchant names. */ + private Random rand = new Random(); + + /** List of words used to generate an enchant name. */ + private String[] wordList = "the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale ".split(" "); + + /** + * Generates a random enchant name. + */ + public String generateRandomEnchantName() + { + int var1 = this.rand.nextInt(2) + 3; + String var2 = ""; + + for (int var3 = 0; var3 < var1; ++var3) + { + if (var3 > 0) + { + var2 = var2 + " "; + } + + var2 = var2 + this.wordList[this.rand.nextInt(this.wordList.length)]; + } + + return var2; + } + + /** + * Sets the seed for the enchant name RNG. + */ + public void setRandSeed(long par1) + { + this.rand.setSeed(par1); + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentOxygen.java b/src/main/java/net/minecraft/src/EnchantmentOxygen.java new file mode 100644 index 0000000..6e9e836 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentOxygen.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class EnchantmentOxygen extends Enchantment +{ + public EnchantmentOxygen(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.armor_head); + this.setName("oxygen"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 10 * par1; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return this.getMinEnchantability(par1) + 30; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 3; + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentProtection.java b/src/main/java/net/minecraft/src/EnchantmentProtection.java new file mode 100644 index 0000000..411ec62 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentProtection.java @@ -0,0 +1,131 @@ +package net.minecraft.src; + +public class EnchantmentProtection extends Enchantment +{ + /** Holds the name to be translated of each protection type. */ + private static final String[] protectionName = new String[] {"all", "fire", "fall", "explosion", "projectile"}; + + /** + * Holds the base factor of enchantability needed to be able to use the enchant. + */ + private static final int[] baseEnchantability = new int[] {1, 10, 5, 5, 3}; + + /** + * Holds how much each level increased the enchantability factor to be able to use this enchant. + */ + private static final int[] levelEnchantability = new int[] {11, 8, 6, 8, 6}; + + /** + * Used on the formula of base enchantability, this is the 'window' factor of values to be able to use thing + * enchant. + */ + private static final int[] thresholdEnchantability = new int[] {20, 12, 10, 12, 15}; + + /** + * Defines the type of protection of the enchantment, 0 = all, 1 = fire, 2 = fall (feather fall), 3 = explosion and + * 4 = projectile. + */ + public final int protectionType; + + public EnchantmentProtection(int par1, int par2, int par3) + { + super(par1, par2, EnumEnchantmentType.armor); + this.protectionType = par3; + + if (par3 == 2) + { + this.type = EnumEnchantmentType.armor_feet; + } + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return baseEnchantability[this.protectionType] + (par1 - 1) * levelEnchantability[this.protectionType]; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return this.getMinEnchantability(par1) + thresholdEnchantability[this.protectionType]; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 4; + } + + /** + * Calculates de damage protection of the enchantment based on level and damage source passed. + */ + public int calcModifierDamage(int par1, DamageSource par2DamageSource) + { + if (par2DamageSource.canHarmInCreative()) + { + return 0; + } + else + { + float var3 = (float)(6 + par1 * par1) / 3.0F; + return this.protectionType == 0 ? MathHelper.floor_float(var3 * 0.75F) : (this.protectionType == 1 && par2DamageSource.isFireDamage() ? MathHelper.floor_float(var3 * 1.25F) : (this.protectionType == 2 && par2DamageSource == DamageSource.fall ? MathHelper.floor_float(var3 * 2.5F) : (this.protectionType == 3 && par2DamageSource.isExplosion() ? MathHelper.floor_float(var3 * 1.5F) : (this.protectionType == 4 && par2DamageSource.isProjectile() ? MathHelper.floor_float(var3 * 1.5F) : 0)))); + } + } + + /** + * Return the name of key in translation table of this enchantment. + */ + public String getName() + { + return "enchantment.protect." + protectionName[this.protectionType]; + } + + /** + * Determines if the enchantment passed can be applyied together with this enchantment. + */ + public boolean canApplyTogether(Enchantment par1Enchantment) + { + if (par1Enchantment instanceof EnchantmentProtection) + { + EnchantmentProtection var2 = (EnchantmentProtection)par1Enchantment; + return var2.protectionType == this.protectionType ? false : this.protectionType == 2 || var2.protectionType == 2; + } + else + { + return super.canApplyTogether(par1Enchantment); + } + } + + /** + * Gets the amount of ticks an entity should be set fire, adjusted for fire protection. + */ + public static int getFireTimeForEntity(Entity par0Entity, int par1) + { + int var2 = EnchantmentHelper.getMaxEnchantmentLevel(Enchantment.fireProtection.effectId, par0Entity.getLastActiveItems()); + + if (var2 > 0) + { + par1 -= MathHelper.floor_float((float)par1 * (float)var2 * 0.15F); + } + + return par1; + } + + public static double func_92092_a(Entity par0Entity, double par1) + { + int var3 = EnchantmentHelper.getMaxEnchantmentLevel(Enchantment.blastProtection.effectId, par0Entity.getLastActiveItems()); + + if (var3 > 0) + { + par1 -= (double)MathHelper.floor_double(par1 * (double)((float)var3 * 0.15F)); + } + + return par1; + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentThorns.java b/src/main/java/net/minecraft/src/EnchantmentThorns.java new file mode 100644 index 0000000..e474e1c --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentThorns.java @@ -0,0 +1,72 @@ +package net.minecraft.src; + +import java.util.Random; + +public class EnchantmentThorns extends Enchantment +{ + public EnchantmentThorns(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.armor_torso); + this.setName("thorns"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 10 + 20 * (par1 - 1); + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return super.getMinEnchantability(par1) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 3; + } + + public boolean canApply(ItemStack par1ItemStack) + { + return par1ItemStack.getItem() instanceof ItemArmor ? true : super.canApply(par1ItemStack); + } + + public static boolean func_92094_a(int par0, Random par1Random) + { + return par0 <= 0 ? false : par1Random.nextFloat() < 0.15F * (float)par0; + } + + public static int func_92095_b(int par0, Random par1Random) + { + return par0 > 10 ? par0 - 10 : 1 + par1Random.nextInt(4); + } + + public static void func_92096_a(Entity par0Entity, EntityLivingBase par1EntityLivingBase, Random par2Random) + { + int var3 = EnchantmentHelper.func_92098_i(par1EntityLivingBase); + ItemStack var4 = EnchantmentHelper.func_92099_a(Enchantment.thorns, par1EntityLivingBase); + + if (func_92094_a(var3, par2Random)) + { + par0Entity.attackEntityFrom(DamageSource.causeThornsDamage(par1EntityLivingBase), (float)func_92095_b(var3, par2Random)); + par0Entity.playSound("damage.thorns", 0.5F, 1.0F); + + if (var4 != null) + { + var4.damageItem(3, par1EntityLivingBase); + } + } + else if (var4 != null) + { + var4.damageItem(1, par1EntityLivingBase); + } + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentUntouching.java b/src/main/java/net/minecraft/src/EnchantmentUntouching.java new file mode 100644 index 0000000..255a7c1 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentUntouching.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +public class EnchantmentUntouching extends Enchantment +{ + protected EnchantmentUntouching(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.digger); + this.setName("untouching"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 15; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return super.getMinEnchantability(par1) + 50; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 1; + } + + /** + * Determines if the enchantment passed can be applyied together with this enchantment. + */ + public boolean canApplyTogether(Enchantment par1Enchantment) + { + return super.canApplyTogether(par1Enchantment) && par1Enchantment.effectId != fortune.effectId; + } + + public boolean canApply(ItemStack par1ItemStack) + { + return par1ItemStack.getItem().itemID == Item.shears.itemID ? true : super.canApply(par1ItemStack); + } +} diff --git a/src/main/java/net/minecraft/src/EnchantmentWaterWorker.java b/src/main/java/net/minecraft/src/EnchantmentWaterWorker.java new file mode 100644 index 0000000..8d49ae6 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnchantmentWaterWorker.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class EnchantmentWaterWorker extends Enchantment +{ + public EnchantmentWaterWorker(int par1, int par2) + { + super(par1, par2, EnumEnchantmentType.armor_head); + this.setName("waterWorker"); + } + + /** + * Returns the minimal value of enchantability needed on the enchantment level passed. + */ + public int getMinEnchantability(int par1) + { + return 1; + } + + /** + * Returns the maximum value of enchantability nedded on the enchantment level passed. + */ + public int getMaxEnchantability(int par1) + { + return this.getMinEnchantability(par1) + 40; + } + + /** + * Returns the maximum level that the enchantment can have. + */ + public int getMaxLevel() + { + return 1; + } +} diff --git a/src/main/java/net/minecraft/src/Entity.java b/src/main/java/net/minecraft/src/Entity.java new file mode 100644 index 0000000..eeba020 --- /dev/null +++ b/src/main/java/net/minecraft/src/Entity.java @@ -0,0 +1,2399 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; +import java.util.UUID; +import net.minecraft.server.MinecraftServer; + +public abstract class Entity +{ + private static int nextEntityID; + public int entityId; + public double renderDistanceWeight; + + /** + * Blocks entities from spawning when they do their AABB check to make sure the spot is clear of entities that can + * prevent spawning. + */ + public boolean preventEntitySpawning; + + /** The entity that is riding this entity */ + public Entity riddenByEntity; + + /** The entity we are currently riding */ + public Entity ridingEntity; + public boolean forceSpawn; + + /** Reference to the World object. */ + public World worldObj; + public double prevPosX; + public double prevPosY; + public double prevPosZ; + + /** Entity position X */ + public double posX; + + /** Entity position Y */ + public double posY; + + /** Entity position Z */ + public double posZ; + + /** Entity motion X */ + public double motionX; + + /** Entity motion Y */ + public double motionY; + + /** Entity motion Z */ + public double motionZ; + + /** Entity rotation Yaw */ + public float rotationYaw; + + /** Entity rotation Pitch */ + public float rotationPitch; + public float prevRotationYaw; + public float prevRotationPitch; + + /** Axis aligned bounding box. */ + public final AxisAlignedBB boundingBox; + public boolean onGround; + + /** + * True if after a move this entity has collided with something on X- or Z-axis + */ + public boolean isCollidedHorizontally; + + /** + * True if after a move this entity has collided with something on Y-axis + */ + public boolean isCollidedVertically; + + /** + * True if after a move this entity has collided with something either vertically or horizontally + */ + public boolean isCollided; + public boolean velocityChanged; + protected boolean isInWeb; + public boolean field_70135_K; + + /** + * Gets set by setDead, so this must be the flag whether an Entity is dead (inactive may be better term) + */ + public boolean isDead; + public float yOffset; + + /** How wide this entity is considered to be */ + public float width; + + /** How high this entity is considered to be */ + public float height; + + /** The previous ticks distance walked multiplied by 0.6 */ + public float prevDistanceWalkedModified; + + /** The distance walked multiplied by 0.6 */ + public float distanceWalkedModified; + public float distanceWalkedOnStepModified; + public float fallDistance; + + /** + * The distance that has to be exceeded in order to triger a new step sound and an onEntityWalking event on a block + */ + private int nextStepDistance; + + /** + * The entity's X coordinate at the previous tick, used to calculate position during rendering routines + */ + public double lastTickPosX; + + /** + * The entity's Y coordinate at the previous tick, used to calculate position during rendering routines + */ + public double lastTickPosY; + + /** + * The entity's Z coordinate at the previous tick, used to calculate position during rendering routines + */ + public double lastTickPosZ; + public float ySize; + + /** + * How high this entity can step up when running into a block to try to get over it (currently make note the entity + * will always step up this amount and not just the amount needed) + */ + public float stepHeight; + + /** + * Whether this entity won't clip with collision or not (make note it won't disable gravity) + */ + public boolean noClip; + + /** + * Reduces the velocity applied by entity collisions by the specified percent. + */ + public float entityCollisionReduction; + protected Random rand; + + /** How many ticks has this entity had ran since being alive */ + public int ticksExisted; + + /** + * The amount of ticks you have to stand inside of fire before be set on fire + */ + public int fireResistance; + private int fire; + + /** + * Whether this entity is currently inside of water (if it handles water movement that is) + */ + protected boolean inWater; + + /** + * Remaining time an entity will be "immune" to further damage after being hurt. + */ + public int hurtResistantTime; + private boolean firstUpdate; + protected boolean isImmuneToFire; + protected DataWatcher dataWatcher; + private double entityRiderPitchDelta; + private double entityRiderYawDelta; + + /** Has this entity been added to the chunk its within */ + public boolean addedToChunk; + public int chunkCoordX; + public int chunkCoordY; + public int chunkCoordZ; + public int serverPosX; + public int serverPosY; + public int serverPosZ; + + /** + * Render entity even if it is outside the camera frustum. Only true in EntityFish for now. Used in RenderGlobal: + * render if ignoreFrustumCheck or in frustum. + */ + public boolean ignoreFrustumCheck; + public boolean isAirBorne; + public int timeUntilPortal; + + /** Whether the entity is inside a Portal */ + protected boolean inPortal; + protected int portalCounter; + + /** Which dimension the player is in (-1 = the Nether, 0 = normal world) */ + public int dimension; + protected int teleportDirection; + private boolean invulnerable; + private UUID entityUniqueID; + public EnumEntitySize myEntitySize; + + public Entity(World par1World) + { + this.entityId = nextEntityID++; + this.renderDistanceWeight = 1.0D; + this.boundingBox = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + this.field_70135_K = true; + this.width = 0.6F; + this.height = 1.8F; + this.nextStepDistance = 1; + this.rand = new Random(); + this.fireResistance = 1; + this.firstUpdate = true; + this.dataWatcher = new DataWatcher(); + this.entityUniqueID = UUID.randomUUID(); + this.myEntitySize = EnumEntitySize.SIZE_2; + this.worldObj = par1World; + this.setPosition(0.0D, 0.0D, 0.0D); + + if (par1World != null) + { + this.dimension = par1World.provider.dimensionId; + } + + this.dataWatcher.addObject(0, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(1, Short.valueOf((short)300)); + this.entityInit(); + } + + protected abstract void entityInit(); + + public DataWatcher getDataWatcher() + { + return this.dataWatcher; + } + + public boolean equals(Object par1Obj) + { + return par1Obj instanceof Entity ? ((Entity)par1Obj).entityId == this.entityId : false; + } + + public int hashCode() + { + return this.entityId; + } + + /** + * Keeps moving the entity up so it isn't colliding with blocks and other requirements for this entity to be spawned + * (only actually used on players though its also on Entity) + */ + protected void preparePlayerToSpawn() + { + if (this.worldObj != null) + { + while (this.posY > 0.0D) + { + this.setPosition(this.posX, this.posY, this.posZ); + + if (this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()) + { + break; + } + + ++this.posY; + } + + this.motionX = this.motionY = this.motionZ = 0.0D; + this.rotationPitch = 0.0F; + } + } + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + this.isDead = true; + } + + /** + * Sets the width and height of the entity. Args: width, height + */ + protected void setSize(float par1, float par2) + { + float var3; + + if (par1 != this.width || par2 != this.height) + { + var3 = this.width; + this.width = par1; + this.height = par2; + this.boundingBox.maxX = this.boundingBox.minX + (double)this.width; + this.boundingBox.maxZ = this.boundingBox.minZ + (double)this.width; + this.boundingBox.maxY = this.boundingBox.minY + (double)this.height; + + if (this.width > var3 && !this.firstUpdate && !this.worldObj.isRemote) + { + this.moveEntity((double)(var3 - this.width), 0.0D, (double)(var3 - this.width)); + } + } + + var3 = par1 % 2.0F; + + if ((double)var3 < 0.375D) + { + this.myEntitySize = EnumEntitySize.SIZE_1; + } + else if ((double)var3 < 0.75D) + { + this.myEntitySize = EnumEntitySize.SIZE_2; + } + else if ((double)var3 < 1.0D) + { + this.myEntitySize = EnumEntitySize.SIZE_3; + } + else if ((double)var3 < 1.375D) + { + this.myEntitySize = EnumEntitySize.SIZE_4; + } + else if ((double)var3 < 1.75D) + { + this.myEntitySize = EnumEntitySize.SIZE_5; + } + else + { + this.myEntitySize = EnumEntitySize.SIZE_6; + } + } + + /** + * Sets the rotation of the entity + */ + protected void setRotation(float par1, float par2) + { + this.rotationYaw = par1 % 360.0F; + this.rotationPitch = par2 % 360.0F; + } + + /** + * Sets the x,y,z of the entity from the given parameters. Also seems to set up a bounding box. + */ + public void setPosition(double par1, double par3, double par5) + { + this.posX = par1; + this.posY = par3; + this.posZ = par5; + float var7 = this.width / 2.0F; + float var8 = this.height; + this.boundingBox.setBounds(par1 - (double)var7, par3 - (double)this.yOffset + (double)this.ySize, par5 - (double)var7, par1 + (double)var7, par3 - (double)this.yOffset + (double)this.ySize + (double)var8, par5 + (double)var7); + } + + /** + * Adds par1*0.15 to the entity's yaw, and *subtracts* par2*0.15 from the pitch. Clamps pitch from -90 to 90. Both + * arguments in degrees. + */ + public void setAngles(float par1, float par2) + { + float var3 = this.rotationPitch; + float var4 = this.rotationYaw; + this.rotationYaw = (float)((double)this.rotationYaw + (double)par1 * 0.15D); + this.rotationPitch = (float)((double)this.rotationPitch - (double)par2 * 0.15D); + + if (this.rotationPitch < -90.0F) + { + this.rotationPitch = -90.0F; + } + + if (this.rotationPitch > 90.0F) + { + this.rotationPitch = 90.0F; + } + + this.prevRotationPitch += this.rotationPitch - var3; + this.prevRotationYaw += this.rotationYaw - var4; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.onEntityUpdate(); + } + + /** + * Gets called every tick from main Entity class + */ + public void onEntityUpdate() + { + this.worldObj.theProfiler.startSection("entityBaseTick"); + + if (this.ridingEntity != null && this.ridingEntity.isDead) + { + this.ridingEntity = null; + } + + this.prevDistanceWalkedModified = this.distanceWalkedModified; + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.prevRotationPitch = this.rotationPitch; + this.prevRotationYaw = this.rotationYaw; + int var2; + + if (!this.worldObj.isRemote && this.worldObj instanceof WorldServer) + { + this.worldObj.theProfiler.startSection("portal"); + MinecraftServer var1 = ((WorldServer)this.worldObj).getMinecraftServer(); + var2 = this.getMaxInPortalTime(); + + if (this.inPortal) + { + if (var1.getAllowNether()) + { + if (this.ridingEntity == null && this.portalCounter++ >= var2) + { + this.portalCounter = var2; + this.timeUntilPortal = this.getPortalCooldown(); + byte var3; + + if (this.worldObj.provider.dimensionId == -1) + { + var3 = 0; + } + else + { + var3 = -1; + } + + this.travelToDimension(var3); + } + + this.inPortal = false; + } + } + else + { + if (this.portalCounter > 0) + { + this.portalCounter -= 4; + } + + if (this.portalCounter < 0) + { + this.portalCounter = 0; + } + } + + if (this.timeUntilPortal > 0) + { + --this.timeUntilPortal; + } + + this.worldObj.theProfiler.endSection(); + } + + if (this.isSprinting() && !this.isInWater()) + { + int var5 = MathHelper.floor_double(this.posX); + var2 = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset); + int var6 = MathHelper.floor_double(this.posZ); + int var4 = this.worldObj.getBlockId(var5, var2, var6); + + if (var4 > 0) + { + this.worldObj.spawnParticle("tilecrack_" + var4 + "_" + this.worldObj.getBlockMetadata(var5, var2, var6), this.posX + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, this.boundingBox.minY + 0.1D, this.posZ + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, -this.motionX * 4.0D, 1.5D, -this.motionZ * 4.0D); + } + } + + this.handleWaterMovement(); + + if (this.worldObj.isRemote) + { + this.fire = 0; + } + else if (this.fire > 0) + { + if (this.isImmuneToFire) + { + this.fire -= 4; + + if (this.fire < 0) + { + this.fire = 0; + } + } + else + { + if (this.fire % 20 == 0) + { + this.attackEntityFrom(DamageSource.onFire, 1.0F); + } + + --this.fire; + } + } + + if (this.handleLavaMovement()) + { + this.setOnFireFromLava(); + this.fallDistance *= 0.5F; + } + + if (this.posY < -64.0D) + { + this.kill(); + } + + if (!this.worldObj.isRemote) + { + this.setFlag(0, this.fire > 0); + } + + this.firstUpdate = false; + this.worldObj.theProfiler.endSection(); + } + + /** + * Return the amount of time this entity should stay in a portal before being transported. + */ + public int getMaxInPortalTime() + { + return 0; + } + + /** + * Called whenever the entity is walking inside of lava. + */ + protected void setOnFireFromLava() + { + if (!this.isImmuneToFire) + { + this.attackEntityFrom(DamageSource.lava, 4.0F); + this.setFire(15); + } + } + + /** + * Sets entity to burn for x amount of seconds, cannot lower amount of existing fire. + */ + public void setFire(int par1) + { + int var2 = par1 * 20; + var2 = EnchantmentProtection.getFireTimeForEntity(this, var2); + + if (this.fire < var2) + { + this.fire = var2; + } + } + + /** + * Removes fire from entity. + */ + public void extinguish() + { + this.fire = 0; + } + + /** + * sets the dead flag. Used when you fall off the bottom of the world. + */ + protected void kill() + { + this.setDead(); + } + + /** + * Checks if the offset position from the entity's current position is inside of liquid. Args: x, y, z + */ + public boolean isOffsetPositionInLiquid(double par1, double par3, double par5) + { + AxisAlignedBB var7 = this.boundingBox.getOffsetBoundingBox(par1, par3, par5); + List var8 = this.worldObj.getCollidingBoundingBoxes(this, var7); + return !var8.isEmpty() ? false : !this.worldObj.isAnyLiquid(var7); + } + + /** + * Tries to moves the entity by the passed in displacement. Args: x, y, z + */ + public void moveEntity(double par1, double par3, double par5) + { + if (this.noClip) + { + this.boundingBox.offset(par1, par3, par5); + this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; + this.posY = this.boundingBox.minY + (double)this.yOffset - (double)this.ySize; + this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; + } + else + { + this.worldObj.theProfiler.startSection("move"); + this.ySize *= 0.4F; + double var7 = this.posX; + double var9 = this.posY; + double var11 = this.posZ; + + if (this.isInWeb) + { + this.isInWeb = false; + par1 *= 0.25D; + par3 *= 0.05000000074505806D; + par5 *= 0.25D; + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + } + + double var13 = par1; + double var15 = par3; + double var17 = par5; + AxisAlignedBB var19 = this.boundingBox.copy(); + boolean var20 = this.onGround && this.isSneaking() && this instanceof EntityPlayer; + + if (var20) + { + double var21; + + for (var21 = 0.05D; par1 != 0.0D && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.getOffsetBoundingBox(par1, -1.0D, 0.0D)).isEmpty(); var13 = par1) + { + if (par1 < var21 && par1 >= -var21) + { + par1 = 0.0D; + } + else if (par1 > 0.0D) + { + par1 -= var21; + } + else + { + par1 += var21; + } + } + + for (; par5 != 0.0D && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.getOffsetBoundingBox(0.0D, -1.0D, par5)).isEmpty(); var17 = par5) + { + if (par5 < var21 && par5 >= -var21) + { + par5 = 0.0D; + } + else if (par5 > 0.0D) + { + par5 -= var21; + } + else + { + par5 += var21; + } + } + + while (par1 != 0.0D && par5 != 0.0D && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.getOffsetBoundingBox(par1, -1.0D, par5)).isEmpty()) + { + if (par1 < var21 && par1 >= -var21) + { + par1 = 0.0D; + } + else if (par1 > 0.0D) + { + par1 -= var21; + } + else + { + par1 += var21; + } + + if (par5 < var21 && par5 >= -var21) + { + par5 = 0.0D; + } + else if (par5 > 0.0D) + { + par5 -= var21; + } + else + { + par5 += var21; + } + + var13 = par1; + var17 = par5; + } + } + + List var35 = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.addCoord(par1, par3, par5)); + + for (int var22 = 0; var22 < var35.size(); ++var22) + { + par3 = ((AxisAlignedBB)var35.get(var22)).calculateYOffset(this.boundingBox, par3); + } + + this.boundingBox.offset(0.0D, par3, 0.0D); + + if (!this.field_70135_K && var15 != par3) + { + par5 = 0.0D; + par3 = 0.0D; + par1 = 0.0D; + } + + boolean var36 = this.onGround || var15 != par3 && var15 < 0.0D; + int var23; + + for (var23 = 0; var23 < var35.size(); ++var23) + { + par1 = ((AxisAlignedBB)var35.get(var23)).calculateXOffset(this.boundingBox, par1); + } + + this.boundingBox.offset(par1, 0.0D, 0.0D); + + if (!this.field_70135_K && var13 != par1) + { + par5 = 0.0D; + par3 = 0.0D; + par1 = 0.0D; + } + + for (var23 = 0; var23 < var35.size(); ++var23) + { + par5 = ((AxisAlignedBB)var35.get(var23)).calculateZOffset(this.boundingBox, par5); + } + + this.boundingBox.offset(0.0D, 0.0D, par5); + + if (!this.field_70135_K && var17 != par5) + { + par5 = 0.0D; + par3 = 0.0D; + par1 = 0.0D; + } + + double var25; + double var27; + int var30; + double var37; + + if (this.stepHeight > 0.0F && var36 && (var20 || this.ySize < 0.05F) && (var13 != par1 || var17 != par5)) + { + var37 = par1; + var25 = par3; + var27 = par5; + par1 = var13; + par3 = (double)this.stepHeight; + par5 = var17; + AxisAlignedBB var29 = this.boundingBox.copy(); + this.boundingBox.setBB(var19); + var35 = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.addCoord(var13, par3, var17)); + + for (var30 = 0; var30 < var35.size(); ++var30) + { + par3 = ((AxisAlignedBB)var35.get(var30)).calculateYOffset(this.boundingBox, par3); + } + + this.boundingBox.offset(0.0D, par3, 0.0D); + + if (!this.field_70135_K && var15 != par3) + { + par5 = 0.0D; + par3 = 0.0D; + par1 = 0.0D; + } + + for (var30 = 0; var30 < var35.size(); ++var30) + { + par1 = ((AxisAlignedBB)var35.get(var30)).calculateXOffset(this.boundingBox, par1); + } + + this.boundingBox.offset(par1, 0.0D, 0.0D); + + if (!this.field_70135_K && var13 != par1) + { + par5 = 0.0D; + par3 = 0.0D; + par1 = 0.0D; + } + + for (var30 = 0; var30 < var35.size(); ++var30) + { + par5 = ((AxisAlignedBB)var35.get(var30)).calculateZOffset(this.boundingBox, par5); + } + + this.boundingBox.offset(0.0D, 0.0D, par5); + + if (!this.field_70135_K && var17 != par5) + { + par5 = 0.0D; + par3 = 0.0D; + par1 = 0.0D; + } + + if (!this.field_70135_K && var15 != par3) + { + par5 = 0.0D; + par3 = 0.0D; + par1 = 0.0D; + } + else + { + par3 = (double)(-this.stepHeight); + + for (var30 = 0; var30 < var35.size(); ++var30) + { + par3 = ((AxisAlignedBB)var35.get(var30)).calculateYOffset(this.boundingBox, par3); + } + + this.boundingBox.offset(0.0D, par3, 0.0D); + } + + if (var37 * var37 + var27 * var27 >= par1 * par1 + par5 * par5) + { + par1 = var37; + par3 = var25; + par5 = var27; + this.boundingBox.setBB(var29); + } + } + + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("rest"); + this.posX = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; + this.posY = this.boundingBox.minY + (double)this.yOffset - (double)this.ySize; + this.posZ = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; + this.isCollidedHorizontally = var13 != par1 || var17 != par5; + this.isCollidedVertically = var15 != par3; + this.onGround = var15 != par3 && var15 < 0.0D; + this.isCollided = this.isCollidedHorizontally || this.isCollidedVertically; + this.updateFallState(par3, this.onGround); + + if (var13 != par1) + { + this.motionX = 0.0D; + } + + if (var15 != par3) + { + this.motionY = 0.0D; + } + + if (var17 != par5) + { + this.motionZ = 0.0D; + } + + var37 = this.posX - var7; + var25 = this.posY - var9; + var27 = this.posZ - var11; + + if (this.canTriggerWalking() && !var20 && this.ridingEntity == null) + { + int var38 = MathHelper.floor_double(this.posX); + var30 = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset); + int var31 = MathHelper.floor_double(this.posZ); + int var32 = this.worldObj.getBlockId(var38, var30, var31); + + if (var32 == 0) + { + int var33 = this.worldObj.blockGetRenderType(var38, var30 - 1, var31); + + if (var33 == 11 || var33 == 32 || var33 == 21) + { + var32 = this.worldObj.getBlockId(var38, var30 - 1, var31); + } + } + + if (var32 != Block.ladder.blockID) + { + var25 = 0.0D; + } + + this.distanceWalkedModified = (float)((double)this.distanceWalkedModified + (double)MathHelper.sqrt_double(var37 * var37 + var27 * var27) * 0.6D); + this.distanceWalkedOnStepModified = (float)((double)this.distanceWalkedOnStepModified + (double)MathHelper.sqrt_double(var37 * var37 + var25 * var25 + var27 * var27) * 0.6D); + + if (this.distanceWalkedOnStepModified > (float)this.nextStepDistance && var32 > 0) + { + this.nextStepDistance = (int)this.distanceWalkedOnStepModified + 1; + + if (this.isInWater()) + { + float var42 = MathHelper.sqrt_double(this.motionX * this.motionX * 0.20000000298023224D + this.motionY * this.motionY + this.motionZ * this.motionZ * 0.20000000298023224D) * 0.35F; + + if (var42 > 1.0F) + { + var42 = 1.0F; + } + + this.playSound("liquid.swim", var42, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + } + + this.playStepSound(var38, var30, var31, var32); + Block.blocksList[var32].onEntityWalking(this.worldObj, var38, var30, var31, this); + } + } + + try + { + this.doBlockCollisions(); + } + catch (Throwable var34) + { + CrashReport var41 = CrashReport.makeCrashReport(var34, "Checking entity tile collision"); + CrashReportCategory var40 = var41.makeCategory("Entity being checked for collision"); + this.addEntityCrashInfo(var40); + throw new ReportedException(var41); + } + + boolean var39 = this.isWet(); + + if (this.worldObj.isBoundingBoxBurning(this.boundingBox.contract(0.001D, 0.001D, 0.001D))) + { + this.dealFireDamage(1); + + if (!var39) + { + ++this.fire; + + if (this.fire == 0) + { + this.setFire(8); + } + } + } + else if (this.fire <= 0) + { + this.fire = -this.fireResistance; + } + + if (var39 && this.fire > 0) + { + this.playSound("random.fizz", 0.7F, 1.6F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + this.fire = -this.fireResistance; + } + + this.worldObj.theProfiler.endSection(); + } + } + + /** + * Checks for block collisions, and calls the associated onBlockCollided method for the collided block. + */ + protected void doBlockCollisions() + { + int var1 = MathHelper.floor_double(this.boundingBox.minX + 0.001D); + int var2 = MathHelper.floor_double(this.boundingBox.minY + 0.001D); + int var3 = MathHelper.floor_double(this.boundingBox.minZ + 0.001D); + int var4 = MathHelper.floor_double(this.boundingBox.maxX - 0.001D); + int var5 = MathHelper.floor_double(this.boundingBox.maxY - 0.001D); + int var6 = MathHelper.floor_double(this.boundingBox.maxZ - 0.001D); + + if (this.worldObj.checkChunksExist(var1, var2, var3, var4, var5, var6)) + { + for (int var7 = var1; var7 <= var4; ++var7) + { + for (int var8 = var2; var8 <= var5; ++var8) + { + for (int var9 = var3; var9 <= var6; ++var9) + { + int var10 = this.worldObj.getBlockId(var7, var8, var9); + + if (var10 > 0) + { + try + { + Block.blocksList[var10].onEntityCollidedWithBlock(this.worldObj, var7, var8, var9, this); + } + catch (Throwable var14) + { + CrashReport var12 = CrashReport.makeCrashReport(var14, "Colliding entity with tile"); + CrashReportCategory var13 = var12.makeCategory("Tile being collided with"); + CrashReportCategory.addBlockCrashInfo(var13, var7, var8, var9, var10, this.worldObj.getBlockMetadata(var7, var8, var9)); + throw new ReportedException(var12); + } + } + } + } + } + } + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + StepSound var5 = Block.blocksList[par4].stepSound; + + if (this.worldObj.getBlockId(par1, par2 + 1, par3) == Block.snow.blockID) + { + var5 = Block.snow.stepSound; + this.playSound(var5.getStepSound(), var5.getVolume() * 0.15F, var5.getPitch()); + } + else if (!Block.blocksList[par4].blockMaterial.isLiquid()) + { + this.playSound(var5.getStepSound(), var5.getVolume() * 0.15F, var5.getPitch()); + } + } + + public void playSound(String par1Str, float par2, float par3) + { + this.worldObj.playSoundAtEntity(this, par1Str, par2, par3); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return true; + } + + /** + * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance + * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround + */ + protected void updateFallState(double par1, boolean par3) + { + if (par3) + { + if (this.fallDistance > 0.0F) + { + this.fall(this.fallDistance); + this.fallDistance = 0.0F; + } + } + else if (par1 < 0.0D) + { + this.fallDistance = (float)((double)this.fallDistance - par1); + } + } + + /** + * returns the bounding box for this entity + */ + public AxisAlignedBB getBoundingBox() + { + return null; + } + + /** + * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args: + * amountDamage + */ + protected void dealFireDamage(int par1) + { + if (!this.isImmuneToFire) + { + this.attackEntityFrom(DamageSource.inFire, (float)par1); + } + } + + public final boolean isImmuneToFire() + { + return this.isImmuneToFire; + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) + { + if (this.riddenByEntity != null) + { + this.riddenByEntity.fall(par1); + } + } + + /** + * Checks if this entity is either in water or on an open air block in rain (used in wolves). + */ + public boolean isWet() + { + return this.inWater || this.worldObj.canLightningStrikeAt(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) || this.worldObj.canLightningStrikeAt(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY + (double)this.height), MathHelper.floor_double(this.posZ)); + } + + /** + * Checks if this entity is inside water (if inWater field is true as a result of handleWaterMovement() returning + * true) + */ + public boolean isInWater() + { + return this.inWater; + } + + /** + * Returns if this entity is in water and will end up adding the waters velocity to the entity + */ + public boolean handleWaterMovement() + { + if (this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, -0.4000000059604645D, 0.0D).contract(0.001D, 0.001D, 0.001D), Material.water, this)) + { + if (!this.inWater && !this.firstUpdate) + { + float var1 = MathHelper.sqrt_double(this.motionX * this.motionX * 0.20000000298023224D + this.motionY * this.motionY + this.motionZ * this.motionZ * 0.20000000298023224D) * 0.2F; + + if (var1 > 1.0F) + { + var1 = 1.0F; + } + + this.playSound("liquid.splash", var1, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + float var2 = (float)MathHelper.floor_double(this.boundingBox.minY); + int var3; + float var4; + float var5; + + for (var3 = 0; (float)var3 < 1.0F + this.width * 20.0F; ++var3) + { + var4 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + var5 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("bubble", this.posX + (double)var4, (double)(var2 + 1.0F), this.posZ + (double)var5, this.motionX, this.motionY - (double)(this.rand.nextFloat() * 0.2F), this.motionZ); + } + + for (var3 = 0; (float)var3 < 1.0F + this.width * 20.0F; ++var3) + { + var4 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + var5 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("splash", this.posX + (double)var4, (double)(var2 + 1.0F), this.posZ + (double)var5, this.motionX, this.motionY, this.motionZ); + } + } + + this.fallDistance = 0.0F; + this.inWater = true; + this.fire = 0; + } + else + { + this.inWater = false; + } + + return this.inWater; + } + + /** + * Checks if the current block the entity is within of the specified material type + */ + public boolean isInsideOfMaterial(Material par1Material) + { + double var2 = this.posY + (double)this.getEyeHeight(); + int var4 = MathHelper.floor_double(this.posX); + int var5 = MathHelper.floor_float((float)MathHelper.floor_double(var2)); + int var6 = MathHelper.floor_double(this.posZ); + int var7 = this.worldObj.getBlockId(var4, var5, var6); + + if (var7 != 0 && Block.blocksList[var7].blockMaterial == par1Material) + { + float var8 = BlockFluid.getFluidHeightPercent(this.worldObj.getBlockMetadata(var4, var5, var6)) - 0.11111111F; + float var9 = (float)(var5 + 1) - var8; + return var2 < (double)var9; + } + else + { + return false; + } + } + + public float getEyeHeight() + { + return 0.0F; + } + + /** + * Whether or not the current entity is in lava + */ + public boolean handleLavaMovement() + { + return this.worldObj.isMaterialInBB(this.boundingBox.expand(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.lava); + } + + /** + * Used in both water and by flying objects + */ + public void moveFlying(float par1, float par2, float par3) + { + float var4 = par1 * par1 + par2 * par2; + + if (var4 >= 1.0E-4F) + { + var4 = MathHelper.sqrt_float(var4); + + if (var4 < 1.0F) + { + var4 = 1.0F; + } + + var4 = par3 / var4; + par1 *= var4; + par2 *= var4; + float var5 = MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F); + float var6 = MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F); + this.motionX += (double)(par1 * var6 - par2 * var5); + this.motionZ += (double)(par2 * var6 + par1 * var5); + } + } + + public int getBrightnessForRender(float par1) + { + int var2 = MathHelper.floor_double(this.posX); + int var3 = MathHelper.floor_double(this.posZ); + + if (this.worldObj.blockExists(var2, 0, var3)) + { + double var4 = (this.boundingBox.maxY - this.boundingBox.minY) * 0.66D; + int var6 = MathHelper.floor_double(this.posY - (double)this.yOffset + var4); + return this.worldObj.getLightBrightnessForSkyBlocks(var2, var6, var3, 0); + } + else + { + return 0; + } + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + int var2 = MathHelper.floor_double(this.posX); + int var3 = MathHelper.floor_double(this.posZ); + + if (this.worldObj.blockExists(var2, 0, var3)) + { + double var4 = (this.boundingBox.maxY - this.boundingBox.minY) * 0.66D; + int var6 = MathHelper.floor_double(this.posY - (double)this.yOffset + var4); + return this.worldObj.getLightBrightness(var2, var6, var3); + } + else + { + return 0.0F; + } + } + + /** + * Sets the reference to the World object. + */ + public void setWorld(World par1World) + { + this.worldObj = par1World; + } + + /** + * Sets the entity's position and rotation. Args: posX, posY, posZ, yaw, pitch + */ + public void setPositionAndRotation(double par1, double par3, double par5, float par7, float par8) + { + this.prevPosX = this.posX = par1; + this.prevPosY = this.posY = par3; + this.prevPosZ = this.posZ = par5; + this.prevRotationYaw = this.rotationYaw = par7; + this.prevRotationPitch = this.rotationPitch = par8; + this.ySize = 0.0F; + double var9 = (double)(this.prevRotationYaw - par7); + + if (var9 < -180.0D) + { + this.prevRotationYaw += 360.0F; + } + + if (var9 >= 180.0D) + { + this.prevRotationYaw -= 360.0F; + } + + this.setPosition(this.posX, this.posY, this.posZ); + this.setRotation(par7, par8); + } + + /** + * Sets the location and Yaw/Pitch of an entity in the world + */ + public void setLocationAndAngles(double par1, double par3, double par5, float par7, float par8) + { + this.lastTickPosX = this.prevPosX = this.posX = par1; + this.lastTickPosY = this.prevPosY = this.posY = par3 + (double)this.yOffset; + this.lastTickPosZ = this.prevPosZ = this.posZ = par5; + this.rotationYaw = par7; + this.rotationPitch = par8; + this.setPosition(this.posX, this.posY, this.posZ); + } + + /** + * Returns the distance to the entity. Args: entity + */ + public float getDistanceToEntity(Entity par1Entity) + { + float var2 = (float)(this.posX - par1Entity.posX); + float var3 = (float)(this.posY - par1Entity.posY); + float var4 = (float)(this.posZ - par1Entity.posZ); + return MathHelper.sqrt_float(var2 * var2 + var3 * var3 + var4 * var4); + } + + /** + * Gets the squared distance to the position. Args: x, y, z + */ + public double getDistanceSq(double par1, double par3, double par5) + { + double var7 = this.posX - par1; + double var9 = this.posY - par3; + double var11 = this.posZ - par5; + return var7 * var7 + var9 * var9 + var11 * var11; + } + + /** + * Gets the distance to the position. Args: x, y, z + */ + public double getDistance(double par1, double par3, double par5) + { + double var7 = this.posX - par1; + double var9 = this.posY - par3; + double var11 = this.posZ - par5; + return (double)MathHelper.sqrt_double(var7 * var7 + var9 * var9 + var11 * var11); + } + + /** + * Returns the squared distance to the entity. Args: entity + */ + public double getDistanceSqToEntity(Entity par1Entity) + { + double var2 = this.posX - par1Entity.posX; + double var4 = this.posY - par1Entity.posY; + double var6 = this.posZ - par1Entity.posZ; + return var2 * var2 + var4 * var4 + var6 * var6; + } + + /** + * Called by a player entity when they collide with an entity + */ + public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) {} + + /** + * Applies a velocity to each of the entities pushing them away from each other. Args: entity + */ + public void applyEntityCollision(Entity par1Entity) + { + if (par1Entity.riddenByEntity != this && par1Entity.ridingEntity != this) + { + double var2 = par1Entity.posX - this.posX; + double var4 = par1Entity.posZ - this.posZ; + double var6 = MathHelper.abs_max(var2, var4); + + if (var6 >= 0.009999999776482582D) + { + var6 = (double)MathHelper.sqrt_double(var6); + var2 /= var6; + var4 /= var6; + double var8 = 1.0D / var6; + + if (var8 > 1.0D) + { + var8 = 1.0D; + } + + var2 *= var8; + var4 *= var8; + var2 *= 0.05000000074505806D; + var4 *= 0.05000000074505806D; + var2 *= (double)(1.0F - this.entityCollisionReduction); + var4 *= (double)(1.0F - this.entityCollisionReduction); + this.addVelocity(-var2, 0.0D, -var4); + par1Entity.addVelocity(var2, 0.0D, var4); + } + } + } + + /** + * Adds to the current velocity of the entity. Args: x, y, z + */ + public void addVelocity(double par1, double par3, double par5) + { + this.motionX += par1; + this.motionY += par3; + this.motionZ += par5; + this.isAirBorne = true; + } + + /** + * Sets that this entity has been attacked. + */ + protected void setBeenAttacked() + { + this.velocityChanged = true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + this.setBeenAttacked(); + return false; + } + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return false; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return false; + } + + /** + * Adds a value to the player score. Currently not actually used and the entity passed in does nothing. Args: + * entity, scoreToAdd + */ + public void addToPlayerScore(Entity par1Entity, int par2) {} + + /** + * Checks using a Vec3d to determine if this entity is within range of that vector to be rendered. Args: vec3D + */ + public boolean isInRangeToRenderVec3D(Vec3 par1Vec3) + { + double var2 = this.posX - par1Vec3.xCoord; + double var4 = this.posY - par1Vec3.yCoord; + double var6 = this.posZ - par1Vec3.zCoord; + double var8 = var2 * var2 + var4 * var4 + var6 * var6; + return this.isInRangeToRenderDist(var8); + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double par1) + { + double var3 = this.boundingBox.getAverageEdgeLength(); + var3 *= 64.0D * this.renderDistanceWeight; + return par1 < var3 * var3; + } + + /** + * Like writeToNBTOptional but does not check if the entity is ridden. Used for saving ridden entities with their + * riders. + */ + public boolean writeMountToNBT(NBTTagCompound par1NBTTagCompound) + { + String var2 = this.getEntityString(); + + if (!this.isDead && var2 != null) + { + par1NBTTagCompound.setString("id", var2); + this.writeToNBT(par1NBTTagCompound); + return true; + } + else + { + return false; + } + } + + /** + * Either write this entity to the NBT tag given and return true, or return false without doing anything. If this + * returns false the entity is not saved on disk. Ridden entities return false here as they are saved with their + * rider. + */ + public boolean writeToNBTOptional(NBTTagCompound par1NBTTagCompound) + { + String var2 = this.getEntityString(); + + if (!this.isDead && var2 != null && this.riddenByEntity == null) + { + par1NBTTagCompound.setString("id", var2); + this.writeToNBT(par1NBTTagCompound); + return true; + } + else + { + return false; + } + } + + /** + * Save the entity to NBT (calls an abstract helper method to write extra data) + */ + public void writeToNBT(NBTTagCompound par1NBTTagCompound) + { + try + { + par1NBTTagCompound.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ})); + par1NBTTagCompound.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ})); + par1NBTTagCompound.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch})); + par1NBTTagCompound.setFloat("FallDistance", this.fallDistance); + par1NBTTagCompound.setShort("Fire", (short)this.fire); + par1NBTTagCompound.setShort("Air", (short)this.getAir()); + par1NBTTagCompound.setBoolean("OnGround", this.onGround); + par1NBTTagCompound.setInteger("Dimension", this.dimension); + par1NBTTagCompound.setBoolean("Invulnerable", this.invulnerable); + par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal); + par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits()); + par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits()); + this.writeEntityToNBT(par1NBTTagCompound); + + if (this.ridingEntity != null) + { + NBTTagCompound var2 = new NBTTagCompound("Riding"); + + if (this.ridingEntity.writeMountToNBT(var2)) + { + par1NBTTagCompound.setTag("Riding", var2); + } + } + } + catch (Throwable var5) + { + CrashReport var3 = CrashReport.makeCrashReport(var5, "Saving entity NBT"); + CrashReportCategory var4 = var3.makeCategory("Entity being saved"); + this.addEntityCrashInfo(var4); + throw new ReportedException(var3); + } + } + + /** + * Reads the entity from NBT (calls an abstract helper method to read specialized data) + */ + public void readFromNBT(NBTTagCompound par1NBTTagCompound) + { + try + { + NBTTagList var2 = par1NBTTagCompound.getTagList("Pos"); + NBTTagList var6 = par1NBTTagCompound.getTagList("Motion"); + NBTTagList var7 = par1NBTTagCompound.getTagList("Rotation"); + this.motionX = ((NBTTagDouble)var6.tagAt(0)).data; + this.motionY = ((NBTTagDouble)var6.tagAt(1)).data; + this.motionZ = ((NBTTagDouble)var6.tagAt(2)).data; + + if (Math.abs(this.motionX) > 10.0D) + { + this.motionX = 0.0D; + } + + if (Math.abs(this.motionY) > 10.0D) + { + this.motionY = 0.0D; + } + + if (Math.abs(this.motionZ) > 10.0D) + { + this.motionZ = 0.0D; + } + + this.prevPosX = this.lastTickPosX = this.posX = ((NBTTagDouble)var2.tagAt(0)).data; + this.prevPosY = this.lastTickPosY = this.posY = ((NBTTagDouble)var2.tagAt(1)).data; + this.prevPosZ = this.lastTickPosZ = this.posZ = ((NBTTagDouble)var2.tagAt(2)).data; + this.prevRotationYaw = this.rotationYaw = ((NBTTagFloat)var7.tagAt(0)).data; + this.prevRotationPitch = this.rotationPitch = ((NBTTagFloat)var7.tagAt(1)).data; + this.fallDistance = par1NBTTagCompound.getFloat("FallDistance"); + this.fire = par1NBTTagCompound.getShort("Fire"); + this.setAir(par1NBTTagCompound.getShort("Air")); + this.onGround = par1NBTTagCompound.getBoolean("OnGround"); + this.dimension = par1NBTTagCompound.getInteger("Dimension"); + this.invulnerable = par1NBTTagCompound.getBoolean("Invulnerable"); + this.timeUntilPortal = par1NBTTagCompound.getInteger("PortalCooldown"); + + if (par1NBTTagCompound.hasKey("UUIDMost") && par1NBTTagCompound.hasKey("UUIDLeast")) + { + this.entityUniqueID = new UUID(par1NBTTagCompound.getLong("UUIDMost"), par1NBTTagCompound.getLong("UUIDLeast")); + } + + this.setPosition(this.posX, this.posY, this.posZ); + this.setRotation(this.rotationYaw, this.rotationPitch); + this.readEntityFromNBT(par1NBTTagCompound); + + if (this.shouldSetPosAfterLoading()) + { + this.setPosition(this.posX, this.posY, this.posZ); + } + } + catch (Throwable var5) + { + CrashReport var3 = CrashReport.makeCrashReport(var5, "Loading entity NBT"); + CrashReportCategory var4 = var3.makeCategory("Entity being loaded"); + this.addEntityCrashInfo(var4); + throw new ReportedException(var3); + } + } + + protected boolean shouldSetPosAfterLoading() + { + return true; + } + + /** + * Returns the string that identifies this Entity's class + */ + protected final String getEntityString() + { + return EntityList.getEntityString(this); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected abstract void readEntityFromNBT(NBTTagCompound var1); + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected abstract void writeEntityToNBT(NBTTagCompound var1); + + public void onChunkLoad() {} + + /** + * creates a NBT list from the array of doubles passed to this function + */ + protected NBTTagList newDoubleNBTList(double ... par1ArrayOfDouble) + { + NBTTagList var2 = new NBTTagList(); + double[] var3 = par1ArrayOfDouble; + int var4 = par1ArrayOfDouble.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + double var6 = var3[var5]; + var2.appendTag(new NBTTagDouble((String)null, var6)); + } + + return var2; + } + + /** + * Returns a new NBTTagList filled with the specified floats + */ + protected NBTTagList newFloatNBTList(float ... par1ArrayOfFloat) + { + NBTTagList var2 = new NBTTagList(); + float[] var3 = par1ArrayOfFloat; + int var4 = par1ArrayOfFloat.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + float var6 = var3[var5]; + var2.appendTag(new NBTTagFloat((String)null, var6)); + } + + return var2; + } + + public float getShadowSize() + { + return this.height / 2.0F; + } + + /** + * Drops an item stack at the entity's position. Args: itemID, count + */ + public EntityItem dropItem(int par1, int par2) + { + return this.dropItemWithOffset(par1, par2, 0.0F); + } + + /** + * Drops an item stack with a specified y offset. Args: itemID, count, yOffset + */ + public EntityItem dropItemWithOffset(int par1, int par2, float par3) + { + return this.entityDropItem(new ItemStack(par1, par2, 0), par3); + } + + /** + * Drops an item at the position of the entity. + */ + public EntityItem entityDropItem(ItemStack par1ItemStack, float par2) + { + if (par1ItemStack.stackSize == 0) + { + return null; + } + else + { + EntityItem var3 = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack); + var3.delayBeforeCanPickup = 10; + this.worldObj.spawnEntityInWorld(var3); + return var3; + } + } + + /** + * Checks whether target entity is alive. + */ + public boolean isEntityAlive() + { + return !this.isDead; + } + + /** + * Checks if this entity is inside of an opaque block + */ + public boolean isEntityInsideOpaqueBlock() + { + for (int var1 = 0; var1 < 8; ++var1) + { + float var2 = ((float)((var1 >> 0) % 2) - 0.5F) * this.width * 0.8F; + float var3 = ((float)((var1 >> 1) % 2) - 0.5F) * 0.1F; + float var4 = ((float)((var1 >> 2) % 2) - 0.5F) * this.width * 0.8F; + int var5 = MathHelper.floor_double(this.posX + (double)var2); + int var6 = MathHelper.floor_double(this.posY + (double)this.getEyeHeight() + (double)var3); + int var7 = MathHelper.floor_double(this.posZ + (double)var4); + + if (this.worldObj.isBlockNormalCube(var5, var6, var7)) + { + return true; + } + } + + return false; + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer par1EntityPlayer) + { + return false; + } + + /** + * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be + * pushable on contact, like boats or minecarts. + */ + public AxisAlignedBB getCollisionBox(Entity par1Entity) + { + return null; + } + + /** + * Handles updating while being ridden by an entity + */ + public void updateRidden() + { + if (this.ridingEntity.isDead) + { + this.ridingEntity = null; + } + else + { + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.onUpdate(); + + if (this.ridingEntity != null) + { + this.ridingEntity.updateRiderPosition(); + this.entityRiderYawDelta += (double)(this.ridingEntity.rotationYaw - this.ridingEntity.prevRotationYaw); + + for (this.entityRiderPitchDelta += (double)(this.ridingEntity.rotationPitch - this.ridingEntity.prevRotationPitch); this.entityRiderYawDelta >= 180.0D; this.entityRiderYawDelta -= 360.0D) + { + ; + } + + while (this.entityRiderYawDelta < -180.0D) + { + this.entityRiderYawDelta += 360.0D; + } + + while (this.entityRiderPitchDelta >= 180.0D) + { + this.entityRiderPitchDelta -= 360.0D; + } + + while (this.entityRiderPitchDelta < -180.0D) + { + this.entityRiderPitchDelta += 360.0D; + } + + double var1 = this.entityRiderYawDelta * 0.5D; + double var3 = this.entityRiderPitchDelta * 0.5D; + float var5 = 10.0F; + + if (var1 > (double)var5) + { + var1 = (double)var5; + } + + if (var1 < (double)(-var5)) + { + var1 = (double)(-var5); + } + + if (var3 > (double)var5) + { + var3 = (double)var5; + } + + if (var3 < (double)(-var5)) + { + var3 = (double)(-var5); + } + + this.entityRiderYawDelta -= var1; + this.entityRiderPitchDelta -= var3; + } + } + } + + public void updateRiderPosition() + { + if (this.riddenByEntity != null) + { + this.riddenByEntity.setPosition(this.posX, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ); + } + } + + /** + * Returns the Y Offset of this entity. + */ + public double getYOffset() + { + return (double)this.yOffset; + } + + /** + * Returns the Y offset from the entity's position for any entity riding this one. + */ + public double getMountedYOffset() + { + return (double)this.height * 0.75D; + } + + /** + * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. + */ + public void mountEntity(Entity par1Entity) + { + this.entityRiderPitchDelta = 0.0D; + this.entityRiderYawDelta = 0.0D; + + if (par1Entity == null) + { + if (this.ridingEntity != null) + { + this.setLocationAndAngles(this.ridingEntity.posX, this.ridingEntity.boundingBox.minY + (double)this.ridingEntity.height, this.ridingEntity.posZ, this.rotationYaw, this.rotationPitch); + this.ridingEntity.riddenByEntity = null; + } + + this.ridingEntity = null; + } + else + { + if (this.ridingEntity != null) + { + this.ridingEntity.riddenByEntity = null; + } + + this.ridingEntity = par1Entity; + par1Entity.riddenByEntity = this; + } + } + + /** + * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, + * posY, posZ, yaw, pitch + */ + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) + { + this.setPosition(par1, par3, par5); + this.setRotation(par7, par8); + List var10 = this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox.contract(0.03125D, 0.0D, 0.03125D)); + + if (!var10.isEmpty()) + { + double var11 = 0.0D; + + for (int var13 = 0; var13 < var10.size(); ++var13) + { + AxisAlignedBB var14 = (AxisAlignedBB)var10.get(var13); + + if (var14.maxY > var11) + { + var11 = var14.maxY; + } + } + + par3 += var11 - this.boundingBox.minY; + this.setPosition(par1, par3, par5); + } + } + + public float getCollisionBorderSize() + { + return 0.1F; + } + + /** + * returns a (normalized) vector of where this entity is looking + */ + public Vec3 getLookVec() + { + return null; + } + + /** + * Called by portal blocks when an entity is within it. + */ + public void setInPortal() + { + if (this.timeUntilPortal > 0) + { + this.timeUntilPortal = this.getPortalCooldown(); + } + else + { + double var1 = this.prevPosX - this.posX; + double var3 = this.prevPosZ - this.posZ; + + if (!this.worldObj.isRemote && !this.inPortal) + { + this.teleportDirection = Direction.getMovementDirection(var1, var3); + } + + this.inPortal = true; + } + } + + /** + * Return the amount of cooldown before this entity can use a portal again. + */ + public int getPortalCooldown() + { + return 900; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double par1, double par3, double par5) + { + this.motionX = par1; + this.motionY = par3; + this.motionZ = par5; + } + + public void handleHealthUpdate(byte par1) {} + + /** + * Setups the entity to do the hurt animation. Only used by packets in multiplayer. + */ + public void performHurtAnimation() {} + + public ItemStack[] getLastActiveItems() + { + return null; + } + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) {} + + /** + * Returns true if the entity is on fire. Used by render to add the fire effect on rendering. + */ + public boolean isBurning() + { + return !this.isImmuneToFire && (this.fire > 0 || this.getFlag(0)); + } + + /** + * Returns true if the entity is riding another entity, used by render to rotate the legs to be in 'sit' position + * for players. + */ + public boolean isRiding() + { + return this.ridingEntity != null; + } + + /** + * Returns if this entity is sneaking. + */ + public boolean isSneaking() + { + return this.getFlag(1); + } + + /** + * Sets the sneaking flag. + */ + public void setSneaking(boolean par1) + { + this.setFlag(1, par1); + } + + /** + * Get if the Entity is sprinting. + */ + public boolean isSprinting() + { + return this.getFlag(3); + } + + /** + * Set sprinting switch for Entity. + */ + public void setSprinting(boolean par1) + { + this.setFlag(3, par1); + } + + public boolean isInvisible() + { + return this.getFlag(5); + } + + /** + * Only used by renderer in EntityLivingBase subclasses.\nDetermines if an entity is visible or not to a specfic + * player, if the entity is normally invisible.\nFor EntityLivingBase subclasses, returning false when invisible + * will render the entity semitransparent. + */ + public boolean isInvisibleToPlayer(EntityPlayer par1EntityPlayer) + { + return this.isInvisible(); + } + + public void setInvisible(boolean par1) + { + this.setFlag(5, par1); + } + + public boolean isEating() + { + return this.getFlag(4); + } + + public void setEating(boolean par1) + { + this.setFlag(4, par1); + } + + /** + * Returns true if the flag is active for the entity. Known flags: 0) is burning; 1) is sneaking; 2) is riding + * something; 3) is sprinting; 4) is eating + */ + protected boolean getFlag(int par1) + { + return (this.dataWatcher.getWatchableObjectByte(0) & 1 << par1) != 0; + } + + /** + * Enable or disable a entity flag, see getEntityFlag to read the know flags. + */ + protected void setFlag(int par1, boolean par2) + { + byte var3 = this.dataWatcher.getWatchableObjectByte(0); + + if (par2) + { + this.dataWatcher.updateObject(0, Byte.valueOf((byte)(var3 | 1 << par1))); + } + else + { + this.dataWatcher.updateObject(0, Byte.valueOf((byte)(var3 & ~(1 << par1)))); + } + } + + public int getAir() + { + return this.dataWatcher.getWatchableObjectShort(1); + } + + public void setAir(int par1) + { + this.dataWatcher.updateObject(1, Short.valueOf((short)par1)); + } + + /** + * Called when a lightning bolt hits the entity. + */ + public void onStruckByLightning(EntityLightningBolt par1EntityLightningBolt) + { + this.dealFireDamage(5); + ++this.fire; + + if (this.fire == 0) + { + this.setFire(8); + } + } + + /** + * This method gets called when the entity kills another one. + */ + public void onKillEntity(EntityLivingBase par1EntityLivingBase) {} + + /** + * Adds velocity to push the entity out of blocks at the specified x, y, z position Args: x, y, z + */ + protected boolean pushOutOfBlocks(double par1, double par3, double par5) + { + int var7 = MathHelper.floor_double(par1); + int var8 = MathHelper.floor_double(par3); + int var9 = MathHelper.floor_double(par5); + double var10 = par1 - (double)var7; + double var12 = par3 - (double)var8; + double var14 = par5 - (double)var9; + List var16 = this.worldObj.getCollidingBlockBounds(this.boundingBox); + + if (var16.isEmpty() && !this.worldObj.isBlockFullCube(var7, var8, var9)) + { + return false; + } + else + { + boolean var17 = !this.worldObj.isBlockFullCube(var7 - 1, var8, var9); + boolean var18 = !this.worldObj.isBlockFullCube(var7 + 1, var8, var9); + boolean var19 = !this.worldObj.isBlockFullCube(var7, var8 - 1, var9); + boolean var20 = !this.worldObj.isBlockFullCube(var7, var8 + 1, var9); + boolean var21 = !this.worldObj.isBlockFullCube(var7, var8, var9 - 1); + boolean var22 = !this.worldObj.isBlockFullCube(var7, var8, var9 + 1); + byte var23 = 3; + double var24 = 9999.0D; + + if (var17 && var10 < var24) + { + var24 = var10; + var23 = 0; + } + + if (var18 && 1.0D - var10 < var24) + { + var24 = 1.0D - var10; + var23 = 1; + } + + if (var20 && 1.0D - var12 < var24) + { + var24 = 1.0D - var12; + var23 = 3; + } + + if (var21 && var14 < var24) + { + var24 = var14; + var23 = 4; + } + + if (var22 && 1.0D - var14 < var24) + { + var24 = 1.0D - var14; + var23 = 5; + } + + float var26 = this.rand.nextFloat() * 0.2F + 0.1F; + + if (var23 == 0) + { + this.motionX = (double)(-var26); + } + + if (var23 == 1) + { + this.motionX = (double)var26; + } + + if (var23 == 2) + { + this.motionY = (double)(-var26); + } + + if (var23 == 3) + { + this.motionY = (double)var26; + } + + if (var23 == 4) + { + this.motionZ = (double)(-var26); + } + + if (var23 == 5) + { + this.motionZ = (double)var26; + } + + return true; + } + } + + /** + * Sets the Entity inside a web block. + */ + public void setInWeb() + { + this.isInWeb = true; + this.fallDistance = 0.0F; + } + + /** + * Gets the username of the entity. + */ + public String getEntityName() + { + String var1 = EntityList.getEntityString(this); + + if (var1 == null) + { + var1 = "generic"; + } + + return StatCollector.translateToLocal("entity." + var1 + ".name"); + } + + /** + * Return the Entity parts making up this Entity (currently only for dragons) + */ + public Entity[] getParts() + { + return null; + } + + /** + * Returns true if Entity argument is equal to this Entity + */ + public boolean isEntityEqual(Entity par1Entity) + { + return this == par1Entity; + } + + public float getRotationYawHead() + { + return 0.0F; + } + + /** + * Sets the head's yaw rotation of the entity. + */ + public void setRotationYawHead(float par1) {} + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return true; + } + + /** + * Called when a player attacks an entity. If this returns true the attack will not happen. + */ + public boolean hitByEntity(Entity par1Entity) + { + return false; + } + + public String toString() + { + return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] {this.getClass().getSimpleName(), this.getEntityName(), Integer.valueOf(this.entityId), this.worldObj == null ? "~NULL~" : this.worldObj.getWorldInfo().getWorldName(), Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ)}); + } + + /** + * Return whether this entity is invulnerable to damage. + */ + public boolean isEntityInvulnerable() + { + return this.invulnerable; + } + + /** + * Sets this entity's location and angles to the location and angles of the passed in entity. + */ + public void copyLocationAndAnglesFrom(Entity par1Entity) + { + this.setLocationAndAngles(par1Entity.posX, par1Entity.posY, par1Entity.posZ, par1Entity.rotationYaw, par1Entity.rotationPitch); + } + + /** + * Copies important data from another entity to this entity. Used when teleporting entities between worlds, as this + * actually deletes the teleporting entity and re-creates it on the other side. Params: Entity to copy from, unused + * (always true) + */ + public void copyDataFrom(Entity par1Entity, boolean par2) + { + NBTTagCompound var3 = new NBTTagCompound(); + par1Entity.writeToNBT(var3); + this.readFromNBT(var3); + this.timeUntilPortal = par1Entity.timeUntilPortal; + this.teleportDirection = par1Entity.teleportDirection; + } + + /** + * Teleports the entity to another dimension. Params: Dimension number to teleport to + */ + public void travelToDimension(int par1) + { + if (!this.worldObj.isRemote && !this.isDead) + { + this.worldObj.theProfiler.startSection("changeDimension"); + MinecraftServer var2 = MinecraftServer.getServer(); + int var3 = this.dimension; + WorldServer var4 = var2.worldServerForDimension(var3); + WorldServer var5 = var2.worldServerForDimension(par1); + this.dimension = par1; + + if (var3 == 1 && par1 == 1) + { + var5 = var2.worldServerForDimension(0); + this.dimension = 0; + } + + this.worldObj.removeEntity(this); + this.isDead = false; + this.worldObj.theProfiler.startSection("reposition"); + var2.getConfigurationManager().transferEntityToWorld(this, var3, var4, var5); + this.worldObj.theProfiler.endStartSection("reloading"); + Entity var6 = EntityList.createEntityByName(EntityList.getEntityString(this), var5); + + if (var6 != null) + { + var6.copyDataFrom(this, true); + + if (var3 == 1 && par1 == 1) + { + ChunkCoordinates var7 = var5.getSpawnPoint(); + var7.posY = this.worldObj.getTopSolidOrLiquidBlock(var7.posX, var7.posZ); + var6.setLocationAndAngles((double)var7.posX, (double)var7.posY, (double)var7.posZ, var6.rotationYaw, var6.rotationPitch); + } + + var5.spawnEntityInWorld(var6); + } + + this.isDead = true; + this.worldObj.theProfiler.endSection(); + var4.resetUpdateEntityTick(); + var5.resetUpdateEntityTick(); + this.worldObj.theProfiler.endSection(); + } + } + + /** + * Gets a block's resistance to this entity's explosion. Used to make rails immune to TNT minecarts' explosions and + * Wither skulls more destructive. + */ + public float getBlockExplosionResistance(Explosion par1Explosion, World par2World, int par3, int par4, int par5, Block par6Block) + { + return par6Block.getExplosionResistance(this); + } + + public boolean shouldExplodeBlock(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7) + { + return true; + } + + /** + * The number of iterations PathFinder.getSafePoint will execute before giving up. + */ + public int getMaxSafePointTries() + { + return 3; + } + + public int getTeleportDirection() + { + return this.teleportDirection; + } + + /** + * Return whether this entity should NOT trigger a pressure plate or a tripwire. + */ + public boolean doesEntityNotTriggerPressurePlate() + { + return false; + } + + public void addEntityCrashInfo(CrashReportCategory par1CrashReportCategory) + { + par1CrashReportCategory.addCrashSectionCallable("Entity Type", new CallableEntityType(this)); + par1CrashReportCategory.addCrashSection("Entity ID", Integer.valueOf(this.entityId)); + par1CrashReportCategory.addCrashSectionCallable("Entity Name", new CallableEntityName(this)); + par1CrashReportCategory.addCrashSection("Entity\'s Exact location", String.format("%.2f, %.2f, %.2f", new Object[] {Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ)})); + par1CrashReportCategory.addCrashSection("Entity\'s Block location", CrashReportCategory.getLocationInfo(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))); + par1CrashReportCategory.addCrashSection("Entity\'s Momentum", String.format("%.2f, %.2f, %.2f", new Object[] {Double.valueOf(this.motionX), Double.valueOf(this.motionY), Double.valueOf(this.motionZ)})); + } + + /** + * Return whether this entity should be rendered as on fire. + */ + public boolean canRenderOnFire() + { + return this.isBurning(); + } + + public UUID getUniqueID() + { + return this.entityUniqueID; + } + + public boolean isPushedByWater() + { + return true; + } + + /** + * Returns the translated name of the entity. + */ + public String getTranslatedEntityName() + { + return this.getEntityName(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIArrowAttack.java b/src/main/java/net/minecraft/src/EntityAIArrowAttack.java new file mode 100644 index 0000000..5c8743d --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIArrowAttack.java @@ -0,0 +1,150 @@ +package net.minecraft.src; + +public class EntityAIArrowAttack extends EntityAIBase +{ + /** The entity the AI instance has been applied to */ + private final EntityLiving entityHost; + + /** + * The entity (as a RangedAttackMob) the AI instance has been applied to. + */ + private final IRangedAttackMob rangedAttackEntityHost; + private EntityLivingBase attackTarget; + + /** + * A decrementing tick that spawns a ranged attack once this value reaches 0. It is then set back to the + * maxRangedAttackTime. + */ + private int rangedAttackTime; + private double entityMoveSpeed; + private int field_75318_f; + private int field_96561_g; + + /** + * The maximum time the AI has to wait before peforming another ranged attack. + */ + private int maxRangedAttackTime; + private float field_96562_i; + private float field_82642_h; + + public EntityAIArrowAttack(IRangedAttackMob par1IRangedAttackMob, double par2, int par4, float par5) + { + this(par1IRangedAttackMob, par2, par4, par4, par5); + } + + public EntityAIArrowAttack(IRangedAttackMob par1IRangedAttackMob, double par2, int par4, int par5, float par6) + { + this.rangedAttackTime = -1; + + if (!(par1IRangedAttackMob instanceof EntityLivingBase)) + { + throw new IllegalArgumentException("ArrowAttackGoal requires Mob implements RangedAttackMob"); + } + else + { + this.rangedAttackEntityHost = par1IRangedAttackMob; + this.entityHost = (EntityLiving)par1IRangedAttackMob; + this.entityMoveSpeed = par2; + this.field_96561_g = par4; + this.maxRangedAttackTime = par5; + this.field_96562_i = par6; + this.field_82642_h = par6 * par6; + this.setMutexBits(3); + } + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase var1 = this.entityHost.getAttackTarget(); + + if (var1 == null) + { + return false; + } + else + { + this.attackTarget = var1; + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.shouldExecute() || !this.entityHost.getNavigator().noPath(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.attackTarget = null; + this.field_75318_f = 0; + this.rangedAttackTime = -1; + } + + /** + * Updates the task + */ + public void updateTask() + { + double var1 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.boundingBox.minY, this.attackTarget.posZ); + boolean var3 = this.entityHost.getEntitySenses().canSee(this.attackTarget); + + if (var3) + { + ++this.field_75318_f; + } + else + { + this.field_75318_f = 0; + } + + if (var1 <= (double)this.field_82642_h && this.field_75318_f >= 20) + { + this.entityHost.getNavigator().clearPathEntity(); + } + else + { + this.entityHost.getNavigator().tryMoveToEntityLiving(this.attackTarget, this.entityMoveSpeed); + } + + this.entityHost.getLookHelper().setLookPositionWithEntity(this.attackTarget, 30.0F, 30.0F); + float var4; + + if (--this.rangedAttackTime == 0) + { + if (var1 > (double)this.field_82642_h || !var3) + { + return; + } + + var4 = MathHelper.sqrt_double(var1) / this.field_96562_i; + float var5 = var4; + + if (var4 < 0.1F) + { + var5 = 0.1F; + } + + if (var5 > 1.0F) + { + var5 = 1.0F; + } + + this.rangedAttackEntityHost.attackEntityWithRangedAttack(this.attackTarget, var5); + this.rangedAttackTime = MathHelper.floor_float(var4 * (float)(this.maxRangedAttackTime - this.field_96561_g) + (float)this.field_96561_g); + } + else if (this.rangedAttackTime < 0) + { + var4 = MathHelper.sqrt_double(var1) / this.field_96562_i; + this.rangedAttackTime = MathHelper.floor_float(var4 * (float)(this.maxRangedAttackTime - this.field_96561_g) + (float)this.field_96561_g); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIAttackOnCollide.java b/src/main/java/net/minecraft/src/EntityAIAttackOnCollide.java new file mode 100644 index 0000000..0e73b3d --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIAttackOnCollide.java @@ -0,0 +1,123 @@ +package net.minecraft.src; + +public class EntityAIAttackOnCollide extends EntityAIBase +{ + World worldObj; + EntityCreature attacker; + + /** + * An amount of decrementing ticks that allows the entity to attack once the tick reaches 0. + */ + int attackTick; + double field_75440_e; + + /** + * When true, the mob will continue chasing its target, even if it can't find a path to them right now. + */ + boolean longMemory; + + /** The PathEntity of our entity. */ + PathEntity entityPathEntity; + Class classTarget; + private int field_75445_i; + + public EntityAIAttackOnCollide(EntityCreature par1EntityCreature, Class par2Class, double par3, boolean par5) + { + this(par1EntityCreature, par3, par5); + this.classTarget = par2Class; + } + + public EntityAIAttackOnCollide(EntityCreature par1EntityCreature, double par2, boolean par4) + { + this.attacker = par1EntityCreature; + this.worldObj = par1EntityCreature.worldObj; + this.field_75440_e = par2; + this.longMemory = par4; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase var1 = this.attacker.getAttackTarget(); + + if (var1 == null) + { + return false; + } + else if (!var1.isEntityAlive()) + { + return false; + } + else if (this.classTarget != null && !this.classTarget.isAssignableFrom(var1.getClass())) + { + return false; + } + else + { + this.entityPathEntity = this.attacker.getNavigator().getPathToEntityLiving(var1); + return this.entityPathEntity != null; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + EntityLivingBase var1 = this.attacker.getAttackTarget(); + return var1 == null ? false : (!var1.isEntityAlive() ? false : (!this.longMemory ? !this.attacker.getNavigator().noPath() : this.attacker.func_110176_b(MathHelper.floor_double(var1.posX), MathHelper.floor_double(var1.posY), MathHelper.floor_double(var1.posZ)))); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.attacker.getNavigator().setPath(this.entityPathEntity, this.field_75440_e); + this.field_75445_i = 0; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.attacker.getNavigator().clearPathEntity(); + } + + /** + * Updates the task + */ + public void updateTask() + { + EntityLivingBase var1 = this.attacker.getAttackTarget(); + this.attacker.getLookHelper().setLookPositionWithEntity(var1, 30.0F, 30.0F); + + if ((this.longMemory || this.attacker.getEntitySenses().canSee(var1)) && --this.field_75445_i <= 0) + { + this.field_75445_i = 4 + this.attacker.getRNG().nextInt(7); + this.attacker.getNavigator().tryMoveToEntityLiving(var1, this.field_75440_e); + } + + this.attackTick = Math.max(this.attackTick - 1, 0); + double var2 = (double)(this.attacker.width * 2.0F * this.attacker.width * 2.0F + var1.width); + + if (this.attacker.getDistanceSq(var1.posX, var1.boundingBox.minY, var1.posZ) <= var2) + { + if (this.attackTick <= 0) + { + this.attackTick = 20; + + if (this.attacker.getHeldItem() != null) + { + this.attacker.swingItem(); + } + + this.attacker.attackEntityAsMob(var1); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIAvoidEntity.java b/src/main/java/net/minecraft/src/EntityAIAvoidEntity.java new file mode 100644 index 0000000..e210fed --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIAvoidEntity.java @@ -0,0 +1,127 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityAIAvoidEntity extends EntityAIBase +{ + public final IEntitySelector field_98218_a = new EntityAIAvoidEntitySelector(this); + + /** The entity we are attached to */ + private EntityCreature theEntity; + private double farSpeed; + private double nearSpeed; + private Entity closestLivingEntity; + private float distanceFromEntity; + + /** The PathEntity of our entity */ + private PathEntity entityPathEntity; + + /** The PathNavigate of our entity */ + private PathNavigate entityPathNavigate; + + /** The class of the entity we should avoid */ + private Class targetEntityClass; + + public EntityAIAvoidEntity(EntityCreature par1EntityCreature, Class par2Class, float par3, double par4, double par6) + { + this.theEntity = par1EntityCreature; + this.targetEntityClass = par2Class; + this.distanceFromEntity = par3; + this.farSpeed = par4; + this.nearSpeed = par6; + this.entityPathNavigate = par1EntityCreature.getNavigator(); + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.targetEntityClass == EntityPlayer.class) + { + if (this.theEntity instanceof EntityTameable && ((EntityTameable)this.theEntity).isTamed()) + { + return false; + } + + this.closestLivingEntity = this.theEntity.worldObj.getClosestPlayerToEntity(this.theEntity, (double)this.distanceFromEntity); + + if (this.closestLivingEntity == null) + { + return false; + } + } + else + { + List var1 = this.theEntity.worldObj.selectEntitiesWithinAABB(this.targetEntityClass, this.theEntity.boundingBox.expand((double)this.distanceFromEntity, 3.0D, (double)this.distanceFromEntity), this.field_98218_a); + + if (var1.isEmpty()) + { + return false; + } + + this.closestLivingEntity = (Entity)var1.get(0); + } + + Vec3 var2 = RandomPositionGenerator.findRandomTargetBlockAwayFrom(this.theEntity, 16, 7, this.theEntity.worldObj.getWorldVec3Pool().getVecFromPool(this.closestLivingEntity.posX, this.closestLivingEntity.posY, this.closestLivingEntity.posZ)); + + if (var2 == null) + { + return false; + } + else if (this.closestLivingEntity.getDistanceSq(var2.xCoord, var2.yCoord, var2.zCoord) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity)) + { + return false; + } + else + { + this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(var2.xCoord, var2.yCoord, var2.zCoord); + return this.entityPathEntity == null ? false : this.entityPathEntity.isDestinationSame(var2); + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.entityPathNavigate.noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.entityPathNavigate.setPath(this.entityPathEntity, this.farSpeed); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.closestLivingEntity = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.theEntity.getDistanceSqToEntity(this.closestLivingEntity) < 49.0D) + { + this.theEntity.getNavigator().setSpeed(this.nearSpeed); + } + else + { + this.theEntity.getNavigator().setSpeed(this.farSpeed); + } + } + + static EntityCreature func_98217_a(EntityAIAvoidEntity par0EntityAIAvoidEntity) + { + return par0EntityAIAvoidEntity.theEntity; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIAvoidEntitySelector.java b/src/main/java/net/minecraft/src/EntityAIAvoidEntitySelector.java new file mode 100644 index 0000000..2dc8006 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIAvoidEntitySelector.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +class EntityAIAvoidEntitySelector implements IEntitySelector +{ + final EntityAIAvoidEntity entityAvoiderAI; + + EntityAIAvoidEntitySelector(EntityAIAvoidEntity par1EntityAIAvoidEntity) + { + this.entityAvoiderAI = par1EntityAIAvoidEntity; + } + + /** + * Return whether the specified entity is applicable to this filter. + */ + public boolean isEntityApplicable(Entity par1Entity) + { + return par1Entity.isEntityAlive() && EntityAIAvoidEntity.func_98217_a(this.entityAvoiderAI).getEntitySenses().canSee(par1Entity); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIBase.java b/src/main/java/net/minecraft/src/EntityAIBase.java new file mode 100644 index 0000000..42e3e87 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIBase.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +public abstract class EntityAIBase +{ + /** + * A bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it yields + * zero, the two tasks may run concurrently, if not - they must run exclusively from each other. + */ + private int mutexBits; + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public abstract boolean shouldExecute(); + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.shouldExecute(); + } + + /** + * Determine if this AI Task is interruptible by a higher (= lower value) priority task. + */ + public boolean isInterruptible() + { + return true; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() {} + + /** + * Resets the task + */ + public void resetTask() {} + + /** + * Updates the task + */ + public void updateTask() {} + + /** + * Sets a bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it + * yields zero, the two tasks may run concurrently, if not - they must run exclusively from each other. + */ + public void setMutexBits(int par1) + { + this.mutexBits = par1; + } + + /** + * Get a bitmask telling which other tasks may not run concurrently. The test is a simple bitwise AND - if it yields + * zero, the two tasks may run concurrently, if not - they must run exclusively from each other. + */ + public int getMutexBits() + { + return this.mutexBits; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIBeg.java b/src/main/java/net/minecraft/src/EntityAIBeg.java new file mode 100644 index 0000000..35ce98b --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIBeg.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +public class EntityAIBeg extends EntityAIBase +{ + private EntityWolf theWolf; + private EntityPlayer thePlayer; + private World worldObject; + private float minPlayerDistance; + private int field_75384_e; + + public EntityAIBeg(EntityWolf par1EntityWolf, float par2) + { + this.theWolf = par1EntityWolf; + this.worldObject = par1EntityWolf.worldObj; + this.minPlayerDistance = par2; + this.setMutexBits(2); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.thePlayer = this.worldObject.getClosestPlayerToEntity(this.theWolf, (double)this.minPlayerDistance); + return this.thePlayer == null ? false : this.hasPlayerGotBoneInHand(this.thePlayer); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.thePlayer.isEntityAlive() ? false : (this.theWolf.getDistanceSqToEntity(this.thePlayer) > (double)(this.minPlayerDistance * this.minPlayerDistance) ? false : this.field_75384_e > 0 && this.hasPlayerGotBoneInHand(this.thePlayer)); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theWolf.func_70918_i(true); + this.field_75384_e = 40 + this.theWolf.getRNG().nextInt(40); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theWolf.func_70918_i(false); + this.thePlayer = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theWolf.getLookHelper().setLookPosition(this.thePlayer.posX, this.thePlayer.posY + (double)this.thePlayer.getEyeHeight(), this.thePlayer.posZ, 10.0F, (float)this.theWolf.getVerticalFaceSpeed()); + --this.field_75384_e; + } + + /** + * Gets if the Player has the Bone in the hand. + */ + private boolean hasPlayerGotBoneInHand(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + return var2 == null ? false : (!this.theWolf.isTamed() && var2.itemID == Item.bone.itemID ? true : this.theWolf.isBreedingItem(var2)); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIBreakDoor.java b/src/main/java/net/minecraft/src/EntityAIBreakDoor.java new file mode 100644 index 0000000..e795d0f --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIBreakDoor.java @@ -0,0 +1,76 @@ +package net.minecraft.src; + +public class EntityAIBreakDoor extends EntityAIDoorInteract +{ + private int breakingTime; + private int field_75358_j = -1; + + public EntityAIBreakDoor(EntityLiving par1EntityLiving) + { + super(par1EntityLiving); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return !super.shouldExecute() ? false : (!this.theEntity.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing") ? false : !this.targetDoor.isDoorOpen(this.theEntity.worldObj, this.entityPosX, this.entityPosY, this.entityPosZ)); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + super.startExecuting(); + this.breakingTime = 0; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + double var1 = this.theEntity.getDistanceSq((double)this.entityPosX, (double)this.entityPosY, (double)this.entityPosZ); + return this.breakingTime <= 240 && !this.targetDoor.isDoorOpen(this.theEntity.worldObj, this.entityPosX, this.entityPosY, this.entityPosZ) && var1 < 4.0D; + } + + /** + * Resets the task + */ + public void resetTask() + { + super.resetTask(); + this.theEntity.worldObj.destroyBlockInWorldPartially(this.theEntity.entityId, this.entityPosX, this.entityPosY, this.entityPosZ, -1); + } + + /** + * Updates the task + */ + public void updateTask() + { + super.updateTask(); + + if (this.theEntity.getRNG().nextInt(20) == 0) + { + this.theEntity.worldObj.playAuxSFX(1010, this.entityPosX, this.entityPosY, this.entityPosZ, 0); + } + + ++this.breakingTime; + int var1 = (int)((float)this.breakingTime / 240.0F * 10.0F); + + if (var1 != this.field_75358_j) + { + this.theEntity.worldObj.destroyBlockInWorldPartially(this.theEntity.entityId, this.entityPosX, this.entityPosY, this.entityPosZ, var1); + this.field_75358_j = var1; + } + + if (this.breakingTime == 240 && this.theEntity.worldObj.difficultySetting == 3) + { + this.theEntity.worldObj.setBlockToAir(this.entityPosX, this.entityPosY, this.entityPosZ); + this.theEntity.worldObj.playAuxSFX(1012, this.entityPosX, this.entityPosY, this.entityPosZ, 0); + this.theEntity.worldObj.playAuxSFX(2001, this.entityPosX, this.entityPosY, this.entityPosZ, this.targetDoor.blockID); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIControlledByPlayer.java b/src/main/java/net/minecraft/src/EntityAIControlledByPlayer.java new file mode 100644 index 0000000..f21f872 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIControlledByPlayer.java @@ -0,0 +1,216 @@ +package net.minecraft.src; + +public class EntityAIControlledByPlayer extends EntityAIBase +{ + private final EntityLiving thisEntity; + private final float maxSpeed; + private float currentSpeed; + + /** Whether the entity's speed is boosted. */ + private boolean speedBoosted; + + /** + * Counter for speed boosting, upon reaching maxSpeedBoostTime the speed boost will be disabled + */ + private int speedBoostTime; + + /** Maximum time the entity's speed should be boosted for. */ + private int maxSpeedBoostTime; + + public EntityAIControlledByPlayer(EntityLiving par1EntityLiving, float par2) + { + this.thisEntity = par1EntityLiving; + this.maxSpeed = par2; + this.setMutexBits(7); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.currentSpeed = 0.0F; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.speedBoosted = false; + this.currentSpeed = 0.0F; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return this.thisEntity.isEntityAlive() && this.thisEntity.riddenByEntity != null && this.thisEntity.riddenByEntity instanceof EntityPlayer && (this.speedBoosted || this.thisEntity.canBeSteered()); + } + + /** + * Updates the task + */ + public void updateTask() + { + EntityPlayer var1 = (EntityPlayer)this.thisEntity.riddenByEntity; + EntityCreature var2 = (EntityCreature)this.thisEntity; + float var3 = MathHelper.wrapAngleTo180_float(var1.rotationYaw - this.thisEntity.rotationYaw) * 0.5F; + + if (var3 > 5.0F) + { + var3 = 5.0F; + } + + if (var3 < -5.0F) + { + var3 = -5.0F; + } + + this.thisEntity.rotationYaw = MathHelper.wrapAngleTo180_float(this.thisEntity.rotationYaw + var3); + + if (this.currentSpeed < this.maxSpeed) + { + this.currentSpeed += (this.maxSpeed - this.currentSpeed) * 0.01F; + } + + if (this.currentSpeed > this.maxSpeed) + { + this.currentSpeed = this.maxSpeed; + } + + int var4 = MathHelper.floor_double(this.thisEntity.posX); + int var5 = MathHelper.floor_double(this.thisEntity.posY); + int var6 = MathHelper.floor_double(this.thisEntity.posZ); + float var7 = this.currentSpeed; + + if (this.speedBoosted) + { + if (this.speedBoostTime++ > this.maxSpeedBoostTime) + { + this.speedBoosted = false; + } + + var7 += var7 * 1.15F * MathHelper.sin((float)this.speedBoostTime / (float)this.maxSpeedBoostTime * (float)Math.PI); + } + + float var8 = 0.91F; + + if (this.thisEntity.onGround) + { + var8 = 0.54600006F; + int var9 = this.thisEntity.worldObj.getBlockId(MathHelper.floor_float((float)var4), MathHelper.floor_float((float)var5) - 1, MathHelper.floor_float((float)var6)); + + if (var9 > 0) + { + var8 = Block.blocksList[var9].slipperiness * 0.91F; + } + } + + float var23 = 0.16277136F / (var8 * var8 * var8); + float var10 = MathHelper.sin(var2.rotationYaw * (float)Math.PI / 180.0F); + float var11 = MathHelper.cos(var2.rotationYaw * (float)Math.PI / 180.0F); + float var12 = var2.getAIMoveSpeed() * var23; + float var13 = Math.max(var7, 1.0F); + var13 = var12 / var13; + float var14 = var7 * var13; + float var15 = -(var14 * var10); + float var16 = var14 * var11; + + if (MathHelper.abs(var15) > MathHelper.abs(var16)) + { + if (var15 < 0.0F) + { + var15 -= this.thisEntity.width / 2.0F; + } + + if (var15 > 0.0F) + { + var15 += this.thisEntity.width / 2.0F; + } + + var16 = 0.0F; + } + else + { + var15 = 0.0F; + + if (var16 < 0.0F) + { + var16 -= this.thisEntity.width / 2.0F; + } + + if (var16 > 0.0F) + { + var16 += this.thisEntity.width / 2.0F; + } + } + + int var17 = MathHelper.floor_double(this.thisEntity.posX + (double)var15); + int var18 = MathHelper.floor_double(this.thisEntity.posZ + (double)var16); + PathPoint var19 = new PathPoint(MathHelper.floor_float(this.thisEntity.width + 1.0F), MathHelper.floor_float(this.thisEntity.height + var1.height + 1.0F), MathHelper.floor_float(this.thisEntity.width + 1.0F)); + + if (var4 != var17 || var6 != var18) + { + int var20 = this.thisEntity.worldObj.getBlockId(var4, var5, var6); + int var21 = this.thisEntity.worldObj.getBlockId(var4, var5 - 1, var6); + boolean var22 = this.func_98216_b(var20) || Block.blocksList[var20] == null && this.func_98216_b(var21); + + if (!var22 && PathFinder.func_82565_a(this.thisEntity, var17, var5, var18, var19, false, false, true) == 0 && PathFinder.func_82565_a(this.thisEntity, var4, var5 + 1, var6, var19, false, false, true) == 1 && PathFinder.func_82565_a(this.thisEntity, var17, var5 + 1, var18, var19, false, false, true) == 1) + { + var2.getJumpHelper().setJumping(); + } + } + + if (!var1.capabilities.isCreativeMode && this.currentSpeed >= this.maxSpeed * 0.5F && this.thisEntity.getRNG().nextFloat() < 0.006F && !this.speedBoosted) + { + ItemStack var24 = var1.getHeldItem(); + + if (var24 != null && var24.itemID == Item.carrotOnAStick.itemID) + { + var24.damageItem(1, var1); + + if (var24.stackSize == 0) + { + ItemStack var25 = new ItemStack(Item.fishingRod); + var25.setTagCompound(var24.stackTagCompound); + var1.inventory.mainInventory[var1.inventory.currentItem] = var25; + } + } + } + + this.thisEntity.moveEntityWithHeading(0.0F, var7); + } + + private boolean func_98216_b(int par1) + { + return Block.blocksList[par1] != null && (Block.blocksList[par1].getRenderType() == 10 || Block.blocksList[par1] instanceof BlockHalfSlab); + } + + /** + * Return whether the entity's speed is boosted. + */ + public boolean isSpeedBoosted() + { + return this.speedBoosted; + } + + /** + * Boost the entity's movement speed. + */ + public void boostSpeed() + { + this.speedBoosted = true; + this.speedBoostTime = 0; + this.maxSpeedBoostTime = this.thisEntity.getRNG().nextInt(841) + 140; + } + + /** + * Return whether the entity is being controlled by a player. + */ + public boolean isControlledByPlayer() + { + return !this.isSpeedBoosted() && this.currentSpeed > this.maxSpeed * 0.3F; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAICreeperSwell.java b/src/main/java/net/minecraft/src/EntityAICreeperSwell.java new file mode 100644 index 0000000..0cf494a --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAICreeperSwell.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +public class EntityAICreeperSwell extends EntityAIBase +{ + /** The creeper that is swelling. */ + EntityCreeper swellingCreeper; + + /** + * The creeper's attack target. This is used for the changing of the creeper's state. + */ + EntityLivingBase creeperAttackTarget; + + public EntityAICreeperSwell(EntityCreeper par1EntityCreeper) + { + this.swellingCreeper = par1EntityCreeper; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase var1 = this.swellingCreeper.getAttackTarget(); + return this.swellingCreeper.getCreeperState() > 0 || var1 != null && this.swellingCreeper.getDistanceSqToEntity(var1) < 9.0D; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.swellingCreeper.getNavigator().clearPathEntity(); + this.creeperAttackTarget = this.swellingCreeper.getAttackTarget(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.creeperAttackTarget = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.creeperAttackTarget == null) + { + this.swellingCreeper.setCreeperState(-1); + } + else if (this.swellingCreeper.getDistanceSqToEntity(this.creeperAttackTarget) > 49.0D) + { + this.swellingCreeper.setCreeperState(-1); + } + else if (!this.swellingCreeper.getEntitySenses().canSee(this.creeperAttackTarget)) + { + this.swellingCreeper.setCreeperState(-1); + } + else + { + this.swellingCreeper.setCreeperState(1); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIDefendVillage.java b/src/main/java/net/minecraft/src/EntityAIDefendVillage.java new file mode 100644 index 0000000..193a07b --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIDefendVillage.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +public class EntityAIDefendVillage extends EntityAITarget +{ + EntityIronGolem irongolem; + + /** + * The aggressor of the iron golem's village which is now the golem's attack target. + */ + EntityLivingBase villageAgressorTarget; + + public EntityAIDefendVillage(EntityIronGolem par1EntityIronGolem) + { + super(par1EntityIronGolem, false, true); + this.irongolem = par1EntityIronGolem; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + Village var1 = this.irongolem.getVillage(); + + if (var1 == null) + { + return false; + } + else + { + this.villageAgressorTarget = var1.findNearestVillageAggressor(this.irongolem); + + if (!this.isSuitableTarget(this.villageAgressorTarget, false)) + { + if (this.taskOwner.getRNG().nextInt(20) == 0) + { + this.villageAgressorTarget = var1.func_82685_c(this.irongolem); + return this.isSuitableTarget(this.villageAgressorTarget, false); + } + else + { + return false; + } + } + else + { + return true; + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.irongolem.setAttackTarget(this.villageAgressorTarget); + super.startExecuting(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIDoorInteract.java b/src/main/java/net/minecraft/src/EntityAIDoorInteract.java new file mode 100644 index 0000000..61704ab --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIDoorInteract.java @@ -0,0 +1,111 @@ +package net.minecraft.src; + +public abstract class EntityAIDoorInteract extends EntityAIBase +{ + protected EntityLiving theEntity; + protected int entityPosX; + protected int entityPosY; + protected int entityPosZ; + protected BlockDoor targetDoor; + + /** + * If is true then the Entity has stopped Door Interaction and compoleted the task. + */ + boolean hasStoppedDoorInteraction; + float entityPositionX; + float entityPositionZ; + + public EntityAIDoorInteract(EntityLiving par1EntityLiving) + { + this.theEntity = par1EntityLiving; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theEntity.isCollidedHorizontally) + { + return false; + } + else + { + PathNavigate var1 = this.theEntity.getNavigator(); + PathEntity var2 = var1.getPath(); + + if (var2 != null && !var2.isFinished() && var1.getCanBreakDoors()) + { + for (int var3 = 0; var3 < Math.min(var2.getCurrentPathIndex() + 2, var2.getCurrentPathLength()); ++var3) + { + PathPoint var4 = var2.getPathPointFromIndex(var3); + this.entityPosX = var4.xCoord; + this.entityPosY = var4.yCoord + 1; + this.entityPosZ = var4.zCoord; + + if (this.theEntity.getDistanceSq((double)this.entityPosX, this.theEntity.posY, (double)this.entityPosZ) <= 2.25D) + { + this.targetDoor = this.findUsableDoor(this.entityPosX, this.entityPosY, this.entityPosZ); + + if (this.targetDoor != null) + { + return true; + } + } + } + + this.entityPosX = MathHelper.floor_double(this.theEntity.posX); + this.entityPosY = MathHelper.floor_double(this.theEntity.posY + 1.0D); + this.entityPosZ = MathHelper.floor_double(this.theEntity.posZ); + this.targetDoor = this.findUsableDoor(this.entityPosX, this.entityPosY, this.entityPosZ); + return this.targetDoor != null; + } + else + { + return false; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.hasStoppedDoorInteraction; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.hasStoppedDoorInteraction = false; + this.entityPositionX = (float)((double)((float)this.entityPosX + 0.5F) - this.theEntity.posX); + this.entityPositionZ = (float)((double)((float)this.entityPosZ + 0.5F) - this.theEntity.posZ); + } + + /** + * Updates the task + */ + public void updateTask() + { + float var1 = (float)((double)((float)this.entityPosX + 0.5F) - this.theEntity.posX); + float var2 = (float)((double)((float)this.entityPosZ + 0.5F) - this.theEntity.posZ); + float var3 = this.entityPositionX * var1 + this.entityPositionZ * var2; + + if (var3 < 0.0F) + { + this.hasStoppedDoorInteraction = true; + } + } + + /** + * Determines if a door can be broken with AI. + */ + private BlockDoor findUsableDoor(int par1, int par2, int par3) + { + int var4 = this.theEntity.worldObj.getBlockId(par1, par2, par3); + return var4 != Block.doorWood.blockID ? null : (BlockDoor)Block.blocksList[var4]; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIEatGrass.java b/src/main/java/net/minecraft/src/EntityAIEatGrass.java new file mode 100644 index 0000000..df9729f --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIEatGrass.java @@ -0,0 +1,93 @@ +package net.minecraft.src; + +public class EntityAIEatGrass extends EntityAIBase +{ + private EntityLiving theEntity; + private World theWorld; + + /** A decrementing tick used for the sheep's head offset and animation. */ + int eatGrassTick; + + public EntityAIEatGrass(EntityLiving par1EntityLiving) + { + this.theEntity = par1EntityLiving; + this.theWorld = par1EntityLiving.worldObj; + this.setMutexBits(7); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theEntity.getRNG().nextInt(this.theEntity.isChild() ? 50 : 1000) != 0) + { + return false; + } + else + { + int var1 = MathHelper.floor_double(this.theEntity.posX); + int var2 = MathHelper.floor_double(this.theEntity.posY); + int var3 = MathHelper.floor_double(this.theEntity.posZ); + return this.theWorld.getBlockId(var1, var2, var3) == Block.tallGrass.blockID && this.theWorld.getBlockMetadata(var1, var2, var3) == 1 ? true : this.theWorld.getBlockId(var1, var2 - 1, var3) == Block.grass.blockID; + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.eatGrassTick = 40; + this.theWorld.setEntityState(this.theEntity, (byte)10); + this.theEntity.getNavigator().clearPathEntity(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.eatGrassTick = 0; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.eatGrassTick > 0; + } + + public int getEatGrassTick() + { + return this.eatGrassTick; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.eatGrassTick = Math.max(0, this.eatGrassTick - 1); + + if (this.eatGrassTick == 4) + { + int var1 = MathHelper.floor_double(this.theEntity.posX); + int var2 = MathHelper.floor_double(this.theEntity.posY); + int var3 = MathHelper.floor_double(this.theEntity.posZ); + + if (this.theWorld.getBlockId(var1, var2, var3) == Block.tallGrass.blockID) + { + this.theWorld.destroyBlock(var1, var2, var3, false); + this.theEntity.eatGrassBonus(); + } + else if (this.theWorld.getBlockId(var1, var2 - 1, var3) == Block.grass.blockID) + { + this.theWorld.playAuxSFX(2001, var1, var2 - 1, var3, Block.grass.blockID); + this.theWorld.setBlock(var1, var2 - 1, var3, Block.dirt.blockID, 0, 2); + this.theEntity.eatGrassBonus(); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIFleeSun.java b/src/main/java/net/minecraft/src/EntityAIFleeSun.java new file mode 100644 index 0000000..e3b0f1f --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIFleeSun.java @@ -0,0 +1,91 @@ +package net.minecraft.src; + +import java.util.Random; + +public class EntityAIFleeSun extends EntityAIBase +{ + private EntityCreature theCreature; + private double shelterX; + private double shelterY; + private double shelterZ; + private double movementSpeed; + private World theWorld; + + public EntityAIFleeSun(EntityCreature par1EntityCreature, double par2) + { + this.theCreature = par1EntityCreature; + this.movementSpeed = par2; + this.theWorld = par1EntityCreature.worldObj; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theWorld.isDaytime()) + { + return false; + } + else if (!this.theCreature.isBurning()) + { + return false; + } + else if (!this.theWorld.canBlockSeeTheSky(MathHelper.floor_double(this.theCreature.posX), (int)this.theCreature.boundingBox.minY, MathHelper.floor_double(this.theCreature.posZ))) + { + return false; + } + else + { + Vec3 var1 = this.findPossibleShelter(); + + if (var1 == null) + { + return false; + } + else + { + this.shelterX = var1.xCoord; + this.shelterY = var1.yCoord; + this.shelterZ = var1.zCoord; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theCreature.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theCreature.getNavigator().tryMoveToXYZ(this.shelterX, this.shelterY, this.shelterZ, this.movementSpeed); + } + + private Vec3 findPossibleShelter() + { + Random var1 = this.theCreature.getRNG(); + + for (int var2 = 0; var2 < 10; ++var2) + { + int var3 = MathHelper.floor_double(this.theCreature.posX + (double)var1.nextInt(20) - 10.0D); + int var4 = MathHelper.floor_double(this.theCreature.boundingBox.minY + (double)var1.nextInt(6) - 3.0D); + int var5 = MathHelper.floor_double(this.theCreature.posZ + (double)var1.nextInt(20) - 10.0D); + + if (!this.theWorld.canBlockSeeTheSky(var3, var4, var5) && this.theCreature.getBlockPathWeight(var3, var4, var5) < 0.0F) + { + return this.theWorld.getWorldVec3Pool().getVecFromPool((double)var3, (double)var4, (double)var5); + } + } + + return null; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIFollowGolem.java b/src/main/java/net/minecraft/src/EntityAIFollowGolem.java new file mode 100644 index 0000000..4727309 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIFollowGolem.java @@ -0,0 +1,106 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class EntityAIFollowGolem extends EntityAIBase +{ + private EntityVillager theVillager; + private EntityIronGolem theGolem; + private int takeGolemRoseTick; + private boolean tookGolemRose; + + public EntityAIFollowGolem(EntityVillager par1EntityVillager) + { + this.theVillager = par1EntityVillager; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theVillager.getGrowingAge() >= 0) + { + return false; + } + else if (!this.theVillager.worldObj.isDaytime()) + { + return false; + } + else + { + List var1 = this.theVillager.worldObj.getEntitiesWithinAABB(EntityIronGolem.class, this.theVillager.boundingBox.expand(6.0D, 2.0D, 6.0D)); + + if (var1.isEmpty()) + { + return false; + } + else + { + Iterator var2 = var1.iterator(); + + while (var2.hasNext()) + { + EntityIronGolem var3 = (EntityIronGolem)var2.next(); + + if (var3.getHoldRoseTick() > 0) + { + this.theGolem = var3; + break; + } + } + + return this.theGolem != null; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.theGolem.getHoldRoseTick() > 0; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.takeGolemRoseTick = this.theVillager.getRNG().nextInt(320); + this.tookGolemRose = false; + this.theGolem.getNavigator().clearPathEntity(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theGolem = null; + this.theVillager.getNavigator().clearPathEntity(); + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theVillager.getLookHelper().setLookPositionWithEntity(this.theGolem, 30.0F, 30.0F); + + if (this.theGolem.getHoldRoseTick() == this.takeGolemRoseTick) + { + this.theVillager.getNavigator().tryMoveToEntityLiving(this.theGolem, 0.5D); + this.tookGolemRose = true; + } + + if (this.tookGolemRose && this.theVillager.getDistanceSqToEntity(this.theGolem) < 4.0D) + { + this.theGolem.setHoldingRose(false); + this.theVillager.getNavigator().clearPathEntity(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIFollowOwner.java b/src/main/java/net/minecraft/src/EntityAIFollowOwner.java new file mode 100644 index 0000000..94216f5 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIFollowOwner.java @@ -0,0 +1,121 @@ +package net.minecraft.src; + +public class EntityAIFollowOwner extends EntityAIBase +{ + private EntityTameable thePet; + private EntityLivingBase theOwner; + World theWorld; + private double field_75336_f; + private PathNavigate petPathfinder; + private int field_75343_h; + float maxDist; + float minDist; + private boolean field_75344_i; + + public EntityAIFollowOwner(EntityTameable par1EntityTameable, double par2, float par4, float par5) + { + this.thePet = par1EntityTameable; + this.theWorld = par1EntityTameable.worldObj; + this.field_75336_f = par2; + this.petPathfinder = par1EntityTameable.getNavigator(); + this.minDist = par4; + this.maxDist = par5; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase var1 = this.thePet.func_130012_q(); + + if (var1 == null) + { + return false; + } + else if (this.thePet.isSitting()) + { + return false; + } + else if (this.thePet.getDistanceSqToEntity(var1) < (double)(this.minDist * this.minDist)) + { + return false; + } + else + { + this.theOwner = var1; + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.petPathfinder.noPath() && this.thePet.getDistanceSqToEntity(this.theOwner) > (double)(this.maxDist * this.maxDist) && !this.thePet.isSitting(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.field_75343_h = 0; + this.field_75344_i = this.thePet.getNavigator().getAvoidsWater(); + this.thePet.getNavigator().setAvoidsWater(false); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theOwner = null; + this.petPathfinder.clearPathEntity(); + this.thePet.getNavigator().setAvoidsWater(this.field_75344_i); + } + + /** + * Updates the task + */ + public void updateTask() + { + this.thePet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, (float)this.thePet.getVerticalFaceSpeed()); + + if (!this.thePet.isSitting()) + { + if (--this.field_75343_h <= 0) + { + this.field_75343_h = 10; + + if (!this.petPathfinder.tryMoveToEntityLiving(this.theOwner, this.field_75336_f)) + { + if (!this.thePet.getLeashed()) + { + if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D) + { + int var1 = MathHelper.floor_double(this.theOwner.posX) - 2; + int var2 = MathHelper.floor_double(this.theOwner.posZ) - 2; + int var3 = MathHelper.floor_double(this.theOwner.boundingBox.minY); + + for (int var4 = 0; var4 <= 4; ++var4) + { + for (int var5 = 0; var5 <= 4; ++var5) + { + if ((var4 < 1 || var5 < 1 || var4 > 3 || var5 > 3) && this.theWorld.doesBlockHaveSolidTopSurface(var1 + var4, var3 - 1, var2 + var5) && !this.theWorld.isBlockNormalCube(var1 + var4, var3, var2 + var5) && !this.theWorld.isBlockNormalCube(var1 + var4, var3 + 1, var2 + var5)) + { + this.thePet.setLocationAndAngles((double)((float)(var1 + var4) + 0.5F), (double)var3, (double)((float)(var2 + var5) + 0.5F), this.thePet.rotationYaw, this.thePet.rotationPitch); + this.petPathfinder.clearPathEntity(); + return; + } + } + } + } + } + } + } + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIFollowParent.java b/src/main/java/net/minecraft/src/EntityAIFollowParent.java new file mode 100644 index 0000000..8f29bf9 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIFollowParent.java @@ -0,0 +1,111 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class EntityAIFollowParent extends EntityAIBase +{ + /** The child that is following its parent. */ + EntityAnimal childAnimal; + EntityAnimal parentAnimal; + double field_75347_c; + private int field_75345_d; + + public EntityAIFollowParent(EntityAnimal par1EntityAnimal, double par2) + { + this.childAnimal = par1EntityAnimal; + this.field_75347_c = par2; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.childAnimal.getGrowingAge() >= 0) + { + return false; + } + else + { + List var1 = this.childAnimal.worldObj.getEntitiesWithinAABB(this.childAnimal.getClass(), this.childAnimal.boundingBox.expand(8.0D, 4.0D, 8.0D)); + EntityAnimal var2 = null; + double var3 = Double.MAX_VALUE; + Iterator var5 = var1.iterator(); + + while (var5.hasNext()) + { + EntityAnimal var6 = (EntityAnimal)var5.next(); + + if (var6.getGrowingAge() >= 0) + { + double var7 = this.childAnimal.getDistanceSqToEntity(var6); + + if (var7 <= var3) + { + var3 = var7; + var2 = var6; + } + } + } + + if (var2 == null) + { + return false; + } + else if (var3 < 9.0D) + { + return false; + } + else + { + this.parentAnimal = var2; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + if (!this.parentAnimal.isEntityAlive()) + { + return false; + } + else + { + double var1 = this.childAnimal.getDistanceSqToEntity(this.parentAnimal); + return var1 >= 9.0D && var1 <= 256.0D; + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.field_75345_d = 0; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.parentAnimal = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + if (--this.field_75345_d <= 0) + { + this.field_75345_d = 10; + this.childAnimal.getNavigator().tryMoveToEntityLiving(this.parentAnimal, this.field_75347_c); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIHurtByTarget.java b/src/main/java/net/minecraft/src/EntityAIHurtByTarget.java new file mode 100644 index 0000000..226a914 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIHurtByTarget.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class EntityAIHurtByTarget extends EntityAITarget +{ + boolean entityCallsForHelp; + private int field_142052_b; + + public EntityAIHurtByTarget(EntityCreature par1EntityCreature, boolean par2) + { + super(par1EntityCreature, false); + this.entityCallsForHelp = par2; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + int var1 = this.taskOwner.func_142015_aE(); + return var1 != this.field_142052_b && this.isSuitableTarget(this.taskOwner.getAITarget(), false); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.taskOwner.setAttackTarget(this.taskOwner.getAITarget()); + this.field_142052_b = this.taskOwner.func_142015_aE(); + + if (this.entityCallsForHelp) + { + double var1 = this.getTargetDistance(); + List var3 = this.taskOwner.worldObj.getEntitiesWithinAABB(this.taskOwner.getClass(), AxisAlignedBB.getAABBPool().getAABB(this.taskOwner.posX, this.taskOwner.posY, this.taskOwner.posZ, this.taskOwner.posX + 1.0D, this.taskOwner.posY + 1.0D, this.taskOwner.posZ + 1.0D).expand(var1, 10.0D, var1)); + Iterator var4 = var3.iterator(); + + while (var4.hasNext()) + { + EntityCreature var5 = (EntityCreature)var4.next(); + + if (this.taskOwner != var5 && var5.getAttackTarget() == null && !var5.isOnSameTeam(this.taskOwner.getAITarget())) + { + var5.setAttackTarget(this.taskOwner.getAITarget()); + } + } + } + + super.startExecuting(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAILeapAtTarget.java b/src/main/java/net/minecraft/src/EntityAILeapAtTarget.java new file mode 100644 index 0000000..7f9e05a --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAILeapAtTarget.java @@ -0,0 +1,59 @@ +package net.minecraft.src; + +public class EntityAILeapAtTarget extends EntityAIBase +{ + /** The entity that is leaping. */ + EntityLiving leaper; + + /** The entity that the leaper is leaping towards. */ + EntityLivingBase leapTarget; + + /** The entity's motionY after leaping. */ + float leapMotionY; + + public EntityAILeapAtTarget(EntityLiving par1EntityLiving, float par2) + { + this.leaper = par1EntityLiving; + this.leapMotionY = par2; + this.setMutexBits(5); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.leapTarget = this.leaper.getAttackTarget(); + + if (this.leapTarget == null) + { + return false; + } + else + { + double var1 = this.leaper.getDistanceSqToEntity(this.leapTarget); + return var1 >= 4.0D && var1 <= 16.0D ? (!this.leaper.onGround ? false : this.leaper.getRNG().nextInt(5) == 0) : false; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.leaper.onGround; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + double var1 = this.leapTarget.posX - this.leaper.posX; + double var3 = this.leapTarget.posZ - this.leaper.posZ; + float var5 = MathHelper.sqrt_double(var1 * var1 + var3 * var3); + this.leaper.motionX += var1 / (double)var5 * 0.5D * 0.800000011920929D + this.leaper.motionX * 0.20000000298023224D; + this.leaper.motionZ += var3 / (double)var5 * 0.5D * 0.800000011920929D + this.leaper.motionZ * 0.20000000298023224D; + this.leaper.motionY = (double)this.leapMotionY; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAILookAtTradePlayer.java b/src/main/java/net/minecraft/src/EntityAILookAtTradePlayer.java new file mode 100644 index 0000000..7bc4b45 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAILookAtTradePlayer.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +public class EntityAILookAtTradePlayer extends EntityAIWatchClosest +{ + private final EntityVillager theMerchant; + + public EntityAILookAtTradePlayer(EntityVillager par1EntityVillager) + { + super(par1EntityVillager, EntityPlayer.class, 8.0F); + this.theMerchant = par1EntityVillager; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theMerchant.isTrading()) + { + this.closestEntity = this.theMerchant.getCustomer(); + return true; + } + else + { + return false; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAILookAtVillager.java b/src/main/java/net/minecraft/src/EntityAILookAtVillager.java new file mode 100644 index 0000000..fa87b6b --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAILookAtVillager.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +public class EntityAILookAtVillager extends EntityAIBase +{ + private EntityIronGolem theGolem; + private EntityVillager theVillager; + private int lookTime; + + public EntityAILookAtVillager(EntityIronGolem par1EntityIronGolem) + { + this.theGolem = par1EntityIronGolem; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theGolem.worldObj.isDaytime()) + { + return false; + } + else if (this.theGolem.getRNG().nextInt(8000) != 0) + { + return false; + } + else + { + this.theVillager = (EntityVillager)this.theGolem.worldObj.findNearestEntityWithinAABB(EntityVillager.class, this.theGolem.boundingBox.expand(6.0D, 2.0D, 6.0D), this.theGolem); + return this.theVillager != null; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.lookTime > 0; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.lookTime = 400; + this.theGolem.setHoldingRose(true); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theGolem.setHoldingRose(false); + this.theVillager = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theGolem.getLookHelper().setLookPositionWithEntity(this.theVillager, 30.0F, 30.0F); + --this.lookTime; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAILookIdle.java b/src/main/java/net/minecraft/src/EntityAILookIdle.java new file mode 100644 index 0000000..07a08f2 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAILookIdle.java @@ -0,0 +1,60 @@ +package net.minecraft.src; + +public class EntityAILookIdle extends EntityAIBase +{ + /** The entity that is looking idle. */ + private EntityLiving idleEntity; + + /** X offset to look at */ + private double lookX; + + /** Z offset to look at */ + private double lookZ; + + /** + * A decrementing tick that stops the entity from being idle once it reaches 0. + */ + private int idleTime; + + public EntityAILookIdle(EntityLiving par1EntityLiving) + { + this.idleEntity = par1EntityLiving; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return this.idleEntity.getRNG().nextFloat() < 0.02F; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.idleTime >= 0; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + double var1 = (Math.PI * 2D) * this.idleEntity.getRNG().nextDouble(); + this.lookX = Math.cos(var1); + this.lookZ = Math.sin(var1); + this.idleTime = 20 + this.idleEntity.getRNG().nextInt(20); + } + + /** + * Updates the task + */ + public void updateTask() + { + --this.idleTime; + this.idleEntity.getLookHelper().setLookPosition(this.idleEntity.posX + this.lookX, this.idleEntity.posY + (double)this.idleEntity.getEyeHeight(), this.idleEntity.posZ + this.lookZ, 10.0F, (float)this.idleEntity.getVerticalFaceSpeed()); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIMate.java b/src/main/java/net/minecraft/src/EntityAIMate.java new file mode 100644 index 0000000..7e4e9e9 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIMate.java @@ -0,0 +1,132 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; +import java.util.Random; + +public class EntityAIMate extends EntityAIBase +{ + private EntityAnimal theAnimal; + World theWorld; + private EntityAnimal targetMate; + + /** + * Delay preventing a baby from spawning immediately when two mate-able animals find each other. + */ + int spawnBabyDelay; + + /** The speed the creature moves at during mating behavior. */ + double moveSpeed; + + public EntityAIMate(EntityAnimal par1EntityAnimal, double par2) + { + this.theAnimal = par1EntityAnimal; + this.theWorld = par1EntityAnimal.worldObj; + this.moveSpeed = par2; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theAnimal.isInLove()) + { + return false; + } + else + { + this.targetMate = this.getNearbyMate(); + return this.targetMate != null; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.targetMate.isEntityAlive() && this.targetMate.isInLove() && this.spawnBabyDelay < 60; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.targetMate = null; + this.spawnBabyDelay = 0; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theAnimal.getLookHelper().setLookPositionWithEntity(this.targetMate, 10.0F, (float)this.theAnimal.getVerticalFaceSpeed()); + this.theAnimal.getNavigator().tryMoveToEntityLiving(this.targetMate, this.moveSpeed); + ++this.spawnBabyDelay; + + if (this.spawnBabyDelay >= 60 && this.theAnimal.getDistanceSqToEntity(this.targetMate) < 9.0D) + { + this.spawnBaby(); + } + } + + /** + * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first + * valid mate found. + */ + private EntityAnimal getNearbyMate() + { + float var1 = 8.0F; + List var2 = this.theWorld.getEntitiesWithinAABB(this.theAnimal.getClass(), this.theAnimal.boundingBox.expand((double)var1, (double)var1, (double)var1)); + double var3 = Double.MAX_VALUE; + EntityAnimal var5 = null; + Iterator var6 = var2.iterator(); + + while (var6.hasNext()) + { + EntityAnimal var7 = (EntityAnimal)var6.next(); + + if (this.theAnimal.canMateWith(var7) && this.theAnimal.getDistanceSqToEntity(var7) < var3) + { + var5 = var7; + var3 = this.theAnimal.getDistanceSqToEntity(var7); + } + } + + return var5; + } + + /** + * Spawns a baby animal of the same type. + */ + private void spawnBaby() + { + EntityAgeable var1 = this.theAnimal.createChild(this.targetMate); + + if (var1 != null) + { + this.theAnimal.setGrowingAge(6000); + this.targetMate.setGrowingAge(6000); + this.theAnimal.resetInLove(); + this.targetMate.resetInLove(); + var1.setGrowingAge(-24000); + var1.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F); + this.theWorld.spawnEntityInWorld(var1); + Random var2 = this.theAnimal.getRNG(); + + for (int var3 = 0; var3 < 7; ++var3) + { + double var4 = var2.nextGaussian() * 0.02D; + double var6 = var2.nextGaussian() * 0.02D; + double var8 = var2.nextGaussian() * 0.02D; + this.theWorld.spawnParticle("heart", this.theAnimal.posX + (double)(var2.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, this.theAnimal.posY + 0.5D + (double)(var2.nextFloat() * this.theAnimal.height), this.theAnimal.posZ + (double)(var2.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, var4, var6, var8); + } + + this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, var2.nextInt(7) + 1)); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIMoveIndoors.java b/src/main/java/net/minecraft/src/EntityAIMoveIndoors.java new file mode 100644 index 0000000..66fd456 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIMoveIndoors.java @@ -0,0 +1,91 @@ +package net.minecraft.src; + +public class EntityAIMoveIndoors extends EntityAIBase +{ + private EntityCreature entityObj; + private VillageDoorInfo doorInfo; + private int insidePosX = -1; + private int insidePosZ = -1; + + public EntityAIMoveIndoors(EntityCreature par1EntityCreature) + { + this.entityObj = par1EntityCreature; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if ((!this.entityObj.worldObj.isDaytime() || this.entityObj.worldObj.isRaining()) && !this.entityObj.worldObj.provider.hasNoSky) + { + if (this.entityObj.getRNG().nextInt(50) != 0) + { + return false; + } + else if (this.insidePosX != -1 && this.entityObj.getDistanceSq((double)this.insidePosX, this.entityObj.posY, (double)this.insidePosZ) < 4.0D) + { + return false; + } + else + { + Village var1 = this.entityObj.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posY), MathHelper.floor_double(this.entityObj.posZ), 14); + + if (var1 == null) + { + return false; + } + else + { + this.doorInfo = var1.findNearestDoorUnrestricted(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posY), MathHelper.floor_double(this.entityObj.posZ)); + return this.doorInfo != null; + } + } + } + else + { + return false; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.entityObj.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.insidePosX = -1; + + if (this.entityObj.getDistanceSq((double)this.doorInfo.getInsidePosX(), (double)this.doorInfo.posY, (double)this.doorInfo.getInsidePosZ()) > 256.0D) + { + Vec3 var1 = RandomPositionGenerator.findRandomTargetBlockTowards(this.entityObj, 14, 3, this.entityObj.worldObj.getWorldVec3Pool().getVecFromPool((double)this.doorInfo.getInsidePosX() + 0.5D, (double)this.doorInfo.getInsidePosY(), (double)this.doorInfo.getInsidePosZ() + 0.5D)); + + if (var1 != null) + { + this.entityObj.getNavigator().tryMoveToXYZ(var1.xCoord, var1.yCoord, var1.zCoord, 1.0D); + } + } + else + { + this.entityObj.getNavigator().tryMoveToXYZ((double)this.doorInfo.getInsidePosX() + 0.5D, (double)this.doorInfo.getInsidePosY(), (double)this.doorInfo.getInsidePosZ() + 0.5D, 1.0D); + } + } + + /** + * Resets the task + */ + public void resetTask() + { + this.insidePosX = this.doorInfo.getInsidePosX(); + this.insidePosZ = this.doorInfo.getInsidePosZ(); + this.doorInfo = null; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIMoveThroughVillage.java b/src/main/java/net/minecraft/src/EntityAIMoveThroughVillage.java new file mode 100644 index 0000000..8e428e8 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIMoveThroughVillage.java @@ -0,0 +1,168 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class EntityAIMoveThroughVillage extends EntityAIBase +{ + private EntityCreature theEntity; + private double movementSpeed; + + /** The PathNavigate of our entity. */ + private PathEntity entityPathNavigate; + private VillageDoorInfo doorInfo; + private boolean isNocturnal; + private List doorList = new ArrayList(); + + public EntityAIMoveThroughVillage(EntityCreature par1EntityCreature, double par2, boolean par4) + { + this.theEntity = par1EntityCreature; + this.movementSpeed = par2; + this.isNocturnal = par4; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.func_75414_f(); + + if (this.isNocturnal && this.theEntity.worldObj.isDaytime()) + { + return false; + } + else + { + Village var1 = this.theEntity.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_double(this.theEntity.posX), MathHelper.floor_double(this.theEntity.posY), MathHelper.floor_double(this.theEntity.posZ), 0); + + if (var1 == null) + { + return false; + } + else + { + this.doorInfo = this.func_75412_a(var1); + + if (this.doorInfo == null) + { + return false; + } + else + { + boolean var2 = this.theEntity.getNavigator().getCanBreakDoors(); + this.theEntity.getNavigator().setBreakDoors(false); + this.entityPathNavigate = this.theEntity.getNavigator().getPathToXYZ((double)this.doorInfo.posX, (double)this.doorInfo.posY, (double)this.doorInfo.posZ); + this.theEntity.getNavigator().setBreakDoors(var2); + + if (this.entityPathNavigate != null) + { + return true; + } + else + { + Vec3 var3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 10, 7, this.theEntity.worldObj.getWorldVec3Pool().getVecFromPool((double)this.doorInfo.posX, (double)this.doorInfo.posY, (double)this.doorInfo.posZ)); + + if (var3 == null) + { + return false; + } + else + { + this.theEntity.getNavigator().setBreakDoors(false); + this.entityPathNavigate = this.theEntity.getNavigator().getPathToXYZ(var3.xCoord, var3.yCoord, var3.zCoord); + this.theEntity.getNavigator().setBreakDoors(var2); + return this.entityPathNavigate != null; + } + } + } + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + if (this.theEntity.getNavigator().noPath()) + { + return false; + } + else + { + float var1 = this.theEntity.width + 4.0F; + return this.theEntity.getDistanceSq((double)this.doorInfo.posX, (double)this.doorInfo.posY, (double)this.doorInfo.posZ) > (double)(var1 * var1); + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().setPath(this.entityPathNavigate, this.movementSpeed); + } + + /** + * Resets the task + */ + public void resetTask() + { + if (this.theEntity.getNavigator().noPath() || this.theEntity.getDistanceSq((double)this.doorInfo.posX, (double)this.doorInfo.posY, (double)this.doorInfo.posZ) < 16.0D) + { + this.doorList.add(this.doorInfo); + } + } + + private VillageDoorInfo func_75412_a(Village par1Village) + { + VillageDoorInfo var2 = null; + int var3 = Integer.MAX_VALUE; + List var4 = par1Village.getVillageDoorInfoList(); + Iterator var5 = var4.iterator(); + + while (var5.hasNext()) + { + VillageDoorInfo var6 = (VillageDoorInfo)var5.next(); + int var7 = var6.getDistanceSquared(MathHelper.floor_double(this.theEntity.posX), MathHelper.floor_double(this.theEntity.posY), MathHelper.floor_double(this.theEntity.posZ)); + + if (var7 < var3 && !this.func_75413_a(var6)) + { + var2 = var6; + var3 = var7; + } + } + + return var2; + } + + private boolean func_75413_a(VillageDoorInfo par1VillageDoorInfo) + { + Iterator var2 = this.doorList.iterator(); + VillageDoorInfo var3; + + do + { + if (!var2.hasNext()) + { + return false; + } + + var3 = (VillageDoorInfo)var2.next(); + } + while (par1VillageDoorInfo.posX != var3.posX || par1VillageDoorInfo.posY != var3.posY || par1VillageDoorInfo.posZ != var3.posZ); + + return true; + } + + private void func_75414_f() + { + if (this.doorList.size() > 15) + { + this.doorList.remove(0); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIMoveTowardsRestriction.java b/src/main/java/net/minecraft/src/EntityAIMoveTowardsRestriction.java new file mode 100644 index 0000000..7a2b3de --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIMoveTowardsRestriction.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +public class EntityAIMoveTowardsRestriction extends EntityAIBase +{ + private EntityCreature theEntity; + private double movePosX; + private double movePosY; + private double movePosZ; + private double movementSpeed; + + public EntityAIMoveTowardsRestriction(EntityCreature par1EntityCreature, double par2) + { + this.theEntity = par1EntityCreature; + this.movementSpeed = par2; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theEntity.func_110173_bK()) + { + return false; + } + else + { + ChunkCoordinates var1 = this.theEntity.getHomePosition(); + Vec3 var2 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, this.theEntity.worldObj.getWorldVec3Pool().getVecFromPool((double)var1.posX, (double)var1.posY, (double)var1.posZ)); + + if (var2 == null) + { + return false; + } + else + { + this.movePosX = var2.xCoord; + this.movePosY = var2.yCoord; + this.movePosZ = var2.zCoord; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theEntity.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().tryMoveToXYZ(this.movePosX, this.movePosY, this.movePosZ, this.movementSpeed); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIMoveTowardsTarget.java b/src/main/java/net/minecraft/src/EntityAIMoveTowardsTarget.java new file mode 100644 index 0000000..9e74408 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIMoveTowardsTarget.java @@ -0,0 +1,81 @@ +package net.minecraft.src; + +public class EntityAIMoveTowardsTarget extends EntityAIBase +{ + private EntityCreature theEntity; + private EntityLivingBase targetEntity; + private double movePosX; + private double movePosY; + private double movePosZ; + private double speed; + + /** + * If the distance to the target entity is further than this, this AI task will not run. + */ + private float maxTargetDistance; + + public EntityAIMoveTowardsTarget(EntityCreature par1EntityCreature, double par2, float par4) + { + this.theEntity = par1EntityCreature; + this.speed = par2; + this.maxTargetDistance = par4; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + this.targetEntity = this.theEntity.getAttackTarget(); + + if (this.targetEntity == null) + { + return false; + } + else if (this.targetEntity.getDistanceSqToEntity(this.theEntity) > (double)(this.maxTargetDistance * this.maxTargetDistance)) + { + return false; + } + else + { + Vec3 var1 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, this.theEntity.worldObj.getWorldVec3Pool().getVecFromPool(this.targetEntity.posX, this.targetEntity.posY, this.targetEntity.posZ)); + + if (var1 == null) + { + return false; + } + else + { + this.movePosX = var1.xCoord; + this.movePosY = var1.yCoord; + this.movePosZ = var1.zCoord; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theEntity.getNavigator().noPath() && this.targetEntity.isEntityAlive() && this.targetEntity.getDistanceSqToEntity(this.theEntity) < (double)(this.maxTargetDistance * this.maxTargetDistance); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.targetEntity = null; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().tryMoveToXYZ(this.movePosX, this.movePosY, this.movePosZ, this.speed); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAINearestAttackableTarget.java b/src/main/java/net/minecraft/src/EntityAINearestAttackableTarget.java new file mode 100644 index 0000000..dba729c --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAINearestAttackableTarget.java @@ -0,0 +1,76 @@ +package net.minecraft.src; + +import java.util.Collections; +import java.util.List; + +public class EntityAINearestAttackableTarget extends EntityAITarget +{ + private final Class targetClass; + private final int targetChance; + + /** Instance of EntityAINearestAttackableTargetSorter. */ + private final EntityAINearestAttackableTargetSorter theNearestAttackableTargetSorter; + + /** + * This filter is applied to the Entity search. Only matching entities will be targetted. (null -> no + * restrictions) + */ + private final IEntitySelector targetEntitySelector; + private EntityLivingBase targetEntity; + + public EntityAINearestAttackableTarget(EntityCreature par1EntityCreature, Class par2Class, int par3, boolean par4) + { + this(par1EntityCreature, par2Class, par3, par4, false); + } + + public EntityAINearestAttackableTarget(EntityCreature par1EntityCreature, Class par2Class, int par3, boolean par4, boolean par5) + { + this(par1EntityCreature, par2Class, par3, par4, par5, (IEntitySelector)null); + } + + public EntityAINearestAttackableTarget(EntityCreature par1EntityCreature, Class par2Class, int par3, boolean par4, boolean par5, IEntitySelector par6IEntitySelector) + { + super(par1EntityCreature, par4, par5); + this.targetClass = par2Class; + this.targetChance = par3; + this.theNearestAttackableTargetSorter = new EntityAINearestAttackableTargetSorter(par1EntityCreature); + this.setMutexBits(1); + this.targetEntitySelector = new EntityAINearestAttackableTargetSelector(this, par6IEntitySelector); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.targetChance > 0 && this.taskOwner.getRNG().nextInt(this.targetChance) != 0) + { + return false; + } + else + { + double var1 = this.getTargetDistance(); + List var3 = this.taskOwner.worldObj.selectEntitiesWithinAABB(this.targetClass, this.taskOwner.boundingBox.expand(var1, 4.0D, var1), this.targetEntitySelector); + Collections.sort(var3, this.theNearestAttackableTargetSorter); + + if (var3.isEmpty()) + { + return false; + } + else + { + this.targetEntity = (EntityLivingBase)var3.get(0); + return true; + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.taskOwner.setAttackTarget(this.targetEntity); + super.startExecuting(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAINearestAttackableTargetSelector.java b/src/main/java/net/minecraft/src/EntityAINearestAttackableTargetSelector.java new file mode 100644 index 0000000..f610ff1 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAINearestAttackableTargetSelector.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +class EntityAINearestAttackableTargetSelector implements IEntitySelector +{ + final IEntitySelector field_111103_c; + + final EntityAINearestAttackableTarget field_111102_d; + + EntityAINearestAttackableTargetSelector(EntityAINearestAttackableTarget par1EntityAINearestAttackableTarget, IEntitySelector par2IEntitySelector) + { + this.field_111102_d = par1EntityAINearestAttackableTarget; + this.field_111103_c = par2IEntitySelector; + } + + /** + * Return whether the specified entity is applicable to this filter. + */ + public boolean isEntityApplicable(Entity par1Entity) + { + return !(par1Entity instanceof EntityLivingBase) ? false : (this.field_111103_c != null && !this.field_111103_c.isEntityApplicable(par1Entity) ? false : this.field_111102_d.isSuitableTarget((EntityLivingBase)par1Entity, false)); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAINearestAttackableTargetSorter.java b/src/main/java/net/minecraft/src/EntityAINearestAttackableTargetSorter.java new file mode 100644 index 0000000..8ab635a --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAINearestAttackableTargetSorter.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.util.Comparator; + +public class EntityAINearestAttackableTargetSorter implements Comparator +{ + private final Entity theEntity; + + public EntityAINearestAttackableTargetSorter(Entity par1Entity) + { + this.theEntity = par1Entity; + } + + public int compareDistanceSq(Entity par1Entity, Entity par2Entity) + { + double var3 = this.theEntity.getDistanceSqToEntity(par1Entity); + double var5 = this.theEntity.getDistanceSqToEntity(par2Entity); + return var3 < var5 ? -1 : (var3 > var5 ? 1 : 0); + } + + public int compare(Object par1Obj, Object par2Obj) + { + return this.compareDistanceSq((Entity)par1Obj, (Entity)par2Obj); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIOcelotAttack.java b/src/main/java/net/minecraft/src/EntityAIOcelotAttack.java new file mode 100644 index 0000000..27ebcbe --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIOcelotAttack.java @@ -0,0 +1,83 @@ +package net.minecraft.src; + +public class EntityAIOcelotAttack extends EntityAIBase +{ + World theWorld; + EntityLiving theEntity; + EntityLivingBase theVictim; + int attackCountdown; + + public EntityAIOcelotAttack(EntityLiving par1EntityLiving) + { + this.theEntity = par1EntityLiving; + this.theWorld = par1EntityLiving.worldObj; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + EntityLivingBase var1 = this.theEntity.getAttackTarget(); + + if (var1 == null) + { + return false; + } + else + { + this.theVictim = var1; + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theVictim.isEntityAlive() ? false : (this.theEntity.getDistanceSqToEntity(this.theVictim) > 225.0D ? false : !this.theEntity.getNavigator().noPath() || this.shouldExecute()); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theVictim = null; + this.theEntity.getNavigator().clearPathEntity(); + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theEntity.getLookHelper().setLookPositionWithEntity(this.theVictim, 30.0F, 30.0F); + double var1 = (double)(this.theEntity.width * 2.0F * this.theEntity.width * 2.0F); + double var3 = this.theEntity.getDistanceSq(this.theVictim.posX, this.theVictim.boundingBox.minY, this.theVictim.posZ); + double var5 = 0.8D; + + if (var3 > var1 && var3 < 16.0D) + { + var5 = 1.33D; + } + else if (var3 < 225.0D) + { + var5 = 0.6D; + } + + this.theEntity.getNavigator().tryMoveToEntityLiving(this.theVictim, var5); + this.attackCountdown = Math.max(this.attackCountdown - 1, 0); + + if (var3 <= var1) + { + if (this.attackCountdown <= 0) + { + this.attackCountdown = 20; + this.theEntity.attackEntityAsMob(this.theVictim); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIOcelotSit.java b/src/main/java/net/minecraft/src/EntityAIOcelotSit.java new file mode 100644 index 0000000..2222a5d --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIOcelotSit.java @@ -0,0 +1,153 @@ +package net.minecraft.src; + +public class EntityAIOcelotSit extends EntityAIBase +{ + private final EntityOcelot theOcelot; + private final double field_75404_b; + + /** Tracks for how long the task has been executing */ + private int currentTick; + private int field_75402_d; + + /** For how long the Ocelot should be sitting */ + private int maxSittingTicks; + + /** X Coordinate of a nearby sitable block */ + private int sitableBlockX; + + /** Y Coordinate of a nearby sitable block */ + private int sitableBlockY; + + /** Z Coordinate of a nearby sitable block */ + private int sitableBlockZ; + + public EntityAIOcelotSit(EntityOcelot par1EntityOcelot, double par2) + { + this.theOcelot = par1EntityOcelot; + this.field_75404_b = par2; + this.setMutexBits(5); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return this.theOcelot.isTamed() && !this.theOcelot.isSitting() && this.theOcelot.getRNG().nextDouble() <= 0.006500000134110451D && this.getNearbySitableBlockDistance(); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.currentTick <= this.maxSittingTicks && this.field_75402_d <= 60 && this.isSittableBlock(this.theOcelot.worldObj, this.sitableBlockX, this.sitableBlockY, this.sitableBlockZ); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theOcelot.getNavigator().tryMoveToXYZ((double)((float)this.sitableBlockX) + 0.5D, (double)(this.sitableBlockY + 1), (double)((float)this.sitableBlockZ) + 0.5D, this.field_75404_b); + this.currentTick = 0; + this.field_75402_d = 0; + this.maxSittingTicks = this.theOcelot.getRNG().nextInt(this.theOcelot.getRNG().nextInt(1200) + 1200) + 1200; + this.theOcelot.func_70907_r().setSitting(false); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theOcelot.setSitting(false); + } + + /** + * Updates the task + */ + public void updateTask() + { + ++this.currentTick; + this.theOcelot.func_70907_r().setSitting(false); + + if (this.theOcelot.getDistanceSq((double)this.sitableBlockX, (double)(this.sitableBlockY + 1), (double)this.sitableBlockZ) > 1.0D) + { + this.theOcelot.setSitting(false); + this.theOcelot.getNavigator().tryMoveToXYZ((double)((float)this.sitableBlockX) + 0.5D, (double)(this.sitableBlockY + 1), (double)((float)this.sitableBlockZ) + 0.5D, this.field_75404_b); + ++this.field_75402_d; + } + else if (!this.theOcelot.isSitting()) + { + this.theOcelot.setSitting(true); + } + else + { + --this.field_75402_d; + } + } + + /** + * Searches for a block to sit on within a 8 block range, returns 0 if none found + */ + private boolean getNearbySitableBlockDistance() + { + int var1 = (int)this.theOcelot.posY; + double var2 = 2.147483647E9D; + + for (int var4 = (int)this.theOcelot.posX - 8; (double)var4 < this.theOcelot.posX + 8.0D; ++var4) + { + for (int var5 = (int)this.theOcelot.posZ - 8; (double)var5 < this.theOcelot.posZ + 8.0D; ++var5) + { + if (this.isSittableBlock(this.theOcelot.worldObj, var4, var1, var5) && this.theOcelot.worldObj.isAirBlock(var4, var1 + 1, var5)) + { + double var6 = this.theOcelot.getDistanceSq((double)var4, (double)var1, (double)var5); + + if (var6 < var2) + { + this.sitableBlockX = var4; + this.sitableBlockY = var1; + this.sitableBlockZ = var5; + var2 = var6; + } + } + } + } + + return var2 < 2.147483647E9D; + } + + /** + * Determines whether the Ocelot wants to sit on the block at given coordinate + */ + private boolean isSittableBlock(World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockId(par2, par3, par4); + int var6 = par1World.getBlockMetadata(par2, par3, par4); + + if (var5 == Block.chest.blockID) + { + TileEntityChest var7 = (TileEntityChest)par1World.getBlockTileEntity(par2, par3, par4); + + if (var7.numUsingPlayers < 1) + { + return true; + } + } + else + { + if (var5 == Block.furnaceBurning.blockID) + { + return true; + } + + if (var5 == Block.bed.blockID && !BlockBed.isBlockHeadOfBed(var6)) + { + return true; + } + } + + return false; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIOpenDoor.java b/src/main/java/net/minecraft/src/EntityAIOpenDoor.java new file mode 100644 index 0000000..6b1f702 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIOpenDoor.java @@ -0,0 +1,51 @@ +package net.minecraft.src; + +public class EntityAIOpenDoor extends EntityAIDoorInteract +{ + boolean field_75361_i; + int field_75360_j; + + public EntityAIOpenDoor(EntityLiving par1EntityLiving, boolean par2) + { + super(par1EntityLiving); + this.theEntity = par1EntityLiving; + this.field_75361_i = par2; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.field_75361_i && this.field_75360_j > 0 && super.continueExecuting(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.field_75360_j = 20; + this.targetDoor.onPoweredBlockChange(this.theEntity.worldObj, this.entityPosX, this.entityPosY, this.entityPosZ, true); + } + + /** + * Resets the task + */ + public void resetTask() + { + if (this.field_75361_i) + { + this.targetDoor.onPoweredBlockChange(this.theEntity.worldObj, this.entityPosX, this.entityPosY, this.entityPosZ, false); + } + } + + /** + * Updates the task + */ + public void updateTask() + { + --this.field_75360_j; + super.updateTask(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIOwnerHurtByTarget.java b/src/main/java/net/minecraft/src/EntityAIOwnerHurtByTarget.java new file mode 100644 index 0000000..7a63ce2 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIOwnerHurtByTarget.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +public class EntityAIOwnerHurtByTarget extends EntityAITarget +{ + EntityTameable theDefendingTameable; + EntityLivingBase theOwnerAttacker; + private int field_142051_e; + + public EntityAIOwnerHurtByTarget(EntityTameable par1EntityTameable) + { + super(par1EntityTameable, false); + this.theDefendingTameable = par1EntityTameable; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theDefendingTameable.isTamed()) + { + return false; + } + else + { + EntityLivingBase var1 = this.theDefendingTameable.func_130012_q(); + + if (var1 == null) + { + return false; + } + else + { + this.theOwnerAttacker = var1.getAITarget(); + int var2 = var1.func_142015_aE(); + return var2 != this.field_142051_e && this.isSuitableTarget(this.theOwnerAttacker, false) && this.theDefendingTameable.func_142018_a(this.theOwnerAttacker, var1); + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.taskOwner.setAttackTarget(this.theOwnerAttacker); + EntityLivingBase var1 = this.theDefendingTameable.func_130012_q(); + + if (var1 != null) + { + this.field_142051_e = var1.func_142015_aE(); + } + + super.startExecuting(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIOwnerHurtTarget.java b/src/main/java/net/minecraft/src/EntityAIOwnerHurtTarget.java new file mode 100644 index 0000000..cad0c44 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIOwnerHurtTarget.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +public class EntityAIOwnerHurtTarget extends EntityAITarget +{ + EntityTameable theEntityTameable; + EntityLivingBase theTarget; + private int field_142050_e; + + public EntityAIOwnerHurtTarget(EntityTameable par1EntityTameable) + { + super(par1EntityTameable, false); + this.theEntityTameable = par1EntityTameable; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theEntityTameable.isTamed()) + { + return false; + } + else + { + EntityLivingBase var1 = this.theEntityTameable.func_130012_q(); + + if (var1 == null) + { + return false; + } + else + { + this.theTarget = var1.getLastAttacker(); + int var2 = var1.getLastAttackerTime(); + return var2 != this.field_142050_e && this.isSuitableTarget(this.theTarget, false) && this.theEntityTameable.func_142018_a(this.theTarget, var1); + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.taskOwner.setAttackTarget(this.theTarget); + EntityLivingBase var1 = this.theEntityTameable.func_130012_q(); + + if (var1 != null) + { + this.field_142050_e = var1.getLastAttackerTime(); + } + + super.startExecuting(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIPanic.java b/src/main/java/net/minecraft/src/EntityAIPanic.java new file mode 100644 index 0000000..5785f2c --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIPanic.java @@ -0,0 +1,60 @@ +package net.minecraft.src; + +public class EntityAIPanic extends EntityAIBase +{ + private EntityCreature theEntityCreature; + private double speed; + private double randPosX; + private double randPosY; + private double randPosZ; + + public EntityAIPanic(EntityCreature par1EntityCreature, double par2) + { + this.theEntityCreature = par1EntityCreature; + this.speed = par2; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theEntityCreature.getAITarget() == null && !this.theEntityCreature.isBurning()) + { + return false; + } + else + { + Vec3 var1 = RandomPositionGenerator.findRandomTarget(this.theEntityCreature, 5, 4); + + if (var1 == null) + { + return false; + } + else + { + this.randPosX = var1.xCoord; + this.randPosY = var1.yCoord; + this.randPosZ = var1.zCoord; + return true; + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntityCreature.getNavigator().tryMoveToXYZ(this.randPosX, this.randPosY, this.randPosZ, this.speed); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.theEntityCreature.getNavigator().noPath(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIPlay.java b/src/main/java/net/minecraft/src/EntityAIPlay.java new file mode 100644 index 0000000..969cfc9 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIPlay.java @@ -0,0 +1,125 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class EntityAIPlay extends EntityAIBase +{ + private EntityVillager villagerObj; + private EntityLivingBase targetVillager; + private double field_75261_c; + private int playTime; + + public EntityAIPlay(EntityVillager par1EntityVillager, double par2) + { + this.villagerObj = par1EntityVillager; + this.field_75261_c = par2; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.villagerObj.getGrowingAge() >= 0) + { + return false; + } + else if (this.villagerObj.getRNG().nextInt(400) != 0) + { + return false; + } + else + { + List var1 = this.villagerObj.worldObj.getEntitiesWithinAABB(EntityVillager.class, this.villagerObj.boundingBox.expand(6.0D, 3.0D, 6.0D)); + double var2 = Double.MAX_VALUE; + Iterator var4 = var1.iterator(); + + while (var4.hasNext()) + { + EntityVillager var5 = (EntityVillager)var4.next(); + + if (var5 != this.villagerObj && !var5.isPlaying() && var5.getGrowingAge() < 0) + { + double var6 = var5.getDistanceSqToEntity(this.villagerObj); + + if (var6 <= var2) + { + var2 = var6; + this.targetVillager = var5; + } + } + } + + if (this.targetVillager == null) + { + Vec3 var8 = RandomPositionGenerator.findRandomTarget(this.villagerObj, 16, 3); + + if (var8 == null) + { + return false; + } + } + + return true; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.playTime > 0; + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + if (this.targetVillager != null) + { + this.villagerObj.setPlaying(true); + } + + this.playTime = 1000; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.villagerObj.setPlaying(false); + this.targetVillager = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + --this.playTime; + + if (this.targetVillager != null) + { + if (this.villagerObj.getDistanceSqToEntity(this.targetVillager) > 4.0D) + { + this.villagerObj.getNavigator().tryMoveToEntityLiving(this.targetVillager, this.field_75261_c); + } + } + else if (this.villagerObj.getNavigator().noPath()) + { + Vec3 var1 = RandomPositionGenerator.findRandomTarget(this.villagerObj, 16, 3); + + if (var1 == null) + { + return; + } + + this.villagerObj.getNavigator().tryMoveToXYZ(var1.xCoord, var1.yCoord, var1.zCoord, this.field_75261_c); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIRestrictOpenDoor.java b/src/main/java/net/minecraft/src/EntityAIRestrictOpenDoor.java new file mode 100644 index 0000000..febf3e4 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIRestrictOpenDoor.java @@ -0,0 +1,72 @@ +package net.minecraft.src; + +public class EntityAIRestrictOpenDoor extends EntityAIBase +{ + private EntityCreature entityObj; + private VillageDoorInfo frontDoor; + + public EntityAIRestrictOpenDoor(EntityCreature par1EntityCreature) + { + this.entityObj = par1EntityCreature; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.entityObj.worldObj.isDaytime()) + { + return false; + } + else + { + Village var1 = this.entityObj.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posY), MathHelper.floor_double(this.entityObj.posZ), 16); + + if (var1 == null) + { + return false; + } + else + { + this.frontDoor = var1.findNearestDoor(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posY), MathHelper.floor_double(this.entityObj.posZ)); + return this.frontDoor == null ? false : (double)this.frontDoor.getInsideDistanceSquare(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posY), MathHelper.floor_double(this.entityObj.posZ)) < 2.25D; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.entityObj.worldObj.isDaytime() ? false : !this.frontDoor.isDetachedFromVillageFlag && this.frontDoor.isInside(MathHelper.floor_double(this.entityObj.posX), MathHelper.floor_double(this.entityObj.posZ)); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.entityObj.getNavigator().setBreakDoors(false); + this.entityObj.getNavigator().setEnterDoors(false); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.entityObj.getNavigator().setBreakDoors(true); + this.entityObj.getNavigator().setEnterDoors(true); + this.frontDoor = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.frontDoor.incrementDoorOpeningRestrictionCounter(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIRestrictSun.java b/src/main/java/net/minecraft/src/EntityAIRestrictSun.java new file mode 100644 index 0000000..42f5993 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIRestrictSun.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +public class EntityAIRestrictSun extends EntityAIBase +{ + private EntityCreature theEntity; + + public EntityAIRestrictSun(EntityCreature par1EntityCreature) + { + this.theEntity = par1EntityCreature; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return this.theEntity.worldObj.isDaytime(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().setAvoidSun(true); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theEntity.getNavigator().setAvoidSun(false); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIRunAroundLikeCrazy.java b/src/main/java/net/minecraft/src/EntityAIRunAroundLikeCrazy.java new file mode 100644 index 0000000..a3e3bbd --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIRunAroundLikeCrazy.java @@ -0,0 +1,89 @@ +package net.minecraft.src; + +public class EntityAIRunAroundLikeCrazy extends EntityAIBase +{ + private EntityHorse horseHost; + private double field_111178_b; + private double field_111179_c; + private double field_111176_d; + private double field_111177_e; + + public EntityAIRunAroundLikeCrazy(EntityHorse par1EntityHorse, double par2) + { + this.horseHost = par1EntityHorse; + this.field_111178_b = par2; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.horseHost.isTame() && this.horseHost.riddenByEntity != null) + { + Vec3 var1 = RandomPositionGenerator.findRandomTarget(this.horseHost, 5, 4); + + if (var1 == null) + { + return false; + } + else + { + this.field_111179_c = var1.xCoord; + this.field_111176_d = var1.yCoord; + this.field_111177_e = var1.zCoord; + return true; + } + } + else + { + return false; + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.horseHost.getNavigator().tryMoveToXYZ(this.field_111179_c, this.field_111176_d, this.field_111177_e, this.field_111178_b); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.horseHost.getNavigator().noPath() && this.horseHost.riddenByEntity != null; + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.horseHost.getRNG().nextInt(50) == 0) + { + if (this.horseHost.riddenByEntity instanceof EntityPlayer) + { + int var1 = this.horseHost.getTemper(); + int var2 = this.horseHost.getMaxTemper(); + + if (var2 > 0 && this.horseHost.getRNG().nextInt(var2) < var1) + { + this.horseHost.setTamedBy((EntityPlayer)this.horseHost.riddenByEntity); + this.horseHost.worldObj.setEntityState(this.horseHost, (byte)7); + return; + } + + this.horseHost.increaseTemper(5); + } + + this.horseHost.riddenByEntity.mountEntity((Entity)null); + this.horseHost.riddenByEntity = null; + this.horseHost.makeHorseRearWithSound(); + this.horseHost.worldObj.setEntityState(this.horseHost, (byte)6); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAISit.java b/src/main/java/net/minecraft/src/EntityAISit.java new file mode 100644 index 0000000..0c48e10 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAISit.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +public class EntityAISit extends EntityAIBase +{ + private EntityTameable theEntity; + + /** If the EntityTameable is sitting. */ + private boolean isSitting; + + public EntityAISit(EntityTameable par1EntityTameable) + { + this.theEntity = par1EntityTameable; + this.setMutexBits(5); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.theEntity.isTamed()) + { + return false; + } + else if (this.theEntity.isInWater()) + { + return false; + } + else if (!this.theEntity.onGround) + { + return false; + } + else + { + EntityLivingBase var1 = this.theEntity.func_130012_q(); + return var1 == null ? true : (this.theEntity.getDistanceSqToEntity(var1) < 144.0D && var1.getAITarget() != null ? false : this.isSitting); + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.theEntity.getNavigator().clearPathEntity(); + this.theEntity.setSitting(true); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.theEntity.setSitting(false); + } + + /** + * Sets the sitting flag. + */ + public void setSitting(boolean par1) + { + this.isSitting = par1; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAISwimming.java b/src/main/java/net/minecraft/src/EntityAISwimming.java new file mode 100644 index 0000000..3baeb7f --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAISwimming.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +public class EntityAISwimming extends EntityAIBase +{ + private EntityLiving theEntity; + + public EntityAISwimming(EntityLiving par1EntityLiving) + { + this.theEntity = par1EntityLiving; + this.setMutexBits(4); + par1EntityLiving.getNavigator().setCanSwim(true); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return this.theEntity.isInWater() || this.theEntity.handleLavaMovement(); + } + + /** + * Updates the task + */ + public void updateTask() + { + if (this.theEntity.getRNG().nextFloat() < 0.8F) + { + this.theEntity.getJumpHelper().setJumping(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAITarget.java b/src/main/java/net/minecraft/src/EntityAITarget.java new file mode 100644 index 0000000..05b2267 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAITarget.java @@ -0,0 +1,208 @@ +package net.minecraft.src; + +public abstract class EntityAITarget extends EntityAIBase +{ + /** The entity that this task belongs to */ + protected EntityCreature taskOwner; + + /** + * If true, EntityAI targets must be able to be seen (cannot be blocked by walls) to be suitable targets. + */ + protected boolean shouldCheckSight; + + /** + * When true, only entities that can be reached with minimal effort will be targetted. + */ + private boolean nearbyOnly; + + /** + * When nearbyOnly is true: 0 -> No target, but OK to search; 1 -> Nearby target found; 2 -> Target too far. + */ + private int targetSearchStatus; + + /** + * When nearbyOnly is true, this throttles target searching to avoid excessive pathfinding. + */ + private int targetSearchDelay; + private int field_75298_g; + + public EntityAITarget(EntityCreature par1EntityCreature, boolean par2) + { + this(par1EntityCreature, par2, false); + } + + public EntityAITarget(EntityCreature par1EntityCreature, boolean par2, boolean par3) + { + this.taskOwner = par1EntityCreature; + this.shouldCheckSight = par2; + this.nearbyOnly = par3; + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + EntityLivingBase var1 = this.taskOwner.getAttackTarget(); + + if (var1 == null) + { + return false; + } + else if (!var1.isEntityAlive()) + { + return false; + } + else + { + double var2 = this.getTargetDistance(); + + if (this.taskOwner.getDistanceSqToEntity(var1) > var2 * var2) + { + return false; + } + else + { + if (this.shouldCheckSight) + { + if (this.taskOwner.getEntitySenses().canSee(var1)) + { + this.field_75298_g = 0; + } + else if (++this.field_75298_g > 60) + { + return false; + } + } + + return true; + } + } + } + + protected double getTargetDistance() + { + AttributeInstance var1 = this.taskOwner.getEntityAttribute(SharedMonsterAttributes.followRange); + return var1 == null ? 16.0D : var1.getAttributeValue(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.targetSearchStatus = 0; + this.targetSearchDelay = 0; + this.field_75298_g = 0; + } + + /** + * Resets the task + */ + public void resetTask() + { + this.taskOwner.setAttackTarget((EntityLivingBase)null); + } + + /** + * A method used to see if an entity is a suitable target through a number of checks. + */ + protected boolean isSuitableTarget(EntityLivingBase par1EntityLivingBase, boolean par2) + { + if (par1EntityLivingBase == null) + { + return false; + } + else if (par1EntityLivingBase == this.taskOwner) + { + return false; + } + else if (!par1EntityLivingBase.isEntityAlive()) + { + return false; + } + else if (!this.taskOwner.canAttackClass(par1EntityLivingBase.getClass())) + { + return false; + } + else + { + if (this.taskOwner instanceof EntityOwnable && org.apache.commons.lang3.StringUtils.isNotEmpty(((EntityOwnable)this.taskOwner).getOwnerName())) + { + if (par1EntityLivingBase instanceof EntityOwnable && ((EntityOwnable)this.taskOwner).getOwnerName().equals(((EntityOwnable)par1EntityLivingBase).getOwnerName())) + { + return false; + } + + if (par1EntityLivingBase == ((EntityOwnable)this.taskOwner).getOwner()) + { + return false; + } + } + else if (par1EntityLivingBase instanceof EntityPlayer && !par2 && ((EntityPlayer)par1EntityLivingBase).capabilities.disableDamage) + { + return false; + } + + if (!this.taskOwner.func_110176_b(MathHelper.floor_double(par1EntityLivingBase.posX), MathHelper.floor_double(par1EntityLivingBase.posY), MathHelper.floor_double(par1EntityLivingBase.posZ))) + { + return false; + } + else if (this.shouldCheckSight && !this.taskOwner.getEntitySenses().canSee(par1EntityLivingBase)) + { + return false; + } + else + { + if (this.nearbyOnly) + { + if (--this.targetSearchDelay <= 0) + { + this.targetSearchStatus = 0; + } + + if (this.targetSearchStatus == 0) + { + this.targetSearchStatus = this.canEasilyReach(par1EntityLivingBase) ? 1 : 2; + } + + if (this.targetSearchStatus == 2) + { + return false; + } + } + + return true; + } + } + } + + /** + * Checks to see if this entity can find a short path to the given target. + */ + private boolean canEasilyReach(EntityLivingBase par1EntityLivingBase) + { + this.targetSearchDelay = 10 + this.taskOwner.getRNG().nextInt(5); + PathEntity var2 = this.taskOwner.getNavigator().getPathToEntityLiving(par1EntityLivingBase); + + if (var2 == null) + { + return false; + } + else + { + PathPoint var3 = var2.getFinalPathPoint(); + + if (var3 == null) + { + return false; + } + else + { + int var4 = var3.xCoord - MathHelper.floor_double(par1EntityLivingBase.posX); + int var5 = var3.zCoord - MathHelper.floor_double(par1EntityLivingBase.posZ); + return (double)(var4 * var4 + var5 * var5) <= 2.25D; + } + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityAITargetNonTamed.java b/src/main/java/net/minecraft/src/EntityAITargetNonTamed.java new file mode 100644 index 0000000..e6256af --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAITargetNonTamed.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +public class EntityAITargetNonTamed extends EntityAINearestAttackableTarget +{ + private EntityTameable theTameable; + + public EntityAITargetNonTamed(EntityTameable par1EntityTameable, Class par2Class, int par3, boolean par4) + { + super(par1EntityTameable, par2Class, par3, par4); + this.theTameable = par1EntityTameable; + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + return !this.theTameable.isTamed() && super.shouldExecute(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAITaskEntry.java b/src/main/java/net/minecraft/src/EntityAITaskEntry.java new file mode 100644 index 0000000..d929718 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAITaskEntry.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +class EntityAITaskEntry +{ + /** The EntityAIBase object. */ + public EntityAIBase action; + + /** Priority of the EntityAIBase */ + public int priority; + + /** The EntityAITasks object of which this is an entry. */ + final EntityAITasks tasks; + + public EntityAITaskEntry(EntityAITasks par1EntityAITasks, int par2, EntityAIBase par3EntityAIBase) + { + this.tasks = par1EntityAITasks; + this.priority = par2; + this.action = par3EntityAIBase; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAITasks.java b/src/main/java/net/minecraft/src/EntityAITasks.java new file mode 100644 index 0000000..91323de --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAITasks.java @@ -0,0 +1,181 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class EntityAITasks +{ + /** A list of EntityAITaskEntrys in EntityAITasks. */ + private List taskEntries = new ArrayList(); + + /** A list of EntityAITaskEntrys that are currently being executed. */ + private List executingTaskEntries = new ArrayList(); + + /** Instance of Profiler. */ + private final Profiler theProfiler; + private int tickCount; + private int tickRate = 3; + + public EntityAITasks(Profiler par1Profiler) + { + this.theProfiler = par1Profiler; + } + + public void addTask(int par1, EntityAIBase par2EntityAIBase) + { + this.taskEntries.add(new EntityAITaskEntry(this, par1, par2EntityAIBase)); + } + + /** + * removes the indicated task from the entity's AI tasks. + */ + public void removeTask(EntityAIBase par1EntityAIBase) + { + Iterator var2 = this.taskEntries.iterator(); + + while (var2.hasNext()) + { + EntityAITaskEntry var3 = (EntityAITaskEntry)var2.next(); + EntityAIBase var4 = var3.action; + + if (var4 == par1EntityAIBase) + { + if (this.executingTaskEntries.contains(var3)) + { + var4.resetTask(); + this.executingTaskEntries.remove(var3); + } + + var2.remove(); + } + } + } + + public void onUpdateTasks() + { + ArrayList var1 = new ArrayList(); + Iterator var2; + EntityAITaskEntry var3; + + if (this.tickCount++ % this.tickRate == 0) + { + var2 = this.taskEntries.iterator(); + + while (var2.hasNext()) + { + var3 = (EntityAITaskEntry)var2.next(); + boolean var4 = this.executingTaskEntries.contains(var3); + + if (var4) + { + if (this.canUse(var3) && this.canContinue(var3)) + { + continue; + } + + var3.action.resetTask(); + this.executingTaskEntries.remove(var3); + } + + if (this.canUse(var3) && var3.action.shouldExecute()) + { + var1.add(var3); + this.executingTaskEntries.add(var3); + } + } + } + else + { + var2 = this.executingTaskEntries.iterator(); + + while (var2.hasNext()) + { + var3 = (EntityAITaskEntry)var2.next(); + + if (!var3.action.continueExecuting()) + { + var3.action.resetTask(); + var2.remove(); + } + } + } + + this.theProfiler.startSection("goalStart"); + var2 = var1.iterator(); + + while (var2.hasNext()) + { + var3 = (EntityAITaskEntry)var2.next(); + this.theProfiler.startSection(var3.action.getClass().getSimpleName()); + var3.action.startExecuting(); + this.theProfiler.endSection(); + } + + this.theProfiler.endSection(); + this.theProfiler.startSection("goalTick"); + var2 = this.executingTaskEntries.iterator(); + + while (var2.hasNext()) + { + var3 = (EntityAITaskEntry)var2.next(); + var3.action.updateTask(); + } + + this.theProfiler.endSection(); + } + + /** + * Determine if a specific AI Task should continue being executed. + */ + private boolean canContinue(EntityAITaskEntry par1EntityAITaskEntry) + { + this.theProfiler.startSection("canContinue"); + boolean var2 = par1EntityAITaskEntry.action.continueExecuting(); + this.theProfiler.endSection(); + return var2; + } + + /** + * Determine if a specific AI Task can be executed, which means that all running higher (= lower int value) priority + * tasks are compatible with it or all lower priority tasks can be interrupted. + */ + private boolean canUse(EntityAITaskEntry par1EntityAITaskEntry) + { + this.theProfiler.startSection("canUse"); + Iterator var2 = this.taskEntries.iterator(); + + while (var2.hasNext()) + { + EntityAITaskEntry var3 = (EntityAITaskEntry)var2.next(); + + if (var3 != par1EntityAITaskEntry) + { + if (par1EntityAITaskEntry.priority >= var3.priority) + { + if (this.executingTaskEntries.contains(var3) && !this.areTasksCompatible(par1EntityAITaskEntry, var3)) + { + this.theProfiler.endSection(); + return false; + } + } + else if (this.executingTaskEntries.contains(var3) && !var3.action.isInterruptible()) + { + this.theProfiler.endSection(); + return false; + } + } + } + + this.theProfiler.endSection(); + return true; + } + + /** + * Returns whether two EntityAITaskEntries can be executed concurrently + */ + private boolean areTasksCompatible(EntityAITaskEntry par1EntityAITaskEntry, EntityAITaskEntry par2EntityAITaskEntry) + { + return (par1EntityAITaskEntry.action.getMutexBits() & par2EntityAITaskEntry.action.getMutexBits()) == 0; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAITempt.java b/src/main/java/net/minecraft/src/EntityAITempt.java new file mode 100644 index 0000000..394099b --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAITempt.java @@ -0,0 +1,160 @@ +package net.minecraft.src; + +public class EntityAITempt extends EntityAIBase +{ + /** The entity using this AI that is tempted by the player. */ + private EntityCreature temptedEntity; + private double field_75282_b; + + /** X position of player tempting this mob */ + private double targetX; + + /** Y position of player tempting this mob */ + private double targetY; + + /** Z position of player tempting this mob */ + private double targetZ; + private double field_75278_f; + private double field_75279_g; + + /** The player that is tempting the entity that is using this AI. */ + private EntityPlayer temptingPlayer; + + /** + * A counter that is decremented each time the shouldExecute method is called. The shouldExecute method will always + * return false if delayTemptCounter is greater than 0. + */ + private int delayTemptCounter; + + /** True if this EntityAITempt task is running */ + private boolean isRunning; + + /** + * This field saves the ID of the items that can be used to breed entities with this behaviour. + */ + private int breedingFood; + + /** + * Whether the entity using this AI will be scared by the tempter's sudden movement. + */ + private boolean scaredByPlayerMovement; + private boolean field_75286_m; + + public EntityAITempt(EntityCreature par1EntityCreature, double par2, int par4, boolean par5) + { + this.temptedEntity = par1EntityCreature; + this.field_75282_b = par2; + this.breedingFood = par4; + this.scaredByPlayerMovement = par5; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.delayTemptCounter > 0) + { + --this.delayTemptCounter; + return false; + } + else + { + this.temptingPlayer = this.temptedEntity.worldObj.getClosestPlayerToEntity(this.temptedEntity, 10.0D); + + if (this.temptingPlayer == null) + { + return false; + } + else + { + ItemStack var1 = this.temptingPlayer.getCurrentEquippedItem(); + return var1 == null ? false : var1.itemID == this.breedingFood; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + if (this.scaredByPlayerMovement) + { + if (this.temptedEntity.getDistanceSqToEntity(this.temptingPlayer) < 36.0D) + { + if (this.temptingPlayer.getDistanceSq(this.targetX, this.targetY, this.targetZ) > 0.010000000000000002D) + { + return false; + } + + if (Math.abs((double)this.temptingPlayer.rotationPitch - this.field_75278_f) > 5.0D || Math.abs((double)this.temptingPlayer.rotationYaw - this.field_75279_g) > 5.0D) + { + return false; + } + } + else + { + this.targetX = this.temptingPlayer.posX; + this.targetY = this.temptingPlayer.posY; + this.targetZ = this.temptingPlayer.posZ; + } + + this.field_75278_f = (double)this.temptingPlayer.rotationPitch; + this.field_75279_g = (double)this.temptingPlayer.rotationYaw; + } + + return this.shouldExecute(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.targetX = this.temptingPlayer.posX; + this.targetY = this.temptingPlayer.posY; + this.targetZ = this.temptingPlayer.posZ; + this.isRunning = true; + this.field_75286_m = this.temptedEntity.getNavigator().getAvoidsWater(); + this.temptedEntity.getNavigator().setAvoidsWater(false); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.temptingPlayer = null; + this.temptedEntity.getNavigator().clearPathEntity(); + this.delayTemptCounter = 100; + this.isRunning = false; + this.temptedEntity.getNavigator().setAvoidsWater(this.field_75286_m); + } + + /** + * Updates the task + */ + public void updateTask() + { + this.temptedEntity.getLookHelper().setLookPositionWithEntity(this.temptingPlayer, 30.0F, (float)this.temptedEntity.getVerticalFaceSpeed()); + + if (this.temptedEntity.getDistanceSqToEntity(this.temptingPlayer) < 6.25D) + { + this.temptedEntity.getNavigator().clearPathEntity(); + } + else + { + this.temptedEntity.getNavigator().tryMoveToEntityLiving(this.temptingPlayer, this.field_75282_b); + } + } + + /** + * @see #isRunning + */ + public boolean isRunning() + { + return this.isRunning; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAITradePlayer.java b/src/main/java/net/minecraft/src/EntityAITradePlayer.java new file mode 100644 index 0000000..474d0df --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAITradePlayer.java @@ -0,0 +1,56 @@ +package net.minecraft.src; + +public class EntityAITradePlayer extends EntityAIBase +{ + private EntityVillager villager; + + public EntityAITradePlayer(EntityVillager par1EntityVillager) + { + this.villager = par1EntityVillager; + this.setMutexBits(5); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (!this.villager.isEntityAlive()) + { + return false; + } + else if (this.villager.isInWater()) + { + return false; + } + else if (!this.villager.onGround) + { + return false; + } + else if (this.villager.velocityChanged) + { + return false; + } + else + { + EntityPlayer var1 = this.villager.getCustomer(); + return var1 == null ? false : (this.villager.getDistanceSqToEntity(var1) > 16.0D ? false : var1.openContainer instanceof Container); + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.villager.getNavigator().clearPathEntity(); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.villager.setCustomer((EntityPlayer)null); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIVillagerMate.java b/src/main/java/net/minecraft/src/EntityAIVillagerMate.java new file mode 100644 index 0000000..f4db1ff --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIVillagerMate.java @@ -0,0 +1,133 @@ +package net.minecraft.src; + +public class EntityAIVillagerMate extends EntityAIBase +{ + private EntityVillager villagerObj; + private EntityVillager mate; + private World worldObj; + private int matingTimeout; + Village villageObj; + + public EntityAIVillagerMate(EntityVillager par1EntityVillager) + { + this.villagerObj = par1EntityVillager; + this.worldObj = par1EntityVillager.worldObj; + this.setMutexBits(3); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.villagerObj.getGrowingAge() != 0) + { + return false; + } + else if (this.villagerObj.getRNG().nextInt(500) != 0) + { + return false; + } + else + { + this.villageObj = this.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_double(this.villagerObj.posX), MathHelper.floor_double(this.villagerObj.posY), MathHelper.floor_double(this.villagerObj.posZ), 0); + + if (this.villageObj == null) + { + return false; + } + else if (!this.checkSufficientDoorsPresentForNewVillager()) + { + return false; + } + else + { + Entity var1 = this.worldObj.findNearestEntityWithinAABB(EntityVillager.class, this.villagerObj.boundingBox.expand(8.0D, 3.0D, 8.0D), this.villagerObj); + + if (var1 == null) + { + return false; + } + else + { + this.mate = (EntityVillager)var1; + return this.mate.getGrowingAge() == 0; + } + } + } + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.matingTimeout = 300; + this.villagerObj.setMating(true); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.villageObj = null; + this.mate = null; + this.villagerObj.setMating(false); + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return this.matingTimeout >= 0 && this.checkSufficientDoorsPresentForNewVillager() && this.villagerObj.getGrowingAge() == 0; + } + + /** + * Updates the task + */ + public void updateTask() + { + --this.matingTimeout; + this.villagerObj.getLookHelper().setLookPositionWithEntity(this.mate, 10.0F, 30.0F); + + if (this.villagerObj.getDistanceSqToEntity(this.mate) > 2.25D) + { + this.villagerObj.getNavigator().tryMoveToEntityLiving(this.mate, 0.25D); + } + else if (this.matingTimeout == 0 && this.mate.isMating()) + { + this.giveBirth(); + } + + if (this.villagerObj.getRNG().nextInt(35) == 0) + { + this.worldObj.setEntityState(this.villagerObj, (byte)12); + } + } + + private boolean checkSufficientDoorsPresentForNewVillager() + { + if (!this.villageObj.isMatingSeason()) + { + return false; + } + else + { + int var1 = (int)((double)((float)this.villageObj.getNumVillageDoors()) * 0.35D); + return this.villageObj.getNumVillagers() < var1; + } + } + + private void giveBirth() + { + EntityVillager var1 = this.villagerObj.func_90012_b(this.mate); + this.mate.setGrowingAge(6000); + this.villagerObj.setGrowingAge(6000); + var1.setGrowingAge(-24000); + var1.setLocationAndAngles(this.villagerObj.posX, this.villagerObj.posY, this.villagerObj.posZ, 0.0F, 0.0F); + this.worldObj.spawnEntityInWorld(var1); + this.worldObj.setEntityState(var1, (byte)12); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIWander.java b/src/main/java/net/minecraft/src/EntityAIWander.java new file mode 100644 index 0000000..59adfd7 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIWander.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +public class EntityAIWander extends EntityAIBase +{ + private EntityCreature entity; + private double xPosition; + private double yPosition; + private double zPosition; + private double speed; + + public EntityAIWander(EntityCreature par1EntityCreature, double par2) + { + this.entity = par1EntityCreature; + this.speed = par2; + this.setMutexBits(1); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.entity.getAge() >= 100) + { + return false; + } + else if (this.entity.getRNG().nextInt(120) != 0) + { + return false; + } + else + { + Vec3 var1 = RandomPositionGenerator.findRandomTarget(this.entity, 10, 7); + + if (var1 == null) + { + return false; + } + else + { + this.xPosition = var1.xCoord; + this.yPosition = var1.yCoord; + this.zPosition = var1.zCoord; + return true; + } + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.entity.getNavigator().noPath(); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.entity.getNavigator().tryMoveToXYZ(this.xPosition, this.yPosition, this.zPosition, this.speed); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIWatchClosest.java b/src/main/java/net/minecraft/src/EntityAIWatchClosest.java new file mode 100644 index 0000000..1e4ad8f --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIWatchClosest.java @@ -0,0 +1,95 @@ +package net.minecraft.src; + +public class EntityAIWatchClosest extends EntityAIBase +{ + private EntityLiving theWatcher; + + /** The closest entity which is being watched by this one. */ + protected Entity closestEntity; + + /** This is the Maximum distance that the AI will look for the Entity */ + private float maxDistanceForPlayer; + private int lookTime; + private float field_75331_e; + private Class watchedClass; + + public EntityAIWatchClosest(EntityLiving par1EntityLiving, Class par2Class, float par3) + { + this.theWatcher = par1EntityLiving; + this.watchedClass = par2Class; + this.maxDistanceForPlayer = par3; + this.field_75331_e = 0.02F; + this.setMutexBits(2); + } + + public EntityAIWatchClosest(EntityLiving par1EntityLiving, Class par2Class, float par3, float par4) + { + this.theWatcher = par1EntityLiving; + this.watchedClass = par2Class; + this.maxDistanceForPlayer = par3; + this.field_75331_e = par4; + this.setMutexBits(2); + } + + /** + * Returns whether the EntityAIBase should begin execution. + */ + public boolean shouldExecute() + { + if (this.theWatcher.getRNG().nextFloat() >= this.field_75331_e) + { + return false; + } + else + { + if (this.theWatcher.getAttackTarget() != null) + { + this.closestEntity = this.theWatcher.getAttackTarget(); + } + + if (this.watchedClass == EntityPlayer.class) + { + this.closestEntity = this.theWatcher.worldObj.getClosestPlayerToEntity(this.theWatcher, (double)this.maxDistanceForPlayer); + } + else + { + this.closestEntity = this.theWatcher.worldObj.findNearestEntityWithinAABB(this.watchedClass, this.theWatcher.boundingBox.expand((double)this.maxDistanceForPlayer, 3.0D, (double)this.maxDistanceForPlayer), this.theWatcher); + } + + return this.closestEntity != null; + } + } + + /** + * Returns whether an in-progress EntityAIBase should continue executing + */ + public boolean continueExecuting() + { + return !this.closestEntity.isEntityAlive() ? false : (this.theWatcher.getDistanceSqToEntity(this.closestEntity) > (double)(this.maxDistanceForPlayer * this.maxDistanceForPlayer) ? false : this.lookTime > 0); + } + + /** + * Execute a one shot task or start executing a continuous task + */ + public void startExecuting() + { + this.lookTime = 40 + this.theWatcher.getRNG().nextInt(40); + } + + /** + * Resets the task + */ + public void resetTask() + { + this.closestEntity = null; + } + + /** + * Updates the task + */ + public void updateTask() + { + this.theWatcher.getLookHelper().setLookPosition(this.closestEntity.posX, this.closestEntity.posY + (double)this.closestEntity.getEyeHeight(), this.closestEntity.posZ, 10.0F, (float)this.theWatcher.getVerticalFaceSpeed()); + --this.lookTime; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAIWatchClosest2.java b/src/main/java/net/minecraft/src/EntityAIWatchClosest2.java new file mode 100644 index 0000000..c199682 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAIWatchClosest2.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public class EntityAIWatchClosest2 extends EntityAIWatchClosest +{ + public EntityAIWatchClosest2(EntityLiving par1EntityLiving, Class par2Class, float par3, float par4) + { + super(par1EntityLiving, par2Class, par3, par4); + this.setMutexBits(3); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAgeable.java b/src/main/java/net/minecraft/src/EntityAgeable.java new file mode 100644 index 0000000..5c36a74 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAgeable.java @@ -0,0 +1,189 @@ +package net.minecraft.src; + +public abstract class EntityAgeable extends EntityCreature +{ + private float field_98056_d = -1.0F; + private float field_98057_e; + + public EntityAgeable(World par1World) + { + super(par1World); + } + + public abstract EntityAgeable createChild(EntityAgeable var1); + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + + if (var2 != null && var2.itemID == Item.monsterPlacer.itemID) + { + if (!this.worldObj.isRemote) + { + Class var3 = EntityList.getClassFromID(var2.getItemDamage()); + + if (var3 != null && var3.isAssignableFrom(this.getClass())) + { + EntityAgeable var4 = this.createChild(this); + + if (var4 != null) + { + var4.setGrowingAge(-24000); + var4.setLocationAndAngles(this.posX, this.posY, this.posZ, 0.0F, 0.0F); + this.worldObj.spawnEntityInWorld(var4); + + if (var2.hasDisplayName()) + { + var4.setCustomNameTag(var2.getDisplayName()); + } + + if (!par1EntityPlayer.capabilities.isCreativeMode) + { + --var2.stackSize; + + if (var2.stackSize <= 0) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); + } + } + } + } + } + + return true; + } + else + { + return false; + } + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(12, new Integer(0)); + } + + /** + * The age value may be negative or positive or zero. If it's negative, it get's incremented on each tick, if it's + * positive, it get's decremented each tick. Don't confuse this with EntityLiving.getAge. With a negative value the + * Entity is considered a child. + */ + public int getGrowingAge() + { + return this.dataWatcher.getWatchableObjectInt(12); + } + + /** + * "Adds the value of the parameter times 20 to the age of this entity. If the entity is an adult (if the entity's + * age is greater than 0), it will have no effect." + */ + public void addGrowth(int par1) + { + int var2 = this.getGrowingAge(); + var2 += par1 * 20; + + if (var2 > 0) + { + var2 = 0; + } + + this.setGrowingAge(var2); + } + + /** + * The age value may be negative or positive or zero. If it's negative, it get's incremented on each tick, if it's + * positive, it get's decremented each tick. With a negative value the Entity is considered a child. + */ + public void setGrowingAge(int par1) + { + this.dataWatcher.updateObject(12, Integer.valueOf(par1)); + this.setScaleForAge(this.isChild()); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("Age", this.getGrowingAge()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.setGrowingAge(par1NBTTagCompound.getInteger("Age")); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (this.worldObj.isRemote) + { + this.setScaleForAge(this.isChild()); + } + else + { + int var1 = this.getGrowingAge(); + + if (var1 < 0) + { + ++var1; + this.setGrowingAge(var1); + } + else if (var1 > 0) + { + --var1; + this.setGrowingAge(var1); + } + } + } + + /** + * If Animal, checks if the age timer is negative + */ + public boolean isChild() + { + return this.getGrowingAge() < 0; + } + + /** + * "Sets the scale for an ageable entity according to the boolean parameter, which says if it's a child." + */ + public void setScaleForAge(boolean par1) + { + this.setScale(par1 ? 0.5F : 1.0F); + } + + /** + * Sets the width and height of the entity. Args: width, height + */ + protected final void setSize(float par1, float par2) + { + boolean var3 = this.field_98056_d > 0.0F; + this.field_98056_d = par1; + this.field_98057_e = par2; + + if (!var3) + { + this.setScale(1.0F); + } + } + + protected final void setScale(float par1) + { + super.setSize(this.field_98056_d * par1, this.field_98057_e * par1); + } +} diff --git a/src/main/java/net/minecraft/src/EntityAmbientCreature.java b/src/main/java/net/minecraft/src/EntityAmbientCreature.java new file mode 100644 index 0000000..2a5163b --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAmbientCreature.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +public abstract class EntityAmbientCreature extends EntityLiving implements IAnimals +{ + public EntityAmbientCreature(World par1World) + { + super(par1World); + } + + public boolean allowLeashing() + { + return false; + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + protected boolean interact(EntityPlayer par1EntityPlayer) + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAnimal.java b/src/main/java/net/minecraft/src/EntityAnimal.java new file mode 100644 index 0000000..5cba9c7 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAnimal.java @@ -0,0 +1,404 @@ +package net.minecraft.src; + +import java.util.List; + +public abstract class EntityAnimal extends EntityAgeable implements IAnimals +{ + private int inLove; + + /** + * This is representation of a counter for reproduction progress. (Note that this is different from the inLove which + * represent being in Love-Mode) + */ + private int breeding; + + public EntityAnimal(World par1World) + { + super(par1World); + } + + /** + * main AI tick function, replaces updateEntityActionState + */ + protected void updateAITick() + { + if (this.getGrowingAge() != 0) + { + this.inLove = 0; + } + + super.updateAITick(); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (this.getGrowingAge() != 0) + { + this.inLove = 0; + } + + if (this.inLove > 0) + { + --this.inLove; + String var1 = "heart"; + + if (this.inLove % 10 == 0) + { + double var2 = this.rand.nextGaussian() * 0.02D; + double var4 = this.rand.nextGaussian() * 0.02D; + double var6 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle(var1, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var2, var4, var6); + } + } + else + { + this.breeding = 0; + } + } + + /** + * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack. + */ + protected void attackEntity(Entity par1Entity, float par2) + { + if (par1Entity instanceof EntityPlayer) + { + if (par2 < 3.0F) + { + double var3 = par1Entity.posX - this.posX; + double var5 = par1Entity.posZ - this.posZ; + this.rotationYaw = (float)(Math.atan2(var5, var3) * 180.0D / Math.PI) - 90.0F; + this.hasAttacked = true; + } + + EntityPlayer var7 = (EntityPlayer)par1Entity; + + if (var7.getCurrentEquippedItem() == null || !this.isBreedingItem(var7.getCurrentEquippedItem())) + { + this.entityToAttack = null; + } + } + else if (par1Entity instanceof EntityAnimal) + { + EntityAnimal var8 = (EntityAnimal)par1Entity; + + if (this.getGrowingAge() > 0 && var8.getGrowingAge() < 0) + { + if ((double)par2 < 2.5D) + { + this.hasAttacked = true; + } + } + else if (this.inLove > 0 && var8.inLove > 0) + { + if (var8.entityToAttack == null) + { + var8.entityToAttack = this; + } + + if (var8.entityToAttack == this && (double)par2 < 3.5D) + { + ++var8.inLove; + ++this.inLove; + ++this.breeding; + + if (this.breeding % 4 == 0) + { + this.worldObj.spawnParticle("heart", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, 0.0D, 0.0D, 0.0D); + } + + if (this.breeding == 60) + { + this.procreate((EntityAnimal)par1Entity); + } + } + else + { + this.breeding = 0; + } + } + else + { + this.breeding = 0; + this.entityToAttack = null; + } + } + } + + /** + * Creates a baby animal according to the animal type of the target at the actual position and spawns 'love' + * particles. + */ + private void procreate(EntityAnimal par1EntityAnimal) + { + EntityAgeable var2 = this.createChild(par1EntityAnimal); + + if (var2 != null) + { + this.setGrowingAge(6000); + par1EntityAnimal.setGrowingAge(6000); + this.inLove = 0; + this.breeding = 0; + this.entityToAttack = null; + par1EntityAnimal.entityToAttack = null; + par1EntityAnimal.breeding = 0; + par1EntityAnimal.inLove = 0; + var2.setGrowingAge(-24000); + var2.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + + for (int var3 = 0; var3 < 7; ++var3) + { + double var4 = this.rand.nextGaussian() * 0.02D; + double var6 = this.rand.nextGaussian() * 0.02D; + double var8 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle("heart", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var4, var6, var8); + } + + this.worldObj.spawnEntityInWorld(var2); + } + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + this.fleeingTick = 60; + + if (!this.isAIEnabled()) + { + AttributeInstance var3 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + + if (var3.getModifier(field_110179_h) == null) + { + var3.applyModifier(field_110181_i); + } + } + + this.entityToAttack = null; + this.inLove = 0; + return super.attackEntityFrom(par1DamageSource, par2); + } + } + + /** + * Takes a coordinate in and returns a weight to determine how likely this creature will try to path to the block. + * Args: x, y, z + */ + public float getBlockPathWeight(int par1, int par2, int par3) + { + return this.worldObj.getBlockId(par1, par2 - 1, par3) == Block.grass.blockID ? 10.0F : this.worldObj.getLightBrightness(par1, par2, par3) - 0.5F; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("InLove", this.inLove); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.inLove = par1NBTTagCompound.getInteger("InLove"); + } + + /** + * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking + * (Animals, Spiders at day, peaceful PigZombies). + */ + protected Entity findPlayerToAttack() + { + if (this.fleeingTick > 0) + { + return null; + } + else + { + float var1 = 8.0F; + List var2; + int var3; + EntityAnimal var4; + + if (this.inLove > 0) + { + var2 = this.worldObj.getEntitiesWithinAABB(this.getClass(), this.boundingBox.expand((double)var1, (double)var1, (double)var1)); + + for (var3 = 0; var3 < var2.size(); ++var3) + { + var4 = (EntityAnimal)var2.get(var3); + + if (var4 != this && var4.inLove > 0) + { + return var4; + } + } + } + else if (this.getGrowingAge() == 0) + { + var2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand((double)var1, (double)var1, (double)var1)); + + for (var3 = 0; var3 < var2.size(); ++var3) + { + EntityPlayer var5 = (EntityPlayer)var2.get(var3); + + if (var5.getCurrentEquippedItem() != null && this.isBreedingItem(var5.getCurrentEquippedItem())) + { + return var5; + } + } + } + else if (this.getGrowingAge() > 0) + { + var2 = this.worldObj.getEntitiesWithinAABB(this.getClass(), this.boundingBox.expand((double)var1, (double)var1, (double)var1)); + + for (var3 = 0; var3 < var2.size(); ++var3) + { + var4 = (EntityAnimal)var2.get(var3); + + if (var4 != this && var4.getGrowingAge() < 0) + { + return var4; + } + } + } + + return null; + } + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.boundingBox.minY); + int var3 = MathHelper.floor_double(this.posZ); + return this.worldObj.getBlockId(var1, var2 - 1, var3) == Block.grass.blockID && this.worldObj.getFullBlockLightValue(var1, var2, var3) > 8 && super.getCanSpawnHere(); + } + + /** + * Get number of ticks, at least during which the living entity will be silent. + */ + public int getTalkInterval() + { + return 120; + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return false; + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer par1EntityPlayer) + { + return 1 + this.worldObj.rand.nextInt(3); + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack par1ItemStack) + { + return par1ItemStack.itemID == Item.wheat.itemID; + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + + if (var2 != null && this.isBreedingItem(var2) && this.getGrowingAge() == 0 && this.inLove <= 0) + { + if (!par1EntityPlayer.capabilities.isCreativeMode) + { + --var2.stackSize; + + if (var2.stackSize <= 0) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); + } + } + + this.func_110196_bT(); + return true; + } + else + { + return super.interact(par1EntityPlayer); + } + } + + public void func_110196_bT() + { + this.inLove = 600; + this.entityToAttack = null; + this.worldObj.setEntityState(this, (byte)18); + } + + /** + * Returns if the entity is currently in 'love mode'. + */ + public boolean isInLove() + { + return this.inLove > 0; + } + + public void resetInLove() + { + this.inLove = 0; + } + + /** + * Returns true if the mob is currently able to mate with the specified mob. + */ + public boolean canMateWith(EntityAnimal par1EntityAnimal) + { + return par1EntityAnimal == this ? false : (par1EntityAnimal.getClass() != this.getClass() ? false : this.isInLove() && par1EntityAnimal.isInLove()); + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 18) + { + for (int var2 = 0; var2 < 7; ++var2) + { + double var3 = this.rand.nextGaussian() * 0.02D; + double var5 = this.rand.nextGaussian() * 0.02D; + double var7 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle("heart", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var3, var5, var7); + } + } + else + { + super.handleHealthUpdate(par1); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityArrow.java b/src/main/java/net/minecraft/src/EntityArrow.java new file mode 100644 index 0000000..08d5cee --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityArrow.java @@ -0,0 +1,570 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityArrow extends Entity implements IProjectile +{ + private int xTile = -1; + private int yTile = -1; + private int zTile = -1; + private int inTile; + private int inData; + private boolean inGround; + + /** 1 if the player can pick up the arrow */ + public int canBePickedUp; + + /** Seems to be some sort of timer for animating an arrow. */ + public int arrowShake; + + /** The owner of this arrow. */ + public Entity shootingEntity; + private int ticksInGround; + private int ticksInAir; + private double damage = 2.0D; + + /** The amount of knockback an arrow applies when it hits a mob. */ + private int knockbackStrength; + + public EntityArrow(World par1World) + { + super(par1World); + this.renderDistanceWeight = 10.0D; + this.setSize(0.5F, 0.5F); + } + + public EntityArrow(World par1World, double par2, double par4, double par6) + { + super(par1World); + this.renderDistanceWeight = 10.0D; + this.setSize(0.5F, 0.5F); + this.setPosition(par2, par4, par6); + this.yOffset = 0.0F; + } + + public EntityArrow(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5) + { + super(par1World); + this.renderDistanceWeight = 10.0D; + this.shootingEntity = par2EntityLivingBase; + + if (par2EntityLivingBase instanceof EntityPlayer) + { + this.canBePickedUp = 1; + } + + this.posY = par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight() - 0.10000000149011612D; + double var6 = par3EntityLivingBase.posX - par2EntityLivingBase.posX; + double var8 = par3EntityLivingBase.boundingBox.minY + (double)(par3EntityLivingBase.height / 3.0F) - this.posY; + double var10 = par3EntityLivingBase.posZ - par2EntityLivingBase.posZ; + double var12 = (double)MathHelper.sqrt_double(var6 * var6 + var10 * var10); + + if (var12 >= 1.0E-7D) + { + float var14 = (float)(Math.atan2(var10, var6) * 180.0D / Math.PI) - 90.0F; + float var15 = (float)(-(Math.atan2(var8, var12) * 180.0D / Math.PI)); + double var16 = var6 / var12; + double var18 = var10 / var12; + this.setLocationAndAngles(par2EntityLivingBase.posX + var16, this.posY, par2EntityLivingBase.posZ + var18, var14, var15); + this.yOffset = 0.0F; + float var20 = (float)var12 * 0.2F; + this.setThrowableHeading(var6, var8 + (double)var20, var10, par4, par5); + } + } + + public EntityArrow(World par1World, EntityLivingBase par2EntityLivingBase, float par3) + { + super(par1World); + this.renderDistanceWeight = 10.0D; + this.shootingEntity = par2EntityLivingBase; + + if (par2EntityLivingBase instanceof EntityPlayer) + { + this.canBePickedUp = 1; + } + + this.setSize(0.5F, 0.5F); + this.setLocationAndAngles(par2EntityLivingBase.posX, par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight(), par2EntityLivingBase.posZ, par2EntityLivingBase.rotationYaw, par2EntityLivingBase.rotationPitch); + this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posY -= 0.10000000149011612D; + this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); + this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI)); + this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI)); + this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F); + } + + protected void entityInit() + { + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + /** + * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction. + */ + public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) + { + float var9 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); + par1 /= (double)var9; + par3 /= (double)var9; + par5 /= (double)var9; + par1 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8; + par3 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8; + par5 += this.rand.nextGaussian() * (double)(this.rand.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double)par8; + par1 *= (double)par7; + par3 *= (double)par7; + par5 *= (double)par7; + this.motionX = par1; + this.motionY = par3; + this.motionZ = par5; + float var10 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)var10) * 180.0D / Math.PI); + this.ticksInGround = 0; + } + + /** + * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, + * posY, posZ, yaw, pitch + */ + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) + { + this.setPosition(par1, par3, par5); + this.setRotation(par7, par8); + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double par1, double par3, double par5) + { + this.motionX = par1; + this.motionY = par3; + this.motionZ = par5; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)var7) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch; + this.prevRotationYaw = this.rotationYaw; + this.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + this.ticksInGround = 0; + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float var1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var1) * 180.0D / Math.PI); + } + + int var16 = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + + if (var16 > 0) + { + Block.blocksList[var16].setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile); + AxisAlignedBB var2 = Block.blocksList[var16].getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile); + + if (var2 != null && var2.isVecInside(this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ))) + { + this.inGround = true; + } + } + + if (this.arrowShake > 0) + { + --this.arrowShake; + } + + if (this.inGround) + { + int var18 = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + int var19 = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + + if (var18 == this.inTile && var19 == this.inData) + { + ++this.ticksInGround; + + if (this.ticksInGround == 1200) + { + this.setDead(); + } + } + else + { + this.inGround = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } + } + else + { + ++this.ticksInAir; + Vec3 var17 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); + Vec3 var3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition var4 = this.worldObj.rayTraceBlocks_do_do(var17, var3, false, true); + var17 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); + var3 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (var4 != null) + { + var3 = this.worldObj.getWorldVec3Pool().getVecFromPool(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); + } + + Entity var5 = null; + List var6 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double var7 = 0.0D; + int var9; + float var11; + + for (var9 = 0; var9 < var6.size(); ++var9) + { + Entity var10 = (Entity)var6.get(var9); + + if (var10.canBeCollidedWith() && (var10 != this.shootingEntity || this.ticksInAir >= 5)) + { + var11 = 0.3F; + AxisAlignedBB var12 = var10.boundingBox.expand((double)var11, (double)var11, (double)var11); + MovingObjectPosition var13 = var12.calculateIntercept(var17, var3); + + if (var13 != null) + { + double var14 = var17.distanceTo(var13.hitVec); + + if (var14 < var7 || var7 == 0.0D) + { + var5 = var10; + var7 = var14; + } + } + } + } + + if (var5 != null) + { + var4 = new MovingObjectPosition(var5); + } + + if (var4 != null && var4.entityHit != null && var4.entityHit instanceof EntityPlayer) + { + EntityPlayer var20 = (EntityPlayer)var4.entityHit; + + if (var20.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer)this.shootingEntity).canAttackPlayer(var20)) + { + var4 = null; + } + } + + float var21; + float var27; + + if (var4 != null) + { + if (var4.entityHit != null) + { + var21 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + int var22 = MathHelper.ceiling_double_int((double)var21 * this.damage); + + if (this.getIsCritical()) + { + var22 += this.rand.nextInt(var22 / 2 + 2); + } + + DamageSource var23 = null; + + if (this.shootingEntity == null) + { + var23 = DamageSource.causeArrowDamage(this, this); + } + else + { + var23 = DamageSource.causeArrowDamage(this, this.shootingEntity); + } + + if (this.isBurning() && !(var4.entityHit instanceof EntityEnderman)) + { + var4.entityHit.setFire(5); + } + + if (var4.entityHit.attackEntityFrom(var23, (float)var22)) + { + if (var4.entityHit instanceof EntityLivingBase) + { + EntityLivingBase var25 = (EntityLivingBase)var4.entityHit; + + if (!this.worldObj.isRemote) + { + var25.setArrowCountInEntity(var25.getArrowCountInEntity() + 1); + } + + if (this.knockbackStrength > 0) + { + var27 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (var27 > 0.0F) + { + var4.entityHit.addVelocity(this.motionX * (double)this.knockbackStrength * 0.6000000238418579D / (double)var27, 0.1D, this.motionZ * (double)this.knockbackStrength * 0.6000000238418579D / (double)var27); + } + } + + if (this.shootingEntity != null) + { + EnchantmentThorns.func_92096_a(this.shootingEntity, var25, this.rand); + } + + if (this.shootingEntity != null && var4.entityHit != this.shootingEntity && var4.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) + { + ((EntityPlayerMP)this.shootingEntity).playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(6, 0)); + } + } + + this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + + if (!(var4.entityHit instanceof EntityEnderman)) + { + this.setDead(); + } + } + else + { + this.motionX *= -0.10000000149011612D; + this.motionY *= -0.10000000149011612D; + this.motionZ *= -0.10000000149011612D; + this.rotationYaw += 180.0F; + this.prevRotationYaw += 180.0F; + this.ticksInAir = 0; + } + } + else + { + this.xTile = var4.blockX; + this.yTile = var4.blockY; + this.zTile = var4.blockZ; + this.inTile = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + this.inData = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + this.motionX = (double)((float)(var4.hitVec.xCoord - this.posX)); + this.motionY = (double)((float)(var4.hitVec.yCoord - this.posY)); + this.motionZ = (double)((float)(var4.hitVec.zCoord - this.posZ)); + var21 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.posX -= this.motionX / (double)var21 * 0.05000000074505806D; + this.posY -= this.motionY / (double)var21 * 0.05000000074505806D; + this.posZ -= this.motionZ / (double)var21 * 0.05000000074505806D; + this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + this.inGround = true; + this.arrowShake = 7; + this.setIsCritical(false); + + if (this.inTile != 0) + { + Block.blocksList[this.inTile].onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this); + } + } + } + + if (this.getIsCritical()) + { + for (var9 = 0; var9 < 4; ++var9) + { + this.worldObj.spawnParticle("crit", this.posX + this.motionX * (double)var9 / 4.0D, this.posY + this.motionY * (double)var9 / 4.0D, this.posZ + this.motionZ * (double)var9 / 4.0D, -this.motionX, -this.motionY + 0.2D, -this.motionZ); + } + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + var21 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var21) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float var24 = 0.99F; + var11 = 0.05F; + + if (this.isInWater()) + { + for (int var26 = 0; var26 < 4; ++var26) + { + var27 = 0.25F; + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)var27, this.posY - this.motionY * (double)var27, this.posZ - this.motionZ * (double)var27, this.motionX, this.motionY, this.motionZ); + } + + var24 = 0.8F; + } + + this.motionX *= (double)var24; + this.motionY *= (double)var24; + this.motionZ *= (double)var24; + this.motionY -= (double)var11; + this.setPosition(this.posX, this.posY, this.posZ); + this.doBlockCollisions(); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setShort("xTile", (short)this.xTile); + par1NBTTagCompound.setShort("yTile", (short)this.yTile); + par1NBTTagCompound.setShort("zTile", (short)this.zTile); + par1NBTTagCompound.setByte("inTile", (byte)this.inTile); + par1NBTTagCompound.setByte("inData", (byte)this.inData); + par1NBTTagCompound.setByte("shake", (byte)this.arrowShake); + par1NBTTagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + par1NBTTagCompound.setByte("pickup", (byte)this.canBePickedUp); + par1NBTTagCompound.setDouble("damage", this.damage); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.xTile = par1NBTTagCompound.getShort("xTile"); + this.yTile = par1NBTTagCompound.getShort("yTile"); + this.zTile = par1NBTTagCompound.getShort("zTile"); + this.inTile = par1NBTTagCompound.getByte("inTile") & 255; + this.inData = par1NBTTagCompound.getByte("inData") & 255; + this.arrowShake = par1NBTTagCompound.getByte("shake") & 255; + this.inGround = par1NBTTagCompound.getByte("inGround") == 1; + + if (par1NBTTagCompound.hasKey("damage")) + { + this.damage = par1NBTTagCompound.getDouble("damage"); + } + + if (par1NBTTagCompound.hasKey("pickup")) + { + this.canBePickedUp = par1NBTTagCompound.getByte("pickup"); + } + else if (par1NBTTagCompound.hasKey("player")) + { + this.canBePickedUp = par1NBTTagCompound.getBoolean("player") ? 1 : 0; + } + } + + /** + * Called by a player entity when they collide with an entity + */ + public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) + { + if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) + { + boolean var2 = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; + + if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.arrow, 1))) + { + var2 = false; + } + + if (var2) + { + this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + par1EntityPlayer.onItemPickup(this, 1); + this.setDead(); + } + } + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + public float getShadowSize() + { + return 0.0F; + } + + public void setDamage(double par1) + { + this.damage = par1; + } + + public double getDamage() + { + return this.damage; + } + + /** + * Sets the amount of knockback the arrow applies when it hits a mob. + */ + public void setKnockbackStrength(int par1) + { + this.knockbackStrength = par1; + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } + + /** + * Whether the arrow has a stream of critical hit particles flying behind it. + */ + public void setIsCritical(boolean par1) + { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + + if (par1) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -2))); + } + } + + /** + * Whether the arrow has a stream of critical hit particles flying behind it. + */ + public boolean getIsCritical() + { + byte var1 = this.dataWatcher.getWatchableObjectByte(16); + return (var1 & 1) != 0; + } +} diff --git a/src/main/java/net/minecraft/src/EntityAuraFX.java b/src/main/java/net/minecraft/src/EntityAuraFX.java new file mode 100644 index 0000000..119b63b --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityAuraFX.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +public class EntityAuraFX extends EntityFX +{ + public EntityAuraFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, par8, par10, par12); + float var14 = this.rand.nextFloat() * 0.1F + 0.2F; + this.particleRed = var14; + this.particleGreen = var14; + this.particleBlue = var14; + this.setParticleTextureIndex(0); + this.setSize(0.02F, 0.02F); + this.particleScale *= this.rand.nextFloat() * 0.6F + 0.5F; + this.motionX *= 0.019999999552965164D; + this.motionY *= 0.019999999552965164D; + this.motionZ *= 0.019999999552965164D; + this.particleMaxAge = (int)(20.0D / (Math.random() * 0.8D + 0.2D)); + this.noClip = true; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.99D; + this.motionY *= 0.99D; + this.motionZ *= 0.99D; + + if (this.particleMaxAge-- <= 0) + { + this.setDead(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityBat.java b/src/main/java/net/minecraft/src/EntityBat.java new file mode 100644 index 0000000..c35e3d4 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityBat.java @@ -0,0 +1,284 @@ +package net.minecraft.src; + +import java.util.Calendar; + +public class EntityBat extends EntityAmbientCreature +{ + /** + * randomly selected ChunkCoordinates in a 7x6x7 box around the bat (y offset -2 to 4) towards which it will fly. + * upon getting close a new target will be selected + */ + private ChunkCoordinates currentFlightTarget; + + public EntityBat(World par1World) + { + super(par1World); + this.setSize(0.5F, 0.9F); + this.setIsBatHanging(true); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.1F; + } + + /** + * Gets the pitch of living sounds in living entities. + */ + protected float getSoundPitch() + { + return super.getSoundPitch() * 0.95F; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return this.getIsBatHanging() && this.rand.nextInt(4) != 0 ? null : "mob.bat.idle"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.bat.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.bat.death"; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return false; + } + + protected void collideWithEntity(Entity par1Entity) {} + + protected void collideWithNearbyEntities() {} + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(6.0D); + } + + public boolean getIsBatHanging() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + public void setIsBatHanging(boolean par1) + { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + + if (par1) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -2))); + } + } + + /** + * Returns true if the newer Entity AI code should be run + */ + protected boolean isAIEnabled() + { + return true; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.getIsBatHanging()) + { + this.motionX = this.motionY = this.motionZ = 0.0D; + this.posY = (double)MathHelper.floor_double(this.posY) + 1.0D - (double)this.height; + } + else + { + this.motionY *= 0.6000000238418579D; + } + } + + protected void updateAITasks() + { + super.updateAITasks(); + + if (this.getIsBatHanging()) + { + if (!this.worldObj.isBlockNormalCube(MathHelper.floor_double(this.posX), (int)this.posY + 1, MathHelper.floor_double(this.posZ))) + { + this.setIsBatHanging(false); + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1015, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + } + else + { + if (this.rand.nextInt(200) == 0) + { + this.rotationYawHead = (float)this.rand.nextInt(360); + } + + if (this.worldObj.getClosestPlayerToEntity(this, 4.0D) != null) + { + this.setIsBatHanging(false); + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1015, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + } + } + } + else + { + if (this.currentFlightTarget != null && (!this.worldObj.isAirBlock(this.currentFlightTarget.posX, this.currentFlightTarget.posY, this.currentFlightTarget.posZ) || this.currentFlightTarget.posY < 1)) + { + this.currentFlightTarget = null; + } + + if (this.currentFlightTarget == null || this.rand.nextInt(30) == 0 || this.currentFlightTarget.getDistanceSquared((int)this.posX, (int)this.posY, (int)this.posZ) < 4.0F) + { + this.currentFlightTarget = new ChunkCoordinates((int)this.posX + this.rand.nextInt(7) - this.rand.nextInt(7), (int)this.posY + this.rand.nextInt(6) - 2, (int)this.posZ + this.rand.nextInt(7) - this.rand.nextInt(7)); + } + + double var1 = (double)this.currentFlightTarget.posX + 0.5D - this.posX; + double var3 = (double)this.currentFlightTarget.posY + 0.1D - this.posY; + double var5 = (double)this.currentFlightTarget.posZ + 0.5D - this.posZ; + this.motionX += (Math.signum(var1) * 0.5D - this.motionX) * 0.10000000149011612D; + this.motionY += (Math.signum(var3) * 0.699999988079071D - this.motionY) * 0.10000000149011612D; + this.motionZ += (Math.signum(var5) * 0.5D - this.motionZ) * 0.10000000149011612D; + float var7 = (float)(Math.atan2(this.motionZ, this.motionX) * 180.0D / Math.PI) - 90.0F; + float var8 = MathHelper.wrapAngleTo180_float(var7 - this.rotationYaw); + this.moveForward = 0.5F; + this.rotationYaw += var8; + + if (this.rand.nextInt(100) == 0 && this.worldObj.isBlockNormalCube(MathHelper.floor_double(this.posX), (int)this.posY + 1, MathHelper.floor_double(this.posZ))) + { + this.setIsBatHanging(true); + } + } + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) {} + + /** + * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance + * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround + */ + protected void updateFallState(double par1, boolean par3) {} + + /** + * Return whether this entity should NOT trigger a pressure plate or a tripwire. + */ + public boolean doesEntityNotTriggerPressurePlate() + { + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + if (!this.worldObj.isRemote && this.getIsBatHanging()) + { + this.setIsBatHanging(false); + } + + return super.attackEntityFrom(par1DamageSource, par2); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.dataWatcher.updateObject(16, Byte.valueOf(par1NBTTagCompound.getByte("BatFlags"))); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setByte("BatFlags", this.dataWatcher.getWatchableObjectByte(16)); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + int var1 = MathHelper.floor_double(this.boundingBox.minY); + + if (var1 >= 63) + { + return false; + } + else + { + int var2 = MathHelper.floor_double(this.posX); + int var3 = MathHelper.floor_double(this.posZ); + int var4 = this.worldObj.getBlockLightValue(var2, var1, var3); + byte var5 = 4; + Calendar var6 = this.worldObj.getCurrentDate(); + + if ((var6.get(2) + 1 != 10 || var6.get(5) < 20) && (var6.get(2) + 1 != 11 || var6.get(5) > 3)) + { + if (this.rand.nextBoolean()) + { + return false; + } + } + else + { + var5 = 7; + } + + return var4 > this.rand.nextInt(var5) ? false : super.getCanSpawnHere(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityBlaze.java b/src/main/java/net/minecraft/src/EntityBlaze.java new file mode 100644 index 0000000..88177f4 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityBlaze.java @@ -0,0 +1,234 @@ +package net.minecraft.src; + +public class EntityBlaze extends EntityMob +{ + /** Random offset used in floating behaviour */ + private float heightOffset = 0.5F; + + /** ticks until heightOffset is randomized */ + private int heightOffsetUpdateTime; + private int field_70846_g; + + public EntityBlaze(World par1World) + { + super(par1World); + this.isImmuneToFire = true; + this.experienceValue = 10; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(6.0D); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.blaze.breathe"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.blaze.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.blaze.death"; + } + + public int getBrightnessForRender(float par1) + { + return 15728880; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + return 1.0F; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (!this.worldObj.isRemote) + { + if (this.isWet()) + { + this.attackEntityFrom(DamageSource.drown, 1.0F); + } + + --this.heightOffsetUpdateTime; + + if (this.heightOffsetUpdateTime <= 0) + { + this.heightOffsetUpdateTime = 100; + this.heightOffset = 0.5F + (float)this.rand.nextGaussian() * 3.0F; + } + + if (this.getEntityToAttack() != null && this.getEntityToAttack().posY + (double)this.getEntityToAttack().getEyeHeight() > this.posY + (double)this.getEyeHeight() + (double)this.heightOffset) + { + this.motionY += (0.30000001192092896D - this.motionY) * 0.30000001192092896D; + } + } + + if (this.rand.nextInt(24) == 0) + { + this.worldObj.playSoundEffect(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "fire.fire", 1.0F + this.rand.nextFloat(), this.rand.nextFloat() * 0.7F + 0.3F); + } + + if (!this.onGround && this.motionY < 0.0D) + { + this.motionY *= 0.6D; + } + + for (int var1 = 0; var1 < 2; ++var1) + { + this.worldObj.spawnParticle("largesmoke", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.0D, 0.0D, 0.0D); + } + + super.onLivingUpdate(); + } + + /** + * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack. + */ + protected void attackEntity(Entity par1Entity, float par2) + { + if (this.attackTime <= 0 && par2 < 2.0F && par1Entity.boundingBox.maxY > this.boundingBox.minY && par1Entity.boundingBox.minY < this.boundingBox.maxY) + { + this.attackTime = 20; + this.attackEntityAsMob(par1Entity); + } + else if (par2 < 30.0F) + { + double var3 = par1Entity.posX - this.posX; + double var5 = par1Entity.boundingBox.minY + (double)(par1Entity.height / 2.0F) - (this.posY + (double)(this.height / 2.0F)); + double var7 = par1Entity.posZ - this.posZ; + + if (this.attackTime == 0) + { + ++this.field_70846_g; + + if (this.field_70846_g == 1) + { + this.attackTime = 60; + this.func_70844_e(true); + } + else if (this.field_70846_g <= 4) + { + this.attackTime = 6; + } + else + { + this.attackTime = 100; + this.field_70846_g = 0; + this.func_70844_e(false); + } + + if (this.field_70846_g > 1) + { + float var9 = MathHelper.sqrt_float(par2) * 0.5F; + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + + for (int var10 = 0; var10 < 1; ++var10) + { + EntitySmallFireball var11 = new EntitySmallFireball(this.worldObj, this, var3 + this.rand.nextGaussian() * (double)var9, var5, var7 + this.rand.nextGaussian() * (double)var9); + var11.posY = this.posY + (double)(this.height / 2.0F) + 0.5D; + this.worldObj.spawnEntityInWorld(var11); + } + } + } + + this.rotationYaw = (float)(Math.atan2(var7, var3) * 180.0D / Math.PI) - 90.0F; + this.hasAttacked = true; + } + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) {} + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.blazeRod.itemID; + } + + /** + * Returns true if the entity is on fire. Used by render to add the fire effect on rendering. + */ + public boolean isBurning() + { + return this.func_70845_n(); + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + if (par1) + { + int var3 = this.rand.nextInt(2 + par2); + + for (int var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Item.blazeRod.itemID, 1); + } + } + } + + public boolean func_70845_n() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + public void func_70844_e(boolean par1) + { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + + if (par1) + { + var2 = (byte)(var2 | 1); + } + else + { + var2 &= -2; + } + + this.dataWatcher.updateObject(16, Byte.valueOf(var2)); + } + + /** + * Checks to make sure the light is not too bright where the mob is spawning + */ + protected boolean isValidLightLevel() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/EntityBoat.java b/src/main/java/net/minecraft/src/EntityBoat.java new file mode 100644 index 0000000..a572440 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityBoat.java @@ -0,0 +1,557 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityBoat extends Entity +{ + private boolean field_70279_a; + private double speedMultiplier; + private int boatPosRotationIncrements; + private double boatX; + private double boatY; + private double boatZ; + private double boatYaw; + private double boatPitch; + private double velocityX; + private double velocityY; + private double velocityZ; + + public EntityBoat(World par1World) + { + super(par1World); + this.field_70279_a = true; + this.speedMultiplier = 0.07D; + this.preventEntitySpawning = true; + this.setSize(1.5F, 0.6F); + this.yOffset = this.height / 2.0F; + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + protected void entityInit() + { + this.dataWatcher.addObject(17, new Integer(0)); + this.dataWatcher.addObject(18, new Integer(1)); + this.dataWatcher.addObject(19, new Float(0.0F)); + } + + /** + * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be + * pushable on contact, like boats or minecarts. + */ + public AxisAlignedBB getCollisionBox(Entity par1Entity) + { + return par1Entity.boundingBox; + } + + /** + * returns the bounding box for this entity + */ + public AxisAlignedBB getBoundingBox() + { + return this.boundingBox; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return true; + } + + public EntityBoat(World par1World, double par2, double par4, double par6) + { + this(par1World); + this.setPosition(par2, par4 + (double)this.yOffset, par6); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevPosX = par2; + this.prevPosY = par4; + this.prevPosZ = par6; + } + + /** + * Returns the Y offset from the entity's position for any entity riding this one. + */ + public double getMountedYOffset() + { + return (double)this.height * 0.0D - 0.30000001192092896D; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else if (!this.worldObj.isRemote && !this.isDead) + { + this.setForwardDirection(-this.getForwardDirection()); + this.setTimeSinceHit(10); + this.setDamageTaken(this.getDamageTaken() + par2 * 10.0F); + this.setBeenAttacked(); + boolean var3 = par1DamageSource.getEntity() instanceof EntityPlayer && ((EntityPlayer)par1DamageSource.getEntity()).capabilities.isCreativeMode; + + if (var3 || this.getDamageTaken() > 40.0F) + { + if (this.riddenByEntity != null) + { + this.riddenByEntity.mountEntity(this); + } + + if (!var3) + { + this.dropItemWithOffset(Item.boat.itemID, 1, 0.0F); + } + + this.setDead(); + } + + return true; + } + else + { + return true; + } + } + + /** + * Setups the entity to do the hurt animation. Only used by packets in multiplayer. + */ + public void performHurtAnimation() + { + this.setForwardDirection(-this.getForwardDirection()); + this.setTimeSinceHit(10); + this.setDamageTaken(this.getDamageTaken() * 11.0F); + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return !this.isDead; + } + + /** + * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, + * posY, posZ, yaw, pitch + */ + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) + { + if (this.field_70279_a) + { + this.boatPosRotationIncrements = par9 + 5; + } + else + { + double var10 = par1 - this.posX; + double var12 = par3 - this.posY; + double var14 = par5 - this.posZ; + double var16 = var10 * var10 + var12 * var12 + var14 * var14; + + if (var16 <= 1.0D) + { + return; + } + + this.boatPosRotationIncrements = 3; + } + + this.boatX = par1; + this.boatY = par3; + this.boatZ = par5; + this.boatYaw = (double)par7; + this.boatPitch = (double)par8; + this.motionX = this.velocityX; + this.motionY = this.velocityY; + this.motionZ = this.velocityZ; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double par1, double par3, double par5) + { + this.velocityX = this.motionX = par1; + this.velocityY = this.motionY = par3; + this.velocityZ = this.motionZ = par5; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.getTimeSinceHit() > 0) + { + this.setTimeSinceHit(this.getTimeSinceHit() - 1); + } + + if (this.getDamageTaken() > 0.0F) + { + this.setDamageTaken(this.getDamageTaken() - 1.0F); + } + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + byte var1 = 5; + double var2 = 0.0D; + + for (int var4 = 0; var4 < var1; ++var4) + { + double var5 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(var4 + 0) / (double)var1 - 0.125D; + double var7 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(var4 + 1) / (double)var1 - 0.125D; + AxisAlignedBB var9 = AxisAlignedBB.getAABBPool().getAABB(this.boundingBox.minX, var5, this.boundingBox.minZ, this.boundingBox.maxX, var7, this.boundingBox.maxZ); + + if (this.worldObj.isAABBInMaterial(var9, Material.water)) + { + var2 += 1.0D / (double)var1; + } + } + + double var23 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + double var6; + double var8; + + if (var23 > 0.26249999999999996D) + { + var6 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D); + var8 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D); + + for (int var10 = 0; (double)var10 < 1.0D + var23 * 60.0D; ++var10) + { + double var11 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); + double var13 = (double)(this.rand.nextInt(2) * 2 - 1) * 0.7D; + double var15; + double var17; + + if (this.rand.nextBoolean()) + { + var15 = this.posX - var6 * var11 * 0.8D + var8 * var13; + var17 = this.posZ - var8 * var11 * 0.8D - var6 * var13; + this.worldObj.spawnParticle("splash", var15, this.posY - 0.125D, var17, this.motionX, this.motionY, this.motionZ); + } + else + { + var15 = this.posX + var6 + var8 * var11 * 0.7D; + var17 = this.posZ + var8 - var6 * var11 * 0.7D; + this.worldObj.spawnParticle("splash", var15, this.posY - 0.125D, var17, this.motionX, this.motionY, this.motionZ); + } + } + } + + double var12; + double var25; + + if (this.worldObj.isRemote && this.field_70279_a) + { + if (this.boatPosRotationIncrements > 0) + { + var6 = this.posX + (this.boatX - this.posX) / (double)this.boatPosRotationIncrements; + var8 = this.posY + (this.boatY - this.posY) / (double)this.boatPosRotationIncrements; + var25 = this.posZ + (this.boatZ - this.posZ) / (double)this.boatPosRotationIncrements; + var12 = MathHelper.wrapAngleTo180_double(this.boatYaw - (double)this.rotationYaw); + this.rotationYaw = (float)((double)this.rotationYaw + var12 / (double)this.boatPosRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.boatPitch - (double)this.rotationPitch) / (double)this.boatPosRotationIncrements); + --this.boatPosRotationIncrements; + this.setPosition(var6, var8, var25); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + else + { + var6 = this.posX + this.motionX; + var8 = this.posY + this.motionY; + var25 = this.posZ + this.motionZ; + this.setPosition(var6, var8, var25); + + if (this.onGround) + { + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + + this.motionX *= 0.9900000095367432D; + this.motionY *= 0.949999988079071D; + this.motionZ *= 0.9900000095367432D; + } + } + else + { + if (var2 < 1.0D) + { + var6 = var2 * 2.0D - 1.0D; + this.motionY += 0.03999999910593033D * var6; + } + else + { + if (this.motionY < 0.0D) + { + this.motionY /= 2.0D; + } + + this.motionY += 0.007000000216066837D; + } + + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase) + { + var6 = (double)((EntityLivingBase)this.riddenByEntity).moveForward; + + if (var6 > 0.0D) + { + var8 = -Math.sin((double)(this.riddenByEntity.rotationYaw * (float)Math.PI / 180.0F)); + var25 = Math.cos((double)(this.riddenByEntity.rotationYaw * (float)Math.PI / 180.0F)); + this.motionX += var8 * this.speedMultiplier * 0.05000000074505806D; + this.motionZ += var25 * this.speedMultiplier * 0.05000000074505806D; + } + } + + var6 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (var6 > 0.35D) + { + var8 = 0.35D / var6; + this.motionX *= var8; + this.motionZ *= var8; + var6 = 0.35D; + } + + if (var6 > var23 && this.speedMultiplier < 0.35D) + { + this.speedMultiplier += (0.35D - this.speedMultiplier) / 35.0D; + + if (this.speedMultiplier > 0.35D) + { + this.speedMultiplier = 0.35D; + } + } + else + { + this.speedMultiplier -= (this.speedMultiplier - 0.07D) / 35.0D; + + if (this.speedMultiplier < 0.07D) + { + this.speedMultiplier = 0.07D; + } + } + + if (this.onGround) + { + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.isCollidedHorizontally && var23 > 0.2D) + { + if (!this.worldObj.isRemote && !this.isDead) + { + this.setDead(); + int var24; + + for (var24 = 0; var24 < 3; ++var24) + { + this.dropItemWithOffset(Block.planks.blockID, 1, 0.0F); + } + + for (var24 = 0; var24 < 2; ++var24) + { + this.dropItemWithOffset(Item.stick.itemID, 1, 0.0F); + } + } + } + else + { + this.motionX *= 0.9900000095367432D; + this.motionY *= 0.949999988079071D; + this.motionZ *= 0.9900000095367432D; + } + + this.rotationPitch = 0.0F; + var8 = (double)this.rotationYaw; + var25 = this.prevPosX - this.posX; + var12 = this.prevPosZ - this.posZ; + + if (var25 * var25 + var12 * var12 > 0.001D) + { + var8 = (double)((float)(Math.atan2(var12, var25) * 180.0D / Math.PI)); + } + + double var14 = MathHelper.wrapAngleTo180_double(var8 - (double)this.rotationYaw); + + if (var14 > 20.0D) + { + var14 = 20.0D; + } + + if (var14 < -20.0D) + { + var14 = -20.0D; + } + + this.rotationYaw = (float)((double)this.rotationYaw + var14); + this.setRotation(this.rotationYaw, this.rotationPitch); + + if (!this.worldObj.isRemote) + { + List var16 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + int var26; + + if (var16 != null && !var16.isEmpty()) + { + for (var26 = 0; var26 < var16.size(); ++var26) + { + Entity var18 = (Entity)var16.get(var26); + + if (var18 != this.riddenByEntity && var18.canBePushed() && var18 instanceof EntityBoat) + { + var18.applyEntityCollision(this); + } + } + } + + for (var26 = 0; var26 < 4; ++var26) + { + int var27 = MathHelper.floor_double(this.posX + ((double)(var26 % 2) - 0.5D) * 0.8D); + int var19 = MathHelper.floor_double(this.posZ + ((double)(var26 / 2) - 0.5D) * 0.8D); + + for (int var20 = 0; var20 < 2; ++var20) + { + int var21 = MathHelper.floor_double(this.posY) + var20; + int var22 = this.worldObj.getBlockId(var27, var21, var19); + + if (var22 == Block.snow.blockID) + { + this.worldObj.setBlockToAir(var27, var21, var19); + } + else if (var22 == Block.waterlily.blockID) + { + this.worldObj.destroyBlock(var27, var21, var19, true); + } + } + } + + if (this.riddenByEntity != null && this.riddenByEntity.isDead) + { + this.riddenByEntity = null; + } + } + } + } + + public void updateRiderPosition() + { + if (this.riddenByEntity != null) + { + double var1 = Math.cos((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D; + double var3 = Math.sin((double)this.rotationYaw * Math.PI / 180.0D) * 0.4D; + this.riddenByEntity.setPosition(this.posX + var1, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + var3); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {} + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {} + + public float getShadowSize() + { + return 0.0F; + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer par1EntityPlayer) + { + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer) + { + return true; + } + else + { + if (!this.worldObj.isRemote) + { + par1EntityPlayer.mountEntity(this); + } + + return true; + } + } + + /** + * Sets the damage taken from the last hit. + */ + public void setDamageTaken(float par1) + { + this.dataWatcher.updateObject(19, Float.valueOf(par1)); + } + + /** + * Gets the damage taken from the last hit. + */ + public float getDamageTaken() + { + return this.dataWatcher.getWatchableObjectFloat(19); + } + + /** + * Sets the time to count down from since the last time entity was hit. + */ + public void setTimeSinceHit(int par1) + { + this.dataWatcher.updateObject(17, Integer.valueOf(par1)); + } + + /** + * Gets the time since the last hit. + */ + public int getTimeSinceHit() + { + return this.dataWatcher.getWatchableObjectInt(17); + } + + /** + * Sets the forward direction of the entity. + */ + public void setForwardDirection(int par1) + { + this.dataWatcher.updateObject(18, Integer.valueOf(par1)); + } + + /** + * Gets the forward direction of the entity. + */ + public int getForwardDirection() + { + return this.dataWatcher.getWatchableObjectInt(18); + } + + public void func_70270_d(boolean par1) + { + this.field_70279_a = par1; + } +} diff --git a/src/main/java/net/minecraft/src/EntityBodyHelper.java b/src/main/java/net/minecraft/src/EntityBodyHelper.java new file mode 100644 index 0000000..4148e84 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityBodyHelper.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +public class EntityBodyHelper +{ + /** Instance of EntityLiving. */ + private EntityLivingBase theLiving; + private int field_75666_b; + private float field_75667_c; + + public EntityBodyHelper(EntityLivingBase par1EntityLivingBase) + { + this.theLiving = par1EntityLivingBase; + } + + public void func_75664_a() + { + double var1 = this.theLiving.posX - this.theLiving.prevPosX; + double var3 = this.theLiving.posZ - this.theLiving.prevPosZ; + + if (var1 * var1 + var3 * var3 > 2.500000277905201E-7D) + { + this.theLiving.renderYawOffset = this.theLiving.rotationYaw; + this.theLiving.rotationYawHead = this.func_75665_a(this.theLiving.renderYawOffset, this.theLiving.rotationYawHead, 75.0F); + this.field_75667_c = this.theLiving.rotationYawHead; + this.field_75666_b = 0; + } + else + { + float var5 = 75.0F; + + if (Math.abs(this.theLiving.rotationYawHead - this.field_75667_c) > 15.0F) + { + this.field_75666_b = 0; + this.field_75667_c = this.theLiving.rotationYawHead; + } + else + { + ++this.field_75666_b; + boolean var6 = true; + + if (this.field_75666_b > 10) + { + var5 = Math.max(1.0F - (float)(this.field_75666_b - 10) / 10.0F, 0.0F) * 75.0F; + } + } + + this.theLiving.renderYawOffset = this.func_75665_a(this.theLiving.rotationYawHead, this.theLiving.renderYawOffset, var5); + } + } + + private float func_75665_a(float par1, float par2, float par3) + { + float var4 = MathHelper.wrapAngleTo180_float(par1 - par2); + + if (var4 < -par3) + { + var4 = -par3; + } + + if (var4 >= par3) + { + var4 = par3; + } + + return par1 - var4; + } +} diff --git a/src/main/java/net/minecraft/src/EntityBreakingFX.java b/src/main/java/net/minecraft/src/EntityBreakingFX.java new file mode 100644 index 0000000..221e756 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityBreakingFX.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +public class EntityBreakingFX extends EntityFX +{ + public EntityBreakingFX(World par1World, double par2, double par4, double par6, Item par8Item) + { + this(par1World, par2, par4, par6, par8Item, 0); + } + + public EntityBreakingFX(World par1World, double par2, double par4, double par6, Item par8Item, int par9) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.setParticleIcon(par8Item.getIconFromDamage(par9)); + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.particleGravity = Block.blockSnow.blockParticleGravity; + this.particleScale /= 2.0F; + } + + public EntityBreakingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Item par14Item, int par15) + { + this(par1World, par2, par4, par6, par14Item, par15); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += par8; + this.motionY += par10; + this.motionZ += par12; + } + + public int getFXLayer() + { + return 2; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F; + float var9 = var8 + 0.015609375F; + float var10 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F; + float var11 = var10 + 0.015609375F; + float var12 = 0.1F * this.particleScale; + + if (this.particleIcon != null) + { + var8 = this.particleIcon.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F)); + var9 = this.particleIcon.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F)); + var10 = this.particleIcon.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F)); + var11 = this.particleIcon.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F)); + } + + float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX); + float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY); + float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ); + float var16 = 1.0F; + par1Tessellator.setColorOpaque_F(var16 * this.particleRed, var16 * this.particleGreen, var16 * this.particleBlue); + par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var8, (double)var11); + par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var8, (double)var10); + par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var9, (double)var10); + par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var9, (double)var11); + } +} diff --git a/src/main/java/net/minecraft/src/EntityBubbleFX.java b/src/main/java/net/minecraft/src/EntityBubbleFX.java new file mode 100644 index 0000000..5df19bb --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityBubbleFX.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +public class EntityBubbleFX extends EntityFX +{ + public EntityBubbleFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, par8, par10, par12); + this.particleRed = 1.0F; + this.particleGreen = 1.0F; + this.particleBlue = 1.0F; + this.setParticleTextureIndex(32); + this.setSize(0.02F, 0.02F); + this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F; + this.motionX = par8 * 0.20000000298023224D + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F); + this.motionY = par10 * 0.20000000298023224D + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F); + this.motionZ = par12 * 0.20000000298023224D + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F); + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY += 0.002D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.8500000238418579D; + this.motionY *= 0.8500000238418579D; + this.motionZ *= 0.8500000238418579D; + + if (this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) != Material.water) + { + this.setDead(); + } + + if (this.particleMaxAge-- <= 0) + { + this.setDead(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityCaveSpider.java b/src/main/java/net/minecraft/src/EntityCaveSpider.java new file mode 100644 index 0000000..54a8af7 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityCaveSpider.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +public class EntityCaveSpider extends EntitySpider +{ + public EntityCaveSpider(World par1World) + { + super(par1World); + this.setSize(0.7F, 0.5F); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(12.0D); + } + + public boolean attackEntityAsMob(Entity par1Entity) + { + if (super.attackEntityAsMob(par1Entity)) + { + if (par1Entity instanceof EntityLivingBase) + { + byte var2 = 0; + + if (this.worldObj.difficultySetting > 1) + { + if (this.worldObj.difficultySetting == 2) + { + var2 = 7; + } + else if (this.worldObj.difficultySetting == 3) + { + var2 = 15; + } + } + + if (var2 > 0) + { + ((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(Potion.poison.id, var2 * 20, 0)); + } + } + + return true; + } + else + { + return false; + } + } + + public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData) + { + return par1EntityLivingData; + } +} diff --git a/src/main/java/net/minecraft/src/EntityChicken.java b/src/main/java/net/minecraft/src/EntityChicken.java new file mode 100644 index 0000000..099c1b4 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityChicken.java @@ -0,0 +1,176 @@ +package net.minecraft.src; + +public class EntityChicken extends EntityAnimal +{ + public float field_70886_e; + public float destPos; + public float field_70884_g; + public float field_70888_h; + public float field_70889_i = 1.0F; + + /** The time until the next egg is spawned. */ + public int timeUntilNextEgg; + + public EntityChicken(World par1World) + { + super(par1World); + this.setSize(0.3F, 0.7F); + this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.4D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Item.seeds.itemID, false)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); + this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(7, new EntityAILookIdle(this)); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return true; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(4.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.25D); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + this.field_70888_h = this.field_70886_e; + this.field_70884_g = this.destPos; + this.destPos = (float)((double)this.destPos + (double)(this.onGround ? -1 : 4) * 0.3D); + + if (this.destPos < 0.0F) + { + this.destPos = 0.0F; + } + + if (this.destPos > 1.0F) + { + this.destPos = 1.0F; + } + + if (!this.onGround && this.field_70889_i < 1.0F) + { + this.field_70889_i = 1.0F; + } + + this.field_70889_i = (float)((double)this.field_70889_i * 0.9D); + + if (!this.onGround && this.motionY < 0.0D) + { + this.motionY *= 0.6D; + } + + this.field_70886_e += this.field_70889_i * 2.0F; + + if (!this.isChild() && !this.worldObj.isRemote && --this.timeUntilNextEgg <= 0) + { + this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.dropItem(Item.egg.itemID, 1); + this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; + } + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) {} + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.chicken.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.chicken.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.chicken.hurt"; + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + this.playSound("mob.chicken.step", 0.15F, 1.0F); + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.feather.itemID; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.rand.nextInt(3) + this.rand.nextInt(1 + par2); + + for (int var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Item.feather.itemID, 1); + } + + if (this.isBurning()) + { + this.dropItem(Item.chickenCooked.itemID, 1); + } + else + { + this.dropItem(Item.chickenRaw.itemID, 1); + } + } + + /** + * This function is used when two same-species animals in 'love mode' breed to generate the new baby animal. + */ + public EntityChicken spawnBabyAnimal(EntityAgeable par1EntityAgeable) + { + return new EntityChicken(this.worldObj); + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack par1ItemStack) + { + return par1ItemStack != null && par1ItemStack.getItem() instanceof ItemSeeds; + } + + public EntityAgeable createChild(EntityAgeable par1EntityAgeable) + { + return this.spawnBabyAnimal(par1EntityAgeable); + } +} diff --git a/src/main/java/net/minecraft/src/EntityClientPlayerMP.java b/src/main/java/net/minecraft/src/EntityClientPlayerMP.java new file mode 100644 index 0000000..dfad389 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityClientPlayerMP.java @@ -0,0 +1,288 @@ +package net.minecraft.src; + +public class EntityClientPlayerMP extends EntityPlayerSP +{ + public NetClientHandler sendQueue; + private double oldPosX; + + /** Old Minimum Y of the bounding box */ + private double oldMinY; + private double oldPosY; + private double oldPosZ; + private float oldRotationYaw; + private float oldRotationPitch; + + /** Check if was on ground last update */ + private boolean wasOnGround; + + /** should the player stop sneaking? */ + private boolean shouldStopSneaking; + private boolean wasSneaking; + private int field_71168_co; + + /** has the client player's health been set? */ + private boolean hasSetHealth; + private String field_142022_ce; + + public EntityClientPlayerMP(Minecraft par1Minecraft, World par2World, Session par3Session, NetClientHandler par4NetClientHandler) + { + super(par1Minecraft, par2World, par3Session, 0); + this.sendQueue = par4NetClientHandler; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + return false; + } + + /** + * Heal living entity (param: amount of half-hearts) + */ + public void heal(float par1) {} + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (this.worldObj.blockExists(MathHelper.floor_double(this.posX), 0, MathHelper.floor_double(this.posZ))) + { + super.onUpdate(); + + if (this.isRiding()) + { + this.sendQueue.addToSendQueue(new Packet12PlayerLook(this.rotationYaw, this.rotationPitch, this.onGround)); + this.sendQueue.addToSendQueue(new Packet27PlayerInput(this.moveStrafing, this.moveForward, this.movementInput.jump, this.movementInput.sneak)); + } + else + { + this.sendMotionUpdates(); + } + } + } + + /** + * Send updated motion and position information to the server + */ + public void sendMotionUpdates() + { + boolean var1 = this.isSprinting(); + + if (var1 != this.wasSneaking) + { + if (var1) + { + this.sendQueue.addToSendQueue(new Packet19EntityAction(this, 4)); + } + else + { + this.sendQueue.addToSendQueue(new Packet19EntityAction(this, 5)); + } + + this.wasSneaking = var1; + } + + boolean var2 = this.isSneaking(); + + if (var2 != this.shouldStopSneaking) + { + if (var2) + { + this.sendQueue.addToSendQueue(new Packet19EntityAction(this, 1)); + } + else + { + this.sendQueue.addToSendQueue(new Packet19EntityAction(this, 2)); + } + + this.shouldStopSneaking = var2; + } + + double var3 = this.posX - this.oldPosX; + double var5 = this.boundingBox.minY - this.oldMinY; + double var7 = this.posZ - this.oldPosZ; + double var9 = (double)(this.rotationYaw - this.oldRotationYaw); + double var11 = (double)(this.rotationPitch - this.oldRotationPitch); + boolean var13 = var3 * var3 + var5 * var5 + var7 * var7 > 9.0E-4D || this.field_71168_co >= 20; + boolean var14 = var9 != 0.0D || var11 != 0.0D; + + if (this.ridingEntity != null) + { + this.sendQueue.addToSendQueue(new Packet13PlayerLookMove(this.motionX, -999.0D, -999.0D, this.motionZ, this.rotationYaw, this.rotationPitch, this.onGround)); + var13 = false; + } + else if (var13 && var14) + { + this.sendQueue.addToSendQueue(new Packet13PlayerLookMove(this.posX, this.boundingBox.minY, this.posY, this.posZ, this.rotationYaw, this.rotationPitch, this.onGround)); + } + else if (var13) + { + this.sendQueue.addToSendQueue(new Packet11PlayerPosition(this.posX, this.boundingBox.minY, this.posY, this.posZ, this.onGround)); + } + else if (var14) + { + this.sendQueue.addToSendQueue(new Packet12PlayerLook(this.rotationYaw, this.rotationPitch, this.onGround)); + } + else + { + this.sendQueue.addToSendQueue(new Packet10Flying(this.onGround)); + } + + ++this.field_71168_co; + this.wasOnGround = this.onGround; + + if (var13) + { + this.oldPosX = this.posX; + this.oldMinY = this.boundingBox.minY; + this.oldPosY = this.posY; + this.oldPosZ = this.posZ; + this.field_71168_co = 0; + } + + if (var14) + { + this.oldRotationYaw = this.rotationYaw; + this.oldRotationPitch = this.rotationPitch; + } + } + + /** + * Called when player presses the drop item key + */ + public EntityItem dropOneItem(boolean par1) + { + int var2 = par1 ? 3 : 4; + this.sendQueue.addToSendQueue(new Packet14BlockDig(var2, 0, 0, 0, 0)); + return null; + } + + /** + * Joins the passed in entity item with the world. Args: entityItem + */ + protected void joinEntityItemWithWorld(EntityItem par1EntityItem) {} + + /** + * Sends a chat message from the player. Args: chatMessage + */ + public void sendChatMessage(String par1Str) + { + this.sendQueue.addToSendQueue(new Packet3Chat(par1Str)); + } + + /** + * Swings the item the player is holding. + */ + public void swingItem() + { + super.swingItem(); + this.sendQueue.addToSendQueue(new Packet18Animation(this, 1)); + } + + public void respawnPlayer() + { + this.sendQueue.addToSendQueue(new Packet205ClientCommand(1)); + } + + /** + * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health + * second with the reduced value. Args: damageAmount + */ + protected void damageEntity(DamageSource par1DamageSource, float par2) + { + if (!this.isEntityInvulnerable()) + { + this.setHealth(this.getHealth() - par2); + } + } + + /** + * sets current screen to null (used on escape buttons of GUIs) + */ + public void closeScreen() + { + this.sendQueue.addToSendQueue(new Packet101CloseWindow(this.openContainer.windowId)); + this.func_92015_f(); + } + + public void func_92015_f() + { + this.inventory.setItemStack((ItemStack)null); + super.closeScreen(); + } + + /** + * Updates health locally. + */ + public void setPlayerSPHealth(float par1) + { + if (this.hasSetHealth) + { + super.setPlayerSPHealth(par1); + } + else + { + this.setHealth(par1); + this.hasSetHealth = true; + } + } + + /** + * Adds a value to a statistic field. + */ + public void addStat(StatBase par1StatBase, int par2) + { + if (par1StatBase != null) + { + if (par1StatBase.isIndependent) + { + super.addStat(par1StatBase, par2); + } + } + } + + /** + * Used by NetClientHandler.handleStatistic + */ + public void incrementStat(StatBase par1StatBase, int par2) + { + if (par1StatBase != null) + { + if (!par1StatBase.isIndependent) + { + super.addStat(par1StatBase, par2); + } + } + } + + /** + * Sends the player's abilities to the server (if there is one). + */ + public void sendPlayerAbilities() + { + this.sendQueue.addToSendQueue(new Packet202PlayerAbilities(this.capabilities)); + } + + protected void func_110318_g() + { + this.sendQueue.addToSendQueue(new Packet19EntityAction(this, 6, (int)(this.getHorseJumpPower() * 100.0F))); + } + + public void func_110322_i() + { + this.sendQueue.addToSendQueue(new Packet19EntityAction(this, 7)); + } + + public void func_142020_c(String par1Str) + { + this.field_142022_ce = par1Str; + } + + public String func_142021_k() + { + return this.field_142022_ce; + } +} diff --git a/src/main/java/net/minecraft/src/EntityCloudFX.java b/src/main/java/net/minecraft/src/EntityCloudFX.java new file mode 100644 index 0000000..a7737d1 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityCloudFX.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +public class EntityCloudFX extends EntityFX +{ + float field_70569_a; + + public EntityCloudFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + float var14 = 2.5F; + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += par8; + this.motionY += par10; + this.motionZ += par12; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F - (float)(Math.random() * 0.30000001192092896D); + this.particleScale *= 0.75F; + this.particleScale *= var14; + this.field_70569_a = this.particleScale; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.3D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * var14); + this.noClip = false; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F; + + if (var8 < 0.0F) + { + var8 = 0.0F; + } + + if (var8 > 1.0F) + { + var8 = 1.0F; + } + + this.particleScale = this.field_70569_a * var8; + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; + EntityPlayer var1 = this.worldObj.getClosestPlayerToEntity(this, 2.0D); + + if (var1 != null && this.posY > var1.boundingBox.minY) + { + this.posY += (var1.boundingBox.minY - this.posY) * 0.2D; + this.motionY += (var1.motionY - this.motionY) * 0.2D; + this.setPosition(this.posX, this.posY, this.posZ); + } + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityCow.java b/src/main/java/net/minecraft/src/EntityCow.java new file mode 100644 index 0000000..8967312 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityCow.java @@ -0,0 +1,150 @@ +package net.minecraft.src; + +public class EntityCow extends EntityAnimal +{ + public EntityCow(World par1World) + { + super(par1World); + this.setSize(0.9F, 1.3F); + this.getNavigator().setAvoidsWater(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 2.0D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Item.wheat.itemID, false)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D)); + this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(7, new EntityAILookIdle(this)); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return true; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.20000000298023224D); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.cow.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.cow.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.cow.hurt"; + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + this.playSound("mob.cow.step", 0.15F, 1.0F); + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.4F; + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.leather.itemID; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.rand.nextInt(3) + this.rand.nextInt(1 + par2); + int var4; + + for (var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Item.leather.itemID, 1); + } + + var3 = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2); + + for (var4 = 0; var4 < var3; ++var4) + { + if (this.isBurning()) + { + this.dropItem(Item.beefCooked.itemID, 1); + } + else + { + this.dropItem(Item.beefRaw.itemID, 1); + } + } + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + + if (var2 != null && var2.itemID == Item.bucketEmpty.itemID && !par1EntityPlayer.capabilities.isCreativeMode) + { + if (var2.stackSize-- == 1) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, new ItemStack(Item.bucketMilk)); + } + else if (!par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.bucketMilk))) + { + par1EntityPlayer.dropPlayerItem(new ItemStack(Item.bucketMilk.itemID, 1, 0)); + } + + return true; + } + else + { + return super.interact(par1EntityPlayer); + } + } + + /** + * This function is used when two same-species animals in 'love mode' breed to generate the new baby animal. + */ + public EntityCow spawnBabyAnimal(EntityAgeable par1EntityAgeable) + { + return new EntityCow(this.worldObj); + } + + public EntityAgeable createChild(EntityAgeable par1EntityAgeable) + { + return this.spawnBabyAnimal(par1EntityAgeable); + } +} diff --git a/src/main/java/net/minecraft/src/EntityCreature.java b/src/main/java/net/minecraft/src/EntityCreature.java new file mode 100644 index 0000000..a5d1f45 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityCreature.java @@ -0,0 +1,382 @@ +package net.minecraft.src; + +import java.util.UUID; + +public abstract class EntityCreature extends EntityLiving +{ + public static final UUID field_110179_h = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A"); + public static final AttributeModifier field_110181_i = (new AttributeModifier(field_110179_h, "Fleeing speed bonus", 2.0D, 2)).setSaved(false); + private PathEntity pathToEntity; + + /** The Entity this EntityCreature is set to attack. */ + protected Entity entityToAttack; + + /** + * returns true if a creature has attacked recently only used for creepers and skeletons + */ + protected boolean hasAttacked; + + /** Used to make a creature speed up and wander away when hit. */ + protected int fleeingTick; + private ChunkCoordinates homePosition = new ChunkCoordinates(0, 0, 0); + + /** If -1 there is no maximum distance */ + private float maximumHomeDistance = -1.0F; + private EntityAIBase field_110178_bs = new EntityAIMoveTowardsRestriction(this, 1.0D); + private boolean field_110180_bt; + + public EntityCreature(World par1World) + { + super(par1World); + } + + /** + * Disables a mob's ability to move on its own while true. + */ + protected boolean isMovementCeased() + { + return false; + } + + protected void updateEntityActionState() + { + this.worldObj.theProfiler.startSection("ai"); + + if (this.fleeingTick > 0 && --this.fleeingTick == 0) + { + AttributeInstance var1 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + var1.removeModifier(field_110181_i); + } + + this.hasAttacked = this.isMovementCeased(); + float var21 = 16.0F; + + if (this.entityToAttack == null) + { + this.entityToAttack = this.findPlayerToAttack(); + + if (this.entityToAttack != null) + { + this.pathToEntity = this.worldObj.getPathEntityToEntity(this, this.entityToAttack, var21, true, false, false, true); + } + } + else if (this.entityToAttack.isEntityAlive()) + { + float var2 = this.entityToAttack.getDistanceToEntity(this); + + if (this.canEntityBeSeen(this.entityToAttack)) + { + this.attackEntity(this.entityToAttack, var2); + } + } + else + { + this.entityToAttack = null; + } + + this.worldObj.theProfiler.endSection(); + + if (!this.hasAttacked && this.entityToAttack != null && (this.pathToEntity == null || this.rand.nextInt(20) == 0)) + { + this.pathToEntity = this.worldObj.getPathEntityToEntity(this, this.entityToAttack, var21, true, false, false, true); + } + else if (!this.hasAttacked && (this.pathToEntity == null && this.rand.nextInt(180) == 0 || this.rand.nextInt(120) == 0 || this.fleeingTick > 0) && this.entityAge < 100) + { + this.updateWanderPath(); + } + + int var22 = MathHelper.floor_double(this.boundingBox.minY + 0.5D); + boolean var3 = this.isInWater(); + boolean var4 = this.handleLavaMovement(); + this.rotationPitch = 0.0F; + + if (this.pathToEntity != null && this.rand.nextInt(100) != 0) + { + this.worldObj.theProfiler.startSection("followpath"); + Vec3 var5 = this.pathToEntity.getPosition(this); + double var6 = (double)(this.width * 2.0F); + + while (var5 != null && var5.squareDistanceTo(this.posX, var5.yCoord, this.posZ) < var6 * var6) + { + this.pathToEntity.incrementPathIndex(); + + if (this.pathToEntity.isFinished()) + { + var5 = null; + this.pathToEntity = null; + } + else + { + var5 = this.pathToEntity.getPosition(this); + } + } + + this.isJumping = false; + + if (var5 != null) + { + double var8 = var5.xCoord - this.posX; + double var10 = var5.zCoord - this.posZ; + double var12 = var5.yCoord - (double)var22; + float var14 = (float)(Math.atan2(var10, var8) * 180.0D / Math.PI) - 90.0F; + float var15 = MathHelper.wrapAngleTo180_float(var14 - this.rotationYaw); + this.moveForward = (float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(); + + if (var15 > 30.0F) + { + var15 = 30.0F; + } + + if (var15 < -30.0F) + { + var15 = -30.0F; + } + + this.rotationYaw += var15; + + if (this.hasAttacked && this.entityToAttack != null) + { + double var16 = this.entityToAttack.posX - this.posX; + double var18 = this.entityToAttack.posZ - this.posZ; + float var20 = this.rotationYaw; + this.rotationYaw = (float)(Math.atan2(var18, var16) * 180.0D / Math.PI) - 90.0F; + var15 = (var20 - this.rotationYaw + 90.0F) * (float)Math.PI / 180.0F; + this.moveStrafing = -MathHelper.sin(var15) * this.moveForward * 1.0F; + this.moveForward = MathHelper.cos(var15) * this.moveForward * 1.0F; + } + + if (var12 > 0.0D) + { + this.isJumping = true; + } + } + + if (this.entityToAttack != null) + { + this.faceEntity(this.entityToAttack, 30.0F, 30.0F); + } + + if (this.isCollidedHorizontally && !this.hasPath()) + { + this.isJumping = true; + } + + if (this.rand.nextFloat() < 0.8F && (var3 || var4)) + { + this.isJumping = true; + } + + this.worldObj.theProfiler.endSection(); + } + else + { + super.updateEntityActionState(); + this.pathToEntity = null; + } + } + + /** + * Time remaining during which the Animal is sped up and flees. + */ + protected void updateWanderPath() + { + this.worldObj.theProfiler.startSection("stroll"); + boolean var1 = false; + int var2 = -1; + int var3 = -1; + int var4 = -1; + float var5 = -99999.0F; + + for (int var6 = 0; var6 < 10; ++var6) + { + int var7 = MathHelper.floor_double(this.posX + (double)this.rand.nextInt(13) - 6.0D); + int var8 = MathHelper.floor_double(this.posY + (double)this.rand.nextInt(7) - 3.0D); + int var9 = MathHelper.floor_double(this.posZ + (double)this.rand.nextInt(13) - 6.0D); + float var10 = this.getBlockPathWeight(var7, var8, var9); + + if (var10 > var5) + { + var5 = var10; + var2 = var7; + var3 = var8; + var4 = var9; + var1 = true; + } + } + + if (var1) + { + this.pathToEntity = this.worldObj.getEntityPathToXYZ(this, var2, var3, var4, 10.0F, true, false, false, true); + } + + this.worldObj.theProfiler.endSection(); + } + + /** + * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack. + */ + protected void attackEntity(Entity par1Entity, float par2) {} + + /** + * Takes a coordinate in and returns a weight to determine how likely this creature will try to path to the block. + * Args: x, y, z + */ + public float getBlockPathWeight(int par1, int par2, int par3) + { + return 0.0F; + } + + /** + * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking + * (Animals, Spiders at day, peaceful PigZombies). + */ + protected Entity findPlayerToAttack() + { + return null; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.boundingBox.minY); + int var3 = MathHelper.floor_double(this.posZ); + return super.getCanSpawnHere() && this.getBlockPathWeight(var1, var2, var3) >= 0.0F; + } + + /** + * Returns true if entity has a path to follow + */ + public boolean hasPath() + { + return this.pathToEntity != null; + } + + /** + * sets the Entities walk path in EntityCreature + */ + public void setPathToEntity(PathEntity par1PathEntity) + { + this.pathToEntity = par1PathEntity; + } + + /** + * Returns current entities target + */ + public Entity getEntityToAttack() + { + return this.entityToAttack; + } + + /** + * Sets the entity which is to be attacked. + */ + public void setTarget(Entity par1Entity) + { + this.entityToAttack = par1Entity; + } + + public boolean func_110173_bK() + { + return this.func_110176_b(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + } + + public boolean func_110176_b(int par1, int par2, int par3) + { + return this.maximumHomeDistance == -1.0F ? true : this.homePosition.getDistanceSquared(par1, par2, par3) < this.maximumHomeDistance * this.maximumHomeDistance; + } + + public void setHomeArea(int par1, int par2, int par3, int par4) + { + this.homePosition.set(par1, par2, par3); + this.maximumHomeDistance = (float)par4; + } + + /** + * Returns the chunk coordinate object of the home position. + */ + public ChunkCoordinates getHomePosition() + { + return this.homePosition; + } + + public float func_110174_bM() + { + return this.maximumHomeDistance; + } + + public void detachHome() + { + this.maximumHomeDistance = -1.0F; + } + + /** + * Returns whether a home area is defined for this entity. + */ + public boolean hasHome() + { + return this.maximumHomeDistance != -1.0F; + } + + protected void func_110159_bB() + { + super.func_110159_bB(); + + if (this.getLeashed() && this.getLeashedToEntity() != null && this.getLeashedToEntity().worldObj == this.worldObj) + { + Entity var1 = this.getLeashedToEntity(); + this.setHomeArea((int)var1.posX, (int)var1.posY, (int)var1.posZ, 5); + float var2 = this.getDistanceToEntity(var1); + + if (this instanceof EntityTameable && ((EntityTameable)this).isSitting()) + { + if (var2 > 10.0F) + { + this.clearLeashed(true, true); + } + + return; + } + + if (!this.field_110180_bt) + { + this.tasks.addTask(2, this.field_110178_bs); + this.getNavigator().setAvoidsWater(false); + this.field_110180_bt = true; + } + + this.func_142017_o(var2); + + if (var2 > 4.0F) + { + this.getNavigator().tryMoveToEntityLiving(var1, 1.0D); + } + + if (var2 > 6.0F) + { + double var3 = (var1.posX - this.posX) / (double)var2; + double var5 = (var1.posY - this.posY) / (double)var2; + double var7 = (var1.posZ - this.posZ) / (double)var2; + this.motionX += var3 * Math.abs(var3) * 0.4D; + this.motionY += var5 * Math.abs(var5) * 0.4D; + this.motionZ += var7 * Math.abs(var7) * 0.4D; + } + + if (var2 > 10.0F) + { + this.clearLeashed(true, true); + } + } + else if (!this.getLeashed() && this.field_110180_bt) + { + this.field_110180_bt = false; + this.tasks.removeTask(this.field_110178_bs); + this.getNavigator().setAvoidsWater(true); + this.detachHome(); + } + } + + protected void func_142017_o(float par1) {} +} diff --git a/src/main/java/net/minecraft/src/EntityCreeper.java b/src/main/java/net/minecraft/src/EntityCreeper.java new file mode 100644 index 0000000..4d31d6f --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityCreeper.java @@ -0,0 +1,242 @@ +package net.minecraft.src; + +public class EntityCreeper extends EntityMob +{ + /** + * Time when this creeper was last in an active state (Messed up code here, probably causes creeper animation to go + * weird) + */ + private int lastActiveTime; + + /** + * The amount of time since the creeper was close enough to the player to ignite + */ + private int timeSinceIgnited; + private int fuseTime = 30; + + /** Explosion radius for this creeper. */ + private int explosionRadius = 3; + + public EntityCreeper(World par1World) + { + super(par1World); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAICreeperSwell(this)); + this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityOcelot.class, 6.0F, 1.0D, 1.2D)); + this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, false)); + this.tasks.addTask(5, new EntityAIWander(this, 0.8D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(6, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); + this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.25D); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return true; + } + + /** + * The number of iterations PathFinder.getSafePoint will execute before giving up. + */ + public int getMaxSafePointTries() + { + return this.getAttackTarget() == null ? 3 : 3 + (int)(this.getHealth() - 1.0F); + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) + { + super.fall(par1); + this.timeSinceIgnited = (int)((float)this.timeSinceIgnited + par1 * 1.5F); + + if (this.timeSinceIgnited > this.fuseTime - 5) + { + this.timeSinceIgnited = this.fuseTime - 5; + } + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte) - 1)); + this.dataWatcher.addObject(17, Byte.valueOf((byte)0)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + + if (this.dataWatcher.getWatchableObjectByte(17) == 1) + { + par1NBTTagCompound.setBoolean("powered", true); + } + + par1NBTTagCompound.setShort("Fuse", (short)this.fuseTime); + par1NBTTagCompound.setByte("ExplosionRadius", (byte)this.explosionRadius); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.dataWatcher.updateObject(17, Byte.valueOf((byte)(par1NBTTagCompound.getBoolean("powered") ? 1 : 0))); + + if (par1NBTTagCompound.hasKey("Fuse")) + { + this.fuseTime = par1NBTTagCompound.getShort("Fuse"); + } + + if (par1NBTTagCompound.hasKey("ExplosionRadius")) + { + this.explosionRadius = par1NBTTagCompound.getByte("ExplosionRadius"); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (this.isEntityAlive()) + { + this.lastActiveTime = this.timeSinceIgnited; + int var1 = this.getCreeperState(); + + if (var1 > 0 && this.timeSinceIgnited == 0) + { + this.playSound("random.fuse", 1.0F, 0.5F); + } + + this.timeSinceIgnited += var1; + + if (this.timeSinceIgnited < 0) + { + this.timeSinceIgnited = 0; + } + + if (this.timeSinceIgnited >= this.fuseTime) + { + this.timeSinceIgnited = this.fuseTime; + + if (!this.worldObj.isRemote) + { + boolean var2 = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"); + + if (this.getPowered()) + { + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(this.explosionRadius * 2), var2); + } + else + { + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.explosionRadius, var2); + } + + this.setDead(); + } + } + } + + super.onUpdate(); + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.creeper.say"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.creeper.death"; + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource par1DamageSource) + { + super.onDeath(par1DamageSource); + + if (par1DamageSource.getEntity() instanceof EntitySkeleton) + { + int var2 = Item.record13.itemID + this.rand.nextInt(Item.recordWait.itemID - Item.record13.itemID + 1); + this.dropItem(var2, 1); + } + } + + public boolean attackEntityAsMob(Entity par1Entity) + { + return true; + } + + /** + * Returns true if the creeper is powered by a lightning bolt. + */ + public boolean getPowered() + { + return this.dataWatcher.getWatchableObjectByte(17) == 1; + } + + /** + * Params: (Float)Render tick. Returns the intensity of the creeper's flash when it is ignited. + */ + public float getCreeperFlashIntensity(float par1) + { + return ((float)this.lastActiveTime + (float)(this.timeSinceIgnited - this.lastActiveTime) * par1) / (float)(this.fuseTime - 2); + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.gunpowder.itemID; + } + + /** + * Returns the current state of creeper, -1 is idle, 1 is 'in fuse' + */ + public int getCreeperState() + { + return this.dataWatcher.getWatchableObjectByte(16); + } + + /** + * Sets the state of creeper, -1 to idle and 1 to be 'in fuse' + */ + public void setCreeperState(int par1) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)par1)); + } + + /** + * Called when a lightning bolt hits the entity. + */ + public void onStruckByLightning(EntityLightningBolt par1EntityLightningBolt) + { + super.onStruckByLightning(par1EntityLightningBolt); + this.dataWatcher.updateObject(17, Byte.valueOf((byte)1)); + } +} diff --git a/src/main/java/net/minecraft/src/EntityCrit2FX.java b/src/main/java/net/minecraft/src/EntityCrit2FX.java new file mode 100644 index 0000000..65b5e5b --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityCrit2FX.java @@ -0,0 +1,59 @@ +package net.minecraft.src; + +public class EntityCrit2FX extends EntityFX +{ + /** Entity that had been hit and done the Critical hit on. */ + private Entity theEntity; + private int currentLife; + private int maximumLife; + private String particleName; + + public EntityCrit2FX(World par1World, Entity par2Entity) + { + this(par1World, par2Entity, "crit"); + } + + public EntityCrit2FX(World par1World, Entity par2Entity, String par3Str) + { + super(par1World, par2Entity.posX, par2Entity.boundingBox.minY + (double)(par2Entity.height / 2.0F), par2Entity.posZ, par2Entity.motionX, par2Entity.motionY, par2Entity.motionZ); + this.theEntity = par2Entity; + this.maximumLife = 3; + this.particleName = par3Str; + this.onUpdate(); + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {} + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + for (int var1 = 0; var1 < 16; ++var1) + { + double var2 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); + double var4 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); + double var6 = (double)(this.rand.nextFloat() * 2.0F - 1.0F); + + if (var2 * var2 + var4 * var4 + var6 * var6 <= 1.0D) + { + double var8 = this.theEntity.posX + var2 * (double)this.theEntity.width / 4.0D; + double var10 = this.theEntity.boundingBox.minY + (double)(this.theEntity.height / 2.0F) + var4 * (double)this.theEntity.height / 4.0D; + double var12 = this.theEntity.posZ + var6 * (double)this.theEntity.width / 4.0D; + this.worldObj.spawnParticle(this.particleName, var8, var10, var12, var2, var4 + 0.2D, var6); + } + } + + ++this.currentLife; + + if (this.currentLife >= this.maximumLife) + { + this.setDead(); + } + } + + public int getFXLayer() + { + return 3; + } +} diff --git a/src/main/java/net/minecraft/src/EntityCritFX.java b/src/main/java/net/minecraft/src/EntityCritFX.java new file mode 100644 index 0000000..fca28e5 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityCritFX.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +public class EntityCritFX extends EntityFX +{ + float initialParticleScale; + + public EntityCritFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + this(par1World, par2, par4, par6, par8, par10, par12, 1.0F); + } + + public EntityCritFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += par8 * 0.4D; + this.motionY += par10 * 0.4D; + this.motionZ += par12 * 0.4D; + this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D + 0.6000000238418579D); + this.particleScale *= 0.75F; + this.particleScale *= par14; + this.initialParticleScale = this.particleScale; + this.particleMaxAge = (int)(6.0D / (Math.random() * 0.8D + 0.6D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * par14); + this.noClip = false; + this.setParticleTextureIndex(65); + this.onUpdate(); + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F; + + if (var8 < 0.0F) + { + var8 = 0.0F; + } + + if (var8 > 1.0F) + { + var8 = 1.0F; + } + + this.particleScale = this.initialParticleScale * var8; + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.particleGreen = (float)((double)this.particleGreen * 0.96D); + this.particleBlue = (float)((double)this.particleBlue * 0.9D); + this.motionX *= 0.699999988079071D; + this.motionY *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + this.motionY -= 0.019999999552965164D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityDamageSource.java b/src/main/java/net/minecraft/src/EntityDamageSource.java new file mode 100644 index 0000000..f5990bd --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityDamageSource.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +public class EntityDamageSource extends DamageSource +{ + protected Entity damageSourceEntity; + + public EntityDamageSource(String par1Str, Entity par2Entity) + { + super(par1Str); + this.damageSourceEntity = par2Entity; + } + + public Entity getEntity() + { + return this.damageSourceEntity; + } + + /** + * Returns the message to be displayed on player death. + */ + public ChatMessageComponent getDeathMessage(EntityLivingBase par1EntityLivingBase) + { + ItemStack var2 = this.damageSourceEntity instanceof EntityLivingBase ? ((EntityLivingBase)this.damageSourceEntity).getHeldItem() : null; + String var3 = "death.attack." + this.damageType; + String var4 = var3 + ".item"; + return var2 != null && var2.hasDisplayName() && StatCollector.func_94522_b(var4) ? ChatMessageComponent.createFromTranslationWithSubstitutions(var4, new Object[] {par1EntityLivingBase.getTranslatedEntityName(), this.damageSourceEntity.getTranslatedEntityName(), var2.getDisplayName()}): ChatMessageComponent.createFromTranslationWithSubstitutions(var3, new Object[] {par1EntityLivingBase.getTranslatedEntityName(), this.damageSourceEntity.getTranslatedEntityName()}); + } + + /** + * Return whether this damage source will have its damage amount scaled based on the current difficulty. + */ + public boolean isDifficultyScaled() + { + return this.damageSourceEntity != null && this.damageSourceEntity instanceof EntityLivingBase && !(this.damageSourceEntity instanceof EntityPlayer); + } +} diff --git a/src/main/java/net/minecraft/src/EntityDamageSourceIndirect.java b/src/main/java/net/minecraft/src/EntityDamageSourceIndirect.java new file mode 100644 index 0000000..18babe3 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityDamageSourceIndirect.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class EntityDamageSourceIndirect extends EntityDamageSource +{ + private Entity indirectEntity; + + public EntityDamageSourceIndirect(String par1Str, Entity par2Entity, Entity par3Entity) + { + super(par1Str, par2Entity); + this.indirectEntity = par3Entity; + } + + public Entity getSourceOfDamage() + { + return this.damageSourceEntity; + } + + public Entity getEntity() + { + return this.indirectEntity; + } + + /** + * Returns the message to be displayed on player death. + */ + public ChatMessageComponent getDeathMessage(EntityLivingBase par1EntityLivingBase) + { + String var2 = this.indirectEntity == null ? this.damageSourceEntity.getTranslatedEntityName() : this.indirectEntity.getTranslatedEntityName(); + ItemStack var3 = this.indirectEntity instanceof EntityLivingBase ? ((EntityLivingBase)this.indirectEntity).getHeldItem() : null; + String var4 = "death.attack." + this.damageType; + String var5 = var4 + ".item"; + return var3 != null && var3.hasDisplayName() && StatCollector.func_94522_b(var5) ? ChatMessageComponent.createFromTranslationWithSubstitutions(var5, new Object[] {par1EntityLivingBase.getTranslatedEntityName(), var2, var3.getDisplayName()}): ChatMessageComponent.createFromTranslationWithSubstitutions(var4, new Object[] {par1EntityLivingBase.getTranslatedEntityName(), var2}); + } +} diff --git a/src/main/java/net/minecraft/src/EntityDiggingFX.java b/src/main/java/net/minecraft/src/EntityDiggingFX.java new file mode 100644 index 0000000..16b31ad --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityDiggingFX.java @@ -0,0 +1,86 @@ +package net.minecraft.src; + +public class EntityDiggingFX extends EntityFX +{ + private Block blockInstance; + + public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15) + { + super(par1World, par2, par4, par6, par8, par10, par12); + this.blockInstance = par14Block; + this.setParticleIcon(par14Block.getIcon(0, par15)); + this.particleGravity = par14Block.blockParticleGravity; + this.particleRed = this.particleGreen = this.particleBlue = 0.6F; + this.particleScale /= 2.0F; + } + + /** + * If the block has a colour multiplier, copies it to this particle and returns this particle. + */ + public EntityDiggingFX applyColourMultiplier(int par1, int par2, int par3) + { + if (this.blockInstance == Block.grass) + { + return this; + } + else + { + int var4 = this.blockInstance.colorMultiplier(this.worldObj, par1, par2, par3); + this.particleRed *= (float)(var4 >> 16 & 255) / 255.0F; + this.particleGreen *= (float)(var4 >> 8 & 255) / 255.0F; + this.particleBlue *= (float)(var4 & 255) / 255.0F; + return this; + } + } + + /** + * Creates a new EntityDiggingFX with the block render color applied to the base particle color + */ + public EntityDiggingFX applyRenderColor(int par1) + { + if (this.blockInstance == Block.grass) + { + return this; + } + else + { + int var2 = this.blockInstance.getRenderColor(par1); + this.particleRed *= (float)(var2 >> 16 & 255) / 255.0F; + this.particleGreen *= (float)(var2 >> 8 & 255) / 255.0F; + this.particleBlue *= (float)(var2 & 255) / 255.0F; + return this; + } + } + + public int getFXLayer() + { + return 1; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F; + float var9 = var8 + 0.015609375F; + float var10 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F; + float var11 = var10 + 0.015609375F; + float var12 = 0.1F * this.particleScale; + + if (this.particleIcon != null) + { + var8 = this.particleIcon.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F)); + var9 = this.particleIcon.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F)); + var10 = this.particleIcon.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F)); + var11 = this.particleIcon.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F)); + } + + float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX); + float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY); + float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ); + float var16 = 1.0F; + par1Tessellator.setColorOpaque_F(var16 * this.particleRed, var16 * this.particleGreen, var16 * this.particleBlue); + par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var8, (double)var11); + par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var8, (double)var10); + par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var9, (double)var10); + par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var9, (double)var11); + } +} diff --git a/src/main/java/net/minecraft/src/EntityDragon.java b/src/main/java/net/minecraft/src/EntityDragon.java new file mode 100644 index 0000000..660e37c --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityDragon.java @@ -0,0 +1,739 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class EntityDragon extends EntityLiving implements IBossDisplayData, IEntityMultiPart, IMob +{ + public double targetX; + public double targetY; + public double targetZ; + + /** + * Ring buffer array for the last 64 Y-positions and yaw rotations. Used to calculate offsets for the animations. + */ + public double[][] ringBuffer = new double[64][3]; + + /** + * Index into the ring buffer. Incremented once per tick and restarts at 0 once it reaches the end of the buffer. + */ + public int ringBufferIndex = -1; + + /** An array containing all body parts of this dragon */ + public EntityDragonPart[] dragonPartArray; + + /** The head bounding box of a dragon */ + public EntityDragonPart dragonPartHead; + + /** The body bounding box of a dragon */ + public EntityDragonPart dragonPartBody; + public EntityDragonPart dragonPartTail1; + public EntityDragonPart dragonPartTail2; + public EntityDragonPart dragonPartTail3; + public EntityDragonPart dragonPartWing1; + public EntityDragonPart dragonPartWing2; + + /** Animation time at previous tick. */ + public float prevAnimTime; + + /** + * Animation time, used to control the speed of the animation cycles (wings flapping, jaw opening, etc.) + */ + public float animTime; + + /** Force selecting a new flight target at next tick if set to true. */ + public boolean forceNewTarget; + + /** + * Activated if the dragon is flying though obsidian, white stone or bedrock. Slows movement and animation speed. + */ + public boolean slowed; + private Entity target; + public int deathTicks; + + /** The current endercrystal that is healing this dragon */ + public EntityEnderCrystal healingEnderCrystal; + + public EntityDragon(World par1World) + { + super(par1World); + this.dragonPartArray = new EntityDragonPart[] {this.dragonPartHead = new EntityDragonPart(this, "head", 6.0F, 6.0F), this.dragonPartBody = new EntityDragonPart(this, "body", 8.0F, 8.0F), this.dragonPartTail1 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartTail2 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartTail3 = new EntityDragonPart(this, "tail", 4.0F, 4.0F), this.dragonPartWing1 = new EntityDragonPart(this, "wing", 4.0F, 4.0F), this.dragonPartWing2 = new EntityDragonPart(this, "wing", 4.0F, 4.0F)}; + this.setHealth(this.getMaxHealth()); + this.setSize(16.0F, 8.0F); + this.noClip = true; + this.isImmuneToFire = true; + this.targetY = 100.0D; + this.ignoreFrustumCheck = true; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(200.0D); + } + + protected void entityInit() + { + super.entityInit(); + } + + /** + * Returns a double[3] array with movement offsets, used to calculate trailing tail/neck positions. [0] = yaw + * offset, [1] = y offset, [2] = unused, always 0. Parameters: buffer index offset, partial ticks. + */ + public double[] getMovementOffsets(int par1, float par2) + { + if (this.getHealth() <= 0.0F) + { + par2 = 0.0F; + } + + par2 = 1.0F - par2; + int var3 = this.ringBufferIndex - par1 * 1 & 63; + int var4 = this.ringBufferIndex - par1 * 1 - 1 & 63; + double[] var5 = new double[3]; + double var6 = this.ringBuffer[var3][0]; + double var8 = MathHelper.wrapAngleTo180_double(this.ringBuffer[var4][0] - var6); + var5[0] = var6 + var8 * (double)par2; + var6 = this.ringBuffer[var3][1]; + var8 = this.ringBuffer[var4][1] - var6; + var5[1] = var6 + var8 * (double)par2; + var5[2] = this.ringBuffer[var3][2] + (this.ringBuffer[var4][2] - this.ringBuffer[var3][2]) * (double)par2; + return var5; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + float var1; + float var2; + + if (this.worldObj.isRemote) + { + var1 = MathHelper.cos(this.animTime * (float)Math.PI * 2.0F); + var2 = MathHelper.cos(this.prevAnimTime * (float)Math.PI * 2.0F); + + if (var2 <= -0.3F && var1 >= -0.3F) + { + this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.rand.nextFloat() * 0.3F, false); + } + } + + this.prevAnimTime = this.animTime; + float var3; + + if (this.getHealth() <= 0.0F) + { + var1 = (this.rand.nextFloat() - 0.5F) * 8.0F; + var2 = (this.rand.nextFloat() - 0.5F) * 4.0F; + var3 = (this.rand.nextFloat() - 0.5F) * 8.0F; + this.worldObj.spawnParticle("largeexplode", this.posX + (double)var1, this.posY + 2.0D + (double)var2, this.posZ + (double)var3, 0.0D, 0.0D, 0.0D); + } + else + { + this.updateDragonEnderCrystal(); + var1 = 0.2F / (MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 10.0F + 1.0F); + var1 *= (float)Math.pow(2.0D, this.motionY); + + if (this.slowed) + { + this.animTime += var1 * 0.5F; + } + else + { + this.animTime += var1; + } + + this.rotationYaw = MathHelper.wrapAngleTo180_float(this.rotationYaw); + + if (this.ringBufferIndex < 0) + { + for (int var25 = 0; var25 < this.ringBuffer.length; ++var25) + { + this.ringBuffer[var25][0] = (double)this.rotationYaw; + this.ringBuffer[var25][1] = this.posY; + } + } + + if (++this.ringBufferIndex == this.ringBuffer.length) + { + this.ringBufferIndex = 0; + } + + this.ringBuffer[this.ringBufferIndex][0] = (double)this.rotationYaw; + this.ringBuffer[this.ringBufferIndex][1] = this.posY; + double var4; + double var6; + double var8; + double var26; + float var31; + + if (this.worldObj.isRemote) + { + if (this.newPosRotationIncrements > 0) + { + var26 = this.posX + (this.newPosX - this.posX) / (double)this.newPosRotationIncrements; + var4 = this.posY + (this.newPosY - this.posY) / (double)this.newPosRotationIncrements; + var6 = this.posZ + (this.newPosZ - this.posZ) / (double)this.newPosRotationIncrements; + var8 = MathHelper.wrapAngleTo180_double(this.newRotationYaw - (double)this.rotationYaw); + this.rotationYaw = (float)((double)this.rotationYaw + var8 / (double)this.newPosRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.newRotationPitch - (double)this.rotationPitch) / (double)this.newPosRotationIncrements); + --this.newPosRotationIncrements; + this.setPosition(var26, var4, var6); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + } + else + { + var26 = this.targetX - this.posX; + var4 = this.targetY - this.posY; + var6 = this.targetZ - this.posZ; + var8 = var26 * var26 + var4 * var4 + var6 * var6; + + if (this.target != null) + { + this.targetX = this.target.posX; + this.targetZ = this.target.posZ; + double var10 = this.targetX - this.posX; + double var12 = this.targetZ - this.posZ; + double var14 = Math.sqrt(var10 * var10 + var12 * var12); + double var16 = 0.4000000059604645D + var14 / 80.0D - 1.0D; + + if (var16 > 10.0D) + { + var16 = 10.0D; + } + + this.targetY = this.target.boundingBox.minY + var16; + } + else + { + this.targetX += this.rand.nextGaussian() * 2.0D; + this.targetZ += this.rand.nextGaussian() * 2.0D; + } + + if (this.forceNewTarget || var8 < 100.0D || var8 > 22500.0D || this.isCollidedHorizontally || this.isCollidedVertically) + { + this.setNewTarget(); + } + + var4 /= (double)MathHelper.sqrt_double(var26 * var26 + var6 * var6); + var31 = 0.6F; + + if (var4 < (double)(-var31)) + { + var4 = (double)(-var31); + } + + if (var4 > (double)var31) + { + var4 = (double)var31; + } + + this.motionY += var4 * 0.10000000149011612D; + this.rotationYaw = MathHelper.wrapAngleTo180_float(this.rotationYaw); + double var11 = 180.0D - Math.atan2(var26, var6) * 180.0D / Math.PI; + double var13 = MathHelper.wrapAngleTo180_double(var11 - (double)this.rotationYaw); + + if (var13 > 50.0D) + { + var13 = 50.0D; + } + + if (var13 < -50.0D) + { + var13 = -50.0D; + } + + Vec3 var15 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.targetX - this.posX, this.targetY - this.posY, this.targetZ - this.posZ).normalize(); + Vec3 var39 = this.worldObj.getWorldVec3Pool().getVecFromPool((double)MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F), this.motionY, (double)(-MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F))).normalize(); + float var17 = (float)(var39.dotProduct(var15) + 0.5D) / 1.5F; + + if (var17 < 0.0F) + { + var17 = 0.0F; + } + + this.randomYawVelocity *= 0.8F; + float var18 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0F + 1.0F; + double var19 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ) * 1.0D + 1.0D; + + if (var19 > 40.0D) + { + var19 = 40.0D; + } + + this.randomYawVelocity = (float)((double)this.randomYawVelocity + var13 * (0.699999988079071D / var19 / (double)var18)); + this.rotationYaw += this.randomYawVelocity * 0.1F; + float var21 = (float)(2.0D / (var19 + 1.0D)); + float var22 = 0.06F; + this.moveFlying(0.0F, -1.0F, var22 * (var17 * var21 + (1.0F - var21))); + + if (this.slowed) + { + this.moveEntity(this.motionX * 0.800000011920929D, this.motionY * 0.800000011920929D, this.motionZ * 0.800000011920929D); + } + else + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + + Vec3 var23 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.motionX, this.motionY, this.motionZ).normalize(); + float var24 = (float)(var23.dotProduct(var39) + 1.0D) / 2.0F; + var24 = 0.8F + 0.15F * var24; + this.motionX *= (double)var24; + this.motionZ *= (double)var24; + this.motionY *= 0.9100000262260437D; + } + + this.renderYawOffset = this.rotationYaw; + this.dragonPartHead.width = this.dragonPartHead.height = 3.0F; + this.dragonPartTail1.width = this.dragonPartTail1.height = 2.0F; + this.dragonPartTail2.width = this.dragonPartTail2.height = 2.0F; + this.dragonPartTail3.width = this.dragonPartTail3.height = 2.0F; + this.dragonPartBody.height = 3.0F; + this.dragonPartBody.width = 5.0F; + this.dragonPartWing1.height = 2.0F; + this.dragonPartWing1.width = 4.0F; + this.dragonPartWing2.height = 3.0F; + this.dragonPartWing2.width = 4.0F; + var2 = (float)(this.getMovementOffsets(5, 1.0F)[1] - this.getMovementOffsets(10, 1.0F)[1]) * 10.0F / 180.0F * (float)Math.PI; + var3 = MathHelper.cos(var2); + float var27 = -MathHelper.sin(var2); + float var5 = this.rotationYaw * (float)Math.PI / 180.0F; + float var28 = MathHelper.sin(var5); + float var7 = MathHelper.cos(var5); + this.dragonPartBody.onUpdate(); + this.dragonPartBody.setLocationAndAngles(this.posX + (double)(var28 * 0.5F), this.posY, this.posZ - (double)(var7 * 0.5F), 0.0F, 0.0F); + this.dragonPartWing1.onUpdate(); + this.dragonPartWing1.setLocationAndAngles(this.posX + (double)(var7 * 4.5F), this.posY + 2.0D, this.posZ + (double)(var28 * 4.5F), 0.0F, 0.0F); + this.dragonPartWing2.onUpdate(); + this.dragonPartWing2.setLocationAndAngles(this.posX - (double)(var7 * 4.5F), this.posY + 2.0D, this.posZ - (double)(var28 * 4.5F), 0.0F, 0.0F); + + if (!this.worldObj.isRemote && this.hurtTime == 0) + { + this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartWing1.boundingBox.expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); + this.collideWithEntities(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartWing2.boundingBox.expand(4.0D, 2.0D, 4.0D).offset(0.0D, -2.0D, 0.0D))); + this.attackEntitiesInList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.dragonPartHead.boundingBox.expand(1.0D, 1.0D, 1.0D))); + } + + double[] var29 = this.getMovementOffsets(5, 1.0F); + double[] var9 = this.getMovementOffsets(0, 1.0F); + var31 = MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F - this.randomYawVelocity * 0.01F); + float var33 = MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F - this.randomYawVelocity * 0.01F); + this.dragonPartHead.onUpdate(); + this.dragonPartHead.setLocationAndAngles(this.posX + (double)(var31 * 5.5F * var3), this.posY + (var9[1] - var29[1]) * 1.0D + (double)(var27 * 5.5F), this.posZ - (double)(var33 * 5.5F * var3), 0.0F, 0.0F); + + for (int var30 = 0; var30 < 3; ++var30) + { + EntityDragonPart var32 = null; + + if (var30 == 0) + { + var32 = this.dragonPartTail1; + } + + if (var30 == 1) + { + var32 = this.dragonPartTail2; + } + + if (var30 == 2) + { + var32 = this.dragonPartTail3; + } + + double[] var34 = this.getMovementOffsets(12 + var30 * 2, 1.0F); + float var35 = this.rotationYaw * (float)Math.PI / 180.0F + this.simplifyAngle(var34[0] - var29[0]) * (float)Math.PI / 180.0F * 1.0F; + float var37 = MathHelper.sin(var35); + float var36 = MathHelper.cos(var35); + float var38 = 1.5F; + float var40 = (float)(var30 + 1) * 2.0F; + var32.onUpdate(); + var32.setLocationAndAngles(this.posX - (double)((var28 * var38 + var37 * var40) * var3), this.posY + (var34[1] - var29[1]) * 1.0D - (double)((var40 + var38) * var27) + 1.5D, this.posZ + (double)((var7 * var38 + var36 * var40) * var3), 0.0F, 0.0F); + } + + if (!this.worldObj.isRemote) + { + this.slowed = this.destroyBlocksInAABB(this.dragonPartHead.boundingBox) | this.destroyBlocksInAABB(this.dragonPartBody.boundingBox); + } + } + } + + /** + * Updates the state of the enderdragon's current endercrystal. + */ + private void updateDragonEnderCrystal() + { + if (this.healingEnderCrystal != null) + { + if (this.healingEnderCrystal.isDead) + { + if (!this.worldObj.isRemote) + { + this.attackEntityFromPart(this.dragonPartHead, DamageSource.setExplosionSource((Explosion)null), 10.0F); + } + + this.healingEnderCrystal = null; + } + else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth()) + { + this.setHealth(this.getHealth() + 1.0F); + } + } + + if (this.rand.nextInt(10) == 0) + { + float var1 = 32.0F; + List var2 = this.worldObj.getEntitiesWithinAABB(EntityEnderCrystal.class, this.boundingBox.expand((double)var1, (double)var1, (double)var1)); + EntityEnderCrystal var3 = null; + double var4 = Double.MAX_VALUE; + Iterator var6 = var2.iterator(); + + while (var6.hasNext()) + { + EntityEnderCrystal var7 = (EntityEnderCrystal)var6.next(); + double var8 = var7.getDistanceSqToEntity(this); + + if (var8 < var4) + { + var4 = var8; + var3 = var7; + } + } + + this.healingEnderCrystal = var3; + } + } + + /** + * Pushes all entities inside the list away from the enderdragon. + */ + private void collideWithEntities(List par1List) + { + double var2 = (this.dragonPartBody.boundingBox.minX + this.dragonPartBody.boundingBox.maxX) / 2.0D; + double var4 = (this.dragonPartBody.boundingBox.minZ + this.dragonPartBody.boundingBox.maxZ) / 2.0D; + Iterator var6 = par1List.iterator(); + + while (var6.hasNext()) + { + Entity var7 = (Entity)var6.next(); + + if (var7 instanceof EntityLivingBase) + { + double var8 = var7.posX - var2; + double var10 = var7.posZ - var4; + double var12 = var8 * var8 + var10 * var10; + var7.addVelocity(var8 / var12 * 4.0D, 0.20000000298023224D, var10 / var12 * 4.0D); + } + } + } + + /** + * Attacks all entities inside this list, dealing 5 hearts of damage. + */ + private void attackEntitiesInList(List par1List) + { + for (int var2 = 0; var2 < par1List.size(); ++var2) + { + Entity var3 = (Entity)par1List.get(var2); + + if (var3 instanceof EntityLivingBase) + { + var3.attackEntityFrom(DamageSource.causeMobDamage(this), 10.0F); + } + } + } + + /** + * Sets a new target for the flight AI. It can be a random coordinate or a nearby player. + */ + private void setNewTarget() + { + this.forceNewTarget = false; + + if (this.rand.nextInt(2) == 0 && !this.worldObj.playerEntities.isEmpty()) + { + this.target = (Entity)this.worldObj.playerEntities.get(this.rand.nextInt(this.worldObj.playerEntities.size())); + } + else + { + boolean var1 = false; + + do + { + this.targetX = 0.0D; + this.targetY = (double)(70.0F + this.rand.nextFloat() * 50.0F); + this.targetZ = 0.0D; + this.targetX += (double)(this.rand.nextFloat() * 120.0F - 60.0F); + this.targetZ += (double)(this.rand.nextFloat() * 120.0F - 60.0F); + double var2 = this.posX - this.targetX; + double var4 = this.posY - this.targetY; + double var6 = this.posZ - this.targetZ; + var1 = var2 * var2 + var4 * var4 + var6 * var6 > 100.0D; + } + while (!var1); + + this.target = null; + } + } + + /** + * Simplifies the value of a number by adding/subtracting 180 to the point that the number is between -180 and 180. + */ + private float simplifyAngle(double par1) + { + return (float)MathHelper.wrapAngleTo180_double(par1); + } + + /** + * Destroys all blocks that aren't associated with 'The End' inside the given bounding box. + */ + private boolean destroyBlocksInAABB(AxisAlignedBB par1AxisAlignedBB) + { + int var2 = MathHelper.floor_double(par1AxisAlignedBB.minX); + int var3 = MathHelper.floor_double(par1AxisAlignedBB.minY); + int var4 = MathHelper.floor_double(par1AxisAlignedBB.minZ); + int var5 = MathHelper.floor_double(par1AxisAlignedBB.maxX); + int var6 = MathHelper.floor_double(par1AxisAlignedBB.maxY); + int var7 = MathHelper.floor_double(par1AxisAlignedBB.maxZ); + boolean var8 = false; + boolean var9 = false; + + for (int var10 = var2; var10 <= var5; ++var10) + { + for (int var11 = var3; var11 <= var6; ++var11) + { + for (int var12 = var4; var12 <= var7; ++var12) + { + int var13 = this.worldObj.getBlockId(var10, var11, var12); + + if (var13 != 0) + { + if (var13 != Block.obsidian.blockID && var13 != Block.whiteStone.blockID && var13 != Block.bedrock.blockID && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) + { + var9 = this.worldObj.setBlockToAir(var10, var11, var12) || var9; + } + else + { + var8 = true; + } + } + } + } + } + + if (var9) + { + double var16 = par1AxisAlignedBB.minX + (par1AxisAlignedBB.maxX - par1AxisAlignedBB.minX) * (double)this.rand.nextFloat(); + double var17 = par1AxisAlignedBB.minY + (par1AxisAlignedBB.maxY - par1AxisAlignedBB.minY) * (double)this.rand.nextFloat(); + double var14 = par1AxisAlignedBB.minZ + (par1AxisAlignedBB.maxZ - par1AxisAlignedBB.minZ) * (double)this.rand.nextFloat(); + this.worldObj.spawnParticle("largeexplode", var16, var17, var14, 0.0D, 0.0D, 0.0D); + } + + return var8; + } + + public boolean attackEntityFromPart(EntityDragonPart par1EntityDragonPart, DamageSource par2DamageSource, float par3) + { + if (par1EntityDragonPart != this.dragonPartHead) + { + par3 = par3 / 4.0F + 1.0F; + } + + float var4 = this.rotationYaw * (float)Math.PI / 180.0F; + float var5 = MathHelper.sin(var4); + float var6 = MathHelper.cos(var4); + this.targetX = this.posX + (double)(var5 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); + this.targetY = this.posY + (double)(this.rand.nextFloat() * 3.0F) + 1.0D; + this.targetZ = this.posZ - (double)(var6 * 5.0F) + (double)((this.rand.nextFloat() - 0.5F) * 2.0F); + this.target = null; + + if (par2DamageSource.getEntity() instanceof EntityPlayer || par2DamageSource.isExplosion()) + { + this.func_82195_e(par2DamageSource, par3); + } + + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + return false; + } + + protected boolean func_82195_e(DamageSource par1DamageSource, float par2) + { + return super.attackEntityFrom(par1DamageSource, par2); + } + + /** + * handles entity death timer, experience orb and particle creation + */ + protected void onDeathUpdate() + { + ++this.deathTicks; + + if (this.deathTicks >= 180 && this.deathTicks <= 200) + { + float var1 = (this.rand.nextFloat() - 0.5F) * 8.0F; + float var2 = (this.rand.nextFloat() - 0.5F) * 4.0F; + float var3 = (this.rand.nextFloat() - 0.5F) * 8.0F; + this.worldObj.spawnParticle("hugeexplosion", this.posX + (double)var1, this.posY + 2.0D + (double)var2, this.posZ + (double)var3, 0.0D, 0.0D, 0.0D); + } + + int var4; + int var5; + + if (!this.worldObj.isRemote) + { + if (this.deathTicks > 150 && this.deathTicks % 5 == 0) + { + var4 = 1000; + + while (var4 > 0) + { + var5 = EntityXPOrb.getXPSplit(var4); + var4 -= var5; + this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var5)); + } + } + + if (this.deathTicks == 1) + { + this.worldObj.func_82739_e(1018, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + } + } + + this.moveEntity(0.0D, 0.10000000149011612D, 0.0D); + this.renderYawOffset = this.rotationYaw += 20.0F; + + if (this.deathTicks == 200 && !this.worldObj.isRemote) + { + var4 = 2000; + + while (var4 > 0) + { + var5 = EntityXPOrb.getXPSplit(var4); + var4 -= var5; + this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var5)); + } + + this.createEnderPortal(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posZ)); + this.setDead(); + } + } + + /** + * Creates the ender portal leading back to the normal world after defeating the enderdragon. + */ + private void createEnderPortal(int par1, int par2) + { + byte var3 = 64; + BlockEndPortal.bossDefeated = true; + byte var4 = 4; + + for (int var5 = var3 - 1; var5 <= var3 + 32; ++var5) + { + for (int var6 = par1 - var4; var6 <= par1 + var4; ++var6) + { + for (int var7 = par2 - var4; var7 <= par2 + var4; ++var7) + { + double var8 = (double)(var6 - par1); + double var10 = (double)(var7 - par2); + double var12 = var8 * var8 + var10 * var10; + + if (var12 <= ((double)var4 - 0.5D) * ((double)var4 - 0.5D)) + { + if (var5 < var3) + { + if (var12 <= ((double)(var4 - 1) - 0.5D) * ((double)(var4 - 1) - 0.5D)) + { + this.worldObj.setBlock(var6, var5, var7, Block.bedrock.blockID); + } + } + else if (var5 > var3) + { + this.worldObj.setBlock(var6, var5, var7, 0); + } + else if (var12 > ((double)(var4 - 1) - 0.5D) * ((double)(var4 - 1) - 0.5D)) + { + this.worldObj.setBlock(var6, var5, var7, Block.bedrock.blockID); + } + else + { + this.worldObj.setBlock(var6, var5, var7, Block.endPortal.blockID); + } + } + } + } + } + + this.worldObj.setBlock(par1, var3 + 0, par2, Block.bedrock.blockID); + this.worldObj.setBlock(par1, var3 + 1, par2, Block.bedrock.blockID); + this.worldObj.setBlock(par1, var3 + 2, par2, Block.bedrock.blockID); + this.worldObj.setBlock(par1 - 1, var3 + 2, par2, Block.torchWood.blockID); + this.worldObj.setBlock(par1 + 1, var3 + 2, par2, Block.torchWood.blockID); + this.worldObj.setBlock(par1, var3 + 2, par2 - 1, Block.torchWood.blockID); + this.worldObj.setBlock(par1, var3 + 2, par2 + 1, Block.torchWood.blockID); + this.worldObj.setBlock(par1, var3 + 3, par2, Block.bedrock.blockID); + this.worldObj.setBlock(par1, var3 + 4, par2, Block.dragonEgg.blockID); + BlockEndPortal.bossDefeated = false; + } + + /** + * Makes the entity despawn if requirements are reached + */ + protected void despawnEntity() {} + + /** + * Return the Entity parts making up this Entity (currently only for dragons) + */ + public Entity[] getParts() + { + return this.dragonPartArray; + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return false; + } + + public World func_82194_d() + { + return this.worldObj; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.enderdragon.growl"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.enderdragon.hit"; + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 5.0F; + } +} diff --git a/src/main/java/net/minecraft/src/EntityDragonPart.java b/src/main/java/net/minecraft/src/EntityDragonPart.java new file mode 100644 index 0000000..aefb853 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityDragonPart.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +public class EntityDragonPart extends Entity +{ + /** The dragon entity this dragon part belongs to */ + public final IEntityMultiPart entityDragonObj; + + /** The name of the Dragon Part */ + public final String name; + + public EntityDragonPart(IEntityMultiPart par1IEntityMultiPart, String par2Str, float par3, float par4) + { + super(par1IEntityMultiPart.func_82194_d()); + this.setSize(par3, par4); + this.entityDragonObj = par1IEntityMultiPart; + this.name = par2Str; + } + + protected void entityInit() {} + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {} + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {} + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + return this.isEntityInvulnerable() ? false : this.entityDragonObj.attackEntityFromPart(this, par1DamageSource, par2); + } + + /** + * Returns true if Entity argument is equal to this Entity + */ + public boolean isEntityEqual(Entity par1Entity) + { + return this == par1Entity || this.entityDragonObj == par1Entity; + } +} diff --git a/src/main/java/net/minecraft/src/EntityDropParticleFX.java b/src/main/java/net/minecraft/src/EntityDropParticleFX.java new file mode 100644 index 0000000..36dcff0 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityDropParticleFX.java @@ -0,0 +1,125 @@ +package net.minecraft.src; + +public class EntityDropParticleFX extends EntityFX +{ + /** the material type for dropped items/blocks */ + private Material materialType; + + /** The height of the current bob */ + private int bobTimer; + + public EntityDropParticleFX(World par1World, double par2, double par4, double par6, Material par8Material) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.motionX = this.motionY = this.motionZ = 0.0D; + + if (par8Material == Material.water) + { + this.particleRed = 0.0F; + this.particleGreen = 0.0F; + this.particleBlue = 1.0F; + } + else + { + this.particleRed = 1.0F; + this.particleGreen = 0.0F; + this.particleBlue = 0.0F; + } + + this.setParticleTextureIndex(113); + this.setSize(0.01F, 0.01F); + this.particleGravity = 0.06F; + this.materialType = par8Material; + this.bobTimer = 40; + this.particleMaxAge = (int)(64.0D / (Math.random() * 0.8D + 0.2D)); + this.motionX = this.motionY = this.motionZ = 0.0D; + } + + public int getBrightnessForRender(float par1) + { + return this.materialType == Material.water ? super.getBrightnessForRender(par1) : 257; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + return this.materialType == Material.water ? super.getBrightness(par1) : 1.0F; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.materialType == Material.water) + { + this.particleRed = 0.2F; + this.particleGreen = 0.3F; + this.particleBlue = 1.0F; + } + else + { + this.particleRed = 1.0F; + this.particleGreen = 16.0F / (float)(40 - this.bobTimer + 16); + this.particleBlue = 4.0F / (float)(40 - this.bobTimer + 8); + } + + this.motionY -= (double)this.particleGravity; + + if (this.bobTimer-- > 0) + { + this.motionX *= 0.02D; + this.motionY *= 0.02D; + this.motionZ *= 0.02D; + this.setParticleTextureIndex(113); + } + else + { + this.setParticleTextureIndex(112); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (this.particleMaxAge-- <= 0) + { + this.setDead(); + } + + if (this.onGround) + { + if (this.materialType == Material.water) + { + this.setDead(); + this.worldObj.spawnParticle("splash", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); + } + else + { + this.setParticleTextureIndex(114); + } + + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + + Material var1 = this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + + if (var1.isLiquid() || var1.isSolid()) + { + double var2 = (double)((float)(MathHelper.floor_double(this.posY) + 1) - BlockFluid.getFluidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)))); + + if (this.posY < var2) + { + this.setDead(); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityEgg.java b/src/main/java/net/minecraft/src/EntityEgg.java new file mode 100644 index 0000000..e86cf41 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityEgg.java @@ -0,0 +1,58 @@ +package net.minecraft.src; + +public class EntityEgg extends EntityThrowable +{ + public EntityEgg(World par1World) + { + super(par1World); + } + + public EntityEgg(World par1World, EntityLivingBase par2EntityLivingBase) + { + super(par1World, par2EntityLivingBase); + } + + public EntityEgg(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected void onImpact(MovingObjectPosition par1MovingObjectPosition) + { + if (par1MovingObjectPosition.entityHit != null) + { + par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F); + } + + if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0) + { + byte var2 = 1; + + if (this.rand.nextInt(32) == 0) + { + var2 = 4; + } + + for (int var3 = 0; var3 < var2; ++var3) + { + EntityChicken var4 = new EntityChicken(this.worldObj); + var4.setGrowingAge(-24000); + var4.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); + this.worldObj.spawnEntityInWorld(var4); + } + } + + for (int var5 = 0; var5 < 8; ++var5) + { + this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); + } + + if (!this.worldObj.isRemote) + { + this.setDead(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityEggInfo.java b/src/main/java/net/minecraft/src/EntityEggInfo.java new file mode 100644 index 0000000..05809f9 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityEggInfo.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +public class EntityEggInfo +{ + /** The entityID of the spawned mob */ + public int spawnedID; + + /** Base color of the egg */ + public int primaryColor; + + /** Color of the egg spots */ + public int secondaryColor; + + public EntityEggInfo(int par1, int par2, int par3) + { + this.spawnedID = par1; + this.primaryColor = par2; + this.secondaryColor = par3; + } +} diff --git a/src/main/java/net/minecraft/src/EntityEnchantmentTableParticleFX.java b/src/main/java/net/minecraft/src/EntityEnchantmentTableParticleFX.java new file mode 100644 index 0000000..2ea4e69 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityEnchantmentTableParticleFX.java @@ -0,0 +1,81 @@ +package net.minecraft.src; + +public class EntityEnchantmentTableParticleFX extends EntityFX +{ + private float field_70565_a; + private double field_70568_aq; + private double field_70567_ar; + private double field_70566_as; + + public EntityEnchantmentTableParticleFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, par8, par10, par12); + this.motionX = par8; + this.motionY = par10; + this.motionZ = par12; + this.field_70568_aq = this.posX = par2; + this.field_70567_ar = this.posY = par4; + this.field_70566_as = this.posZ = par6; + float var14 = this.rand.nextFloat() * 0.6F + 0.4F; + this.field_70565_a = this.particleScale = this.rand.nextFloat() * 0.5F + 0.2F; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F * var14; + this.particleGreen *= 0.9F; + this.particleRed *= 0.9F; + this.particleMaxAge = (int)(Math.random() * 10.0D) + 30; + this.noClip = true; + this.setParticleTextureIndex((int)(Math.random() * 26.0D + 1.0D + 224.0D)); + } + + public int getBrightnessForRender(float par1) + { + int var2 = super.getBrightnessForRender(par1); + float var3 = (float)this.particleAge / (float)this.particleMaxAge; + var3 *= var3; + var3 *= var3; + int var4 = var2 & 255; + int var5 = var2 >> 16 & 255; + var5 += (int)(var3 * 15.0F * 16.0F); + + if (var5 > 240) + { + var5 = 240; + } + + return var4 | var5 << 16; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + float var2 = super.getBrightness(par1); + float var3 = (float)this.particleAge / (float)this.particleMaxAge; + var3 *= var3; + var3 *= var3; + return var2 * (1.0F - var3) + var3; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + float var1 = (float)this.particleAge / (float)this.particleMaxAge; + var1 = 1.0F - var1; + float var2 = 1.0F - var1; + var2 *= var2; + var2 *= var2; + this.posX = this.field_70568_aq + this.motionX * (double)var1; + this.posY = this.field_70567_ar + this.motionY * (double)var1 - (double)(var2 * 1.2F); + this.posZ = this.field_70566_as + this.motionZ * (double)var1; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityEnderCrystal.java b/src/main/java/net/minecraft/src/EntityEnderCrystal.java new file mode 100644 index 0000000..639e831 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityEnderCrystal.java @@ -0,0 +1,111 @@ +package net.minecraft.src; + +public class EntityEnderCrystal extends Entity +{ + /** Used to create the rotation animation when rendering the crystal. */ + public int innerRotation; + public int health; + + public EntityEnderCrystal(World par1World) + { + super(par1World); + this.preventEntitySpawning = true; + this.setSize(2.0F, 2.0F); + this.yOffset = this.height / 2.0F; + this.health = 5; + this.innerRotation = this.rand.nextInt(100000); + } + + public EntityEnderCrystal(World par1World, double par2, double par4, double par6) + { + this(par1World); + this.setPosition(par2, par4, par6); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + protected void entityInit() + { + this.dataWatcher.addObject(8, Integer.valueOf(this.health)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + ++this.innerRotation; + this.dataWatcher.updateObject(8, Integer.valueOf(this.health)); + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.posY); + int var3 = MathHelper.floor_double(this.posZ); + + if (this.worldObj.getBlockId(var1, var2, var3) != Block.fire.blockID) + { + this.worldObj.setBlock(var1, var2, var3, Block.fire.blockID); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {} + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {} + + public float getShadowSize() + { + return 0.0F; + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return true; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + if (!this.isDead && !this.worldObj.isRemote) + { + this.health = 0; + + if (this.health <= 0) + { + this.setDead(); + + if (!this.worldObj.isRemote) + { + this.worldObj.createExplosion((Entity)null, this.posX, this.posY, this.posZ, 6.0F, true); + } + } + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityEnderEye.java b/src/main/java/net/minecraft/src/EntityEnderEye.java new file mode 100644 index 0000000..840206e --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityEnderEye.java @@ -0,0 +1,223 @@ +package net.minecraft.src; + +public class EntityEnderEye extends Entity +{ + /** 'x' location the eye should float towards. */ + private double targetX; + + /** 'y' location the eye should float towards. */ + private double targetY; + + /** 'z' location the eye should float towards. */ + private double targetZ; + private int despawnTimer; + private boolean shatterOrDrop; + + public EntityEnderEye(World par1World) + { + super(par1World); + this.setSize(0.25F, 0.25F); + } + + protected void entityInit() {} + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double par1) + { + double var3 = this.boundingBox.getAverageEdgeLength() * 4.0D; + var3 *= 64.0D; + return par1 < var3 * var3; + } + + public EntityEnderEye(World par1World, double par2, double par4, double par6) + { + super(par1World); + this.despawnTimer = 0; + this.setSize(0.25F, 0.25F); + this.setPosition(par2, par4, par6); + this.yOffset = 0.0F; + } + + /** + * The location the eye should float/move towards. Currently used for moving towards the nearest stronghold. Args: + * strongholdX, strongholdY, strongholdZ + */ + public void moveTowards(double par1, int par3, double par4) + { + double var6 = par1 - this.posX; + double var8 = par4 - this.posZ; + float var10 = MathHelper.sqrt_double(var6 * var6 + var8 * var8); + + if (var10 > 12.0F) + { + this.targetX = this.posX + var6 / (double)var10 * 12.0D; + this.targetZ = this.posZ + var8 / (double)var10 * 12.0D; + this.targetY = this.posY + 8.0D; + } + else + { + this.targetX = par1; + this.targetY = (double)par3; + this.targetZ = par4; + } + + this.despawnTimer = 0; + this.shatterOrDrop = this.rand.nextInt(5) > 0; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double par1, double par3, double par5) + { + this.motionX = par1; + this.motionY = par3; + this.motionZ = par5; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)var7) * 180.0D / Math.PI); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float var1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var1) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + + if (!this.worldObj.isRemote) + { + double var2 = this.targetX - this.posX; + double var4 = this.targetZ - this.posZ; + float var6 = (float)Math.sqrt(var2 * var2 + var4 * var4); + float var7 = (float)Math.atan2(var4, var2); + double var8 = (double)var1 + (double)(var6 - var1) * 0.0025D; + + if (var6 < 1.0F) + { + var8 *= 0.8D; + this.motionY *= 0.8D; + } + + this.motionX = Math.cos((double)var7) * var8; + this.motionZ = Math.sin((double)var7) * var8; + + if (this.posY < this.targetY) + { + this.motionY += (1.0D - this.motionY) * 0.014999999664723873D; + } + else + { + this.motionY += (-1.0D - this.motionY) * 0.014999999664723873D; + } + } + + float var10 = 0.25F; + + if (this.isInWater()) + { + for (int var3 = 0; var3 < 4; ++var3) + { + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)var10, this.posY - this.motionY * (double)var10, this.posZ - this.motionZ * (double)var10, this.motionX, this.motionY, this.motionZ); + } + } + else + { + this.worldObj.spawnParticle("portal", this.posX - this.motionX * (double)var10 + this.rand.nextDouble() * 0.6D - 0.3D, this.posY - this.motionY * (double)var10 - 0.5D, this.posZ - this.motionZ * (double)var10 + this.rand.nextDouble() * 0.6D - 0.3D, this.motionX, this.motionY, this.motionZ); + } + + if (!this.worldObj.isRemote) + { + this.setPosition(this.posX, this.posY, this.posZ); + ++this.despawnTimer; + + if (this.despawnTimer > 80 && !this.worldObj.isRemote) + { + this.setDead(); + + if (this.shatterOrDrop) + { + this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.eyeOfEnder))); + } + else + { + this.worldObj.playAuxSFX(2003, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), 0); + } + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {} + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {} + + public float getShadowSize() + { + return 0.0F; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + return 1.0F; + } + + public int getBrightnessForRender(float par1) + { + return 15728880; + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/EntityEnderPearl.java b/src/main/java/net/minecraft/src/EntityEnderPearl.java new file mode 100644 index 0000000..fe4082d --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityEnderPearl.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +public class EntityEnderPearl extends EntityThrowable +{ + public EntityEnderPearl(World par1World) + { + super(par1World); + } + + public EntityEnderPearl(World par1World, EntityLivingBase par2EntityLivingBase) + { + super(par1World, par2EntityLivingBase); + } + + public EntityEnderPearl(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected void onImpact(MovingObjectPosition par1MovingObjectPosition) + { + if (par1MovingObjectPosition.entityHit != null) + { + par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F); + } + + for (int var2 = 0; var2 < 32; ++var2) + { + this.worldObj.spawnParticle("portal", this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian()); + } + + if (!this.worldObj.isRemote) + { + if (this.getThrower() != null && this.getThrower() instanceof EntityPlayerMP) + { + EntityPlayerMP var3 = (EntityPlayerMP)this.getThrower(); + + if (!var3.playerNetServerHandler.connectionClosed && var3.worldObj == this.worldObj) + { + if (this.getThrower().isRiding()) + { + this.getThrower().mountEntity((Entity)null); + } + + this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ); + this.getThrower().fallDistance = 0.0F; + this.getThrower().attackEntityFrom(DamageSource.fall, 5.0F); + } + } + + this.setDead(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityEnderman.java b/src/main/java/net/minecraft/src/EntityEnderman.java new file mode 100644 index 0000000..c6eb932 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityEnderman.java @@ -0,0 +1,501 @@ +package net.minecraft.src; + +import java.util.UUID; + +public class EntityEnderman extends EntityMob +{ + private static final UUID attackingSpeedBoostModifierUUID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0"); + private static final AttributeModifier attackingSpeedBoostModifier = (new AttributeModifier(attackingSpeedBoostModifierUUID, "Attacking speed boost", 6.199999809265137D, 0)).setSaved(false); + private static boolean[] carriableBlocks = new boolean[256]; + + /** + * Counter to delay the teleportation of an enderman towards the currently attacked target + */ + private int teleportDelay; + + /** + * A player must stare at an enderman for 5 ticks before it becomes aggressive. This field counts those ticks. + */ + private int stareTimer; + private Entity lastEntityToAttack; + private boolean isAggressive; + + public EntityEnderman(World par1World) + { + super(par1World); + this.setSize(0.6F, 2.9F); + this.stepHeight = 1.0F; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(40.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.30000001192092896D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(7.0D); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + this.dataWatcher.addObject(17, new Byte((byte)0)); + this.dataWatcher.addObject(18, new Byte((byte)0)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setShort("carried", (short)this.getCarried()); + par1NBTTagCompound.setShort("carriedData", (short)this.getCarryingData()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.setCarried(par1NBTTagCompound.getShort("carried")); + this.setCarryingData(par1NBTTagCompound.getShort("carriedData")); + } + + /** + * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking + * (Animals, Spiders at day, peaceful PigZombies). + */ + protected Entity findPlayerToAttack() + { + EntityPlayer var1 = this.worldObj.getClosestVulnerablePlayerToEntity(this, 64.0D); + + if (var1 != null) + { + if (this.shouldAttackPlayer(var1)) + { + this.isAggressive = true; + + if (this.stareTimer == 0) + { + this.worldObj.playSoundAtEntity(var1, "mob.endermen.stare", 1.0F, 1.0F); + } + + if (this.stareTimer++ == 5) + { + this.stareTimer = 0; + this.setScreaming(true); + return var1; + } + } + else + { + this.stareTimer = 0; + } + } + + return null; + } + + /** + * Checks to see if this enderman should be attacking this player + */ + private boolean shouldAttackPlayer(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.armorInventory[3]; + + if (var2 != null && var2.itemID == Block.pumpkin.blockID) + { + return false; + } + else + { + Vec3 var3 = par1EntityPlayer.getLook(1.0F).normalize(); + Vec3 var4 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX - par1EntityPlayer.posX, this.boundingBox.minY + (double)(this.height / 2.0F) - (par1EntityPlayer.posY + (double)par1EntityPlayer.getEyeHeight()), this.posZ - par1EntityPlayer.posZ); + double var5 = var4.lengthVector(); + var4 = var4.normalize(); + double var7 = var3.dotProduct(var4); + return var7 > 1.0D - 0.025D / var5 ? par1EntityPlayer.canEntityBeSeen(this) : false; + } + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.isWet()) + { + this.attackEntityFrom(DamageSource.drown, 1.0F); + } + + if (this.lastEntityToAttack != this.entityToAttack) + { + AttributeInstance var1 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + var1.removeModifier(attackingSpeedBoostModifier); + + if (this.entityToAttack != null) + { + var1.applyModifier(attackingSpeedBoostModifier); + } + } + + this.lastEntityToAttack = this.entityToAttack; + int var6; + + if (!this.worldObj.isRemote && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) + { + int var2; + int var3; + int var4; + + if (this.getCarried() == 0) + { + if (this.rand.nextInt(20) == 0) + { + var6 = MathHelper.floor_double(this.posX - 2.0D + this.rand.nextDouble() * 4.0D); + var2 = MathHelper.floor_double(this.posY + this.rand.nextDouble() * 3.0D); + var3 = MathHelper.floor_double(this.posZ - 2.0D + this.rand.nextDouble() * 4.0D); + var4 = this.worldObj.getBlockId(var6, var2, var3); + + if (carriableBlocks[var4]) + { + this.setCarried(this.worldObj.getBlockId(var6, var2, var3)); + this.setCarryingData(this.worldObj.getBlockMetadata(var6, var2, var3)); + this.worldObj.setBlock(var6, var2, var3, 0); + } + } + } + else if (this.rand.nextInt(2000) == 0) + { + var6 = MathHelper.floor_double(this.posX - 1.0D + this.rand.nextDouble() * 2.0D); + var2 = MathHelper.floor_double(this.posY + this.rand.nextDouble() * 2.0D); + var3 = MathHelper.floor_double(this.posZ - 1.0D + this.rand.nextDouble() * 2.0D); + var4 = this.worldObj.getBlockId(var6, var2, var3); + int var5 = this.worldObj.getBlockId(var6, var2 - 1, var3); + + if (var4 == 0 && var5 > 0 && Block.blocksList[var5].renderAsNormalBlock()) + { + this.worldObj.setBlock(var6, var2, var3, this.getCarried(), this.getCarryingData(), 3); + this.setCarried(0); + } + } + } + + for (var6 = 0; var6 < 2; ++var6) + { + this.worldObj.spawnParticle("portal", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - 0.25D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(), (this.rand.nextDouble() - 0.5D) * 2.0D); + } + + if (this.worldObj.isDaytime() && !this.worldObj.isRemote) + { + float var7 = this.getBrightness(1.0F); + + if (var7 > 0.5F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) && this.rand.nextFloat() * 30.0F < (var7 - 0.4F) * 2.0F) + { + this.entityToAttack = null; + this.setScreaming(false); + this.isAggressive = false; + this.teleportRandomly(); + } + } + + if (this.isWet() || this.isBurning()) + { + this.entityToAttack = null; + this.setScreaming(false); + this.isAggressive = false; + this.teleportRandomly(); + } + + if (this.isScreaming() && !this.isAggressive && this.rand.nextInt(100) == 0) + { + this.setScreaming(false); + } + + this.isJumping = false; + + if (this.entityToAttack != null) + { + this.faceEntity(this.entityToAttack, 100.0F, 100.0F); + } + + if (!this.worldObj.isRemote && this.isEntityAlive()) + { + if (this.entityToAttack != null) + { + if (this.entityToAttack instanceof EntityPlayer && this.shouldAttackPlayer((EntityPlayer)this.entityToAttack)) + { + if (this.entityToAttack.getDistanceSqToEntity(this) < 16.0D) + { + this.teleportRandomly(); + } + + this.teleportDelay = 0; + } + else if (this.entityToAttack.getDistanceSqToEntity(this) > 256.0D && this.teleportDelay++ >= 30 && this.teleportToEntity(this.entityToAttack)) + { + this.teleportDelay = 0; + } + } + else + { + this.setScreaming(false); + this.teleportDelay = 0; + } + } + + super.onLivingUpdate(); + } + + /** + * Teleport the enderman to a random nearby position + */ + protected boolean teleportRandomly() + { + double var1 = this.posX + (this.rand.nextDouble() - 0.5D) * 64.0D; + double var3 = this.posY + (double)(this.rand.nextInt(64) - 32); + double var5 = this.posZ + (this.rand.nextDouble() - 0.5D) * 64.0D; + return this.teleportTo(var1, var3, var5); + } + + /** + * Teleport the enderman to another entity + */ + protected boolean teleportToEntity(Entity par1Entity) + { + Vec3 var2 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX - par1Entity.posX, this.boundingBox.minY + (double)(this.height / 2.0F) - par1Entity.posY + (double)par1Entity.getEyeHeight(), this.posZ - par1Entity.posZ); + var2 = var2.normalize(); + double var3 = 16.0D; + double var5 = this.posX + (this.rand.nextDouble() - 0.5D) * 8.0D - var2.xCoord * var3; + double var7 = this.posY + (double)(this.rand.nextInt(16) - 8) - var2.yCoord * var3; + double var9 = this.posZ + (this.rand.nextDouble() - 0.5D) * 8.0D - var2.zCoord * var3; + return this.teleportTo(var5, var7, var9); + } + + /** + * Teleport the enderman + */ + protected boolean teleportTo(double par1, double par3, double par5) + { + double var7 = this.posX; + double var9 = this.posY; + double var11 = this.posZ; + this.posX = par1; + this.posY = par3; + this.posZ = par5; + boolean var13 = false; + int var14 = MathHelper.floor_double(this.posX); + int var15 = MathHelper.floor_double(this.posY); + int var16 = MathHelper.floor_double(this.posZ); + int var18; + + if (this.worldObj.blockExists(var14, var15, var16)) + { + boolean var17 = false; + + while (!var17 && var15 > 0) + { + var18 = this.worldObj.getBlockId(var14, var15 - 1, var16); + + if (var18 != 0 && Block.blocksList[var18].blockMaterial.blocksMovement()) + { + var17 = true; + } + else + { + --this.posY; + --var15; + } + } + + if (var17) + { + this.setPosition(this.posX, this.posY, this.posZ); + + if (this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox)) + { + var13 = true; + } + } + } + + if (!var13) + { + this.setPosition(var7, var9, var11); + return false; + } + else + { + short var30 = 128; + + for (var18 = 0; var18 < var30; ++var18) + { + double var19 = (double)var18 / ((double)var30 - 1.0D); + float var21 = (this.rand.nextFloat() - 0.5F) * 0.2F; + float var22 = (this.rand.nextFloat() - 0.5F) * 0.2F; + float var23 = (this.rand.nextFloat() - 0.5F) * 0.2F; + double var24 = var7 + (this.posX - var7) * var19 + (this.rand.nextDouble() - 0.5D) * (double)this.width * 2.0D; + double var26 = var9 + (this.posY - var9) * var19 + this.rand.nextDouble() * (double)this.height; + double var28 = var11 + (this.posZ - var11) * var19 + (this.rand.nextDouble() - 0.5D) * (double)this.width * 2.0D; + this.worldObj.spawnParticle("portal", var24, var26, var28, (double)var21, (double)var22, (double)var23); + } + + this.worldObj.playSoundEffect(var7, var9, var11, "mob.endermen.portal", 1.0F, 1.0F); + this.playSound("mob.endermen.portal", 1.0F, 1.0F); + return true; + } + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return this.isScreaming() ? "mob.endermen.scream" : "mob.endermen.idle"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.endermen.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.endermen.death"; + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.enderPearl.itemID; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.getDropItemId(); + + if (var3 > 0) + { + int var4 = this.rand.nextInt(2 + par2); + + for (int var5 = 0; var5 < var4; ++var5) + { + this.dropItem(var3, 1); + } + } + } + + /** + * Set the id of the block an enderman carries + */ + public void setCarried(int par1) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(par1 & 255))); + } + + /** + * Get the id of the block an enderman carries + */ + public int getCarried() + { + return this.dataWatcher.getWatchableObjectByte(16); + } + + /** + * Set the metadata of the block an enderman carries + */ + public void setCarryingData(int par1) + { + this.dataWatcher.updateObject(17, Byte.valueOf((byte)(par1 & 255))); + } + + /** + * Get the metadata of the block an enderman carries + */ + public int getCarryingData() + { + return this.dataWatcher.getWatchableObjectByte(17); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + this.setScreaming(true); + + if (par1DamageSource instanceof EntityDamageSource && par1DamageSource.getEntity() instanceof EntityPlayer) + { + this.isAggressive = true; + } + + if (par1DamageSource instanceof EntityDamageSourceIndirect) + { + this.isAggressive = false; + + for (int var3 = 0; var3 < 64; ++var3) + { + if (this.teleportRandomly()) + { + return true; + } + } + + return false; + } + else + { + return super.attackEntityFrom(par1DamageSource, par2); + } + } + } + + public boolean isScreaming() + { + return this.dataWatcher.getWatchableObjectByte(18) > 0; + } + + public void setScreaming(boolean par1) + { + this.dataWatcher.updateObject(18, Byte.valueOf((byte)(par1 ? 1 : 0))); + } + + static + { + carriableBlocks[Block.grass.blockID] = true; + carriableBlocks[Block.dirt.blockID] = true; + carriableBlocks[Block.sand.blockID] = true; + carriableBlocks[Block.gravel.blockID] = true; + carriableBlocks[Block.plantYellow.blockID] = true; + carriableBlocks[Block.plantRed.blockID] = true; + carriableBlocks[Block.mushroomBrown.blockID] = true; + carriableBlocks[Block.mushroomRed.blockID] = true; + carriableBlocks[Block.tnt.blockID] = true; + carriableBlocks[Block.cactus.blockID] = true; + carriableBlocks[Block.blockClay.blockID] = true; + carriableBlocks[Block.pumpkin.blockID] = true; + carriableBlocks[Block.melon.blockID] = true; + carriableBlocks[Block.mycelium.blockID] = true; + } +} diff --git a/src/main/java/net/minecraft/src/EntityExpBottle.java b/src/main/java/net/minecraft/src/EntityExpBottle.java new file mode 100644 index 0000000..ab45848 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityExpBottle.java @@ -0,0 +1,58 @@ +package net.minecraft.src; + +public class EntityExpBottle extends EntityThrowable +{ + public EntityExpBottle(World par1World) + { + super(par1World); + } + + public EntityExpBottle(World par1World, EntityLivingBase par2EntityLivingBase) + { + super(par1World, par2EntityLivingBase); + } + + public EntityExpBottle(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + } + + /** + * Gets the amount of gravity to apply to the thrown entity with each tick. + */ + protected float getGravityVelocity() + { + return 0.07F; + } + + protected float func_70182_d() + { + return 0.7F; + } + + protected float func_70183_g() + { + return -20.0F; + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected void onImpact(MovingObjectPosition par1MovingObjectPosition) + { + if (!this.worldObj.isRemote) + { + this.worldObj.playAuxSFX(2002, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), 0); + int var2 = 3 + this.worldObj.rand.nextInt(5) + this.worldObj.rand.nextInt(5); + + while (var2 > 0) + { + int var3 = EntityXPOrb.getXPSplit(var2); + var2 -= var3; + this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var3)); + } + + this.setDead(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityExplodeFX.java b/src/main/java/net/minecraft/src/EntityExplodeFX.java new file mode 100644 index 0000000..7ae5ee1 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityExplodeFX.java @@ -0,0 +1,43 @@ +package net.minecraft.src; + +public class EntityExplodeFX extends EntityFX +{ + public EntityExplodeFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, par8, par10, par12); + this.motionX = par8 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F); + this.motionY = par10 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F); + this.motionZ = par12 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.05F); + this.particleRed = this.particleGreen = this.particleBlue = this.rand.nextFloat() * 0.3F + 0.7F; + this.particleScale = this.rand.nextFloat() * this.rand.nextFloat() * 6.0F + 1.0F; + this.particleMaxAge = (int)(16.0D / ((double)this.rand.nextFloat() * 0.8D + 0.2D)) + 2; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.motionY += 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.8999999761581421D; + this.motionY *= 0.8999999761581421D; + this.motionZ *= 0.8999999761581421D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityFX.java b/src/main/java/net/minecraft/src/EntityFX.java new file mode 100644 index 0000000..d67da2c --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityFX.java @@ -0,0 +1,242 @@ +package net.minecraft.src; + +public class EntityFX extends Entity +{ + protected int particleTextureIndexX; + protected int particleTextureIndexY; + protected float particleTextureJitterX; + protected float particleTextureJitterY; + protected int particleAge; + protected int particleMaxAge; + protected float particleScale; + protected float particleGravity; + + /** The red amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0. */ + protected float particleRed; + + /** + * The green amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0. + */ + protected float particleGreen; + + /** + * The blue amount of color. Used as a percentage, 1.0 = 255 and 0.0 = 0. + */ + protected float particleBlue; + + /** Particle alpha */ + protected float particleAlpha; + + /** The icon field from which the given particle pulls its texture. */ + protected Icon particleIcon; + public static double interpPosX; + public static double interpPosY; + public static double interpPosZ; + + protected EntityFX(World par1World, double par2, double par4, double par6) + { + super(par1World); + this.particleAlpha = 1.0F; + this.setSize(0.2F, 0.2F); + this.yOffset = this.height / 2.0F; + this.setPosition(par2, par4, par6); + this.lastTickPosX = par2; + this.lastTickPosY = par4; + this.lastTickPosZ = par6; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.particleTextureJitterX = this.rand.nextFloat() * 3.0F; + this.particleTextureJitterY = this.rand.nextFloat() * 3.0F; + this.particleScale = (this.rand.nextFloat() * 0.5F + 0.5F) * 2.0F; + this.particleMaxAge = (int)(4.0F / (this.rand.nextFloat() * 0.9F + 0.1F)); + this.particleAge = 0; + } + + public EntityFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + this(par1World, par2, par4, par6); + this.motionX = par8 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.4F); + this.motionY = par10 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.4F); + this.motionZ = par12 + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.4F); + float var14 = (float)(Math.random() + Math.random() + 1.0D) * 0.15F; + float var15 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.motionX = this.motionX / (double)var15 * (double)var14 * 0.4000000059604645D; + this.motionY = this.motionY / (double)var15 * (double)var14 * 0.4000000059604645D + 0.10000000149011612D; + this.motionZ = this.motionZ / (double)var15 * (double)var14 * 0.4000000059604645D; + } + + public EntityFX multiplyVelocity(float par1) + { + this.motionX *= (double)par1; + this.motionY = (this.motionY - 0.10000000149011612D) * (double)par1 + 0.10000000149011612D; + this.motionZ *= (double)par1; + return this; + } + + public EntityFX multipleParticleScaleBy(float par1) + { + this.setSize(0.2F * par1, 0.2F * par1); + this.particleScale *= par1; + return this; + } + + public void setRBGColorF(float par1, float par2, float par3) + { + this.particleRed = par1; + this.particleGreen = par2; + this.particleBlue = par3; + } + + /** + * Sets the particle alpha (float) + */ + public void setAlphaF(float par1) + { + this.particleAlpha = par1; + } + + public float getRedColorF() + { + return this.particleRed; + } + + public float getGreenColorF() + { + return this.particleGreen; + } + + public float getBlueColorF() + { + return this.particleBlue; + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + protected void entityInit() {} + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.motionY -= 0.04D * (double)this.particleGravity; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = (float)this.particleTextureIndexX / 16.0F; + float var9 = var8 + 0.0624375F; + float var10 = (float)this.particleTextureIndexY / 16.0F; + float var11 = var10 + 0.0624375F; + float var12 = 0.1F * this.particleScale; + + if (this.particleIcon != null) + { + var8 = this.particleIcon.getMinU(); + var9 = this.particleIcon.getMaxU(); + var10 = this.particleIcon.getMinV(); + var11 = this.particleIcon.getMaxV(); + } + + float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX); + float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY); + float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ); + float var16 = 1.0F; + par1Tessellator.setColorRGBA_F(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, this.particleAlpha); + par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var9, (double)var11); + par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var9, (double)var10); + par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var8, (double)var10); + par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var8, (double)var11); + } + + public int getFXLayer() + { + return 0; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {} + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {} + + public void setParticleIcon(Icon par1Icon) + { + if (this.getFXLayer() == 1) + { + this.particleIcon = par1Icon; + } + else + { + if (this.getFXLayer() != 2) + { + throw new RuntimeException("Invalid call to Particle.setTex, use coordinate methods"); + } + + this.particleIcon = par1Icon; + } + } + + /** + * Public method to set private field particleTextureIndex. + */ + public void setParticleTextureIndex(int par1) + { + if (this.getFXLayer() != 0) + { + throw new RuntimeException("Invalid call to Particle.setMiscTex"); + } + else + { + this.particleTextureIndexX = par1 % 16; + this.particleTextureIndexY = par1 / 16; + } + } + + public void nextTextureIndexX() + { + ++this.particleTextureIndexX; + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } + + public String toString() + { + return this.getClass().getSimpleName() + ", Pos (" + this.posX + "," + this.posY + "," + this.posZ + "), RGBA (" + this.particleRed + "," + this.particleGreen + "," + this.particleBlue + "," + this.particleAlpha + "), Age " + this.particleAge; + } +} diff --git a/src/main/java/net/minecraft/src/EntityFallingSand.java b/src/main/java/net/minecraft/src/EntityFallingSand.java new file mode 100644 index 0000000..2f7c752 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityFallingSand.java @@ -0,0 +1,308 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; + +public class EntityFallingSand extends Entity +{ + public int blockID; + public int metadata; + + /** How long the block has been falling for. */ + public int fallTime; + public boolean shouldDropItem; + private boolean isBreakingAnvil; + private boolean isAnvil; + + /** Maximum amount of damage dealt to entities hit by falling block */ + private int fallHurtMax; + + /** Actual damage dealt to entities hit by falling block */ + private float fallHurtAmount; + public NBTTagCompound fallingBlockTileEntityData; + + public EntityFallingSand(World par1World) + { + super(par1World); + this.shouldDropItem = true; + this.fallHurtMax = 40; + this.fallHurtAmount = 2.0F; + } + + public EntityFallingSand(World par1World, double par2, double par4, double par6, int par8) + { + this(par1World, par2, par4, par6, par8, 0); + } + + public EntityFallingSand(World par1World, double par2, double par4, double par6, int par8, int par9) + { + super(par1World); + this.shouldDropItem = true; + this.fallHurtMax = 40; + this.fallHurtAmount = 2.0F; + this.blockID = par8; + this.metadata = par9; + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.98F); + this.yOffset = this.height / 2.0F; + this.setPosition(par2, par4, par6); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevPosX = par2; + this.prevPosY = par4; + this.prevPosZ = par6; + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + protected void entityInit() {} + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return !this.isDead; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (this.blockID == 0) + { + this.setDead(); + } + else + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + ++this.fallTime; + this.motionY -= 0.03999999910593033D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (!this.worldObj.isRemote) + { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.posY); + int var3 = MathHelper.floor_double(this.posZ); + + if (this.fallTime == 1) + { + if (this.worldObj.getBlockId(var1, var2, var3) != this.blockID) + { + this.setDead(); + return; + } + + this.worldObj.setBlockToAir(var1, var2, var3); + } + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + this.motionY *= -0.5D; + + if (this.worldObj.getBlockId(var1, var2, var3) != Block.pistonMoving.blockID) + { + this.setDead(); + + if (!this.isBreakingAnvil && this.worldObj.canPlaceEntityOnSide(this.blockID, var1, var2, var3, true, 1, (Entity)null, (ItemStack)null) && !BlockSand.canFallBelow(this.worldObj, var1, var2 - 1, var3) && this.worldObj.setBlock(var1, var2, var3, this.blockID, this.metadata, 3)) + { + if (Block.blocksList[this.blockID] instanceof BlockSand) + { + ((BlockSand)Block.blocksList[this.blockID]).onFinishFalling(this.worldObj, var1, var2, var3, this.metadata); + } + + if (this.fallingBlockTileEntityData != null && Block.blocksList[this.blockID] instanceof ITileEntityProvider) + { + TileEntity var4 = this.worldObj.getBlockTileEntity(var1, var2, var3); + + if (var4 != null) + { + NBTTagCompound var5 = new NBTTagCompound(); + var4.writeToNBT(var5); + Iterator var6 = this.fallingBlockTileEntityData.getTags().iterator(); + + while (var6.hasNext()) + { + NBTBase var7 = (NBTBase)var6.next(); + + if (!var7.getName().equals("x") && !var7.getName().equals("y") && !var7.getName().equals("z")) + { + var5.setTag(var7.getName(), var7.copy()); + } + } + + var4.readFromNBT(var5); + var4.onInventoryChanged(); + } + } + } + else if (this.shouldDropItem && !this.isBreakingAnvil) + { + this.entityDropItem(new ItemStack(this.blockID, 1, Block.blocksList[this.blockID].damageDropped(this.metadata)), 0.0F); + } + } + } + else if (this.fallTime > 100 && !this.worldObj.isRemote && (var2 < 1 || var2 > 256) || this.fallTime > 600) + { + if (this.shouldDropItem) + { + this.entityDropItem(new ItemStack(this.blockID, 1, Block.blocksList[this.blockID].damageDropped(this.metadata)), 0.0F); + } + + this.setDead(); + } + } + } + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) + { + if (this.isAnvil) + { + int var2 = MathHelper.ceiling_float_int(par1 - 1.0F); + + if (var2 > 0) + { + ArrayList var3 = new ArrayList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox)); + DamageSource var4 = this.blockID == Block.anvil.blockID ? DamageSource.anvil : DamageSource.fallingBlock; + Iterator var5 = var3.iterator(); + + while (var5.hasNext()) + { + Entity var6 = (Entity)var5.next(); + var6.attackEntityFrom(var4, (float)Math.min(MathHelper.floor_float((float)var2 * this.fallHurtAmount), this.fallHurtMax)); + } + + if (this.blockID == Block.anvil.blockID && (double)this.rand.nextFloat() < 0.05000000074505806D + (double)var2 * 0.05D) + { + int var7 = this.metadata >> 2; + int var8 = this.metadata & 3; + ++var7; + + if (var7 > 2) + { + this.isBreakingAnvil = true; + } + else + { + this.metadata = var8 | var7 << 2; + } + } + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setByte("Tile", (byte)this.blockID); + par1NBTTagCompound.setInteger("TileID", this.blockID); + par1NBTTagCompound.setByte("Data", (byte)this.metadata); + par1NBTTagCompound.setByte("Time", (byte)this.fallTime); + par1NBTTagCompound.setBoolean("DropItem", this.shouldDropItem); + par1NBTTagCompound.setBoolean("HurtEntities", this.isAnvil); + par1NBTTagCompound.setFloat("FallHurtAmount", this.fallHurtAmount); + par1NBTTagCompound.setInteger("FallHurtMax", this.fallHurtMax); + + if (this.fallingBlockTileEntityData != null) + { + par1NBTTagCompound.setCompoundTag("TileEntityData", this.fallingBlockTileEntityData); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + if (par1NBTTagCompound.hasKey("TileID")) + { + this.blockID = par1NBTTagCompound.getInteger("TileID"); + } + else + { + this.blockID = par1NBTTagCompound.getByte("Tile") & 255; + } + + this.metadata = par1NBTTagCompound.getByte("Data") & 255; + this.fallTime = par1NBTTagCompound.getByte("Time") & 255; + + if (par1NBTTagCompound.hasKey("HurtEntities")) + { + this.isAnvil = par1NBTTagCompound.getBoolean("HurtEntities"); + this.fallHurtAmount = par1NBTTagCompound.getFloat("FallHurtAmount"); + this.fallHurtMax = par1NBTTagCompound.getInteger("FallHurtMax"); + } + else if (this.blockID == Block.anvil.blockID) + { + this.isAnvil = true; + } + + if (par1NBTTagCompound.hasKey("DropItem")) + { + this.shouldDropItem = par1NBTTagCompound.getBoolean("DropItem"); + } + + if (par1NBTTagCompound.hasKey("TileEntityData")) + { + this.fallingBlockTileEntityData = par1NBTTagCompound.getCompoundTag("TileEntityData"); + } + + if (this.blockID == 0) + { + this.blockID = Block.sand.blockID; + } + } + + public float getShadowSize() + { + return 0.0F; + } + + public World getWorld() + { + return this.worldObj; + } + + public void setIsAnvil(boolean par1) + { + this.isAnvil = par1; + } + + /** + * Return whether this entity should be rendered as on fire. + */ + public boolean canRenderOnFire() + { + return false; + } + + public void addEntityCrashInfo(CrashReportCategory par1CrashReportCategory) + { + super.addEntityCrashInfo(par1CrashReportCategory); + par1CrashReportCategory.addCrashSection("Immitating block ID", Integer.valueOf(this.blockID)); + par1CrashReportCategory.addCrashSection("Immitating block data", Integer.valueOf(this.metadata)); + } +} diff --git a/src/main/java/net/minecraft/src/EntityFireball.java b/src/main/java/net/minecraft/src/EntityFireball.java new file mode 100644 index 0000000..ce5932f --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityFireball.java @@ -0,0 +1,331 @@ +package net.minecraft.src; + +import java.util.List; + +public abstract class EntityFireball extends Entity +{ + private int xTile = -1; + private int yTile = -1; + private int zTile = -1; + private int inTile; + private boolean inGround; + public EntityLivingBase shootingEntity; + private int ticksAlive; + private int ticksInAir; + public double accelerationX; + public double accelerationY; + public double accelerationZ; + + public EntityFireball(World par1World) + { + super(par1World); + this.setSize(1.0F, 1.0F); + } + + protected void entityInit() {} + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double par1) + { + double var3 = this.boundingBox.getAverageEdgeLength() * 4.0D; + var3 *= 64.0D; + return par1 < var3 * var3; + } + + public EntityFireball(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World); + this.setSize(1.0F, 1.0F); + this.setLocationAndAngles(par2, par4, par6, this.rotationYaw, this.rotationPitch); + this.setPosition(par2, par4, par6); + double var14 = (double)MathHelper.sqrt_double(par8 * par8 + par10 * par10 + par12 * par12); + this.accelerationX = par8 / var14 * 0.1D; + this.accelerationY = par10 / var14 * 0.1D; + this.accelerationZ = par12 / var14 * 0.1D; + } + + public EntityFireball(World par1World, EntityLivingBase par2EntityLivingBase, double par3, double par5, double par7) + { + super(par1World); + this.shootingEntity = par2EntityLivingBase; + this.setSize(1.0F, 1.0F); + this.setLocationAndAngles(par2EntityLivingBase.posX, par2EntityLivingBase.posY, par2EntityLivingBase.posZ, par2EntityLivingBase.rotationYaw, par2EntityLivingBase.rotationPitch); + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + this.motionX = this.motionY = this.motionZ = 0.0D; + par3 += this.rand.nextGaussian() * 0.4D; + par5 += this.rand.nextGaussian() * 0.4D; + par7 += this.rand.nextGaussian() * 0.4D; + double var9 = (double)MathHelper.sqrt_double(par3 * par3 + par5 * par5 + par7 * par7); + this.accelerationX = par3 / var9 * 0.1D; + this.accelerationY = par5 / var9 * 0.1D; + this.accelerationZ = par7 / var9 * 0.1D; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (!this.worldObj.isRemote && (this.shootingEntity != null && this.shootingEntity.isDead || !this.worldObj.blockExists((int)this.posX, (int)this.posY, (int)this.posZ))) + { + this.setDead(); + } + else + { + super.onUpdate(); + this.setFire(1); + + if (this.inGround) + { + int var1 = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + + if (var1 == this.inTile) + { + ++this.ticksAlive; + + if (this.ticksAlive == 600) + { + this.setDead(); + } + + return; + } + + this.inGround = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksAlive = 0; + this.ticksInAir = 0; + } + else + { + ++this.ticksInAir; + } + + Vec3 var15 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); + Vec3 var2 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition var3 = this.worldObj.clip(var15, var2); + var15 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); + var2 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (var3 != null) + { + var2 = this.worldObj.getWorldVec3Pool().getVecFromPool(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord); + } + + Entity var4 = null; + List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double var6 = 0.0D; + + for (int var8 = 0; var8 < var5.size(); ++var8) + { + Entity var9 = (Entity)var5.get(var8); + + if (var9.canBeCollidedWith() && (!var9.isEntityEqual(this.shootingEntity) || this.ticksInAir >= 25)) + { + float var10 = 0.3F; + AxisAlignedBB var11 = var9.boundingBox.expand((double)var10, (double)var10, (double)var10); + MovingObjectPosition var12 = var11.calculateIntercept(var15, var2); + + if (var12 != null) + { + double var13 = var15.distanceTo(var12.hitVec); + + if (var13 < var6 || var6 == 0.0D) + { + var4 = var9; + var6 = var13; + } + } + } + } + + if (var4 != null) + { + var3 = new MovingObjectPosition(var4); + } + + if (var3 != null) + { + this.onImpact(var3); + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float var16 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionZ, this.motionX) * 180.0D / Math.PI) + 90.0F; + + for (this.rotationPitch = (float)(Math.atan2((double)var16, this.motionY) * 180.0D / Math.PI) - 90.0F; this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float var17 = this.getMotionFactor(); + + if (this.isInWater()) + { + for (int var18 = 0; var18 < 4; ++var18) + { + float var19 = 0.25F; + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)var19, this.posY - this.motionY * (double)var19, this.posZ - this.motionZ * (double)var19, this.motionX, this.motionY, this.motionZ); + } + + var17 = 0.8F; + } + + this.motionX += this.accelerationX; + this.motionY += this.accelerationY; + this.motionZ += this.accelerationZ; + this.motionX *= (double)var17; + this.motionY *= (double)var17; + this.motionZ *= (double)var17; + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + this.setPosition(this.posX, this.posY, this.posZ); + } + } + + /** + * Return the motion factor for this projectile. The factor is multiplied by the original motion. + */ + protected float getMotionFactor() + { + return 0.95F; + } + + /** + * Called when this EntityFireball hits a block or entity. + */ + protected abstract void onImpact(MovingObjectPosition var1); + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setShort("xTile", (short)this.xTile); + par1NBTTagCompound.setShort("yTile", (short)this.yTile); + par1NBTTagCompound.setShort("zTile", (short)this.zTile); + par1NBTTagCompound.setByte("inTile", (byte)this.inTile); + par1NBTTagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + par1NBTTagCompound.setTag("direction", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ})); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.xTile = par1NBTTagCompound.getShort("xTile"); + this.yTile = par1NBTTagCompound.getShort("yTile"); + this.zTile = par1NBTTagCompound.getShort("zTile"); + this.inTile = par1NBTTagCompound.getByte("inTile") & 255; + this.inGround = par1NBTTagCompound.getByte("inGround") == 1; + + if (par1NBTTagCompound.hasKey("direction")) + { + NBTTagList var2 = par1NBTTagCompound.getTagList("direction"); + this.motionX = ((NBTTagDouble)var2.tagAt(0)).data; + this.motionY = ((NBTTagDouble)var2.tagAt(1)).data; + this.motionZ = ((NBTTagDouble)var2.tagAt(2)).data; + } + else + { + this.setDead(); + } + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return true; + } + + public float getCollisionBorderSize() + { + return 1.0F; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + this.setBeenAttacked(); + + if (par1DamageSource.getEntity() != null) + { + Vec3 var3 = par1DamageSource.getEntity().getLookVec(); + + if (var3 != null) + { + this.motionX = var3.xCoord; + this.motionY = var3.yCoord; + this.motionZ = var3.zCoord; + this.accelerationX = this.motionX * 0.1D; + this.accelerationY = this.motionY * 0.1D; + this.accelerationZ = this.motionZ * 0.1D; + } + + if (par1DamageSource.getEntity() instanceof EntityLivingBase) + { + this.shootingEntity = (EntityLivingBase)par1DamageSource.getEntity(); + } + + return true; + } + else + { + return false; + } + } + } + + public float getShadowSize() + { + return 0.0F; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + return 1.0F; + } + + public int getBrightnessForRender(float par1) + { + return 15728880; + } +} diff --git a/src/main/java/net/minecraft/src/EntityFireworkOverlayFX.java b/src/main/java/net/minecraft/src/EntityFireworkOverlayFX.java new file mode 100644 index 0000000..431397c --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityFireworkOverlayFX.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +public class EntityFireworkOverlayFX extends EntityFX +{ + protected EntityFireworkOverlayFX(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + this.particleMaxAge = 4; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = 0.25F; + float var9 = var8 + 0.25F; + float var10 = 0.125F; + float var11 = var10 + 0.25F; + float var12 = 7.1F * MathHelper.sin(((float)this.particleAge + par2 - 1.0F) * 0.25F * (float)Math.PI); + this.particleAlpha = 0.6F - ((float)this.particleAge + par2 - 1.0F) * 0.25F * 0.5F; + float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX); + float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY); + float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ); + par1Tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); + par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var9, (double)var11); + par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var9, (double)var10); + par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var8, (double)var10); + par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var8, (double)var11); + } +} diff --git a/src/main/java/net/minecraft/src/EntityFireworkRocket.java b/src/main/java/net/minecraft/src/EntityFireworkRocket.java new file mode 100644 index 0000000..6f84fb4 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityFireworkRocket.java @@ -0,0 +1,215 @@ +package net.minecraft.src; + +public class EntityFireworkRocket extends Entity +{ + /** The age of the firework in ticks. */ + private int fireworkAge; + + /** + * The lifetime of the firework in ticks. When the age reaches the lifetime the firework explodes. + */ + private int lifetime; + + public EntityFireworkRocket(World par1World) + { + super(par1World); + this.setSize(0.25F, 0.25F); + } + + protected void entityInit() + { + this.dataWatcher.addObjectByDataType(8, 5); + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double par1) + { + return par1 < 4096.0D; + } + + public EntityFireworkRocket(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) + { + super(par1World); + this.fireworkAge = 0; + this.setSize(0.25F, 0.25F); + this.setPosition(par2, par4, par6); + this.yOffset = 0.0F; + int var9 = 1; + + if (par8ItemStack != null && par8ItemStack.hasTagCompound()) + { + this.dataWatcher.updateObject(8, par8ItemStack); + NBTTagCompound var10 = par8ItemStack.getTagCompound(); + NBTTagCompound var11 = var10.getCompoundTag("Fireworks"); + + if (var11 != null) + { + var9 += var11.getByte("Flight"); + } + } + + this.motionX = this.rand.nextGaussian() * 0.001D; + this.motionZ = this.rand.nextGaussian() * 0.001D; + this.motionY = 0.05D; + this.lifetime = 10 * var9 + this.rand.nextInt(6) + this.rand.nextInt(7); + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double par1, double par3, double par5) + { + this.motionX = par1; + this.motionY = par3; + this.motionZ = par5; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)var7) * 180.0D / Math.PI); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); + this.motionX *= 1.15D; + this.motionZ *= 1.15D; + this.motionY += 0.04D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + float var1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var1) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + + if (this.fireworkAge == 0) + { + this.worldObj.playSoundAtEntity(this, "fireworks.launch", 3.0F, 1.0F); + } + + ++this.fireworkAge; + + if (this.worldObj.isRemote && this.fireworkAge % 2 < 2) + { + this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY - 0.3D, this.posZ, this.rand.nextGaussian() * 0.05D, -this.motionY * 0.5D, this.rand.nextGaussian() * 0.05D); + } + + if (!this.worldObj.isRemote && this.fireworkAge > this.lifetime) + { + this.worldObj.setEntityState(this, (byte)17); + this.setDead(); + } + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 17 && this.worldObj.isRemote) + { + ItemStack var2 = this.dataWatcher.getWatchableObjectItemStack(8); + NBTTagCompound var3 = null; + + if (var2 != null && var2.hasTagCompound()) + { + var3 = var2.getTagCompound().getCompoundTag("Fireworks"); + } + + this.worldObj.func_92088_a(this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, var3); + } + + super.handleHealthUpdate(par1); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setInteger("Life", this.fireworkAge); + par1NBTTagCompound.setInteger("LifeTime", this.lifetime); + ItemStack var2 = this.dataWatcher.getWatchableObjectItemStack(8); + + if (var2 != null) + { + NBTTagCompound var3 = new NBTTagCompound(); + var2.writeToNBT(var3); + par1NBTTagCompound.setCompoundTag("FireworksItem", var3); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.fireworkAge = par1NBTTagCompound.getInteger("Life"); + this.lifetime = par1NBTTagCompound.getInteger("LifeTime"); + NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("FireworksItem"); + + if (var2 != null) + { + ItemStack var3 = ItemStack.loadItemStackFromNBT(var2); + + if (var3 != null) + { + this.dataWatcher.updateObject(8, var3); + } + } + } + + public float getShadowSize() + { + return 0.0F; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + return super.getBrightness(par1); + } + + public int getBrightnessForRender(float par1) + { + return super.getBrightnessForRender(par1); + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/EntityFireworkSparkFX.java b/src/main/java/net/minecraft/src/EntityFireworkSparkFX.java new file mode 100644 index 0000000..086ec1f --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityFireworkSparkFX.java @@ -0,0 +1,147 @@ +package net.minecraft.src; + +public class EntityFireworkSparkFX extends EntityFX +{ + private int baseTextureIndex = 160; + private boolean field_92054_ax; + private boolean field_92048_ay; + private final EffectRenderer field_92047_az; + private float fadeColourRed; + private float fadeColourGreen; + private float fadeColourBlue; + private boolean hasFadeColour; + + public EntityFireworkSparkFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, EffectRenderer par14EffectRenderer) + { + super(par1World, par2, par4, par6); + this.motionX = par8; + this.motionY = par10; + this.motionZ = par12; + this.field_92047_az = par14EffectRenderer; + this.particleScale *= 0.75F; + this.particleMaxAge = 48 + this.rand.nextInt(12); + this.noClip = false; + } + + public void setTrail(boolean par1) + { + this.field_92054_ax = par1; + } + + public void setTwinkle(boolean par1) + { + this.field_92048_ay = par1; + } + + public void setColour(int par1) + { + float var2 = (float)((par1 & 16711680) >> 16) / 255.0F; + float var3 = (float)((par1 & 65280) >> 8) / 255.0F; + float var4 = (float)((par1 & 255) >> 0) / 255.0F; + float var5 = 1.0F; + this.setRBGColorF(var2 * var5, var3 * var5, var4 * var5); + } + + public void setFadeColour(int par1) + { + this.fadeColourRed = (float)((par1 & 16711680) >> 16) / 255.0F; + this.fadeColourGreen = (float)((par1 & 65280) >> 8) / 255.0F; + this.fadeColourBlue = (float)((par1 & 255) >> 0) / 255.0F; + this.hasFadeColour = true; + } + + /** + * returns the bounding box for this entity + */ + public AxisAlignedBB getBoundingBox() + { + return null; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return false; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + if (!this.field_92048_ay || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0) + { + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + if (this.particleAge > this.particleMaxAge / 2) + { + this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge); + + if (this.hasFadeColour) + { + this.particleRed += (this.fadeColourRed - this.particleRed) * 0.2F; + this.particleGreen += (this.fadeColourGreen - this.particleGreen) * 0.2F; + this.particleBlue += (this.fadeColourBlue - this.particleBlue) * 0.2F; + } + } + + this.setParticleTextureIndex(this.baseTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge)); + this.motionY -= 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9100000262260437D; + this.motionY *= 0.9100000262260437D; + this.motionZ *= 0.9100000262260437D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + + if (this.field_92054_ax && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0) + { + EntityFireworkSparkFX var1 = new EntityFireworkSparkFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, this.field_92047_az); + var1.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue); + var1.particleAge = var1.particleMaxAge / 2; + + if (this.hasFadeColour) + { + var1.hasFadeColour = true; + var1.fadeColourRed = this.fadeColourRed; + var1.fadeColourGreen = this.fadeColourGreen; + var1.fadeColourBlue = this.fadeColourBlue; + } + + var1.field_92048_ay = this.field_92048_ay; + this.field_92047_az.addEffect(var1); + } + } + + public int getBrightnessForRender(float par1) + { + return 15728880; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + return 1.0F; + } +} diff --git a/src/main/java/net/minecraft/src/EntityFireworkStarterFX.java b/src/main/java/net/minecraft/src/EntityFireworkStarterFX.java new file mode 100644 index 0000000..eec8b07 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityFireworkStarterFX.java @@ -0,0 +1,257 @@ +package net.minecraft.src; + +public class EntityFireworkStarterFX extends EntityFX +{ + private int fireworkAge; + private final EffectRenderer theEffectRenderer; + private NBTTagList fireworkExplosions; + boolean twinkle; + + public EntityFireworkStarterFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, EffectRenderer par14EffectRenderer, NBTTagCompound par15NBTTagCompound) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.motionX = par8; + this.motionY = par10; + this.motionZ = par12; + this.theEffectRenderer = par14EffectRenderer; + this.particleMaxAge = 8; + + if (par15NBTTagCompound != null) + { + this.fireworkExplosions = par15NBTTagCompound.getTagList("Explosions"); + + if (this.fireworkExplosions.tagCount() == 0) + { + this.fireworkExplosions = null; + } + else + { + this.particleMaxAge = this.fireworkExplosions.tagCount() * 2 - 1; + + for (int var16 = 0; var16 < this.fireworkExplosions.tagCount(); ++var16) + { + NBTTagCompound var17 = (NBTTagCompound)this.fireworkExplosions.tagAt(var16); + + if (var17.getBoolean("Flicker")) + { + this.twinkle = true; + this.particleMaxAge += 15; + break; + } + } + } + } + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {} + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + boolean var1; + + if (this.fireworkAge == 0 && this.fireworkExplosions != null) + { + var1 = this.func_92037_i(); + boolean var2 = false; + + if (this.fireworkExplosions.tagCount() >= 3) + { + var2 = true; + } + else + { + for (int var3 = 0; var3 < this.fireworkExplosions.tagCount(); ++var3) + { + NBTTagCompound var4 = (NBTTagCompound)this.fireworkExplosions.tagAt(var3); + + if (var4.getByte("Type") == 1) + { + var2 = true; + break; + } + } + } + + String var15 = "fireworks." + (var2 ? "largeBlast" : "blast") + (var1 ? "_far" : ""); + this.worldObj.playSound(this.posX, this.posY, this.posZ, var15, 20.0F, 0.95F + this.rand.nextFloat() * 0.1F, true); + } + + if (this.fireworkAge % 2 == 0 && this.fireworkExplosions != null && this.fireworkAge / 2 < this.fireworkExplosions.tagCount()) + { + int var13 = this.fireworkAge / 2; + NBTTagCompound var14 = (NBTTagCompound)this.fireworkExplosions.tagAt(var13); + byte var17 = var14.getByte("Type"); + boolean var18 = var14.getBoolean("Trail"); + boolean var5 = var14.getBoolean("Flicker"); + int[] var6 = var14.getIntArray("Colors"); + int[] var7 = var14.getIntArray("FadeColors"); + + if (var17 == 1) + { + this.createBall(0.5D, 4, var6, var7, var18, var5); + } + else if (var17 == 2) + { + this.createShaped(0.5D, new double[][] {{0.0D, 1.0D}, {0.3455D, 0.309D}, {0.9511D, 0.309D}, {0.3795918367346939D, -0.12653061224489795D}, {0.6122448979591837D, -0.8040816326530612D}, {0.0D, -0.35918367346938773D}}, var6, var7, var18, var5, false); + } + else if (var17 == 3) + { + this.createShaped(0.5D, new double[][] {{0.0D, 0.2D}, {0.2D, 0.2D}, {0.2D, 0.6D}, {0.6D, 0.6D}, {0.6D, 0.2D}, {0.2D, 0.2D}, {0.2D, 0.0D}, {0.4D, 0.0D}, {0.4D, -0.6D}, {0.2D, -0.6D}, {0.2D, -0.4D}, {0.0D, -0.4D}}, var6, var7, var18, var5, true); + } + else if (var17 == 4) + { + this.createBurst(var6, var7, var18, var5); + } + else + { + this.createBall(0.25D, 2, var6, var7, var18, var5); + } + + int var8 = var6[0]; + float var9 = (float)((var8 & 16711680) >> 16) / 255.0F; + float var10 = (float)((var8 & 65280) >> 8) / 255.0F; + float var11 = (float)((var8 & 255) >> 0) / 255.0F; + EntityFireworkOverlayFX var12 = new EntityFireworkOverlayFX(this.worldObj, this.posX, this.posY, this.posZ); + var12.setRBGColorF(var9, var10, var11); + this.theEffectRenderer.addEffect(var12); + } + + ++this.fireworkAge; + + if (this.fireworkAge > this.particleMaxAge) + { + if (this.twinkle) + { + var1 = this.func_92037_i(); + String var16 = "fireworks." + (var1 ? "twinkle_far" : "twinkle"); + this.worldObj.playSound(this.posX, this.posY, this.posZ, var16, 20.0F, 0.9F + this.rand.nextFloat() * 0.15F, true); + } + + this.setDead(); + } + } + + private boolean func_92037_i() + { + Minecraft var1 = Minecraft.getMinecraft(); + return var1 == null || var1.renderViewEntity == null || var1.renderViewEntity.getDistanceSq(this.posX, this.posY, this.posZ) >= 256.0D; + } + + /** + * Creates a single particle. Args: x, y, z, x velocity, y velocity, z velocity, colours, fade colours, whether to + * trail, whether to twinkle + */ + private void createParticle(double par1, double par3, double par5, double par7, double par9, double par11, int[] par13ArrayOfInteger, int[] par14ArrayOfInteger, boolean par15, boolean par16) + { + EntityFireworkSparkFX var17 = new EntityFireworkSparkFX(this.worldObj, par1, par3, par5, par7, par9, par11, this.theEffectRenderer); + var17.setTrail(par15); + var17.setTwinkle(par16); + int var18 = this.rand.nextInt(par13ArrayOfInteger.length); + var17.setColour(par13ArrayOfInteger[var18]); + + if (par14ArrayOfInteger != null && par14ArrayOfInteger.length > 0) + { + var17.setFadeColour(par14ArrayOfInteger[this.rand.nextInt(par14ArrayOfInteger.length)]); + } + + this.theEffectRenderer.addEffect(var17); + } + + /** + * Creates a small ball or large ball type explosion. Args: particle speed, size, colours, fade colours, whether to + * trail, whether to flicker + */ + private void createBall(double par1, int par3, int[] par4ArrayOfInteger, int[] par5ArrayOfInteger, boolean par6, boolean par7) + { + double var8 = this.posX; + double var10 = this.posY; + double var12 = this.posZ; + + for (int var14 = -par3; var14 <= par3; ++var14) + { + for (int var15 = -par3; var15 <= par3; ++var15) + { + for (int var16 = -par3; var16 <= par3; ++var16) + { + double var17 = (double)var15 + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D; + double var19 = (double)var14 + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D; + double var21 = (double)var16 + (this.rand.nextDouble() - this.rand.nextDouble()) * 0.5D; + double var23 = (double)MathHelper.sqrt_double(var17 * var17 + var19 * var19 + var21 * var21) / par1 + this.rand.nextGaussian() * 0.05D; + this.createParticle(var8, var10, var12, var17 / var23, var19 / var23, var21 / var23, par4ArrayOfInteger, par5ArrayOfInteger, par6, par7); + + if (var14 != -par3 && var14 != par3 && var15 != -par3 && var15 != par3) + { + var16 += par3 * 2 - 1; + } + } + } + } + } + + /** + * Creates a creeper-shaped or star-shaped explosion. Args: particle speed, shape, colours, fade colours, whether to + * trail, whether to flicker, unknown + */ + private void createShaped(double par1, double[][] par3ArrayOfDouble, int[] par4ArrayOfInteger, int[] par5ArrayOfInteger, boolean par6, boolean par7, boolean par8) + { + double var9 = par3ArrayOfDouble[0][0]; + double var11 = par3ArrayOfDouble[0][1]; + this.createParticle(this.posX, this.posY, this.posZ, var9 * par1, var11 * par1, 0.0D, par4ArrayOfInteger, par5ArrayOfInteger, par6, par7); + float var13 = this.rand.nextFloat() * (float)Math.PI; + double var14 = par8 ? 0.034D : 0.34D; + + for (int var16 = 0; var16 < 3; ++var16) + { + double var17 = (double)var13 + (double)((float)var16 * (float)Math.PI) * var14; + double var19 = var9; + double var21 = var11; + + for (int var23 = 1; var23 < par3ArrayOfDouble.length; ++var23) + { + double var24 = par3ArrayOfDouble[var23][0]; + double var26 = par3ArrayOfDouble[var23][1]; + + for (double var28 = 0.25D; var28 <= 1.0D; var28 += 0.25D) + { + double var30 = (var19 + (var24 - var19) * var28) * par1; + double var32 = (var21 + (var26 - var21) * var28) * par1; + double var34 = var30 * Math.sin(var17); + var30 *= Math.cos(var17); + + for (double var36 = -1.0D; var36 <= 1.0D; var36 += 2.0D) + { + this.createParticle(this.posX, this.posY, this.posZ, var30 * var36, var32, var34 * var36, par4ArrayOfInteger, par5ArrayOfInteger, par6, par7); + } + } + + var19 = var24; + var21 = var26; + } + } + } + + /** + * Creates a burst type explosion. Args: colours, fade colours, whether to trail, whether to flicker + */ + private void createBurst(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger, boolean par3, boolean par4) + { + double var5 = this.rand.nextGaussian() * 0.05D; + double var7 = this.rand.nextGaussian() * 0.05D; + + for (int var9 = 0; var9 < 70; ++var9) + { + double var10 = this.motionX * 0.5D + this.rand.nextGaussian() * 0.15D + var5; + double var12 = this.motionZ * 0.5D + this.rand.nextGaussian() * 0.15D + var7; + double var14 = this.motionY * 0.5D + this.rand.nextDouble() * 0.5D; + this.createParticle(this.posX, this.posY, this.posZ, var10, var14, var12, par1ArrayOfInteger, par2ArrayOfInteger, par3, par4); + } + } + + public int getFXLayer() + { + return 0; + } +} diff --git a/src/main/java/net/minecraft/src/EntityFishHook.java b/src/main/java/net/minecraft/src/EntityFishHook.java new file mode 100644 index 0000000..153ac69 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityFishHook.java @@ -0,0 +1,488 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityFishHook extends Entity +{ + /** The tile this entity is on, X position */ + private int xTile; + + /** The tile this entity is on, Y position */ + private int yTile; + + /** The tile this entity is on, Z position */ + private int zTile; + private int inTile; + private boolean inGround; + public int shake; + public EntityPlayer angler; + private int ticksInGround; + private int ticksInAir; + + /** the number of ticks remaining until this fish can no longer be caught */ + private int ticksCatchable; + + /** + * The entity that the fishing rod is connected to, if any. When you right click on the fishing rod and the hook + * falls on to an entity, this it that entity. + */ + public Entity bobber; + private int fishPosRotationIncrements; + private double fishX; + private double fishY; + private double fishZ; + private double fishYaw; + private double fishPitch; + private double velocityX; + private double velocityY; + private double velocityZ; + + public EntityFishHook(World par1World) + { + super(par1World); + this.xTile = -1; + this.yTile = -1; + this.zTile = -1; + this.setSize(0.25F, 0.25F); + this.ignoreFrustumCheck = true; + } + + public EntityFishHook(World par1World, double par2, double par4, double par6, EntityPlayer par8EntityPlayer) + { + this(par1World); + this.setPosition(par2, par4, par6); + this.ignoreFrustumCheck = true; + this.angler = par8EntityPlayer; + par8EntityPlayer.fishEntity = this; + } + + public EntityFishHook(World par1World, EntityPlayer par2EntityPlayer) + { + super(par1World); + this.xTile = -1; + this.yTile = -1; + this.zTile = -1; + this.ignoreFrustumCheck = true; + this.angler = par2EntityPlayer; + this.angler.fishEntity = this; + this.setSize(0.25F, 0.25F); + this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + 1.62D - (double)par2EntityPlayer.yOffset, par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); + this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posY -= 0.10000000149011612D; + this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + float var3 = 0.4F; + this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.calculateVelocity(this.motionX, this.motionY, this.motionZ, 1.5F, 1.0F); + } + + protected void entityInit() {} + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double par1) + { + double var3 = this.boundingBox.getAverageEdgeLength() * 4.0D; + var3 *= 64.0D; + return par1 < var3 * var3; + } + + public void calculateVelocity(double par1, double par3, double par5, float par7, float par8) + { + float var9 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); + par1 /= (double)var9; + par3 /= (double)var9; + par5 /= (double)var9; + par1 += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; + par3 += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; + par5 += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; + par1 *= (double)par7; + par3 *= (double)par7; + par5 *= (double)par7; + this.motionX = par1; + this.motionY = par3; + this.motionZ = par5; + float var10 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)var10) * 180.0D / Math.PI); + this.ticksInGround = 0; + } + + /** + * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, + * posY, posZ, yaw, pitch + */ + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) + { + this.fishX = par1; + this.fishY = par3; + this.fishZ = par5; + this.fishYaw = (double)par7; + this.fishPitch = (double)par8; + this.fishPosRotationIncrements = par9; + this.motionX = this.velocityX; + this.motionY = this.velocityY; + this.motionZ = this.velocityZ; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double par1, double par3, double par5) + { + this.velocityX = this.motionX = par1; + this.velocityY = this.motionY = par3; + this.velocityZ = this.motionZ = par5; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.fishPosRotationIncrements > 0) + { + double var21 = this.posX + (this.fishX - this.posX) / (double)this.fishPosRotationIncrements; + double var22 = this.posY + (this.fishY - this.posY) / (double)this.fishPosRotationIncrements; + double var23 = this.posZ + (this.fishZ - this.posZ) / (double)this.fishPosRotationIncrements; + double var7 = MathHelper.wrapAngleTo180_double(this.fishYaw - (double)this.rotationYaw); + this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.fishPosRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.fishPitch - (double)this.rotationPitch) / (double)this.fishPosRotationIncrements); + --this.fishPosRotationIncrements; + this.setPosition(var21, var22, var23); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + else + { + if (!this.worldObj.isRemote) + { + ItemStack var1 = this.angler.getCurrentEquippedItem(); + + if (this.angler.isDead || !this.angler.isEntityAlive() || var1 == null || var1.getItem() != Item.fishingRod || this.getDistanceSqToEntity(this.angler) > 1024.0D) + { + this.setDead(); + this.angler.fishEntity = null; + return; + } + + if (this.bobber != null) + { + if (!this.bobber.isDead) + { + this.posX = this.bobber.posX; + this.posY = this.bobber.boundingBox.minY + (double)this.bobber.height * 0.8D; + this.posZ = this.bobber.posZ; + return; + } + + this.bobber = null; + } + } + + if (this.shake > 0) + { + --this.shake; + } + + if (this.inGround) + { + int var19 = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + + if (var19 == this.inTile) + { + ++this.ticksInGround; + + if (this.ticksInGround == 1200) + { + this.setDead(); + } + + return; + } + + this.inGround = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } + else + { + ++this.ticksInAir; + } + + Vec3 var20 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); + Vec3 var2 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition var3 = this.worldObj.clip(var20, var2); + var20 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); + var2 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (var3 != null) + { + var2 = this.worldObj.getWorldVec3Pool().getVecFromPool(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord); + } + + Entity var4 = null; + List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double var6 = 0.0D; + double var13; + + for (int var8 = 0; var8 < var5.size(); ++var8) + { + Entity var9 = (Entity)var5.get(var8); + + if (var9.canBeCollidedWith() && (var9 != this.angler || this.ticksInAir >= 5)) + { + float var10 = 0.3F; + AxisAlignedBB var11 = var9.boundingBox.expand((double)var10, (double)var10, (double)var10); + MovingObjectPosition var12 = var11.calculateIntercept(var20, var2); + + if (var12 != null) + { + var13 = var20.distanceTo(var12.hitVec); + + if (var13 < var6 || var6 == 0.0D) + { + var4 = var9; + var6 = var13; + } + } + } + } + + if (var4 != null) + { + var3 = new MovingObjectPosition(var4); + } + + if (var3 != null) + { + if (var3.entityHit != null) + { + if (var3.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.angler), 0.0F)) + { + this.bobber = var3.entityHit; + } + } + else + { + this.inGround = true; + } + } + + if (!this.inGround) + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + float var24 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var24) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float var25 = 0.92F; + + if (this.onGround || this.isCollidedHorizontally) + { + var25 = 0.5F; + } + + byte var26 = 5; + double var27 = 0.0D; + + for (int var28 = 0; var28 < var26; ++var28) + { + double var14 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(var28 + 0) / (double)var26 - 0.125D + 0.125D; + double var16 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double)(var28 + 1) / (double)var26 - 0.125D + 0.125D; + AxisAlignedBB var18 = AxisAlignedBB.getAABBPool().getAABB(this.boundingBox.minX, var14, this.boundingBox.minZ, this.boundingBox.maxX, var16, this.boundingBox.maxZ); + + if (this.worldObj.isAABBInMaterial(var18, Material.water)) + { + var27 += 1.0D / (double)var26; + } + } + + if (var27 > 0.0D) + { + if (this.ticksCatchable > 0) + { + --this.ticksCatchable; + } + else + { + short var29 = 500; + + if (this.worldObj.canLightningStrikeAt(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) + 1, MathHelper.floor_double(this.posZ))) + { + var29 = 300; + } + + if (this.rand.nextInt(var29) == 0) + { + this.ticksCatchable = this.rand.nextInt(30) + 10; + this.motionY -= 0.20000000298023224D; + this.playSound("random.splash", 0.25F, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + float var30 = (float)MathHelper.floor_double(this.boundingBox.minY); + int var15; + float var17; + float var31; + + for (var15 = 0; (float)var15 < 1.0F + this.width * 20.0F; ++var15) + { + var31 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + var17 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("bubble", this.posX + (double)var31, (double)(var30 + 1.0F), this.posZ + (double)var17, this.motionX, this.motionY - (double)(this.rand.nextFloat() * 0.2F), this.motionZ); + } + + for (var15 = 0; (float)var15 < 1.0F + this.width * 20.0F; ++var15) + { + var31 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + var17 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("splash", this.posX + (double)var31, (double)(var30 + 1.0F), this.posZ + (double)var17, this.motionX, this.motionY, this.motionZ); + } + } + } + } + + if (this.ticksCatchable > 0) + { + this.motionY -= (double)(this.rand.nextFloat() * this.rand.nextFloat() * this.rand.nextFloat()) * 0.2D; + } + + var13 = var27 * 2.0D - 1.0D; + this.motionY += 0.03999999910593033D * var13; + + if (var27 > 0.0D) + { + var25 = (float)((double)var25 * 0.9D); + this.motionY *= 0.8D; + } + + this.motionX *= (double)var25; + this.motionY *= (double)var25; + this.motionZ *= (double)var25; + this.setPosition(this.posX, this.posY, this.posZ); + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setShort("xTile", (short)this.xTile); + par1NBTTagCompound.setShort("yTile", (short)this.yTile); + par1NBTTagCompound.setShort("zTile", (short)this.zTile); + par1NBTTagCompound.setByte("inTile", (byte)this.inTile); + par1NBTTagCompound.setByte("shake", (byte)this.shake); + par1NBTTagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.xTile = par1NBTTagCompound.getShort("xTile"); + this.yTile = par1NBTTagCompound.getShort("yTile"); + this.zTile = par1NBTTagCompound.getShort("zTile"); + this.inTile = par1NBTTagCompound.getByte("inTile") & 255; + this.shake = par1NBTTagCompound.getByte("shake") & 255; + this.inGround = par1NBTTagCompound.getByte("inGround") == 1; + } + + public float getShadowSize() + { + return 0.0F; + } + + public int catchFish() + { + if (this.worldObj.isRemote) + { + return 0; + } + else + { + byte var1 = 0; + + if (this.bobber != null) + { + double var2 = this.angler.posX - this.posX; + double var4 = this.angler.posY - this.posY; + double var6 = this.angler.posZ - this.posZ; + double var8 = (double)MathHelper.sqrt_double(var2 * var2 + var4 * var4 + var6 * var6); + double var10 = 0.1D; + this.bobber.motionX += var2 * var10; + this.bobber.motionY += var4 * var10 + (double)MathHelper.sqrt_double(var8) * 0.08D; + this.bobber.motionZ += var6 * var10; + var1 = 3; + } + else if (this.ticksCatchable > 0) + { + EntityItem var13 = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(Item.fishRaw)); + double var3 = this.angler.posX - this.posX; + double var5 = this.angler.posY - this.posY; + double var7 = this.angler.posZ - this.posZ; + double var9 = (double)MathHelper.sqrt_double(var3 * var3 + var5 * var5 + var7 * var7); + double var11 = 0.1D; + var13.motionX = var3 * var11; + var13.motionY = var5 * var11 + (double)MathHelper.sqrt_double(var9) * 0.08D; + var13.motionZ = var7 * var11; + this.worldObj.spawnEntityInWorld(var13); + this.angler.addStat(StatList.fishCaughtStat, 1); + this.angler.worldObj.spawnEntityInWorld(new EntityXPOrb(this.angler.worldObj, this.angler.posX, this.angler.posY + 0.5D, this.angler.posZ + 0.5D, this.rand.nextInt(6) + 1)); + var1 = 1; + } + + if (this.inGround) + { + var1 = 2; + } + + this.setDead(); + this.angler.fishEntity = null; + return var1; + } + } + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + super.setDead(); + + if (this.angler != null) + { + this.angler.fishEntity = null; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityFlameFX.java b/src/main/java/net/minecraft/src/EntityFlameFX.java new file mode 100644 index 0000000..eaa6313 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityFlameFX.java @@ -0,0 +1,104 @@ +package net.minecraft.src; + +public class EntityFlameFX extends EntityFX +{ + /** the scale of the flame FX */ + private float flameScale; + + public EntityFlameFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, par8, par10, par12); + this.motionX = this.motionX * 0.009999999776482582D + par8; + this.motionY = this.motionY * 0.009999999776482582D + par10; + this.motionZ = this.motionZ * 0.009999999776482582D + par12; + double var10000 = par2 + (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F); + var10000 = par4 + (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F); + var10000 = par6 + (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F); + this.flameScale = this.particleScale; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)) + 4; + this.noClip = true; + this.setParticleTextureIndex(48); + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge; + this.particleScale = this.flameScale * (1.0F - var8 * var8 * 0.5F); + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + + public int getBrightnessForRender(float par1) + { + float var2 = ((float)this.particleAge + par1) / (float)this.particleMaxAge; + + if (var2 < 0.0F) + { + var2 = 0.0F; + } + + if (var2 > 1.0F) + { + var2 = 1.0F; + } + + int var3 = super.getBrightnessForRender(par1); + int var4 = var3 & 255; + int var5 = var3 >> 16 & 255; + var4 += (int)(var2 * 15.0F * 16.0F); + + if (var4 > 240) + { + var4 = 240; + } + + return var4 | var5 << 16; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + float var2 = ((float)this.particleAge + par1) / (float)this.particleMaxAge; + + if (var2 < 0.0F) + { + var2 = 0.0F; + } + + if (var2 > 1.0F) + { + var2 = 1.0F; + } + + float var3 = super.getBrightness(par1); + return var3 * var2 + (1.0F - var2); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityFlying.java b/src/main/java/net/minecraft/src/EntityFlying.java new file mode 100644 index 0000000..c0971e3 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityFlying.java @@ -0,0 +1,99 @@ +package net.minecraft.src; + +public abstract class EntityFlying extends EntityLiving +{ + public EntityFlying(World par1World) + { + super(par1World); + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) {} + + /** + * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance + * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround + */ + protected void updateFallState(double par1, boolean par3) {} + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float par1, float par2) + { + if (this.isInWater()) + { + this.moveFlying(par1, par2, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.800000011920929D; + this.motionY *= 0.800000011920929D; + this.motionZ *= 0.800000011920929D; + } + else if (this.handleLavaMovement()) + { + this.moveFlying(par1, par2, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + else + { + float var3 = 0.91F; + + if (this.onGround) + { + var3 = 0.54600006F; + int var4 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + + if (var4 > 0) + { + var3 = Block.blocksList[var4].slipperiness * 0.91F; + } + } + + float var8 = 0.16277136F / (var3 * var3 * var3); + this.moveFlying(par1, par2, this.onGround ? 0.1F * var8 : 0.02F); + var3 = 0.91F; + + if (this.onGround) + { + var3 = 0.54600006F; + int var5 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + + if (var5 > 0) + { + var3 = Block.blocksList[var5].slipperiness * 0.91F; + } + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= (double)var3; + this.motionY *= (double)var3; + this.motionZ *= (double)var3; + } + + this.prevLimbSwingAmount = this.limbSwingAmount; + double var10 = this.posX - this.prevPosX; + double var9 = this.posZ - this.prevPosZ; + float var7 = MathHelper.sqrt_double(var10 * var10 + var9 * var9) * 4.0F; + + if (var7 > 1.0F) + { + var7 = 1.0F; + } + + this.limbSwingAmount += (var7 - this.limbSwingAmount) * 0.4F; + this.limbSwing += this.limbSwingAmount; + } + + /** + * returns true if this entity is by a ladder, false otherwise + */ + public boolean isOnLadder() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/EntityFootStepFX.java b/src/main/java/net/minecraft/src/EntityFootStepFX.java new file mode 100644 index 0000000..8c1bc20 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityFootStepFX.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class EntityFootStepFX extends EntityFX +{ + private static final ResourceLocation field_110126_a = new ResourceLocation("textures/particle/footprint.png"); + private int footstepAge; + private int footstepMaxAge; + private TextureManager currentFootSteps; + + public EntityFootStepFX(TextureManager par1TextureManager, World par2World, double par3, double par5, double par7) + { + super(par2World, par3, par5, par7, 0.0D, 0.0D, 0.0D); + this.currentFootSteps = par1TextureManager; + this.motionX = this.motionY = this.motionZ = 0.0D; + this.footstepMaxAge = 200; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.footstepAge + par2) / (float)this.footstepMaxAge; + var8 *= var8; + float var9 = 2.0F - var8 * 2.0F; + + if (var9 > 1.0F) + { + var9 = 1.0F; + } + + var9 *= 0.2F; + GL11.glDisable(GL11.GL_LIGHTING); + float var10 = 0.125F; + float var11 = (float)(this.posX - interpPosX); + float var12 = (float)(this.posY - interpPosY); + float var13 = (float)(this.posZ - interpPosZ); + float var14 = this.worldObj.getLightBrightness(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + this.currentFootSteps.bindTexture(field_110126_a); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + par1Tessellator.startDrawingQuads(); + par1Tessellator.setColorRGBA_F(var14, var14, var14, var9); + par1Tessellator.addVertexWithUV((double)(var11 - var10), (double)var12, (double)(var13 + var10), 0.0D, 1.0D); + par1Tessellator.addVertexWithUV((double)(var11 + var10), (double)var12, (double)(var13 + var10), 1.0D, 1.0D); + par1Tessellator.addVertexWithUV((double)(var11 + var10), (double)var12, (double)(var13 - var10), 1.0D, 0.0D); + par1Tessellator.addVertexWithUV((double)(var11 - var10), (double)var12, (double)(var13 - var10), 0.0D, 0.0D); + par1Tessellator.draw(); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_LIGHTING); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + ++this.footstepAge; + + if (this.footstepAge == this.footstepMaxAge) + { + this.setDead(); + } + } + + public int getFXLayer() + { + return 3; + } +} diff --git a/src/main/java/net/minecraft/src/EntityGhast.java b/src/main/java/net/minecraft/src/EntityGhast.java new file mode 100644 index 0000000..2dbec42 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityGhast.java @@ -0,0 +1,301 @@ +package net.minecraft.src; + +public class EntityGhast extends EntityFlying implements IMob +{ + public int courseChangeCooldown; + public double waypointX; + public double waypointY; + public double waypointZ; + private Entity targetedEntity; + + /** Cooldown time between target loss and new target aquirement. */ + private int aggroCooldown; + public int prevAttackCounter; + public int attackCounter; + + /** The explosion radius of spawned fireballs. */ + private int explosionStrength = 1; + + public EntityGhast(World par1World) + { + super(par1World); + this.setSize(4.0F, 4.0F); + this.isImmuneToFire = true; + this.experienceValue = 5; + } + + public boolean func_110182_bF() + { + return this.dataWatcher.getWatchableObjectByte(16) != 0; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else if ("fireball".equals(par1DamageSource.getDamageType()) && par1DamageSource.getEntity() instanceof EntityPlayer) + { + super.attackEntityFrom(par1DamageSource, 1000.0F); + ((EntityPlayer)par1DamageSource.getEntity()).triggerAchievement(AchievementList.ghast); + return true; + } + else + { + return super.attackEntityFrom(par1DamageSource, par2); + } + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(10.0D); + } + + protected void updateEntityActionState() + { + if (!this.worldObj.isRemote && this.worldObj.difficultySetting == 0) + { + this.setDead(); + } + + this.despawnEntity(); + this.prevAttackCounter = this.attackCounter; + double var1 = this.waypointX - this.posX; + double var3 = this.waypointY - this.posY; + double var5 = this.waypointZ - this.posZ; + double var7 = var1 * var1 + var3 * var3 + var5 * var5; + + if (var7 < 1.0D || var7 > 3600.0D) + { + this.waypointX = this.posX + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); + this.waypointY = this.posY + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); + this.waypointZ = this.posZ + (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 16.0F); + } + + if (this.courseChangeCooldown-- <= 0) + { + this.courseChangeCooldown += this.rand.nextInt(5) + 2; + var7 = (double)MathHelper.sqrt_double(var7); + + if (this.isCourseTraversable(this.waypointX, this.waypointY, this.waypointZ, var7)) + { + this.motionX += var1 / var7 * 0.1D; + this.motionY += var3 / var7 * 0.1D; + this.motionZ += var5 / var7 * 0.1D; + } + else + { + this.waypointX = this.posX; + this.waypointY = this.posY; + this.waypointZ = this.posZ; + } + } + + if (this.targetedEntity != null && this.targetedEntity.isDead) + { + this.targetedEntity = null; + } + + if (this.targetedEntity == null || this.aggroCooldown-- <= 0) + { + this.targetedEntity = this.worldObj.getClosestVulnerablePlayerToEntity(this, 100.0D); + + if (this.targetedEntity != null) + { + this.aggroCooldown = 20; + } + } + + double var9 = 64.0D; + + if (this.targetedEntity != null && this.targetedEntity.getDistanceSqToEntity(this) < var9 * var9) + { + double var11 = this.targetedEntity.posX - this.posX; + double var13 = this.targetedEntity.boundingBox.minY + (double)(this.targetedEntity.height / 2.0F) - (this.posY + (double)(this.height / 2.0F)); + double var15 = this.targetedEntity.posZ - this.posZ; + this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(var11, var15)) * 180.0F / (float)Math.PI; + + if (this.canEntityBeSeen(this.targetedEntity)) + { + if (this.attackCounter == 10) + { + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1007, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + } + + ++this.attackCounter; + + if (this.attackCounter == 20) + { + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1008, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + EntityLargeFireball var17 = new EntityLargeFireball(this.worldObj, this, var11, var13, var15); + var17.field_92057_e = this.explosionStrength; + double var18 = 4.0D; + Vec3 var20 = this.getLook(1.0F); + var17.posX = this.posX + var20.xCoord * var18; + var17.posY = this.posY + (double)(this.height / 2.0F) + 0.5D; + var17.posZ = this.posZ + var20.zCoord * var18; + this.worldObj.spawnEntityInWorld(var17); + this.attackCounter = -40; + } + } + else if (this.attackCounter > 0) + { + --this.attackCounter; + } + } + else + { + this.renderYawOffset = this.rotationYaw = -((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI; + + if (this.attackCounter > 0) + { + --this.attackCounter; + } + } + + if (!this.worldObj.isRemote) + { + byte var21 = this.dataWatcher.getWatchableObjectByte(16); + byte var12 = (byte)(this.attackCounter > 10 ? 1 : 0); + + if (var21 != var12) + { + this.dataWatcher.updateObject(16, Byte.valueOf(var12)); + } + } + } + + /** + * True if the ghast has an unobstructed line of travel to the waypoint. + */ + private boolean isCourseTraversable(double par1, double par3, double par5, double par7) + { + double var9 = (this.waypointX - this.posX) / par7; + double var11 = (this.waypointY - this.posY) / par7; + double var13 = (this.waypointZ - this.posZ) / par7; + AxisAlignedBB var15 = this.boundingBox.copy(); + + for (int var16 = 1; (double)var16 < par7; ++var16) + { + var15.offset(var9, var11, var13); + + if (!this.worldObj.getCollidingBoundingBoxes(this, var15).isEmpty()) + { + return false; + } + } + + return true; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.ghast.moan"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.ghast.scream"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.ghast.death"; + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.gunpowder.itemID; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.rand.nextInt(2) + this.rand.nextInt(1 + par2); + int var4; + + for (var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Item.ghastTear.itemID, 1); + } + + var3 = this.rand.nextInt(3) + this.rand.nextInt(1 + par2); + + for (var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Item.gunpowder.itemID, 1); + } + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 10.0F; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.rand.nextInt(20) == 0 && super.getCanSpawnHere() && this.worldObj.difficultySetting > 0; + } + + /** + * Will return how many at most can spawn in a chunk at once. + */ + public int getMaxSpawnedInChunk() + { + return 1; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("ExplosionPower", this.explosionStrength); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + + if (par1NBTTagCompound.hasKey("ExplosionPower")) + { + this.explosionStrength = par1NBTTagCompound.getInteger("ExplosionPower"); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityGiantZombie.java b/src/main/java/net/minecraft/src/EntityGiantZombie.java new file mode 100644 index 0000000..d8bc686 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityGiantZombie.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +public class EntityGiantZombie extends EntityMob +{ + public EntityGiantZombie(World par1World) + { + super(par1World); + this.yOffset *= 6.0F; + this.setSize(this.width * 6.0F, this.height * 6.0F); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(100.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(50.0D); + } + + /** + * Takes a coordinate in and returns a weight to determine how likely this creature will try to path to the block. + * Args: x, y, z + */ + public float getBlockPathWeight(int par1, int par2, int par3) + { + return this.worldObj.getLightBrightness(par1, par2, par3) - 0.5F; + } +} diff --git a/src/main/java/net/minecraft/src/EntityGolem.java b/src/main/java/net/minecraft/src/EntityGolem.java new file mode 100644 index 0000000..2561fde --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityGolem.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +public abstract class EntityGolem extends EntityCreature implements IAnimals +{ + public EntityGolem(World par1World) + { + super(par1World); + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) {} + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "none"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "none"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "none"; + } + + /** + * Get number of ticks, at least during which the living entity will be silent. + */ + public int getTalkInterval() + { + return 120; + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/EntityHanging.java b/src/main/java/net/minecraft/src/EntityHanging.java new file mode 100644 index 0000000..6db6d6a --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityHanging.java @@ -0,0 +1,349 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public abstract class EntityHanging extends Entity +{ + private int tickCounter1; + public int hangingDirection; + public int xPosition; + public int yPosition; + public int zPosition; + + public EntityHanging(World par1World) + { + super(par1World); + this.yOffset = 0.0F; + this.setSize(0.5F, 0.5F); + } + + public EntityHanging(World par1World, int par2, int par3, int par4, int par5) + { + this(par1World); + this.xPosition = par2; + this.yPosition = par3; + this.zPosition = par4; + } + + protected void entityInit() {} + + public void setDirection(int par1) + { + this.hangingDirection = par1; + this.prevRotationYaw = this.rotationYaw = (float)(par1 * 90); + float var2 = (float)this.getWidthPixels(); + float var3 = (float)this.getHeightPixels(); + float var4 = (float)this.getWidthPixels(); + + if (par1 != 2 && par1 != 0) + { + var2 = 0.5F; + } + else + { + var4 = 0.5F; + this.rotationYaw = this.prevRotationYaw = (float)(Direction.rotateOpposite[par1] * 90); + } + + var2 /= 32.0F; + var3 /= 32.0F; + var4 /= 32.0F; + float var5 = (float)this.xPosition + 0.5F; + float var6 = (float)this.yPosition + 0.5F; + float var7 = (float)this.zPosition + 0.5F; + float var8 = 0.5625F; + + if (par1 == 2) + { + var7 -= var8; + } + + if (par1 == 1) + { + var5 -= var8; + } + + if (par1 == 0) + { + var7 += var8; + } + + if (par1 == 3) + { + var5 += var8; + } + + if (par1 == 2) + { + var5 -= this.func_70517_b(this.getWidthPixels()); + } + + if (par1 == 1) + { + var7 += this.func_70517_b(this.getWidthPixels()); + } + + if (par1 == 0) + { + var5 += this.func_70517_b(this.getWidthPixels()); + } + + if (par1 == 3) + { + var7 -= this.func_70517_b(this.getWidthPixels()); + } + + var6 += this.func_70517_b(this.getHeightPixels()); + this.setPosition((double)var5, (double)var6, (double)var7); + float var9 = -0.03125F; + this.boundingBox.setBounds((double)(var5 - var2 - var9), (double)(var6 - var3 - var9), (double)(var7 - var4 - var9), (double)(var5 + var2 + var9), (double)(var6 + var3 + var9), (double)(var7 + var4 + var9)); + } + + private float func_70517_b(int par1) + { + return par1 == 32 ? 0.5F : (par1 == 64 ? 0.5F : 0.0F); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.tickCounter1++ == 100 && !this.worldObj.isRemote) + { + this.tickCounter1 = 0; + + if (!this.isDead && !this.onValidSurface()) + { + this.setDead(); + this.onBroken((Entity)null); + } + } + } + + /** + * checks to make sure painting can be placed there + */ + public boolean onValidSurface() + { + if (!this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()) + { + return false; + } + else + { + int var1 = Math.max(1, this.getWidthPixels() / 16); + int var2 = Math.max(1, this.getHeightPixels() / 16); + int var3 = this.xPosition; + int var4 = this.yPosition; + int var5 = this.zPosition; + + if (this.hangingDirection == 2) + { + var3 = MathHelper.floor_double(this.posX - (double)((float)this.getWidthPixels() / 32.0F)); + } + + if (this.hangingDirection == 1) + { + var5 = MathHelper.floor_double(this.posZ - (double)((float)this.getWidthPixels() / 32.0F)); + } + + if (this.hangingDirection == 0) + { + var3 = MathHelper.floor_double(this.posX - (double)((float)this.getWidthPixels() / 32.0F)); + } + + if (this.hangingDirection == 3) + { + var5 = MathHelper.floor_double(this.posZ - (double)((float)this.getWidthPixels() / 32.0F)); + } + + var4 = MathHelper.floor_double(this.posY - (double)((float)this.getHeightPixels() / 32.0F)); + + for (int var6 = 0; var6 < var1; ++var6) + { + for (int var7 = 0; var7 < var2; ++var7) + { + Material var8; + + if (this.hangingDirection != 2 && this.hangingDirection != 0) + { + var8 = this.worldObj.getBlockMaterial(this.xPosition, var4 + var7, var5 + var6); + } + else + { + var8 = this.worldObj.getBlockMaterial(var3 + var6, var4 + var7, this.zPosition); + } + + if (!var8.isSolid()) + { + return false; + } + } + } + + List var9 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox); + Iterator var10 = var9.iterator(); + Entity var11; + + do + { + if (!var10.hasNext()) + { + return true; + } + + var11 = (Entity)var10.next(); + } + while (!(var11 instanceof EntityHanging)); + + return false; + } + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return true; + } + + /** + * Called when a player attacks an entity. If this returns true the attack will not happen. + */ + public boolean hitByEntity(Entity par1Entity) + { + return par1Entity instanceof EntityPlayer ? this.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)par1Entity), 0.0F) : false; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + if (!this.isDead && !this.worldObj.isRemote) + { + this.setDead(); + this.setBeenAttacked(); + this.onBroken(par1DamageSource.getEntity()); + } + + return true; + } + } + + /** + * Tries to moves the entity by the passed in displacement. Args: x, y, z + */ + public void moveEntity(double par1, double par3, double par5) + { + if (!this.worldObj.isRemote && !this.isDead && par1 * par1 + par3 * par3 + par5 * par5 > 0.0D) + { + this.setDead(); + this.onBroken((Entity)null); + } + } + + /** + * Adds to the current velocity of the entity. Args: x, y, z + */ + public void addVelocity(double par1, double par3, double par5) + { + if (!this.worldObj.isRemote && !this.isDead && par1 * par1 + par3 * par3 + par5 * par5 > 0.0D) + { + this.setDead(); + this.onBroken((Entity)null); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setByte("Direction", (byte)this.hangingDirection); + par1NBTTagCompound.setInteger("TileX", this.xPosition); + par1NBTTagCompound.setInteger("TileY", this.yPosition); + par1NBTTagCompound.setInteger("TileZ", this.zPosition); + + switch (this.hangingDirection) + { + case 0: + par1NBTTagCompound.setByte("Dir", (byte)2); + break; + + case 1: + par1NBTTagCompound.setByte("Dir", (byte)1); + break; + + case 2: + par1NBTTagCompound.setByte("Dir", (byte)0); + break; + + case 3: + par1NBTTagCompound.setByte("Dir", (byte)3); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + if (par1NBTTagCompound.hasKey("Direction")) + { + this.hangingDirection = par1NBTTagCompound.getByte("Direction"); + } + else + { + switch (par1NBTTagCompound.getByte("Dir")) + { + case 0: + this.hangingDirection = 2; + break; + + case 1: + this.hangingDirection = 1; + break; + + case 2: + this.hangingDirection = 0; + break; + + case 3: + this.hangingDirection = 3; + } + } + + this.xPosition = par1NBTTagCompound.getInteger("TileX"); + this.yPosition = par1NBTTagCompound.getInteger("TileY"); + this.zPosition = par1NBTTagCompound.getInteger("TileZ"); + this.setDirection(this.hangingDirection); + } + + public abstract int getWidthPixels(); + + public abstract int getHeightPixels(); + + /** + * Called when this entity is broken. Entity parameter may be null. + */ + public abstract void onBroken(Entity var1); + + protected boolean shouldSetPosAfterLoading() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/EntityHeartFX.java b/src/main/java/net/minecraft/src/EntityHeartFX.java new file mode 100644 index 0000000..19bfb12 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityHeartFX.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +public class EntityHeartFX extends EntityFX +{ + float particleScaleOverTime; + + public EntityHeartFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + this(par1World, par2, par4, par6, par8, par10, par12, 2.0F); + } + + public EntityHeartFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.009999999776482582D; + this.motionY *= 0.009999999776482582D; + this.motionZ *= 0.009999999776482582D; + this.motionY += 0.1D; + this.particleScale *= 0.75F; + this.particleScale *= par14; + this.particleScaleOverTime = this.particleScale; + this.particleMaxAge = 16; + this.noClip = false; + this.setParticleTextureIndex(80); + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F; + + if (var8 < 0.0F) + { + var8 = 0.0F; + } + + if (var8 > 1.0F) + { + var8 = 1.0F; + } + + this.particleScale = this.particleScaleOverTime * var8; + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.8600000143051147D; + this.motionY *= 0.8600000143051147D; + this.motionZ *= 0.8600000143051147D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityHorse.java b/src/main/java/net/minecraft/src/EntityHorse.java new file mode 100644 index 0000000..7cde5781 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityHorse.java @@ -0,0 +1,1700 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class EntityHorse extends EntityAnimal implements IInvBasic +{ + private static final IEntitySelector horseBreedingSelector = new EntityHorseBredSelector(); + private static final Attribute horseJumpStrength = (new RangedAttribute("horse.jumpStrength", 0.7D, 0.0D, 2.0D)).func_111117_a("Jump Strength").setShouldWatch(true); + private static final String[] horseArmorTextures = new String[] {null, "textures/entity/horse/armor/horse_armor_iron.png", "textures/entity/horse/armor/horse_armor_gold.png", "textures/entity/horse/armor/horse_armor_diamond.png"}; + private static final String[] field_110273_bx = new String[] {"", "meo", "goo", "dio"}; + private static final int[] armorValues = new int[] {0, 5, 7, 11}; + private static final String[] horseTextures = new String[] {"textures/entity/horse/horse_white.png", "textures/entity/horse/horse_creamy.png", "textures/entity/horse/horse_chestnut.png", "textures/entity/horse/horse_brown.png", "textures/entity/horse/horse_black.png", "textures/entity/horse/horse_gray.png", "textures/entity/horse/horse_darkbrown.png"}; + private static final String[] field_110269_bA = new String[] {"hwh", "hcr", "hch", "hbr", "hbl", "hgr", "hdb"}; + private static final String[] horseMarkingTextures = new String[] {null, "textures/entity/horse/horse_markings_white.png", "textures/entity/horse/horse_markings_whitefield.png", "textures/entity/horse/horse_markings_whitedots.png", "textures/entity/horse/horse_markings_blackdots.png"}; + private static final String[] field_110292_bC = new String[] {"", "wo_", "wmo", "wdo", "bdo"}; + private int eatingHaystackCounter; + private int openMouthCounter; + private int jumpRearingCounter; + public int field_110278_bp; + public int field_110279_bq; + protected boolean horseJumping; + private AnimalChest horseChest; + private boolean hasReproduced; + + /** + * "The higher this value, the more likely the horse is to be tamed next time a player rides it." + */ + protected int temper; + protected float jumpPower; + private boolean field_110294_bI; + private float headLean; + private float prevHeadLean; + private float rearingAmount; + private float prevRearingAmount; + private float mouthOpenness; + private float prevMouthOpenness; + private int field_110285_bP; + private String field_110286_bQ; + private String[] field_110280_bR = new String[3]; + + public EntityHorse(World par1World) + { + super(par1World); + this.setSize(1.4F, 1.6F); + this.isImmuneToFire = false; + this.setChested(false); + this.getNavigator().setAvoidsWater(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.2D)); + this.tasks.addTask(1, new EntityAIRunAroundLikeCrazy(this, 1.2D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWander(this, 0.7D)); + this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.func_110226_cD(); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Integer.valueOf(0)); + this.dataWatcher.addObject(19, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(20, Integer.valueOf(0)); + this.dataWatcher.addObject(21, String.valueOf("")); + this.dataWatcher.addObject(22, Integer.valueOf(0)); + } + + public void setHorseType(int par1) + { + this.dataWatcher.updateObject(19, Byte.valueOf((byte)par1)); + this.func_110230_cF(); + } + + /** + * returns the horse type + */ + public int getHorseType() + { + return this.dataWatcher.getWatchableObjectByte(19); + } + + public void setHorseVariant(int par1) + { + this.dataWatcher.updateObject(20, Integer.valueOf(par1)); + this.func_110230_cF(); + } + + public int getHorseVariant() + { + return this.dataWatcher.getWatchableObjectInt(20); + } + + /** + * Gets the username of the entity. + */ + public String getEntityName() + { + if (this.hasCustomNameTag()) + { + return this.getCustomNameTag(); + } + else + { + int var1 = this.getHorseType(); + + switch (var1) + { + case 0: + default: + return StatCollector.translateToLocal("entity.horse.name"); + + case 1: + return StatCollector.translateToLocal("entity.donkey.name"); + + case 2: + return StatCollector.translateToLocal("entity.mule.name"); + + case 3: + return StatCollector.translateToLocal("entity.zombiehorse.name"); + + case 4: + return StatCollector.translateToLocal("entity.skeletonhorse.name"); + } + } + } + + private boolean getHorseWatchableBoolean(int par1) + { + return (this.dataWatcher.getWatchableObjectInt(16) & par1) != 0; + } + + private void setHorseWatchableBoolean(int par1, boolean par2) + { + int var3 = this.dataWatcher.getWatchableObjectInt(16); + + if (par2) + { + this.dataWatcher.updateObject(16, Integer.valueOf(var3 | par1)); + } + else + { + this.dataWatcher.updateObject(16, Integer.valueOf(var3 & ~par1)); + } + } + + public boolean isAdultHorse() + { + return !this.isChild(); + } + + public boolean isTame() + { + return this.getHorseWatchableBoolean(2); + } + + public boolean func_110253_bW() + { + return this.isAdultHorse(); + } + + public String getOwnerName() + { + return this.dataWatcher.getWatchableObjectString(21); + } + + public void setOwnerName(String par1Str) + { + this.dataWatcher.updateObject(21, par1Str); + } + + public float getHorseSize() + { + int var1 = this.getGrowingAge(); + return var1 >= 0 ? 1.0F : 0.5F + (float)(-24000 - var1) / -24000.0F * 0.5F; + } + + /** + * "Sets the scale for an ageable entity according to the boolean parameter, which says if it's a child." + */ + public void setScaleForAge(boolean par1) + { + if (par1) + { + this.setScale(this.getHorseSize()); + } + else + { + this.setScale(1.0F); + } + } + + public boolean isHorseJumping() + { + return this.horseJumping; + } + + public void setHorseTamed(boolean par1) + { + this.setHorseWatchableBoolean(2, par1); + } + + public void setHorseJumping(boolean par1) + { + this.horseJumping = par1; + } + + public boolean allowLeashing() + { + return !this.func_110256_cu() && super.allowLeashing(); + } + + protected void func_142017_o(float par1) + { + if (par1 > 6.0F && this.isEatingHaystack()) + { + this.setEatingHaystack(false); + } + } + + public boolean isChested() + { + return this.getHorseWatchableBoolean(8); + } + + public int func_110241_cb() + { + return this.dataWatcher.getWatchableObjectInt(22); + } + + /** + * 0 = iron, 1 = gold, 2 = diamond + */ + public int getHorseArmorIndex(ItemStack par1ItemStack) + { + return par1ItemStack == null ? 0 : (par1ItemStack.itemID == Item.horseArmorIron.itemID ? 1 : (par1ItemStack.itemID == Item.horseArmorGold.itemID ? 2 : (par1ItemStack.itemID == Item.horseArmorDiamond.itemID ? 3 : 0))); + } + + public boolean isEatingHaystack() + { + return this.getHorseWatchableBoolean(32); + } + + public boolean isRearing() + { + return this.getHorseWatchableBoolean(64); + } + + public boolean func_110205_ce() + { + return this.getHorseWatchableBoolean(16); + } + + public boolean getHasReproduced() + { + return this.hasReproduced; + } + + public void func_110236_r(int par1) + { + this.dataWatcher.updateObject(22, Integer.valueOf(par1)); + this.func_110230_cF(); + } + + public void func_110242_l(boolean par1) + { + this.setHorseWatchableBoolean(16, par1); + } + + public void setChested(boolean par1) + { + this.setHorseWatchableBoolean(8, par1); + } + + public void setHasReproduced(boolean par1) + { + this.hasReproduced = par1; + } + + public void setHorseSaddled(boolean par1) + { + this.setHorseWatchableBoolean(4, par1); + } + + public int getTemper() + { + return this.temper; + } + + public void setTemper(int par1) + { + this.temper = par1; + } + + public int increaseTemper(int par1) + { + int var2 = MathHelper.clamp_int(this.getTemper() + par1, 0, this.getMaxTemper()); + this.setTemper(var2); + return var2; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + Entity var3 = par1DamageSource.getEntity(); + return this.riddenByEntity != null && this.riddenByEntity.equals(var3) ? false : super.attackEntityFrom(par1DamageSource, par2); + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + return armorValues[this.func_110241_cb()]; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return this.riddenByEntity == null; + } + + public boolean prepareChunkForSpawn() + { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.posZ); + this.worldObj.getBiomeGenForCoords(var1, var2); + return true; + } + + public void dropChests() + { + if (!this.worldObj.isRemote && this.isChested()) + { + this.dropItem(Block.chest.blockID, 1); + this.setChested(false); + } + } + + private void func_110266_cB() + { + this.openHorseMouth(); + this.worldObj.playSoundAtEntity(this, "eating", 1.0F, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) + { + if (par1 > 1.0F) + { + this.playSound("mob.horse.land", 0.4F, 1.0F); + } + + int var2 = MathHelper.ceiling_float_int(par1 * 0.5F - 3.0F); + + if (var2 > 0) + { + this.attackEntityFrom(DamageSource.fall, (float)var2); + + if (this.riddenByEntity != null) + { + this.riddenByEntity.attackEntityFrom(DamageSource.fall, (float)var2); + } + + int var3 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY - 0.2D - (double)this.prevRotationYaw), MathHelper.floor_double(this.posZ)); + + if (var3 > 0) + { + StepSound var4 = Block.blocksList[var3].stepSound; + this.worldObj.playSoundAtEntity(this, var4.getStepSound(), var4.getVolume() * 0.5F, var4.getPitch() * 0.75F); + } + } + } + + private int func_110225_cC() + { + int var1 = this.getHorseType(); + return this.isChested() && (var1 == 1 || var1 == 2) ? 17 : 2; + } + + private void func_110226_cD() + { + AnimalChest var1 = this.horseChest; + this.horseChest = new AnimalChest("HorseChest", this.func_110225_cC()); + this.horseChest.func_110133_a(this.getEntityName()); + + if (var1 != null) + { + var1.func_110132_b(this); + int var2 = Math.min(var1.getSizeInventory(), this.horseChest.getSizeInventory()); + + for (int var3 = 0; var3 < var2; ++var3) + { + ItemStack var4 = var1.getStackInSlot(var3); + + if (var4 != null) + { + this.horseChest.setInventorySlotContents(var3, var4.copy()); + } + } + + var1 = null; + } + + this.horseChest.func_110134_a(this); + this.func_110232_cE(); + } + + private void func_110232_cE() + { + if (!this.worldObj.isRemote) + { + this.setHorseSaddled(this.horseChest.getStackInSlot(0) != null); + + if (this.func_110259_cr()) + { + this.func_110236_r(this.getHorseArmorIndex(this.horseChest.getStackInSlot(1))); + } + } + } + + /** + * Called by InventoryBasic.onInventoryChanged() on a array that is never filled. + */ + public void onInventoryChanged(InventoryBasic par1InventoryBasic) + { + int var2 = this.func_110241_cb(); + boolean var3 = this.isHorseSaddled(); + this.func_110232_cE(); + + if (this.ticksExisted > 20) + { + if (var2 == 0 && var2 != this.func_110241_cb()) + { + this.playSound("mob.horse.armor", 0.5F, 1.0F); + } + + if (!var3 && this.isHorseSaddled()) + { + this.playSound("mob.horse.leather", 0.5F, 1.0F); + } + } + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + this.prepareChunkForSpawn(); + return super.getCanSpawnHere(); + } + + protected EntityHorse getClosestHorse(Entity par1Entity, double par2) + { + double var4 = Double.MAX_VALUE; + Entity var6 = null; + List var7 = this.worldObj.getEntitiesWithinAABBExcludingEntity(par1Entity, par1Entity.boundingBox.addCoord(par2, par2, par2), horseBreedingSelector); + Iterator var8 = var7.iterator(); + + while (var8.hasNext()) + { + Entity var9 = (Entity)var8.next(); + double var10 = var9.getDistanceSq(par1Entity.posX, par1Entity.posY, par1Entity.posZ); + + if (var10 < var4) + { + var6 = var9; + var4 = var10; + } + } + + return (EntityHorse)var6; + } + + public double getHorseJumpStrength() + { + return this.getEntityAttribute(horseJumpStrength).getAttributeValue(); + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + this.openHorseMouth(); + int var1 = this.getHorseType(); + return var1 == 3 ? "mob.horse.zombie.death" : (var1 == 4 ? "mob.horse.skeleton.death" : (var1 != 1 && var1 != 2 ? "mob.horse.death" : "mob.horse.donkey.death")); + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + boolean var1 = this.rand.nextInt(4) == 0; + int var2 = this.getHorseType(); + return var2 == 4 ? Item.bone.itemID : (var2 == 3 ? (var1 ? 0 : Item.rottenFlesh.itemID) : Item.leather.itemID); + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + this.openHorseMouth(); + + if (this.rand.nextInt(3) == 0) + { + this.makeHorseRear(); + } + + int var1 = this.getHorseType(); + return var1 == 3 ? "mob.horse.zombie.hit" : (var1 == 4 ? "mob.horse.skeleton.hit" : (var1 != 1 && var1 != 2 ? "mob.horse.hit" : "mob.horse.donkey.hit")); + } + + public boolean isHorseSaddled() + { + return this.getHorseWatchableBoolean(4); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + this.openHorseMouth(); + + if (this.rand.nextInt(10) == 0 && !this.isMovementBlocked()) + { + this.makeHorseRear(); + } + + int var1 = this.getHorseType(); + return var1 == 3 ? "mob.horse.zombie.idle" : (var1 == 4 ? "mob.horse.skeleton.idle" : (var1 != 1 && var1 != 2 ? "mob.horse.idle" : "mob.horse.donkey.idle")); + } + + protected String getAngrySoundName() + { + this.openHorseMouth(); + this.makeHorseRear(); + int var1 = this.getHorseType(); + return var1 != 3 && var1 != 4 ? (var1 != 1 && var1 != 2 ? "mob.horse.angry" : "mob.horse.donkey.angry") : null; + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + StepSound var5 = Block.blocksList[par4].stepSound; + + if (this.worldObj.getBlockId(par1, par2 + 1, par3) == Block.snow.blockID) + { + var5 = Block.snow.stepSound; + } + + if (!Block.blocksList[par4].blockMaterial.isLiquid()) + { + int var6 = this.getHorseType(); + + if (this.riddenByEntity != null && var6 != 1 && var6 != 2) + { + ++this.field_110285_bP; + + if (this.field_110285_bP > 5 && this.field_110285_bP % 3 == 0) + { + this.playSound("mob.horse.gallop", var5.getVolume() * 0.15F, var5.getPitch()); + + if (var6 == 0 && this.rand.nextInt(10) == 0) + { + this.playSound("mob.horse.breathe", var5.getVolume() * 0.6F, var5.getPitch()); + } + } + else if (this.field_110285_bP <= 5) + { + this.playSound("mob.horse.wood", var5.getVolume() * 0.15F, var5.getPitch()); + } + } + else if (var5 == Block.soundWoodFootstep) + { + this.playSound("mob.horse.soft", var5.getVolume() * 0.15F, var5.getPitch()); + } + else + { + this.playSound("mob.horse.wood", var5.getVolume() * 0.15F, var5.getPitch()); + } + } + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getAttributeMap().func_111150_b(horseJumpStrength); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(53.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.22499999403953552D); + } + + /** + * Will return how many at most can spawn in a chunk at once. + */ + public int getMaxSpawnedInChunk() + { + return 6; + } + + public int getMaxTemper() + { + return 100; + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.8F; + } + + /** + * Get number of ticks, at least during which the living entity will be silent. + */ + public int getTalkInterval() + { + return 400; + } + + public boolean func_110239_cn() + { + return this.getHorseType() == 0 || this.func_110241_cb() > 0; + } + + private void func_110230_cF() + { + this.field_110286_bQ = null; + } + + private void setHorseTexturePaths() + { + this.field_110286_bQ = "horse/"; + this.field_110280_bR[0] = null; + this.field_110280_bR[1] = null; + this.field_110280_bR[2] = null; + int var1 = this.getHorseType(); + int var2 = this.getHorseVariant(); + int var3; + + if (var1 == 0) + { + var3 = var2 & 255; + int var4 = (var2 & 65280) >> 8; + this.field_110280_bR[0] = horseTextures[var3]; + this.field_110286_bQ = this.field_110286_bQ + field_110269_bA[var3]; + this.field_110280_bR[1] = horseMarkingTextures[var4]; + this.field_110286_bQ = this.field_110286_bQ + field_110292_bC[var4]; + } + else + { + this.field_110280_bR[0] = ""; + this.field_110286_bQ = this.field_110286_bQ + "_" + var1 + "_"; + } + + var3 = this.func_110241_cb(); + this.field_110280_bR[2] = horseArmorTextures[var3]; + this.field_110286_bQ = this.field_110286_bQ + field_110273_bx[var3]; + } + + public String getHorseTexture() + { + if (this.field_110286_bQ == null) + { + this.setHorseTexturePaths(); + } + + return this.field_110286_bQ; + } + + public String[] getVariantTexturePaths() + { + if (this.field_110286_bQ == null) + { + this.setHorseTexturePaths(); + } + + return this.field_110280_bR; + } + + public void openGUI(EntityPlayer par1EntityPlayer) + { + if (!this.worldObj.isRemote && (this.riddenByEntity == null || this.riddenByEntity == par1EntityPlayer) && this.isTame()) + { + this.horseChest.func_110133_a(this.getEntityName()); + par1EntityPlayer.displayGUIHorse(this, this.horseChest); + } + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + + if (var2 != null && var2.itemID == Item.monsterPlacer.itemID) + { + return super.interact(par1EntityPlayer); + } + else if (!this.isTame() && this.func_110256_cu()) + { + return false; + } + else if (this.isTame() && this.isAdultHorse() && par1EntityPlayer.isSneaking()) + { + this.openGUI(par1EntityPlayer); + return true; + } + else if (this.func_110253_bW() && this.riddenByEntity != null) + { + return super.interact(par1EntityPlayer); + } + else + { + if (var2 != null) + { + boolean var3 = false; + + if (this.func_110259_cr()) + { + byte var4 = -1; + + if (var2.itemID == Item.horseArmorIron.itemID) + { + var4 = 1; + } + else if (var2.itemID == Item.horseArmorGold.itemID) + { + var4 = 2; + } + else if (var2.itemID == Item.horseArmorDiamond.itemID) + { + var4 = 3; + } + + if (var4 >= 0) + { + if (!this.isTame()) + { + this.makeHorseRearWithSound(); + return true; + } + + this.openGUI(par1EntityPlayer); + return true; + } + } + + if (!var3 && !this.func_110256_cu()) + { + float var7 = 0.0F; + short var5 = 0; + byte var6 = 0; + + if (var2.itemID == Item.wheat.itemID) + { + var7 = 2.0F; + var5 = 60; + var6 = 3; + } + else if (var2.itemID == Item.sugar.itemID) + { + var7 = 1.0F; + var5 = 30; + var6 = 3; + } + else if (var2.itemID == Item.bread.itemID) + { + var7 = 7.0F; + var5 = 180; + var6 = 3; + } + else if (var2.itemID == Block.hay.blockID) + { + var7 = 20.0F; + var5 = 180; + } + else if (var2.itemID == Item.appleRed.itemID) + { + var7 = 3.0F; + var5 = 60; + var6 = 3; + } + else if (var2.itemID == Item.goldenCarrot.itemID) + { + var7 = 4.0F; + var5 = 60; + var6 = 5; + + if (this.isTame() && this.getGrowingAge() == 0) + { + var3 = true; + this.func_110196_bT(); + } + } + else if (var2.itemID == Item.appleGold.itemID) + { + var7 = 10.0F; + var5 = 240; + var6 = 10; + + if (this.isTame() && this.getGrowingAge() == 0) + { + var3 = true; + this.func_110196_bT(); + } + } + + if (this.getHealth() < this.getMaxHealth() && var7 > 0.0F) + { + this.heal(var7); + var3 = true; + } + + if (!this.isAdultHorse() && var5 > 0) + { + this.addGrowth(var5); + var3 = true; + } + + if (var6 > 0 && (var3 || !this.isTame()) && var6 < this.getMaxTemper()) + { + var3 = true; + this.increaseTemper(var6); + } + + if (var3) + { + this.func_110266_cB(); + } + } + + if (!this.isTame() && !var3) + { + if (var2 != null && var2.func_111282_a(par1EntityPlayer, this)) + { + return true; + } + + this.makeHorseRearWithSound(); + return true; + } + + if (!var3 && this.func_110229_cs() && !this.isChested() && var2.itemID == Block.chest.blockID) + { + this.setChested(true); + this.playSound("mob.chickenplop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + var3 = true; + this.func_110226_cD(); + } + + if (!var3 && this.func_110253_bW() && !this.isHorseSaddled() && var2.itemID == Item.saddle.itemID) + { + this.openGUI(par1EntityPlayer); + return true; + } + + if (var3) + { + if (!par1EntityPlayer.capabilities.isCreativeMode && --var2.stackSize == 0) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); + } + + return true; + } + } + + if (this.func_110253_bW() && this.riddenByEntity == null) + { + if (var2 != null && var2.func_111282_a(par1EntityPlayer, this)) + { + return true; + } + else + { + this.func_110237_h(par1EntityPlayer); + return true; + } + } + else + { + return super.interact(par1EntityPlayer); + } + } + } + + private void func_110237_h(EntityPlayer par1EntityPlayer) + { + par1EntityPlayer.rotationYaw = this.rotationYaw; + par1EntityPlayer.rotationPitch = this.rotationPitch; + this.setEatingHaystack(false); + this.setRearing(false); + + if (!this.worldObj.isRemote) + { + par1EntityPlayer.mountEntity(this); + } + } + + public boolean func_110259_cr() + { + return this.getHorseType() == 0; + } + + public boolean func_110229_cs() + { + int var1 = this.getHorseType(); + return var1 == 2 || var1 == 1; + } + + /** + * Dead and sleeping entities cannot move + */ + protected boolean isMovementBlocked() + { + return this.riddenByEntity != null && this.isHorseSaddled() ? true : this.isEatingHaystack() || this.isRearing(); + } + + public boolean func_110256_cu() + { + int var1 = this.getHorseType(); + return var1 == 3 || var1 == 4; + } + + public boolean func_110222_cv() + { + return this.func_110256_cu() || this.getHorseType() == 2; + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack par1ItemStack) + { + return false; + } + + private void func_110210_cH() + { + this.field_110278_bp = 1; + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource par1DamageSource) + { + super.onDeath(par1DamageSource); + + if (!this.worldObj.isRemote) + { + this.dropChestItems(); + } + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.rand.nextInt(200) == 0) + { + this.func_110210_cH(); + } + + super.onLivingUpdate(); + + if (!this.worldObj.isRemote) + { + if (this.rand.nextInt(900) == 0 && this.deathTime == 0) + { + this.heal(1.0F); + } + + if (!this.isEatingHaystack() && this.riddenByEntity == null && this.rand.nextInt(300) == 0 && this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) - 1, MathHelper.floor_double(this.posZ)) == Block.grass.blockID) + { + this.setEatingHaystack(true); + } + + if (this.isEatingHaystack() && ++this.eatingHaystackCounter > 50) + { + this.eatingHaystackCounter = 0; + this.setEatingHaystack(false); + } + + if (this.func_110205_ce() && !this.isAdultHorse() && !this.isEatingHaystack()) + { + EntityHorse var1 = this.getClosestHorse(this, 16.0D); + + if (var1 != null && this.getDistanceSqToEntity(var1) > 4.0D) + { + PathEntity var2 = this.worldObj.getPathEntityToEntity(this, var1, 16.0F, true, false, false, true); + this.setPathToEntity(var2); + } + } + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.worldObj.isRemote && this.dataWatcher.hasChanges()) + { + this.dataWatcher.func_111144_e(); + this.func_110230_cF(); + } + + if (this.openMouthCounter > 0 && ++this.openMouthCounter > 30) + { + this.openMouthCounter = 0; + this.setHorseWatchableBoolean(128, false); + } + + if (!this.worldObj.isRemote && this.jumpRearingCounter > 0 && ++this.jumpRearingCounter > 20) + { + this.jumpRearingCounter = 0; + this.setRearing(false); + } + + if (this.field_110278_bp > 0 && ++this.field_110278_bp > 8) + { + this.field_110278_bp = 0; + } + + if (this.field_110279_bq > 0) + { + ++this.field_110279_bq; + + if (this.field_110279_bq > 300) + { + this.field_110279_bq = 0; + } + } + + this.prevHeadLean = this.headLean; + + if (this.isEatingHaystack()) + { + this.headLean += (1.0F - this.headLean) * 0.4F + 0.05F; + + if (this.headLean > 1.0F) + { + this.headLean = 1.0F; + } + } + else + { + this.headLean += (0.0F - this.headLean) * 0.4F - 0.05F; + + if (this.headLean < 0.0F) + { + this.headLean = 0.0F; + } + } + + this.prevRearingAmount = this.rearingAmount; + + if (this.isRearing()) + { + this.prevHeadLean = this.headLean = 0.0F; + this.rearingAmount += (1.0F - this.rearingAmount) * 0.4F + 0.05F; + + if (this.rearingAmount > 1.0F) + { + this.rearingAmount = 1.0F; + } + } + else + { + this.field_110294_bI = false; + this.rearingAmount += (0.8F * this.rearingAmount * this.rearingAmount * this.rearingAmount - this.rearingAmount) * 0.6F - 0.05F; + + if (this.rearingAmount < 0.0F) + { + this.rearingAmount = 0.0F; + } + } + + this.prevMouthOpenness = this.mouthOpenness; + + if (this.getHorseWatchableBoolean(128)) + { + this.mouthOpenness += (1.0F - this.mouthOpenness) * 0.7F + 0.05F; + + if (this.mouthOpenness > 1.0F) + { + this.mouthOpenness = 1.0F; + } + } + else + { + this.mouthOpenness += (0.0F - this.mouthOpenness) * 0.7F - 0.05F; + + if (this.mouthOpenness < 0.0F) + { + this.mouthOpenness = 0.0F; + } + } + } + + private void openHorseMouth() + { + if (!this.worldObj.isRemote) + { + this.openMouthCounter = 1; + this.setHorseWatchableBoolean(128, true); + } + } + + private boolean func_110200_cJ() + { + return this.riddenByEntity == null && this.ridingEntity == null && this.isTame() && this.isAdultHorse() && !this.func_110222_cv() && this.getHealth() >= this.getMaxHealth(); + } + + public void setEating(boolean par1) + { + this.setHorseWatchableBoolean(32, par1); + } + + public void setEatingHaystack(boolean par1) + { + this.setEating(par1); + } + + public void setRearing(boolean par1) + { + if (par1) + { + this.setEatingHaystack(false); + } + + this.setHorseWatchableBoolean(64, par1); + } + + private void makeHorseRear() + { + if (!this.worldObj.isRemote) + { + this.jumpRearingCounter = 1; + this.setRearing(true); + } + } + + public void makeHorseRearWithSound() + { + this.makeHorseRear(); + String var1 = this.getAngrySoundName(); + + if (var1 != null) + { + this.playSound(var1, this.getSoundVolume(), this.getSoundPitch()); + } + } + + public void dropChestItems() + { + this.dropItemsInChest(this, this.horseChest); + this.dropChests(); + } + + private void dropItemsInChest(Entity par1Entity, AnimalChest par2AnimalChest) + { + if (par2AnimalChest != null && !this.worldObj.isRemote) + { + for (int var3 = 0; var3 < par2AnimalChest.getSizeInventory(); ++var3) + { + ItemStack var4 = par2AnimalChest.getStackInSlot(var3); + + if (var4 != null) + { + this.entityDropItem(var4, 0.0F); + } + } + } + } + + public boolean setTamedBy(EntityPlayer par1EntityPlayer) + { + this.setOwnerName(par1EntityPlayer.getCommandSenderName()); + this.setHorseTamed(true); + return true; + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float par1, float par2) + { + if (this.riddenByEntity != null && this.isHorseSaddled()) + { + this.prevRotationYaw = this.rotationYaw = this.riddenByEntity.rotationYaw; + this.rotationPitch = this.riddenByEntity.rotationPitch * 0.5F; + this.setRotation(this.rotationYaw, this.rotationPitch); + this.rotationYawHead = this.renderYawOffset = this.rotationYaw; + par1 = ((EntityLivingBase)this.riddenByEntity).moveStrafing * 0.5F; + par2 = ((EntityLivingBase)this.riddenByEntity).moveForward; + + if (par2 <= 0.0F) + { + par2 *= 0.25F; + this.field_110285_bP = 0; + } + + if (this.onGround && this.jumpPower == 0.0F && this.isRearing() && !this.field_110294_bI) + { + par1 = 0.0F; + par2 = 0.0F; + } + + if (this.jumpPower > 0.0F && !this.isHorseJumping() && this.onGround) + { + this.motionY = this.getHorseJumpStrength() * (double)this.jumpPower; + + if (this.isPotionActive(Potion.jump)) + { + this.motionY += (double)((float)(this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F); + } + + this.setHorseJumping(true); + this.isAirBorne = true; + + if (par2 > 0.0F) + { + float var3 = MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F); + float var4 = MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F); + this.motionX += (double)(-0.4F * var3 * this.jumpPower); + this.motionZ += (double)(0.4F * var4 * this.jumpPower); + this.playSound("mob.horse.jump", 0.4F, 1.0F); + } + + this.jumpPower = 0.0F; + } + + this.stepHeight = 1.0F; + this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F; + + if (!this.worldObj.isRemote) + { + this.setAIMoveSpeed((float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue()); + super.moveEntityWithHeading(par1, par2); + } + + if (this.onGround) + { + this.jumpPower = 0.0F; + this.setHorseJumping(false); + } + + this.prevLimbSwingAmount = this.limbSwingAmount; + double var8 = this.posX - this.prevPosX; + double var5 = this.posZ - this.prevPosZ; + float var7 = MathHelper.sqrt_double(var8 * var8 + var5 * var5) * 4.0F; + + if (var7 > 1.0F) + { + var7 = 1.0F; + } + + this.limbSwingAmount += (var7 - this.limbSwingAmount) * 0.4F; + this.limbSwing += this.limbSwingAmount; + } + else + { + this.stepHeight = 0.5F; + this.jumpMovementFactor = 0.02F; + super.moveEntityWithHeading(par1, par2); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("EatingHaystack", this.isEatingHaystack()); + par1NBTTagCompound.setBoolean("ChestedHorse", this.isChested()); + par1NBTTagCompound.setBoolean("HasReproduced", this.getHasReproduced()); + par1NBTTagCompound.setBoolean("Bred", this.func_110205_ce()); + par1NBTTagCompound.setInteger("Type", this.getHorseType()); + par1NBTTagCompound.setInteger("Variant", this.getHorseVariant()); + par1NBTTagCompound.setInteger("Temper", this.getTemper()); + par1NBTTagCompound.setBoolean("Tame", this.isTame()); + par1NBTTagCompound.setString("OwnerName", this.getOwnerName()); + + if (this.isChested()) + { + NBTTagList var2 = new NBTTagList(); + + for (int var3 = 2; var3 < this.horseChest.getSizeInventory(); ++var3) + { + ItemStack var4 = this.horseChest.getStackInSlot(var3); + + if (var4 != null) + { + NBTTagCompound var5 = new NBTTagCompound(); + var5.setByte("Slot", (byte)var3); + var4.writeToNBT(var5); + var2.appendTag(var5); + } + } + + par1NBTTagCompound.setTag("Items", var2); + } + + if (this.horseChest.getStackInSlot(1) != null) + { + par1NBTTagCompound.setTag("ArmorItem", this.horseChest.getStackInSlot(1).writeToNBT(new NBTTagCompound("ArmorItem"))); + } + + if (this.horseChest.getStackInSlot(0) != null) + { + par1NBTTagCompound.setTag("SaddleItem", this.horseChest.getStackInSlot(0).writeToNBT(new NBTTagCompound("SaddleItem"))); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.setEatingHaystack(par1NBTTagCompound.getBoolean("EatingHaystack")); + this.func_110242_l(par1NBTTagCompound.getBoolean("Bred")); + this.setChested(par1NBTTagCompound.getBoolean("ChestedHorse")); + this.setHasReproduced(par1NBTTagCompound.getBoolean("HasReproduced")); + this.setHorseType(par1NBTTagCompound.getInteger("Type")); + this.setHorseVariant(par1NBTTagCompound.getInteger("Variant")); + this.setTemper(par1NBTTagCompound.getInteger("Temper")); + this.setHorseTamed(par1NBTTagCompound.getBoolean("Tame")); + + if (par1NBTTagCompound.hasKey("OwnerName")) + { + this.setOwnerName(par1NBTTagCompound.getString("OwnerName")); + } + + AttributeInstance var2 = this.getAttributeMap().getAttributeInstanceByName("Speed"); + + if (var2 != null) + { + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(var2.getBaseValue() * 0.25D); + } + + if (this.isChested()) + { + NBTTagList var3 = par1NBTTagCompound.getTagList("Items"); + this.func_110226_cD(); + + for (int var4 = 0; var4 < var3.tagCount(); ++var4) + { + NBTTagCompound var5 = (NBTTagCompound)var3.tagAt(var4); + int var6 = var5.getByte("Slot") & 255; + + if (var6 >= 2 && var6 < this.horseChest.getSizeInventory()) + { + this.horseChest.setInventorySlotContents(var6, ItemStack.loadItemStackFromNBT(var5)); + } + } + } + + ItemStack var7; + + if (par1NBTTagCompound.hasKey("ArmorItem")) + { + var7 = ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("ArmorItem")); + + if (var7 != null && func_110211_v(var7.itemID)) + { + this.horseChest.setInventorySlotContents(1, var7); + } + } + + if (par1NBTTagCompound.hasKey("SaddleItem")) + { + var7 = ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("SaddleItem")); + + if (var7 != null && var7.itemID == Item.saddle.itemID) + { + this.horseChest.setInventorySlotContents(0, var7); + } + } + else if (par1NBTTagCompound.getBoolean("Saddle")) + { + this.horseChest.setInventorySlotContents(0, new ItemStack(Item.saddle)); + } + + this.func_110232_cE(); + } + + /** + * Returns true if the mob is currently able to mate with the specified mob. + */ + public boolean canMateWith(EntityAnimal par1EntityAnimal) + { + if (par1EntityAnimal == this) + { + return false; + } + else if (par1EntityAnimal.getClass() != this.getClass()) + { + return false; + } + else + { + EntityHorse var2 = (EntityHorse)par1EntityAnimal; + + if (this.func_110200_cJ() && var2.func_110200_cJ()) + { + int var3 = this.getHorseType(); + int var4 = var2.getHorseType(); + return var3 == var4 || var3 == 0 && var4 == 1 || var3 == 1 && var4 == 0; + } + else + { + return false; + } + } + } + + public EntityAgeable createChild(EntityAgeable par1EntityAgeable) + { + EntityHorse var2 = (EntityHorse)par1EntityAgeable; + EntityHorse var3 = new EntityHorse(this.worldObj); + int var4 = this.getHorseType(); + int var5 = var2.getHorseType(); + int var6 = 0; + + if (var4 == var5) + { + var6 = var4; + } + else if (var4 == 0 && var5 == 1 || var4 == 1 && var5 == 0) + { + var6 = 2; + } + + if (var6 == 0) + { + int var8 = this.rand.nextInt(9); + int var7; + + if (var8 < 4) + { + var7 = this.getHorseVariant() & 255; + } + else if (var8 < 8) + { + var7 = var2.getHorseVariant() & 255; + } + else + { + var7 = this.rand.nextInt(7); + } + + int var9 = this.rand.nextInt(5); + + if (var9 < 4) + { + var7 |= this.getHorseVariant() & 65280; + } + else if (var9 < 8) + { + var7 |= var2.getHorseVariant() & 65280; + } + else + { + var7 |= this.rand.nextInt(5) << 8 & 65280; + } + + var3.setHorseVariant(var7); + } + + var3.setHorseType(var6); + double var14 = this.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue() + par1EntityAgeable.getEntityAttribute(SharedMonsterAttributes.maxHealth).getBaseValue() + (double)this.func_110267_cL(); + var3.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(var14 / 3.0D); + double var13 = this.getEntityAttribute(horseJumpStrength).getBaseValue() + par1EntityAgeable.getEntityAttribute(horseJumpStrength).getBaseValue() + this.func_110245_cM(); + var3.getEntityAttribute(horseJumpStrength).setAttribute(var13 / 3.0D); + double var11 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getBaseValue() + par1EntityAgeable.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getBaseValue() + this.func_110203_cN(); + var3.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(var11 / 3.0D); + return var3; + } + + public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData) + { + Object par1EntityLivingData1 = super.onSpawnWithEgg(par1EntityLivingData); + boolean var2 = false; + int var3 = 0; + int var7; + + if (par1EntityLivingData1 instanceof EntityHorseGroupData) + { + var7 = ((EntityHorseGroupData)par1EntityLivingData1).field_111107_a; + var3 = ((EntityHorseGroupData)par1EntityLivingData1).field_111106_b & 255 | this.rand.nextInt(5) << 8; + } + else + { + if (this.rand.nextInt(10) == 0) + { + var7 = 1; + } + else + { + int var4 = this.rand.nextInt(7); + int var5 = this.rand.nextInt(5); + var7 = 0; + var3 = var4 | var5 << 8; + } + + par1EntityLivingData1 = new EntityHorseGroupData(var7, var3); + } + + this.setHorseType(var7); + this.setHorseVariant(var3); + + if (this.rand.nextInt(5) == 0) + { + this.setGrowingAge(-24000); + } + + if (var7 != 4 && var7 != 3) + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute((double)this.func_110267_cL()); + + if (var7 == 0) + { + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(this.func_110203_cN()); + } + else + { + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.17499999701976776D); + } + } + else + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(15.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.20000000298023224D); + } + + if (var7 != 2 && var7 != 1) + { + this.getEntityAttribute(horseJumpStrength).setAttribute(this.func_110245_cM()); + } + else + { + this.getEntityAttribute(horseJumpStrength).setAttribute(0.5D); + } + + this.setHealth(this.getMaxHealth()); + return (EntityLivingData)par1EntityLivingData1; + } + + public float getGrassEatingAmount(float par1) + { + return this.prevHeadLean + (this.headLean - this.prevHeadLean) * par1; + } + + public float getRearingAmount(float par1) + { + return this.prevRearingAmount + (this.rearingAmount - this.prevRearingAmount) * par1; + } + + public float func_110201_q(float par1) + { + return this.prevMouthOpenness + (this.mouthOpenness - this.prevMouthOpenness) * par1; + } + + /** + * Returns true if the newer Entity AI code should be run + */ + protected boolean isAIEnabled() + { + return true; + } + + public void setJumpPower(int par1) + { + if (this.isHorseSaddled()) + { + if (par1 < 0) + { + par1 = 0; + } + else + { + this.field_110294_bI = true; + this.makeHorseRear(); + } + + if (par1 >= 90) + { + this.jumpPower = 1.0F; + } + else + { + this.jumpPower = 0.4F + 0.4F * (float)par1 / 90.0F; + } + } + } + + /** + * "Spawns particles for the horse entity. par1 tells whether to spawn hearts. If it is false, it spawns smoke." + */ + protected void spawnHorseParticles(boolean par1) + { + String var2 = par1 ? "heart" : "smoke"; + + for (int var3 = 0; var3 < 7; ++var3) + { + double var4 = this.rand.nextGaussian() * 0.02D; + double var6 = this.rand.nextGaussian() * 0.02D; + double var8 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle(var2, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var4, var6, var8); + } + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 7) + { + this.spawnHorseParticles(true); + } + else if (par1 == 6) + { + this.spawnHorseParticles(false); + } + else + { + super.handleHealthUpdate(par1); + } + } + + public void updateRiderPosition() + { + super.updateRiderPosition(); + + if (this.prevRearingAmount > 0.0F) + { + float var1 = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F); + float var2 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F); + float var3 = 0.7F * this.prevRearingAmount; + float var4 = 0.15F * this.prevRearingAmount; + this.riddenByEntity.setPosition(this.posX + (double)(var3 * var1), this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset() + (double)var4, this.posZ - (double)(var3 * var2)); + + if (this.riddenByEntity instanceof EntityLivingBase) + { + ((EntityLivingBase)this.riddenByEntity).renderYawOffset = this.renderYawOffset; + } + } + } + + private float func_110267_cL() + { + return 15.0F + (float)this.rand.nextInt(8) + (float)this.rand.nextInt(9); + } + + private double func_110245_cM() + { + return 0.4000000059604645D + this.rand.nextDouble() * 0.2D + this.rand.nextDouble() * 0.2D + this.rand.nextDouble() * 0.2D; + } + + private double func_110203_cN() + { + return (0.44999998807907104D + this.rand.nextDouble() * 0.3D + this.rand.nextDouble() * 0.3D + this.rand.nextDouble() * 0.3D) * 0.25D; + } + + public static boolean func_110211_v(int par0) + { + return par0 == Item.horseArmorIron.itemID || par0 == Item.horseArmorGold.itemID || par0 == Item.horseArmorDiamond.itemID; + } + + /** + * returns true if this entity is by a ladder, false otherwise + */ + public boolean isOnLadder() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/EntityHorseBredSelector.java b/src/main/java/net/minecraft/src/EntityHorseBredSelector.java new file mode 100644 index 0000000..92b2a74 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityHorseBredSelector.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +final class EntityHorseBredSelector implements IEntitySelector +{ + /** + * Return whether the specified entity is applicable to this filter. + */ + public boolean isEntityApplicable(Entity par1Entity) + { + return par1Entity instanceof EntityHorse && ((EntityHorse)par1Entity).func_110205_ce(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityHorseGroupData.java b/src/main/java/net/minecraft/src/EntityHorseGroupData.java new file mode 100644 index 0000000..083f900 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityHorseGroupData.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +public class EntityHorseGroupData implements EntityLivingData +{ + public int field_111107_a; + public int field_111106_b; + + public EntityHorseGroupData(int par1, int par2) + { + this.field_111107_a = par1; + this.field_111106_b = par2; + } +} diff --git a/src/main/java/net/minecraft/src/EntityHugeExplodeFX.java b/src/main/java/net/minecraft/src/EntityHugeExplodeFX.java new file mode 100644 index 0000000..34dd5c7 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityHugeExplodeFX.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +public class EntityHugeExplodeFX extends EntityFX +{ + private int timeSinceStart; + + /** the maximum time for the explosion */ + private int maximumTime = 8; + + public EntityHugeExplodeFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {} + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + for (int var1 = 0; var1 < 6; ++var1) + { + double var2 = this.posX + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; + double var4 = this.posY + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; + double var6 = this.posZ + (this.rand.nextDouble() - this.rand.nextDouble()) * 4.0D; + this.worldObj.spawnParticle("largeexplode", var2, var4, var6, (double)((float)this.timeSinceStart / (float)this.maximumTime), 0.0D, 0.0D); + } + + ++this.timeSinceStart; + + if (this.timeSinceStart == this.maximumTime) + { + this.setDead(); + } + } + + public int getFXLayer() + { + return 1; + } +} diff --git a/src/main/java/net/minecraft/src/EntityIronGolem.java b/src/main/java/net/minecraft/src/EntityIronGolem.java new file mode 100644 index 0000000..04d2f0c --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityIronGolem.java @@ -0,0 +1,288 @@ +package net.minecraft.src; + +public class EntityIronGolem extends EntityGolem +{ + /** deincrements, and a distance-to-home check is done at 0 */ + private int homeCheckTimer; + Village villageObj; + private int attackTimer; + private int holdRoseTick; + + public EntityIronGolem(World par1World) + { + super(par1World); + this.setSize(1.4F, 2.9F); + this.getNavigator().setAvoidsWater(true); + this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); + this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); + this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); + this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); + this.tasks.addTask(5, new EntityAILookAtVillager(this)); + this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); + this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIDefendVillage(this)); + this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); + this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return true; + } + + /** + * main AI tick function, replaces updateEntityActionState + */ + protected void updateAITick() + { + if (--this.homeCheckTimer <= 0) + { + this.homeCheckTimer = 70 + this.rand.nextInt(50); + this.villageObj = this.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ), 32); + + if (this.villageObj == null) + { + this.detachHome(); + } + else + { + ChunkCoordinates var1 = this.villageObj.getCenter(); + this.setHomeArea(var1.posX, var1.posY, var1.posZ, (int)((float)this.villageObj.getVillageRadius() * 0.6F)); + } + } + + super.updateAITick(); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(100.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.25D); + } + + /** + * Decrements the entity's air supply when underwater + */ + protected int decreaseAirSupply(int par1) + { + return par1; + } + + protected void collideWithEntity(Entity par1Entity) + { + if (par1Entity instanceof IMob && this.getRNG().nextInt(20) == 0) + { + this.setAttackTarget((EntityLivingBase)par1Entity); + } + + super.collideWithEntity(par1Entity); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (this.attackTimer > 0) + { + --this.attackTimer; + } + + if (this.holdRoseTick > 0) + { + --this.holdRoseTick; + } + + if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D && this.rand.nextInt(5) == 0) + { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset); + int var3 = MathHelper.floor_double(this.posZ); + int var4 = this.worldObj.getBlockId(var1, var2, var3); + + if (var4 > 0) + { + this.worldObj.spawnParticle("tilecrack_" + var4 + "_" + this.worldObj.getBlockMetadata(var1, var2, var3), this.posX + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, this.boundingBox.minY + 0.1D, this.posZ + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, 4.0D * ((double)this.rand.nextFloat() - 0.5D), 0.5D, ((double)this.rand.nextFloat() - 0.5D) * 4.0D); + } + } + } + + /** + * Returns true if this entity can attack entities of the specified class. + */ + public boolean canAttackClass(Class par1Class) + { + return this.isPlayerCreated() && EntityPlayer.class.isAssignableFrom(par1Class) ? false : super.canAttackClass(par1Class); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("PlayerCreated", this.isPlayerCreated()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.setPlayerCreated(par1NBTTagCompound.getBoolean("PlayerCreated")); + } + + public boolean attackEntityAsMob(Entity par1Entity) + { + this.attackTimer = 10; + this.worldObj.setEntityState(this, (byte)4); + boolean var2 = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(7 + this.rand.nextInt(15))); + + if (var2) + { + par1Entity.motionY += 0.4000000059604645D; + } + + this.playSound("mob.irongolem.throw", 1.0F, 1.0F); + return var2; + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 4) + { + this.attackTimer = 10; + this.playSound("mob.irongolem.throw", 1.0F, 1.0F); + } + else if (par1 == 11) + { + this.holdRoseTick = 400; + } + else + { + super.handleHealthUpdate(par1); + } + } + + public Village getVillage() + { + return this.villageObj; + } + + public int getAttackTimer() + { + return this.attackTimer; + } + + public void setHoldingRose(boolean par1) + { + this.holdRoseTick = par1 ? 400 : 0; + this.worldObj.setEntityState(this, (byte)11); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "none"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.irongolem.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.irongolem.death"; + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + this.playSound("mob.irongolem.walk", 1.0F, 1.0F); + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.rand.nextInt(3); + int var4; + + for (var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Block.plantRed.blockID, 1); + } + + var4 = 3 + this.rand.nextInt(3); + + for (int var5 = 0; var5 < var4; ++var5) + { + this.dropItem(Item.ingotIron.itemID, 1); + } + } + + public int getHoldRoseTick() + { + return this.holdRoseTick; + } + + public boolean isPlayerCreated() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + public void setPlayerCreated(boolean par1) + { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + + if (par1) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -2))); + } + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource par1DamageSource) + { + if (!this.isPlayerCreated() && this.attackingPlayer != null && this.villageObj != null) + { + this.villageObj.setReputationForPlayer(this.attackingPlayer.getCommandSenderName(), -5); + } + + super.onDeath(par1DamageSource); + } +} diff --git a/src/main/java/net/minecraft/src/EntityItem.java b/src/main/java/net/minecraft/src/EntityItem.java new file mode 100644 index 0000000..dca2923 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityItem.java @@ -0,0 +1,383 @@ +package net.minecraft.src; + +import java.util.Iterator; + +public class EntityItem extends Entity +{ + /** + * The age of this EntityItem (used to animate it up and down as well as expire it) + */ + public int age; + public int delayBeforeCanPickup; + + /** The health of this EntityItem. (For example, damage for tools) */ + private int health; + + /** The EntityItem's random initial float height. */ + public float hoverStart; + + public EntityItem(World par1World, double par2, double par4, double par6) + { + super(par1World); + this.health = 5; + this.hoverStart = (float)(Math.random() * Math.PI * 2.0D); + this.setSize(0.25F, 0.25F); + this.yOffset = this.height / 2.0F; + this.setPosition(par2, par4, par6); + this.rotationYaw = (float)(Math.random() * 360.0D); + this.motionX = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D)); + this.motionY = 0.20000000298023224D; + this.motionZ = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D)); + } + + public EntityItem(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) + { + this(par1World, par2, par4, par6); + this.setEntityItemStack(par8ItemStack); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + public EntityItem(World par1World) + { + super(par1World); + this.health = 5; + this.hoverStart = (float)(Math.random() * Math.PI * 2.0D); + this.setSize(0.25F, 0.25F); + this.yOffset = this.height / 2.0F; + } + + protected void entityInit() + { + this.getDataWatcher().addObjectByDataType(10, 5); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.delayBeforeCanPickup > 0) + { + --this.delayBeforeCanPickup; + } + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= 0.03999999910593033D; + this.noClip = this.pushOutOfBlocks(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + boolean var1 = (int)this.prevPosX != (int)this.posX || (int)this.prevPosY != (int)this.posY || (int)this.prevPosZ != (int)this.posZ; + + if (var1 || this.ticksExisted % 25 == 0) + { + if (this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) == Material.lava) + { + this.motionY = 0.20000000298023224D; + this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F); + } + + if (!this.worldObj.isRemote) + { + this.searchForOtherItemsNearby(); + } + } + + float var2 = 0.98F; + + if (this.onGround) + { + var2 = 0.58800006F; + int var3 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + + if (var3 > 0) + { + var2 = Block.blocksList[var3].slipperiness * 0.98F; + } + } + + this.motionX *= (double)var2; + this.motionY *= 0.9800000190734863D; + this.motionZ *= (double)var2; + + if (this.onGround) + { + this.motionY *= -0.5D; + } + + ++this.age; + + if (!this.worldObj.isRemote && this.age >= 6000) + { + this.setDead(); + } + } + + /** + * Looks for other itemstacks nearby and tries to stack them together + */ + private void searchForOtherItemsNearby() + { + Iterator var1 = this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.5D, 0.0D, 0.5D)).iterator(); + + while (var1.hasNext()) + { + EntityItem var2 = (EntityItem)var1.next(); + this.combineItems(var2); + } + } + + /** + * Tries to merge this item with the item passed as the parameter. Returns true if successful. Either this item or + * the other item will be removed from the world. + */ + public boolean combineItems(EntityItem par1EntityItem) + { + if (par1EntityItem == this) + { + return false; + } + else if (par1EntityItem.isEntityAlive() && this.isEntityAlive()) + { + ItemStack var2 = this.getEntityItem(); + ItemStack var3 = par1EntityItem.getEntityItem(); + + if (var3.getItem() != var2.getItem()) + { + return false; + } + else if (var3.hasTagCompound() ^ var2.hasTagCompound()) + { + return false; + } + else if (var3.hasTagCompound() && !var3.getTagCompound().equals(var2.getTagCompound())) + { + return false; + } + else if (var3.getItem().getHasSubtypes() && var3.getItemDamage() != var2.getItemDamage()) + { + return false; + } + else if (var3.stackSize < var2.stackSize) + { + return par1EntityItem.combineItems(this); + } + else if (var3.stackSize + var2.stackSize > var3.getMaxStackSize()) + { + return false; + } + else + { + var3.stackSize += var2.stackSize; + par1EntityItem.delayBeforeCanPickup = Math.max(par1EntityItem.delayBeforeCanPickup, this.delayBeforeCanPickup); + par1EntityItem.age = Math.min(par1EntityItem.age, this.age); + par1EntityItem.setEntityItemStack(var3); + this.setDead(); + return true; + } + } + else + { + return false; + } + } + + /** + * sets the age of the item so that it'll despawn one minute after it has been dropped (instead of five). Used when + * items are dropped from players in creative mode + */ + public void setAgeToCreativeDespawnTime() + { + this.age = 4800; + } + + /** + * Returns if this entity is in water and will end up adding the waters velocity to the entity + */ + public boolean handleWaterMovement() + { + return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this); + } + + /** + * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args: + * amountDamage + */ + protected void dealFireDamage(int par1) + { + this.attackEntityFrom(DamageSource.inFire, (float)par1); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else if (this.getEntityItem() != null && this.getEntityItem().itemID == Item.netherStar.itemID && par1DamageSource.isExplosion()) + { + return false; + } + else + { + this.setBeenAttacked(); + this.health = (int)((float)this.health - par2); + + if (this.health <= 0) + { + this.setDead(); + } + + return false; + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setShort("Health", (short)((byte)this.health)); + par1NBTTagCompound.setShort("Age", (short)this.age); + + if (this.getEntityItem() != null) + { + par1NBTTagCompound.setCompoundTag("Item", this.getEntityItem().writeToNBT(new NBTTagCompound())); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.health = par1NBTTagCompound.getShort("Health") & 255; + this.age = par1NBTTagCompound.getShort("Age"); + NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("Item"); + this.setEntityItemStack(ItemStack.loadItemStackFromNBT(var2)); + + if (this.getEntityItem() == null) + { + this.setDead(); + } + } + + /** + * Called by a player entity when they collide with an entity + */ + public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) + { + if (!this.worldObj.isRemote) + { + ItemStack var2 = this.getEntityItem(); + int var3 = var2.stackSize; + + if (this.delayBeforeCanPickup == 0 && par1EntityPlayer.inventory.addItemStackToInventory(var2)) + { + if (var2.itemID == Block.wood.blockID) + { + par1EntityPlayer.triggerAchievement(AchievementList.mineWood); + } + + if (var2.itemID == Item.leather.itemID) + { + par1EntityPlayer.triggerAchievement(AchievementList.killCow); + } + + if (var2.itemID == Item.diamond.itemID) + { + par1EntityPlayer.triggerAchievement(AchievementList.diamonds); + } + + if (var2.itemID == Item.blazeRod.itemID) + { + par1EntityPlayer.triggerAchievement(AchievementList.blazeRod); + } + + this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + par1EntityPlayer.onItemPickup(this, var3); + + if (var2.stackSize <= 0) + { + this.setDead(); + } + } + } + } + + /** + * Gets the username of the entity. + */ + public String getEntityName() + { + return StatCollector.translateToLocal("item." + this.getEntityItem().getUnlocalizedName()); + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } + + /** + * Teleports the entity to another dimension. Params: Dimension number to teleport to + */ + public void travelToDimension(int par1) + { + super.travelToDimension(par1); + + if (!this.worldObj.isRemote) + { + this.searchForOtherItemsNearby(); + } + } + + /** + * Returns the ItemStack corresponding to the Entity (Note: if no item exists, will log an error but still return an + * ItemStack containing Block.stone) + */ + public ItemStack getEntityItem() + { + ItemStack var1 = this.getDataWatcher().getWatchableObjectItemStack(10); + + if (var1 == null) + { + if (this.worldObj != null) + { + this.worldObj.getWorldLogAgent().logSevere("Item entity " + this.entityId + " has no item?!"); + } + + return new ItemStack(Block.stone); + } + else + { + return var1; + } + } + + /** + * Sets the ItemStack for this entity + */ + public void setEntityItemStack(ItemStack par1ItemStack) + { + this.getDataWatcher().updateObject(10, par1ItemStack); + this.getDataWatcher().setObjectWatched(10); + } +} diff --git a/src/main/java/net/minecraft/src/EntityItemFrame.java b/src/main/java/net/minecraft/src/EntityItemFrame.java new file mode 100644 index 0000000..a1bee8e --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityItemFrame.java @@ -0,0 +1,180 @@ +package net.minecraft.src; + +public class EntityItemFrame extends EntityHanging +{ + /** Chance for this item frame's item to drop from the frame. */ + private float itemDropChance = 1.0F; + + public EntityItemFrame(World par1World) + { + super(par1World); + } + + public EntityItemFrame(World par1World, int par2, int par3, int par4, int par5) + { + super(par1World, par2, par3, par4, par5); + this.setDirection(par5); + } + + protected void entityInit() + { + this.getDataWatcher().addObjectByDataType(2, 5); + this.getDataWatcher().addObject(3, Byte.valueOf((byte)0)); + } + + public int getWidthPixels() + { + return 9; + } + + public int getHeightPixels() + { + return 9; + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double par1) + { + double var3 = 16.0D; + var3 *= 64.0D * this.renderDistanceWeight; + return par1 < var3 * var3; + } + + /** + * Called when this entity is broken. Entity parameter may be null. + */ + public void onBroken(Entity par1Entity) + { + ItemStack var2 = this.getDisplayedItem(); + + if (par1Entity instanceof EntityPlayer) + { + EntityPlayer var3 = (EntityPlayer)par1Entity; + + if (var3.capabilities.isCreativeMode) + { + this.removeFrameFromMap(var2); + return; + } + } + + this.entityDropItem(new ItemStack(Item.itemFrame), 0.0F); + + if (var2 != null && this.rand.nextFloat() < this.itemDropChance) + { + var2 = var2.copy(); + this.removeFrameFromMap(var2); + this.entityDropItem(var2, 0.0F); + } + } + + /** + * Removes the dot representing this frame's position from the map when the item frame is broken. + */ + private void removeFrameFromMap(ItemStack par1ItemStack) + { + if (par1ItemStack != null) + { + if (par1ItemStack.itemID == Item.map.itemID) + { + MapData var2 = ((ItemMap)par1ItemStack.getItem()).getMapData(par1ItemStack, this.worldObj); + var2.playersVisibleOnMap.remove("frame-" + this.entityId); + } + + par1ItemStack.setItemFrame((EntityItemFrame)null); + } + } + + public ItemStack getDisplayedItem() + { + return this.getDataWatcher().getWatchableObjectItemStack(2); + } + + public void setDisplayedItem(ItemStack par1ItemStack) + { + par1ItemStack = par1ItemStack.copy(); + par1ItemStack.stackSize = 1; + par1ItemStack.setItemFrame(this); + this.getDataWatcher().updateObject(2, par1ItemStack); + this.getDataWatcher().setObjectWatched(2); + } + + /** + * Return the rotation of the item currently on this frame. + */ + public int getRotation() + { + return this.getDataWatcher().getWatchableObjectByte(3); + } + + public void setItemRotation(int par1) + { + this.getDataWatcher().updateObject(3, Byte.valueOf((byte)(par1 % 4))); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + if (this.getDisplayedItem() != null) + { + par1NBTTagCompound.setCompoundTag("Item", this.getDisplayedItem().writeToNBT(new NBTTagCompound())); + par1NBTTagCompound.setByte("ItemRotation", (byte)this.getRotation()); + par1NBTTagCompound.setFloat("ItemDropChance", this.itemDropChance); + } + + super.writeEntityToNBT(par1NBTTagCompound); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("Item"); + + if (var2 != null && !var2.hasNoTags()) + { + this.setDisplayedItem(ItemStack.loadItemStackFromNBT(var2)); + this.setItemRotation(par1NBTTagCompound.getByte("ItemRotation")); + + if (par1NBTTagCompound.hasKey("ItemDropChance")) + { + this.itemDropChance = par1NBTTagCompound.getFloat("ItemDropChance"); + } + } + + super.readEntityFromNBT(par1NBTTagCompound); + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer par1EntityPlayer) + { + if (this.getDisplayedItem() == null) + { + ItemStack var2 = par1EntityPlayer.getHeldItem(); + + if (var2 != null && !this.worldObj.isRemote) + { + this.setDisplayedItem(var2); + + if (!par1EntityPlayer.capabilities.isCreativeMode && --var2.stackSize <= 0) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); + } + } + } + else if (!this.worldObj.isRemote) + { + this.setItemRotation(this.getRotation() + 1); + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/EntityJumpHelper.java b/src/main/java/net/minecraft/src/EntityJumpHelper.java new file mode 100644 index 0000000..6cd3354 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityJumpHelper.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +public class EntityJumpHelper +{ + private EntityLiving entity; + private boolean isJumping; + + public EntityJumpHelper(EntityLiving par1EntityLiving) + { + this.entity = par1EntityLiving; + } + + public void setJumping() + { + this.isJumping = true; + } + + /** + * Called to actually make the entity jump if isJumping is true. + */ + public void doJump() + { + this.entity.setJumping(this.isJumping); + this.isJumping = false; + } +} diff --git a/src/main/java/net/minecraft/src/EntityLargeExplodeFX.java b/src/main/java/net/minecraft/src/EntityLargeExplodeFX.java new file mode 100644 index 0000000..e1e1425 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityLargeExplodeFX.java @@ -0,0 +1,81 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class EntityLargeExplodeFX extends EntityFX +{ + private static final ResourceLocation field_110127_a = new ResourceLocation("textures/entity/explosion.png"); + private int field_70581_a; + private int field_70584_aq; + + /** The Rendering Engine. */ + private TextureManager theRenderEngine; + private float field_70582_as; + + public EntityLargeExplodeFX(TextureManager par1TextureManager, World par2World, double par3, double par5, double par7, double par9, double par11, double par13) + { + super(par2World, par3, par5, par7, 0.0D, 0.0D, 0.0D); + this.theRenderEngine = par1TextureManager; + this.field_70584_aq = 6 + this.rand.nextInt(4); + this.particleRed = this.particleGreen = this.particleBlue = this.rand.nextFloat() * 0.6F + 0.4F; + this.field_70582_as = 1.0F - (float)par9 * 0.5F; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + int var8 = (int)(((float)this.field_70581_a + par2) * 15.0F / (float)this.field_70584_aq); + + if (var8 <= 15) + { + this.theRenderEngine.bindTexture(field_110127_a); + float var9 = (float)(var8 % 4) / 4.0F; + float var10 = var9 + 0.24975F; + float var11 = (float)(var8 / 4) / 4.0F; + float var12 = var11 + 0.24975F; + float var13 = 2.0F * this.field_70582_as; + float var14 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX); + float var15 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY); + float var16 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + RenderHelper.disableStandardItemLighting(); + par1Tessellator.startDrawingQuads(); + par1Tessellator.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, 1.0F); + par1Tessellator.setNormal(0.0F, 1.0F, 0.0F); + par1Tessellator.setBrightness(240); + par1Tessellator.addVertexWithUV((double)(var14 - par3 * var13 - par6 * var13), (double)(var15 - par4 * var13), (double)(var16 - par5 * var13 - par7 * var13), (double)var10, (double)var12); + par1Tessellator.addVertexWithUV((double)(var14 - par3 * var13 + par6 * var13), (double)(var15 + par4 * var13), (double)(var16 - par5 * var13 + par7 * var13), (double)var10, (double)var11); + par1Tessellator.addVertexWithUV((double)(var14 + par3 * var13 + par6 * var13), (double)(var15 + par4 * var13), (double)(var16 + par5 * var13 + par7 * var13), (double)var9, (double)var11); + par1Tessellator.addVertexWithUV((double)(var14 + par3 * var13 - par6 * var13), (double)(var15 - par4 * var13), (double)(var16 + par5 * var13 - par7 * var13), (double)var9, (double)var12); + par1Tessellator.draw(); + GL11.glPolygonOffset(0.0F, 0.0F); + GL11.glEnable(GL11.GL_LIGHTING); + } + } + + public int getBrightnessForRender(float par1) + { + return 61680; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + ++this.field_70581_a; + + if (this.field_70581_a == this.field_70584_aq) + { + this.setDead(); + } + } + + public int getFXLayer() + { + return 3; + } +} diff --git a/src/main/java/net/minecraft/src/EntityLargeFireball.java b/src/main/java/net/minecraft/src/EntityLargeFireball.java new file mode 100644 index 0000000..6b8bc5a --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityLargeFireball.java @@ -0,0 +1,60 @@ +package net.minecraft.src; + +public class EntityLargeFireball extends EntityFireball +{ + public int field_92057_e = 1; + + public EntityLargeFireball(World par1World) + { + super(par1World); + } + + public EntityLargeFireball(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, par8, par10, par12); + } + + public EntityLargeFireball(World par1World, EntityLivingBase par2EntityLivingBase, double par3, double par5, double par7) + { + super(par1World, par2EntityLivingBase, par3, par5, par7); + } + + /** + * Called when this EntityFireball hits a block or entity. + */ + protected void onImpact(MovingObjectPosition par1MovingObjectPosition) + { + if (!this.worldObj.isRemote) + { + if (par1MovingObjectPosition.entityHit != null) + { + par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 6.0F); + } + + this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, (float)this.field_92057_e, true, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); + this.setDead(); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("ExplosionPower", this.field_92057_e); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + + if (par1NBTTagCompound.hasKey("ExplosionPower")) + { + this.field_92057_e = par1NBTTagCompound.getInteger("ExplosionPower"); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityLavaFX.java b/src/main/java/net/minecraft/src/EntityLavaFX.java new file mode 100644 index 0000000..ac01866 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityLavaFX.java @@ -0,0 +1,90 @@ +package net.minecraft.src; + +public class EntityLavaFX extends EntityFX +{ + private float lavaParticleScale; + + public EntityLavaFX(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.800000011920929D; + this.motionY *= 0.800000011920929D; + this.motionZ *= 0.800000011920929D; + this.motionY = (double)(this.rand.nextFloat() * 0.4F + 0.05F); + this.particleRed = this.particleGreen = this.particleBlue = 1.0F; + this.particleScale *= this.rand.nextFloat() * 2.0F + 0.2F; + this.lavaParticleScale = this.particleScale; + this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D)); + this.noClip = false; + this.setParticleTextureIndex(49); + } + + public int getBrightnessForRender(float par1) + { + float var2 = ((float)this.particleAge + par1) / (float)this.particleMaxAge; + + if (var2 < 0.0F) + { + var2 = 0.0F; + } + + if (var2 > 1.0F) + { + var2 = 1.0F; + } + + int var3 = super.getBrightnessForRender(par1); + short var4 = 240; + int var5 = var3 >> 16 & 255; + return var4 | var5 << 16; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + return 1.0F; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge; + this.particleScale = this.lavaParticleScale * (1.0F - var8 * var8); + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + float var1 = (float)this.particleAge / (float)this.particleMaxAge; + + if (this.rand.nextFloat() > var1) + { + this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ); + } + + this.motionY -= 0.03D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9990000128746033D; + this.motionY *= 0.9990000128746033D; + this.motionZ *= 0.9990000128746033D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityLeashKnot.java b/src/main/java/net/minecraft/src/EntityLeashKnot.java new file mode 100644 index 0000000..bb3546e --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityLeashKnot.java @@ -0,0 +1,172 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class EntityLeashKnot extends EntityHanging +{ + public EntityLeashKnot(World par1World) + { + super(par1World); + } + + public EntityLeashKnot(World par1World, int par2, int par3, int par4) + { + super(par1World, par2, par3, par4, 0); + this.setPosition((double)par2 + 0.5D, (double)par3 + 0.5D, (double)par4 + 0.5D); + } + + protected void entityInit() + { + super.entityInit(); + } + + public void setDirection(int par1) {} + + public int getWidthPixels() + { + return 9; + } + + public int getHeightPixels() + { + return 9; + } + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double par1) + { + return par1 < 1024.0D; + } + + /** + * Called when this entity is broken. Entity parameter may be null. + */ + public void onBroken(Entity par1Entity) {} + + /** + * Either write this entity to the NBT tag given and return true, or return false without doing anything. If this + * returns false the entity is not saved on disk. Ridden entities return false here as they are saved with their + * rider. + */ + public boolean writeToNBTOptional(NBTTagCompound par1NBTTagCompound) + { + return false; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {} + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {} + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.getHeldItem(); + boolean var3 = false; + double var4; + List var6; + Iterator var7; + EntityLiving var8; + + if (var2 != null && var2.itemID == Item.leash.itemID && !this.worldObj.isRemote) + { + var4 = 7.0D; + var6 = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getAABBPool().getAABB(this.posX - var4, this.posY - var4, this.posZ - var4, this.posX + var4, this.posY + var4, this.posZ + var4)); + + if (var6 != null) + { + var7 = var6.iterator(); + + while (var7.hasNext()) + { + var8 = (EntityLiving)var7.next(); + + if (var8.getLeashed() && var8.getLeashedToEntity() == par1EntityPlayer) + { + var8.setLeashedToEntity(this, true); + var3 = true; + } + } + } + } + + if (!this.worldObj.isRemote && !var3) + { + this.setDead(); + + if (par1EntityPlayer.capabilities.isCreativeMode) + { + var4 = 7.0D; + var6 = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getAABBPool().getAABB(this.posX - var4, this.posY - var4, this.posZ - var4, this.posX + var4, this.posY + var4, this.posZ + var4)); + + if (var6 != null) + { + var7 = var6.iterator(); + + while (var7.hasNext()) + { + var8 = (EntityLiving)var7.next(); + + if (var8.getLeashed() && var8.getLeashedToEntity() == this) + { + var8.clearLeashed(true, false); + } + } + } + } + } + + return true; + } + + /** + * checks to make sure painting can be placed there + */ + public boolean onValidSurface() + { + int var1 = this.worldObj.getBlockId(this.xPosition, this.yPosition, this.zPosition); + return Block.blocksList[var1] != null && Block.blocksList[var1].getRenderType() == 11; + } + + public static EntityLeashKnot func_110129_a(World par0World, int par1, int par2, int par3) + { + EntityLeashKnot var4 = new EntityLeashKnot(par0World, par1, par2, par3); + var4.forceSpawn = true; + par0World.spawnEntityInWorld(var4); + return var4; + } + + public static EntityLeashKnot getKnotForBlock(World par0World, int par1, int par2, int par3) + { + List var4 = par0World.getEntitiesWithinAABB(EntityLeashKnot.class, AxisAlignedBB.getAABBPool().getAABB((double)par1 - 1.0D, (double)par2 - 1.0D, (double)par3 - 1.0D, (double)par1 + 1.0D, (double)par2 + 1.0D, (double)par3 + 1.0D)); + Object var5 = null; + + if (var4 != null) + { + Iterator var6 = var4.iterator(); + + while (var6.hasNext()) + { + EntityLeashKnot var7 = (EntityLeashKnot)var6.next(); + + if (var7.xPosition == par1 && var7.yPosition == par2 && var7.zPosition == par3) + { + return var7; + } + } + } + + return null; + } +} diff --git a/src/main/java/net/minecraft/src/EntityLightningBolt.java b/src/main/java/net/minecraft/src/EntityLightningBolt.java new file mode 100644 index 0000000..8934dd4 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityLightningBolt.java @@ -0,0 +1,135 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityLightningBolt extends EntityWeatherEffect +{ + /** + * Declares which state the lightning bolt is in. Whether it's in the air, hit the ground, etc. + */ + private int lightningState; + + /** + * A random long that is used to change the vertex of the lightning rendered in RenderLightningBolt + */ + public long boltVertex; + + /** + * Determines the time before the EntityLightningBolt is destroyed. It is a random integer decremented over time. + */ + private int boltLivingTime; + + public EntityLightningBolt(World par1World, double par2, double par4, double par6) + { + super(par1World); + this.setLocationAndAngles(par2, par4, par6, 0.0F, 0.0F); + this.lightningState = 2; + this.boltVertex = this.rand.nextLong(); + this.boltLivingTime = this.rand.nextInt(3) + 1; + + if (!par1World.isRemote && par1World.getGameRules().getGameRuleBooleanValue("doFireTick") && par1World.difficultySetting >= 2 && par1World.doChunksNearChunkExist(MathHelper.floor_double(par2), MathHelper.floor_double(par4), MathHelper.floor_double(par6), 10)) + { + int var8 = MathHelper.floor_double(par2); + int var9 = MathHelper.floor_double(par4); + int var10 = MathHelper.floor_double(par6); + + if (par1World.getBlockId(var8, var9, var10) == 0 && Block.fire.canPlaceBlockAt(par1World, var8, var9, var10)) + { + par1World.setBlock(var8, var9, var10, Block.fire.blockID); + } + + for (var8 = 0; var8 < 4; ++var8) + { + var9 = MathHelper.floor_double(par2) + this.rand.nextInt(3) - 1; + var10 = MathHelper.floor_double(par4) + this.rand.nextInt(3) - 1; + int var11 = MathHelper.floor_double(par6) + this.rand.nextInt(3) - 1; + + if (par1World.getBlockId(var9, var10, var11) == 0 && Block.fire.canPlaceBlockAt(par1World, var9, var10, var11)) + { + par1World.setBlock(var9, var10, var11, Block.fire.blockID); + } + } + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.lightningState == 2) + { + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F); + this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 2.0F, 0.5F + this.rand.nextFloat() * 0.2F); + } + + --this.lightningState; + + if (this.lightningState < 0) + { + if (this.boltLivingTime == 0) + { + this.setDead(); + } + else if (this.lightningState < -this.rand.nextInt(10)) + { + --this.boltLivingTime; + this.lightningState = 1; + this.boltVertex = this.rand.nextLong(); + + if (!this.worldObj.isRemote && this.worldObj.getGameRules().getGameRuleBooleanValue("doFireTick") && this.worldObj.doChunksNearChunkExist(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ), 10)) + { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.posY); + int var3 = MathHelper.floor_double(this.posZ); + + if (this.worldObj.getBlockId(var1, var2, var3) == 0 && Block.fire.canPlaceBlockAt(this.worldObj, var1, var2, var3)) + { + this.worldObj.setBlock(var1, var2, var3, Block.fire.blockID); + } + } + } + } + + if (this.lightningState >= 0) + { + if (this.worldObj.isRemote) + { + this.worldObj.lastLightningBolt = 2; + } + else + { + double var6 = 3.0D; + List var7 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getAABBPool().getAABB(this.posX - var6, this.posY - var6, this.posZ - var6, this.posX + var6, this.posY + 6.0D + var6, this.posZ + var6)); + + for (int var4 = 0; var4 < var7.size(); ++var4) + { + Entity var5 = (Entity)var7.get(var4); + var5.onStruckByLightning(this); + } + } + } + } + + protected void entityInit() {} + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {} + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {} + + /** + * Checks using a Vec3d to determine if this entity is within range of that vector to be rendered. Args: vec3D + */ + public boolean isInRangeToRenderVec3D(Vec3 par1Vec3) + { + return this.lightningState >= 0; + } +} diff --git a/src/main/java/net/minecraft/src/EntityList.java b/src/main/java/net/minecraft/src/EntityList.java new file mode 100644 index 0000000..369de09 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityList.java @@ -0,0 +1,246 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +public class EntityList +{ + /** Provides a mapping between entity classes and a string */ + private static Map stringToClassMapping = new HashMap(); + + /** Provides a mapping between a string and an entity classes */ + private static Map classToStringMapping = new HashMap(); + + /** provides a mapping between an entityID and an Entity Class */ + private static Map IDtoClassMapping = new HashMap(); + + /** provides a mapping between an Entity Class and an entity ID */ + private static Map classToIDMapping = new HashMap(); + + /** Maps entity names to their numeric identifiers */ + private static Map stringToIDMapping = new HashMap(); + + /** This is a HashMap of the Creative Entity Eggs/Spawners. */ + public static HashMap entityEggs = new LinkedHashMap(); + + /** + * adds a mapping between Entity classes and both a string representation and an ID + */ + private static void addMapping(Class par0Class, String par1Str, int par2) + { + stringToClassMapping.put(par1Str, par0Class); + classToStringMapping.put(par0Class, par1Str); + IDtoClassMapping.put(Integer.valueOf(par2), par0Class); + classToIDMapping.put(par0Class, Integer.valueOf(par2)); + stringToIDMapping.put(par1Str, Integer.valueOf(par2)); + } + + /** + * Adds a entity mapping with egg info. + */ + private static void addMapping(Class par0Class, String par1Str, int par2, int par3, int par4) + { + addMapping(par0Class, par1Str, par2); + entityEggs.put(Integer.valueOf(par2), new EntityEggInfo(par2, par3, par4)); + } + + /** + * Create a new instance of an entity in the world by using the entity name. + */ + public static Entity createEntityByName(String par0Str, World par1World) + { + Entity var2 = null; + + try + { + Class var3 = (Class)stringToClassMapping.get(par0Str); + + if (var3 != null) + { + var2 = (Entity)var3.getConstructor(new Class[] {World.class}).newInstance(new Object[] {par1World}); + } + } + catch (Exception var4) + { + var4.printStackTrace(); + } + + return var2; + } + + /** + * create a new instance of an entity from NBT store + */ + public static Entity createEntityFromNBT(NBTTagCompound par0NBTTagCompound, World par1World) + { + Entity var2 = null; + + if ("Minecart".equals(par0NBTTagCompound.getString("id"))) + { + switch (par0NBTTagCompound.getInteger("Type")) + { + case 0: + par0NBTTagCompound.setString("id", "MinecartRideable"); + break; + + case 1: + par0NBTTagCompound.setString("id", "MinecartChest"); + break; + + case 2: + par0NBTTagCompound.setString("id", "MinecartFurnace"); + } + + par0NBTTagCompound.removeTag("Type"); + } + + try + { + Class var3 = (Class)stringToClassMapping.get(par0NBTTagCompound.getString("id")); + + if (var3 != null) + { + var2 = (Entity)var3.getConstructor(new Class[] {World.class}).newInstance(new Object[] {par1World}); + } + } + catch (Exception var4) + { + var4.printStackTrace(); + } + + if (var2 != null) + { + var2.readFromNBT(par0NBTTagCompound); + } + else + { + par1World.getWorldLogAgent().logWarning("Skipping Entity with id " + par0NBTTagCompound.getString("id")); + } + + return var2; + } + + /** + * Create a new instance of an entity in the world by using an entity ID. + */ + public static Entity createEntityByID(int par0, World par1World) + { + Entity var2 = null; + + try + { + Class var3 = getClassFromID(par0); + + if (var3 != null) + { + var2 = (Entity)var3.getConstructor(new Class[] {World.class}).newInstance(new Object[] {par1World}); + } + } + catch (Exception var4) + { + var4.printStackTrace(); + } + + if (var2 == null) + { + par1World.getWorldLogAgent().logWarning("Skipping Entity with id " + par0); + } + + return var2; + } + + /** + * gets the entityID of a specific entity + */ + public static int getEntityID(Entity par0Entity) + { + Class var1 = par0Entity.getClass(); + return classToIDMapping.containsKey(var1) ? ((Integer)classToIDMapping.get(var1)).intValue() : 0; + } + + /** + * Return the class assigned to this entity ID. + */ + public static Class getClassFromID(int par0) + { + return (Class)IDtoClassMapping.get(Integer.valueOf(par0)); + } + + /** + * Gets the string representation of a specific entity. + */ + public static String getEntityString(Entity par0Entity) + { + return (String)classToStringMapping.get(par0Entity.getClass()); + } + + /** + * Finds the class using IDtoClassMapping and classToStringMapping + */ + public static String getStringFromID(int par0) + { + Class var1 = getClassFromID(par0); + return var1 != null ? (String)classToStringMapping.get(var1) : null; + } + + static + { + addMapping(EntityItem.class, "Item", 1); + addMapping(EntityXPOrb.class, "XPOrb", 2); + addMapping(EntityLeashKnot.class, "LeashKnot", 8); + addMapping(EntityPainting.class, "Painting", 9); + addMapping(EntityArrow.class, "Arrow", 10); + addMapping(EntitySnowball.class, "Snowball", 11); + addMapping(EntityLargeFireball.class, "Fireball", 12); + addMapping(EntitySmallFireball.class, "SmallFireball", 13); + addMapping(EntityEnderPearl.class, "ThrownEnderpearl", 14); + addMapping(EntityEnderEye.class, "EyeOfEnderSignal", 15); + addMapping(EntityPotion.class, "ThrownPotion", 16); + addMapping(EntityExpBottle.class, "ThrownExpBottle", 17); + addMapping(EntityItemFrame.class, "ItemFrame", 18); + addMapping(EntityWitherSkull.class, "WitherSkull", 19); + addMapping(EntityTNTPrimed.class, "PrimedTnt", 20); + addMapping(EntityFallingSand.class, "FallingSand", 21); + addMapping(EntityFireworkRocket.class, "FireworksRocketEntity", 22); + addMapping(EntityBoat.class, "Boat", 41); + addMapping(EntityMinecartEmpty.class, "MinecartRideable", 42); + addMapping(EntityMinecartChest.class, "MinecartChest", 43); + addMapping(EntityMinecartFurnace.class, "MinecartFurnace", 44); + addMapping(EntityMinecartTNT.class, "MinecartTNT", 45); + addMapping(EntityMinecartHopper.class, "MinecartHopper", 46); + addMapping(EntityMinecartMobSpawner.class, "MinecartSpawner", 47); + addMapping(EntityLiving.class, "Mob", 48); + addMapping(EntityMob.class, "Monster", 49); + addMapping(EntityCreeper.class, "Creeper", 50, 894731, 0); + addMapping(EntitySkeleton.class, "Skeleton", 51, 12698049, 4802889); + addMapping(EntitySpider.class, "Spider", 52, 3419431, 11013646); + addMapping(EntityGiantZombie.class, "Giant", 53); + addMapping(EntityZombie.class, "Zombie", 54, 44975, 7969893); + addMapping(EntitySlime.class, "Slime", 55, 5349438, 8306542); + addMapping(EntityGhast.class, "Ghast", 56, 16382457, 12369084); + addMapping(EntityPigZombie.class, "PigZombie", 57, 15373203, 5009705); + addMapping(EntityEnderman.class, "Enderman", 58, 1447446, 0); + addMapping(EntityCaveSpider.class, "CaveSpider", 59, 803406, 11013646); + addMapping(EntitySilverfish.class, "Silverfish", 60, 7237230, 3158064); + addMapping(EntityBlaze.class, "Blaze", 61, 16167425, 16775294); + addMapping(EntityMagmaCube.class, "LavaSlime", 62, 3407872, 16579584); + addMapping(EntityDragon.class, "EnderDragon", 63); + addMapping(EntityWither.class, "WitherBoss", 64); + addMapping(EntityBat.class, "Bat", 65, 4996656, 986895); + addMapping(EntityWitch.class, "Witch", 66, 3407872, 5349438); + addMapping(EntityPig.class, "Pig", 90, 15771042, 14377823); + addMapping(EntitySheep.class, "Sheep", 91, 15198183, 16758197); + addMapping(EntityCow.class, "Cow", 92, 4470310, 10592673); + addMapping(EntityChicken.class, "Chicken", 93, 10592673, 16711680); + addMapping(EntitySquid.class, "Squid", 94, 2243405, 7375001); + addMapping(EntityWolf.class, "Wolf", 95, 14144467, 13545366); + addMapping(EntityMooshroom.class, "MushroomCow", 96, 10489616, 12040119); + addMapping(EntitySnowman.class, "SnowMan", 97); + addMapping(EntityOcelot.class, "Ozelot", 98, 15720061, 5653556); + addMapping(EntityIronGolem.class, "VillagerGolem", 99); + addMapping(EntityHorse.class, "EntityHorse", 100, 12623485, 15656192); + addMapping(EntityVillager.class, "Villager", 120, 5651507, 12422002); + addMapping(EntityEnderCrystal.class, "EnderCrystal", 200); + } +} diff --git a/src/main/java/net/minecraft/src/EntityLiving.java b/src/main/java/net/minecraft/src/EntityLiving.java new file mode 100644 index 0000000..769cb5c --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityLiving.java @@ -0,0 +1,1241 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + +public abstract class EntityLiving extends EntityLivingBase +{ + /** Number of ticks since this EntityLiving last produced its sound */ + public int livingSoundTime; + + /** The experience points the Entity gives. */ + protected int experienceValue; + private EntityLookHelper lookHelper; + private EntityMoveHelper moveHelper; + + /** Entity jumping helper */ + private EntityJumpHelper jumpHelper; + private EntityBodyHelper bodyHelper; + private PathNavigate navigator; + protected final EntityAITasks tasks; + protected final EntityAITasks targetTasks; + + /** The active target the Task system uses for tracking */ + private EntityLivingBase attackTarget; + private EntitySenses senses; + + /** Equipment (armor and held item) for this entity. */ + private ItemStack[] equipment = new ItemStack[5]; + + /** Chances for each equipment piece from dropping when this entity dies. */ + protected float[] equipmentDropChances = new float[5]; + + /** Whether this entity can pick up items from the ground. */ + private boolean canPickUpLoot; + + /** Whether this entity should NOT despawn. */ + private boolean persistenceRequired; + protected float defaultPitch; + + /** This entity's current target. */ + private Entity currentTarget; + + /** How long to keep a specific target entity */ + protected int numTicksToChaseTarget; + private boolean isLeashed; + private Entity leashedToEntity; + private NBTTagCompound field_110170_bx; + + public EntityLiving(World par1World) + { + super(par1World); + this.tasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null); + this.targetTasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null); + this.lookHelper = new EntityLookHelper(this); + this.moveHelper = new EntityMoveHelper(this); + this.jumpHelper = new EntityJumpHelper(this); + this.bodyHelper = new EntityBodyHelper(this); + this.navigator = new PathNavigate(this, par1World); + this.senses = new EntitySenses(this); + + for (int var2 = 0; var2 < this.equipmentDropChances.length; ++var2) + { + this.equipmentDropChances[var2] = 0.085F; + } + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getAttributeMap().func_111150_b(SharedMonsterAttributes.followRange).setAttribute(16.0D); + } + + public EntityLookHelper getLookHelper() + { + return this.lookHelper; + } + + public EntityMoveHelper getMoveHelper() + { + return this.moveHelper; + } + + public EntityJumpHelper getJumpHelper() + { + return this.jumpHelper; + } + + public PathNavigate getNavigator() + { + return this.navigator; + } + + /** + * returns the EntitySenses Object for the EntityLiving + */ + public EntitySenses getEntitySenses() + { + return this.senses; + } + + /** + * Gets the active target the Task system uses for tracking + */ + public EntityLivingBase getAttackTarget() + { + return this.attackTarget; + } + + /** + * Sets the active target the Task system uses for tracking + */ + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) + { + this.attackTarget = par1EntityLivingBase; + } + + /** + * Returns true if this entity can attack entities of the specified class. + */ + public boolean canAttackClass(Class par1Class) + { + return EntityCreeper.class != par1Class && EntityGhast.class != par1Class; + } + + /** + * This function applies the benefits of growing back wool and faster growing up to the acting entity. (This + * function is used in the AIEatGrass) + */ + public void eatGrassBonus() {} + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(11, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(10, ""); + } + + /** + * Get number of ticks, at least during which the living entity will be silent. + */ + public int getTalkInterval() + { + return 80; + } + + /** + * Plays living's sound at its position + */ + public void playLivingSound() + { + String var1 = this.getLivingSound(); + + if (var1 != null) + { + this.playSound(var1, this.getSoundVolume(), this.getSoundPitch()); + } + } + + /** + * Gets called every tick from main Entity class + */ + public void onEntityUpdate() + { + super.onEntityUpdate(); + this.worldObj.theProfiler.startSection("mobBaseTick"); + + if (this.isEntityAlive() && this.rand.nextInt(1000) < this.livingSoundTime++) + { + this.livingSoundTime = -this.getTalkInterval(); + this.playLivingSound(); + } + + this.worldObj.theProfiler.endSection(); + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer par1EntityPlayer) + { + if (this.experienceValue > 0) + { + int var2 = this.experienceValue; + ItemStack[] var3 = this.getLastActiveItems(); + + for (int var4 = 0; var4 < var3.length; ++var4) + { + if (var3[var4] != null && this.equipmentDropChances[var4] <= 1.0F) + { + var2 += 1 + this.rand.nextInt(3); + } + } + + return var2; + } + else + { + return this.experienceValue; + } + } + + /** + * Spawns an explosion particle around the Entity's location + */ + public void spawnExplosionParticle() + { + for (int var1 = 0; var1 < 20; ++var1) + { + double var2 = this.rand.nextGaussian() * 0.02D; + double var4 = this.rand.nextGaussian() * 0.02D; + double var6 = this.rand.nextGaussian() * 0.02D; + double var8 = 10.0D; + this.worldObj.spawnParticle("explode", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - var2 * var8, this.posY + (double)(this.rand.nextFloat() * this.height) - var4 * var8, this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - var6 * var8, var2, var4, var6); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (!this.worldObj.isRemote) + { + this.func_110159_bB(); + } + } + + protected float func_110146_f(float par1, float par2) + { + if (this.isAIEnabled()) + { + this.bodyHelper.func_75664_a(); + return par2; + } + else + { + return super.func_110146_f(par1, par2); + } + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return null; + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return 0; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.getDropItemId(); + + if (var3 > 0) + { + int var4 = this.rand.nextInt(3); + + if (par2 > 0) + { + var4 += this.rand.nextInt(par2 + 1); + } + + for (int var5 = 0; var5 < var4; ++var5) + { + this.dropItem(var3, 1); + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("CanPickUpLoot", this.canPickUpLoot()); + par1NBTTagCompound.setBoolean("PersistenceRequired", this.persistenceRequired); + NBTTagList var2 = new NBTTagList(); + NBTTagCompound var4; + + for (int var3 = 0; var3 < this.equipment.length; ++var3) + { + var4 = new NBTTagCompound(); + + if (this.equipment[var3] != null) + { + this.equipment[var3].writeToNBT(var4); + } + + var2.appendTag(var4); + } + + par1NBTTagCompound.setTag("Equipment", var2); + NBTTagList var6 = new NBTTagList(); + + for (int var7 = 0; var7 < this.equipmentDropChances.length; ++var7) + { + var6.appendTag(new NBTTagFloat(var7 + "", this.equipmentDropChances[var7])); + } + + par1NBTTagCompound.setTag("DropChances", var6); + par1NBTTagCompound.setString("CustomName", this.getCustomNameTag()); + par1NBTTagCompound.setBoolean("CustomNameVisible", this.getAlwaysRenderNameTag()); + par1NBTTagCompound.setBoolean("Leashed", this.isLeashed); + + if (this.leashedToEntity != null) + { + var4 = new NBTTagCompound("Leash"); + + if (this.leashedToEntity instanceof EntityLivingBase) + { + var4.setLong("UUIDMost", this.leashedToEntity.getUniqueID().getMostSignificantBits()); + var4.setLong("UUIDLeast", this.leashedToEntity.getUniqueID().getLeastSignificantBits()); + } + else if (this.leashedToEntity instanceof EntityHanging) + { + EntityHanging var5 = (EntityHanging)this.leashedToEntity; + var4.setInteger("X", var5.xPosition); + var4.setInteger("Y", var5.yPosition); + var4.setInteger("Z", var5.zPosition); + } + + par1NBTTagCompound.setTag("Leash", var4); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.setCanPickUpLoot(par1NBTTagCompound.getBoolean("CanPickUpLoot")); + this.persistenceRequired = par1NBTTagCompound.getBoolean("PersistenceRequired"); + + if (par1NBTTagCompound.hasKey("CustomName") && par1NBTTagCompound.getString("CustomName").length() > 0) + { + this.setCustomNameTag(par1NBTTagCompound.getString("CustomName")); + } + + this.setAlwaysRenderNameTag(par1NBTTagCompound.getBoolean("CustomNameVisible")); + NBTTagList var2; + int var3; + + if (par1NBTTagCompound.hasKey("Equipment")) + { + var2 = par1NBTTagCompound.getTagList("Equipment"); + + for (var3 = 0; var3 < this.equipment.length; ++var3) + { + this.equipment[var3] = ItemStack.loadItemStackFromNBT((NBTTagCompound)var2.tagAt(var3)); + } + } + + if (par1NBTTagCompound.hasKey("DropChances")) + { + var2 = par1NBTTagCompound.getTagList("DropChances"); + + for (var3 = 0; var3 < var2.tagCount(); ++var3) + { + this.equipmentDropChances[var3] = ((NBTTagFloat)var2.tagAt(var3)).data; + } + } + + this.isLeashed = par1NBTTagCompound.getBoolean("Leashed"); + + if (this.isLeashed && par1NBTTagCompound.hasKey("Leash")) + { + this.field_110170_bx = par1NBTTagCompound.getCompoundTag("Leash"); + } + } + + public void setMoveForward(float par1) + { + this.moveForward = par1; + } + + /** + * set the movespeed used for the new AI system + */ + public void setAIMoveSpeed(float par1) + { + super.setAIMoveSpeed(par1); + this.setMoveForward(par1); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + this.worldObj.theProfiler.startSection("looting"); + + if (!this.worldObj.isRemote && this.canPickUpLoot() && !this.dead && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) + { + List var1 = this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(1.0D, 0.0D, 1.0D)); + Iterator var2 = var1.iterator(); + + while (var2.hasNext()) + { + EntityItem var3 = (EntityItem)var2.next(); + + if (!var3.isDead && var3.getEntityItem() != null) + { + ItemStack var4 = var3.getEntityItem(); + int var5 = getArmorPosition(var4); + + if (var5 > -1) + { + boolean var6 = true; + ItemStack var7 = this.getCurrentItemOrArmor(var5); + + if (var7 != null) + { + if (var5 == 0) + { + if (var4.getItem() instanceof ItemSword && !(var7.getItem() instanceof ItemSword)) + { + var6 = true; + } + else if (var4.getItem() instanceof ItemSword && var7.getItem() instanceof ItemSword) + { + ItemSword var8 = (ItemSword)var4.getItem(); + ItemSword var9 = (ItemSword)var7.getItem(); + + if (var8.func_82803_g() == var9.func_82803_g()) + { + var6 = var4.getItemDamage() > var7.getItemDamage() || var4.hasTagCompound() && !var7.hasTagCompound(); + } + else + { + var6 = var8.func_82803_g() > var9.func_82803_g(); + } + } + else + { + var6 = false; + } + } + else if (var4.getItem() instanceof ItemArmor && !(var7.getItem() instanceof ItemArmor)) + { + var6 = true; + } + else if (var4.getItem() instanceof ItemArmor && var7.getItem() instanceof ItemArmor) + { + ItemArmor var10 = (ItemArmor)var4.getItem(); + ItemArmor var11 = (ItemArmor)var7.getItem(); + + if (var10.damageReduceAmount == var11.damageReduceAmount) + { + var6 = var4.getItemDamage() > var7.getItemDamage() || var4.hasTagCompound() && !var7.hasTagCompound(); + } + else + { + var6 = var10.damageReduceAmount > var11.damageReduceAmount; + } + } + else + { + var6 = false; + } + } + + if (var6) + { + if (var7 != null && this.rand.nextFloat() - 0.1F < this.equipmentDropChances[var5]) + { + this.entityDropItem(var7, 0.0F); + } + + this.setCurrentItemOrArmor(var5, var4); + this.equipmentDropChances[var5] = 2.0F; + this.persistenceRequired = true; + this.onItemPickup(var3, 1); + var3.setDead(); + } + } + } + } + } + + this.worldObj.theProfiler.endSection(); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + protected boolean isAIEnabled() + { + return false; + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return true; + } + + /** + * Makes the entity despawn if requirements are reached + */ + protected void despawnEntity() + { + if (this.persistenceRequired) + { + this.entityAge = 0; + } + else + { + EntityPlayer var1 = this.worldObj.getClosestPlayerToEntity(this, -1.0D); + + if (var1 != null) + { + double var2 = var1.posX - this.posX; + double var4 = var1.posY - this.posY; + double var6 = var1.posZ - this.posZ; + double var8 = var2 * var2 + var4 * var4 + var6 * var6; + + if (this.canDespawn() && var8 > 16384.0D) + { + this.setDead(); + } + + if (this.entityAge > 600 && this.rand.nextInt(800) == 0 && var8 > 1024.0D && this.canDespawn()) + { + this.setDead(); + } + else if (var8 < 1024.0D) + { + this.entityAge = 0; + } + } + } + } + + protected void updateAITasks() + { + ++this.entityAge; + this.worldObj.theProfiler.startSection("checkDespawn"); + this.despawnEntity(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("sensing"); + this.senses.clearSensingCache(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("targetSelector"); + this.targetTasks.onUpdateTasks(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("goalSelector"); + this.tasks.onUpdateTasks(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("navigation"); + this.navigator.onUpdateNavigation(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("mob tick"); + this.updateAITick(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("controls"); + this.worldObj.theProfiler.startSection("move"); + this.moveHelper.onUpdateMoveHelper(); + this.worldObj.theProfiler.endStartSection("look"); + this.lookHelper.onUpdateLook(); + this.worldObj.theProfiler.endStartSection("jump"); + this.jumpHelper.doJump(); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.endSection(); + } + + protected void updateEntityActionState() + { + super.updateEntityActionState(); + this.moveStrafing = 0.0F; + this.moveForward = 0.0F; + this.despawnEntity(); + float var1 = 8.0F; + + if (this.rand.nextFloat() < 0.02F) + { + EntityPlayer var2 = this.worldObj.getClosestPlayerToEntity(this, (double)var1); + + if (var2 != null) + { + this.currentTarget = var2; + this.numTicksToChaseTarget = 10 + this.rand.nextInt(20); + } + else + { + this.randomYawVelocity = (this.rand.nextFloat() - 0.5F) * 20.0F; + } + } + + if (this.currentTarget != null) + { + this.faceEntity(this.currentTarget, 10.0F, (float)this.getVerticalFaceSpeed()); + + if (this.numTicksToChaseTarget-- <= 0 || this.currentTarget.isDead || this.currentTarget.getDistanceSqToEntity(this) > (double)(var1 * var1)) + { + this.currentTarget = null; + } + } + else + { + if (this.rand.nextFloat() < 0.05F) + { + this.randomYawVelocity = (this.rand.nextFloat() - 0.5F) * 20.0F; + } + + this.rotationYaw += this.randomYawVelocity; + this.rotationPitch = this.defaultPitch; + } + + boolean var4 = this.isInWater(); + boolean var3 = this.handleLavaMovement(); + + if (var4 || var3) + { + this.isJumping = this.rand.nextFloat() < 0.8F; + } + } + + /** + * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently + * use in wolves. + */ + public int getVerticalFaceSpeed() + { + return 40; + } + + /** + * Changes pitch and yaw so that the entity calling the function is facing the entity provided as an argument. + */ + public void faceEntity(Entity par1Entity, float par2, float par3) + { + double var4 = par1Entity.posX - this.posX; + double var8 = par1Entity.posZ - this.posZ; + double var6; + + if (par1Entity instanceof EntityLivingBase) + { + EntityLivingBase var10 = (EntityLivingBase)par1Entity; + var6 = var10.posY + (double)var10.getEyeHeight() - (this.posY + (double)this.getEyeHeight()); + } + else + { + var6 = (par1Entity.boundingBox.minY + par1Entity.boundingBox.maxY) / 2.0D - (this.posY + (double)this.getEyeHeight()); + } + + double var14 = (double)MathHelper.sqrt_double(var4 * var4 + var8 * var8); + float var12 = (float)(Math.atan2(var8, var4) * 180.0D / Math.PI) - 90.0F; + float var13 = (float)(-(Math.atan2(var6, var14) * 180.0D / Math.PI)); + this.rotationPitch = this.updateRotation(this.rotationPitch, var13, par3); + this.rotationYaw = this.updateRotation(this.rotationYaw, var12, par2); + } + + /** + * Arguments: current rotation, intended rotation, max increment. + */ + private float updateRotation(float par1, float par2, float par3) + { + float var4 = MathHelper.wrapAngleTo180_float(par2 - par1); + + if (var4 > par3) + { + var4 = par3; + } + + if (var4 < -par3) + { + var4 = -par3; + } + + return par1 + var4; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); + } + + /** + * Returns render size modifier + */ + public float getRenderSizeModifier() + { + return 1.0F; + } + + /** + * Will return how many at most can spawn in a chunk at once. + */ + public int getMaxSpawnedInChunk() + { + return 4; + } + + /** + * The number of iterations PathFinder.getSafePoint will execute before giving up. + */ + public int getMaxSafePointTries() + { + if (this.getAttackTarget() == null) + { + return 3; + } + else + { + int var1 = (int)(this.getHealth() - this.getMaxHealth() * 0.33F); + var1 -= (3 - this.worldObj.difficultySetting) * 4; + + if (var1 < 0) + { + var1 = 0; + } + + return var1 + 3; + } + } + + /** + * Returns the item that this EntityLiving is holding, if any. + */ + public ItemStack getHeldItem() + { + return this.equipment[0]; + } + + /** + * 0 = item, 1-n is armor + */ + public ItemStack getCurrentItemOrArmor(int par1) + { + return this.equipment[par1]; + } + + public ItemStack func_130225_q(int par1) + { + return this.equipment[par1 + 1]; + } + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) + { + this.equipment[par1] = par2ItemStack; + } + + public ItemStack[] getLastActiveItems() + { + return this.equipment; + } + + /** + * Drop the equipment for this entity. + */ + protected void dropEquipment(boolean par1, int par2) + { + for (int var3 = 0; var3 < this.getLastActiveItems().length; ++var3) + { + ItemStack var4 = this.getCurrentItemOrArmor(var3); + boolean var5 = this.equipmentDropChances[var3] > 1.0F; + + if (var4 != null && (par1 || var5) && this.rand.nextFloat() - (float)par2 * 0.01F < this.equipmentDropChances[var3]) + { + if (!var5 && var4.isItemStackDamageable()) + { + int var6 = Math.max(var4.getMaxDamage() - 25, 1); + int var7 = var4.getMaxDamage() - this.rand.nextInt(this.rand.nextInt(var6) + 1); + + if (var7 > var6) + { + var7 = var6; + } + + if (var7 < 1) + { + var7 = 1; + } + + var4.setItemDamage(var7); + } + + this.entityDropItem(var4, 0.0F); + } + } + } + + /** + * Makes entity wear random armor based on difficulty + */ + protected void addRandomArmor() + { + if (this.rand.nextFloat() < 0.15F * this.worldObj.getLocationTensionFactor(this.posX, this.posY, this.posZ)) + { + int var1 = this.rand.nextInt(2); + float var2 = this.worldObj.difficultySetting == 3 ? 0.1F : 0.25F; + + if (this.rand.nextFloat() < 0.095F) + { + ++var1; + } + + if (this.rand.nextFloat() < 0.095F) + { + ++var1; + } + + if (this.rand.nextFloat() < 0.095F) + { + ++var1; + } + + for (int var3 = 3; var3 >= 0; --var3) + { + ItemStack var4 = this.func_130225_q(var3); + + if (var3 < 3 && this.rand.nextFloat() < var2) + { + break; + } + + if (var4 == null) + { + Item var5 = getArmorItemForSlot(var3 + 1, var1); + + if (var5 != null) + { + this.setCurrentItemOrArmor(var3 + 1, new ItemStack(var5)); + } + } + } + } + } + + public static int getArmorPosition(ItemStack par0ItemStack) + { + if (par0ItemStack.itemID != Block.pumpkin.blockID && par0ItemStack.itemID != Item.skull.itemID) + { + if (par0ItemStack.getItem() instanceof ItemArmor) + { + switch (((ItemArmor)par0ItemStack.getItem()).armorType) + { + case 0: + return 4; + + case 1: + return 3; + + case 2: + return 2; + + case 3: + return 1; + } + } + + return 0; + } + else + { + return 4; + } + } + + /** + * Params: Armor slot, Item tier + */ + public static Item getArmorItemForSlot(int par0, int par1) + { + switch (par0) + { + case 4: + if (par1 == 0) + { + return Item.helmetLeather; + } + else if (par1 == 1) + { + return Item.helmetGold; + } + else if (par1 == 2) + { + return Item.helmetChain; + } + else if (par1 == 3) + { + return Item.helmetIron; + } + else if (par1 == 4) + { + return Item.helmetDiamond; + } + + case 3: + if (par1 == 0) + { + return Item.plateLeather; + } + else if (par1 == 1) + { + return Item.plateGold; + } + else if (par1 == 2) + { + return Item.plateChain; + } + else if (par1 == 3) + { + return Item.plateIron; + } + else if (par1 == 4) + { + return Item.plateDiamond; + } + + case 2: + if (par1 == 0) + { + return Item.legsLeather; + } + else if (par1 == 1) + { + return Item.legsGold; + } + else if (par1 == 2) + { + return Item.legsChain; + } + else if (par1 == 3) + { + return Item.legsIron; + } + else if (par1 == 4) + { + return Item.legsDiamond; + } + + case 1: + if (par1 == 0) + { + return Item.bootsLeather; + } + else if (par1 == 1) + { + return Item.bootsGold; + } + else if (par1 == 2) + { + return Item.bootsChain; + } + else if (par1 == 3) + { + return Item.bootsIron; + } + else if (par1 == 4) + { + return Item.bootsDiamond; + } + + default: + return null; + } + } + + /** + * Enchants the entity's armor and held item based on difficulty + */ + protected void enchantEquipment() + { + float var1 = this.worldObj.getLocationTensionFactor(this.posX, this.posY, this.posZ); + + if (this.getHeldItem() != null && this.rand.nextFloat() < 0.25F * var1) + { + EnchantmentHelper.addRandomEnchantment(this.rand, this.getHeldItem(), (int)(5.0F + var1 * (float)this.rand.nextInt(18))); + } + + for (int var2 = 0; var2 < 4; ++var2) + { + ItemStack var3 = this.func_130225_q(var2); + + if (var3 != null && this.rand.nextFloat() < 0.5F * var1) + { + EnchantmentHelper.addRandomEnchantment(this.rand, var3, (int)(5.0F + var1 * (float)this.rand.nextInt(18))); + } + } + } + + public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData) + { + this.getEntityAttribute(SharedMonsterAttributes.followRange).applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, 1)); + return par1EntityLivingData; + } + + /** + * returns true if all the conditions for steering the entity are met. For pigs, this is true if it is being ridden + * by a player and the player is holding a carrot-on-a-stick + */ + public boolean canBeSteered() + { + return false; + } + + /** + * Gets the username of the entity. + */ + public String getEntityName() + { + return this.hasCustomNameTag() ? this.getCustomNameTag() : super.getEntityName(); + } + + public void func_110163_bv() + { + this.persistenceRequired = true; + } + + public void setCustomNameTag(String par1Str) + { + this.dataWatcher.updateObject(10, par1Str); + } + + public String getCustomNameTag() + { + return this.dataWatcher.getWatchableObjectString(10); + } + + public boolean hasCustomNameTag() + { + return this.dataWatcher.getWatchableObjectString(10).length() > 0; + } + + public void setAlwaysRenderNameTag(boolean par1) + { + this.dataWatcher.updateObject(11, Byte.valueOf((byte)(par1 ? 1 : 0))); + } + + public boolean getAlwaysRenderNameTag() + { + return this.dataWatcher.getWatchableObjectByte(11) == 1; + } + + public boolean getAlwaysRenderNameTagForRender() + { + return this.getAlwaysRenderNameTag(); + } + + public void setEquipmentDropChance(int par1, float par2) + { + this.equipmentDropChances[par1] = par2; + } + + public boolean canPickUpLoot() + { + return this.canPickUpLoot; + } + + public void setCanPickUpLoot(boolean par1) + { + this.canPickUpLoot = par1; + } + + public boolean isNoDespawnRequired() + { + return this.persistenceRequired; + } + + /** + * First layer of player interaction + */ + public final boolean interactFirst(EntityPlayer par1EntityPlayer) + { + if (this.getLeashed() && this.getLeashedToEntity() == par1EntityPlayer) + { + this.clearLeashed(true, !par1EntityPlayer.capabilities.isCreativeMode); + return true; + } + else + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + + if (var2 != null && var2.itemID == Item.leash.itemID && this.allowLeashing()) + { + if (!(this instanceof EntityTameable) || !((EntityTameable)this).isTamed()) + { + this.setLeashedToEntity(par1EntityPlayer, true); + --var2.stackSize; + return true; + } + + if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(((EntityTameable)this).getOwnerName())) + { + this.setLeashedToEntity(par1EntityPlayer, true); + --var2.stackSize; + return true; + } + } + + return this.interact(par1EntityPlayer) ? true : super.interactFirst(par1EntityPlayer); + } + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + protected boolean interact(EntityPlayer par1EntityPlayer) + { + return false; + } + + protected void func_110159_bB() + { + if (this.field_110170_bx != null) + { + this.recreateLeash(); + } + + if (this.isLeashed) + { + if (this.leashedToEntity == null || this.leashedToEntity.isDead) + { + this.clearLeashed(true, true); + } + } + } + + /** + * Removes the leash from this entity. Second parameter tells whether to send a packet to surrounding players. + */ + public void clearLeashed(boolean par1, boolean par2) + { + if (this.isLeashed) + { + this.isLeashed = false; + this.leashedToEntity = null; + + if (!this.worldObj.isRemote && par2) + { + this.dropItem(Item.leash.itemID, 1); + } + + if (!this.worldObj.isRemote && par1 && this.worldObj instanceof WorldServer) + { + ((WorldServer)this.worldObj).getEntityTracker().sendPacketToAllPlayersTrackingEntity(this, new Packet39AttachEntity(1, this, (Entity)null)); + } + } + } + + public boolean allowLeashing() + { + return !this.getLeashed() && !(this instanceof IMob); + } + + public boolean getLeashed() + { + return this.isLeashed; + } + + public Entity getLeashedToEntity() + { + return this.leashedToEntity; + } + + /** + * Sets the entity to be leashed to.\nArgs:\n@param par1Entity: The entity to be tethered to.\n@param par2: Whether + * to send an attaching notification packet to surrounding players. + */ + public void setLeashedToEntity(Entity par1Entity, boolean par2) + { + this.isLeashed = true; + this.leashedToEntity = par1Entity; + + if (!this.worldObj.isRemote && par2 && this.worldObj instanceof WorldServer) + { + ((WorldServer)this.worldObj).getEntityTracker().sendPacketToAllPlayersTrackingEntity(this, new Packet39AttachEntity(1, this, this.leashedToEntity)); + } + } + + private void recreateLeash() + { + if (this.isLeashed && this.field_110170_bx != null) + { + if (this.field_110170_bx.hasKey("UUIDMost") && this.field_110170_bx.hasKey("UUIDLeast")) + { + UUID var5 = new UUID(this.field_110170_bx.getLong("UUIDMost"), this.field_110170_bx.getLong("UUIDLeast")); + List var6 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(10.0D, 10.0D, 10.0D)); + Iterator var7 = var6.iterator(); + + while (var7.hasNext()) + { + EntityLivingBase var8 = (EntityLivingBase)var7.next(); + + if (var8.getUniqueID().equals(var5)) + { + this.leashedToEntity = var8; + break; + } + } + } + else if (this.field_110170_bx.hasKey("X") && this.field_110170_bx.hasKey("Y") && this.field_110170_bx.hasKey("Z")) + { + int var1 = this.field_110170_bx.getInteger("X"); + int var2 = this.field_110170_bx.getInteger("Y"); + int var3 = this.field_110170_bx.getInteger("Z"); + EntityLeashKnot var4 = EntityLeashKnot.getKnotForBlock(this.worldObj, var1, var2, var3); + + if (var4 == null) + { + var4 = EntityLeashKnot.func_110129_a(this.worldObj, var1, var2, var3); + } + + this.leashedToEntity = var4; + } + else + { + this.clearLeashed(false, true); + } + } + + this.field_110170_bx = null; + } +} diff --git a/src/main/java/net/minecraft/src/EntityLivingBase.java b/src/main/java/net/minecraft/src/EntityLivingBase.java new file mode 100644 index 0000000..b0b58d0 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityLivingBase.java @@ -0,0 +1,2222 @@ +package net.minecraft.src; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import java.util.UUID; + +public abstract class EntityLivingBase extends Entity +{ + private static final UUID sprintingSpeedBoostModifierUUID = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); + private static final AttributeModifier sprintingSpeedBoostModifier = (new AttributeModifier(sprintingSpeedBoostModifierUUID, "Sprinting speed boost", 0.30000001192092896D, 2)).setSaved(false); + private BaseAttributeMap attributeMap; + private final CombatTracker _combatTracker = new CombatTracker(this); + private final HashMap activePotionsMap = new HashMap(); + + /** The equipment this mob was previously wearing, used for syncing. */ + private final ItemStack[] previousEquipment = new ItemStack[5]; + + /** Whether an arm swing is currently in progress. */ + public boolean isSwingInProgress; + public int swingProgressInt; + public int arrowHitTimer; + public float prevHealth; + + /** + * The amount of time remaining this entity should act 'hurt'. (Visual appearance of red tint) + */ + public int hurtTime; + + /** What the hurt time was max set to last. */ + public int maxHurtTime; + + /** The yaw at which this entity was last attacked from. */ + public float attackedAtYaw; + + /** + * The amount of time remaining this entity should act 'dead', i.e. have a corpse in the world. + */ + public int deathTime; + public int attackTime; + public float prevSwingProgress; + public float swingProgress; + public float prevLimbSwingAmount; + public float limbSwingAmount; + + /** + * Only relevant when limbYaw is not 0(the entity is moving). Influences where in its swing legs and arms currently + * are. + */ + public float limbSwing; + public int maxHurtResistantTime = 20; + public float prevCameraPitch; + public float cameraPitch; + public float field_70769_ao; + public float field_70770_ap; + public float renderYawOffset; + public float prevRenderYawOffset; + + /** Entity head rotation yaw */ + public float rotationYawHead; + + /** Entity head rotation yaw at previous tick */ + public float prevRotationYawHead; + + /** + * A factor used to determine how far this entity will move each tick if it is jumping or falling. + */ + public float jumpMovementFactor = 0.02F; + + /** The most recent player that has attacked this entity */ + protected EntityPlayer attackingPlayer; + + /** + * Set to 60 when hit by the player or the player's wolf, then decrements. Used to determine whether the entity + * should drop items on death. + */ + protected int recentlyHit; + + /** + * This gets set on entity death, but never used. Looks like a duplicate of isDead + */ + protected boolean dead; + + /** Holds the living entity age, used to control the despawn. */ + protected int entityAge; + protected float field_70768_au; + protected float field_110154_aX; + protected float field_70764_aw; + protected float field_70763_ax; + protected float field_70741_aB; + + /** The score value of the Mob, the amount of points the mob is worth. */ + protected int scoreValue; + + /** + * Damage taken in the last hit. Mobs are resistant to damage less than this for a short time after taking damage. + */ + protected float lastDamage; + + /** used to check whether entity is jumping. */ + protected boolean isJumping; + public float moveStrafing; + public float moveForward; + protected float randomYawVelocity; + + /** + * The number of updates over which the new position and rotation are to be applied to the entity. + */ + protected int newPosRotationIncrements; + + /** The new X position to be applied to the entity. */ + protected double newPosX; + + /** The new Y position to be applied to the entity. */ + protected double newPosY; + protected double newPosZ; + + /** The new yaw rotation to be applied to the entity. */ + protected double newRotationYaw; + + /** The new yaw rotation to be applied to the entity. */ + protected double newRotationPitch; + + /** Whether the DataWatcher needs to be updated with the active potions */ + private boolean potionsNeedUpdate = true; + + /** is only being set, has no uses as of MC 1.1 */ + private EntityLivingBase entityLivingToAttack; + private int revengeTimer; + private EntityLivingBase lastAttacker; + + /** Holds the value of ticksExisted when setLastAttacker was last called. */ + private int lastAttackerTime; + + /** + * A factor used to determine how far this entity will move each tick if it is walking on land. Adjusted by speed, + * and slipperiness of the current block. + */ + private float landMovementFactor; + + /** Number of ticks since last jump */ + private int jumpTicks; + private float field_110151_bq; + + public EntityLivingBase(World par1World) + { + super(par1World); + this.applyEntityAttributes(); + this.setHealth(this.getMaxHealth()); + this.preventEntitySpawning = true; + this.field_70770_ap = (float)(Math.random() + 1.0D) * 0.01F; + this.setPosition(this.posX, this.posY, this.posZ); + this.field_70769_ao = (float)Math.random() * 12398.0F; + this.rotationYaw = (float)(Math.random() * Math.PI * 2.0D); + this.rotationYawHead = this.rotationYaw; + this.stepHeight = 0.5F; + } + + protected void entityInit() + { + this.dataWatcher.addObject(7, Integer.valueOf(0)); + this.dataWatcher.addObject(8, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(9, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(6, Float.valueOf(1.0F)); + } + + protected void applyEntityAttributes() + { + this.getAttributeMap().func_111150_b(SharedMonsterAttributes.maxHealth); + this.getAttributeMap().func_111150_b(SharedMonsterAttributes.knockbackResistance); + this.getAttributeMap().func_111150_b(SharedMonsterAttributes.movementSpeed); + + if (!this.isAIEnabled()) + { + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.10000000149011612D); + } + } + + /** + * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance + * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround + */ + protected void updateFallState(double par1, boolean par3) + { + if (!this.isInWater()) + { + this.handleWaterMovement(); + } + + if (par3 && this.fallDistance > 0.0F) + { + int var4 = MathHelper.floor_double(this.posX); + int var5 = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset); + int var6 = MathHelper.floor_double(this.posZ); + int var7 = this.worldObj.getBlockId(var4, var5, var6); + + if (var7 == 0) + { + int var8 = this.worldObj.blockGetRenderType(var4, var5 - 1, var6); + + if (var8 == 11 || var8 == 32 || var8 == 21) + { + var7 = this.worldObj.getBlockId(var4, var5 - 1, var6); + } + } + + if (var7 > 0) + { + Block.blocksList[var7].onFallenUpon(this.worldObj, var4, var5, var6, this, this.fallDistance); + } + } + + super.updateFallState(par1, par3); + } + + public boolean canBreatheUnderwater() + { + return false; + } + + /** + * Gets called every tick from main Entity class + */ + public void onEntityUpdate() + { + this.prevSwingProgress = this.swingProgress; + super.onEntityUpdate(); + this.worldObj.theProfiler.startSection("livingEntityBaseTick"); + + if (this.isEntityAlive() && this.isEntityInsideOpaqueBlock()) + { + this.attackEntityFrom(DamageSource.inWall, 1.0F); + } + + if (this.isImmuneToFire() || this.worldObj.isRemote) + { + this.extinguish(); + } + + boolean var1 = this instanceof EntityPlayer && ((EntityPlayer)this).capabilities.disableDamage; + + if (this.isEntityAlive() && this.isInsideOfMaterial(Material.water)) + { + if (!this.canBreatheUnderwater() && !this.isPotionActive(Potion.waterBreathing.id) && !var1) + { + this.setAir(this.decreaseAirSupply(this.getAir())); + + if (this.getAir() == -20) + { + this.setAir(0); + + for (int var2 = 0; var2 < 8; ++var2) + { + float var3 = this.rand.nextFloat() - this.rand.nextFloat(); + float var4 = this.rand.nextFloat() - this.rand.nextFloat(); + float var5 = this.rand.nextFloat() - this.rand.nextFloat(); + this.worldObj.spawnParticle("bubble", this.posX + (double)var3, this.posY + (double)var4, this.posZ + (double)var5, this.motionX, this.motionY, this.motionZ); + } + + this.attackEntityFrom(DamageSource.drown, 2.0F); + } + } + + this.extinguish(); + + if (!this.worldObj.isRemote && this.isRiding() && this.ridingEntity instanceof EntityLivingBase) + { + this.mountEntity((Entity)null); + } + } + else + { + this.setAir(300); + } + + this.prevCameraPitch = this.cameraPitch; + + if (this.attackTime > 0) + { + --this.attackTime; + } + + if (this.hurtTime > 0) + { + --this.hurtTime; + } + + if (this.hurtResistantTime > 0) + { + --this.hurtResistantTime; + } + + if (this.getHealth() <= 0.0F) + { + this.onDeathUpdate(); + } + + if (this.recentlyHit > 0) + { + --this.recentlyHit; + } + else + { + this.attackingPlayer = null; + } + + if (this.lastAttacker != null && !this.lastAttacker.isEntityAlive()) + { + this.lastAttacker = null; + } + + if (this.entityLivingToAttack != null && !this.entityLivingToAttack.isEntityAlive()) + { + this.setRevengeTarget((EntityLivingBase)null); + } + + this.updatePotionEffects(); + this.field_70763_ax = this.field_70764_aw; + this.prevRenderYawOffset = this.renderYawOffset; + this.prevRotationYawHead = this.rotationYawHead; + this.prevRotationYaw = this.rotationYaw; + this.prevRotationPitch = this.rotationPitch; + this.worldObj.theProfiler.endSection(); + } + + /** + * If Animal, checks if the age timer is negative + */ + public boolean isChild() + { + return false; + } + + /** + * handles entity death timer, experience orb and particle creation + */ + protected void onDeathUpdate() + { + ++this.deathTime; + + if (this.deathTime == 20) + { + int var1; + + if (!this.worldObj.isRemote && (this.recentlyHit > 0 || this.isPlayer()) && !this.isChild() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + { + var1 = this.getExperiencePoints(this.attackingPlayer); + + while (var1 > 0) + { + int var2 = EntityXPOrb.getXPSplit(var1); + var1 -= var2; + this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var2)); + } + } + + this.setDead(); + + for (var1 = 0; var1 < 20; ++var1) + { + double var8 = this.rand.nextGaussian() * 0.02D; + double var4 = this.rand.nextGaussian() * 0.02D; + double var6 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle("explode", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var8, var4, var6); + } + } + } + + /** + * Decrements the entity's air supply when underwater + */ + protected int decreaseAirSupply(int par1) + { + int var2 = EnchantmentHelper.getRespiration(this); + return var2 > 0 && this.rand.nextInt(var2 + 1) > 0 ? par1 : par1 - 1; + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer par1EntityPlayer) + { + return 0; + } + + /** + * Only use is to identify if class is an instance of player for experience dropping + */ + protected boolean isPlayer() + { + return false; + } + + public Random getRNG() + { + return this.rand; + } + + public EntityLivingBase getAITarget() + { + return this.entityLivingToAttack; + } + + public int func_142015_aE() + { + return this.revengeTimer; + } + + public void setRevengeTarget(EntityLivingBase par1EntityLivingBase) + { + this.entityLivingToAttack = par1EntityLivingBase; + this.revengeTimer = this.ticksExisted; + } + + public EntityLivingBase getLastAttacker() + { + return this.lastAttacker; + } + + public int getLastAttackerTime() + { + return this.lastAttackerTime; + } + + public void setLastAttacker(Entity par1Entity) + { + if (par1Entity instanceof EntityLivingBase) + { + this.lastAttacker = (EntityLivingBase)par1Entity; + } + else + { + this.lastAttacker = null; + } + + this.lastAttackerTime = this.ticksExisted; + } + + public int getAge() + { + return this.entityAge; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setFloat("HealF", this.getHealth()); + par1NBTTagCompound.setShort("Health", (short)((int)Math.ceil((double)this.getHealth()))); + par1NBTTagCompound.setShort("HurtTime", (short)this.hurtTime); + par1NBTTagCompound.setShort("DeathTime", (short)this.deathTime); + par1NBTTagCompound.setShort("AttackTime", (short)this.attackTime); + par1NBTTagCompound.setFloat("AbsorptionAmount", this.getAbsorptionAmount()); + ItemStack[] var2 = this.getLastActiveItems(); + int var3 = var2.length; + int var4; + ItemStack var5; + + for (var4 = 0; var4 < var3; ++var4) + { + var5 = var2[var4]; + + if (var5 != null) + { + this.attributeMap.removeAttributeModifiers(var5.getAttributeModifiers()); + } + } + + par1NBTTagCompound.setTag("Attributes", SharedMonsterAttributes.func_111257_a(this.getAttributeMap())); + var2 = this.getLastActiveItems(); + var3 = var2.length; + + for (var4 = 0; var4 < var3; ++var4) + { + var5 = var2[var4]; + + if (var5 != null) + { + this.attributeMap.applyAttributeModifiers(var5.getAttributeModifiers()); + } + } + + if (!this.activePotionsMap.isEmpty()) + { + NBTTagList var6 = new NBTTagList(); + Iterator var7 = this.activePotionsMap.values().iterator(); + + while (var7.hasNext()) + { + PotionEffect var8 = (PotionEffect)var7.next(); + var6.appendTag(var8.writeCustomPotionEffectToNBT(new NBTTagCompound())); + } + + par1NBTTagCompound.setTag("ActiveEffects", var6); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.setAbsorptionAmount(par1NBTTagCompound.getFloat("AbsorptionAmount")); + + if (par1NBTTagCompound.hasKey("Attributes") && this.worldObj != null && !this.worldObj.isRemote) + { + SharedMonsterAttributes.func_111260_a(this.getAttributeMap(), par1NBTTagCompound.getTagList("Attributes"), this.worldObj == null ? null : this.worldObj.getWorldLogAgent()); + } + + if (par1NBTTagCompound.hasKey("ActiveEffects")) + { + NBTTagList var2 = par1NBTTagCompound.getTagList("ActiveEffects"); + + for (int var3 = 0; var3 < var2.tagCount(); ++var3) + { + NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + PotionEffect var5 = PotionEffect.readCustomPotionEffectFromNBT(var4); + this.activePotionsMap.put(Integer.valueOf(var5.getPotionID()), var5); + } + } + + if (par1NBTTagCompound.hasKey("HealF")) + { + this.setHealth(par1NBTTagCompound.getFloat("HealF")); + } + else + { + NBTBase var6 = par1NBTTagCompound.getTag("Health"); + + if (var6 == null) + { + this.setHealth(this.getMaxHealth()); + } + else if (var6.getId() == 5) + { + this.setHealth(((NBTTagFloat)var6).data); + } + else if (var6.getId() == 2) + { + this.setHealth((float)((NBTTagShort)var6).data); + } + } + + this.hurtTime = par1NBTTagCompound.getShort("HurtTime"); + this.deathTime = par1NBTTagCompound.getShort("DeathTime"); + this.attackTime = par1NBTTagCompound.getShort("AttackTime"); + } + + protected void updatePotionEffects() + { + Iterator var1 = this.activePotionsMap.keySet().iterator(); + + while (var1.hasNext()) + { + Integer var2 = (Integer)var1.next(); + PotionEffect var3 = (PotionEffect)this.activePotionsMap.get(var2); + + if (!var3.onUpdate(this)) + { + if (!this.worldObj.isRemote) + { + var1.remove(); + this.onFinishedPotionEffect(var3); + } + } + else if (var3.getDuration() % 600 == 0) + { + this.onChangedPotionEffect(var3, false); + } + } + + int var11; + + if (this.potionsNeedUpdate) + { + if (!this.worldObj.isRemote) + { + if (this.activePotionsMap.isEmpty()) + { + this.dataWatcher.updateObject(8, Byte.valueOf((byte)0)); + this.dataWatcher.updateObject(7, Integer.valueOf(0)); + this.setInvisible(false); + } + else + { + var11 = PotionHelper.calcPotionLiquidColor(this.activePotionsMap.values()); + this.dataWatcher.updateObject(8, Byte.valueOf((byte)(PotionHelper.func_82817_b(this.activePotionsMap.values()) ? 1 : 0))); + this.dataWatcher.updateObject(7, Integer.valueOf(var11)); + this.setInvisible(this.isPotionActive(Potion.invisibility.id)); + } + } + + this.potionsNeedUpdate = false; + } + + var11 = this.dataWatcher.getWatchableObjectInt(7); + boolean var12 = this.dataWatcher.getWatchableObjectByte(8) > 0; + + if (var11 > 0) + { + boolean var4 = false; + + if (!this.isInvisible()) + { + var4 = this.rand.nextBoolean(); + } + else + { + var4 = this.rand.nextInt(15) == 0; + } + + if (var12) + { + var4 &= this.rand.nextInt(5) == 0; + } + + if (var4 && var11 > 0) + { + double var5 = (double)(var11 >> 16 & 255) / 255.0D; + double var7 = (double)(var11 >> 8 & 255) / 255.0D; + double var9 = (double)(var11 >> 0 & 255) / 255.0D; + this.worldObj.spawnParticle(var12 ? "mobSpellAmbient" : "mobSpell", this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height - (double)this.yOffset, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, var5, var7, var9); + } + } + } + + public void clearActivePotions() + { + Iterator var1 = this.activePotionsMap.keySet().iterator(); + + while (var1.hasNext()) + { + Integer var2 = (Integer)var1.next(); + PotionEffect var3 = (PotionEffect)this.activePotionsMap.get(var2); + + if (!this.worldObj.isRemote) + { + var1.remove(); + this.onFinishedPotionEffect(var3); + } + } + } + + public Collection getActivePotionEffects() + { + return this.activePotionsMap.values(); + } + + public boolean isPotionActive(int par1) + { + return this.activePotionsMap.containsKey(Integer.valueOf(par1)); + } + + public boolean isPotionActive(Potion par1Potion) + { + return this.activePotionsMap.containsKey(Integer.valueOf(par1Potion.id)); + } + + /** + * returns the PotionEffect for the supplied Potion if it is active, null otherwise. + */ + public PotionEffect getActivePotionEffect(Potion par1Potion) + { + return (PotionEffect)this.activePotionsMap.get(Integer.valueOf(par1Potion.id)); + } + + /** + * adds a PotionEffect to the entity + */ + public void addPotionEffect(PotionEffect par1PotionEffect) + { + if (this.isPotionApplicable(par1PotionEffect)) + { + if (this.activePotionsMap.containsKey(Integer.valueOf(par1PotionEffect.getPotionID()))) + { + ((PotionEffect)this.activePotionsMap.get(Integer.valueOf(par1PotionEffect.getPotionID()))).combine(par1PotionEffect); + this.onChangedPotionEffect((PotionEffect)this.activePotionsMap.get(Integer.valueOf(par1PotionEffect.getPotionID())), true); + } + else + { + this.activePotionsMap.put(Integer.valueOf(par1PotionEffect.getPotionID()), par1PotionEffect); + this.onNewPotionEffect(par1PotionEffect); + } + } + } + + public boolean isPotionApplicable(PotionEffect par1PotionEffect) + { + if (this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD) + { + int var2 = par1PotionEffect.getPotionID(); + + if (var2 == Potion.regeneration.id || var2 == Potion.poison.id) + { + return false; + } + } + + return true; + } + + /** + * Returns true if this entity is undead. + */ + public boolean isEntityUndead() + { + return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD; + } + + /** + * Remove the speified potion effect from this entity. + */ + public void removePotionEffectClient(int par1) + { + this.activePotionsMap.remove(Integer.valueOf(par1)); + } + + /** + * Remove the specified potion effect from this entity. + */ + public void removePotionEffect(int par1) + { + PotionEffect var2 = (PotionEffect)this.activePotionsMap.remove(Integer.valueOf(par1)); + + if (var2 != null) + { + this.onFinishedPotionEffect(var2); + } + } + + protected void onNewPotionEffect(PotionEffect par1PotionEffect) + { + this.potionsNeedUpdate = true; + + if (!this.worldObj.isRemote) + { + Potion.potionTypes[par1PotionEffect.getPotionID()].applyAttributesModifiersToEntity(this, this.getAttributeMap(), par1PotionEffect.getAmplifier()); + } + } + + protected void onChangedPotionEffect(PotionEffect par1PotionEffect, boolean par2) + { + this.potionsNeedUpdate = true; + + if (par2 && !this.worldObj.isRemote) + { + Potion.potionTypes[par1PotionEffect.getPotionID()].removeAttributesModifiersFromEntity(this, this.getAttributeMap(), par1PotionEffect.getAmplifier()); + Potion.potionTypes[par1PotionEffect.getPotionID()].applyAttributesModifiersToEntity(this, this.getAttributeMap(), par1PotionEffect.getAmplifier()); + } + } + + protected void onFinishedPotionEffect(PotionEffect par1PotionEffect) + { + this.potionsNeedUpdate = true; + + if (!this.worldObj.isRemote) + { + Potion.potionTypes[par1PotionEffect.getPotionID()].removeAttributesModifiersFromEntity(this, this.getAttributeMap(), par1PotionEffect.getAmplifier()); + } + } + + /** + * Heal living entity (param: amount of half-hearts) + */ + public void heal(float par1) + { + float var2 = this.getHealth(); + + if (var2 > 0.0F) + { + this.setHealth(var2 + par1); + } + } + + public final float getHealth() + { + return this.dataWatcher.getWatchableObjectFloat(6); + } + + public void setHealth(float par1) + { + this.dataWatcher.updateObject(6, Float.valueOf(MathHelper.clamp_float(par1, 0.0F, this.getMaxHealth()))); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else if (this.worldObj.isRemote) + { + return false; + } + else + { + this.entityAge = 0; + + if (this.getHealth() <= 0.0F) + { + return false; + } + else if (par1DamageSource.isFireDamage() && this.isPotionActive(Potion.fireResistance)) + { + return false; + } + else + { + if ((par1DamageSource == DamageSource.anvil || par1DamageSource == DamageSource.fallingBlock) && this.getCurrentItemOrArmor(4) != null) + { + this.getCurrentItemOrArmor(4).damageItem((int)(par2 * 4.0F + this.rand.nextFloat() * par2 * 2.0F), this); + par2 *= 0.75F; + } + + this.limbSwingAmount = 1.5F; + boolean var3 = true; + + if ((float)this.hurtResistantTime > (float)this.maxHurtResistantTime / 2.0F) + { + if (par2 <= this.lastDamage) + { + return false; + } + + this.damageEntity(par1DamageSource, par2 - this.lastDamage); + this.lastDamage = par2; + var3 = false; + } + else + { + this.lastDamage = par2; + this.prevHealth = this.getHealth(); + this.hurtResistantTime = this.maxHurtResistantTime; + this.damageEntity(par1DamageSource, par2); + this.hurtTime = this.maxHurtTime = 10; + } + + this.attackedAtYaw = 0.0F; + Entity var4 = par1DamageSource.getEntity(); + + if (var4 != null) + { + if (var4 instanceof EntityLivingBase) + { + this.setRevengeTarget((EntityLivingBase)var4); + } + + if (var4 instanceof EntityPlayer) + { + this.recentlyHit = 100; + this.attackingPlayer = (EntityPlayer)var4; + } + else if (var4 instanceof EntityWolf) + { + EntityWolf var5 = (EntityWolf)var4; + + if (var5.isTamed()) + { + this.recentlyHit = 100; + this.attackingPlayer = null; + } + } + } + + if (var3) + { + this.worldObj.setEntityState(this, (byte)2); + + if (par1DamageSource != DamageSource.drown) + { + this.setBeenAttacked(); + } + + if (var4 != null) + { + double var9 = var4.posX - this.posX; + double var7; + + for (var7 = var4.posZ - this.posZ; var9 * var9 + var7 * var7 < 1.0E-4D; var7 = (Math.random() - Math.random()) * 0.01D) + { + var9 = (Math.random() - Math.random()) * 0.01D; + } + + this.attackedAtYaw = (float)(Math.atan2(var7, var9) * 180.0D / Math.PI) - this.rotationYaw; + this.knockBack(var4, par2, var9, var7); + } + else + { + this.attackedAtYaw = (float)((int)(Math.random() * 2.0D) * 180); + } + } + + if (this.getHealth() <= 0.0F) + { + if (var3) + { + this.playSound(this.getDeathSound(), this.getSoundVolume(), this.getSoundPitch()); + } + + this.onDeath(par1DamageSource); + } + else if (var3) + { + this.playSound(this.getHurtSound(), this.getSoundVolume(), this.getSoundPitch()); + } + + return true; + } + } + } + + /** + * Renders broken item particles using the given ItemStack + */ + public void renderBrokenItemStack(ItemStack par1ItemStack) + { + this.playSound("random.break", 0.8F, 0.8F + this.worldObj.rand.nextFloat() * 0.4F); + + for (int var2 = 0; var2 < 5; ++var2) + { + Vec3 var3 = this.worldObj.getWorldVec3Pool().getVecFromPool(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); + var3.rotateAroundX(-this.rotationPitch * (float)Math.PI / 180.0F); + var3.rotateAroundY(-this.rotationYaw * (float)Math.PI / 180.0F); + Vec3 var4 = this.worldObj.getWorldVec3Pool().getVecFromPool(((double)this.rand.nextFloat() - 0.5D) * 0.3D, (double)(-this.rand.nextFloat()) * 0.6D - 0.3D, 0.6D); + var4.rotateAroundX(-this.rotationPitch * (float)Math.PI / 180.0F); + var4.rotateAroundY(-this.rotationYaw * (float)Math.PI / 180.0F); + var4 = var4.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); + this.worldObj.spawnParticle("iconcrack_" + par1ItemStack.getItem().itemID, var4.xCoord, var4.yCoord, var4.zCoord, var3.xCoord, var3.yCoord + 0.05D, var3.zCoord); + } + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource par1DamageSource) + { + Entity var2 = par1DamageSource.getEntity(); + EntityLivingBase var3 = this.func_94060_bK(); + + if (this.scoreValue >= 0 && var3 != null) + { + var3.addToPlayerScore(this, this.scoreValue); + } + + if (var2 != null) + { + var2.onKillEntity(this); + } + + this.dead = true; + + if (!this.worldObj.isRemote) + { + int var4 = 0; + + if (var2 instanceof EntityPlayer) + { + var4 = EnchantmentHelper.getLootingModifier((EntityLivingBase)var2); + } + + if (!this.isChild() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) + { + this.dropFewItems(this.recentlyHit > 0, var4); + this.dropEquipment(this.recentlyHit > 0, var4); + + if (this.recentlyHit > 0) + { + int var5 = this.rand.nextInt(200) - var4; + + if (var5 < 5) + { + this.dropRareDrop(var5 <= 0 ? 1 : 0); + } + } + } + } + + this.worldObj.setEntityState(this, (byte)3); + } + + /** + * Drop the equipment for this entity. + */ + protected void dropEquipment(boolean par1, int par2) {} + + /** + * knocks back this entity + */ + public void knockBack(Entity par1Entity, float par2, double par3, double par5) + { + if (this.rand.nextDouble() >= this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue()) + { + this.isAirBorne = true; + float var7 = MathHelper.sqrt_double(par3 * par3 + par5 * par5); + float var8 = 0.4F; + this.motionX /= 2.0D; + this.motionY /= 2.0D; + this.motionZ /= 2.0D; + this.motionX -= par3 / (double)var7 * (double)var8; + this.motionY += (double)var8; + this.motionZ -= par5 / (double)var7 * (double)var8; + + if (this.motionY > 0.4000000059604645D) + { + this.motionY = 0.4000000059604645D; + } + } + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "damage.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "damage.hit"; + } + + protected void dropRareDrop(int par1) {} + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) {} + + /** + * returns true if this entity is by a ladder, false otherwise + */ + public boolean isOnLadder() + { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.boundingBox.minY); + int var3 = MathHelper.floor_double(this.posZ); + int var4 = this.worldObj.getBlockId(var1, var2, var3); + return var4 == Block.ladder.blockID || var4 == Block.vine.blockID; + } + + /** + * Checks whether target entity is alive. + */ + public boolean isEntityAlive() + { + return !this.isDead && this.getHealth() > 0.0F; + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) + { + super.fall(par1); + PotionEffect var2 = this.getActivePotionEffect(Potion.jump); + float var3 = var2 != null ? (float)(var2.getAmplifier() + 1) : 0.0F; + int var4 = MathHelper.ceiling_float_int(par1 - 3.0F - var3); + + if (var4 > 0) + { + if (var4 > 4) + { + this.playSound("damage.fallbig", 1.0F, 1.0F); + } + else + { + this.playSound("damage.fallsmall", 1.0F, 1.0F); + } + + this.attackEntityFrom(DamageSource.fall, (float)var4); + int var5 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY - 0.20000000298023224D - (double)this.yOffset), MathHelper.floor_double(this.posZ)); + + if (var5 > 0) + { + StepSound var6 = Block.blocksList[var5].stepSound; + this.playSound(var6.getStepSound(), var6.getVolume() * 0.5F, var6.getPitch() * 0.75F); + } + } + } + + /** + * Setups the entity to do the hurt animation. Only used by packets in multiplayer. + */ + public void performHurtAnimation() + { + this.hurtTime = this.maxHurtTime = 10; + this.attackedAtYaw = 0.0F; + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + int var1 = 0; + ItemStack[] var2 = this.getLastActiveItems(); + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + ItemStack var5 = var2[var4]; + + if (var5 != null && var5.getItem() instanceof ItemArmor) + { + int var6 = ((ItemArmor)var5.getItem()).damageReduceAmount; + var1 += var6; + } + } + + return var1; + } + + protected void damageArmor(float par1) {} + + /** + * Reduces damage, depending on armor + */ + protected float applyArmorCalculations(DamageSource par1DamageSource, float par2) + { + if (!par1DamageSource.isUnblockable()) + { + int var3 = 25 - this.getTotalArmorValue(); + float var4 = par2 * (float)var3; + this.damageArmor(par2); + par2 = var4 / 25.0F; + } + + return par2; + } + + /** + * Reduces damage, depending on potions + */ + protected float applyPotionDamageCalculations(DamageSource par1DamageSource, float par2) + { + if (this instanceof EntityZombie) + { + par2 = par2; + } + + int var3; + int var4; + float var5; + + if (this.isPotionActive(Potion.resistance) && par1DamageSource != DamageSource.outOfWorld) + { + var3 = (this.getActivePotionEffect(Potion.resistance).getAmplifier() + 1) * 5; + var4 = 25 - var3; + var5 = par2 * (float)var4; + par2 = var5 / 25.0F; + } + + if (par2 <= 0.0F) + { + return 0.0F; + } + else + { + var3 = EnchantmentHelper.getEnchantmentModifierDamage(this.getLastActiveItems(), par1DamageSource); + + if (var3 > 20) + { + var3 = 20; + } + + if (var3 > 0 && var3 <= 20) + { + var4 = 25 - var3; + var5 = par2 * (float)var4; + par2 = var5 / 25.0F; + } + + return par2; + } + } + + /** + * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health + * second with the reduced value. Args: damageAmount + */ + protected void damageEntity(DamageSource par1DamageSource, float par2) + { + if (!this.isEntityInvulnerable()) + { + par2 = this.applyArmorCalculations(par1DamageSource, par2); + par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); + float var3 = par2; + par2 = Math.max(par2 - this.getAbsorptionAmount(), 0.0F); + this.setAbsorptionAmount(this.getAbsorptionAmount() - (var3 - par2)); + + if (par2 != 0.0F) + { + float var4 = this.getHealth(); + this.setHealth(var4 - par2); + this.func_110142_aN().func_94547_a(par1DamageSource, var4, par2); + this.setAbsorptionAmount(this.getAbsorptionAmount() - par2); + } + } + } + + public CombatTracker func_110142_aN() + { + return this._combatTracker; + } + + public EntityLivingBase func_94060_bK() + { + return (EntityLivingBase)(this._combatTracker.func_94550_c() != null ? this._combatTracker.func_94550_c() : (this.attackingPlayer != null ? this.attackingPlayer : (this.entityLivingToAttack != null ? this.entityLivingToAttack : null))); + } + + public final float getMaxHealth() + { + return (float)this.getEntityAttribute(SharedMonsterAttributes.maxHealth).getAttributeValue(); + } + + /** + * counts the amount of arrows stuck in the entity. getting hit by arrows increases this, used in rendering + */ + public final int getArrowCountInEntity() + { + return this.dataWatcher.getWatchableObjectByte(9); + } + + /** + * sets the amount of arrows stuck in the entity. used for rendering those + */ + public final void setArrowCountInEntity(int par1) + { + this.dataWatcher.updateObject(9, Byte.valueOf((byte)par1)); + } + + /** + * Returns an integer indicating the end point of the swing animation, used by {@link #swingProgress} to provide a + * progress indicator. Takes dig speed enchantments into account. + */ + private int getArmSwingAnimationEnd() + { + return this.isPotionActive(Potion.digSpeed) ? 6 - (1 + this.getActivePotionEffect(Potion.digSpeed).getAmplifier()) * 1 : (this.isPotionActive(Potion.digSlowdown) ? 6 + (1 + this.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) * 2 : 6); + } + + /** + * Swings the item the player is holding. + */ + public void swingItem() + { + if (!this.isSwingInProgress || this.swingProgressInt >= this.getArmSwingAnimationEnd() / 2 || this.swingProgressInt < 0) + { + this.swingProgressInt = -1; + this.isSwingInProgress = true; + + if (this.worldObj instanceof WorldServer) + { + ((WorldServer)this.worldObj).getEntityTracker().sendPacketToAllPlayersTrackingEntity(this, new Packet18Animation(this, 1)); + } + } + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 2) + { + this.limbSwingAmount = 1.5F; + this.hurtResistantTime = this.maxHurtResistantTime; + this.hurtTime = this.maxHurtTime = 10; + this.attackedAtYaw = 0.0F; + this.playSound(this.getHurtSound(), this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.attackEntityFrom(DamageSource.generic, 0.0F); + } + else if (par1 == 3) + { + this.playSound(this.getDeathSound(), this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.setHealth(0.0F); + this.onDeath(DamageSource.generic); + } + else + { + super.handleHealthUpdate(par1); + } + } + + /** + * sets the dead flag. Used when you fall off the bottom of the world. + */ + protected void kill() + { + this.attackEntityFrom(DamageSource.outOfWorld, 4.0F); + } + + /** + * Updates the arm swing progress counters and animation progress + */ + protected void updateArmSwingProgress() + { + int var1 = this.getArmSwingAnimationEnd(); + + if (this.isSwingInProgress) + { + ++this.swingProgressInt; + + if (this.swingProgressInt >= var1) + { + this.swingProgressInt = 0; + this.isSwingInProgress = false; + } + } + else + { + this.swingProgressInt = 0; + } + + this.swingProgress = (float)this.swingProgressInt / (float)var1; + } + + public AttributeInstance getEntityAttribute(Attribute par1Attribute) + { + return this.getAttributeMap().getAttributeInstance(par1Attribute); + } + + public BaseAttributeMap getAttributeMap() + { + if (this.attributeMap == null) + { + this.attributeMap = new ServersideAttributeMap(); + } + + return this.attributeMap; + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.UNDEFINED; + } + + /** + * Returns the item that this EntityLiving is holding, if any. + */ + public abstract ItemStack getHeldItem(); + + /** + * 0 = item, 1-n is armor + */ + public abstract ItemStack getCurrentItemOrArmor(int var1); + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public abstract void setCurrentItemOrArmor(int var1, ItemStack var2); + + /** + * Set sprinting switch for Entity. + */ + public void setSprinting(boolean par1) + { + super.setSprinting(par1); + AttributeInstance var2 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + + if (var2.getModifier(sprintingSpeedBoostModifierUUID) != null) + { + var2.removeModifier(sprintingSpeedBoostModifier); + } + + if (par1) + { + var2.applyModifier(sprintingSpeedBoostModifier); + } + } + + public abstract ItemStack[] getLastActiveItems(); + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 1.0F; + } + + /** + * Gets the pitch of living sounds in living entities. + */ + protected float getSoundPitch() + { + return this.isChild() ? (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.5F : (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F; + } + + /** + * Dead and sleeping entities cannot move + */ + protected boolean isMovementBlocked() + { + return this.getHealth() <= 0.0F; + } + + /** + * Move the entity to the coordinates informed, but keep yaw/pitch values. + */ + public void setPositionAndUpdate(double par1, double par3, double par5) + { + this.setLocationAndAngles(par1, par3, par5, this.rotationYaw, this.rotationPitch); + } + + /** + * Moves the entity to a position out of the way of its mount. + */ + public void dismountEntity(Entity par1Entity) + { + double var3 = par1Entity.posX; + double var5 = par1Entity.boundingBox.minY + (double)par1Entity.height; + double var7 = par1Entity.posZ; + + for (double var9 = -1.5D; var9 < 2.0D; ++var9) + { + for (double var11 = -1.5D; var11 < 2.0D; ++var11) + { + if (var9 != 0.0D || var11 != 0.0D) + { + int var13 = (int)(this.posX + var9); + int var14 = (int)(this.posZ + var11); + AxisAlignedBB var2 = this.boundingBox.getOffsetBoundingBox(var9, 1.0D, var11); + + if (this.worldObj.getCollidingBlockBounds(var2).isEmpty()) + { + if (this.worldObj.doesBlockHaveSolidTopSurface(var13, (int)this.posY, var14)) + { + this.setPositionAndUpdate(this.posX + var9, this.posY + 1.0D, this.posZ + var11); + return; + } + + if (this.worldObj.doesBlockHaveSolidTopSurface(var13, (int)this.posY - 1, var14) || this.worldObj.getBlockMaterial(var13, (int)this.posY - 1, var14) == Material.water) + { + var3 = this.posX + var9; + var5 = this.posY + 1.0D; + var7 = this.posZ + var11; + } + } + } + } + } + + this.setPositionAndUpdate(var3, var5, var7); + } + + public boolean getAlwaysRenderNameTagForRender() + { + return false; + } + + /** + * Gets the Icon Index of the item currently held + */ + public Icon getItemIcon(ItemStack par1ItemStack, int par2) + { + return par1ItemStack.getIconIndex(); + } + + /** + * Causes this entity to do an upwards motion (jumping). + */ + protected void jump() + { + this.motionY = 0.41999998688697815D; + + if (this.isPotionActive(Potion.jump)) + { + this.motionY += (double)((float)(this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F); + } + + if (this.isSprinting()) + { + float var1 = this.rotationYaw * 0.017453292F; + this.motionX -= (double)(MathHelper.sin(var1) * 0.2F); + this.motionZ += (double)(MathHelper.cos(var1) * 0.2F); + } + + this.isAirBorne = true; + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float par1, float par2) + { + double var9; + + if (this.isInWater() && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).capabilities.isFlying)) + { + var9 = this.posY; + this.moveFlying(par1, par2, this.isAIEnabled() ? 0.04F : 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.800000011920929D; + this.motionY *= 0.800000011920929D; + this.motionZ *= 0.800000011920929D; + this.motionY -= 0.02D; + + if (this.isCollidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, this.motionY + 0.6000000238418579D - this.posY + var9, this.motionZ)) + { + this.motionY = 0.30000001192092896D; + } + } + else if (this.handleLavaMovement() && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).capabilities.isFlying)) + { + var9 = this.posY; + this.moveFlying(par1, par2, 0.02F); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + this.motionY -= 0.02D; + + if (this.isCollidedHorizontally && this.isOffsetPositionInLiquid(this.motionX, this.motionY + 0.6000000238418579D - this.posY + var9, this.motionZ)) + { + this.motionY = 0.30000001192092896D; + } + } + else + { + float var3 = 0.91F; + + if (this.onGround) + { + var3 = 0.54600006F; + int var4 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + + if (var4 > 0) + { + var3 = Block.blocksList[var4].slipperiness * 0.91F; + } + } + + float var8 = 0.16277136F / (var3 * var3 * var3); + float var5; + + if (this.onGround) + { + var5 = this.getAIMoveSpeed() * var8; + } + else + { + var5 = this.jumpMovementFactor; + } + + this.moveFlying(par1, par2, var5); + var3 = 0.91F; + + if (this.onGround) + { + var3 = 0.54600006F; + int var6 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + + if (var6 > 0) + { + var3 = Block.blocksList[var6].slipperiness * 0.91F; + } + } + + if (this.isOnLadder()) + { + float var11 = 0.15F; + + if (this.motionX < (double)(-var11)) + { + this.motionX = (double)(-var11); + } + + if (this.motionX > (double)var11) + { + this.motionX = (double)var11; + } + + if (this.motionZ < (double)(-var11)) + { + this.motionZ = (double)(-var11); + } + + if (this.motionZ > (double)var11) + { + this.motionZ = (double)var11; + } + + this.fallDistance = 0.0F; + + if (this.motionY < -0.15D) + { + this.motionY = -0.15D; + } + + boolean var7 = this.isSneaking() && this instanceof EntityPlayer; + + if (var7 && this.motionY < 0.0D) + { + this.motionY = 0.0D; + } + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.isCollidedHorizontally && this.isOnLadder()) + { + this.motionY = 0.2D; + } + + if (this.worldObj.isRemote && (!this.worldObj.blockExists((int)this.posX, 0, (int)this.posZ) || !this.worldObj.getChunkFromBlockCoords((int)this.posX, (int)this.posZ).isChunkLoaded)) + { + if (this.posY > 0.0D) + { + this.motionY = -0.1D; + } + else + { + this.motionY = 0.0D; + } + } + else + { + this.motionY -= 0.08D; + } + + this.motionY *= 0.9800000190734863D; + this.motionX *= (double)var3; + this.motionZ *= (double)var3; + } + + this.prevLimbSwingAmount = this.limbSwingAmount; + var9 = this.posX - this.prevPosX; + double var10 = this.posZ - this.prevPosZ; + float var12 = MathHelper.sqrt_double(var9 * var9 + var10 * var10) * 4.0F; + + if (var12 > 1.0F) + { + var12 = 1.0F; + } + + this.limbSwingAmount += (var12 - this.limbSwingAmount) * 0.4F; + this.limbSwing += this.limbSwingAmount; + } + + /** + * Returns true if the newer Entity AI code should be run + */ + protected boolean isAIEnabled() + { + return false; + } + + /** + * the movespeed used for the new AI system + */ + public float getAIMoveSpeed() + { + return this.isAIEnabled() ? this.landMovementFactor : 0.1F; + } + + /** + * set the movespeed used for the new AI system + */ + public void setAIMoveSpeed(float par1) + { + this.landMovementFactor = par1; + } + + public boolean attackEntityAsMob(Entity par1Entity) + { + this.setLastAttacker(par1Entity); + return false; + } + + /** + * Returns whether player is sleeping or not + */ + public boolean isPlayerSleeping() + { + return false; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (!this.worldObj.isRemote) + { + int var1 = this.getArrowCountInEntity(); + + if (var1 > 0) + { + if (this.arrowHitTimer <= 0) + { + this.arrowHitTimer = 20 * (30 - var1); + } + + --this.arrowHitTimer; + + if (this.arrowHitTimer <= 0) + { + this.setArrowCountInEntity(var1 - 1); + } + } + + for (int var2 = 0; var2 < 5; ++var2) + { + ItemStack var3 = this.previousEquipment[var2]; + ItemStack var4 = this.getCurrentItemOrArmor(var2); + + if (!ItemStack.areItemStacksEqual(var4, var3)) + { + ((WorldServer)this.worldObj).getEntityTracker().sendPacketToAllPlayersTrackingEntity(this, new Packet5PlayerInventory(this.entityId, var2, var4)); + + if (var3 != null) + { + this.attributeMap.removeAttributeModifiers(var3.getAttributeModifiers()); + } + + if (var4 != null) + { + this.attributeMap.applyAttributeModifiers(var4.getAttributeModifiers()); + } + + this.previousEquipment[var2] = var4 == null ? null : var4.copy(); + } + } + } + + this.onLivingUpdate(); + double var9 = this.posX - this.prevPosX; + double var10 = this.posZ - this.prevPosZ; + float var5 = (float)(var9 * var9 + var10 * var10); + float var6 = this.renderYawOffset; + float var7 = 0.0F; + this.field_70768_au = this.field_110154_aX; + float var8 = 0.0F; + + if (var5 > 0.0025000002F) + { + var8 = 1.0F; + var7 = (float)Math.sqrt((double)var5) * 3.0F; + var6 = (float)Math.atan2(var10, var9) * 180.0F / (float)Math.PI - 90.0F; + } + + if (this.swingProgress > 0.0F) + { + var6 = this.rotationYaw; + } + + if (!this.onGround) + { + var8 = 0.0F; + } + + this.field_110154_aX += (var8 - this.field_110154_aX) * 0.3F; + this.worldObj.theProfiler.startSection("headTurn"); + var7 = this.func_110146_f(var6, var7); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("rangeChecks"); + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + while (this.renderYawOffset - this.prevRenderYawOffset < -180.0F) + { + this.prevRenderYawOffset -= 360.0F; + } + + while (this.renderYawOffset - this.prevRenderYawOffset >= 180.0F) + { + this.prevRenderYawOffset += 360.0F; + } + + while (this.rotationPitch - this.prevRotationPitch < -180.0F) + { + this.prevRotationPitch -= 360.0F; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYawHead - this.prevRotationYawHead < -180.0F) + { + this.prevRotationYawHead -= 360.0F; + } + + while (this.rotationYawHead - this.prevRotationYawHead >= 180.0F) + { + this.prevRotationYawHead += 360.0F; + } + + this.worldObj.theProfiler.endSection(); + this.field_70764_aw += var7; + } + + protected float func_110146_f(float par1, float par2) + { + float var3 = MathHelper.wrapAngleTo180_float(par1 - this.renderYawOffset); + this.renderYawOffset += var3 * 0.3F; + float var4 = MathHelper.wrapAngleTo180_float(this.rotationYaw - this.renderYawOffset); + boolean var5 = var4 < -90.0F || var4 >= 90.0F; + + if (var4 < -75.0F) + { + var4 = -75.0F; + } + + if (var4 >= 75.0F) + { + var4 = 75.0F; + } + + this.renderYawOffset = this.rotationYaw - var4; + + if (var4 * var4 > 2500.0F) + { + this.renderYawOffset += var4 * 0.2F; + } + + if (var5) + { + par2 *= -1.0F; + } + + return par2; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.jumpTicks > 0) + { + --this.jumpTicks; + } + + if (this.newPosRotationIncrements > 0) + { + double var1 = this.posX + (this.newPosX - this.posX) / (double)this.newPosRotationIncrements; + double var3 = this.posY + (this.newPosY - this.posY) / (double)this.newPosRotationIncrements; + double var5 = this.posZ + (this.newPosZ - this.posZ) / (double)this.newPosRotationIncrements; + double var7 = MathHelper.wrapAngleTo180_double(this.newRotationYaw - (double)this.rotationYaw); + this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.newPosRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.newRotationPitch - (double)this.rotationPitch) / (double)this.newPosRotationIncrements); + --this.newPosRotationIncrements; + this.setPosition(var1, var3, var5); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + else if (!this.isClientWorld()) + { + this.motionX *= 0.98D; + this.motionY *= 0.98D; + this.motionZ *= 0.98D; + } + + if (Math.abs(this.motionX) < 0.005D) + { + this.motionX = 0.0D; + } + + if (Math.abs(this.motionY) < 0.005D) + { + this.motionY = 0.0D; + } + + if (Math.abs(this.motionZ) < 0.005D) + { + this.motionZ = 0.0D; + } + + this.worldObj.theProfiler.startSection("ai"); + + if (this.isMovementBlocked()) + { + this.isJumping = false; + this.moveStrafing = 0.0F; + this.moveForward = 0.0F; + this.randomYawVelocity = 0.0F; + } + else if (this.isClientWorld()) + { + if (this.isAIEnabled()) + { + this.worldObj.theProfiler.startSection("newAi"); + this.updateAITasks(); + this.worldObj.theProfiler.endSection(); + } + else + { + this.worldObj.theProfiler.startSection("oldAi"); + this.updateEntityActionState(); + this.worldObj.theProfiler.endSection(); + this.rotationYawHead = this.rotationYaw; + } + } + + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("jump"); + + if (this.isJumping) + { + if (!this.isInWater() && !this.handleLavaMovement()) + { + if (this.onGround && this.jumpTicks == 0) + { + this.jump(); + this.jumpTicks = 10; + } + } + else + { + this.motionY += 0.03999999910593033D; + } + } + else + { + this.jumpTicks = 0; + } + + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("travel"); + this.moveStrafing *= 0.98F; + this.moveForward *= 0.98F; + this.randomYawVelocity *= 0.9F; + this.moveEntityWithHeading(this.moveStrafing, this.moveForward); + this.worldObj.theProfiler.endSection(); + this.worldObj.theProfiler.startSection("push"); + + if (!this.worldObj.isRemote) + { + this.collideWithNearbyEntities(); + } + + this.worldObj.theProfiler.endSection(); + } + + protected void updateAITasks() {} + + protected void collideWithNearbyEntities() + { + List var1 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + + if (var1 != null && !var1.isEmpty()) + { + for (int var2 = 0; var2 < var1.size(); ++var2) + { + Entity var3 = (Entity)var1.get(var2); + + if (var3.canBePushed()) + { + this.collideWithEntity(var3); + } + } + } + } + + protected void collideWithEntity(Entity par1Entity) + { + par1Entity.applyEntityCollision(this); + } + + /** + * Handles updating while being ridden by an entity + */ + public void updateRidden() + { + super.updateRidden(); + this.field_70768_au = this.field_110154_aX; + this.field_110154_aX = 0.0F; + this.fallDistance = 0.0F; + } + + /** + * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, + * posY, posZ, yaw, pitch + */ + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) + { + this.yOffset = 0.0F; + this.newPosX = par1; + this.newPosY = par3; + this.newPosZ = par5; + this.newRotationYaw = (double)par7; + this.newRotationPitch = (double)par8; + this.newPosRotationIncrements = par9; + } + + /** + * main AI tick function, replaces updateEntityActionState + */ + protected void updateAITick() {} + + protected void updateEntityActionState() + { + ++this.entityAge; + } + + public void setJumping(boolean par1) + { + this.isJumping = par1; + } + + /** + * Called whenever an item is picked up from walking over it. Args: pickedUpEntity, stackSize + */ + public void onItemPickup(Entity par1Entity, int par2) + { + if (!par1Entity.isDead && !this.worldObj.isRemote) + { + EntityTracker var3 = ((WorldServer)this.worldObj).getEntityTracker(); + + if (par1Entity instanceof EntityItem) + { + var3.sendPacketToAllPlayersTrackingEntity(par1Entity, new Packet22Collect(par1Entity.entityId, this.entityId)); + } + + if (par1Entity instanceof EntityArrow) + { + var3.sendPacketToAllPlayersTrackingEntity(par1Entity, new Packet22Collect(par1Entity.entityId, this.entityId)); + } + + if (par1Entity instanceof EntityXPOrb) + { + var3.sendPacketToAllPlayersTrackingEntity(par1Entity, new Packet22Collect(par1Entity.entityId, this.entityId)); + } + } + } + + /** + * returns true if the entity provided in the argument can be seen. (Raytrace) + */ + public boolean canEntityBeSeen(Entity par1Entity) + { + return this.worldObj.clip(this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ), this.worldObj.getWorldVec3Pool().getVecFromPool(par1Entity.posX, par1Entity.posY + (double)par1Entity.getEyeHeight(), par1Entity.posZ)) == null; + } + + /** + * returns a (normalized) vector of where this entity is looking + */ + public Vec3 getLookVec() + { + return this.getLook(1.0F); + } + + /** + * interpolated look vector + */ + public Vec3 getLook(float par1) + { + float var2; + float var3; + float var4; + float var5; + + if (par1 == 1.0F) + { + var2 = MathHelper.cos(-this.rotationYaw * 0.017453292F - (float)Math.PI); + var3 = MathHelper.sin(-this.rotationYaw * 0.017453292F - (float)Math.PI); + var4 = -MathHelper.cos(-this.rotationPitch * 0.017453292F); + var5 = MathHelper.sin(-this.rotationPitch * 0.017453292F); + return this.worldObj.getWorldVec3Pool().getVecFromPool((double)(var3 * var4), (double)var5, (double)(var2 * var4)); + } + else + { + var2 = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * par1; + var3 = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * par1; + var4 = MathHelper.cos(-var3 * 0.017453292F - (float)Math.PI); + var5 = MathHelper.sin(-var3 * 0.017453292F - (float)Math.PI); + float var6 = -MathHelper.cos(-var2 * 0.017453292F); + float var7 = MathHelper.sin(-var2 * 0.017453292F); + return this.worldObj.getWorldVec3Pool().getVecFromPool((double)(var5 * var6), (double)var7, (double)(var4 * var6)); + } + } + + /** + * Returns where in the swing animation the living entity is (from 0 to 1). Args: partialTickTime + */ + public float getSwingProgress(float par1) + { + float var2 = this.swingProgress - this.prevSwingProgress; + + if (var2 < 0.0F) + { + ++var2; + } + + return this.prevSwingProgress + var2 * par1; + } + + /** + * interpolated position vector + */ + public Vec3 getPosition(float par1) + { + if (par1 == 1.0F) + { + return this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); + } + else + { + double var2 = this.prevPosX + (this.posX - this.prevPosX) * (double)par1; + double var4 = this.prevPosY + (this.posY - this.prevPosY) * (double)par1; + double var6 = this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par1; + return this.worldObj.getWorldVec3Pool().getVecFromPool(var2, var4, var6); + } + } + + /** + * Performs a ray trace for the distance specified and using the partial tick time. Args: distance, partialTickTime + */ + public MovingObjectPosition rayTrace(double par1, float par3) + { + Vec3 var4 = this.getPosition(par3); + Vec3 var5 = this.getLook(par3); + Vec3 var6 = var4.addVector(var5.xCoord * par1, var5.yCoord * par1, var5.zCoord * par1); + return this.worldObj.clip(var4, var6); + } + + /** + * Returns whether the entity is in a local (client) world + */ + public boolean isClientWorld() + { + return !this.worldObj.isRemote; + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return !this.isDead; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return !this.isDead; + } + + public float getEyeHeight() + { + return this.height * 0.85F; + } + + /** + * Sets that this entity has been attacked. + */ + protected void setBeenAttacked() + { + this.velocityChanged = this.rand.nextDouble() >= this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue(); + } + + public float getRotationYawHead() + { + return this.rotationYawHead; + } + + /** + * Sets the head's yaw rotation of the entity. + */ + public void setRotationYawHead(float par1) + { + this.rotationYawHead = par1; + } + + public float getAbsorptionAmount() + { + return this.field_110151_bq; + } + + public void setAbsorptionAmount(float par1) + { + if (par1 < 0.0F) + { + par1 = 0.0F; + } + + this.field_110151_bq = par1; + } + + public Team getTeam() + { + return null; + } + + public boolean isOnSameTeam(EntityLivingBase par1EntityLivingBase) + { + return this.isOnTeam(par1EntityLivingBase.getTeam()); + } + + /** + * Returns true if the entity is on a specific team. + */ + public boolean isOnTeam(Team par1Team) + { + return this.getTeam() != null ? this.getTeam().isSameTeam(par1Team) : false; + } +} diff --git a/src/main/java/net/minecraft/src/EntityLivingData.java b/src/main/java/net/minecraft/src/EntityLivingData.java new file mode 100644 index 0000000..2231182 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityLivingData.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public interface EntityLivingData +{ +} diff --git a/src/main/java/net/minecraft/src/EntityLookHelper.java b/src/main/java/net/minecraft/src/EntityLookHelper.java new file mode 100644 index 0000000..ec66836 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityLookHelper.java @@ -0,0 +1,119 @@ +package net.minecraft.src; + +public class EntityLookHelper +{ + private EntityLiving entity; + + /** + * The amount of change that is made each update for an entity facing a direction. + */ + private float deltaLookYaw; + + /** + * The amount of change that is made each update for an entity facing a direction. + */ + private float deltaLookPitch; + + /** Whether or not the entity is trying to look at something. */ + private boolean isLooking; + private double posX; + private double posY; + private double posZ; + + public EntityLookHelper(EntityLiving par1EntityLiving) + { + this.entity = par1EntityLiving; + } + + /** + * Sets position to look at using entity + */ + public void setLookPositionWithEntity(Entity par1Entity, float par2, float par3) + { + this.posX = par1Entity.posX; + + if (par1Entity instanceof EntityLivingBase) + { + this.posY = par1Entity.posY + (double)par1Entity.getEyeHeight(); + } + else + { + this.posY = (par1Entity.boundingBox.minY + par1Entity.boundingBox.maxY) / 2.0D; + } + + this.posZ = par1Entity.posZ; + this.deltaLookYaw = par2; + this.deltaLookPitch = par3; + this.isLooking = true; + } + + /** + * Sets position to look at + */ + public void setLookPosition(double par1, double par3, double par5, float par7, float par8) + { + this.posX = par1; + this.posY = par3; + this.posZ = par5; + this.deltaLookYaw = par7; + this.deltaLookPitch = par8; + this.isLooking = true; + } + + /** + * Updates look + */ + public void onUpdateLook() + { + this.entity.rotationPitch = 0.0F; + + if (this.isLooking) + { + this.isLooking = false; + double var1 = this.posX - this.entity.posX; + double var3 = this.posY - (this.entity.posY + (double)this.entity.getEyeHeight()); + double var5 = this.posZ - this.entity.posZ; + double var7 = (double)MathHelper.sqrt_double(var1 * var1 + var5 * var5); + float var9 = (float)(Math.atan2(var5, var1) * 180.0D / Math.PI) - 90.0F; + float var10 = (float)(-(Math.atan2(var3, var7) * 180.0D / Math.PI)); + this.entity.rotationPitch = this.updateRotation(this.entity.rotationPitch, var10, this.deltaLookPitch); + this.entity.rotationYawHead = this.updateRotation(this.entity.rotationYawHead, var9, this.deltaLookYaw); + } + else + { + this.entity.rotationYawHead = this.updateRotation(this.entity.rotationYawHead, this.entity.renderYawOffset, 10.0F); + } + + float var11 = MathHelper.wrapAngleTo180_float(this.entity.rotationYawHead - this.entity.renderYawOffset); + + if (!this.entity.getNavigator().noPath()) + { + if (var11 < -75.0F) + { + this.entity.rotationYawHead = this.entity.renderYawOffset - 75.0F; + } + + if (var11 > 75.0F) + { + this.entity.rotationYawHead = this.entity.renderYawOffset + 75.0F; + } + } + } + + private float updateRotation(float par1, float par2, float par3) + { + float var4 = MathHelper.wrapAngleTo180_float(par2 - par1); + + if (var4 > par3) + { + var4 = par3; + } + + if (var4 < -par3) + { + var4 = -par3; + } + + return par1 + var4; + } +} diff --git a/src/main/java/net/minecraft/src/EntityMagmaCube.java b/src/main/java/net/minecraft/src/EntityMagmaCube.java new file mode 100644 index 0000000..a23da67 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMagmaCube.java @@ -0,0 +1,181 @@ +package net.minecraft.src; + +public class EntityMagmaCube extends EntitySlime +{ + public EntityMagmaCube(World par1World) + { + super(par1World); + this.isImmuneToFire = true; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.20000000298023224D); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.worldObj.difficultySetting > 0 && this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + return this.getSlimeSize() * 3; + } + + public int getBrightnessForRender(float par1) + { + return 15728880; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + return 1.0F; + } + + /** + * Returns the name of a particle effect that may be randomly created by EntitySlime.onUpdate() + */ + protected String getSlimeParticle() + { + return "flame"; + } + + protected EntitySlime createInstance() + { + return new EntityMagmaCube(this.worldObj); + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.magmaCream.itemID; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.getDropItemId(); + + if (var3 > 0 && this.getSlimeSize() > 1) + { + int var4 = this.rand.nextInt(4) - 2; + + if (par2 > 0) + { + var4 += this.rand.nextInt(par2 + 1); + } + + for (int var5 = 0; var5 < var4; ++var5) + { + this.dropItem(var3, 1); + } + } + } + + /** + * Returns true if the entity is on fire. Used by render to add the fire effect on rendering. + */ + public boolean isBurning() + { + return false; + } + + /** + * Gets the amount of time the slime needs to wait between jumps. + */ + protected int getJumpDelay() + { + return super.getJumpDelay() * 4; + } + + protected void alterSquishAmount() + { + this.squishAmount *= 0.9F; + } + + /** + * Causes this entity to do an upwards motion (jumping). + */ + protected void jump() + { + this.motionY = (double)(0.42F + (float)this.getSlimeSize() * 0.1F); + this.isAirBorne = true; + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) {} + + /** + * Indicates weather the slime is able to damage the player (based upon the slime's size) + */ + protected boolean canDamagePlayer() + { + return true; + } + + /** + * Gets the amount of damage dealt to the player when "attacked" by the slime. + */ + protected int getAttackStrength() + { + return super.getAttackStrength() + 2; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small"); + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small"); + } + + /** + * Returns the name of the sound played when the slime jumps. + */ + protected String getJumpSound() + { + return this.getSlimeSize() > 1 ? "mob.magmacube.big" : "mob.magmacube.small"; + } + + /** + * Whether or not the current entity is in lava + */ + public boolean handleLavaMovement() + { + return false; + } + + /** + * Returns true if the slime makes a sound when it lands after a jump (based upon the slime's size) + */ + protected boolean makesSoundOnLand() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/EntityMinecart.java b/src/main/java/net/minecraft/src/EntityMinecart.java new file mode 100644 index 0000000..13a6449 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMinecart.java @@ -0,0 +1,1146 @@ +package net.minecraft.src; + +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public abstract class EntityMinecart extends Entity +{ + private boolean isInReverse; + private final IUpdatePlayerListBox field_82344_g; + private String entityName; + + /** Minecart rotational logic matrix */ + private static final int[][][] matrix = new int[][][] {{{0, 0, -1}, {0, 0, 1}}, {{ -1, 0, 0}, {1, 0, 0}}, {{ -1, -1, 0}, {1, 0, 0}}, {{ -1, 0, 0}, {1, -1, 0}}, {{0, 0, -1}, {0, -1, 1}}, {{0, -1, -1}, {0, 0, 1}}, {{0, 0, 1}, {1, 0, 0}}, {{0, 0, 1}, { -1, 0, 0}}, {{0, 0, -1}, { -1, 0, 0}}, {{0, 0, -1}, {1, 0, 0}}}; + + /** appears to be the progress of the turn */ + private int turnProgress; + private double minecartX; + private double minecartY; + private double minecartZ; + private double minecartYaw; + private double minecartPitch; + private double velocityX; + private double velocityY; + private double velocityZ; + + public EntityMinecart(World par1World) + { + super(par1World); + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.7F); + this.yOffset = this.height / 2.0F; + this.field_82344_g = par1World != null ? par1World.getMinecartSoundUpdater(this) : null; + } + + /** + * Creates a new minecart of the specified type in the specified location in the given world. par0World - world to + * create the minecart in, double par1,par3,par5 represent x,y,z respectively. int par7 specifies the type: 1 for + * MinecartChest, 2 for MinecartFurnace, 3 for MinecartTNT, 4 for MinecartMobSpawner, 5 for MinecartHopper and 0 for + * a standard empty minecart + */ + public static EntityMinecart createMinecart(World par0World, double par1, double par3, double par5, int par7) + { + switch (par7) + { + case 1: + return new EntityMinecartChest(par0World, par1, par3, par5); + + case 2: + return new EntityMinecartFurnace(par0World, par1, par3, par5); + + case 3: + return new EntityMinecartTNT(par0World, par1, par3, par5); + + case 4: + return new EntityMinecartMobSpawner(par0World, par1, par3, par5); + + case 5: + return new EntityMinecartHopper(par0World, par1, par3, par5); + + default: + return new EntityMinecartEmpty(par0World, par1, par3, par5); + } + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + protected void entityInit() + { + this.dataWatcher.addObject(17, new Integer(0)); + this.dataWatcher.addObject(18, new Integer(1)); + this.dataWatcher.addObject(19, new Float(0.0F)); + this.dataWatcher.addObject(20, new Integer(0)); + this.dataWatcher.addObject(21, new Integer(6)); + this.dataWatcher.addObject(22, Byte.valueOf((byte)0)); + } + + /** + * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be + * pushable on contact, like boats or minecarts. + */ + public AxisAlignedBB getCollisionBox(Entity par1Entity) + { + return par1Entity.canBePushed() ? par1Entity.boundingBox : null; + } + + /** + * returns the bounding box for this entity + */ + public AxisAlignedBB getBoundingBox() + { + return null; + } + + /** + * Returns true if this entity should push and be pushed by other entities when colliding. + */ + public boolean canBePushed() + { + return true; + } + + public EntityMinecart(World par1World, double par2, double par4, double par6) + { + this(par1World); + this.setPosition(par2, par4, par6); + this.motionX = 0.0D; + this.motionY = 0.0D; + this.motionZ = 0.0D; + this.prevPosX = par2; + this.prevPosY = par4; + this.prevPosZ = par6; + } + + /** + * Returns the Y offset from the entity's position for any entity riding this one. + */ + public double getMountedYOffset() + { + return (double)this.height * 0.0D - 0.30000001192092896D; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (!this.worldObj.isRemote && !this.isDead) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + this.setRollingDirection(-this.getRollingDirection()); + this.setRollingAmplitude(10); + this.setBeenAttacked(); + this.setDamage(this.getDamage() + par2 * 10.0F); + boolean var3 = par1DamageSource.getEntity() instanceof EntityPlayer && ((EntityPlayer)par1DamageSource.getEntity()).capabilities.isCreativeMode; + + if (var3 || this.getDamage() > 40.0F) + { + if (this.riddenByEntity != null) + { + this.riddenByEntity.mountEntity(this); + } + + if (var3 && !this.isInvNameLocalized()) + { + this.setDead(); + } + else + { + this.killMinecart(par1DamageSource); + } + } + + return true; + } + } + else + { + return true; + } + } + + public void killMinecart(DamageSource par1DamageSource) + { + this.setDead(); + ItemStack var2 = new ItemStack(Item.minecartEmpty, 1); + + if (this.entityName != null) + { + var2.setItemName(this.entityName); + } + + this.entityDropItem(var2, 0.0F); + } + + /** + * Setups the entity to do the hurt animation. Only used by packets in multiplayer. + */ + public void performHurtAnimation() + { + this.setRollingDirection(-this.getRollingDirection()); + this.setRollingAmplitude(10); + this.setDamage(this.getDamage() + this.getDamage() * 10.0F); + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return !this.isDead; + } + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + super.setDead(); + + if (this.field_82344_g != null) + { + this.field_82344_g.update(); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (this.field_82344_g != null) + { + this.field_82344_g.update(); + } + + if (this.getRollingAmplitude() > 0) + { + this.setRollingAmplitude(this.getRollingAmplitude() - 1); + } + + if (this.getDamage() > 0.0F) + { + this.setDamage(this.getDamage() - 1.0F); + } + + if (this.posY < -64.0D) + { + this.kill(); + } + + int var2; + + if (!this.worldObj.isRemote && this.worldObj instanceof WorldServer) + { + this.worldObj.theProfiler.startSection("portal"); + MinecraftServer var1 = ((WorldServer)this.worldObj).getMinecraftServer(); + var2 = this.getMaxInPortalTime(); + + if (this.inPortal) + { + if (var1.getAllowNether()) + { + if (this.ridingEntity == null && this.portalCounter++ >= var2) + { + this.portalCounter = var2; + this.timeUntilPortal = this.getPortalCooldown(); + byte var3; + + if (this.worldObj.provider.dimensionId == -1) + { + var3 = 0; + } + else + { + var3 = -1; + } + + this.travelToDimension(var3); + } + + this.inPortal = false; + } + } + else + { + if (this.portalCounter > 0) + { + this.portalCounter -= 4; + } + + if (this.portalCounter < 0) + { + this.portalCounter = 0; + } + } + + if (this.timeUntilPortal > 0) + { + --this.timeUntilPortal; + } + + this.worldObj.theProfiler.endSection(); + } + + if (this.worldObj.isRemote) + { + if (this.turnProgress > 0) + { + double var19 = this.posX + (this.minecartX - this.posX) / (double)this.turnProgress; + double var21 = this.posY + (this.minecartY - this.posY) / (double)this.turnProgress; + double var5 = this.posZ + (this.minecartZ - this.posZ) / (double)this.turnProgress; + double var7 = MathHelper.wrapAngleTo180_double(this.minecartYaw - (double)this.rotationYaw); + this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.turnProgress); + this.rotationPitch = (float)((double)this.rotationPitch + (this.minecartPitch - (double)this.rotationPitch) / (double)this.turnProgress); + --this.turnProgress; + this.setPosition(var19, var21, var5); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + else + { + this.setPosition(this.posX, this.posY, this.posZ); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + } + else + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= 0.03999999910593033D; + int var18 = MathHelper.floor_double(this.posX); + var2 = MathHelper.floor_double(this.posY); + int var20 = MathHelper.floor_double(this.posZ); + + if (BlockRailBase.isRailBlockAt(this.worldObj, var18, var2 - 1, var20)) + { + --var2; + } + + double var4 = 0.4D; + double var6 = 0.0078125D; + int var8 = this.worldObj.getBlockId(var18, var2, var20); + + if (BlockRailBase.isRailBlock(var8)) + { + int var9 = this.worldObj.getBlockMetadata(var18, var2, var20); + this.updateOnTrack(var18, var2, var20, var4, var6, var8, var9); + + if (var8 == Block.railActivator.blockID) + { + this.onActivatorRailPass(var18, var2, var20, (var9 & 8) != 0); + } + } + else + { + this.func_94088_b(var4); + } + + this.doBlockCollisions(); + this.rotationPitch = 0.0F; + double var22 = this.prevPosX - this.posX; + double var11 = this.prevPosZ - this.posZ; + + if (var22 * var22 + var11 * var11 > 0.001D) + { + this.rotationYaw = (float)(Math.atan2(var11, var22) * 180.0D / Math.PI); + + if (this.isInReverse) + { + this.rotationYaw += 180.0F; + } + } + + double var13 = (double)MathHelper.wrapAngleTo180_float(this.rotationYaw - this.prevRotationYaw); + + if (var13 < -170.0D || var13 >= 170.0D) + { + this.rotationYaw += 180.0F; + this.isInReverse = !this.isInReverse; + } + + this.setRotation(this.rotationYaw, this.rotationPitch); + List var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D)); + + if (var15 != null && !var15.isEmpty()) + { + for (int var16 = 0; var16 < var15.size(); ++var16) + { + Entity var17 = (Entity)var15.get(var16); + + if (var17 != this.riddenByEntity && var17.canBePushed() && var17 instanceof EntityMinecart) + { + var17.applyEntityCollision(this); + } + } + } + + if (this.riddenByEntity != null && this.riddenByEntity.isDead) + { + if (this.riddenByEntity.ridingEntity == this) + { + this.riddenByEntity.ridingEntity = null; + } + + this.riddenByEntity = null; + } + } + } + + /** + * Called every tick the minecart is on an activator rail. + */ + public void onActivatorRailPass(int par1, int par2, int par3, boolean par4) {} + + protected void func_94088_b(double par1) + { + if (this.motionX < -par1) + { + this.motionX = -par1; + } + + if (this.motionX > par1) + { + this.motionX = par1; + } + + if (this.motionZ < -par1) + { + this.motionZ = -par1; + } + + if (this.motionZ > par1) + { + this.motionZ = par1; + } + + if (this.onGround) + { + this.motionX *= 0.5D; + this.motionY *= 0.5D; + this.motionZ *= 0.5D; + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (!this.onGround) + { + this.motionX *= 0.949999988079071D; + this.motionY *= 0.949999988079071D; + this.motionZ *= 0.949999988079071D; + } + } + + protected void updateOnTrack(int par1, int par2, int par3, double par4, double par6, int par8, int par9) + { + this.fallDistance = 0.0F; + Vec3 var10 = this.func_70489_a(this.posX, this.posY, this.posZ); + this.posY = (double)par2; + boolean var11 = false; + boolean var12 = false; + + if (par8 == Block.railPowered.blockID) + { + var11 = (par9 & 8) != 0; + var12 = !var11; + } + + if (((BlockRailBase)Block.blocksList[par8]).isPowered()) + { + par9 &= 7; + } + + if (par9 >= 2 && par9 <= 5) + { + this.posY = (double)(par2 + 1); + } + + if (par9 == 2) + { + this.motionX -= par6; + } + + if (par9 == 3) + { + this.motionX += par6; + } + + if (par9 == 4) + { + this.motionZ += par6; + } + + if (par9 == 5) + { + this.motionZ -= par6; + } + + int[][] var13 = matrix[par9]; + double var14 = (double)(var13[1][0] - var13[0][0]); + double var16 = (double)(var13[1][2] - var13[0][2]); + double var18 = Math.sqrt(var14 * var14 + var16 * var16); + double var20 = this.motionX * var14 + this.motionZ * var16; + + if (var20 < 0.0D) + { + var14 = -var14; + var16 = -var16; + } + + double var22 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (var22 > 2.0D) + { + var22 = 2.0D; + } + + this.motionX = var22 * var14 / var18; + this.motionZ = var22 * var16 / var18; + double var24; + double var26; + double var28; + double var30; + + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase) + { + var24 = (double)((EntityLivingBase)this.riddenByEntity).moveForward; + + if (var24 > 0.0D) + { + var26 = -Math.sin((double)(this.riddenByEntity.rotationYaw * (float)Math.PI / 180.0F)); + var28 = Math.cos((double)(this.riddenByEntity.rotationYaw * (float)Math.PI / 180.0F)); + var30 = this.motionX * this.motionX + this.motionZ * this.motionZ; + + if (var30 < 0.01D) + { + this.motionX += var26 * 0.1D; + this.motionZ += var28 * 0.1D; + var12 = false; + } + } + } + + if (var12) + { + var24 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (var24 < 0.03D) + { + this.motionX *= 0.0D; + this.motionY *= 0.0D; + this.motionZ *= 0.0D; + } + else + { + this.motionX *= 0.5D; + this.motionY *= 0.0D; + this.motionZ *= 0.5D; + } + } + + var24 = 0.0D; + var26 = (double)par1 + 0.5D + (double)var13[0][0] * 0.5D; + var28 = (double)par3 + 0.5D + (double)var13[0][2] * 0.5D; + var30 = (double)par1 + 0.5D + (double)var13[1][0] * 0.5D; + double var32 = (double)par3 + 0.5D + (double)var13[1][2] * 0.5D; + var14 = var30 - var26; + var16 = var32 - var28; + double var34; + double var36; + + if (var14 == 0.0D) + { + this.posX = (double)par1 + 0.5D; + var24 = this.posZ - (double)par3; + } + else if (var16 == 0.0D) + { + this.posZ = (double)par3 + 0.5D; + var24 = this.posX - (double)par1; + } + else + { + var34 = this.posX - var26; + var36 = this.posZ - var28; + var24 = (var34 * var14 + var36 * var16) * 2.0D; + } + + this.posX = var26 + var14 * var24; + this.posZ = var28 + var16 * var24; + this.setPosition(this.posX, this.posY + (double)this.yOffset, this.posZ); + var34 = this.motionX; + var36 = this.motionZ; + + if (this.riddenByEntity != null) + { + var34 *= 0.75D; + var36 *= 0.75D; + } + + if (var34 < -par4) + { + var34 = -par4; + } + + if (var34 > par4) + { + var34 = par4; + } + + if (var36 < -par4) + { + var36 = -par4; + } + + if (var36 > par4) + { + var36 = par4; + } + + this.moveEntity(var34, 0.0D, var36); + + if (var13[0][1] != 0 && MathHelper.floor_double(this.posX) - par1 == var13[0][0] && MathHelper.floor_double(this.posZ) - par3 == var13[0][2]) + { + this.setPosition(this.posX, this.posY + (double)var13[0][1], this.posZ); + } + else if (var13[1][1] != 0 && MathHelper.floor_double(this.posX) - par1 == var13[1][0] && MathHelper.floor_double(this.posZ) - par3 == var13[1][2]) + { + this.setPosition(this.posX, this.posY + (double)var13[1][1], this.posZ); + } + + this.applyDrag(); + Vec3 var38 = this.func_70489_a(this.posX, this.posY, this.posZ); + + if (var38 != null && var10 != null) + { + double var39 = (var10.yCoord - var38.yCoord) * 0.05D; + var22 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (var22 > 0.0D) + { + this.motionX = this.motionX / var22 * (var22 + var39); + this.motionZ = this.motionZ / var22 * (var22 + var39); + } + + this.setPosition(this.posX, var38.yCoord, this.posZ); + } + + int var45 = MathHelper.floor_double(this.posX); + int var40 = MathHelper.floor_double(this.posZ); + + if (var45 != par1 || var40 != par3) + { + var22 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.motionX = var22 * (double)(var45 - par1); + this.motionZ = var22 * (double)(var40 - par3); + } + + if (var11) + { + double var41 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); + + if (var41 > 0.01D) + { + double var43 = 0.06D; + this.motionX += this.motionX / var41 * var43; + this.motionZ += this.motionZ / var41 * var43; + } + else if (par9 == 1) + { + if (this.worldObj.isBlockNormalCube(par1 - 1, par2, par3)) + { + this.motionX = 0.02D; + } + else if (this.worldObj.isBlockNormalCube(par1 + 1, par2, par3)) + { + this.motionX = -0.02D; + } + } + else if (par9 == 0) + { + if (this.worldObj.isBlockNormalCube(par1, par2, par3 - 1)) + { + this.motionZ = 0.02D; + } + else if (this.worldObj.isBlockNormalCube(par1, par2, par3 + 1)) + { + this.motionZ = -0.02D; + } + } + } + } + + protected void applyDrag() + { + if (this.riddenByEntity != null) + { + this.motionX *= 0.996999979019165D; + this.motionY *= 0.0D; + this.motionZ *= 0.996999979019165D; + } + else + { + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.0D; + this.motionZ *= 0.9599999785423279D; + } + } + + public Vec3 func_70495_a(double par1, double par3, double par5, double par7) + { + int var9 = MathHelper.floor_double(par1); + int var10 = MathHelper.floor_double(par3); + int var11 = MathHelper.floor_double(par5); + + if (BlockRailBase.isRailBlockAt(this.worldObj, var9, var10 - 1, var11)) + { + --var10; + } + + int var12 = this.worldObj.getBlockId(var9, var10, var11); + + if (!BlockRailBase.isRailBlock(var12)) + { + return null; + } + else + { + int var13 = this.worldObj.getBlockMetadata(var9, var10, var11); + + if (((BlockRailBase)Block.blocksList[var12]).isPowered()) + { + var13 &= 7; + } + + par3 = (double)var10; + + if (var13 >= 2 && var13 <= 5) + { + par3 = (double)(var10 + 1); + } + + int[][] var14 = matrix[var13]; + double var15 = (double)(var14[1][0] - var14[0][0]); + double var17 = (double)(var14[1][2] - var14[0][2]); + double var19 = Math.sqrt(var15 * var15 + var17 * var17); + var15 /= var19; + var17 /= var19; + par1 += var15 * par7; + par5 += var17 * par7; + + if (var14[0][1] != 0 && MathHelper.floor_double(par1) - var9 == var14[0][0] && MathHelper.floor_double(par5) - var11 == var14[0][2]) + { + par3 += (double)var14[0][1]; + } + else if (var14[1][1] != 0 && MathHelper.floor_double(par1) - var9 == var14[1][0] && MathHelper.floor_double(par5) - var11 == var14[1][2]) + { + par3 += (double)var14[1][1]; + } + + return this.func_70489_a(par1, par3, par5); + } + } + + public Vec3 func_70489_a(double par1, double par3, double par5) + { + int var7 = MathHelper.floor_double(par1); + int var8 = MathHelper.floor_double(par3); + int var9 = MathHelper.floor_double(par5); + + if (BlockRailBase.isRailBlockAt(this.worldObj, var7, var8 - 1, var9)) + { + --var8; + } + + int var10 = this.worldObj.getBlockId(var7, var8, var9); + + if (BlockRailBase.isRailBlock(var10)) + { + int var11 = this.worldObj.getBlockMetadata(var7, var8, var9); + par3 = (double)var8; + + if (((BlockRailBase)Block.blocksList[var10]).isPowered()) + { + var11 &= 7; + } + + if (var11 >= 2 && var11 <= 5) + { + par3 = (double)(var8 + 1); + } + + int[][] var12 = matrix[var11]; + double var13 = 0.0D; + double var15 = (double)var7 + 0.5D + (double)var12[0][0] * 0.5D; + double var17 = (double)var8 + 0.5D + (double)var12[0][1] * 0.5D; + double var19 = (double)var9 + 0.5D + (double)var12[0][2] * 0.5D; + double var21 = (double)var7 + 0.5D + (double)var12[1][0] * 0.5D; + double var23 = (double)var8 + 0.5D + (double)var12[1][1] * 0.5D; + double var25 = (double)var9 + 0.5D + (double)var12[1][2] * 0.5D; + double var27 = var21 - var15; + double var29 = (var23 - var17) * 2.0D; + double var31 = var25 - var19; + + if (var27 == 0.0D) + { + par1 = (double)var7 + 0.5D; + var13 = par5 - (double)var9; + } + else if (var31 == 0.0D) + { + par5 = (double)var9 + 0.5D; + var13 = par1 - (double)var7; + } + else + { + double var33 = par1 - var15; + double var35 = par5 - var19; + var13 = (var33 * var27 + var35 * var31) * 2.0D; + } + + par1 = var15 + var27 * var13; + par3 = var17 + var29 * var13; + par5 = var19 + var31 * var13; + + if (var29 < 0.0D) + { + ++par3; + } + + if (var29 > 0.0D) + { + par3 += 0.5D; + } + + return this.worldObj.getWorldVec3Pool().getVecFromPool(par1, par3, par5); + } + else + { + return null; + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + if (par1NBTTagCompound.getBoolean("CustomDisplayTile")) + { + this.setDisplayTile(par1NBTTagCompound.getInteger("DisplayTile")); + this.setDisplayTileData(par1NBTTagCompound.getInteger("DisplayData")); + this.setDisplayTileOffset(par1NBTTagCompound.getInteger("DisplayOffset")); + } + + if (par1NBTTagCompound.hasKey("CustomName") && par1NBTTagCompound.getString("CustomName").length() > 0) + { + this.entityName = par1NBTTagCompound.getString("CustomName"); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + if (this.hasDisplayTile()) + { + par1NBTTagCompound.setBoolean("CustomDisplayTile", true); + par1NBTTagCompound.setInteger("DisplayTile", this.getDisplayTile() == null ? 0 : this.getDisplayTile().blockID); + par1NBTTagCompound.setInteger("DisplayData", this.getDisplayTileData()); + par1NBTTagCompound.setInteger("DisplayOffset", this.getDisplayTileOffset()); + } + + if (this.entityName != null && this.entityName.length() > 0) + { + par1NBTTagCompound.setString("CustomName", this.entityName); + } + } + + public float getShadowSize() + { + return 0.0F; + } + + /** + * Applies a velocity to each of the entities pushing them away from each other. Args: entity + */ + public void applyEntityCollision(Entity par1Entity) + { + if (!this.worldObj.isRemote) + { + if (par1Entity != this.riddenByEntity) + { + if (par1Entity instanceof EntityLivingBase && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && this.getMinecartType() == 0 && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null) + { + par1Entity.mountEntity(this); + } + + double var2 = par1Entity.posX - this.posX; + double var4 = par1Entity.posZ - this.posZ; + double var6 = var2 * var2 + var4 * var4; + + if (var6 >= 9.999999747378752E-5D) + { + var6 = (double)MathHelper.sqrt_double(var6); + var2 /= var6; + var4 /= var6; + double var8 = 1.0D / var6; + + if (var8 > 1.0D) + { + var8 = 1.0D; + } + + var2 *= var8; + var4 *= var8; + var2 *= 0.10000000149011612D; + var4 *= 0.10000000149011612D; + var2 *= (double)(1.0F - this.entityCollisionReduction); + var4 *= (double)(1.0F - this.entityCollisionReduction); + var2 *= 0.5D; + var4 *= 0.5D; + + if (par1Entity instanceof EntityMinecart) + { + double var10 = par1Entity.posX - this.posX; + double var12 = par1Entity.posZ - this.posZ; + Vec3 var14 = this.worldObj.getWorldVec3Pool().getVecFromPool(var10, 0.0D, var12).normalize(); + Vec3 var15 = this.worldObj.getWorldVec3Pool().getVecFromPool((double)MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F), 0.0D, (double)MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F)).normalize(); + double var16 = Math.abs(var14.dotProduct(var15)); + + if (var16 < 0.800000011920929D) + { + return; + } + + double var18 = par1Entity.motionX + this.motionX; + double var20 = par1Entity.motionZ + this.motionZ; + + if (((EntityMinecart)par1Entity).getMinecartType() == 2 && this.getMinecartType() != 2) + { + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; + this.addVelocity(par1Entity.motionX - var2, 0.0D, par1Entity.motionZ - var4); + par1Entity.motionX *= 0.949999988079071D; + par1Entity.motionZ *= 0.949999988079071D; + } + else if (((EntityMinecart)par1Entity).getMinecartType() != 2 && this.getMinecartType() == 2) + { + par1Entity.motionX *= 0.20000000298023224D; + par1Entity.motionZ *= 0.20000000298023224D; + par1Entity.addVelocity(this.motionX + var2, 0.0D, this.motionZ + var4); + this.motionX *= 0.949999988079071D; + this.motionZ *= 0.949999988079071D; + } + else + { + var18 /= 2.0D; + var20 /= 2.0D; + this.motionX *= 0.20000000298023224D; + this.motionZ *= 0.20000000298023224D; + this.addVelocity(var18 - var2, 0.0D, var20 - var4); + par1Entity.motionX *= 0.20000000298023224D; + par1Entity.motionZ *= 0.20000000298023224D; + par1Entity.addVelocity(var18 + var2, 0.0D, var20 + var4); + } + } + else + { + this.addVelocity(-var2, 0.0D, -var4); + par1Entity.addVelocity(var2 / 4.0D, 0.0D, var4 / 4.0D); + } + } + } + } + } + + /** + * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, + * posY, posZ, yaw, pitch + */ + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) + { + this.minecartX = par1; + this.minecartY = par3; + this.minecartZ = par5; + this.minecartYaw = (double)par7; + this.minecartPitch = (double)par8; + this.turnProgress = par9 + 2; + this.motionX = this.velocityX; + this.motionY = this.velocityY; + this.motionZ = this.velocityZ; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double par1, double par3, double par5) + { + this.velocityX = this.motionX = par1; + this.velocityY = this.motionY = par3; + this.velocityZ = this.motionZ = par5; + } + + /** + * Sets the current amount of damage the minecart has taken. Decreases over time. The cart breaks when this is over + * 40. + */ + public void setDamage(float par1) + { + this.dataWatcher.updateObject(19, Float.valueOf(par1)); + } + + /** + * Gets the current amount of damage the minecart has taken. Decreases over time. The cart breaks when this is over + * 40. + */ + public float getDamage() + { + return this.dataWatcher.getWatchableObjectFloat(19); + } + + /** + * Sets the rolling amplitude the cart rolls while being attacked. + */ + public void setRollingAmplitude(int par1) + { + this.dataWatcher.updateObject(17, Integer.valueOf(par1)); + } + + /** + * Gets the rolling amplitude the cart rolls while being attacked. + */ + public int getRollingAmplitude() + { + return this.dataWatcher.getWatchableObjectInt(17); + } + + /** + * Sets the rolling direction the cart rolls while being attacked. Can be 1 or -1. + */ + public void setRollingDirection(int par1) + { + this.dataWatcher.updateObject(18, Integer.valueOf(par1)); + } + + /** + * Gets the rolling direction the cart rolls while being attacked. Can be 1 or -1. + */ + public int getRollingDirection() + { + return this.dataWatcher.getWatchableObjectInt(18); + } + + public abstract int getMinecartType(); + + public Block getDisplayTile() + { + if (!this.hasDisplayTile()) + { + return this.getDefaultDisplayTile(); + } + else + { + int var1 = this.getDataWatcher().getWatchableObjectInt(20) & 65535; + return var1 > 0 && var1 < Block.blocksList.length ? Block.blocksList[var1] : null; + } + } + + public Block getDefaultDisplayTile() + { + return null; + } + + public int getDisplayTileData() + { + return !this.hasDisplayTile() ? this.getDefaultDisplayTileData() : this.getDataWatcher().getWatchableObjectInt(20) >> 16; + } + + public int getDefaultDisplayTileData() + { + return 0; + } + + public int getDisplayTileOffset() + { + return !this.hasDisplayTile() ? this.getDefaultDisplayTileOffset() : this.getDataWatcher().getWatchableObjectInt(21); + } + + public int getDefaultDisplayTileOffset() + { + return 6; + } + + public void setDisplayTile(int par1) + { + this.getDataWatcher().updateObject(20, Integer.valueOf(par1 & 65535 | this.getDisplayTileData() << 16)); + this.setHasDisplayTile(true); + } + + public void setDisplayTileData(int par1) + { + Block var2 = this.getDisplayTile(); + int var3 = var2 == null ? 0 : var2.blockID; + this.getDataWatcher().updateObject(20, Integer.valueOf(var3 & 65535 | par1 << 16)); + this.setHasDisplayTile(true); + } + + public void setDisplayTileOffset(int par1) + { + this.getDataWatcher().updateObject(21, Integer.valueOf(par1)); + this.setHasDisplayTile(true); + } + + public boolean hasDisplayTile() + { + return this.getDataWatcher().getWatchableObjectByte(22) == 1; + } + + public void setHasDisplayTile(boolean par1) + { + this.getDataWatcher().updateObject(22, Byte.valueOf((byte)(par1 ? 1 : 0))); + } + + /** + * Sets the minecart's name. + */ + public void setMinecartName(String par1Str) + { + this.entityName = par1Str; + } + + /** + * Gets the username of the entity. + */ + public String getEntityName() + { + return this.entityName != null ? this.entityName : super.getEntityName(); + } + + /** + * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's + * language. Otherwise it will be used directly. + */ + public boolean isInvNameLocalized() + { + return this.entityName != null; + } + + public String func_95999_t() + { + return this.entityName; + } +} diff --git a/src/main/java/net/minecraft/src/EntityMinecartChest.java b/src/main/java/net/minecraft/src/EntityMinecartChest.java new file mode 100644 index 0000000..963404a --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMinecartChest.java @@ -0,0 +1,43 @@ +package net.minecraft.src; + +public class EntityMinecartChest extends EntityMinecartContainer +{ + public EntityMinecartChest(World par1World) + { + super(par1World); + } + + public EntityMinecartChest(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + } + + public void killMinecart(DamageSource par1DamageSource) + { + super.killMinecart(par1DamageSource); + this.dropItemWithOffset(Block.chest.blockID, 1, 0.0F); + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return 27; + } + + public int getMinecartType() + { + return 1; + } + + public Block getDefaultDisplayTile() + { + return Block.chest; + } + + public int getDefaultDisplayTileOffset() + { + return 8; + } +} diff --git a/src/main/java/net/minecraft/src/EntityMinecartContainer.java b/src/main/java/net/minecraft/src/EntityMinecartContainer.java new file mode 100644 index 0000000..d676b84 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMinecartContainer.java @@ -0,0 +1,293 @@ +package net.minecraft.src; + +public abstract class EntityMinecartContainer extends EntityMinecart implements IInventory +{ + private ItemStack[] minecartContainerItems = new ItemStack[36]; + + /** + * When set to true, the minecart will drop all items when setDead() is called. When false (such as when travelling + * dimensions) it preserves its contents. + */ + private boolean dropContentsWhenDead = true; + + public EntityMinecartContainer(World par1World) + { + super(par1World); + } + + public EntityMinecartContainer(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + } + + public void killMinecart(DamageSource par1DamageSource) + { + super.killMinecart(par1DamageSource); + + for (int var2 = 0; var2 < this.getSizeInventory(); ++var2) + { + ItemStack var3 = this.getStackInSlot(var2); + + if (var3 != null) + { + float var4 = this.rand.nextFloat() * 0.8F + 0.1F; + float var5 = this.rand.nextFloat() * 0.8F + 0.1F; + float var6 = this.rand.nextFloat() * 0.8F + 0.1F; + + while (var3.stackSize > 0) + { + int var7 = this.rand.nextInt(21) + 10; + + if (var7 > var3.stackSize) + { + var7 = var3.stackSize; + } + + var3.stackSize -= var7; + EntityItem var8 = new EntityItem(this.worldObj, this.posX + (double)var4, this.posY + (double)var5, this.posZ + (double)var6, new ItemStack(var3.itemID, var7, var3.getItemDamage())); + float var9 = 0.05F; + var8.motionX = (double)((float)this.rand.nextGaussian() * var9); + var8.motionY = (double)((float)this.rand.nextGaussian() * var9 + 0.2F); + var8.motionZ = (double)((float)this.rand.nextGaussian() * var9); + this.worldObj.spawnEntityInWorld(var8); + } + } + } + } + + /** + * Returns the stack in slot i + */ + public ItemStack getStackInSlot(int par1) + { + return this.minecartContainerItems[par1]; + } + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + public ItemStack decrStackSize(int par1, int par2) + { + if (this.minecartContainerItems[par1] != null) + { + ItemStack var3; + + if (this.minecartContainerItems[par1].stackSize <= par2) + { + var3 = this.minecartContainerItems[par1]; + this.minecartContainerItems[par1] = null; + return var3; + } + else + { + var3 = this.minecartContainerItems[par1].splitStack(par2); + + if (this.minecartContainerItems[par1].stackSize == 0) + { + this.minecartContainerItems[par1] = null; + } + + return var3; + } + } + else + { + return null; + } + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + public ItemStack getStackInSlotOnClosing(int par1) + { + if (this.minecartContainerItems[par1] != null) + { + ItemStack var2 = this.minecartContainerItems[par1]; + this.minecartContainerItems[par1] = null; + return var2; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) + { + this.minecartContainerItems[par1] = par2ItemStack; + + if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) + { + par2ItemStack.stackSize = this.getInventoryStackLimit(); + } + } + + /** + * Called when an the contents of an Inventory change, usually + */ + public void onInventoryChanged() {} + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + { + return this.isDead ? false : par1EntityPlayer.getDistanceSqToEntity(this) <= 64.0D; + } + + public void openChest() {} + + public void closeChest() {} + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) + { + return true; + } + + /** + * Returns the name of the inventory. + */ + public String getInvName() + { + return this.isInvNameLocalized() ? this.func_95999_t() : "container.minecart"; + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't + * this more of a set than a get?* + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Teleports the entity to another dimension. Params: Dimension number to teleport to + */ + public void travelToDimension(int par1) + { + this.dropContentsWhenDead = false; + super.travelToDimension(par1); + } + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + if (this.dropContentsWhenDead) + { + for (int var1 = 0; var1 < this.getSizeInventory(); ++var1) + { + ItemStack var2 = this.getStackInSlot(var1); + + if (var2 != null) + { + float var3 = this.rand.nextFloat() * 0.8F + 0.1F; + float var4 = this.rand.nextFloat() * 0.8F + 0.1F; + float var5 = this.rand.nextFloat() * 0.8F + 0.1F; + + while (var2.stackSize > 0) + { + int var6 = this.rand.nextInt(21) + 10; + + if (var6 > var2.stackSize) + { + var6 = var2.stackSize; + } + + var2.stackSize -= var6; + EntityItem var7 = new EntityItem(this.worldObj, this.posX + (double)var3, this.posY + (double)var4, this.posZ + (double)var5, new ItemStack(var2.itemID, var6, var2.getItemDamage())); + + if (var2.hasTagCompound()) + { + var7.getEntityItem().setTagCompound((NBTTagCompound)var2.getTagCompound().copy()); + } + + float var8 = 0.05F; + var7.motionX = (double)((float)this.rand.nextGaussian() * var8); + var7.motionY = (double)((float)this.rand.nextGaussian() * var8 + 0.2F); + var7.motionZ = (double)((float)this.rand.nextGaussian() * var8); + this.worldObj.spawnEntityInWorld(var7); + } + } + } + } + + super.setDead(); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + NBTTagList var2 = new NBTTagList(); + + for (int var3 = 0; var3 < this.minecartContainerItems.length; ++var3) + { + if (this.minecartContainerItems[var3] != null) + { + NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("Slot", (byte)var3); + this.minecartContainerItems[var3].writeToNBT(var4); + var2.appendTag(var4); + } + } + + par1NBTTagCompound.setTag("Items", var2); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); + this.minecartContainerItems = new ItemStack[this.getSizeInventory()]; + + for (int var3 = 0; var3 < var2.tagCount(); ++var3) + { + NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + int var5 = var4.getByte("Slot") & 255; + + if (var5 >= 0 && var5 < this.minecartContainerItems.length) + { + this.minecartContainerItems[var5] = ItemStack.loadItemStackFromNBT(var4); + } + } + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer par1EntityPlayer) + { + if (!this.worldObj.isRemote) + { + par1EntityPlayer.displayGUIChest(this); + } + + return true; + } + + protected void applyDrag() + { + int var1 = 15 - Container.calcRedstoneFromInventory(this); + float var2 = 0.98F + (float)var1 * 0.001F; + this.motionX *= (double)var2; + this.motionY *= 0.0D; + this.motionZ *= (double)var2; + } +} diff --git a/src/main/java/net/minecraft/src/EntityMinecartEmpty.java b/src/main/java/net/minecraft/src/EntityMinecartEmpty.java new file mode 100644 index 0000000..4cbad10 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMinecartEmpty.java @@ -0,0 +1,43 @@ +package net.minecraft.src; + +public class EntityMinecartEmpty extends EntityMinecart +{ + public EntityMinecartEmpty(World par1World) + { + super(par1World); + } + + public EntityMinecartEmpty(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer par1EntityPlayer) + { + if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer) + { + return true; + } + else if (this.riddenByEntity != null && this.riddenByEntity != par1EntityPlayer) + { + return false; + } + else + { + if (!this.worldObj.isRemote) + { + par1EntityPlayer.mountEntity(this); + } + + return true; + } + } + + public int getMinecartType() + { + return 0; + } +} diff --git a/src/main/java/net/minecraft/src/EntityMinecartFurnace.java b/src/main/java/net/minecraft/src/EntityMinecartFurnace.java new file mode 100644 index 0000000..a605add --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMinecartFurnace.java @@ -0,0 +1,185 @@ +package net.minecraft.src; + +public class EntityMinecartFurnace extends EntityMinecart +{ + private int fuel; + public double pushX; + public double pushZ; + + public EntityMinecartFurnace(World par1World) + { + super(par1World); + } + + public EntityMinecartFurnace(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + } + + public int getMinecartType() + { + return 2; + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.fuel > 0) + { + --this.fuel; + } + + if (this.fuel <= 0) + { + this.pushX = this.pushZ = 0.0D; + } + + this.setMinecartPowered(this.fuel > 0); + + if (this.isMinecartPowered() && this.rand.nextInt(4) == 0) + { + this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D); + } + } + + public void killMinecart(DamageSource par1DamageSource) + { + super.killMinecart(par1DamageSource); + + if (!par1DamageSource.isExplosion()) + { + this.entityDropItem(new ItemStack(Block.furnaceIdle, 1), 0.0F); + } + } + + protected void updateOnTrack(int par1, int par2, int par3, double par4, double par6, int par8, int par9) + { + super.updateOnTrack(par1, par2, par3, par4, par6, par8, par9); + double var10 = this.pushX * this.pushX + this.pushZ * this.pushZ; + + if (var10 > 1.0E-4D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.001D) + { + var10 = (double)MathHelper.sqrt_double(var10); + this.pushX /= var10; + this.pushZ /= var10; + + if (this.pushX * this.motionX + this.pushZ * this.motionZ < 0.0D) + { + this.pushX = 0.0D; + this.pushZ = 0.0D; + } + else + { + this.pushX = this.motionX; + this.pushZ = this.motionZ; + } + } + } + + protected void applyDrag() + { + double var1 = this.pushX * this.pushX + this.pushZ * this.pushZ; + + if (var1 > 1.0E-4D) + { + var1 = (double)MathHelper.sqrt_double(var1); + this.pushX /= var1; + this.pushZ /= var1; + double var3 = 0.05D; + this.motionX *= 0.800000011920929D; + this.motionY *= 0.0D; + this.motionZ *= 0.800000011920929D; + this.motionX += this.pushX * var3; + this.motionZ += this.pushZ * var3; + } + else + { + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.0D; + this.motionZ *= 0.9800000190734863D; + } + + super.applyDrag(); + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + + if (var2 != null && var2.itemID == Item.coal.itemID) + { + if (!par1EntityPlayer.capabilities.isCreativeMode && --var2.stackSize == 0) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); + } + + this.fuel += 3600; + } + + this.pushX = this.posX - par1EntityPlayer.posX; + this.pushZ = this.posZ - par1EntityPlayer.posZ; + return true; + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setDouble("PushX", this.pushX); + par1NBTTagCompound.setDouble("PushZ", this.pushZ); + par1NBTTagCompound.setShort("Fuel", (short)this.fuel); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.pushX = par1NBTTagCompound.getDouble("PushX"); + this.pushZ = par1NBTTagCompound.getDouble("PushZ"); + this.fuel = par1NBTTagCompound.getShort("Fuel"); + } + + protected boolean isMinecartPowered() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + protected void setMinecartPowered(boolean par1) + { + if (par1) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(this.dataWatcher.getWatchableObjectByte(16) | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(this.dataWatcher.getWatchableObjectByte(16) & -2))); + } + } + + public Block getDefaultDisplayTile() + { + return Block.furnaceBurning; + } + + public int getDefaultDisplayTileData() + { + return 2; + } +} diff --git a/src/main/java/net/minecraft/src/EntityMinecartHopper.java b/src/main/java/net/minecraft/src/EntityMinecartHopper.java new file mode 100644 index 0000000..4c8d36d --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMinecartHopper.java @@ -0,0 +1,200 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityMinecartHopper extends EntityMinecartContainer implements Hopper +{ + /** Whether this hopper minecart is being blocked by an activator rail. */ + private boolean isBlocked = true; + private int transferTicker = -1; + + public EntityMinecartHopper(World par1World) + { + super(par1World); + } + + public EntityMinecartHopper(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + } + + public int getMinecartType() + { + return 5; + } + + public Block getDefaultDisplayTile() + { + return Block.hopperBlock; + } + + public int getDefaultDisplayTileOffset() + { + return 1; + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return 5; + } + + /** + * First layer of player interaction + */ + public boolean interactFirst(EntityPlayer par1EntityPlayer) + { + if (!this.worldObj.isRemote) + { + par1EntityPlayer.displayGUIHopperMinecart(this); + } + + return true; + } + + /** + * Called every tick the minecart is on an activator rail. + */ + public void onActivatorRailPass(int par1, int par2, int par3, boolean par4) + { + boolean var5 = !par4; + + if (var5 != this.getBlocked()) + { + this.setBlocked(var5); + } + } + + /** + * Get whether this hopper minecart is being blocked by an activator rail. + */ + public boolean getBlocked() + { + return this.isBlocked; + } + + /** + * Set whether this hopper minecart is being blocked by an activator rail. + */ + public void setBlocked(boolean par1) + { + this.isBlocked = par1; + } + + /** + * Returns the worldObj for this tileEntity. + */ + public World getWorldObj() + { + return this.worldObj; + } + + /** + * Gets the world X position for this hopper entity. + */ + public double getXPos() + { + return this.posX; + } + + /** + * Gets the world Y position for this hopper entity. + */ + public double getYPos() + { + return this.posY; + } + + /** + * Gets the world Z position for this hopper entity. + */ + public double getZPos() + { + return this.posZ; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (!this.worldObj.isRemote && this.isEntityAlive() && this.getBlocked()) + { + --this.transferTicker; + + if (!this.canTransfer()) + { + this.setTransferTicker(0); + + if (this.func_96112_aD()) + { + this.setTransferTicker(4); + this.onInventoryChanged(); + } + } + } + } + + public boolean func_96112_aD() + { + if (TileEntityHopper.suckItemsIntoHopper(this)) + { + return true; + } + else + { + List var1 = this.worldObj.selectEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(0.25D, 0.0D, 0.25D), IEntitySelector.selectAnything); + + if (var1.size() > 0) + { + TileEntityHopper.insertStackFromEntity(this, (EntityItem)var1.get(0)); + } + + return false; + } + } + + public void killMinecart(DamageSource par1DamageSource) + { + super.killMinecart(par1DamageSource); + this.dropItemWithOffset(Block.hopperBlock.blockID, 1, 0.0F); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("TransferCooldown", this.transferTicker); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.transferTicker = par1NBTTagCompound.getInteger("TransferCooldown"); + } + + /** + * Sets the transfer ticker, used to determine the delay between transfers. + */ + public void setTransferTicker(int par1) + { + this.transferTicker = par1; + } + + /** + * Returns whether the hopper cart can currently transfer an item. + */ + public boolean canTransfer() + { + return this.transferTicker > 0; + } +} diff --git a/src/main/java/net/minecraft/src/EntityMinecartMobSpawner.java b/src/main/java/net/minecraft/src/EntityMinecartMobSpawner.java new file mode 100644 index 0000000..4304833 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMinecartMobSpawner.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +public class EntityMinecartMobSpawner extends EntityMinecart +{ + /** Mob spawner logic for this spawner minecart. */ + private final MobSpawnerBaseLogic mobSpawnerLogic = new EntityMinecartMobSpawnerLogic(this); + + public EntityMinecartMobSpawner(World par1World) + { + super(par1World); + } + + public EntityMinecartMobSpawner(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + } + + public int getMinecartType() + { + return 4; + } + + public Block getDefaultDisplayTile() + { + return Block.mobSpawner; + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.mobSpawnerLogic.readFromNBT(par1NBTTagCompound); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + this.mobSpawnerLogic.writeToNBT(par1NBTTagCompound); + } + + public void handleHealthUpdate(byte par1) + { + this.mobSpawnerLogic.setDelayToMin(par1); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + this.mobSpawnerLogic.updateSpawner(); + } + + public MobSpawnerBaseLogic func_98039_d() + { + return this.mobSpawnerLogic; + } +} diff --git a/src/main/java/net/minecraft/src/EntityMinecartMobSpawnerLogic.java b/src/main/java/net/minecraft/src/EntityMinecartMobSpawnerLogic.java new file mode 100644 index 0000000..ae8c7f6 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMinecartMobSpawnerLogic.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +class EntityMinecartMobSpawnerLogic extends MobSpawnerBaseLogic +{ + /** The spawner minecart using this mob spawner logic. */ + final EntityMinecartMobSpawner spawnerMinecart; + + EntityMinecartMobSpawnerLogic(EntityMinecartMobSpawner par1EntityMinecartMobSpawner) + { + this.spawnerMinecart = par1EntityMinecartMobSpawner; + } + + public void func_98267_a(int par1) + { + this.spawnerMinecart.worldObj.setEntityState(this.spawnerMinecart, (byte)par1); + } + + public World getSpawnerWorld() + { + return this.spawnerMinecart.worldObj; + } + + public int getSpawnerX() + { + return MathHelper.floor_double(this.spawnerMinecart.posX); + } + + public int getSpawnerY() + { + return MathHelper.floor_double(this.spawnerMinecart.posY); + } + + public int getSpawnerZ() + { + return MathHelper.floor_double(this.spawnerMinecart.posZ); + } +} diff --git a/src/main/java/net/minecraft/src/EntityMinecartTNT.java b/src/main/java/net/minecraft/src/EntityMinecartTNT.java new file mode 100644 index 0000000..b86f92e --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMinecartTNT.java @@ -0,0 +1,189 @@ +package net.minecraft.src; + +public class EntityMinecartTNT extends EntityMinecart +{ + private int minecartTNTFuse = -1; + + public EntityMinecartTNT(World par1World) + { + super(par1World); + } + + public EntityMinecartTNT(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + } + + public int getMinecartType() + { + return 3; + } + + public Block getDefaultDisplayTile() + { + return Block.tnt; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.minecartTNTFuse > 0) + { + --this.minecartTNTFuse; + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + } + else if (this.minecartTNTFuse == 0) + { + this.explodeCart(this.motionX * this.motionX + this.motionZ * this.motionZ); + } + + if (this.isCollidedHorizontally) + { + double var1 = this.motionX * this.motionX + this.motionZ * this.motionZ; + + if (var1 >= 0.009999999776482582D) + { + this.explodeCart(var1); + } + } + } + + public void killMinecart(DamageSource par1DamageSource) + { + super.killMinecart(par1DamageSource); + double var2 = this.motionX * this.motionX + this.motionZ * this.motionZ; + + if (!par1DamageSource.isExplosion()) + { + this.entityDropItem(new ItemStack(Block.tnt, 1), 0.0F); + } + + if (par1DamageSource.isFireDamage() || par1DamageSource.isExplosion() || var2 >= 0.009999999776482582D) + { + this.explodeCart(var2); + } + } + + /** + * Makes the minecart explode. + */ + protected void explodeCart(double par1) + { + if (!this.worldObj.isRemote) + { + double var3 = Math.sqrt(par1); + + if (var3 > 5.0D) + { + var3 = 5.0D; + } + + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)(4.0D + this.rand.nextDouble() * 1.5D * var3), true); + this.setDead(); + } + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) + { + if (par1 >= 3.0F) + { + float var2 = par1 / 10.0F; + this.explodeCart((double)(var2 * var2)); + } + + super.fall(par1); + } + + /** + * Called every tick the minecart is on an activator rail. + */ + public void onActivatorRailPass(int par1, int par2, int par3, boolean par4) + { + if (par4 && this.minecartTNTFuse < 0) + { + this.ignite(); + } + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 10) + { + this.ignite(); + } + else + { + super.handleHealthUpdate(par1); + } + } + + /** + * Ignites this TNT cart. + */ + public void ignite() + { + this.minecartTNTFuse = 80; + + if (!this.worldObj.isRemote) + { + this.worldObj.setEntityState(this, (byte)10); + this.worldObj.playSoundAtEntity(this, "random.fuse", 1.0F, 1.0F); + } + } + + public int func_94104_d() + { + return this.minecartTNTFuse; + } + + /** + * Returns true if the TNT minecart is ignited. + */ + public boolean isIgnited() + { + return this.minecartTNTFuse > -1; + } + + /** + * Gets a block's resistance to this entity's explosion. Used to make rails immune to TNT minecarts' explosions and + * Wither skulls more destructive. + */ + public float getBlockExplosionResistance(Explosion par1Explosion, World par2World, int par3, int par4, int par5, Block par6Block) + { + return this.isIgnited() && (BlockRailBase.isRailBlock(par6Block.blockID) || BlockRailBase.isRailBlockAt(par2World, par3, par4 + 1, par5)) ? 0.0F : super.getBlockExplosionResistance(par1Explosion, par2World, par3, par4, par5, par6Block); + } + + public boolean shouldExplodeBlock(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7) + { + return this.isIgnited() && (BlockRailBase.isRailBlock(par6) || BlockRailBase.isRailBlockAt(par2World, par3, par4 + 1, par5)) ? false : super.shouldExplodeBlock(par1Explosion, par2World, par3, par4, par5, par6, par7); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + + if (par1NBTTagCompound.hasKey("TNTFuse")) + { + this.minecartTNTFuse = par1NBTTagCompound.getInteger("TNTFuse"); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("TNTFuse", this.minecartTNTFuse); + } +} diff --git a/src/main/java/net/minecraft/src/EntityMob.java b/src/main/java/net/minecraft/src/EntityMob.java new file mode 100644 index 0000000..4be039e --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMob.java @@ -0,0 +1,185 @@ +package net.minecraft.src; + +public abstract class EntityMob extends EntityCreature implements IMob +{ + public EntityMob(World par1World) + { + super(par1World); + this.experienceValue = 5; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + this.updateArmSwingProgress(); + float var1 = this.getBrightness(1.0F); + + if (var1 > 0.5F) + { + this.entityAge += 2; + } + + super.onLivingUpdate(); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (!this.worldObj.isRemote && this.worldObj.difficultySetting == 0) + { + this.setDead(); + } + } + + /** + * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking + * (Animals, Spiders at day, peaceful PigZombies). + */ + protected Entity findPlayerToAttack() + { + EntityPlayer var1 = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D); + return var1 != null && this.canEntityBeSeen(var1) ? var1 : null; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else if (super.attackEntityFrom(par1DamageSource, par2)) + { + Entity var3 = par1DamageSource.getEntity(); + + if (this.riddenByEntity != var3 && this.ridingEntity != var3) + { + if (var3 != this) + { + this.entityToAttack = var3; + } + + return true; + } + else + { + return true; + } + } + else + { + return false; + } + } + + public boolean attackEntityAsMob(Entity par1Entity) + { + float var2 = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); + int var3 = 0; + + if (par1Entity instanceof EntityLivingBase) + { + var2 += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase)par1Entity); + var3 += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase)par1Entity); + } + + boolean var4 = par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), var2); + + if (var4) + { + if (var3 > 0) + { + par1Entity.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)var3 * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)var3 * 0.5F)); + this.motionX *= 0.6D; + this.motionZ *= 0.6D; + } + + int var5 = EnchantmentHelper.getFireAspectModifier(this); + + if (var5 > 0) + { + par1Entity.setFire(var5 * 4); + } + + if (par1Entity instanceof EntityLivingBase) + { + EnchantmentThorns.func_92096_a(this, (EntityLivingBase)par1Entity, this.rand); + } + } + + return var4; + } + + /** + * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack. + */ + protected void attackEntity(Entity par1Entity, float par2) + { + if (this.attackTime <= 0 && par2 < 2.0F && par1Entity.boundingBox.maxY > this.boundingBox.minY && par1Entity.boundingBox.minY < this.boundingBox.maxY) + { + this.attackTime = 20; + this.attackEntityAsMob(par1Entity); + } + } + + /** + * Takes a coordinate in and returns a weight to determine how likely this creature will try to path to the block. + * Args: x, y, z + */ + public float getBlockPathWeight(int par1, int par2, int par3) + { + return 0.5F - this.worldObj.getLightBrightness(par1, par2, par3); + } + + /** + * Checks to make sure the light is not too bright where the mob is spawning + */ + protected boolean isValidLightLevel() + { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.boundingBox.minY); + int var3 = MathHelper.floor_double(this.posZ); + + if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, var1, var2, var3) > this.rand.nextInt(32)) + { + return false; + } + else + { + int var4 = this.worldObj.getBlockLightValue(var1, var2, var3); + + if (this.worldObj.isThundering()) + { + int var5 = this.worldObj.skylightSubtracted; + this.worldObj.skylightSubtracted = 10; + var4 = this.worldObj.getBlockLightValue(var1, var2, var3); + this.worldObj.skylightSubtracted = var5; + } + + return var4 <= this.rand.nextInt(8); + } + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.worldObj.difficultySetting > 0 && this.isValidLightLevel() && super.getCanSpawnHere(); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getAttributeMap().func_111150_b(SharedMonsterAttributes.attackDamage); + } +} diff --git a/src/main/java/net/minecraft/src/EntityMooshroom.java b/src/main/java/net/minecraft/src/EntityMooshroom.java new file mode 100644 index 0000000..5693087 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMooshroom.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +public class EntityMooshroom extends EntityCow +{ + public EntityMooshroom(World par1World) + { + super(par1World); + this.setSize(0.9F, 1.3F); + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + + if (var2 != null && var2.itemID == Item.bowlEmpty.itemID && this.getGrowingAge() >= 0) + { + if (var2.stackSize == 1) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, new ItemStack(Item.bowlSoup)); + return true; + } + + if (par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.bowlSoup)) && !par1EntityPlayer.capabilities.isCreativeMode) + { + par1EntityPlayer.inventory.decrStackSize(par1EntityPlayer.inventory.currentItem, 1); + return true; + } + } + + if (var2 != null && var2.itemID == Item.shears.itemID && this.getGrowingAge() >= 0) + { + this.setDead(); + this.worldObj.spawnParticle("largeexplode", this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D); + + if (!this.worldObj.isRemote) + { + EntityCow var3 = new EntityCow(this.worldObj); + var3.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + var3.setHealth(this.getHealth()); + var3.renderYawOffset = this.renderYawOffset; + this.worldObj.spawnEntityInWorld(var3); + + for (int var4 = 0; var4 < 5; ++var4) + { + this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY + (double)this.height, this.posZ, new ItemStack(Block.mushroomRed))); + } + } + + return true; + } + else + { + return super.interact(par1EntityPlayer); + } + } + + public EntityMooshroom func_94900_c(EntityAgeable par1EntityAgeable) + { + return new EntityMooshroom(this.worldObj); + } + + /** + * This function is used when two same-species animals in 'love mode' breed to generate the new baby animal. + */ + public EntityCow spawnBabyAnimal(EntityAgeable par1EntityAgeable) + { + return this.func_94900_c(par1EntityAgeable); + } + + public EntityAgeable createChild(EntityAgeable par1EntityAgeable) + { + return this.func_94900_c(par1EntityAgeable); + } +} diff --git a/src/main/java/net/minecraft/src/EntityMoveHelper.java b/src/main/java/net/minecraft/src/EntityMoveHelper.java new file mode 100644 index 0000000..96e7e48 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityMoveHelper.java @@ -0,0 +1,91 @@ +package net.minecraft.src; + +public class EntityMoveHelper +{ + /** The EntityLiving that is being moved */ + private EntityLiving entity; + private double posX; + private double posY; + private double posZ; + + /** The speed at which the entity should move */ + private double speed; + private boolean update; + + public EntityMoveHelper(EntityLiving par1EntityLiving) + { + this.entity = par1EntityLiving; + this.posX = par1EntityLiving.posX; + this.posY = par1EntityLiving.posY; + this.posZ = par1EntityLiving.posZ; + } + + public boolean isUpdating() + { + return this.update; + } + + public double getSpeed() + { + return this.speed; + } + + /** + * Sets the speed and location to move to + */ + public void setMoveTo(double par1, double par3, double par5, double par7) + { + this.posX = par1; + this.posY = par3; + this.posZ = par5; + this.speed = par7; + this.update = true; + } + + public void onUpdateMoveHelper() + { + this.entity.setMoveForward(0.0F); + + if (this.update) + { + this.update = false; + int var1 = MathHelper.floor_double(this.entity.boundingBox.minY + 0.5D); + double var2 = this.posX - this.entity.posX; + double var4 = this.posZ - this.entity.posZ; + double var6 = this.posY - (double)var1; + double var8 = var2 * var2 + var6 * var6 + var4 * var4; + + if (var8 >= 2.500000277905201E-7D) + { + float var10 = (float)(Math.atan2(var4, var2) * 180.0D / Math.PI) - 90.0F; + this.entity.rotationYaw = this.limitAngle(this.entity.rotationYaw, var10, 30.0F); + this.entity.setAIMoveSpeed((float)(this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue())); + + if (var6 > 0.0D && var2 * var2 + var4 * var4 < 1.0D) + { + this.entity.getJumpHelper().setJumping(); + } + } + } + } + + /** + * Limits the given angle to a upper and lower limit. + */ + private float limitAngle(float par1, float par2, float par3) + { + float var4 = MathHelper.wrapAngleTo180_float(par2 - par1); + + if (var4 > par3) + { + var4 = par3; + } + + if (var4 < -par3) + { + var4 = -par3; + } + + return par1 + var4; + } +} diff --git a/src/main/java/net/minecraft/src/EntityNoteFX.java b/src/main/java/net/minecraft/src/EntityNoteFX.java new file mode 100644 index 0000000..9c90634 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityNoteFX.java @@ -0,0 +1,80 @@ +package net.minecraft.src; + +public class EntityNoteFX extends EntityFX +{ + float noteParticleScale; + + public EntityNoteFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + this(par1World, par2, par4, par6, par8, par10, par12, 2.0F); + } + + public EntityNoteFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.009999999776482582D; + this.motionY *= 0.009999999776482582D; + this.motionZ *= 0.009999999776482582D; + this.motionY += 0.2D; + this.particleRed = MathHelper.sin(((float)par8 + 0.0F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; + this.particleGreen = MathHelper.sin(((float)par8 + 0.33333334F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; + this.particleBlue = MathHelper.sin(((float)par8 + 0.6666667F) * (float)Math.PI * 2.0F) * 0.65F + 0.35F; + this.particleScale *= 0.75F; + this.particleScale *= par14; + this.noteParticleScale = this.particleScale; + this.particleMaxAge = 6; + this.noClip = false; + this.setParticleTextureIndex(64); + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F; + + if (var8 < 0.0F) + { + var8 = 0.0F; + } + + if (var8 > 1.0F) + { + var8 = 1.0F; + } + + this.particleScale = this.noteParticleScale * var8; + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.6600000262260437D; + this.motionY *= 0.6600000262260437D; + this.motionZ *= 0.6600000262260437D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityOcelot.java b/src/main/java/net/minecraft/src/EntityOcelot.java new file mode 100644 index 0000000..02abade --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityOcelot.java @@ -0,0 +1,354 @@ +package net.minecraft.src; + +public class EntityOcelot extends EntityTameable +{ + /** + * The tempt AI task for this mob, used to prevent taming while it is fleeing. + */ + private EntityAITempt aiTempt; + + public EntityOcelot(World par1World) + { + super(par1World); + this.setSize(0.6F, 0.8F); + this.getNavigator().setAvoidsWater(true); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, this.aiSit); + this.tasks.addTask(3, this.aiTempt = new EntityAITempt(this, 0.6D, Item.fishRaw.itemID, true)); + this.tasks.addTask(4, new EntityAIAvoidEntity(this, EntityPlayer.class, 16.0F, 0.8D, 1.33D)); + this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 5.0F)); + this.tasks.addTask(6, new EntityAIOcelotSit(this, 1.33D)); + this.tasks.addTask(7, new EntityAILeapAtTarget(this, 0.3F)); + this.tasks.addTask(8, new EntityAIOcelotAttack(this)); + this.tasks.addTask(9, new EntityAIMate(this, 0.8D)); + this.tasks.addTask(10, new EntityAIWander(this, 0.8D)); + this.tasks.addTask(11, new EntityAIWatchClosest(this, EntityPlayer.class, 10.0F)); + this.targetTasks.addTask(1, new EntityAITargetNonTamed(this, EntityChicken.class, 750, false)); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(18, Byte.valueOf((byte)0)); + } + + /** + * main AI tick function, replaces updateEntityActionState + */ + public void updateAITick() + { + if (this.getMoveHelper().isUpdating()) + { + double var1 = this.getMoveHelper().getSpeed(); + + if (var1 == 0.6D) + { + this.setSneaking(true); + this.setSprinting(false); + } + else if (var1 == 1.33D) + { + this.setSneaking(false); + this.setSprinting(true); + } + else + { + this.setSneaking(false); + this.setSprinting(false); + } + } + else + { + this.setSneaking(false); + this.setSprinting(false); + } + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return !this.isTamed() && this.ticksExisted > 2400; + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return true; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.30000001192092896D); + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) {} + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("CatType", this.getTameSkin()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.setTameSkin(par1NBTTagCompound.getInteger("CatType")); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return this.isTamed() ? (this.isInLove() ? "mob.cat.purr" : (this.rand.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : ""; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.cat.hitt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.cat.hitt"; + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.4F; + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.leather.itemID; + } + + public boolean attackEntityAsMob(Entity par1Entity) + { + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), 3.0F); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + this.aiSit.setSitting(false); + return super.attackEntityFrom(par1DamageSource, par2); + } + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) {} + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + + if (this.isTamed()) + { + if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.worldObj.isRemote && !this.isBreedingItem(var2)) + { + this.aiSit.setSitting(!this.isSitting()); + } + } + else if (this.aiTempt.isRunning() && var2 != null && var2.itemID == Item.fishRaw.itemID && par1EntityPlayer.getDistanceSqToEntity(this) < 9.0D) + { + if (!par1EntityPlayer.capabilities.isCreativeMode) + { + --var2.stackSize; + } + + if (var2.stackSize <= 0) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); + } + + if (!this.worldObj.isRemote) + { + if (this.rand.nextInt(3) == 0) + { + this.setTamed(true); + this.setTameSkin(1 + this.worldObj.rand.nextInt(3)); + this.setOwner(par1EntityPlayer.getCommandSenderName()); + this.playTameEffect(true); + this.aiSit.setSitting(true); + this.worldObj.setEntityState(this, (byte)7); + } + else + { + this.playTameEffect(false); + this.worldObj.setEntityState(this, (byte)6); + } + } + + return true; + } + + return super.interact(par1EntityPlayer); + } + + /** + * This function is used when two same-species animals in 'love mode' breed to generate the new baby animal. + */ + public EntityOcelot spawnBabyAnimal(EntityAgeable par1EntityAgeable) + { + EntityOcelot var2 = new EntityOcelot(this.worldObj); + + if (this.isTamed()) + { + var2.setOwner(this.getOwnerName()); + var2.setTamed(true); + var2.setTameSkin(this.getTameSkin()); + } + + return var2; + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack par1ItemStack) + { + return par1ItemStack != null && par1ItemStack.itemID == Item.fishRaw.itemID; + } + + /** + * Returns true if the mob is currently able to mate with the specified mob. + */ + public boolean canMateWith(EntityAnimal par1EntityAnimal) + { + if (par1EntityAnimal == this) + { + return false; + } + else if (!this.isTamed()) + { + return false; + } + else if (!(par1EntityAnimal instanceof EntityOcelot)) + { + return false; + } + else + { + EntityOcelot var2 = (EntityOcelot)par1EntityAnimal; + return !var2.isTamed() ? false : this.isInLove() && var2.isInLove(); + } + } + + public int getTameSkin() + { + return this.dataWatcher.getWatchableObjectByte(18); + } + + public void setTameSkin(int par1) + { + this.dataWatcher.updateObject(18, Byte.valueOf((byte)par1)); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + if (this.worldObj.rand.nextInt(3) == 0) + { + return false; + } + else + { + if (this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox)) + { + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.boundingBox.minY); + int var3 = MathHelper.floor_double(this.posZ); + + if (var2 < 63) + { + return false; + } + + int var4 = this.worldObj.getBlockId(var1, var2 - 1, var3); + + if (var4 == Block.grass.blockID || var4 == Block.leaves.blockID) + { + return true; + } + } + + return false; + } + } + + /** + * Gets the username of the entity. + */ + public String getEntityName() + { + return this.hasCustomNameTag() ? this.getCustomNameTag() : (this.isTamed() ? "entity.Cat.name" : super.getEntityName()); + } + + public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData) + { + par1EntityLivingData = super.onSpawnWithEgg(par1EntityLivingData); + + if (this.worldObj.rand.nextInt(7) == 0) + { + for (int var2 = 0; var2 < 2; ++var2) + { + EntityOcelot var3 = new EntityOcelot(this.worldObj); + var3.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); + var3.setGrowingAge(-24000); + this.worldObj.spawnEntityInWorld(var3); + } + } + + return par1EntityLivingData; + } + + public EntityAgeable createChild(EntityAgeable par1EntityAgeable) + { + return this.spawnBabyAnimal(par1EntityAgeable); + } +} diff --git a/src/main/java/net/minecraft/src/EntityOtherPlayerMP.java b/src/main/java/net/minecraft/src/EntityOtherPlayerMP.java new file mode 100644 index 0000000..1e5e333 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityOtherPlayerMP.java @@ -0,0 +1,186 @@ +package net.minecraft.src; + +public class EntityOtherPlayerMP extends AbstractClientPlayer +{ + private boolean isItemInUse; + private int otherPlayerMPPosRotationIncrements; + private double otherPlayerMPX; + private double otherPlayerMPY; + private double otherPlayerMPZ; + private double otherPlayerMPYaw; + private double otherPlayerMPPitch; + + public EntityOtherPlayerMP(World par1World, String par2Str) + { + super(par1World, par2Str); + this.yOffset = 0.0F; + this.stepHeight = 0.0F; + this.noClip = true; + this.field_71082_cx = 0.25F; + this.renderDistanceWeight = 10.0D; + } + + /** + * sets the players height back to normal after doing things like sleeping and dieing + */ + protected void resetHeight() + { + this.yOffset = 0.0F; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + return true; + } + + /** + * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, + * posY, posZ, yaw, pitch + */ + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) + { + this.otherPlayerMPX = par1; + this.otherPlayerMPY = par3; + this.otherPlayerMPZ = par5; + this.otherPlayerMPYaw = (double)par7; + this.otherPlayerMPPitch = (double)par8; + this.otherPlayerMPPosRotationIncrements = par9; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.field_71082_cx = 0.0F; + super.onUpdate(); + this.prevLimbSwingAmount = this.limbSwingAmount; + double var1 = this.posX - this.prevPosX; + double var3 = this.posZ - this.prevPosZ; + float var5 = MathHelper.sqrt_double(var1 * var1 + var3 * var3) * 4.0F; + + if (var5 > 1.0F) + { + var5 = 1.0F; + } + + this.limbSwingAmount += (var5 - this.limbSwingAmount) * 0.4F; + this.limbSwing += this.limbSwingAmount; + + if (!this.isItemInUse && this.isEating() && this.inventory.mainInventory[this.inventory.currentItem] != null) + { + ItemStack var6 = this.inventory.mainInventory[this.inventory.currentItem]; + this.setItemInUse(this.inventory.mainInventory[this.inventory.currentItem], Item.itemsList[var6.itemID].getMaxItemUseDuration(var6)); + this.isItemInUse = true; + } + else if (this.isItemInUse && !this.isEating()) + { + this.clearItemInUse(); + this.isItemInUse = false; + } + } + + public float getShadowSize() + { + return 0.0F; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.updateEntityActionState(); + + if (this.otherPlayerMPPosRotationIncrements > 0) + { + double var1 = this.posX + (this.otherPlayerMPX - this.posX) / (double)this.otherPlayerMPPosRotationIncrements; + double var3 = this.posY + (this.otherPlayerMPY - this.posY) / (double)this.otherPlayerMPPosRotationIncrements; + double var5 = this.posZ + (this.otherPlayerMPZ - this.posZ) / (double)this.otherPlayerMPPosRotationIncrements; + double var7; + + for (var7 = this.otherPlayerMPYaw - (double)this.rotationYaw; var7 < -180.0D; var7 += 360.0D) + { + ; + } + + while (var7 >= 180.0D) + { + var7 -= 360.0D; + } + + this.rotationYaw = (float)((double)this.rotationYaw + var7 / (double)this.otherPlayerMPPosRotationIncrements); + this.rotationPitch = (float)((double)this.rotationPitch + (this.otherPlayerMPPitch - (double)this.rotationPitch) / (double)this.otherPlayerMPPosRotationIncrements); + --this.otherPlayerMPPosRotationIncrements; + this.setPosition(var1, var3, var5); + this.setRotation(this.rotationYaw, this.rotationPitch); + } + + this.prevCameraYaw = this.cameraYaw; + float var9 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + float var2 = (float)Math.atan(-this.motionY * 0.20000000298023224D) * 15.0F; + + if (var9 > 0.1F) + { + var9 = 0.1F; + } + + if (!this.onGround || this.getHealth() <= 0.0F) + { + var9 = 0.0F; + } + + if (this.onGround || this.getHealth() <= 0.0F) + { + var2 = 0.0F; + } + + this.cameraYaw += (var9 - this.cameraYaw) * 0.4F; + this.cameraPitch += (var2 - this.cameraPitch) * 0.8F; + } + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) + { + if (par1 == 0) + { + this.inventory.mainInventory[this.inventory.currentItem] = par2ItemStack; + } + else + { + this.inventory.armorInventory[par1 - 1] = par2ItemStack; + } + } + + public float getEyeHeight() + { + return 1.82F; + } + + public void sendChatToPlayer(ChatMessageComponent par1ChatMessageComponent) + { + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(par1ChatMessageComponent.toStringWithFormatting(true)); + } + + /** + * Returns true if the command sender is allowed to use the given command. + */ + public boolean canCommandSenderUseCommand(int par1, String par2Str) + { + return false; + } + + /** + * Return the position for this command sender. + */ + public ChunkCoordinates getPlayerCoordinates() + { + return new ChunkCoordinates(MathHelper.floor_double(this.posX + 0.5D), MathHelper.floor_double(this.posY + 0.5D), MathHelper.floor_double(this.posZ + 0.5D)); + } +} diff --git a/src/main/java/net/minecraft/src/EntityOwnable.java b/src/main/java/net/minecraft/src/EntityOwnable.java new file mode 100644 index 0000000..8274484 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityOwnable.java @@ -0,0 +1,8 @@ +package net.minecraft.src; + +public interface EntityOwnable +{ + String getOwnerName(); + + Entity getOwner(); +} diff --git a/src/main/java/net/minecraft/src/EntityPainting.java b/src/main/java/net/minecraft/src/EntityPainting.java new file mode 100644 index 0000000..1e8143f --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityPainting.java @@ -0,0 +1,124 @@ +package net.minecraft.src; + +import java.util.ArrayList; + +public class EntityPainting extends EntityHanging +{ + public EnumArt art; + + public EntityPainting(World par1World) + { + super(par1World); + } + + public EntityPainting(World par1World, int par2, int par3, int par4, int par5) + { + super(par1World, par2, par3, par4, par5); + ArrayList var6 = new ArrayList(); + EnumArt[] var7 = EnumArt.values(); + int var8 = var7.length; + + for (int var9 = 0; var9 < var8; ++var9) + { + EnumArt var10 = var7[var9]; + this.art = var10; + this.setDirection(par5); + + if (this.onValidSurface()) + { + var6.add(var10); + } + } + + if (!var6.isEmpty()) + { + this.art = (EnumArt)var6.get(this.rand.nextInt(var6.size())); + } + + this.setDirection(par5); + } + + public EntityPainting(World par1World, int par2, int par3, int par4, int par5, String par6Str) + { + this(par1World, par2, par3, par4, par5); + EnumArt[] var7 = EnumArt.values(); + int var8 = var7.length; + + for (int var9 = 0; var9 < var8; ++var9) + { + EnumArt var10 = var7[var9]; + + if (var10.title.equals(par6Str)) + { + this.art = var10; + break; + } + } + + this.setDirection(par5); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setString("Motive", this.art.title); + super.writeEntityToNBT(par1NBTTagCompound); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + String var2 = par1NBTTagCompound.getString("Motive"); + EnumArt[] var3 = EnumArt.values(); + int var4 = var3.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + EnumArt var6 = var3[var5]; + + if (var6.title.equals(var2)) + { + this.art = var6; + } + } + + if (this.art == null) + { + this.art = EnumArt.Kebab; + } + + super.readEntityFromNBT(par1NBTTagCompound); + } + + public int getWidthPixels() + { + return this.art.sizeX; + } + + public int getHeightPixels() + { + return this.art.sizeY; + } + + /** + * Called when this entity is broken. Entity parameter may be null. + */ + public void onBroken(Entity par1Entity) + { + if (par1Entity instanceof EntityPlayer) + { + EntityPlayer var2 = (EntityPlayer)par1Entity; + + if (var2.capabilities.isCreativeMode) + { + return; + } + } + + this.entityDropItem(new ItemStack(Item.painting), 0.0F); + } +} diff --git a/src/main/java/net/minecraft/src/EntityPickupFX.java b/src/main/java/net/minecraft/src/EntityPickupFX.java new file mode 100644 index 0000000..f13c5b4 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityPickupFX.java @@ -0,0 +1,68 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class EntityPickupFX extends EntityFX +{ + private Entity entityToPickUp; + private Entity entityPickingUp; + private int age; + private int maxAge; + + /** renamed from yOffset to fix shadowing Entity.yOffset */ + private float yOffs; + + public EntityPickupFX(World par1World, Entity par2Entity, Entity par3Entity, float par4) + { + super(par1World, par2Entity.posX, par2Entity.posY, par2Entity.posZ, par2Entity.motionX, par2Entity.motionY, par2Entity.motionZ); + this.entityToPickUp = par2Entity; + this.entityPickingUp = par3Entity; + this.maxAge = 3; + this.yOffs = par4; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.age + par2) / (float)this.maxAge; + var8 *= var8; + double var9 = this.entityToPickUp.posX; + double var11 = this.entityToPickUp.posY; + double var13 = this.entityToPickUp.posZ; + double var15 = this.entityPickingUp.lastTickPosX + (this.entityPickingUp.posX - this.entityPickingUp.lastTickPosX) * (double)par2; + double var17 = this.entityPickingUp.lastTickPosY + (this.entityPickingUp.posY - this.entityPickingUp.lastTickPosY) * (double)par2 + (double)this.yOffs; + double var19 = this.entityPickingUp.lastTickPosZ + (this.entityPickingUp.posZ - this.entityPickingUp.lastTickPosZ) * (double)par2; + double var21 = var9 + (var15 - var9) * (double)var8; + double var23 = var11 + (var17 - var11) * (double)var8; + double var25 = var13 + (var19 - var13) * (double)var8; + int var27 = MathHelper.floor_double(var21); + int var28 = MathHelper.floor_double(var23 + (double)(this.yOffset / 2.0F)); + int var29 = MathHelper.floor_double(var25); + int var30 = this.getBrightnessForRender(par2); + int var31 = var30 % 65536; + int var32 = var30 / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)var31 / 1.0F, (float)var32 / 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + var21 -= interpPosX; + var23 -= interpPosY; + var25 -= interpPosZ; + RenderManager.instance.renderEntityWithPosYaw(this.entityToPickUp, (double)((float)var21), (double)((float)var23), (double)((float)var25), this.entityToPickUp.rotationYaw, par2); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + ++this.age; + + if (this.age == this.maxAge) + { + this.setDead(); + } + } + + public int getFXLayer() + { + return 3; + } +} diff --git a/src/main/java/net/minecraft/src/EntityPig.java b/src/main/java/net/minecraft/src/EntityPig.java new file mode 100644 index 0000000..cd96500 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityPig.java @@ -0,0 +1,244 @@ +package net.minecraft.src; + +public class EntityPig extends EntityAnimal +{ + /** AI task for player control. */ + private final EntityAIControlledByPlayer aiControlledByPlayer; + + public EntityPig(World par1World) + { + super(par1World); + this.setSize(0.9F, 0.9F); + this.getNavigator().setAvoidsWater(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); + this.tasks.addTask(2, this.aiControlledByPlayer = new EntityAIControlledByPlayer(this, 0.3F)); + this.tasks.addTask(3, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(4, new EntityAITempt(this, 1.2D, Item.carrotOnAStick.itemID, false)); + this.tasks.addTask(4, new EntityAITempt(this, 1.2D, Item.carrot.itemID, false)); + this.tasks.addTask(5, new EntityAIFollowParent(this, 1.1D)); + this.tasks.addTask(6, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return true; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(10.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.25D); + } + + protected void updateAITasks() + { + super.updateAITasks(); + } + + /** + * returns true if all the conditions for steering the entity are met. For pigs, this is true if it is being ridden + * by a player and the player is holding a carrot-on-a-stick + */ + public boolean canBeSteered() + { + ItemStack var1 = ((EntityPlayer)this.riddenByEntity).getHeldItem(); + return var1 != null && var1.itemID == Item.carrotOnAStick.itemID; + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Saddle", this.getSaddled()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.setSaddled(par1NBTTagCompound.getBoolean("Saddle")); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.pig.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.pig.say"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.pig.death"; + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + this.playSound("mob.pig.step", 0.15F, 1.0F); + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + if (super.interact(par1EntityPlayer)) + { + return true; + } + else if (this.getSaddled() && !this.worldObj.isRemote && (this.riddenByEntity == null || this.riddenByEntity == par1EntityPlayer)) + { + par1EntityPlayer.mountEntity(this); + return true; + } + else + { + return false; + } + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return this.isBurning() ? Item.porkCooked.itemID : Item.porkRaw.itemID; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2); + + for (int var4 = 0; var4 < var3; ++var4) + { + if (this.isBurning()) + { + this.dropItem(Item.porkCooked.itemID, 1); + } + else + { + this.dropItem(Item.porkRaw.itemID, 1); + } + } + + if (this.getSaddled()) + { + this.dropItem(Item.saddle.itemID, 1); + } + } + + /** + * Returns true if the pig is saddled. + */ + public boolean getSaddled() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + /** + * Set or remove the saddle of the pig. + */ + public void setSaddled(boolean par1) + { + if (par1) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)1)); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)0)); + } + } + + /** + * Called when a lightning bolt hits the entity. + */ + public void onStruckByLightning(EntityLightningBolt par1EntityLightningBolt) + { + if (!this.worldObj.isRemote) + { + EntityPigZombie var2 = new EntityPigZombie(this.worldObj); + var2.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + this.worldObj.spawnEntityInWorld(var2); + this.setDead(); + } + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) + { + super.fall(par1); + + if (par1 > 5.0F && this.riddenByEntity instanceof EntityPlayer) + { + ((EntityPlayer)this.riddenByEntity).triggerAchievement(AchievementList.flyPig); + } + } + + /** + * This function is used when two same-species animals in 'love mode' breed to generate the new baby animal. + */ + public EntityPig spawnBabyAnimal(EntityAgeable par1EntityAgeable) + { + return new EntityPig(this.worldObj); + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack par1ItemStack) + { + return par1ItemStack != null && par1ItemStack.itemID == Item.carrot.itemID; + } + + /** + * Return the AI task for player control. + */ + public EntityAIControlledByPlayer getAIControlledByPlayer() + { + return this.aiControlledByPlayer; + } + + public EntityAgeable createChild(EntityAgeable par1EntityAgeable) + { + return this.spawnBabyAnimal(par1EntityAgeable); + } +} diff --git a/src/main/java/net/minecraft/src/EntityPigZombie.java b/src/main/java/net/minecraft/src/EntityPigZombie.java new file mode 100644 index 0000000..714cf3f --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityPigZombie.java @@ -0,0 +1,227 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.UUID; + +public class EntityPigZombie extends EntityZombie +{ + private static final UUID field_110189_bq = UUID.fromString("49455A49-7EC5-45BA-B886-3B90B23A1718"); + private static final AttributeModifier field_110190_br = (new AttributeModifier(field_110189_bq, "Attacking speed boost", 0.45D, 0)).setSaved(false); + + /** Above zero if this PigZombie is Angry. */ + private int angerLevel; + + /** A random delay until this PigZombie next makes a sound. */ + private int randomSoundDelay; + private Entity field_110191_bu; + + public EntityPigZombie(World par1World) + { + super(par1World); + this.isImmuneToFire = true; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(field_110186_bp).setAttribute(0.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(5.0D); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + protected boolean isAIEnabled() + { + return false; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (this.field_110191_bu != this.entityToAttack && !this.worldObj.isRemote) + { + AttributeInstance var1 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + var1.removeModifier(field_110190_br); + + if (this.entityToAttack != null) + { + var1.applyModifier(field_110190_br); + } + } + + this.field_110191_bu = this.entityToAttack; + + if (this.randomSoundDelay > 0 && --this.randomSoundDelay == 0) + { + this.playSound("mob.zombiepig.zpigangry", this.getSoundVolume() * 2.0F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 1.8F); + } + + super.onUpdate(); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.worldObj.difficultySetting > 0 && this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setShort("Anger", (short)this.angerLevel); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.angerLevel = par1NBTTagCompound.getShort("Anger"); + } + + /** + * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking + * (Animals, Spiders at day, peaceful PigZombies). + */ + protected Entity findPlayerToAttack() + { + return this.angerLevel == 0 ? null : super.findPlayerToAttack(); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + Entity var3 = par1DamageSource.getEntity(); + + if (var3 instanceof EntityPlayer) + { + List var4 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(32.0D, 32.0D, 32.0D)); + + for (int var5 = 0; var5 < var4.size(); ++var5) + { + Entity var6 = (Entity)var4.get(var5); + + if (var6 instanceof EntityPigZombie) + { + EntityPigZombie var7 = (EntityPigZombie)var6; + var7.becomeAngryAt(var3); + } + } + + this.becomeAngryAt(var3); + } + + return super.attackEntityFrom(par1DamageSource, par2); + } + } + + /** + * Causes this PigZombie to become angry at the supplied Entity (which will be a player). + */ + private void becomeAngryAt(Entity par1Entity) + { + this.entityToAttack = par1Entity; + this.angerLevel = 400 + this.rand.nextInt(400); + this.randomSoundDelay = this.rand.nextInt(40); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.zombiepig.zpig"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.zombiepig.zpighurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.zombiepig.zpigdeath"; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.rand.nextInt(2 + par2); + int var4; + + for (var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Item.rottenFlesh.itemID, 1); + } + + var3 = this.rand.nextInt(2 + par2); + + for (var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Item.goldNugget.itemID, 1); + } + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + return false; + } + + protected void dropRareDrop(int par1) + { + this.dropItem(Item.ingotGold.itemID, 1); + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.rottenFlesh.itemID; + } + + /** + * Makes entity wear random armor based on difficulty + */ + protected void addRandomArmor() + { + this.setCurrentItemOrArmor(0, new ItemStack(Item.swordGold)); + } + + public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData) + { + super.onSpawnWithEgg(par1EntityLivingData); + this.setVillager(false); + return par1EntityLivingData; + } +} diff --git a/src/main/java/net/minecraft/src/EntityPlayer.java b/src/main/java/net/minecraft/src/EntityPlayer.java new file mode 100644 index 0000000..f35514c --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityPlayer.java @@ -0,0 +1,2189 @@ +package net.minecraft.src; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +public abstract class EntityPlayer extends EntityLivingBase implements ICommandSender +{ + /** Inventory of the player */ + public InventoryPlayer inventory = new InventoryPlayer(this); + private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest(); + + /** + * The Container for the player's inventory (which opens when they press E) + */ + public Container inventoryContainer; + + /** The Container the player has open. */ + public Container openContainer; + + /** The player's food stats. (See class FoodStats) */ + protected FoodStats foodStats = new FoodStats(); + + /** + * Used to tell if the player pressed jump twice. If this is at 0 and it's pressed (And they are allowed to fly, as + * defined in the player's movementInput) it sets this to 7. If it's pressed and it's greater than 0 enable fly. + */ + protected int flyToggleTimer; + public float prevCameraYaw; + public float cameraYaw; + protected final String username; + + /** + * Used by EntityPlayer to prevent too many xp orbs from getting absorbed at once. + */ + public int xpCooldown; + public double field_71091_bM; + public double field_71096_bN; + public double field_71097_bO; + public double field_71094_bP; + public double field_71095_bQ; + public double field_71085_bR; + + /** Boolean value indicating weather a player is sleeping or not */ + protected boolean sleeping; + + /** + * The chunk coordinates of the bed the player is in (null if player isn't in a bed). + */ + public ChunkCoordinates playerLocation; + private int sleepTimer; + public float field_71079_bU; + public float field_71082_cx; + public float field_71089_bV; + + /** + * Holds the last coordinate to spawn based on last bed that the player sleep. + */ + private ChunkCoordinates spawnChunk; + + /** + * Whether this player's spawn point is forced, preventing execution of bed checks. + */ + private boolean spawnForced; + + /** Holds the coordinate of the player when enter a minecraft to ride. */ + private ChunkCoordinates startMinecartRidingCoordinate; + + /** The player's capabilities. (See class PlayerCapabilities) */ + public PlayerCapabilities capabilities = new PlayerCapabilities(); + + /** The current experience level the player is on. */ + public int experienceLevel; + + /** + * The total amount of experience the player has. This also includes the amount of experience within their + * Experience Bar. + */ + public int experienceTotal; + + /** + * The current amount of experience the player has within their Experience Bar. + */ + public float experience; + + /** + * This is the item that is in use when the player is holding down the useItemButton (e.g., bow, food, sword) + */ + private ItemStack itemInUse; + + /** + * This field starts off equal to getMaxItemUseDuration and is decremented on each tick + */ + private int itemInUseCount; + protected float speedOnGround = 0.1F; + protected float speedInAir = 0.02F; + private int field_82249_h; + + /** + * An instance of a fishing rod's hook. If this isn't null, the icon image of the fishing rod is slightly different + */ + public EntityFishHook fishEntity; + + public EntityPlayer(World par1World, String par2Str) + { + super(par1World); + this.username = par2Str; + this.inventoryContainer = new ContainerPlayer(this.inventory, !par1World.isRemote, this); + this.openContainer = this.inventoryContainer; + this.yOffset = 1.62F; + ChunkCoordinates var3 = par1World.getSpawnPoint(); + this.setLocationAndAngles((double)var3.posX + 0.5D, (double)(var3.posY + 1), (double)var3.posZ + 0.5D, 0.0F, 0.0F); + this.field_70741_aB = 180.0F; + this.fireResistance = 20; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getAttributeMap().func_111150_b(SharedMonsterAttributes.attackDamage).setAttribute(1.0D); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(17, Float.valueOf(0.0F)); + this.dataWatcher.addObject(18, Integer.valueOf(0)); + } + + /** + * returns the ItemStack containing the itemInUse + */ + public ItemStack getItemInUse() + { + return this.itemInUse; + } + + /** + * Returns the item in use count + */ + public int getItemInUseCount() + { + return this.itemInUseCount; + } + + /** + * Checks if the entity is currently using an item (e.g., bow, food, sword) by holding down the useItemButton + */ + public boolean isUsingItem() + { + return this.itemInUse != null; + } + + /** + * gets the duration for how long the current itemInUse has been in use + */ + public int getItemInUseDuration() + { + return this.isUsingItem() ? this.itemInUse.getMaxItemUseDuration() - this.itemInUseCount : 0; + } + + public void stopUsingItem() + { + if (this.itemInUse != null) + { + this.itemInUse.onPlayerStoppedUsing(this.worldObj, this, this.itemInUseCount); + } + + this.clearItemInUse(); + } + + public void clearItemInUse() + { + this.itemInUse = null; + this.itemInUseCount = 0; + + if (!this.worldObj.isRemote) + { + this.setEating(false); + } + } + + public boolean isBlocking() + { + return this.isUsingItem() && Item.itemsList[this.itemInUse.itemID].getItemUseAction(this.itemInUse) == EnumAction.block; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (this.itemInUse != null) + { + ItemStack var1 = this.inventory.getCurrentItem(); + + if (var1 == this.itemInUse) + { + if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) + { + this.updateItemUse(var1, 5); + } + + if (--this.itemInUseCount == 0 && !this.worldObj.isRemote) + { + this.onItemUseFinish(); + } + } + else + { + this.clearItemInUse(); + } + } + + if (this.xpCooldown > 0) + { + --this.xpCooldown; + } + + if (this.isPlayerSleeping()) + { + ++this.sleepTimer; + + if (this.sleepTimer > 100) + { + this.sleepTimer = 100; + } + + if (!this.worldObj.isRemote) + { + if (!this.isInBed()) + { + this.wakeUpPlayer(true, true, false); + } + else if (this.worldObj.isDaytime()) + { + this.wakeUpPlayer(false, true, true); + } + } + } + else if (this.sleepTimer > 0) + { + ++this.sleepTimer; + + if (this.sleepTimer >= 110) + { + this.sleepTimer = 0; + } + } + + super.onUpdate(); + + if (!this.worldObj.isRemote && this.openContainer != null && !this.openContainer.canInteractWith(this)) + { + this.closeScreen(); + this.openContainer = this.inventoryContainer; + } + + if (this.isBurning() && this.capabilities.disableDamage) + { + this.extinguish(); + } + + this.field_71091_bM = this.field_71094_bP; + this.field_71096_bN = this.field_71095_bQ; + this.field_71097_bO = this.field_71085_bR; + double var9 = this.posX - this.field_71094_bP; + double var3 = this.posY - this.field_71095_bQ; + double var5 = this.posZ - this.field_71085_bR; + double var7 = 10.0D; + + if (var9 > var7) + { + this.field_71091_bM = this.field_71094_bP = this.posX; + } + + if (var5 > var7) + { + this.field_71097_bO = this.field_71085_bR = this.posZ; + } + + if (var3 > var7) + { + this.field_71096_bN = this.field_71095_bQ = this.posY; + } + + if (var9 < -var7) + { + this.field_71091_bM = this.field_71094_bP = this.posX; + } + + if (var5 < -var7) + { + this.field_71097_bO = this.field_71085_bR = this.posZ; + } + + if (var3 < -var7) + { + this.field_71096_bN = this.field_71095_bQ = this.posY; + } + + this.field_71094_bP += var9 * 0.25D; + this.field_71085_bR += var5 * 0.25D; + this.field_71095_bQ += var3 * 0.25D; + this.addStat(StatList.minutesPlayedStat, 1); + + if (this.ridingEntity == null) + { + this.startMinecartRidingCoordinate = null; + } + + if (!this.worldObj.isRemote) + { + this.foodStats.onUpdate(this); + } + } + + /** + * Return the amount of time this entity should stay in a portal before being transported. + */ + public int getMaxInPortalTime() + { + return this.capabilities.disableDamage ? 0 : 80; + } + + /** + * Return the amount of cooldown before this entity can use a portal again. + */ + public int getPortalCooldown() + { + return 10; + } + + public void playSound(String par1Str, float par2, float par3) + { + this.worldObj.playSoundToNearExcept(this, par1Str, par2, par3); + } + + /** + * Plays sounds and makes particles for item in use state + */ + protected void updateItemUse(ItemStack par1ItemStack, int par2) + { + if (par1ItemStack.getItemUseAction() == EnumAction.drink) + { + this.playSound("random.drink", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + + if (par1ItemStack.getItemUseAction() == EnumAction.eat) + { + for (int var3 = 0; var3 < par2; ++var3) + { + Vec3 var4 = this.worldObj.getWorldVec3Pool().getVecFromPool(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D); + var4.rotateAroundX(-this.rotationPitch * (float)Math.PI / 180.0F); + var4.rotateAroundY(-this.rotationYaw * (float)Math.PI / 180.0F); + Vec3 var5 = this.worldObj.getWorldVec3Pool().getVecFromPool(((double)this.rand.nextFloat() - 0.5D) * 0.3D, (double)(-this.rand.nextFloat()) * 0.6D - 0.3D, 0.6D); + var5.rotateAroundX(-this.rotationPitch * (float)Math.PI / 180.0F); + var5.rotateAroundY(-this.rotationYaw * (float)Math.PI / 180.0F); + var5 = var5.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ); + this.worldObj.spawnParticle("iconcrack_" + par1ItemStack.getItem().itemID, var5.xCoord, var5.yCoord, var5.zCoord, var4.xCoord, var4.yCoord + 0.05D, var4.zCoord); + } + + this.playSound("random.eat", 0.5F + 0.5F * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + } + + /** + * Used for when item use count runs out, ie: eating completed + */ + protected void onItemUseFinish() + { + if (this.itemInUse != null) + { + this.updateItemUse(this.itemInUse, 16); + int var1 = this.itemInUse.stackSize; + ItemStack var2 = this.itemInUse.onFoodEaten(this.worldObj, this); + + if (var2 != this.itemInUse || var2 != null && var2.stackSize != var1) + { + this.inventory.mainInventory[this.inventory.currentItem] = var2; + + if (var2.stackSize == 0) + { + this.inventory.mainInventory[this.inventory.currentItem] = null; + } + } + + this.clearItemInUse(); + } + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 9) + { + this.onItemUseFinish(); + } + else + { + super.handleHealthUpdate(par1); + } + } + + /** + * Dead and sleeping entities cannot move + */ + protected boolean isMovementBlocked() + { + return this.getHealth() <= 0.0F || this.isPlayerSleeping(); + } + + /** + * sets current screen to null (used on escape buttons of GUIs) + */ + protected void closeScreen() + { + this.openContainer = this.inventoryContainer; + } + + /** + * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. + */ + public void mountEntity(Entity par1Entity) + { + if (this.ridingEntity != null && par1Entity == null) + { + if (!this.worldObj.isRemote) + { + this.dismountEntity(this.ridingEntity); + } + + if (this.ridingEntity != null) + { + this.ridingEntity.riddenByEntity = null; + } + + this.ridingEntity = null; + } + else + { + super.mountEntity(par1Entity); + } + } + + /** + * Handles updating while being ridden by an entity + */ + public void updateRidden() + { + if (!this.worldObj.isRemote && this.isSneaking()) + { + this.mountEntity((Entity)null); + this.setSneaking(false); + } + else + { + double var1 = this.posX; + double var3 = this.posY; + double var5 = this.posZ; + float var7 = this.rotationYaw; + float var8 = this.rotationPitch; + super.updateRidden(); + this.prevCameraYaw = this.cameraYaw; + this.cameraYaw = 0.0F; + this.addMountedMovementStat(this.posX - var1, this.posY - var3, this.posZ - var5); + + if (this.ridingEntity instanceof EntityPig) + { + this.rotationPitch = var8; + this.rotationYaw = var7; + this.renderYawOffset = ((EntityPig)this.ridingEntity).renderYawOffset; + } + } + } + + /** + * Keeps moving the entity up so it isn't colliding with blocks and other requirements for this entity to be spawned + * (only actually used on players though its also on Entity) + */ + public void preparePlayerToSpawn() + { + this.yOffset = 1.62F; + this.setSize(0.6F, 1.8F); + super.preparePlayerToSpawn(); + this.setHealth(this.getMaxHealth()); + this.deathTime = 0; + } + + protected void updateEntityActionState() + { + super.updateEntityActionState(); + this.updateArmSwingProgress(); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.flyToggleTimer > 0) + { + --this.flyToggleTimer; + } + + if (this.worldObj.difficultySetting == 0 && this.getHealth() < this.getMaxHealth() && this.worldObj.getGameRules().getGameRuleBooleanValue("naturalRegeneration") && this.ticksExisted % 20 * 12 == 0) + { + this.heal(1.0F); + } + + this.inventory.decrementAnimations(); + this.prevCameraYaw = this.cameraYaw; + super.onLivingUpdate(); + AttributeInstance var1 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + + if (!this.worldObj.isRemote) + { + var1.setAttribute((double)this.capabilities.getWalkSpeed()); + } + + this.jumpMovementFactor = this.speedInAir; + + if (this.isSprinting()) + { + this.jumpMovementFactor = (float)((double)this.jumpMovementFactor + (double)this.speedInAir * 0.3D); + } + + this.setAIMoveSpeed((float)var1.getAttributeValue()); + float var2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + float var3 = (float)Math.atan(-this.motionY * 0.20000000298023224D) * 15.0F; + + if (var2 > 0.1F) + { + var2 = 0.1F; + } + + if (!this.onGround || this.getHealth() <= 0.0F) + { + var2 = 0.0F; + } + + if (this.onGround || this.getHealth() <= 0.0F) + { + var3 = 0.0F; + } + + this.cameraYaw += (var2 - this.cameraYaw) * 0.4F; + this.cameraPitch += (var3 - this.cameraPitch) * 0.8F; + + if (this.getHealth() > 0.0F) + { + AxisAlignedBB var4 = null; + + if (this.ridingEntity != null && !this.ridingEntity.isDead) + { + var4 = this.boundingBox.func_111270_a(this.ridingEntity.boundingBox).expand(1.0D, 0.0D, 1.0D); + } + else + { + var4 = this.boundingBox.expand(1.0D, 0.5D, 1.0D); + } + + List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, var4); + + if (var5 != null) + { + for (int var6 = 0; var6 < var5.size(); ++var6) + { + Entity var7 = (Entity)var5.get(var6); + + if (!var7.isDead) + { + this.collideWithPlayer(var7); + } + } + } + } + } + + private void collideWithPlayer(Entity par1Entity) + { + par1Entity.onCollideWithPlayer(this); + } + + public int getScore() + { + return this.dataWatcher.getWatchableObjectInt(18); + } + + /** + * Set player's score + */ + public void setScore(int par1) + { + this.dataWatcher.updateObject(18, Integer.valueOf(par1)); + } + + /** + * Add to player's score + */ + public void addScore(int par1) + { + int var2 = this.getScore(); + this.dataWatcher.updateObject(18, Integer.valueOf(var2 + par1)); + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource par1DamageSource) + { + super.onDeath(par1DamageSource); + this.setSize(0.2F, 0.2F); + this.setPosition(this.posX, this.posY, this.posZ); + this.motionY = 0.10000000149011612D; + + if (this.username.equals("Notch")) + { + this.dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true); + } + + if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) + { + this.inventory.dropAllItems(); + } + + if (par1DamageSource != null) + { + this.motionX = (double)(-MathHelper.cos((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); + this.motionZ = (double)(-MathHelper.sin((this.attackedAtYaw + this.rotationYaw) * (float)Math.PI / 180.0F) * 0.1F); + } + else + { + this.motionX = this.motionZ = 0.0D; + } + + this.yOffset = 0.1F; + this.addStat(StatList.deathsStat, 1); + } + + /** + * Adds a value to the player score. Currently not actually used and the entity passed in does nothing. Args: + * entity, scoreToAdd + */ + public void addToPlayerScore(Entity par1Entity, int par2) + { + this.addScore(par2); + Collection var3 = this.getWorldScoreboard().func_96520_a(ScoreObjectiveCriteria.totalKillCount); + + if (par1Entity instanceof EntityPlayer) + { + this.addStat(StatList.playerKillsStat, 1); + var3.addAll(this.getWorldScoreboard().func_96520_a(ScoreObjectiveCriteria.playerKillCount)); + } + else + { + this.addStat(StatList.mobKillsStat, 1); + } + + Iterator var4 = var3.iterator(); + + while (var4.hasNext()) + { + ScoreObjective var5 = (ScoreObjective)var4.next(); + Score var6 = this.getWorldScoreboard().func_96529_a(this.getEntityName(), var5); + var6.func_96648_a(); + } + } + + /** + * Called when player presses the drop item key + */ + public EntityItem dropOneItem(boolean par1) + { + return this.dropPlayerItemWithRandomChoice(this.inventory.decrStackSize(this.inventory.currentItem, par1 && this.inventory.getCurrentItem() != null ? this.inventory.getCurrentItem().stackSize : 1), false); + } + + /** + * Args: itemstack - called when player drops an item stack that's not in his inventory (like items still placed in + * a workbench while the workbench'es GUI gets closed) + */ + public EntityItem dropPlayerItem(ItemStack par1ItemStack) + { + return this.dropPlayerItemWithRandomChoice(par1ItemStack, false); + } + + /** + * Args: itemstack, flag + */ + public EntityItem dropPlayerItemWithRandomChoice(ItemStack par1ItemStack, boolean par2) + { + if (par1ItemStack == null) + { + return null; + } + else if (par1ItemStack.stackSize == 0) + { + return null; + } + else + { + EntityItem var3 = new EntityItem(this.worldObj, this.posX, this.posY - 0.30000001192092896D + (double)this.getEyeHeight(), this.posZ, par1ItemStack); + var3.delayBeforeCanPickup = 40; + float var4 = 0.1F; + float var5; + + if (par2) + { + var5 = this.rand.nextFloat() * 0.5F; + float var6 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + var3.motionX = (double)(-MathHelper.sin(var6) * var5); + var3.motionZ = (double)(MathHelper.cos(var6) * var5); + var3.motionY = 0.20000000298023224D; + } + else + { + var4 = 0.3F; + var3.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var4); + var3.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var4); + var3.motionY = (double)(-MathHelper.sin(this.rotationPitch / 180.0F * (float)Math.PI) * var4 + 0.1F); + var4 = 0.02F; + var5 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + var4 *= this.rand.nextFloat(); + var3.motionX += Math.cos((double)var5) * (double)var4; + var3.motionY += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); + var3.motionZ += Math.sin((double)var5) * (double)var4; + } + + this.joinEntityItemWithWorld(var3); + this.addStat(StatList.dropStat, 1); + return var3; + } + } + + /** + * Joins the passed in entity item with the world. Args: entityItem + */ + protected void joinEntityItemWithWorld(EntityItem par1EntityItem) + { + this.worldObj.spawnEntityInWorld(par1EntityItem); + } + + /** + * Returns how strong the player is against the specified block at this moment + */ + public float getCurrentPlayerStrVsBlock(Block par1Block, boolean par2) + { + float var3 = this.inventory.getStrVsBlock(par1Block); + + if (var3 > 1.0F) + { + int var4 = EnchantmentHelper.getEfficiencyModifier(this); + ItemStack var5 = this.inventory.getCurrentItem(); + + if (var4 > 0 && var5 != null) + { + float var6 = (float)(var4 * var4 + 1); + + if (!var5.canHarvestBlock(par1Block) && var3 <= 1.0F) + { + var3 += var6 * 0.08F; + } + else + { + var3 += var6; + } + } + } + + if (this.isPotionActive(Potion.digSpeed)) + { + var3 *= 1.0F + (float)(this.getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * 0.2F; + } + + if (this.isPotionActive(Potion.digSlowdown)) + { + var3 *= 1.0F - (float)(this.getActivePotionEffect(Potion.digSlowdown).getAmplifier() + 1) * 0.2F; + } + + if (this.isInsideOfMaterial(Material.water) && !EnchantmentHelper.getAquaAffinityModifier(this)) + { + var3 /= 5.0F; + } + + if (!this.onGround) + { + var3 /= 5.0F; + } + + return var3; + } + + /** + * Checks if the player has the ability to harvest a block (checks current inventory item for a tool if necessary) + */ + public boolean canHarvestBlock(Block par1Block) + { + return this.inventory.canHarvestBlock(par1Block); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + NBTTagList var2 = par1NBTTagCompound.getTagList("Inventory"); + this.inventory.readFromNBT(var2); + this.inventory.currentItem = par1NBTTagCompound.getInteger("SelectedItemSlot"); + this.sleeping = par1NBTTagCompound.getBoolean("Sleeping"); + this.sleepTimer = par1NBTTagCompound.getShort("SleepTimer"); + this.experience = par1NBTTagCompound.getFloat("XpP"); + this.experienceLevel = par1NBTTagCompound.getInteger("XpLevel"); + this.experienceTotal = par1NBTTagCompound.getInteger("XpTotal"); + this.setScore(par1NBTTagCompound.getInteger("Score")); + + if (this.sleeping) + { + this.playerLocation = new ChunkCoordinates(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + this.wakeUpPlayer(true, true, false); + } + + if (par1NBTTagCompound.hasKey("SpawnX") && par1NBTTagCompound.hasKey("SpawnY") && par1NBTTagCompound.hasKey("SpawnZ")) + { + this.spawnChunk = new ChunkCoordinates(par1NBTTagCompound.getInteger("SpawnX"), par1NBTTagCompound.getInteger("SpawnY"), par1NBTTagCompound.getInteger("SpawnZ")); + this.spawnForced = par1NBTTagCompound.getBoolean("SpawnForced"); + } + + this.foodStats.readNBT(par1NBTTagCompound); + this.capabilities.readCapabilitiesFromNBT(par1NBTTagCompound); + + if (par1NBTTagCompound.hasKey("EnderItems")) + { + NBTTagList var3 = par1NBTTagCompound.getTagList("EnderItems"); + this.theInventoryEnderChest.loadInventoryFromNBT(var3); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setTag("Inventory", this.inventory.writeToNBT(new NBTTagList())); + par1NBTTagCompound.setInteger("SelectedItemSlot", this.inventory.currentItem); + par1NBTTagCompound.setBoolean("Sleeping", this.sleeping); + par1NBTTagCompound.setShort("SleepTimer", (short)this.sleepTimer); + par1NBTTagCompound.setFloat("XpP", this.experience); + par1NBTTagCompound.setInteger("XpLevel", this.experienceLevel); + par1NBTTagCompound.setInteger("XpTotal", this.experienceTotal); + par1NBTTagCompound.setInteger("Score", this.getScore()); + + if (this.spawnChunk != null) + { + par1NBTTagCompound.setInteger("SpawnX", this.spawnChunk.posX); + par1NBTTagCompound.setInteger("SpawnY", this.spawnChunk.posY); + par1NBTTagCompound.setInteger("SpawnZ", this.spawnChunk.posZ); + par1NBTTagCompound.setBoolean("SpawnForced", this.spawnForced); + } + + this.foodStats.writeNBT(par1NBTTagCompound); + this.capabilities.writeCapabilitiesToNBT(par1NBTTagCompound); + par1NBTTagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT()); + } + + /** + * Displays the GUI for interacting with a chest inventory. Args: chestInventory + */ + public void displayGUIChest(IInventory par1IInventory) {} + + public void displayGUIHopper(TileEntityHopper par1TileEntityHopper) {} + + public void displayGUIHopperMinecart(EntityMinecartHopper par1EntityMinecartHopper) {} + + public void displayGUIHorse(EntityHorse par1EntityHorse, IInventory par2IInventory) {} + + public void displayGUIEnchantment(int par1, int par2, int par3, String par4Str) {} + + /** + * Displays the GUI for interacting with an anvil. + */ + public void displayGUIAnvil(int par1, int par2, int par3) {} + + /** + * Displays the crafting GUI for a workbench. + */ + public void displayGUIWorkbench(int par1, int par2, int par3) {} + + public float getEyeHeight() + { + return 0.12F; + } + + /** + * sets the players height back to normal after doing things like sleeping and dieing + */ + protected void resetHeight() + { + this.yOffset = 1.62F; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else if (this.capabilities.disableDamage && !par1DamageSource.canHarmInCreative()) + { + return false; + } + else + { + this.entityAge = 0; + + if (this.getHealth() <= 0.0F) + { + return false; + } + else + { + if (this.isPlayerSleeping() && !this.worldObj.isRemote) + { + this.wakeUpPlayer(true, true, false); + } + + if (par1DamageSource.isDifficultyScaled()) + { + if (this.worldObj.difficultySetting == 0) + { + par2 = 0.0F; + } + + if (this.worldObj.difficultySetting == 1) + { + par2 = par2 / 2.0F + 1.0F; + } + + if (this.worldObj.difficultySetting == 3) + { + par2 = par2 * 3.0F / 2.0F; + } + } + + if (par2 == 0.0F) + { + return false; + } + else + { + Entity var3 = par1DamageSource.getEntity(); + + if (var3 instanceof EntityArrow && ((EntityArrow)var3).shootingEntity != null) + { + var3 = ((EntityArrow)var3).shootingEntity; + } + + this.addStat(StatList.damageTakenStat, Math.round(par2 * 10.0F)); + return super.attackEntityFrom(par1DamageSource, par2); + } + } + } + } + + public boolean canAttackPlayer(EntityPlayer par1EntityPlayer) + { + Team var2 = this.getTeam(); + Team var3 = par1EntityPlayer.getTeam(); + return var2 == null ? true : (!var2.isSameTeam(var3) ? true : var2.getAllowFriendlyFire()); + } + + protected void damageArmor(float par1) + { + this.inventory.damageArmor(par1); + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + return this.inventory.getTotalArmorValue(); + } + + /** + * When searching for vulnerable players, if a player is invisible, the return value of this is the chance of seeing + * them anyway. + */ + public float getArmorVisibility() + { + int var1 = 0; + ItemStack[] var2 = this.inventory.armorInventory; + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + ItemStack var5 = var2[var4]; + + if (var5 != null) + { + ++var1; + } + } + + return (float)var1 / (float)this.inventory.armorInventory.length; + } + + /** + * Deals damage to the entity. If its a EntityPlayer then will take damage from the armor first and then health + * second with the reduced value. Args: damageAmount + */ + protected void damageEntity(DamageSource par1DamageSource, float par2) + { + if (!this.isEntityInvulnerable()) + { + if (!par1DamageSource.isUnblockable() && this.isBlocking() && par2 > 0.0F) + { + par2 = (1.0F + par2) * 0.5F; + } + + par2 = this.applyArmorCalculations(par1DamageSource, par2); + par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); + float var3 = par2; + par2 = Math.max(par2 - this.getAbsorptionAmount(), 0.0F); + this.setAbsorptionAmount(this.getAbsorptionAmount() - (var3 - par2)); + + if (par2 != 0.0F) + { + this.addExhaustion(par1DamageSource.getHungerDamage()); + float var4 = this.getHealth(); + this.setHealth(this.getHealth() - par2); + this.func_110142_aN().func_94547_a(par1DamageSource, var4, par2); + } + } + } + + /** + * Displays the furnace GUI for the passed in furnace entity. Args: tileEntityFurnace + */ + public void displayGUIFurnace(TileEntityFurnace par1TileEntityFurnace) {} + + /** + * Displays the dipsenser GUI for the passed in dispenser entity. Args: TileEntityDispenser + */ + public void displayGUIDispenser(TileEntityDispenser par1TileEntityDispenser) {} + + /** + * Displays the GUI for editing a sign. Args: tileEntitySign + */ + public void displayGUIEditSign(TileEntity par1TileEntity) {} + + /** + * Displays the GUI for interacting with a brewing stand. + */ + public void displayGUIBrewingStand(TileEntityBrewingStand par1TileEntityBrewingStand) {} + + /** + * Displays the GUI for interacting with a beacon. + */ + public void displayGUIBeacon(TileEntityBeacon par1TileEntityBeacon) {} + + public void displayGUIMerchant(IMerchant par1IMerchant, String par2Str) {} + + /** + * Displays the GUI for interacting with a book. + */ + public void displayGUIBook(ItemStack par1ItemStack) {} + + public boolean interactWith(Entity par1Entity) + { + ItemStack var2 = this.getCurrentEquippedItem(); + ItemStack var3 = var2 != null ? var2.copy() : null; + + if (!par1Entity.interactFirst(this)) + { + if (var2 != null && par1Entity instanceof EntityLivingBase) + { + if (this.capabilities.isCreativeMode) + { + var2 = var3; + } + + if (var2.func_111282_a(this, (EntityLivingBase)par1Entity)) + { + if (var2.stackSize <= 0 && !this.capabilities.isCreativeMode) + { + this.destroyCurrentEquippedItem(); + } + + return true; + } + } + + return false; + } + else + { + if (var2 != null && var2 == this.getCurrentEquippedItem()) + { + if (var2.stackSize <= 0 && !this.capabilities.isCreativeMode) + { + this.destroyCurrentEquippedItem(); + } + else if (var2.stackSize < var3.stackSize && this.capabilities.isCreativeMode) + { + var2.stackSize = var3.stackSize; + } + } + + return true; + } + } + + /** + * Returns the currently being used item by the player. + */ + public ItemStack getCurrentEquippedItem() + { + return this.inventory.getCurrentItem(); + } + + /** + * Destroys the currently equipped item from the player's inventory. + */ + public void destroyCurrentEquippedItem() + { + this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null); + } + + /** + * Returns the Y Offset of this entity. + */ + public double getYOffset() + { + return (double)(this.yOffset - 0.5F); + } + + /** + * Attacks for the player the targeted entity with the currently equipped item. The equipped item has hitEntity + * called on it. Args: targetEntity + */ + public void attackTargetEntityWithCurrentItem(Entity par1Entity) + { + if (par1Entity.canAttackWithItem()) + { + if (!par1Entity.hitByEntity(this)) + { + float var2 = (float)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); + int var3 = 0; + float var4 = 0.0F; + + if (par1Entity instanceof EntityLivingBase) + { + var4 = EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase)par1Entity); + var3 += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase)par1Entity); + } + + if (this.isSprinting()) + { + ++var3; + } + + if (var2 > 0.0F || var4 > 0.0F) + { + boolean var5 = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInWater() && !this.isPotionActive(Potion.blindness) && this.ridingEntity == null && par1Entity instanceof EntityLivingBase; + + if (var5 && var2 > 0.0F) + { + var2 *= 1.5F; + } + + var2 += var4; + boolean var6 = false; + int var7 = EnchantmentHelper.getFireAspectModifier(this); + + if (par1Entity instanceof EntityLivingBase && var7 > 0 && !par1Entity.isBurning()) + { + var6 = true; + par1Entity.setFire(1); + } + + boolean var8 = par1Entity.attackEntityFrom(DamageSource.causePlayerDamage(this), var2); + + if (var8) + { + if (var3 > 0) + { + par1Entity.addVelocity((double)(-MathHelper.sin(this.rotationYaw * (float)Math.PI / 180.0F) * (float)var3 * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * (float)Math.PI / 180.0F) * (float)var3 * 0.5F)); + this.motionX *= 0.6D; + this.motionZ *= 0.6D; + this.setSprinting(false); + } + + if (var5) + { + this.onCriticalHit(par1Entity); + } + + if (var4 > 0.0F) + { + this.onEnchantmentCritical(par1Entity); + } + + if (var2 >= 18.0F) + { + this.triggerAchievement(AchievementList.overkill); + } + + this.setLastAttacker(par1Entity); + + if (par1Entity instanceof EntityLivingBase) + { + EnchantmentThorns.func_92096_a(this, (EntityLivingBase)par1Entity, this.rand); + } + } + + ItemStack var9 = this.getCurrentEquippedItem(); + Object var10 = par1Entity; + + if (par1Entity instanceof EntityDragonPart) + { + IEntityMultiPart var11 = ((EntityDragonPart)par1Entity).entityDragonObj; + + if (var11 != null && var11 instanceof EntityLivingBase) + { + var10 = (EntityLivingBase)var11; + } + } + + if (var9 != null && var10 instanceof EntityLivingBase) + { + var9.hitEntity((EntityLivingBase)var10, this); + + if (var9.stackSize <= 0) + { + this.destroyCurrentEquippedItem(); + } + } + + if (par1Entity instanceof EntityLivingBase) + { + this.addStat(StatList.damageDealtStat, Math.round(var2 * 10.0F)); + + if (var7 > 0 && var8) + { + par1Entity.setFire(var7 * 4); + } + else if (var6) + { + par1Entity.extinguish(); + } + } + + this.addExhaustion(0.3F); + } + } + } + } + + /** + * Called when the player performs a critical hit on the Entity. Args: entity that was hit critically + */ + public void onCriticalHit(Entity par1Entity) {} + + public void onEnchantmentCritical(Entity par1Entity) {} + + public void respawnPlayer() {} + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + super.setDead(); + this.inventoryContainer.onContainerClosed(this); + + if (this.openContainer != null) + { + this.openContainer.onContainerClosed(this); + } + } + + /** + * Checks if this entity is inside of an opaque block + */ + public boolean isEntityInsideOpaqueBlock() + { + return !this.sleeping && super.isEntityInsideOpaqueBlock(); + } + + /** + * Attempts to have the player sleep in a bed at the specified location. + */ + public EnumStatus sleepInBedAt(int par1, int par2, int par3) + { + if (!this.worldObj.isRemote) + { + if (this.isPlayerSleeping() || !this.isEntityAlive()) + { + return EnumStatus.OTHER_PROBLEM; + } + + if (!this.worldObj.provider.isSurfaceWorld()) + { + return EnumStatus.NOT_POSSIBLE_HERE; + } + + if (this.worldObj.isDaytime()) + { + return EnumStatus.NOT_POSSIBLE_NOW; + } + + if (Math.abs(this.posX - (double)par1) > 3.0D || Math.abs(this.posY - (double)par2) > 2.0D || Math.abs(this.posZ - (double)par3) > 3.0D) + { + return EnumStatus.TOO_FAR_AWAY; + } + + double var4 = 8.0D; + double var6 = 5.0D; + List var8 = this.worldObj.getEntitiesWithinAABB(EntityMob.class, AxisAlignedBB.getAABBPool().getAABB((double)par1 - var4, (double)par2 - var6, (double)par3 - var4, (double)par1 + var4, (double)par2 + var6, (double)par3 + var4)); + + if (!var8.isEmpty()) + { + return EnumStatus.NOT_SAFE; + } + } + + if (this.isRiding()) + { + this.mountEntity((Entity)null); + } + + this.setSize(0.2F, 0.2F); + this.yOffset = 0.2F; + + if (this.worldObj.blockExists(par1, par2, par3)) + { + int var9 = this.worldObj.getBlockMetadata(par1, par2, par3); + int var5 = BlockBed.getDirection(var9); + float var10 = 0.5F; + float var7 = 0.5F; + + switch (var5) + { + case 0: + var7 = 0.9F; + break; + + case 1: + var10 = 0.1F; + break; + + case 2: + var7 = 0.1F; + break; + + case 3: + var10 = 0.9F; + } + + this.func_71013_b(var5); + this.setPosition((double)((float)par1 + var10), (double)((float)par2 + 0.9375F), (double)((float)par3 + var7)); + } + else + { + this.setPosition((double)((float)par1 + 0.5F), (double)((float)par2 + 0.9375F), (double)((float)par3 + 0.5F)); + } + + this.sleeping = true; + this.sleepTimer = 0; + this.playerLocation = new ChunkCoordinates(par1, par2, par3); + this.motionX = this.motionZ = this.motionY = 0.0D; + + if (!this.worldObj.isRemote) + { + this.worldObj.updateAllPlayersSleepingFlag(); + } + + return EnumStatus.OK; + } + + private void func_71013_b(int par1) + { + this.field_71079_bU = 0.0F; + this.field_71089_bV = 0.0F; + + switch (par1) + { + case 0: + this.field_71089_bV = -1.8F; + break; + + case 1: + this.field_71079_bU = 1.8F; + break; + + case 2: + this.field_71089_bV = 1.8F; + break; + + case 3: + this.field_71079_bU = -1.8F; + } + } + + /** + * Wake up the player if they're sleeping. + */ + public void wakeUpPlayer(boolean par1, boolean par2, boolean par3) + { + this.setSize(0.6F, 1.8F); + this.resetHeight(); + ChunkCoordinates var4 = this.playerLocation; + ChunkCoordinates var5 = this.playerLocation; + + if (var4 != null && this.worldObj.getBlockId(var4.posX, var4.posY, var4.posZ) == Block.bed.blockID) + { + BlockBed.setBedOccupied(this.worldObj, var4.posX, var4.posY, var4.posZ, false); + var5 = BlockBed.getNearestEmptyChunkCoordinates(this.worldObj, var4.posX, var4.posY, var4.posZ, 0); + + if (var5 == null) + { + var5 = new ChunkCoordinates(var4.posX, var4.posY + 1, var4.posZ); + } + + this.setPosition((double)((float)var5.posX + 0.5F), (double)((float)var5.posY + this.yOffset + 0.1F), (double)((float)var5.posZ + 0.5F)); + } + + this.sleeping = false; + + if (!this.worldObj.isRemote && par2) + { + this.worldObj.updateAllPlayersSleepingFlag(); + } + + if (par1) + { + this.sleepTimer = 0; + } + else + { + this.sleepTimer = 100; + } + + if (par3) + { + this.setSpawnChunk(this.playerLocation, false); + } + } + + /** + * Checks if the player is currently in a bed + */ + private boolean isInBed() + { + return this.worldObj.getBlockId(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ) == Block.bed.blockID; + } + + /** + * Ensure that a block enabling respawning exists at the specified coordinates and find an empty space nearby to + * spawn. + */ + public static ChunkCoordinates verifyRespawnCoordinates(World par0World, ChunkCoordinates par1ChunkCoordinates, boolean par2) + { + IChunkProvider var3 = par0World.getChunkProvider(); + var3.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ - 3 >> 4); + var3.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ - 3 >> 4); + var3.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); + var3.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); + + if (par0World.getBlockId(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ) == Block.bed.blockID) + { + ChunkCoordinates var8 = BlockBed.getNearestEmptyChunkCoordinates(par0World, par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ, 0); + return var8; + } + else + { + Material var4 = par0World.getBlockMaterial(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ); + Material var5 = par0World.getBlockMaterial(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY + 1, par1ChunkCoordinates.posZ); + boolean var6 = !var4.isSolid() && !var4.isLiquid(); + boolean var7 = !var5.isSolid() && !var5.isLiquid(); + return par2 && var6 && var7 ? par1ChunkCoordinates : null; + } + } + + /** + * Returns the orientation of the bed in degrees. + */ + public float getBedOrientationInDegrees() + { + if (this.playerLocation != null) + { + int var1 = this.worldObj.getBlockMetadata(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ); + int var2 = BlockBed.getDirection(var1); + + switch (var2) + { + case 0: + return 90.0F; + + case 1: + return 0.0F; + + case 2: + return 270.0F; + + case 3: + return 180.0F; + } + } + + return 0.0F; + } + + /** + * Returns whether player is sleeping or not + */ + public boolean isPlayerSleeping() + { + return this.sleeping; + } + + /** + * Returns whether or not the player is asleep and the screen has fully faded. + */ + public boolean isPlayerFullyAsleep() + { + return this.sleeping && this.sleepTimer >= 100; + } + + public int getSleepTimer() + { + return this.sleepTimer; + } + + protected boolean getHideCape(int par1) + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1 << par1) != 0; + } + + protected void setHideCape(int par1, boolean par2) + { + byte var3 = this.dataWatcher.getWatchableObjectByte(16); + + if (par2) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var3 | 1 << par1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var3 & ~(1 << par1)))); + } + } + + /** + * Add a chat message to the player + */ + public void addChatMessage(String par1Str) {} + + /** + * Returns the location of the bed the player will respawn at, or null if the player has not slept in a bed. + */ + public ChunkCoordinates getBedLocation() + { + return this.spawnChunk; + } + + public boolean isSpawnForced() + { + return this.spawnForced; + } + + /** + * Defines a spawn coordinate to player spawn. Used by bed after the player sleep on it. + */ + public void setSpawnChunk(ChunkCoordinates par1ChunkCoordinates, boolean par2) + { + if (par1ChunkCoordinates != null) + { + this.spawnChunk = new ChunkCoordinates(par1ChunkCoordinates); + this.spawnForced = par2; + } + else + { + this.spawnChunk = null; + this.spawnForced = false; + } + } + + /** + * Will trigger the specified trigger. + */ + public void triggerAchievement(StatBase par1StatBase) + { + this.addStat(par1StatBase, 1); + } + + /** + * Adds a value to a statistic field. + */ + public void addStat(StatBase par1StatBase, int par2) {} + + /** + * Causes this entity to do an upwards motion (jumping). + */ + protected void jump() + { + super.jump(); + this.addStat(StatList.jumpStat, 1); + + if (this.isSprinting()) + { + this.addExhaustion(0.8F); + } + else + { + this.addExhaustion(0.2F); + } + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float par1, float par2) + { + double var3 = this.posX; + double var5 = this.posY; + double var7 = this.posZ; + + if (this.capabilities.isFlying && this.ridingEntity == null) + { + double var9 = this.motionY; + float var11 = this.jumpMovementFactor; + this.jumpMovementFactor = this.capabilities.getFlySpeed(); + super.moveEntityWithHeading(par1, par2); + this.motionY = var9 * 0.6D; + this.jumpMovementFactor = var11; + } + else + { + super.moveEntityWithHeading(par1, par2); + } + + this.addMovementStat(this.posX - var3, this.posY - var5, this.posZ - var7); + } + + /** + * the movespeed used for the new AI system + */ + public float getAIMoveSpeed() + { + return (float)this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(); + } + + /** + * Adds a value to a movement statistic field - like run, walk, swin or climb. + */ + public void addMovementStat(double par1, double par3, double par5) + { + if (this.ridingEntity == null) + { + int var7; + + if (this.isInsideOfMaterial(Material.water)) + { + var7 = Math.round(MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5) * 100.0F); + + if (var7 > 0) + { + this.addStat(StatList.distanceDoveStat, var7); + this.addExhaustion(0.015F * (float)var7 * 0.01F); + } + } + else if (this.isInWater()) + { + var7 = Math.round(MathHelper.sqrt_double(par1 * par1 + par5 * par5) * 100.0F); + + if (var7 > 0) + { + this.addStat(StatList.distanceSwumStat, var7); + this.addExhaustion(0.015F * (float)var7 * 0.01F); + } + } + else if (this.isOnLadder()) + { + if (par3 > 0.0D) + { + this.addStat(StatList.distanceClimbedStat, (int)Math.round(par3 * 100.0D)); + } + } + else if (this.onGround) + { + var7 = Math.round(MathHelper.sqrt_double(par1 * par1 + par5 * par5) * 100.0F); + + if (var7 > 0) + { + this.addStat(StatList.distanceWalkedStat, var7); + + if (this.isSprinting()) + { + this.addExhaustion(0.099999994F * (float)var7 * 0.01F); + } + else + { + this.addExhaustion(0.01F * (float)var7 * 0.01F); + } + } + } + else + { + var7 = Math.round(MathHelper.sqrt_double(par1 * par1 + par5 * par5) * 100.0F); + + if (var7 > 25) + { + this.addStat(StatList.distanceFlownStat, var7); + } + } + } + } + + /** + * Adds a value to a mounted movement statistic field - by minecart, boat, or pig. + */ + private void addMountedMovementStat(double par1, double par3, double par5) + { + if (this.ridingEntity != null) + { + int var7 = Math.round(MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5) * 100.0F); + + if (var7 > 0) + { + if (this.ridingEntity instanceof EntityMinecart) + { + this.addStat(StatList.distanceByMinecartStat, var7); + + if (this.startMinecartRidingCoordinate == null) + { + this.startMinecartRidingCoordinate = new ChunkCoordinates(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + } + else if ((double)this.startMinecartRidingCoordinate.getDistanceSquared(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) >= 1000000.0D) + { + this.addStat(AchievementList.onARail, 1); + } + } + else if (this.ridingEntity instanceof EntityBoat) + { + this.addStat(StatList.distanceByBoatStat, var7); + } + else if (this.ridingEntity instanceof EntityPig) + { + this.addStat(StatList.distanceByPigStat, var7); + } + } + } + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) + { + if (!this.capabilities.allowFlying) + { + if (par1 >= 2.0F) + { + this.addStat(StatList.distanceFallenStat, (int)Math.round((double)par1 * 100.0D)); + } + + super.fall(par1); + } + } + + /** + * This method gets called when the entity kills another one. + */ + public void onKillEntity(EntityLivingBase par1EntityLivingBase) + { + if (par1EntityLivingBase instanceof IMob) + { + this.triggerAchievement(AchievementList.killEnemy); + } + } + + /** + * Sets the Entity inside a web block. + */ + public void setInWeb() + { + if (!this.capabilities.isFlying) + { + super.setInWeb(); + } + } + + /** + * Gets the Icon Index of the item currently held + */ + public Icon getItemIcon(ItemStack par1ItemStack, int par2) + { + Icon var3 = super.getItemIcon(par1ItemStack, par2); + + if (par1ItemStack.itemID == Item.fishingRod.itemID && this.fishEntity != null) + { + var3 = Item.fishingRod.func_94597_g(); + } + else + { + if (par1ItemStack.getItem().requiresMultipleRenderPasses()) + { + return par1ItemStack.getItem().getIconFromDamageForRenderPass(par1ItemStack.getItemDamage(), par2); + } + + if (this.itemInUse != null && par1ItemStack.itemID == Item.bow.itemID) + { + int var4 = par1ItemStack.getMaxItemUseDuration() - this.itemInUseCount; + + if (var4 >= 18) + { + return Item.bow.getItemIconForUseDuration(2); + } + + if (var4 > 13) + { + return Item.bow.getItemIconForUseDuration(1); + } + + if (var4 > 0) + { + return Item.bow.getItemIconForUseDuration(0); + } + } + } + + return var3; + } + + public ItemStack getCurrentArmor(int par1) + { + return this.inventory.armorItemInSlot(par1); + } + + /** + * This method increases the player's current amount of experience. + */ + public void addExperience(int par1) + { + this.addScore(par1); + int var2 = Integer.MAX_VALUE - this.experienceTotal; + + if (par1 > var2) + { + par1 = var2; + } + + this.experience += (float)par1 / (float)this.xpBarCap(); + + for (this.experienceTotal += par1; this.experience >= 1.0F; this.experience /= (float)this.xpBarCap()) + { + this.experience = (this.experience - 1.0F) * (float)this.xpBarCap(); + this.addExperienceLevel(1); + } + } + + /** + * Add experience levels to this player. + */ + public void addExperienceLevel(int par1) + { + this.experienceLevel += par1; + + if (this.experienceLevel < 0) + { + this.experienceLevel = 0; + this.experience = 0.0F; + this.experienceTotal = 0; + } + + if (par1 > 0 && this.experienceLevel % 5 == 0 && (float)this.field_82249_h < (float)this.ticksExisted - 100.0F) + { + float var2 = this.experienceLevel > 30 ? 1.0F : (float)this.experienceLevel / 30.0F; + this.worldObj.playSoundAtEntity(this, "random.levelup", var2 * 0.75F, 1.0F); + this.field_82249_h = this.ticksExisted; + } + } + + /** + * This method returns the cap amount of experience that the experience bar can hold. With each level, the + * experience cap on the player's experience bar is raised by 10. + */ + public int xpBarCap() + { + return this.experienceLevel >= 30 ? 62 + (this.experienceLevel - 30) * 7 : (this.experienceLevel >= 15 ? 17 + (this.experienceLevel - 15) * 3 : 17); + } + + /** + * increases exhaustion level by supplied amount + */ + public void addExhaustion(float par1) + { + if (!this.capabilities.disableDamage) + { + if (!this.worldObj.isRemote) + { + this.foodStats.addExhaustion(par1); + } + } + } + + /** + * Returns the player's FoodStats object. + */ + public FoodStats getFoodStats() + { + return this.foodStats; + } + + public boolean canEat(boolean par1) + { + return (par1 || this.foodStats.needFood()) && !this.capabilities.disableDamage; + } + + /** + * Checks if the player's health is not full and not zero. + */ + public boolean shouldHeal() + { + return this.getHealth() > 0.0F && this.getHealth() < this.getMaxHealth(); + } + + /** + * sets the itemInUse when the use item button is clicked. Args: itemstack, int maxItemUseDuration + */ + public void setItemInUse(ItemStack par1ItemStack, int par2) + { + if (par1ItemStack != this.itemInUse) + { + this.itemInUse = par1ItemStack; + this.itemInUseCount = par2; + + if (!this.worldObj.isRemote) + { + this.setEating(true); + } + } + } + + /** + * Returns true if the given block can be mined with the current tool in adventure mode. + */ + public boolean isCurrentToolAdventureModeExempt(int par1, int par2, int par3) + { + if (this.capabilities.allowEdit) + { + return true; + } + else + { + int var4 = this.worldObj.getBlockId(par1, par2, par3); + + if (var4 > 0) + { + Block var5 = Block.blocksList[var4]; + + if (var5.blockMaterial.isAdventureModeExempt()) + { + return true; + } + + if (this.getCurrentEquippedItem() != null) + { + ItemStack var6 = this.getCurrentEquippedItem(); + + if (var6.canHarvestBlock(var5) || var6.getStrVsBlock(var5) > 1.0F) + { + return true; + } + } + } + + return false; + } + } + + public boolean canPlayerEdit(int par1, int par2, int par3, int par4, ItemStack par5ItemStack) + { + return this.capabilities.allowEdit ? true : (par5ItemStack != null ? par5ItemStack.canEditBlocks() : false); + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer par1EntityPlayer) + { + if (this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) + { + return 0; + } + else + { + int var2 = this.experienceLevel * 7; + return var2 > 100 ? 100 : var2; + } + } + + /** + * Only use is to identify if class is an instance of player for experience dropping + */ + protected boolean isPlayer() + { + return true; + } + + /** + * Gets the username of the entity. + */ + public String getEntityName() + { + return this.username; + } + + public boolean getAlwaysRenderNameTagForRender() + { + return true; + } + + /** + * Copies the values from the given player into this player if boolean par2 is true. Always clones Ender Chest + * Inventory. + */ + public void clonePlayer(EntityPlayer par1EntityPlayer, boolean par2) + { + if (par2) + { + this.inventory.copyInventory(par1EntityPlayer.inventory); + this.setHealth(par1EntityPlayer.getHealth()); + this.foodStats = par1EntityPlayer.foodStats; + this.experienceLevel = par1EntityPlayer.experienceLevel; + this.experienceTotal = par1EntityPlayer.experienceTotal; + this.experience = par1EntityPlayer.experience; + this.setScore(par1EntityPlayer.getScore()); + this.teleportDirection = par1EntityPlayer.teleportDirection; + } + else if (this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) + { + this.inventory.copyInventory(par1EntityPlayer.inventory); + this.experienceLevel = par1EntityPlayer.experienceLevel; + this.experienceTotal = par1EntityPlayer.experienceTotal; + this.experience = par1EntityPlayer.experience; + this.setScore(par1EntityPlayer.getScore()); + } + + this.theInventoryEnderChest = par1EntityPlayer.theInventoryEnderChest; + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return !this.capabilities.isFlying; + } + + /** + * Sends the player's abilities to the server (if there is one). + */ + public void sendPlayerAbilities() {} + + /** + * Sets the player's game mode and sends it to them. + */ + public void setGameType(EnumGameType par1EnumGameType) {} + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getCommandSenderName() + { + return this.username; + } + + public World getEntityWorld() + { + return this.worldObj; + } + + /** + * Returns the InventoryEnderChest of this player. + */ + public InventoryEnderChest getInventoryEnderChest() + { + return this.theInventoryEnderChest; + } + + /** + * 0 = item, 1-n is armor + */ + public ItemStack getCurrentItemOrArmor(int par1) + { + return par1 == 0 ? this.inventory.getCurrentItem() : this.inventory.armorInventory[par1 - 1]; + } + + /** + * Returns the item that this EntityLiving is holding, if any. + */ + public ItemStack getHeldItem() + { + return this.inventory.getCurrentItem(); + } + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) + { + this.inventory.armorInventory[par1] = par2ItemStack; + } + + /** + * Only used by renderer in EntityLivingBase subclasses.\nDetermines if an entity is visible or not to a specfic + * player, if the entity is normally invisible.\nFor EntityLivingBase subclasses, returning false when invisible + * will render the entity semitransparent. + */ + public boolean isInvisibleToPlayer(EntityPlayer par1EntityPlayer) + { + if (!this.isInvisible()) + { + return false; + } + else + { + Team var2 = this.getTeam(); + return var2 == null || par1EntityPlayer == null || par1EntityPlayer.getTeam() != var2 || !var2.func_98297_h(); + } + } + + public ItemStack[] getLastActiveItems() + { + return this.inventory.armorInventory; + } + + public boolean getHideCape() + { + return this.getHideCape(1); + } + + public boolean isPushedByWater() + { + return !this.capabilities.isFlying; + } + + public Scoreboard getWorldScoreboard() + { + return this.worldObj.getScoreboard(); + } + + public Team getTeam() + { + return this.getWorldScoreboard().getPlayersTeam(this.username); + } + + /** + * Returns the translated name of the entity. + */ + public String getTranslatedEntityName() + { + return ScorePlayerTeam.formatPlayerName(this.getTeam(), this.username); + } + + public void setAbsorptionAmount(float par1) + { + if (par1 < 0.0F) + { + par1 = 0.0F; + } + + this.getDataWatcher().updateObject(17, Float.valueOf(par1)); + } + + public float getAbsorptionAmount() + { + return this.getDataWatcher().getWatchableObjectFloat(17); + } +} diff --git a/src/main/java/net/minecraft/src/EntityPlayerMP.java b/src/main/java/net/minecraft/src/EntityPlayerMP.java new file mode 100644 index 0000000..0b05172 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityPlayerMP.java @@ -0,0 +1,976 @@ +package net.minecraft.src; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public class EntityPlayerMP extends EntityPlayer implements ICrafting +{ + private String translator = "en_US"; + + /** + * The NetServerHandler assigned to this player by the ServerConfigurationManager. + */ + public NetServerHandler playerNetServerHandler; + + /** Reference to the MinecraftServer object. */ + public MinecraftServer mcServer; + + /** The ItemInWorldManager belonging to this player */ + public ItemInWorldManager theItemInWorldManager; + + /** player X position as seen by PlayerManager */ + public double managedPosX; + + /** player Z position as seen by PlayerManager */ + public double managedPosZ; + + /** LinkedList that holds the loaded chunks. */ + public final List loadedChunks = new LinkedList(); + + /** entities added to this list will be packet29'd to the player */ + public final List destroyedItemsNetCache = new LinkedList(); + private float field_130068_bO = Float.MIN_VALUE; + + /** set to getHealth */ + private float lastHealth = -1.0E8F; + + /** set to foodStats.GetFoodLevel */ + private int lastFoodLevel = -99999999; + + /** set to foodStats.getSaturationLevel() == 0.0F each tick */ + private boolean wasHungry = true; + + /** Amount of experience the client was last set to */ + private int lastExperience = -99999999; + + /** de-increments onUpdate, attackEntityFrom is ignored if this >0 */ + private int initialInvulnerability = 60; + + /** must be between 3>x>15 (strictly between) */ + private int renderDistance; + private int chatVisibility; + private boolean chatColours = true; + private long field_143005_bX = 0L; + + /** + * The currently in use window ID. Incremented every time a window is opened. + */ + private int currentWindowId; + + /** + * poor mans concurency flag, lets hope the jvm doesn't re-order the setting of this flag wrt the inventory change + * on the next line + */ + public boolean playerInventoryBeingManipulated; + public int ping; + + /** + * Set when a player beats the ender dragon, used to respawn the player at the spawn point while retaining inventory + * and XP + */ + public boolean playerConqueredTheEnd; + + public EntityPlayerMP(MinecraftServer par1MinecraftServer, World par2World, String par3Str, ItemInWorldManager par4ItemInWorldManager) + { + super(par2World, par3Str); + par4ItemInWorldManager.thisPlayerMP = this; + this.theItemInWorldManager = par4ItemInWorldManager; + this.renderDistance = par1MinecraftServer.getConfigurationManager().getViewDistance(); + ChunkCoordinates var5 = par2World.getSpawnPoint(); + int var6 = var5.posX; + int var7 = var5.posZ; + int var8 = var5.posY; + + if (!par2World.provider.hasNoSky && par2World.getWorldInfo().getGameType() != EnumGameType.ADVENTURE) + { + int var9 = Math.max(5, par1MinecraftServer.getSpawnProtectionSize() - 6); + var6 += this.rand.nextInt(var9 * 2) - var9; + var7 += this.rand.nextInt(var9 * 2) - var9; + var8 = par2World.getTopSolidOrLiquidBlock(var6, var7); + } + + this.mcServer = par1MinecraftServer; + this.stepHeight = 0.0F; + this.yOffset = 0.0F; + this.setLocationAndAngles((double)var6 + 0.5D, (double)var8, (double)var7 + 0.5D, 0.0F, 0.0F); + + while (!par2World.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty()) + { + this.setPosition(this.posX, this.posY + 1.0D, this.posZ); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + + if (par1NBTTagCompound.hasKey("playerGameType")) + { + if (MinecraftServer.getServer().getForceGamemode()) + { + this.theItemInWorldManager.setGameType(MinecraftServer.getServer().getGameType()); + } + else + { + this.theItemInWorldManager.setGameType(EnumGameType.getByID(par1NBTTagCompound.getInteger("playerGameType"))); + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("playerGameType", this.theItemInWorldManager.getGameType().getID()); + } + + /** + * Add experience levels to this player. + */ + public void addExperienceLevel(int par1) + { + super.addExperienceLevel(par1); + this.lastExperience = -1; + } + + public void addSelfToInternalCraftingInventory() + { + this.openContainer.addCraftingToCrafters(this); + } + + /** + * sets the players height back to normal after doing things like sleeping and dieing + */ + protected void resetHeight() + { + this.yOffset = 0.0F; + } + + public float getEyeHeight() + { + return 1.62F; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.theItemInWorldManager.updateBlockRemoving(); + --this.initialInvulnerability; + this.openContainer.detectAndSendChanges(); + + if (!this.worldObj.isRemote && !this.openContainer.canInteractWith(this)) + { + this.closeScreen(); + this.openContainer = this.inventoryContainer; + } + + while (!this.destroyedItemsNetCache.isEmpty()) + { + int var1 = Math.min(this.destroyedItemsNetCache.size(), 127); + int[] var2 = new int[var1]; + Iterator var3 = this.destroyedItemsNetCache.iterator(); + int var4 = 0; + + while (var3.hasNext() && var4 < var1) + { + var2[var4++] = ((Integer)var3.next()).intValue(); + var3.remove(); + } + + this.playerNetServerHandler.sendPacketToPlayer(new Packet29DestroyEntity(var2)); + } + + if (!this.loadedChunks.isEmpty()) + { + ArrayList var6 = new ArrayList(); + Iterator var7 = this.loadedChunks.iterator(); + ArrayList var8 = new ArrayList(); + + while (var7.hasNext() && var6.size() < 5) + { + ChunkCoordIntPair var9 = (ChunkCoordIntPair)var7.next(); + var7.remove(); + + if (var9 != null && this.worldObj.blockExists(var9.chunkXPos << 4, 0, var9.chunkZPos << 4)) + { + var6.add(this.worldObj.getChunkFromChunkCoords(var9.chunkXPos, var9.chunkZPos)); + var8.addAll(((WorldServer)this.worldObj).getAllTileEntityInBox(var9.chunkXPos * 16, 0, var9.chunkZPos * 16, var9.chunkXPos * 16 + 16, 256, var9.chunkZPos * 16 + 16)); + } + } + + if (!var6.isEmpty()) + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet56MapChunks(var6)); + Iterator var10 = var8.iterator(); + + while (var10.hasNext()) + { + TileEntity var5 = (TileEntity)var10.next(); + this.sendTileEntityToPlayer(var5); + } + + var10 = var6.iterator(); + + while (var10.hasNext()) + { + Chunk var11 = (Chunk)var10.next(); + this.getServerForPlayer().getEntityTracker().func_85172_a(this, var11); + } + } + } + + if (this.field_143005_bX > 0L && this.mcServer.func_143007_ar() > 0 && MinecraftServer.getSystemTimeMillis() - this.field_143005_bX > (long)(this.mcServer.func_143007_ar() * 1000 * 60)) + { + this.playerNetServerHandler.kickPlayerFromServer("You have been idle for too long!"); + } + } + + public void onUpdateEntity() + { + try + { + super.onUpdate(); + + for (int var1 = 0; var1 < this.inventory.getSizeInventory(); ++var1) + { + ItemStack var6 = this.inventory.getStackInSlot(var1); + + if (var6 != null && Item.itemsList[var6.itemID].isMap() && this.playerNetServerHandler.packetSize() <= 5) + { + Packet var8 = ((ItemMapBase)Item.itemsList[var6.itemID]).createMapDataPacket(var6, this.worldObj, this); + + if (var8 != null) + { + this.playerNetServerHandler.sendPacketToPlayer(var8); + } + } + } + + if (this.getHealth() != this.lastHealth || this.lastFoodLevel != this.foodStats.getFoodLevel() || this.foodStats.getSaturationLevel() == 0.0F != this.wasHungry) + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet8UpdateHealth(this.getHealth(), this.foodStats.getFoodLevel(), this.foodStats.getSaturationLevel())); + this.lastHealth = this.getHealth(); + this.lastFoodLevel = this.foodStats.getFoodLevel(); + this.wasHungry = this.foodStats.getSaturationLevel() == 0.0F; + } + + if (this.getHealth() + this.getAbsorptionAmount() != this.field_130068_bO) + { + this.field_130068_bO = this.getHealth() + this.getAbsorptionAmount(); + Collection var5 = this.getWorldScoreboard().func_96520_a(ScoreObjectiveCriteria.health); + Iterator var7 = var5.iterator(); + + while (var7.hasNext()) + { + ScoreObjective var9 = (ScoreObjective)var7.next(); + this.getWorldScoreboard().func_96529_a(this.getEntityName(), var9).func_96651_a(Arrays.asList(new EntityPlayer[] {this})); + } + } + + if (this.experienceTotal != this.lastExperience) + { + this.lastExperience = this.experienceTotal; + this.playerNetServerHandler.sendPacketToPlayer(new Packet43Experience(this.experience, this.experienceTotal, this.experienceLevel)); + } + } + catch (Throwable var4) + { + CrashReport var2 = CrashReport.makeCrashReport(var4, "Ticking player"); + CrashReportCategory var3 = var2.makeCategory("Player being ticked"); + this.addEntityCrashInfo(var3); + throw new ReportedException(var2); + } + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource par1DamageSource) + { + this.mcServer.getConfigurationManager().sendChatMsg(this.func_110142_aN().func_94546_b()); + + if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory")) + { + this.inventory.dropAllItems(); + } + + Collection var2 = this.worldObj.getScoreboard().func_96520_a(ScoreObjectiveCriteria.deathCount); + Iterator var3 = var2.iterator(); + + while (var3.hasNext()) + { + ScoreObjective var4 = (ScoreObjective)var3.next(); + Score var5 = this.getWorldScoreboard().func_96529_a(this.getEntityName(), var4); + var5.func_96648_a(); + } + + EntityLivingBase var6 = this.func_94060_bK(); + + if (var6 != null) + { + var6.addToPlayerScore(this, this.scoreValue); + } + + this.addStat(StatList.deathsStat, 1); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + boolean var3 = this.mcServer.isDedicatedServer() && this.mcServer.isPVPEnabled() && "fall".equals(par1DamageSource.damageType); + + if (!var3 && this.initialInvulnerability > 0 && par1DamageSource != DamageSource.outOfWorld) + { + return false; + } + else + { + if (par1DamageSource instanceof EntityDamageSource) + { + Entity var4 = par1DamageSource.getEntity(); + + if (var4 instanceof EntityPlayer && !this.canAttackPlayer((EntityPlayer)var4)) + { + return false; + } + + if (var4 instanceof EntityArrow) + { + EntityArrow var5 = (EntityArrow)var4; + + if (var5.shootingEntity instanceof EntityPlayer && !this.canAttackPlayer((EntityPlayer)var5.shootingEntity)) + { + return false; + } + } + } + + return super.attackEntityFrom(par1DamageSource, par2); + } + } + } + + public boolean canAttackPlayer(EntityPlayer par1EntityPlayer) + { + return !this.mcServer.isPVPEnabled() ? false : super.canAttackPlayer(par1EntityPlayer); + } + + /** + * Teleports the entity to another dimension. Params: Dimension number to teleport to + */ + public void travelToDimension(int par1) + { + if (this.dimension == 1 && par1 == 1) + { + this.triggerAchievement(AchievementList.theEnd2); + this.worldObj.removeEntity(this); + this.playerConqueredTheEnd = true; + this.playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(4, 0)); + } + else + { + if (this.dimension == 0 && par1 == 1) + { + this.triggerAchievement(AchievementList.theEnd); + ChunkCoordinates var2 = this.mcServer.worldServerForDimension(par1).getEntrancePortalLocation(); + + if (var2 != null) + { + this.playerNetServerHandler.setPlayerLocation((double)var2.posX, (double)var2.posY, (double)var2.posZ, 0.0F, 0.0F); + } + + par1 = 1; + } + else + { + this.triggerAchievement(AchievementList.portal); + } + + this.mcServer.getConfigurationManager().transferPlayerToDimension(this, par1); + this.lastExperience = -1; + this.lastHealth = -1.0F; + this.lastFoodLevel = -1; + } + } + + /** + * called from onUpdate for all tileEntity in specific chunks + */ + private void sendTileEntityToPlayer(TileEntity par1TileEntity) + { + if (par1TileEntity != null) + { + Packet var2 = par1TileEntity.getDescriptionPacket(); + + if (var2 != null) + { + this.playerNetServerHandler.sendPacketToPlayer(var2); + } + } + } + + /** + * Called whenever an item is picked up from walking over it. Args: pickedUpEntity, stackSize + */ + public void onItemPickup(Entity par1Entity, int par2) + { + super.onItemPickup(par1Entity, par2); + this.openContainer.detectAndSendChanges(); + } + + /** + * Attempts to have the player sleep in a bed at the specified location. + */ + public EnumStatus sleepInBedAt(int par1, int par2, int par3) + { + EnumStatus var4 = super.sleepInBedAt(par1, par2, par3); + + if (var4 == EnumStatus.OK) + { + Packet17Sleep var5 = new Packet17Sleep(this, 0, par1, par2, par3); + this.getServerForPlayer().getEntityTracker().sendPacketToAllPlayersTrackingEntity(this, var5); + this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + this.playerNetServerHandler.sendPacketToPlayer(var5); + } + + return var4; + } + + /** + * Wake up the player if they're sleeping. + */ + public void wakeUpPlayer(boolean par1, boolean par2, boolean par3) + { + if (this.isPlayerSleeping()) + { + this.getServerForPlayer().getEntityTracker().sendPacketToAllAssociatedPlayers(this, new Packet18Animation(this, 3)); + } + + super.wakeUpPlayer(par1, par2, par3); + + if (this.playerNetServerHandler != null) + { + this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + } + } + + /** + * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. + */ + public void mountEntity(Entity par1Entity) + { + super.mountEntity(par1Entity); + this.playerNetServerHandler.sendPacketToPlayer(new Packet39AttachEntity(0, this, this.ridingEntity)); + this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); + } + + /** + * Takes in the distance the entity has fallen this tick and whether its on the ground to update the fall distance + * and deal fall damage if landing on the ground. Args: distanceFallenThisTick, onGround + */ + protected void updateFallState(double par1, boolean par3) {} + + /** + * likeUpdateFallState, but called from updateFlyingState, rather than moveEntity + */ + public void updateFlyingState(double par1, boolean par3) + { + super.updateFallState(par1, par3); + } + + /** + * Displays the GUI for editing a sign. Args: tileEntitySign + */ + public void displayGUIEditSign(TileEntity par1TileEntity) + { + if (par1TileEntity instanceof TileEntitySign) + { + ((TileEntitySign)par1TileEntity).func_142010_a(this); + this.playerNetServerHandler.sendPacketToPlayer(new Packet133TileEditorOpen(0, par1TileEntity.xCoord, par1TileEntity.yCoord, par1TileEntity.zCoord)); + } + } + + private void incrementWindowID() + { + this.currentWindowId = this.currentWindowId % 100 + 1; + } + + /** + * Displays the crafting GUI for a workbench. + */ + public void displayGUIWorkbench(int par1, int par2, int par3) + { + this.incrementWindowID(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 1, "Crafting", 9, true)); + this.openContainer = new ContainerWorkbench(this.inventory, this.worldObj, par1, par2, par3); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + } + + public void displayGUIEnchantment(int par1, int par2, int par3, String par4Str) + { + this.incrementWindowID(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 4, par4Str == null ? "" : par4Str, 9, par4Str != null)); + this.openContainer = new ContainerEnchantment(this.inventory, this.worldObj, par1, par2, par3); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + } + + /** + * Displays the GUI for interacting with an anvil. + */ + public void displayGUIAnvil(int par1, int par2, int par3) + { + this.incrementWindowID(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 8, "Repairing", 9, true)); + this.openContainer = new ContainerRepair(this.inventory, this.worldObj, par1, par2, par3, this); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + } + + /** + * Displays the GUI for interacting with a chest inventory. Args: chestInventory + */ + public void displayGUIChest(IInventory par1IInventory) + { + if (this.openContainer != this.inventoryContainer) + { + this.closeScreen(); + } + + this.incrementWindowID(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 0, par1IInventory.getInvName(), par1IInventory.getSizeInventory(), par1IInventory.isInvNameLocalized())); + this.openContainer = new ContainerChest(this.inventory, par1IInventory); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + } + + public void displayGUIHopper(TileEntityHopper par1TileEntityHopper) + { + this.incrementWindowID(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 9, par1TileEntityHopper.getInvName(), par1TileEntityHopper.getSizeInventory(), par1TileEntityHopper.isInvNameLocalized())); + this.openContainer = new ContainerHopper(this.inventory, par1TileEntityHopper); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + } + + public void displayGUIHopperMinecart(EntityMinecartHopper par1EntityMinecartHopper) + { + this.incrementWindowID(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 9, par1EntityMinecartHopper.getInvName(), par1EntityMinecartHopper.getSizeInventory(), par1EntityMinecartHopper.isInvNameLocalized())); + this.openContainer = new ContainerHopper(this.inventory, par1EntityMinecartHopper); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + } + + /** + * Displays the furnace GUI for the passed in furnace entity. Args: tileEntityFurnace + */ + public void displayGUIFurnace(TileEntityFurnace par1TileEntityFurnace) + { + this.incrementWindowID(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 2, par1TileEntityFurnace.getInvName(), par1TileEntityFurnace.getSizeInventory(), par1TileEntityFurnace.isInvNameLocalized())); + this.openContainer = new ContainerFurnace(this.inventory, par1TileEntityFurnace); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + } + + /** + * Displays the dipsenser GUI for the passed in dispenser entity. Args: TileEntityDispenser + */ + public void displayGUIDispenser(TileEntityDispenser par1TileEntityDispenser) + { + this.incrementWindowID(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, par1TileEntityDispenser instanceof TileEntityDropper ? 10 : 3, par1TileEntityDispenser.getInvName(), par1TileEntityDispenser.getSizeInventory(), par1TileEntityDispenser.isInvNameLocalized())); + this.openContainer = new ContainerDispenser(this.inventory, par1TileEntityDispenser); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + } + + /** + * Displays the GUI for interacting with a brewing stand. + */ + public void displayGUIBrewingStand(TileEntityBrewingStand par1TileEntityBrewingStand) + { + this.incrementWindowID(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 5, par1TileEntityBrewingStand.getInvName(), par1TileEntityBrewingStand.getSizeInventory(), par1TileEntityBrewingStand.isInvNameLocalized())); + this.openContainer = new ContainerBrewingStand(this.inventory, par1TileEntityBrewingStand); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + } + + /** + * Displays the GUI for interacting with a beacon. + */ + public void displayGUIBeacon(TileEntityBeacon par1TileEntityBeacon) + { + this.incrementWindowID(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 7, par1TileEntityBeacon.getInvName(), par1TileEntityBeacon.getSizeInventory(), par1TileEntityBeacon.isInvNameLocalized())); + this.openContainer = new ContainerBeacon(this.inventory, par1TileEntityBeacon); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + } + + public void displayGUIMerchant(IMerchant par1IMerchant, String par2Str) + { + this.incrementWindowID(); + this.openContainer = new ContainerMerchant(this.inventory, par1IMerchant, this.worldObj); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + InventoryMerchant var3 = ((ContainerMerchant)this.openContainer).getMerchantInventory(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 6, par2Str == null ? "" : par2Str, var3.getSizeInventory(), par2Str != null)); + MerchantRecipeList var4 = par1IMerchant.getRecipes(this); + + if (var4 != null) + { + try + { + ByteArrayOutputStream var5 = new ByteArrayOutputStream(); + DataOutputStream var6 = new DataOutputStream(var5); + var6.writeInt(this.currentWindowId); + var4.writeRecipiesToStream(var6); + this.playerNetServerHandler.sendPacketToPlayer(new Packet250CustomPayload("MC|TrList", var5.toByteArray())); + } + catch (IOException var7) + { + var7.printStackTrace(); + } + } + } + + public void displayGUIHorse(EntityHorse par1EntityHorse, IInventory par2IInventory) + { + if (this.openContainer != this.inventoryContainer) + { + this.closeScreen(); + } + + this.incrementWindowID(); + this.playerNetServerHandler.sendPacketToPlayer(new Packet100OpenWindow(this.currentWindowId, 11, par2IInventory.getInvName(), par2IInventory.getSizeInventory(), par2IInventory.isInvNameLocalized(), par1EntityHorse.entityId)); + this.openContainer = new ContainerHorseInventory(this.inventory, par2IInventory, par1EntityHorse); + this.openContainer.windowId = this.currentWindowId; + this.openContainer.addCraftingToCrafters(this); + } + + /** + * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual + * contents of that slot. Args: Container, slot number, slot contents + */ + public void sendSlotContents(Container par1Container, int par2, ItemStack par3ItemStack) + { + if (!(par1Container.getSlot(par2) instanceof SlotCrafting)) + { + if (!this.playerInventoryBeingManipulated) + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet103SetSlot(par1Container.windowId, par2, par3ItemStack)); + } + } + } + + public void sendContainerToPlayer(Container par1Container) + { + this.sendContainerAndContentsToPlayer(par1Container, par1Container.getInventory()); + } + + public void sendContainerAndContentsToPlayer(Container par1Container, List par2List) + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet104WindowItems(par1Container.windowId, par2List)); + this.playerNetServerHandler.sendPacketToPlayer(new Packet103SetSlot(-1, -1, this.inventory.getItemStack())); + } + + /** + * Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress, + * and enchanting level. Normally the first int identifies which variable to update, and the second contains the new + * value. Both are truncated to shorts in non-local SMP. + */ + public void sendProgressBarUpdate(Container par1Container, int par2, int par3) + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet105UpdateProgressbar(par1Container.windowId, par2, par3)); + } + + /** + * sets current screen to null (used on escape buttons of GUIs) + */ + public void closeScreen() + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet101CloseWindow(this.openContainer.windowId)); + this.closeContainer(); + } + + /** + * updates item held by mouse + */ + public void updateHeldItem() + { + if (!this.playerInventoryBeingManipulated) + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet103SetSlot(-1, -1, this.inventory.getItemStack())); + } + } + + /** + * Closes the container the player currently has open. + */ + public void closeContainer() + { + this.openContainer.onContainerClosed(this); + this.openContainer = this.inventoryContainer; + } + + public void setEntityActionState(float par1, float par2, boolean par3, boolean par4) + { + if (this.ridingEntity != null) + { + if (par1 >= -1.0F && par1 <= 1.0F) + { + this.moveStrafing = par1; + } + + if (par2 >= -1.0F && par2 <= 1.0F) + { + this.moveForward = par2; + } + + this.isJumping = par3; + this.setSneaking(par4); + } + } + + /** + * Adds a value to a statistic field. + */ + public void addStat(StatBase par1StatBase, int par2) + { + if (par1StatBase != null) + { + if (!par1StatBase.isIndependent) + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet200Statistic(par1StatBase.statId, par2)); + } + } + } + + public void mountEntityAndWakeUp() + { + if (this.riddenByEntity != null) + { + this.riddenByEntity.mountEntity(this); + } + + if (this.sleeping) + { + this.wakeUpPlayer(true, false, false); + } + } + + /** + * this function is called when a players inventory is sent to him, lastHealth is updated on any dimension + * transitions, then reset. + */ + public void setPlayerHealthUpdated() + { + this.lastHealth = -1.0E8F; + } + + /** + * Add a chat message to the player + */ + public void addChatMessage(String par1Str) + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromTranslationKey(par1Str))); + } + + /** + * Used for when item use count runs out, ie: eating completed + */ + protected void onItemUseFinish() + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet38EntityStatus(this.entityId, (byte)9)); + super.onItemUseFinish(); + } + + /** + * sets the itemInUse when the use item button is clicked. Args: itemstack, int maxItemUseDuration + */ + public void setItemInUse(ItemStack par1ItemStack, int par2) + { + super.setItemInUse(par1ItemStack, par2); + + if (par1ItemStack != null && par1ItemStack.getItem() != null && par1ItemStack.getItem().getItemUseAction(par1ItemStack) == EnumAction.eat) + { + this.getServerForPlayer().getEntityTracker().sendPacketToAllAssociatedPlayers(this, new Packet18Animation(this, 5)); + } + } + + /** + * Copies the values from the given player into this player if boolean par2 is true. Always clones Ender Chest + * Inventory. + */ + public void clonePlayer(EntityPlayer par1EntityPlayer, boolean par2) + { + super.clonePlayer(par1EntityPlayer, par2); + this.lastExperience = -1; + this.lastHealth = -1.0F; + this.lastFoodLevel = -1; + this.destroyedItemsNetCache.addAll(((EntityPlayerMP)par1EntityPlayer).destroyedItemsNetCache); + } + + protected void onNewPotionEffect(PotionEffect par1PotionEffect) + { + super.onNewPotionEffect(par1PotionEffect); + this.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(this.entityId, par1PotionEffect)); + } + + protected void onChangedPotionEffect(PotionEffect par1PotionEffect, boolean par2) + { + super.onChangedPotionEffect(par1PotionEffect, par2); + this.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(this.entityId, par1PotionEffect)); + } + + protected void onFinishedPotionEffect(PotionEffect par1PotionEffect) + { + super.onFinishedPotionEffect(par1PotionEffect); + this.playerNetServerHandler.sendPacketToPlayer(new Packet42RemoveEntityEffect(this.entityId, par1PotionEffect)); + } + + /** + * Move the entity to the coordinates informed, but keep yaw/pitch values. + */ + public void setPositionAndUpdate(double par1, double par3, double par5) + { + this.playerNetServerHandler.setPlayerLocation(par1, par3, par5, this.rotationYaw, this.rotationPitch); + } + + /** + * Called when the player performs a critical hit on the Entity. Args: entity that was hit critically + */ + public void onCriticalHit(Entity par1Entity) + { + this.getServerForPlayer().getEntityTracker().sendPacketToAllAssociatedPlayers(this, new Packet18Animation(par1Entity, 6)); + } + + public void onEnchantmentCritical(Entity par1Entity) + { + this.getServerForPlayer().getEntityTracker().sendPacketToAllAssociatedPlayers(this, new Packet18Animation(par1Entity, 7)); + } + + /** + * Sends the player's abilities to the server (if there is one). + */ + public void sendPlayerAbilities() + { + if (this.playerNetServerHandler != null) + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet202PlayerAbilities(this.capabilities)); + } + } + + public WorldServer getServerForPlayer() + { + return (WorldServer)this.worldObj; + } + + /** + * Sets the player's game mode and sends it to them. + */ + public void setGameType(EnumGameType par1EnumGameType) + { + this.theItemInWorldManager.setGameType(par1EnumGameType); + this.playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(3, par1EnumGameType.getID())); + } + + public void sendChatToPlayer(ChatMessageComponent par1ChatMessageComponent) + { + this.playerNetServerHandler.sendPacketToPlayer(new Packet3Chat(par1ChatMessageComponent)); + } + + /** + * Returns true if the command sender is allowed to use the given command. + */ + public boolean canCommandSenderUseCommand(int par1, String par2Str) + { + return "seed".equals(par2Str) && !this.mcServer.isDedicatedServer() ? true : (!"tell".equals(par2Str) && !"help".equals(par2Str) && !"me".equals(par2Str) ? (this.mcServer.getConfigurationManager().isPlayerOpped(this.username) ? this.mcServer.func_110455_j() >= par1 : false) : true); + } + + /** + * Gets the player's IP address. Used in /banip. + */ + public String getPlayerIP() + { + String var1 = this.playerNetServerHandler.netManager.getSocketAddress().toString(); + var1 = var1.substring(var1.indexOf("/") + 1); + var1 = var1.substring(0, var1.indexOf(":")); + return var1; + } + + public void updateClientInfo(Packet204ClientInfo par1Packet204ClientInfo) + { + this.translator = par1Packet204ClientInfo.getLanguage(); + int var2 = 256 >> par1Packet204ClientInfo.getRenderDistance(); + + if (var2 > 3 && var2 < 15) + { + this.renderDistance = var2; + } + + this.chatVisibility = par1Packet204ClientInfo.getChatVisibility(); + this.chatColours = par1Packet204ClientInfo.getChatColours(); + + if (this.mcServer.isSinglePlayer() && this.mcServer.getServerOwner().equals(this.username)) + { + this.mcServer.setDifficultyForAllWorlds(par1Packet204ClientInfo.getDifficulty()); + } + + this.setHideCape(1, !par1Packet204ClientInfo.getShowCape()); + } + + public int getChatVisibility() + { + return this.chatVisibility; + } + + /** + * on recieving this message the client (if permission is given) will download the requested textures + */ + public void requestTexturePackLoad(String par1Str, int par2) + { + String var3 = par1Str + "\u0000" + par2; + this.playerNetServerHandler.sendPacketToPlayer(new Packet250CustomPayload("MC|TPack", var3.getBytes())); + } + + /** + * Return the position for this command sender. + */ + public ChunkCoordinates getPlayerCoordinates() + { + return new ChunkCoordinates(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY + 0.5D), MathHelper.floor_double(this.posZ)); + } + + public void func_143004_u() + { + this.field_143005_bX = MinecraftServer.getSystemTimeMillis(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityPlayerSP.java b/src/main/java/net/minecraft/src/EntityPlayerSP.java new file mode 100644 index 0000000..fb5e9f1 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityPlayerSP.java @@ -0,0 +1,659 @@ +package net.minecraft.src; + +public class EntityPlayerSP extends AbstractClientPlayer +{ + public MovementInput movementInput; + protected Minecraft mc; + + /** + * Used to tell if the player pressed forward twice. If this is at 0 and it's pressed (And they are allowed to + * sprint, aka enough food on the ground etc) it sets this to 7. If it's pressed and it's greater than 0 enable + * sprinting. + */ + protected int sprintToggleTimer; + + /** Ticks left before sprinting is disabled. */ + public int sprintingTicksLeft; + public float renderArmYaw; + public float renderArmPitch; + public float prevRenderArmYaw; + public float prevRenderArmPitch; + private int horseJumpPowerCounter; + private float horseJumpPower; + private MouseFilter field_71162_ch = new MouseFilter(); + private MouseFilter field_71160_ci = new MouseFilter(); + private MouseFilter field_71161_cj = new MouseFilter(); + + /** The amount of time an entity has been in a Portal */ + public float timeInPortal; + + /** The amount of time an entity has been in a Portal the previous tick */ + public float prevTimeInPortal; + + public EntityPlayerSP(Minecraft par1Minecraft, World par2World, Session par3Session, int par4) + { + super(par2World, par3Session.getUsername()); + this.mc = par1Minecraft; + this.dimension = par4; + } + + public void updateEntityActionState() + { + super.updateEntityActionState(); + this.moveStrafing = this.movementInput.moveStrafe; + this.moveForward = this.movementInput.moveForward; + this.isJumping = this.movementInput.jump; + this.prevRenderArmYaw = this.renderArmYaw; + this.prevRenderArmPitch = this.renderArmPitch; + this.renderArmPitch = (float)((double)this.renderArmPitch + (double)(this.rotationPitch - this.renderArmPitch) * 0.5D); + this.renderArmYaw = (float)((double)this.renderArmYaw + (double)(this.rotationYaw - this.renderArmYaw) * 0.5D); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.sprintingTicksLeft > 0) + { + --this.sprintingTicksLeft; + + if (this.sprintingTicksLeft == 0) + { + this.setSprinting(false); + } + } + + if (this.sprintToggleTimer > 0) + { + --this.sprintToggleTimer; + } + + if (this.mc.playerController.enableEverythingIsScrewedUpMode()) + { + this.posX = this.posZ = 0.5D; + this.posX = 0.0D; + this.posZ = 0.0D; + this.rotationYaw = (float)this.ticksExisted / 12.0F; + this.rotationPitch = 10.0F; + this.posY = 68.5D; + } + else + { + if (!this.mc.statFileWriter.hasAchievementUnlocked(AchievementList.openInventory)) + { + this.mc.guiAchievement.queueAchievementInformation(AchievementList.openInventory); + } + + this.prevTimeInPortal = this.timeInPortal; + + if (this.inPortal) + { + if (this.mc.currentScreen != null) + { + this.mc.displayGuiScreen((GuiScreen)null); + } + + if (this.timeInPortal == 0.0F) + { + this.mc.sndManager.playSoundFX("portal.trigger", 1.0F, this.rand.nextFloat() * 0.4F + 0.8F); + } + + this.timeInPortal += 0.0125F; + + if (this.timeInPortal >= 1.0F) + { + this.timeInPortal = 1.0F; + } + + this.inPortal = false; + } + else if (this.isPotionActive(Potion.confusion) && this.getActivePotionEffect(Potion.confusion).getDuration() > 60) + { + this.timeInPortal += 0.006666667F; + + if (this.timeInPortal > 1.0F) + { + this.timeInPortal = 1.0F; + } + } + else + { + if (this.timeInPortal > 0.0F) + { + this.timeInPortal -= 0.05F; + } + + if (this.timeInPortal < 0.0F) + { + this.timeInPortal = 0.0F; + } + } + + if (this.timeUntilPortal > 0) + { + --this.timeUntilPortal; + } + + boolean var1 = this.movementInput.jump; + float var2 = 0.8F; + boolean var3 = this.movementInput.moveForward >= var2; + this.movementInput.updatePlayerMoveState(); + + if (this.isUsingItem() && !this.isRiding()) + { + this.movementInput.moveStrafe *= 0.2F; + this.movementInput.moveForward *= 0.2F; + this.sprintToggleTimer = 0; + } + + if (this.movementInput.sneak && this.ySize < 0.2F) + { + this.ySize = 0.2F; + } + + this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX - (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ - (double)this.width * 0.35D); + this.pushOutOfBlocks(this.posX + (double)this.width * 0.35D, this.boundingBox.minY + 0.5D, this.posZ + (double)this.width * 0.35D); + boolean var4 = (float)this.getFoodStats().getFoodLevel() > 6.0F || this.capabilities.allowFlying; + + if (this.onGround && !var3 && this.movementInput.moveForward >= var2 && !this.isSprinting() && var4 && !this.isUsingItem() && !this.isPotionActive(Potion.blindness)) + { + if (this.sprintToggleTimer == 0) + { + this.sprintToggleTimer = 7; + } + else + { + this.setSprinting(true); + this.sprintToggleTimer = 0; + } + } + + if (this.isSneaking()) + { + this.sprintToggleTimer = 0; + } + + if (this.isSprinting() && (this.movementInput.moveForward < var2 || this.isCollidedHorizontally || !var4)) + { + this.setSprinting(false); + } + + if (this.capabilities.allowFlying && !var1 && this.movementInput.jump) + { + if (this.flyToggleTimer == 0) + { + this.flyToggleTimer = 7; + } + else + { + this.capabilities.isFlying = !this.capabilities.isFlying; + this.sendPlayerAbilities(); + this.flyToggleTimer = 0; + } + } + + if (this.capabilities.isFlying) + { + if (this.movementInput.sneak) + { + this.motionY -= 0.15D; + } + + if (this.movementInput.jump) + { + this.motionY += 0.15D; + } + } + + if (this.isRidingHorse()) + { + if (this.horseJumpPowerCounter < 0) + { + ++this.horseJumpPowerCounter; + + if (this.horseJumpPowerCounter == 0) + { + this.horseJumpPower = 0.0F; + } + } + + if (var1 && !this.movementInput.jump) + { + this.horseJumpPowerCounter = -10; + this.func_110318_g(); + } + else if (!var1 && this.movementInput.jump) + { + this.horseJumpPowerCounter = 0; + this.horseJumpPower = 0.0F; + } + else if (var1) + { + ++this.horseJumpPowerCounter; + + if (this.horseJumpPowerCounter < 10) + { + this.horseJumpPower = (float)this.horseJumpPowerCounter * 0.1F; + } + else + { + this.horseJumpPower = 0.8F + 2.0F / (float)(this.horseJumpPowerCounter - 9) * 0.1F; + } + } + } + else + { + this.horseJumpPower = 0.0F; + } + + super.onLivingUpdate(); + + if (this.onGround && this.capabilities.isFlying) + { + this.capabilities.isFlying = false; + this.sendPlayerAbilities(); + } + } + } + + /** + * Gets the player's field of view multiplier. (ex. when flying) + */ + public float getFOVMultiplier() + { + float var1 = 1.0F; + + if (this.capabilities.isFlying) + { + var1 *= 1.1F; + } + + AttributeInstance var2 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + var1 = (float)((double)var1 * ((var2.getAttributeValue() / (double)this.capabilities.getWalkSpeed() + 1.0D) / 2.0D)); + + if (this.isUsingItem() && this.getItemInUse().itemID == Item.bow.itemID) + { + int var3 = this.getItemInUseDuration(); + float var4 = (float)var3 / 20.0F; + + if (var4 > 1.0F) + { + var4 = 1.0F; + } + else + { + var4 *= var4; + } + + var1 *= 1.0F - var4 * 0.15F; + } + + return var1; + } + + /** + * sets current screen to null (used on escape buttons of GUIs) + */ + public void closeScreen() + { + super.closeScreen(); + this.mc.displayGuiScreen((GuiScreen)null); + } + + /** + * Displays the GUI for editing a sign. Args: tileEntitySign + */ + public void displayGUIEditSign(TileEntity par1TileEntity) + { + if (par1TileEntity instanceof TileEntitySign) + { + this.mc.displayGuiScreen(new GuiEditSign((TileEntitySign)par1TileEntity)); + } + else if (par1TileEntity instanceof TileEntityCommandBlock) + { + this.mc.displayGuiScreen(new GuiCommandBlock((TileEntityCommandBlock)par1TileEntity)); + } + } + + /** + * Displays the GUI for interacting with a book. + */ + public void displayGUIBook(ItemStack par1ItemStack) + { + Item var2 = par1ItemStack.getItem(); + + if (var2 == Item.writtenBook) + { + this.mc.displayGuiScreen(new GuiScreenBook(this, par1ItemStack, false)); + } + else if (var2 == Item.writableBook) + { + this.mc.displayGuiScreen(new GuiScreenBook(this, par1ItemStack, true)); + } + } + + /** + * Displays the GUI for interacting with a chest inventory. Args: chestInventory + */ + public void displayGUIChest(IInventory par1IInventory) + { + this.mc.displayGuiScreen(new GuiChest(this.inventory, par1IInventory)); + } + + public void displayGUIHopper(TileEntityHopper par1TileEntityHopper) + { + this.mc.displayGuiScreen(new GuiHopper(this.inventory, par1TileEntityHopper)); + } + + public void displayGUIHopperMinecart(EntityMinecartHopper par1EntityMinecartHopper) + { + this.mc.displayGuiScreen(new GuiHopper(this.inventory, par1EntityMinecartHopper)); + } + + public void displayGUIHorse(EntityHorse par1EntityHorse, IInventory par2IInventory) + { + this.mc.displayGuiScreen(new GuiScreenHorseInventory(this.inventory, par2IInventory, par1EntityHorse)); + } + + /** + * Displays the crafting GUI for a workbench. + */ + public void displayGUIWorkbench(int par1, int par2, int par3) + { + this.mc.displayGuiScreen(new GuiCrafting(this.inventory, this.worldObj, par1, par2, par3)); + } + + public void displayGUIEnchantment(int par1, int par2, int par3, String par4Str) + { + this.mc.displayGuiScreen(new GuiEnchantment(this.inventory, this.worldObj, par1, par2, par3, par4Str)); + } + + /** + * Displays the GUI for interacting with an anvil. + */ + public void displayGUIAnvil(int par1, int par2, int par3) + { + this.mc.displayGuiScreen(new GuiRepair(this.inventory, this.worldObj, par1, par2, par3)); + } + + /** + * Displays the furnace GUI for the passed in furnace entity. Args: tileEntityFurnace + */ + public void displayGUIFurnace(TileEntityFurnace par1TileEntityFurnace) + { + this.mc.displayGuiScreen(new GuiFurnace(this.inventory, par1TileEntityFurnace)); + } + + /** + * Displays the GUI for interacting with a brewing stand. + */ + public void displayGUIBrewingStand(TileEntityBrewingStand par1TileEntityBrewingStand) + { + this.mc.displayGuiScreen(new GuiBrewingStand(this.inventory, par1TileEntityBrewingStand)); + } + + /** + * Displays the GUI for interacting with a beacon. + */ + public void displayGUIBeacon(TileEntityBeacon par1TileEntityBeacon) + { + this.mc.displayGuiScreen(new GuiBeacon(this.inventory, par1TileEntityBeacon)); + } + + /** + * Displays the dipsenser GUI for the passed in dispenser entity. Args: TileEntityDispenser + */ + public void displayGUIDispenser(TileEntityDispenser par1TileEntityDispenser) + { + this.mc.displayGuiScreen(new GuiDispenser(this.inventory, par1TileEntityDispenser)); + } + + public void displayGUIMerchant(IMerchant par1IMerchant, String par2Str) + { + this.mc.displayGuiScreen(new GuiMerchant(this.inventory, par1IMerchant, this.worldObj, par2Str)); + } + + /** + * Called when the player performs a critical hit on the Entity. Args: entity that was hit critically + */ + public void onCriticalHit(Entity par1Entity) + { + this.mc.effectRenderer.addEffect(new EntityCrit2FX(this.mc.theWorld, par1Entity)); + } + + public void onEnchantmentCritical(Entity par1Entity) + { + EntityCrit2FX var2 = new EntityCrit2FX(this.mc.theWorld, par1Entity, "magicCrit"); + this.mc.effectRenderer.addEffect(var2); + } + + /** + * Called whenever an item is picked up from walking over it. Args: pickedUpEntity, stackSize + */ + public void onItemPickup(Entity par1Entity, int par2) + { + this.mc.effectRenderer.addEffect(new EntityPickupFX(this.mc.theWorld, par1Entity, this, -0.5F)); + } + + /** + * Returns if this entity is sneaking. + */ + public boolean isSneaking() + { + return this.movementInput.sneak && !this.sleeping; + } + + /** + * Updates health locally. + */ + public void setPlayerSPHealth(float par1) + { + float var2 = this.getHealth() - par1; + + if (var2 <= 0.0F) + { + this.setHealth(par1); + + if (var2 < 0.0F) + { + this.hurtResistantTime = this.maxHurtResistantTime / 2; + } + } + else + { + this.lastDamage = var2; + this.setHealth(this.getHealth()); + this.hurtResistantTime = this.maxHurtResistantTime; + this.damageEntity(DamageSource.generic, var2); + this.hurtTime = this.maxHurtTime = 10; + } + } + + /** + * Add a chat message to the player + */ + public void addChatMessage(String par1Str) + { + this.mc.ingameGUI.getChatGUI().addTranslatedMessage(par1Str, new Object[0]); + } + + /** + * Adds a value to a statistic field. + */ + public void addStat(StatBase par1StatBase, int par2) + { + if (par1StatBase != null) + { + if (par1StatBase.isAchievement()) + { + Achievement var3 = (Achievement)par1StatBase; + + if (var3.parentAchievement == null || this.mc.statFileWriter.hasAchievementUnlocked(var3.parentAchievement)) + { + if (!this.mc.statFileWriter.hasAchievementUnlocked(var3)) + { + this.mc.guiAchievement.queueTakenAchievement(var3); + } + + this.mc.statFileWriter.readStat(par1StatBase, par2); + } + } + else + { + this.mc.statFileWriter.readStat(par1StatBase, par2); + } + } + } + + private boolean isBlockTranslucent(int par1, int par2, int par3) + { + return this.worldObj.isBlockNormalCube(par1, par2, par3); + } + + /** + * Adds velocity to push the entity out of blocks at the specified x, y, z position Args: x, y, z + */ + protected boolean pushOutOfBlocks(double par1, double par3, double par5) + { + int var7 = MathHelper.floor_double(par1); + int var8 = MathHelper.floor_double(par3); + int var9 = MathHelper.floor_double(par5); + double var10 = par1 - (double)var7; + double var12 = par5 - (double)var9; + + if (this.isBlockTranslucent(var7, var8, var9) || this.isBlockTranslucent(var7, var8 + 1, var9)) + { + boolean var14 = !this.isBlockTranslucent(var7 - 1, var8, var9) && !this.isBlockTranslucent(var7 - 1, var8 + 1, var9); + boolean var15 = !this.isBlockTranslucent(var7 + 1, var8, var9) && !this.isBlockTranslucent(var7 + 1, var8 + 1, var9); + boolean var16 = !this.isBlockTranslucent(var7, var8, var9 - 1) && !this.isBlockTranslucent(var7, var8 + 1, var9 - 1); + boolean var17 = !this.isBlockTranslucent(var7, var8, var9 + 1) && !this.isBlockTranslucent(var7, var8 + 1, var9 + 1); + byte var18 = -1; + double var19 = 9999.0D; + + if (var14 && var10 < var19) + { + var19 = var10; + var18 = 0; + } + + if (var15 && 1.0D - var10 < var19) + { + var19 = 1.0D - var10; + var18 = 1; + } + + if (var16 && var12 < var19) + { + var19 = var12; + var18 = 4; + } + + if (var17 && 1.0D - var12 < var19) + { + var19 = 1.0D - var12; + var18 = 5; + } + + float var21 = 0.1F; + + if (var18 == 0) + { + this.motionX = (double)(-var21); + } + + if (var18 == 1) + { + this.motionX = (double)var21; + } + + if (var18 == 4) + { + this.motionZ = (double)(-var21); + } + + if (var18 == 5) + { + this.motionZ = (double)var21; + } + } + + return false; + } + + /** + * Set sprinting switch for Entity. + */ + public void setSprinting(boolean par1) + { + super.setSprinting(par1); + this.sprintingTicksLeft = par1 ? 600 : 0; + } + + /** + * Sets the current XP, total XP, and level number. + */ + public void setXPStats(float par1, int par2, int par3) + { + this.experience = par1; + this.experienceTotal = par2; + this.experienceLevel = par3; + } + + public void sendChatToPlayer(ChatMessageComponent par1ChatMessageComponent) + { + this.mc.ingameGUI.getChatGUI().printChatMessage(par1ChatMessageComponent.toStringWithFormatting(true)); + } + + /** + * Returns true if the command sender is allowed to use the given command. + */ + public boolean canCommandSenderUseCommand(int par1, String par2Str) + { + return par1 <= 0; + } + + /** + * Return the position for this command sender. + */ + public ChunkCoordinates getPlayerCoordinates() + { + return new ChunkCoordinates(MathHelper.floor_double(this.posX + 0.5D), MathHelper.floor_double(this.posY + 0.5D), MathHelper.floor_double(this.posZ + 0.5D)); + } + + /** + * Returns the item that this EntityLiving is holding, if any. + */ + public ItemStack getHeldItem() + { + return this.inventory.getCurrentItem(); + } + + public void playSound(String par1Str, float par2, float par3) + { + this.worldObj.playSound(this.posX, this.posY - (double)this.yOffset, this.posZ, par1Str, par2, par3, false); + } + + /** + * Returns whether the entity is in a local (client) world + */ + public boolean isClientWorld() + { + return true; + } + + public boolean isRidingHorse() + { + return this.ridingEntity != null && this.ridingEntity instanceof EntityHorse; + } + + public float getHorseJumpPower() + { + return this.horseJumpPower; + } + + protected void func_110318_g() {} +} diff --git a/src/main/java/net/minecraft/src/EntityPortalFX.java b/src/main/java/net/minecraft/src/EntityPortalFX.java new file mode 100644 index 0000000..5eb0faf --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityPortalFX.java @@ -0,0 +1,89 @@ +package net.minecraft.src; + +public class EntityPortalFX extends EntityFX +{ + private float portalParticleScale; + private double portalPosX; + private double portalPosY; + private double portalPosZ; + + public EntityPortalFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, par8, par10, par12); + this.motionX = par8; + this.motionY = par10; + this.motionZ = par12; + this.portalPosX = this.posX = par2; + this.portalPosY = this.posY = par4; + this.portalPosZ = this.posZ = par6; + float var14 = this.rand.nextFloat() * 0.6F + 0.4F; + this.portalParticleScale = this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F * var14; + this.particleGreen *= 0.3F; + this.particleRed *= 0.9F; + this.particleMaxAge = (int)(Math.random() * 10.0D) + 40; + this.noClip = true; + this.setParticleTextureIndex((int)(Math.random() * 8.0D)); + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge; + var8 = 1.0F - var8; + var8 *= var8; + var8 = 1.0F - var8; + this.particleScale = this.portalParticleScale * var8; + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + + public int getBrightnessForRender(float par1) + { + int var2 = super.getBrightnessForRender(par1); + float var3 = (float)this.particleAge / (float)this.particleMaxAge; + var3 *= var3; + var3 *= var3; + int var4 = var2 & 255; + int var5 = var2 >> 16 & 255; + var5 += (int)(var3 * 15.0F * 16.0F); + + if (var5 > 240) + { + var5 = 240; + } + + return var4 | var5 << 16; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness(float par1) + { + float var2 = super.getBrightness(par1); + float var3 = (float)this.particleAge / (float)this.particleMaxAge; + var3 = var3 * var3 * var3 * var3; + return var2 * (1.0F - var3) + var3; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + float var1 = (float)this.particleAge / (float)this.particleMaxAge; + float var2 = var1; + var1 = -var1 + var1 * var1 * 2.0F; + var1 = 1.0F - var1; + this.posX = this.portalPosX + this.motionX * (double)var1; + this.posY = this.portalPosY + this.motionY * (double)var1 + (double)(1.0F - var2); + this.posZ = this.portalPosZ + this.motionZ * (double)var1; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityPotion.java b/src/main/java/net/minecraft/src/EntityPotion.java new file mode 100644 index 0000000..ac086cd --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityPotion.java @@ -0,0 +1,178 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class EntityPotion extends EntityThrowable +{ + /** + * The damage value of the thrown potion that this EntityPotion represents. + */ + private ItemStack potionDamage; + + public EntityPotion(World par1World) + { + super(par1World); + } + + public EntityPotion(World par1World, EntityLivingBase par2EntityLivingBase, int par3) + { + this(par1World, par2EntityLivingBase, new ItemStack(Item.potion, 1, par3)); + } + + public EntityPotion(World par1World, EntityLivingBase par2EntityLivingBase, ItemStack par3ItemStack) + { + super(par1World, par2EntityLivingBase); + this.potionDamage = par3ItemStack; + } + + public EntityPotion(World par1World, double par2, double par4, double par6, int par8) + { + this(par1World, par2, par4, par6, new ItemStack(Item.potion, 1, par8)); + } + + public EntityPotion(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) + { + super(par1World, par2, par4, par6); + this.potionDamage = par8ItemStack; + } + + /** + * Gets the amount of gravity to apply to the thrown entity with each tick. + */ + protected float getGravityVelocity() + { + return 0.05F; + } + + protected float func_70182_d() + { + return 0.5F; + } + + protected float func_70183_g() + { + return -20.0F; + } + + public void setPotionDamage(int par1) + { + if (this.potionDamage == null) + { + this.potionDamage = new ItemStack(Item.potion, 1, 0); + } + + this.potionDamage.setItemDamage(par1); + } + + /** + * Returns the damage value of the thrown potion that this EntityPotion represents. + */ + public int getPotionDamage() + { + if (this.potionDamage == null) + { + this.potionDamage = new ItemStack(Item.potion, 1, 0); + } + + return this.potionDamage.getItemDamage(); + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected void onImpact(MovingObjectPosition par1MovingObjectPosition) + { + if (!this.worldObj.isRemote) + { + List var2 = Item.potion.getEffects(this.potionDamage); + + if (var2 != null && !var2.isEmpty()) + { + AxisAlignedBB var3 = this.boundingBox.expand(4.0D, 2.0D, 4.0D); + List var4 = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, var3); + + if (var4 != null && !var4.isEmpty()) + { + Iterator var5 = var4.iterator(); + + while (var5.hasNext()) + { + EntityLivingBase var6 = (EntityLivingBase)var5.next(); + double var7 = this.getDistanceSqToEntity(var6); + + if (var7 < 16.0D) + { + double var9 = 1.0D - Math.sqrt(var7) / 4.0D; + + if (var6 == par1MovingObjectPosition.entityHit) + { + var9 = 1.0D; + } + + Iterator var11 = var2.iterator(); + + while (var11.hasNext()) + { + PotionEffect var12 = (PotionEffect)var11.next(); + int var13 = var12.getPotionID(); + + if (Potion.potionTypes[var13].isInstant()) + { + Potion.potionTypes[var13].affectEntity(this.getThrower(), var6, var12.getAmplifier(), var9); + } + else + { + int var14 = (int)(var9 * (double)var12.getDuration() + 0.5D); + + if (var14 > 20) + { + var6.addPotionEffect(new PotionEffect(var13, var14, var12.getAmplifier())); + } + } + } + } + } + } + } + + this.worldObj.playAuxSFX(2002, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), this.getPotionDamage()); + this.setDead(); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + + if (par1NBTTagCompound.hasKey("Potion")) + { + this.potionDamage = ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("Potion")); + } + else + { + this.setPotionDamage(par1NBTTagCompound.getInteger("potionValue")); + } + + if (this.potionDamage == null) + { + this.setDead(); + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + + if (this.potionDamage != null) + { + par1NBTTagCompound.setCompoundTag("Potion", this.potionDamage.writeToNBT(new NBTTagCompound())); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityRainFX.java b/src/main/java/net/minecraft/src/EntityRainFX.java new file mode 100644 index 0000000..44cd285 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityRainFX.java @@ -0,0 +1,62 @@ +package net.minecraft.src; + +public class EntityRainFX extends EntityFX +{ + public EntityRainFX(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.30000001192092896D; + this.motionY = (double)((float)Math.random() * 0.2F + 0.1F); + this.motionZ *= 0.30000001192092896D; + this.particleRed = 1.0F; + this.particleGreen = 1.0F; + this.particleBlue = 1.0F; + this.setParticleTextureIndex(19 + this.rand.nextInt(4)); + this.setSize(0.01F, 0.01F); + this.particleGravity = 0.06F; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= (double)this.particleGravity; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (this.particleMaxAge-- <= 0) + { + this.setDead(); + } + + if (this.onGround) + { + if (Math.random() < 0.5D) + { + this.setDead(); + } + + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + + Material var1 = this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + + if (var1.isLiquid() || var1.isSolid()) + { + double var2 = (double)((float)(MathHelper.floor_double(this.posY) + 1) - BlockFluid.getFluidHeightPercent(this.worldObj.getBlockMetadata(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)))); + + if (this.posY < var2) + { + this.setDead(); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityReddustFX.java b/src/main/java/net/minecraft/src/EntityReddustFX.java new file mode 100644 index 0000000..5b470e3 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityReddustFX.java @@ -0,0 +1,87 @@ +package net.minecraft.src; + +public class EntityReddustFX extends EntityFX +{ + float reddustParticleScale; + + public EntityReddustFX(World par1World, double par2, double par4, double par6, float par8, float par9, float par10) + { + this(par1World, par2, par4, par6, 1.0F, par8, par9, par10); + } + + public EntityReddustFX(World par1World, double par2, double par4, double par6, float par8, float par9, float par10, float par11) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + + if (par9 == 0.0F) + { + par9 = 1.0F; + } + + float var12 = (float)Math.random() * 0.4F + 0.6F; + this.particleRed = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * par9 * var12; + this.particleGreen = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * par10 * var12; + this.particleBlue = ((float)(Math.random() * 0.20000000298023224D) + 0.8F) * par11 * var12; + this.particleScale *= 0.75F; + this.particleScale *= par8; + this.reddustParticleScale = this.particleScale; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * par8); + this.noClip = false; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F; + + if (var8 < 0.0F) + { + var8 = 0.0F; + } + + if (var8 > 1.0F) + { + var8 = 1.0F; + } + + this.particleScale = this.reddustParticleScale * var8; + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityRenderer.java b/src/main/java/net/minecraft/src/EntityRenderer.java new file mode 100644 index 0000000..eb13ae4 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityRenderer.java @@ -0,0 +1,1891 @@ +package net.minecraft.src; + +import java.nio.FloatBuffer; +import java.util.List; +import java.util.Random; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.util.glu.Project; + +public class EntityRenderer +{ + private static final ResourceLocation locationRainPng = new ResourceLocation("textures/environment/rain.png"); + private static final ResourceLocation locationSnowPng = new ResourceLocation("textures/environment/snow.png"); + public static boolean anaglyphEnable; + + /** Anaglyph field (0=R, 1=GB) */ + public static int anaglyphField; + + /** A reference to the Minecraft object. */ + private Minecraft mc; + private float farPlaneDistance; + public ItemRenderer itemRenderer; + + /** Entity renderer update count */ + private int rendererUpdateCount; + + /** Pointed entity */ + private Entity pointedEntity; + private MouseFilter mouseFilterXAxis = new MouseFilter(); + private MouseFilter mouseFilterYAxis = new MouseFilter(); + + /** Mouse filter dummy 1 */ + private MouseFilter mouseFilterDummy1 = new MouseFilter(); + + /** Mouse filter dummy 2 */ + private MouseFilter mouseFilterDummy2 = new MouseFilter(); + + /** Mouse filter dummy 3 */ + private MouseFilter mouseFilterDummy3 = new MouseFilter(); + + /** Mouse filter dummy 4 */ + private MouseFilter mouseFilterDummy4 = new MouseFilter(); + private float thirdPersonDistance = 4.0F; + + /** Third person distance temp */ + private float thirdPersonDistanceTemp = 4.0F; + private float debugCamYaw; + private float prevDebugCamYaw; + private float debugCamPitch; + private float prevDebugCamPitch; + + /** Smooth cam yaw */ + private float smoothCamYaw; + + /** Smooth cam pitch */ + private float smoothCamPitch; + + /** Smooth cam filter X */ + private float smoothCamFilterX; + + /** Smooth cam filter Y */ + private float smoothCamFilterY; + + /** Smooth cam partial ticks */ + private float smoothCamPartialTicks; + private float debugCamFOV; + private float prevDebugCamFOV; + private float camRoll; + private float prevCamRoll; + + /** + * The texture id of the blocklight/skylight texture used for lighting effects + */ + private final DynamicTexture lightmapTexture; + + /** + * Colors computed in updateLightmap() and loaded into the lightmap emptyTexture + */ + private final int[] lightmapColors; + private final ResourceLocation locationLightMap; + + /** FOV modifier hand */ + private float fovModifierHand; + + /** FOV modifier hand prev */ + private float fovModifierHandPrev; + + /** FOV multiplier temp */ + private float fovMultiplierTemp; + private float field_82831_U; + private float field_82832_V; + + /** Cloud fog mode */ + private boolean cloudFog; + private double cameraZoom = 1.0D; + private double cameraYaw; + private double cameraPitch; + + /** Previous frame time in milliseconds */ + private long prevFrameTime = Minecraft.getSystemTime(); + + /** End time of last render (ns) */ + private long renderEndNanoTime; + + /** + * Is set, updateCameraAndRender() calls updateLightmap(); set by updateTorchFlicker() + */ + private boolean lightmapUpdateNeeded; + + /** Torch flicker X */ + float torchFlickerX; + + /** Torch flicker DX */ + float torchFlickerDX; + + /** Torch flicker Y */ + float torchFlickerY; + + /** Torch flicker DY */ + float torchFlickerDY; + private Random random = new Random(); + + /** Rain sound counter */ + private int rainSoundCounter; + + /** Rain X coords */ + float[] rainXCoords; + + /** Rain Y coords */ + float[] rainYCoords; + + /** Fog color buffer */ + FloatBuffer fogColorBuffer = GLAllocation.createDirectFloatBuffer(16); + + /** red component of the fog color */ + float fogColorRed; + + /** green component of the fog color */ + float fogColorGreen; + + /** blue component of the fog color */ + float fogColorBlue; + + /** Fog color 2 */ + private float fogColor2; + + /** Fog color 1 */ + private float fogColor1; + + /** + * Debug view direction (0=OFF, 1=Front, 2=Right, 3=Back, 4=Left, 5=TiltLeft, 6=TiltRight) + */ + public int debugViewDirection; + + public EntityRenderer(Minecraft par1Minecraft) + { + this.mc = par1Minecraft; + this.itemRenderer = new ItemRenderer(par1Minecraft); + this.lightmapTexture = new DynamicTexture(16, 16); + this.locationLightMap = par1Minecraft.getTextureManager().getDynamicTextureLocation("lightMap", this.lightmapTexture); + this.lightmapColors = this.lightmapTexture.getTextureData(); + } + + /** + * Updates the entity renderer + */ + public void updateRenderer() + { + this.updateFovModifierHand(); + this.updateTorchFlicker(); + this.fogColor2 = this.fogColor1; + this.thirdPersonDistanceTemp = this.thirdPersonDistance; + this.prevDebugCamYaw = this.debugCamYaw; + this.prevDebugCamPitch = this.debugCamPitch; + this.prevDebugCamFOV = this.debugCamFOV; + this.prevCamRoll = this.camRoll; + float var1; + float var2; + + if (this.mc.gameSettings.smoothCamera) + { + var1 = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + var2 = var1 * var1 * var1 * 8.0F; + this.smoothCamFilterX = this.mouseFilterXAxis.smooth(this.smoothCamYaw, 0.05F * var2); + this.smoothCamFilterY = this.mouseFilterYAxis.smooth(this.smoothCamPitch, 0.05F * var2); + this.smoothCamPartialTicks = 0.0F; + this.smoothCamYaw = 0.0F; + this.smoothCamPitch = 0.0F; + } + + if (this.mc.renderViewEntity == null) + { + this.mc.renderViewEntity = this.mc.thePlayer; + } + + var1 = this.mc.theWorld.getLightBrightness(MathHelper.floor_double(this.mc.renderViewEntity.posX), MathHelper.floor_double(this.mc.renderViewEntity.posY), MathHelper.floor_double(this.mc.renderViewEntity.posZ)); + var2 = (float)(3 - this.mc.gameSettings.renderDistance) / 3.0F; + float var3 = var1 * (1.0F - var2) + var2; + this.fogColor1 += (var3 - this.fogColor1) * 0.1F; + ++this.rendererUpdateCount; + this.itemRenderer.updateEquippedItem(); + this.addRainParticles(); + this.field_82832_V = this.field_82831_U; + + if (BossStatus.field_82825_d) + { + this.field_82831_U += 0.05F; + + if (this.field_82831_U > 1.0F) + { + this.field_82831_U = 1.0F; + } + + BossStatus.field_82825_d = false; + } + else if (this.field_82831_U > 0.0F) + { + this.field_82831_U -= 0.0125F; + } + } + + /** + * Finds what block or object the mouse is over at the specified partial tick time. Args: partialTickTime + */ + public void getMouseOver(float par1) + { + if (this.mc.renderViewEntity != null) + { + if (this.mc.theWorld != null) + { + this.mc.pointedEntityLiving = null; + double var2 = (double)this.mc.playerController.getBlockReachDistance(); + this.mc.objectMouseOver = this.mc.renderViewEntity.rayTrace(var2, par1); + double var4 = var2; + Vec3 var6 = this.mc.renderViewEntity.getPosition(par1); + + if (this.mc.playerController.extendedReach()) + { + var2 = 6.0D; + var4 = 6.0D; + } + else + { + if (var2 > 3.0D) + { + var4 = 3.0D; + } + + var2 = var4; + } + + if (this.mc.objectMouseOver != null) + { + var4 = this.mc.objectMouseOver.hitVec.distanceTo(var6); + } + + Vec3 var7 = this.mc.renderViewEntity.getLook(par1); + Vec3 var8 = var6.addVector(var7.xCoord * var2, var7.yCoord * var2, var7.zCoord * var2); + this.pointedEntity = null; + float var9 = 1.0F; + List var10 = this.mc.theWorld.getEntitiesWithinAABBExcludingEntity(this.mc.renderViewEntity, this.mc.renderViewEntity.boundingBox.addCoord(var7.xCoord * var2, var7.yCoord * var2, var7.zCoord * var2).expand((double)var9, (double)var9, (double)var9)); + double var11 = var4; + + for (int var13 = 0; var13 < var10.size(); ++var13) + { + Entity var14 = (Entity)var10.get(var13); + + if (var14.canBeCollidedWith()) + { + float var15 = var14.getCollisionBorderSize(); + AxisAlignedBB var16 = var14.boundingBox.expand((double)var15, (double)var15, (double)var15); + MovingObjectPosition var17 = var16.calculateIntercept(var6, var8); + + if (var16.isVecInside(var6)) + { + if (0.0D < var11 || var11 == 0.0D) + { + this.pointedEntity = var14; + var11 = 0.0D; + } + } + else if (var17 != null) + { + double var18 = var6.distanceTo(var17.hitVec); + + if (var18 < var11 || var11 == 0.0D) + { + if (var14 == this.mc.renderViewEntity.ridingEntity) + { + if (var11 == 0.0D) + { + this.pointedEntity = var14; + } + } + else + { + this.pointedEntity = var14; + var11 = var18; + } + } + } + } + } + + if (this.pointedEntity != null && (var11 < var4 || this.mc.objectMouseOver == null)) + { + this.mc.objectMouseOver = new MovingObjectPosition(this.pointedEntity); + + if (this.pointedEntity instanceof EntityLivingBase) + { + this.mc.pointedEntityLiving = (EntityLivingBase)this.pointedEntity; + } + } + } + } + } + + /** + * Update FOV modifier hand + */ + private void updateFovModifierHand() + { + EntityPlayerSP var1 = (EntityPlayerSP)this.mc.renderViewEntity; + this.fovMultiplierTemp = var1.getFOVMultiplier(); + this.fovModifierHandPrev = this.fovModifierHand; + this.fovModifierHand += (this.fovMultiplierTemp - this.fovModifierHand) * 0.5F; + + if (this.fovModifierHand > 1.5F) + { + this.fovModifierHand = 1.5F; + } + + if (this.fovModifierHand < 0.1F) + { + this.fovModifierHand = 0.1F; + } + } + + /** + * Changes the field of view of the player depending on if they are underwater or not + */ + private float getFOVModifier(float par1, boolean par2) + { + if (this.debugViewDirection > 0) + { + return 90.0F; + } + else + { + EntityPlayer var3 = (EntityPlayer)this.mc.renderViewEntity; + float var4 = 70.0F; + + if (par2) + { + var4 += this.mc.gameSettings.fovSetting * 40.0F; + var4 *= this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * par1; + } + + if (var3.getHealth() <= 0.0F) + { + float var5 = (float)var3.deathTime + par1; + var4 /= (1.0F - 500.0F / (var5 + 500.0F)) * 2.0F + 1.0F; + } + + int var6 = ActiveRenderInfo.getBlockIdAtEntityViewpoint(this.mc.theWorld, var3, par1); + + if (var6 != 0 && Block.blocksList[var6].blockMaterial == Material.water) + { + var4 = var4 * 60.0F / 70.0F; + } + + return var4 + this.prevDebugCamFOV + (this.debugCamFOV - this.prevDebugCamFOV) * par1; + } + } + + private void hurtCameraEffect(float par1) + { + EntityLivingBase var2 = this.mc.renderViewEntity; + float var3 = (float)var2.hurtTime - par1; + float var4; + + if (var2.getHealth() <= 0.0F) + { + var4 = (float)var2.deathTime + par1; + GL11.glRotatef(40.0F - 8000.0F / (var4 + 200.0F), 0.0F, 0.0F, 1.0F); + } + + if (var3 >= 0.0F) + { + var3 /= (float)var2.maxHurtTime; + var3 = MathHelper.sin(var3 * var3 * var3 * var3 * (float)Math.PI); + var4 = var2.attackedAtYaw; + GL11.glRotatef(-var4, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-var3 * 14.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(var4, 0.0F, 1.0F, 0.0F); + } + } + + /** + * Setups all the GL settings for view bobbing. Args: partialTickTime + */ + private void setupViewBobbing(float par1) + { + if (this.mc.renderViewEntity instanceof EntityPlayer) + { + EntityPlayer var2 = (EntityPlayer)this.mc.renderViewEntity; + float var3 = var2.distanceWalkedModified - var2.prevDistanceWalkedModified; + float var4 = -(var2.distanceWalkedModified + var3 * par1); + float var5 = var2.prevCameraYaw + (var2.cameraYaw - var2.prevCameraYaw) * par1; + float var6 = var2.prevCameraPitch + (var2.cameraPitch - var2.prevCameraPitch) * par1; + GL11.glTranslatef(MathHelper.sin(var4 * (float)Math.PI) * var5 * 0.5F, -Math.abs(MathHelper.cos(var4 * (float)Math.PI) * var5), 0.0F); + GL11.glRotatef(MathHelper.sin(var4 * (float)Math.PI) * var5 * 3.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(Math.abs(MathHelper.cos(var4 * (float)Math.PI - 0.2F) * var5) * 5.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var6, 1.0F, 0.0F, 0.0F); + } + } + + /** + * sets up player's eye (or camera in third person mode) + */ + private void orientCamera(float par1) + { + EntityLivingBase var2 = this.mc.renderViewEntity; + float var3 = var2.yOffset - 1.62F; + double var4 = var2.prevPosX + (var2.posX - var2.prevPosX) * (double)par1; + double var6 = var2.prevPosY + (var2.posY - var2.prevPosY) * (double)par1 - (double)var3; + double var8 = var2.prevPosZ + (var2.posZ - var2.prevPosZ) * (double)par1; + GL11.glRotatef(this.prevCamRoll + (this.camRoll - this.prevCamRoll) * par1, 0.0F, 0.0F, 1.0F); + + if (var2.isPlayerSleeping()) + { + var3 = (float)((double)var3 + 1.0D); + GL11.glTranslatef(0.0F, 0.3F, 0.0F); + + if (!this.mc.gameSettings.debugCamEnable) + { + int var10 = this.mc.theWorld.getBlockId(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ)); + + if (var10 == Block.bed.blockID) + { + int var11 = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ)); + int var12 = var11 & 3; + GL11.glRotatef((float)(var12 * 90), 0.0F, 1.0F, 0.0F); + } + + GL11.glRotatef(var2.prevRotationYaw + (var2.rotationYaw - var2.prevRotationYaw) * par1 + 180.0F, 0.0F, -1.0F, 0.0F); + GL11.glRotatef(var2.prevRotationPitch + (var2.rotationPitch - var2.prevRotationPitch) * par1, -1.0F, 0.0F, 0.0F); + } + } + else if (this.mc.gameSettings.thirdPersonView > 0) + { + double var27 = (double)(this.thirdPersonDistanceTemp + (this.thirdPersonDistance - this.thirdPersonDistanceTemp) * par1); + float var13; + float var28; + + if (this.mc.gameSettings.debugCamEnable) + { + var28 = this.prevDebugCamYaw + (this.debugCamYaw - this.prevDebugCamYaw) * par1; + var13 = this.prevDebugCamPitch + (this.debugCamPitch - this.prevDebugCamPitch) * par1; + GL11.glTranslatef(0.0F, 0.0F, (float)(-var27)); + GL11.glRotatef(var13, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var28, 0.0F, 1.0F, 0.0F); + } + else + { + var28 = var2.rotationYaw; + var13 = var2.rotationPitch; + + if (this.mc.gameSettings.thirdPersonView == 2) + { + var13 += 180.0F; + } + + double var14 = (double)(-MathHelper.sin(var28 / 180.0F * (float)Math.PI) * MathHelper.cos(var13 / 180.0F * (float)Math.PI)) * var27; + double var16 = (double)(MathHelper.cos(var28 / 180.0F * (float)Math.PI) * MathHelper.cos(var13 / 180.0F * (float)Math.PI)) * var27; + double var18 = (double)(-MathHelper.sin(var13 / 180.0F * (float)Math.PI)) * var27; + + for (int var20 = 0; var20 < 8; ++var20) + { + float var21 = (float)((var20 & 1) * 2 - 1); + float var22 = (float)((var20 >> 1 & 1) * 2 - 1); + float var23 = (float)((var20 >> 2 & 1) * 2 - 1); + var21 *= 0.1F; + var22 *= 0.1F; + var23 *= 0.1F; + MovingObjectPosition var24 = this.mc.theWorld.clip(this.mc.theWorld.getWorldVec3Pool().getVecFromPool(var4 + (double)var21, var6 + (double)var22, var8 + (double)var23), this.mc.theWorld.getWorldVec3Pool().getVecFromPool(var4 - var14 + (double)var21 + (double)var23, var6 - var18 + (double)var22, var8 - var16 + (double)var23)); + + if (var24 != null) + { + double var25 = var24.hitVec.distanceTo(this.mc.theWorld.getWorldVec3Pool().getVecFromPool(var4, var6, var8)); + + if (var25 < var27) + { + var27 = var25; + } + } + } + + if (this.mc.gameSettings.thirdPersonView == 2) + { + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + } + + GL11.glRotatef(var2.rotationPitch - var13, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var2.rotationYaw - var28, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, 0.0F, (float)(-var27)); + GL11.glRotatef(var28 - var2.rotationYaw, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(var13 - var2.rotationPitch, 1.0F, 0.0F, 0.0F); + } + } + else + { + GL11.glTranslatef(0.0F, 0.0F, -0.1F); + } + + if (!this.mc.gameSettings.debugCamEnable) + { + GL11.glRotatef(var2.prevRotationPitch + (var2.rotationPitch - var2.prevRotationPitch) * par1, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var2.prevRotationYaw + (var2.rotationYaw - var2.prevRotationYaw) * par1 + 180.0F, 0.0F, 1.0F, 0.0F); + } + + GL11.glTranslatef(0.0F, var3, 0.0F); + var4 = var2.prevPosX + (var2.posX - var2.prevPosX) * (double)par1; + var6 = var2.prevPosY + (var2.posY - var2.prevPosY) * (double)par1 - (double)var3; + var8 = var2.prevPosZ + (var2.posZ - var2.prevPosZ) * (double)par1; + this.cloudFog = this.mc.renderGlobal.hasCloudFog(var4, var6, var8, par1); + } + + /** + * sets up projection, view effects, camera position/rotation + */ + private void setupCameraTransform(float par1, int par2) + { + this.farPlaneDistance = (float)(256 >> this.mc.gameSettings.renderDistance); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + float var3 = 0.07F; + + if (this.mc.gameSettings.anaglyph) + { + GL11.glTranslatef((float)(-(par2 * 2 - 1)) * var3, 0.0F, 0.0F); + } + + if (this.cameraZoom != 1.0D) + { + GL11.glTranslatef((float)this.cameraYaw, (float)(-this.cameraPitch), 0.0F); + GL11.glScaled(this.cameraZoom, this.cameraZoom, 1.0D); + } + + Project.gluPerspective(this.getFOVModifier(par1, true), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F); + float var4; + + if (this.mc.playerController.enableEverythingIsScrewedUpMode()) + { + var4 = 0.6666667F; + GL11.glScalef(1.0F, var4, 1.0F); + } + + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + + if (this.mc.gameSettings.anaglyph) + { + GL11.glTranslatef((float)(par2 * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + this.hurtCameraEffect(par1); + + if (this.mc.gameSettings.viewBobbing) + { + this.setupViewBobbing(par1); + } + + var4 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * par1; + + if (var4 > 0.0F) + { + byte var5 = 20; + + if (this.mc.thePlayer.isPotionActive(Potion.confusion)) + { + var5 = 7; + } + + float var6 = 5.0F / (var4 * var4 + 5.0F) - var4 * 0.04F; + var6 *= var6; + GL11.glRotatef(((float)this.rendererUpdateCount + par1) * (float)var5, 0.0F, 1.0F, 1.0F); + GL11.glScalef(1.0F / var6, 1.0F, 1.0F); + GL11.glRotatef(-((float)this.rendererUpdateCount + par1) * (float)var5, 0.0F, 1.0F, 1.0F); + } + + this.orientCamera(par1); + + if (this.debugViewDirection > 0) + { + int var7 = this.debugViewDirection - 1; + + if (var7 == 1) + { + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + } + + if (var7 == 2) + { + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + } + + if (var7 == 3) + { + GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); + } + + if (var7 == 4) + { + GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + } + + if (var7 == 5) + { + GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); + } + } + } + + /** + * Render player hand + */ + private void renderHand(float par1, int par2) + { + if (this.debugViewDirection <= 0) + { + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + float var3 = 0.07F; + + if (this.mc.gameSettings.anaglyph) + { + GL11.glTranslatef((float)(-(par2 * 2 - 1)) * var3, 0.0F, 0.0F); + } + + if (this.cameraZoom != 1.0D) + { + GL11.glTranslatef((float)this.cameraYaw, (float)(-this.cameraPitch), 0.0F); + GL11.glScaled(this.cameraZoom, this.cameraZoom, 1.0D); + } + + Project.gluPerspective(this.getFOVModifier(par1, false), (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F); + + if (this.mc.playerController.enableEverythingIsScrewedUpMode()) + { + float var4 = 0.6666667F; + GL11.glScalef(1.0F, var4, 1.0F); + } + + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + + if (this.mc.gameSettings.anaglyph) + { + GL11.glTranslatef((float)(par2 * 2 - 1) * 0.1F, 0.0F, 0.0F); + } + + GL11.glPushMatrix(); + this.hurtCameraEffect(par1); + + if (this.mc.gameSettings.viewBobbing) + { + this.setupViewBobbing(par1); + } + + if (this.mc.gameSettings.thirdPersonView == 0 && !this.mc.renderViewEntity.isPlayerSleeping() && !this.mc.gameSettings.hideGUI && !this.mc.playerController.enableEverythingIsScrewedUpMode()) + { + this.enableLightmap((double)par1); + this.itemRenderer.renderItemInFirstPerson(par1); + this.disableLightmap((double)par1); + } + + GL11.glPopMatrix(); + + if (this.mc.gameSettings.thirdPersonView == 0 && !this.mc.renderViewEntity.isPlayerSleeping()) + { + this.itemRenderer.renderOverlays(par1); + this.hurtCameraEffect(par1); + } + + if (this.mc.gameSettings.viewBobbing) + { + this.setupViewBobbing(par1); + } + } + } + + /** + * Disable secondary texture unit used by lightmap + */ + public void disableLightmap(double par1) + { + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + + /** + * Enable lightmap in secondary texture unit + */ + public void enableLightmap(double par1) + { + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glLoadIdentity(); + float var3 = 0.00390625F; + GL11.glScalef(var3, var3, var3); + GL11.glTranslatef(8.0F, 8.0F, 8.0F); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + this.mc.getTextureManager().bindTexture(this.locationLightMap); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + + /** + * Recompute a random value that is applied to block color in updateLightmap() + */ + private void updateTorchFlicker() + { + this.torchFlickerDX = (float)((double)this.torchFlickerDX + (Math.random() - Math.random()) * Math.random() * Math.random()); + this.torchFlickerDY = (float)((double)this.torchFlickerDY + (Math.random() - Math.random()) * Math.random() * Math.random()); + this.torchFlickerDX = (float)((double)this.torchFlickerDX * 0.9D); + this.torchFlickerDY = (float)((double)this.torchFlickerDY * 0.9D); + this.torchFlickerX += (this.torchFlickerDX - this.torchFlickerX) * 1.0F; + this.torchFlickerY += (this.torchFlickerDY - this.torchFlickerY) * 1.0F; + this.lightmapUpdateNeeded = true; + } + + private void updateLightmap(float par1) + { + WorldClient var2 = this.mc.theWorld; + + if (var2 != null) + { + for (int var3 = 0; var3 < 256; ++var3) + { + float var4 = var2.getSunBrightness(1.0F) * 0.95F + 0.05F; + float var5 = var2.provider.lightBrightnessTable[var3 / 16] * var4; + float var6 = var2.provider.lightBrightnessTable[var3 % 16] * (this.torchFlickerX * 0.1F + 1.5F); + + if (var2.lastLightningBolt > 0) + { + var5 = var2.provider.lightBrightnessTable[var3 / 16]; + } + + float var7 = var5 * (var2.getSunBrightness(1.0F) * 0.65F + 0.35F); + float var8 = var5 * (var2.getSunBrightness(1.0F) * 0.65F + 0.35F); + float var11 = var6 * ((var6 * 0.6F + 0.4F) * 0.6F + 0.4F); + float var12 = var6 * (var6 * var6 * 0.6F + 0.4F); + float var13 = var7 + var6; + float var14 = var8 + var11; + float var15 = var5 + var12; + var13 = var13 * 0.96F + 0.03F; + var14 = var14 * 0.96F + 0.03F; + var15 = var15 * 0.96F + 0.03F; + float var16; + + if (this.field_82831_U > 0.0F) + { + var16 = this.field_82832_V + (this.field_82831_U - this.field_82832_V) * par1; + var13 = var13 * (1.0F - var16) + var13 * 0.7F * var16; + var14 = var14 * (1.0F - var16) + var14 * 0.6F * var16; + var15 = var15 * (1.0F - var16) + var15 * 0.6F * var16; + } + + if (var2.provider.dimensionId == 1) + { + var13 = 0.22F + var6 * 0.75F; + var14 = 0.28F + var11 * 0.75F; + var15 = 0.25F + var12 * 0.75F; + } + + float var17; + + if (this.mc.thePlayer.isPotionActive(Potion.nightVision)) + { + var16 = this.getNightVisionBrightness(this.mc.thePlayer, par1); + var17 = 1.0F / var13; + + if (var17 > 1.0F / var14) + { + var17 = 1.0F / var14; + } + + if (var17 > 1.0F / var15) + { + var17 = 1.0F / var15; + } + + var13 = var13 * (1.0F - var16) + var13 * var17 * var16; + var14 = var14 * (1.0F - var16) + var14 * var17 * var16; + var15 = var15 * (1.0F - var16) + var15 * var17 * var16; + } + + if (var13 > 1.0F) + { + var13 = 1.0F; + } + + if (var14 > 1.0F) + { + var14 = 1.0F; + } + + if (var15 > 1.0F) + { + var15 = 1.0F; + } + + var16 = this.mc.gameSettings.gammaSetting; + var17 = 1.0F - var13; + float var18 = 1.0F - var14; + float var19 = 1.0F - var15; + var17 = 1.0F - var17 * var17 * var17 * var17; + var18 = 1.0F - var18 * var18 * var18 * var18; + var19 = 1.0F - var19 * var19 * var19 * var19; + var13 = var13 * (1.0F - var16) + var17 * var16; + var14 = var14 * (1.0F - var16) + var18 * var16; + var15 = var15 * (1.0F - var16) + var19 * var16; + var13 = var13 * 0.96F + 0.03F; + var14 = var14 * 0.96F + 0.03F; + var15 = var15 * 0.96F + 0.03F; + + if (var13 > 1.0F) + { + var13 = 1.0F; + } + + if (var14 > 1.0F) + { + var14 = 1.0F; + } + + if (var15 > 1.0F) + { + var15 = 1.0F; + } + + if (var13 < 0.0F) + { + var13 = 0.0F; + } + + if (var14 < 0.0F) + { + var14 = 0.0F; + } + + if (var15 < 0.0F) + { + var15 = 0.0F; + } + + short var20 = 255; + int var21 = (int)(var13 * 255.0F); + int var22 = (int)(var14 * 255.0F); + int var23 = (int)(var15 * 255.0F); + this.lightmapColors[var3] = var20 << 24 | var21 << 16 | var22 << 8 | var23; + } + + this.lightmapTexture.updateDynamicTexture(); + this.lightmapUpdateNeeded = false; + } + } + + /** + * Gets the night vision brightness + */ + private float getNightVisionBrightness(EntityPlayer par1EntityPlayer, float par2) + { + int var3 = par1EntityPlayer.getActivePotionEffect(Potion.nightVision).getDuration(); + return var3 > 200 ? 1.0F : 0.7F + MathHelper.sin(((float)var3 - par2) * (float)Math.PI * 0.2F) * 0.3F; + } + + /** + * Will update any inputs that effect the camera angle (mouse) and then render the world and GUI + */ + public void updateCameraAndRender(float par1) + { + this.mc.mcProfiler.startSection("lightTex"); + + if (this.lightmapUpdateNeeded) + { + this.updateLightmap(par1); + } + + this.mc.mcProfiler.endSection(); + boolean var2 = Display.isActive(); + + if (!var2 && this.mc.gameSettings.pauseOnLostFocus && (!this.mc.gameSettings.touchscreen || !Mouse.isButtonDown(1))) + { + if (Minecraft.getSystemTime() - this.prevFrameTime > 500L) + { + this.mc.displayInGameMenu(); + } + } + else + { + this.prevFrameTime = Minecraft.getSystemTime(); + } + + this.mc.mcProfiler.startSection("mouse"); + + if (this.mc.inGameHasFocus && var2) + { + this.mc.mouseHelper.mouseXYChange(); + float var3 = this.mc.gameSettings.mouseSensitivity * 0.6F + 0.2F; + float var4 = var3 * var3 * var3 * 8.0F; + float var5 = (float)this.mc.mouseHelper.deltaX * var4; + float var6 = (float)this.mc.mouseHelper.deltaY * var4; + byte var7 = 1; + + if (this.mc.gameSettings.invertMouse) + { + var7 = -1; + } + + if (this.mc.gameSettings.smoothCamera) + { + this.smoothCamYaw += var5; + this.smoothCamPitch += var6; + float var8 = par1 - this.smoothCamPartialTicks; + this.smoothCamPartialTicks = par1; + var5 = this.smoothCamFilterX * var8; + var6 = this.smoothCamFilterY * var8; + this.mc.thePlayer.setAngles(var5, var6 * (float)var7); + } + else + { + this.mc.thePlayer.setAngles(var5, var6 * (float)var7); + } + } + + this.mc.mcProfiler.endSection(); + + if (!this.mc.skipRenderWorld) + { + anaglyphEnable = this.mc.gameSettings.anaglyph; + ScaledResolution var13 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + int var14 = var13.getScaledWidth(); + int var15 = var13.getScaledHeight(); + int var16 = Mouse.getX() * var14 / this.mc.displayWidth; + int var17 = var15 - Mouse.getY() * var15 / this.mc.displayHeight - 1; + int var18 = performanceToFps(this.mc.gameSettings.limitFramerate); + + if (this.mc.theWorld != null) + { + this.mc.mcProfiler.startSection("level"); + + if (this.mc.gameSettings.limitFramerate == 0) + { + this.renderWorld(par1, 0L); + } + else + { + this.renderWorld(par1, this.renderEndNanoTime + (long)(1000000000 / var18)); + } + + this.renderEndNanoTime = System.nanoTime(); + this.mc.mcProfiler.endStartSection("gui"); + + if (!this.mc.gameSettings.hideGUI || this.mc.currentScreen != null) + { + this.mc.ingameGUI.renderGameOverlay(par1, this.mc.currentScreen != null, var16, var17); + } + + this.mc.mcProfiler.endSection(); + } + else + { + GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + this.setupOverlayRendering(); + this.renderEndNanoTime = System.nanoTime(); + } + + if (this.mc.currentScreen != null) + { + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + + try + { + this.mc.currentScreen.drawScreen(var16, var17, par1); + } + catch (Throwable var12) + { + CrashReport var10 = CrashReport.makeCrashReport(var12, "Rendering screen"); + CrashReportCategory var11 = var10.makeCategory("Screen render details"); + var11.addCrashSectionCallable("Screen name", new CallableScreenName(this)); + var11.addCrashSectionCallable("Mouse location", new CallableMouseLocation(this, var16, var17)); + var11.addCrashSectionCallable("Screen size", new CallableScreenSize(this, var13)); + throw new ReportedException(var10); + } + } + } + } + + public void renderWorld(float par1, long par2) + { + this.mc.mcProfiler.startSection("lightTex"); + + if (this.lightmapUpdateNeeded) + { + this.updateLightmap(par1); + } + + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_DEPTH_TEST); + + if (this.mc.renderViewEntity == null) + { + this.mc.renderViewEntity = this.mc.thePlayer; + } + + this.mc.mcProfiler.endStartSection("pick"); + this.getMouseOver(par1); + EntityLivingBase var4 = this.mc.renderViewEntity; + RenderGlobal var5 = this.mc.renderGlobal; + EffectRenderer var6 = this.mc.effectRenderer; + double var7 = var4.lastTickPosX + (var4.posX - var4.lastTickPosX) * (double)par1; + double var9 = var4.lastTickPosY + (var4.posY - var4.lastTickPosY) * (double)par1; + double var11 = var4.lastTickPosZ + (var4.posZ - var4.lastTickPosZ) * (double)par1; + this.mc.mcProfiler.endStartSection("center"); + + for (int var13 = 0; var13 < 2; ++var13) + { + if (this.mc.gameSettings.anaglyph) + { + anaglyphField = var13; + + if (anaglyphField == 0) + { + GL11.glColorMask(false, true, true, false); + } + else + { + GL11.glColorMask(true, false, false, false); + } + } + + this.mc.mcProfiler.endStartSection("clear"); + GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + this.updateFogColor(par1); + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); + GL11.glEnable(GL11.GL_CULL_FACE); + this.mc.mcProfiler.endStartSection("camera"); + this.setupCameraTransform(par1, var13); + ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2); + this.mc.mcProfiler.endStartSection("frustrum"); + ClippingHelperImpl.getInstance(); + + if (this.mc.gameSettings.renderDistance < 2) + { + this.setupFog(-1, par1); + this.mc.mcProfiler.endStartSection("sky"); + var5.renderSky(par1); + } + + GL11.glEnable(GL11.GL_FOG); + this.setupFog(1, par1); + + if (this.mc.gameSettings.ambientOcclusion != 0) + { + GL11.glShadeModel(GL11.GL_SMOOTH); + } + + this.mc.mcProfiler.endStartSection("culling"); + Frustrum var14 = new Frustrum(); + var14.setPosition(var7, var9, var11); + this.mc.renderGlobal.clipRenderersByFrustum(var14, par1); + + if (var13 == 0) + { + this.mc.mcProfiler.endStartSection("updatechunks"); + + while (!this.mc.renderGlobal.updateRenderers(var4, false) && par2 != 0L) + { + long var15 = par2 - System.nanoTime(); + + if (var15 < 0L || var15 > 1000000000L) + { + break; + } + } + } + + if (var4.posY < 128.0D) + { + this.renderCloudsCheck(var5, par1); + } + + this.mc.mcProfiler.endStartSection("prepareterrain"); + this.setupFog(0, par1); + GL11.glEnable(GL11.GL_FOG); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + RenderHelper.disableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("terrain"); + var5.sortAndRender(var4, 0, (double)par1); + GL11.glShadeModel(GL11.GL_FLAT); + EntityPlayer var17; + + if (this.debugViewDirection == 0) + { + RenderHelper.enableStandardItemLighting(); + this.mc.mcProfiler.endStartSection("entities"); + var5.renderEntities(var4.getPosition(par1), var14, par1); + this.enableLightmap((double)par1); + this.mc.mcProfiler.endStartSection("litParticles"); + var6.renderLitParticles(var4, par1); + RenderHelper.disableStandardItemLighting(); + this.setupFog(0, par1); + this.mc.mcProfiler.endStartSection("particles"); + var6.renderParticles(var4, par1); + this.disableLightmap((double)par1); + + if (this.mc.objectMouseOver != null && var4.isInsideOfMaterial(Material.water) && var4 instanceof EntityPlayer && !this.mc.gameSettings.hideGUI) + { + var17 = (EntityPlayer)var4; + GL11.glDisable(GL11.GL_ALPHA_TEST); + this.mc.mcProfiler.endStartSection("outline"); + var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, par1); + GL11.glEnable(GL11.GL_ALPHA_TEST); + } + } + + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDepthMask(true); + this.setupFog(0, par1); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_CULL_FACE); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + + if (this.mc.gameSettings.fancyGraphics) + { + this.mc.mcProfiler.endStartSection("water"); + + if (this.mc.gameSettings.ambientOcclusion != 0) + { + GL11.glShadeModel(GL11.GL_SMOOTH); + } + + GL11.glColorMask(false, false, false, false); + int var18 = var5.sortAndRender(var4, 1, (double)par1); + + if (this.mc.gameSettings.anaglyph) + { + if (anaglyphField == 0) + { + GL11.glColorMask(false, true, true, true); + } + else + { + GL11.glColorMask(true, false, false, true); + } + } + else + { + GL11.glColorMask(true, true, true, true); + } + + if (var18 > 0) + { + var5.renderAllRenderLists(1, (double)par1); + } + + GL11.glShadeModel(GL11.GL_FLAT); + } + else + { + this.mc.mcProfiler.endStartSection("water"); + var5.sortAndRender(var4, 1, (double)par1); + } + + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_BLEND); + + if (this.cameraZoom == 1.0D && var4 instanceof EntityPlayer && !this.mc.gameSettings.hideGUI && this.mc.objectMouseOver != null && !var4.isInsideOfMaterial(Material.water)) + { + var17 = (EntityPlayer)var4; + GL11.glDisable(GL11.GL_ALPHA_TEST); + this.mc.mcProfiler.endStartSection("outline"); + var5.drawSelectionBox(var17, this.mc.objectMouseOver, 0, par1); + GL11.glEnable(GL11.GL_ALPHA_TEST); + } + + this.mc.mcProfiler.endStartSection("destroyProgress"); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + var5.drawBlockDamageTexture(Tessellator.instance, (EntityPlayer)var4, par1); + GL11.glDisable(GL11.GL_BLEND); + this.mc.mcProfiler.endStartSection("weather"); + this.renderRainSnow(par1); + GL11.glDisable(GL11.GL_FOG); + + if (var4.posY >= 128.0D) + { + this.renderCloudsCheck(var5, par1); + } + + this.mc.mcProfiler.endStartSection("hand"); + + if (this.cameraZoom == 1.0D) + { + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + this.renderHand(par1, var13); + } + + if (!this.mc.gameSettings.anaglyph) + { + this.mc.mcProfiler.endSection(); + return; + } + } + + GL11.glColorMask(true, true, true, false); + this.mc.mcProfiler.endSection(); + } + + /** + * Render clouds if enabled + */ + private void renderCloudsCheck(RenderGlobal par1RenderGlobal, float par2) + { + if (this.mc.gameSettings.shouldRenderClouds()) + { + this.mc.mcProfiler.endStartSection("clouds"); + GL11.glPushMatrix(); + this.setupFog(0, par2); + GL11.glEnable(GL11.GL_FOG); + par1RenderGlobal.renderClouds(par2); + GL11.glDisable(GL11.GL_FOG); + this.setupFog(1, par2); + GL11.glPopMatrix(); + } + } + + private void addRainParticles() + { + float var1 = this.mc.theWorld.getRainStrength(1.0F); + + if (!this.mc.gameSettings.fancyGraphics) + { + var1 /= 2.0F; + } + + if (var1 != 0.0F) + { + this.random.setSeed((long)this.rendererUpdateCount * 312987231L); + EntityLivingBase var2 = this.mc.renderViewEntity; + WorldClient var3 = this.mc.theWorld; + int var4 = MathHelper.floor_double(var2.posX); + int var5 = MathHelper.floor_double(var2.posY); + int var6 = MathHelper.floor_double(var2.posZ); + byte var7 = 10; + double var8 = 0.0D; + double var10 = 0.0D; + double var12 = 0.0D; + int var14 = 0; + int var15 = (int)(100.0F * var1 * var1); + + if (this.mc.gameSettings.particleSetting == 1) + { + var15 >>= 1; + } + else if (this.mc.gameSettings.particleSetting == 2) + { + var15 = 0; + } + + for (int var16 = 0; var16 < var15; ++var16) + { + int var17 = var4 + this.random.nextInt(var7) - this.random.nextInt(var7); + int var18 = var6 + this.random.nextInt(var7) - this.random.nextInt(var7); + int var19 = var3.getPrecipitationHeight(var17, var18); + int var20 = var3.getBlockId(var17, var19 - 1, var18); + BiomeGenBase var21 = var3.getBiomeGenForCoords(var17, var18); + + if (var19 <= var5 + var7 && var19 >= var5 - var7 && var21.canSpawnLightningBolt() && var21.getFloatTemperature() >= 0.2F) + { + float var22 = this.random.nextFloat(); + float var23 = this.random.nextFloat(); + + if (var20 > 0) + { + if (Block.blocksList[var20].blockMaterial == Material.lava) + { + this.mc.effectRenderer.addEffect(new EntitySmokeFX(var3, (double)((float)var17 + var22), (double)((float)var19 + 0.1F) - Block.blocksList[var20].getBlockBoundsMinY(), (double)((float)var18 + var23), 0.0D, 0.0D, 0.0D)); + } + else + { + ++var14; + + if (this.random.nextInt(var14) == 0) + { + var8 = (double)((float)var17 + var22); + var10 = (double)((float)var19 + 0.1F) - Block.blocksList[var20].getBlockBoundsMinY(); + var12 = (double)((float)var18 + var23); + } + + this.mc.effectRenderer.addEffect(new EntityRainFX(var3, (double)((float)var17 + var22), (double)((float)var19 + 0.1F) - Block.blocksList[var20].getBlockBoundsMinY(), (double)((float)var18 + var23))); + } + } + } + } + + if (var14 > 0 && this.random.nextInt(3) < this.rainSoundCounter++) + { + this.rainSoundCounter = 0; + + if (var10 > var2.posY + 1.0D && var3.getPrecipitationHeight(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posZ)) > MathHelper.floor_double(var2.posY)) + { + this.mc.theWorld.playSound(var8, var10, var12, "ambient.weather.rain", 0.1F, 0.5F, false); + } + else + { + this.mc.theWorld.playSound(var8, var10, var12, "ambient.weather.rain", 0.2F, 1.0F, false); + } + } + } + } + + /** + * Render rain and snow + */ + protected void renderRainSnow(float par1) + { + float var2 = this.mc.theWorld.getRainStrength(par1); + + if (var2 > 0.0F) + { + this.enableLightmap((double)par1); + + if (this.rainXCoords == null) + { + this.rainXCoords = new float[1024]; + this.rainYCoords = new float[1024]; + + for (int var3 = 0; var3 < 32; ++var3) + { + for (int var4 = 0; var4 < 32; ++var4) + { + float var5 = (float)(var4 - 16); + float var6 = (float)(var3 - 16); + float var7 = MathHelper.sqrt_float(var5 * var5 + var6 * var6); + this.rainXCoords[var3 << 5 | var4] = -var6 / var7; + this.rainYCoords[var3 << 5 | var4] = var5 / var7; + } + } + } + + EntityLivingBase var41 = this.mc.renderViewEntity; + WorldClient var42 = this.mc.theWorld; + int var43 = MathHelper.floor_double(var41.posX); + int var44 = MathHelper.floor_double(var41.posY); + int var45 = MathHelper.floor_double(var41.posZ); + Tessellator var8 = Tessellator.instance; + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.01F); + this.mc.getTextureManager().bindTexture(locationSnowPng); + double var9 = var41.lastTickPosX + (var41.posX - var41.lastTickPosX) * (double)par1; + double var11 = var41.lastTickPosY + (var41.posY - var41.lastTickPosY) * (double)par1; + double var13 = var41.lastTickPosZ + (var41.posZ - var41.lastTickPosZ) * (double)par1; + int var15 = MathHelper.floor_double(var11); + byte var16 = 5; + + if (this.mc.gameSettings.fancyGraphics) + { + var16 = 10; + } + + boolean var17 = false; + byte var18 = -1; + float var19 = (float)this.rendererUpdateCount + par1; + + if (this.mc.gameSettings.fancyGraphics) + { + var16 = 10; + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + var17 = false; + + for (int var20 = var45 - var16; var20 <= var45 + var16; ++var20) + { + for (int var21 = var43 - var16; var21 <= var43 + var16; ++var21) + { + int var22 = (var20 - var45 + 16) * 32 + var21 - var43 + 16; + float var23 = this.rainXCoords[var22] * 0.5F; + float var24 = this.rainYCoords[var22] * 0.5F; + BiomeGenBase var25 = var42.getBiomeGenForCoords(var21, var20); + + if (var25.canSpawnLightningBolt() || var25.getEnableSnow()) + { + int var26 = var42.getPrecipitationHeight(var21, var20); + int var27 = var44 - var16; + int var28 = var44 + var16; + + if (var27 < var26) + { + var27 = var26; + } + + if (var28 < var26) + { + var28 = var26; + } + + float var29 = 1.0F; + int var30 = var26; + + if (var26 < var15) + { + var30 = var15; + } + + if (var27 != var28) + { + this.random.setSeed((long)(var21 * var21 * 3121 + var21 * 45238971 ^ var20 * var20 * 418711 + var20 * 13761)); + float var31 = var25.getFloatTemperature(); + float var32; + double var35; + + if (var42.getWorldChunkManager().getTemperatureAtHeight(var31, var26) >= 0.15F) + { + if (var18 != 0) + { + if (var18 >= 0) + { + var8.draw(); + } + + var18 = 0; + this.mc.getTextureManager().bindTexture(locationRainPng); + var8.startDrawingQuads(); + } + + var32 = ((float)(this.rendererUpdateCount + var21 * var21 * 3121 + var21 * 45238971 + var20 * var20 * 418711 + var20 * 13761 & 31) + par1) / 32.0F * (3.0F + this.random.nextFloat()); + double var33 = (double)((float)var21 + 0.5F) - var41.posX; + var35 = (double)((float)var20 + 0.5F) - var41.posZ; + float var37 = MathHelper.sqrt_double(var33 * var33 + var35 * var35) / (float)var16; + float var38 = 1.0F; + var8.setBrightness(var42.getLightBrightnessForSkyBlocks(var21, var30, var20, 0)); + var8.setColorRGBA_F(var38, var38, var38, ((1.0F - var37 * var37) * 0.5F + 0.5F) * var2); + var8.setTranslation(-var9 * 1.0D, -var11 * 1.0D, -var13 * 1.0D); + var8.addVertexWithUV((double)((float)var21 - var23) + 0.5D, (double)var27, (double)((float)var20 - var24) + 0.5D, (double)(0.0F * var29), (double)((float)var27 * var29 / 4.0F + var32 * var29)); + var8.addVertexWithUV((double)((float)var21 + var23) + 0.5D, (double)var27, (double)((float)var20 + var24) + 0.5D, (double)(1.0F * var29), (double)((float)var27 * var29 / 4.0F + var32 * var29)); + var8.addVertexWithUV((double)((float)var21 + var23) + 0.5D, (double)var28, (double)((float)var20 + var24) + 0.5D, (double)(1.0F * var29), (double)((float)var28 * var29 / 4.0F + var32 * var29)); + var8.addVertexWithUV((double)((float)var21 - var23) + 0.5D, (double)var28, (double)((float)var20 - var24) + 0.5D, (double)(0.0F * var29), (double)((float)var28 * var29 / 4.0F + var32 * var29)); + var8.setTranslation(0.0D, 0.0D, 0.0D); + } + else + { + if (var18 != 1) + { + if (var18 >= 0) + { + var8.draw(); + } + + var18 = 1; + this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/environment/snow.png")); + var8.startDrawingQuads(); + } + + var32 = ((float)(this.rendererUpdateCount & 511) + par1) / 512.0F; + float var46 = this.random.nextFloat() + var19 * 0.01F * (float)this.random.nextGaussian(); + float var34 = this.random.nextFloat() + var19 * (float)this.random.nextGaussian() * 0.001F; + var35 = (double)((float)var21 + 0.5F) - var41.posX; + double var47 = (double)((float)var20 + 0.5F) - var41.posZ; + float var39 = MathHelper.sqrt_double(var35 * var35 + var47 * var47) / (float)var16; + float var40 = 1.0F; + var8.setBrightness((var42.getLightBrightnessForSkyBlocks(var21, var30, var20, 0) * 3 + 15728880) / 4); + var8.setColorRGBA_F(var40, var40, var40, ((1.0F - var39 * var39) * 0.3F + 0.5F) * var2); + var8.setTranslation(-var9 * 1.0D, -var11 * 1.0D, -var13 * 1.0D); + var8.addVertexWithUV((double)((float)var21 - var23) + 0.5D, (double)var27, (double)((float)var20 - var24) + 0.5D, (double)(0.0F * var29 + var46), (double)((float)var27 * var29 / 4.0F + var32 * var29 + var34)); + var8.addVertexWithUV((double)((float)var21 + var23) + 0.5D, (double)var27, (double)((float)var20 + var24) + 0.5D, (double)(1.0F * var29 + var46), (double)((float)var27 * var29 / 4.0F + var32 * var29 + var34)); + var8.addVertexWithUV((double)((float)var21 + var23) + 0.5D, (double)var28, (double)((float)var20 + var24) + 0.5D, (double)(1.0F * var29 + var46), (double)((float)var28 * var29 / 4.0F + var32 * var29 + var34)); + var8.addVertexWithUV((double)((float)var21 - var23) + 0.5D, (double)var28, (double)((float)var20 - var24) + 0.5D, (double)(0.0F * var29 + var46), (double)((float)var28 * var29 / 4.0F + var32 * var29 + var34)); + var8.setTranslation(0.0D, 0.0D, 0.0D); + } + } + } + } + } + + if (var18 >= 0) + { + var8.draw(); + } + + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_BLEND); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + this.disableLightmap((double)par1); + } + } + + /** + * Setup orthogonal projection for rendering GUI screen overlays + */ + public void setupOverlayRendering() + { + ScaledResolution var1 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, var1.getScaledWidth_double(), var1.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -2000.0F); + } + + /** + * calculates fog and calls glClearColor + */ + private void updateFogColor(float par1) + { + WorldClient var2 = this.mc.theWorld; + EntityLivingBase var3 = this.mc.renderViewEntity; + float var4 = 1.0F / (float)(4 - this.mc.gameSettings.renderDistance); + var4 = 1.0F - (float)Math.pow((double)var4, 0.25D); + Vec3 var5 = var2.getSkyColor(this.mc.renderViewEntity, par1); + float var6 = (float)var5.xCoord; + float var7 = (float)var5.yCoord; + float var8 = (float)var5.zCoord; + Vec3 var9 = var2.getFogColor(par1); + this.fogColorRed = (float)var9.xCoord; + this.fogColorGreen = (float)var9.yCoord; + this.fogColorBlue = (float)var9.zCoord; + float var11; + + if (this.mc.gameSettings.renderDistance < 2) + { + Vec3 var10 = MathHelper.sin(var2.getCelestialAngleRadians(par1)) > 0.0F ? var2.getWorldVec3Pool().getVecFromPool(-1.0D, 0.0D, 0.0D) : var2.getWorldVec3Pool().getVecFromPool(1.0D, 0.0D, 0.0D); + var11 = (float)var3.getLook(par1).dotProduct(var10); + + if (var11 < 0.0F) + { + var11 = 0.0F; + } + + if (var11 > 0.0F) + { + float[] var12 = var2.provider.calcSunriseSunsetColors(var2.getCelestialAngle(par1), par1); + + if (var12 != null) + { + var11 *= var12[3]; + this.fogColorRed = this.fogColorRed * (1.0F - var11) + var12[0] * var11; + this.fogColorGreen = this.fogColorGreen * (1.0F - var11) + var12[1] * var11; + this.fogColorBlue = this.fogColorBlue * (1.0F - var11) + var12[2] * var11; + } + } + } + + this.fogColorRed += (var6 - this.fogColorRed) * var4; + this.fogColorGreen += (var7 - this.fogColorGreen) * var4; + this.fogColorBlue += (var8 - this.fogColorBlue) * var4; + float var19 = var2.getRainStrength(par1); + float var20; + + if (var19 > 0.0F) + { + var11 = 1.0F - var19 * 0.5F; + var20 = 1.0F - var19 * 0.4F; + this.fogColorRed *= var11; + this.fogColorGreen *= var11; + this.fogColorBlue *= var20; + } + + var11 = var2.getWeightedThunderStrength(par1); + + if (var11 > 0.0F) + { + var20 = 1.0F - var11 * 0.5F; + this.fogColorRed *= var20; + this.fogColorGreen *= var20; + this.fogColorBlue *= var20; + } + + int var21 = ActiveRenderInfo.getBlockIdAtEntityViewpoint(this.mc.theWorld, var3, par1); + float var22; + + if (this.cloudFog) + { + Vec3 var13 = var2.getCloudColour(par1); + this.fogColorRed = (float)var13.xCoord; + this.fogColorGreen = (float)var13.yCoord; + this.fogColorBlue = (float)var13.zCoord; + } + else if (var21 != 0 && Block.blocksList[var21].blockMaterial == Material.water) + { + var22 = (float)EnchantmentHelper.getRespiration(var3) * 0.2F; + this.fogColorRed = 0.02F + var22; + this.fogColorGreen = 0.02F + var22; + this.fogColorBlue = 0.2F + var22; + } + else if (var21 != 0 && Block.blocksList[var21].blockMaterial == Material.lava) + { + this.fogColorRed = 0.6F; + this.fogColorGreen = 0.1F; + this.fogColorBlue = 0.0F; + } + + var22 = this.fogColor2 + (this.fogColor1 - this.fogColor2) * par1; + this.fogColorRed *= var22; + this.fogColorGreen *= var22; + this.fogColorBlue *= var22; + double var14 = (var3.lastTickPosY + (var3.posY - var3.lastTickPosY) * (double)par1) * var2.provider.getVoidFogYFactor(); + + if (var3.isPotionActive(Potion.blindness)) + { + int var16 = var3.getActivePotionEffect(Potion.blindness).getDuration(); + + if (var16 < 20) + { + var14 *= (double)(1.0F - (float)var16 / 20.0F); + } + else + { + var14 = 0.0D; + } + } + + if (var14 < 1.0D) + { + if (var14 < 0.0D) + { + var14 = 0.0D; + } + + var14 *= var14; + this.fogColorRed = (float)((double)this.fogColorRed * var14); + this.fogColorGreen = (float)((double)this.fogColorGreen * var14); + this.fogColorBlue = (float)((double)this.fogColorBlue * var14); + } + + float var23; + + if (this.field_82831_U > 0.0F) + { + var23 = this.field_82832_V + (this.field_82831_U - this.field_82832_V) * par1; + this.fogColorRed = this.fogColorRed * (1.0F - var23) + this.fogColorRed * 0.7F * var23; + this.fogColorGreen = this.fogColorGreen * (1.0F - var23) + this.fogColorGreen * 0.6F * var23; + this.fogColorBlue = this.fogColorBlue * (1.0F - var23) + this.fogColorBlue * 0.6F * var23; + } + + float var17; + + if (var3.isPotionActive(Potion.nightVision)) + { + var23 = this.getNightVisionBrightness(this.mc.thePlayer, par1); + var17 = 1.0F / this.fogColorRed; + + if (var17 > 1.0F / this.fogColorGreen) + { + var17 = 1.0F / this.fogColorGreen; + } + + if (var17 > 1.0F / this.fogColorBlue) + { + var17 = 1.0F / this.fogColorBlue; + } + + this.fogColorRed = this.fogColorRed * (1.0F - var23) + this.fogColorRed * var17 * var23; + this.fogColorGreen = this.fogColorGreen * (1.0F - var23) + this.fogColorGreen * var17 * var23; + this.fogColorBlue = this.fogColorBlue * (1.0F - var23) + this.fogColorBlue * var17 * var23; + } + + if (this.mc.gameSettings.anaglyph) + { + var23 = (this.fogColorRed * 30.0F + this.fogColorGreen * 59.0F + this.fogColorBlue * 11.0F) / 100.0F; + var17 = (this.fogColorRed * 30.0F + this.fogColorGreen * 70.0F) / 100.0F; + float var18 = (this.fogColorRed * 30.0F + this.fogColorBlue * 70.0F) / 100.0F; + this.fogColorRed = var23; + this.fogColorGreen = var17; + this.fogColorBlue = var18; + } + + GL11.glClearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F); + } + + /** + * Sets up the fog to be rendered. If the arg passed in is -1 the fog starts at 0 and goes to 80% of far plane + * distance and is used for sky rendering. + */ + private void setupFog(int par1, float par2) + { + EntityLivingBase var3 = this.mc.renderViewEntity; + boolean var4 = false; + + if (var3 instanceof EntityPlayer) + { + var4 = ((EntityPlayer)var3).capabilities.isCreativeMode; + } + + if (par1 == 999) + { + GL11.glFog(GL11.GL_FOG_COLOR, this.setFogColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR); + GL11.glFogf(GL11.GL_FOG_START, 0.0F); + GL11.glFogf(GL11.GL_FOG_END, 8.0F); + + if (GLContext.getCapabilities().GL_NV_fog_distance) + { + GL11.glFogi(34138, 34139); + } + + GL11.glFogf(GL11.GL_FOG_START, 0.0F); + } + else + { + GL11.glFog(GL11.GL_FOG_COLOR, this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F)); + GL11.glNormal3f(0.0F, -1.0F, 0.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + int var5 = ActiveRenderInfo.getBlockIdAtEntityViewpoint(this.mc.theWorld, var3, par2); + float var6; + + if (var3.isPotionActive(Potion.blindness)) + { + var6 = 5.0F; + int var7 = var3.getActivePotionEffect(Potion.blindness).getDuration(); + + if (var7 < 20) + { + var6 = 5.0F + (this.farPlaneDistance - 5.0F) * (1.0F - (float)var7 / 20.0F); + } + + GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR); + + if (par1 < 0) + { + GL11.glFogf(GL11.GL_FOG_START, 0.0F); + GL11.glFogf(GL11.GL_FOG_END, var6 * 0.8F); + } + else + { + GL11.glFogf(GL11.GL_FOG_START, var6 * 0.25F); + GL11.glFogf(GL11.GL_FOG_END, var6); + } + + if (GLContext.getCapabilities().GL_NV_fog_distance) + { + GL11.glFogi(34138, 34139); + } + } + else if (this.cloudFog) + { + GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); + GL11.glFogf(GL11.GL_FOG_DENSITY, 0.1F); + } + else if (var5 > 0 && Block.blocksList[var5].blockMaterial == Material.water) + { + GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); + + if (var3.isPotionActive(Potion.waterBreathing)) + { + GL11.glFogf(GL11.GL_FOG_DENSITY, 0.05F); + } + else + { + GL11.glFogf(GL11.GL_FOG_DENSITY, 0.1F - (float)EnchantmentHelper.getRespiration(var3) * 0.03F); + } + } + else if (var5 > 0 && Block.blocksList[var5].blockMaterial == Material.lava) + { + GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP); + GL11.glFogf(GL11.GL_FOG_DENSITY, 2.0F); + } + else + { + var6 = this.farPlaneDistance; + + if (this.mc.theWorld.provider.getWorldHasVoidParticles() && !var4) + { + double var10 = (double)((var3.getBrightnessForRender(par2) & 15728640) >> 20) / 16.0D + (var3.lastTickPosY + (var3.posY - var3.lastTickPosY) * (double)par2 + 4.0D) / 32.0D; + + if (var10 < 1.0D) + { + if (var10 < 0.0D) + { + var10 = 0.0D; + } + + var10 *= var10; + float var9 = 100.0F * (float)var10; + + if (var9 < 5.0F) + { + var9 = 5.0F; + } + + if (var6 > var9) + { + var6 = var9; + } + } + } + + GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR); + + if (par1 < 0) + { + GL11.glFogf(GL11.GL_FOG_START, 0.0F); + GL11.glFogf(GL11.GL_FOG_END, var6 * 0.8F); + } + else + { + GL11.glFogf(GL11.GL_FOG_START, var6 * 0.25F); + GL11.glFogf(GL11.GL_FOG_END, var6); + } + + if (GLContext.getCapabilities().GL_NV_fog_distance) + { + GL11.glFogi(34138, 34139); + } + + if (this.mc.theWorld.provider.doesXZShowFog((int)var3.posX, (int)var3.posZ)) + { + GL11.glFogf(GL11.GL_FOG_START, var6 * 0.05F); + GL11.glFogf(GL11.GL_FOG_END, Math.min(var6, 192.0F) * 0.5F); + } + } + + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glColorMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT); + } + } + + /** + * Update and return fogColorBuffer with the RGBA values passed as arguments + */ + private FloatBuffer setFogColorBuffer(float par1, float par2, float par3, float par4) + { + this.fogColorBuffer.clear(); + this.fogColorBuffer.put(par1).put(par2).put(par3).put(par4); + this.fogColorBuffer.flip(); + return this.fogColorBuffer; + } + + /** + * Converts performance value (0-2) to FPS (35-200) + */ + public static int performanceToFps(int par0) + { + short var1 = 200; + + if (par0 == 1) + { + var1 = 120; + } + + if (par0 == 2) + { + var1 = 35; + } + + return var1; + } + + /** + * Get minecraft reference from the EntityRenderer + */ + static Minecraft getRendererMinecraft(EntityRenderer par0EntityRenderer) + { + return par0EntityRenderer.mc; + } +} diff --git a/src/main/java/net/minecraft/src/EntitySelectorAlive.java b/src/main/java/net/minecraft/src/EntitySelectorAlive.java new file mode 100644 index 0000000..4b777ef --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySelectorAlive.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +final class EntitySelectorAlive implements IEntitySelector +{ + /** + * Return whether the specified entity is applicable to this filter. + */ + public boolean isEntityApplicable(Entity par1Entity) + { + return par1Entity.isEntityAlive(); + } +} diff --git a/src/main/java/net/minecraft/src/EntitySelectorArmoredMob.java b/src/main/java/net/minecraft/src/EntitySelectorArmoredMob.java new file mode 100644 index 0000000..c4b64fa --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySelectorArmoredMob.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +public class EntitySelectorArmoredMob implements IEntitySelector +{ + private final ItemStack field_96567_c; + + public EntitySelectorArmoredMob(ItemStack par1ItemStack) + { + this.field_96567_c = par1ItemStack; + } + + /** + * Return whether the specified entity is applicable to this filter. + */ + public boolean isEntityApplicable(Entity par1Entity) + { + if (!par1Entity.isEntityAlive()) + { + return false; + } + else if (!(par1Entity instanceof EntityLivingBase)) + { + return false; + } + else + { + EntityLivingBase var2 = (EntityLivingBase)par1Entity; + return var2.getCurrentItemOrArmor(EntityLiving.getArmorPosition(this.field_96567_c)) != null ? false : (var2 instanceof EntityLiving ? ((EntityLiving)var2).canPickUpLoot() : var2 instanceof EntityPlayer); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntitySelectorInventory.java b/src/main/java/net/minecraft/src/EntitySelectorInventory.java new file mode 100644 index 0000000..4f0729c --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySelectorInventory.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +final class EntitySelectorInventory implements IEntitySelector +{ + /** + * Return whether the specified entity is applicable to this filter. + */ + public boolean isEntityApplicable(Entity par1Entity) + { + return par1Entity instanceof IInventory && par1Entity.isEntityAlive(); + } +} diff --git a/src/main/java/net/minecraft/src/EntitySenses.java b/src/main/java/net/minecraft/src/EntitySenses.java new file mode 100644 index 0000000..8242ec3 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySenses.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class EntitySenses +{ + EntityLiving entityObj; + + /** Cache of entities which we can see */ + List seenEntities = new ArrayList(); + + /** Cache of entities which we cannot see */ + List unseenEntities = new ArrayList(); + + public EntitySenses(EntityLiving par1EntityLiving) + { + this.entityObj = par1EntityLiving; + } + + /** + * Clears canSeeCachePositive and canSeeCacheNegative. + */ + public void clearSensingCache() + { + this.seenEntities.clear(); + this.unseenEntities.clear(); + } + + /** + * Checks, whether 'our' entity can see the entity given as argument (true) or not (false), caching the result. + */ + public boolean canSee(Entity par1Entity) + { + if (this.seenEntities.contains(par1Entity)) + { + return true; + } + else if (this.unseenEntities.contains(par1Entity)) + { + return false; + } + else + { + this.entityObj.worldObj.theProfiler.startSection("canSee"); + boolean var2 = this.entityObj.canEntityBeSeen(par1Entity); + this.entityObj.worldObj.theProfiler.endSection(); + + if (var2) + { + this.seenEntities.add(par1Entity); + } + else + { + this.unseenEntities.add(par1Entity); + } + + return var2; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntitySheep.java b/src/main/java/net/minecraft/src/EntitySheep.java new file mode 100644 index 0000000..808966b --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySheep.java @@ -0,0 +1,319 @@ +package net.minecraft.src; + +import java.util.Random; + +public class EntitySheep extends EntityAnimal +{ + private final InventoryCrafting field_90016_e = new InventoryCrafting(new ContainerSheep(this), 2, 1); + + /** + * Holds the RGB table of the sheep colors - in OpenGL glColor3f values - used to render the sheep colored fleece. + */ + public static final float[][] fleeceColorTable = new float[][] {{1.0F, 1.0F, 1.0F}, {0.85F, 0.5F, 0.2F}, {0.7F, 0.3F, 0.85F}, {0.4F, 0.6F, 0.85F}, {0.9F, 0.9F, 0.2F}, {0.5F, 0.8F, 0.1F}, {0.95F, 0.5F, 0.65F}, {0.3F, 0.3F, 0.3F}, {0.6F, 0.6F, 0.6F}, {0.3F, 0.5F, 0.6F}, {0.5F, 0.25F, 0.7F}, {0.2F, 0.3F, 0.7F}, {0.4F, 0.3F, 0.2F}, {0.4F, 0.5F, 0.2F}, {0.6F, 0.2F, 0.2F}, {0.1F, 0.1F, 0.1F}}; + + /** + * Used to control movement as well as wool regrowth. Set to 40 on handleHealthUpdate and counts down with each + * tick. + */ + private int sheepTimer; + + /** The eat grass AI task for this mob. */ + private EntityAIEatGrass aiEatGrass = new EntityAIEatGrass(this); + + public EntitySheep(World par1World) + { + super(par1World); + this.setSize(0.9F, 1.3F); + this.getNavigator().setAvoidsWater(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.25D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(3, new EntityAITempt(this, 1.1D, Item.wheat.itemID, false)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); + this.tasks.addTask(5, this.aiEatGrass); + this.tasks.addTask(6, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(8, new EntityAILookIdle(this)); + this.field_90016_e.setInventorySlotContents(0, new ItemStack(Item.dyePowder, 1, 0)); + this.field_90016_e.setInventorySlotContents(1, new ItemStack(Item.dyePowder, 1, 0)); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + protected boolean isAIEnabled() + { + return true; + } + + protected void updateAITasks() + { + this.sheepTimer = this.aiEatGrass.getEatGrassTick(); + super.updateAITasks(); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.worldObj.isRemote) + { + this.sheepTimer = Math.max(0, this.sheepTimer - 1); + } + + super.onLivingUpdate(); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(8.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.23000000417232513D); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + if (!this.getSheared()) + { + this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 0.0F); + } + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Block.cloth.blockID; + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 10) + { + this.sheepTimer = 40; + } + else + { + super.handleHealthUpdate(par1); + } + } + + public float func_70894_j(float par1) + { + return this.sheepTimer <= 0 ? 0.0F : (this.sheepTimer >= 4 && this.sheepTimer <= 36 ? 1.0F : (this.sheepTimer < 4 ? ((float)this.sheepTimer - par1) / 4.0F : -((float)(this.sheepTimer - 40) - par1) / 4.0F)); + } + + public float func_70890_k(float par1) + { + if (this.sheepTimer > 4 && this.sheepTimer <= 36) + { + float var2 = ((float)(this.sheepTimer - 4) - par1) / 32.0F; + return ((float)Math.PI / 5F) + ((float)Math.PI * 7F / 100F) * MathHelper.sin(var2 * 28.7F); + } + else + { + return this.sheepTimer > 0 ? ((float)Math.PI / 5F) : this.rotationPitch / (180F / (float)Math.PI); + } + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + + if (var2 != null && var2.itemID == Item.shears.itemID && !this.getSheared() && !this.isChild()) + { + if (!this.worldObj.isRemote) + { + this.setSheared(true); + int var3 = 1 + this.rand.nextInt(3); + + for (int var4 = 0; var4 < var3; ++var4) + { + EntityItem var5 = this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 1.0F); + var5.motionY += (double)(this.rand.nextFloat() * 0.05F); + var5.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); + var5.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F); + } + } + + var2.damageItem(1, par1EntityPlayer); + this.playSound("mob.sheep.shear", 1.0F, 1.0F); + } + + return super.interact(par1EntityPlayer); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Sheared", this.getSheared()); + par1NBTTagCompound.setByte("Color", (byte)this.getFleeceColor()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.setSheared(par1NBTTagCompound.getBoolean("Sheared")); + this.setFleeceColor(par1NBTTagCompound.getByte("Color")); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.sheep.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.sheep.say"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.sheep.say"; + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + this.playSound("mob.sheep.step", 0.15F, 1.0F); + } + + public int getFleeceColor() + { + return this.dataWatcher.getWatchableObjectByte(16) & 15; + } + + public void setFleeceColor(int par1) + { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & 240 | par1 & 15))); + } + + /** + * returns true if a sheeps wool has been sheared + */ + public boolean getSheared() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 16) != 0; + } + + /** + * make a sheep sheared if set to true + */ + public void setSheared(boolean par1) + { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + + if (par1) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 16))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -17))); + } + } + + /** + * This method is called when a sheep spawns in the world to select the color of sheep fleece. + */ + public static int getRandomFleeceColor(Random par0Random) + { + int var1 = par0Random.nextInt(100); + return var1 < 5 ? 15 : (var1 < 10 ? 7 : (var1 < 15 ? 8 : (var1 < 18 ? 12 : (par0Random.nextInt(500) == 0 ? 6 : 0)))); + } + + public EntitySheep func_90015_b(EntityAgeable par1EntityAgeable) + { + EntitySheep var2 = (EntitySheep)par1EntityAgeable; + EntitySheep var3 = new EntitySheep(this.worldObj); + int var4 = this.func_90014_a(this, var2); + var3.setFleeceColor(15 - var4); + return var3; + } + + /** + * This function applies the benefits of growing back wool and faster growing up to the acting entity. (This + * function is used in the AIEatGrass) + */ + public void eatGrassBonus() + { + this.setSheared(false); + + if (this.isChild()) + { + this.addGrowth(60); + } + } + + public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData) + { + par1EntityLivingData = super.onSpawnWithEgg(par1EntityLivingData); + this.setFleeceColor(getRandomFleeceColor(this.worldObj.rand)); + return par1EntityLivingData; + } + + private int func_90014_a(EntityAnimal par1EntityAnimal, EntityAnimal par2EntityAnimal) + { + int var3 = this.func_90013_b(par1EntityAnimal); + int var4 = this.func_90013_b(par2EntityAnimal); + this.field_90016_e.getStackInSlot(0).setItemDamage(var3); + this.field_90016_e.getStackInSlot(1).setItemDamage(var4); + ItemStack var5 = CraftingManager.getInstance().findMatchingRecipe(this.field_90016_e, ((EntitySheep)par1EntityAnimal).worldObj); + int var6; + + if (var5 != null && var5.getItem().itemID == Item.dyePowder.itemID) + { + var6 = var5.getItemDamage(); + } + else + { + var6 = this.worldObj.rand.nextBoolean() ? var3 : var4; + } + + return var6; + } + + private int func_90013_b(EntityAnimal par1EntityAnimal) + { + return 15 - ((EntitySheep)par1EntityAnimal).getFleeceColor(); + } + + public EntityAgeable createChild(EntityAgeable par1EntityAgeable) + { + return this.func_90015_b(par1EntityAgeable); + } +} diff --git a/src/main/java/net/minecraft/src/EntitySilverfish.java b/src/main/java/net/minecraft/src/EntitySilverfish.java new file mode 100644 index 0000000..424d8c2 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySilverfish.java @@ -0,0 +1,258 @@ +package net.minecraft.src; + +public class EntitySilverfish extends EntityMob +{ + /** + * A cooldown before this entity will search for another Silverfish to join them in battle. + */ + private int allySummonCooldown; + + public EntitySilverfish(World par1World) + { + super(par1World); + this.setSize(0.3F, 0.7F); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(8.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.6000000238418579D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(1.0D); + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + /** + * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking + * (Animals, Spiders at day, peaceful PigZombies). + */ + protected Entity findPlayerToAttack() + { + double var1 = 8.0D; + return this.worldObj.getClosestVulnerablePlayerToEntity(this, var1); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.silverfish.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.silverfish.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.silverfish.kill"; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + if (this.allySummonCooldown <= 0 && (par1DamageSource instanceof EntityDamageSource || par1DamageSource == DamageSource.magic)) + { + this.allySummonCooldown = 20; + } + + return super.attackEntityFrom(par1DamageSource, par2); + } + } + + /** + * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack. + */ + protected void attackEntity(Entity par1Entity, float par2) + { + if (this.attackTime <= 0 && par2 < 1.2F && par1Entity.boundingBox.maxY > this.boundingBox.minY && par1Entity.boundingBox.minY < this.boundingBox.maxY) + { + this.attackTime = 20; + this.attackEntityAsMob(par1Entity); + } + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + this.playSound("mob.silverfish.step", 0.15F, 1.0F); + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return 0; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.renderYawOffset = this.rotationYaw; + super.onUpdate(); + } + + protected void updateEntityActionState() + { + super.updateEntityActionState(); + + if (!this.worldObj.isRemote) + { + int var1; + int var2; + int var3; + int var5; + + if (this.allySummonCooldown > 0) + { + --this.allySummonCooldown; + + if (this.allySummonCooldown == 0) + { + var1 = MathHelper.floor_double(this.posX); + var2 = MathHelper.floor_double(this.posY); + var3 = MathHelper.floor_double(this.posZ); + boolean var4 = false; + + for (var5 = 0; !var4 && var5 <= 5 && var5 >= -5; var5 = var5 <= 0 ? 1 - var5 : 0 - var5) + { + for (int var6 = 0; !var4 && var6 <= 10 && var6 >= -10; var6 = var6 <= 0 ? 1 - var6 : 0 - var6) + { + for (int var7 = 0; !var4 && var7 <= 10 && var7 >= -10; var7 = var7 <= 0 ? 1 - var7 : 0 - var7) + { + int var8 = this.worldObj.getBlockId(var1 + var6, var2 + var5, var3 + var7); + + if (var8 == Block.silverfish.blockID) + { + if (!this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) + { + int var9 = this.worldObj.getBlockMetadata(var1 + var6, var2 + var5, var3 + var7); + Block var10 = Block.stone; + + if (var9 == 1) + { + var10 = Block.cobblestone; + } + + if (var9 == 2) + { + var10 = Block.stoneBrick; + } + + this.worldObj.setBlock(var1 + var6, var2 + var5, var3 + var7, var10.blockID, 0, 3); + } + else + { + this.worldObj.destroyBlock(var1 + var6, var2 + var5, var3 + var7, false); + } + + Block.silverfish.onBlockDestroyedByPlayer(this.worldObj, var1 + var6, var2 + var5, var3 + var7, 0); + + if (this.rand.nextBoolean()) + { + var4 = true; + break; + } + } + } + } + } + } + } + + if (this.entityToAttack == null && !this.hasPath()) + { + var1 = MathHelper.floor_double(this.posX); + var2 = MathHelper.floor_double(this.posY + 0.5D); + var3 = MathHelper.floor_double(this.posZ); + int var11 = this.rand.nextInt(6); + var5 = this.worldObj.getBlockId(var1 + Facing.offsetsXForSide[var11], var2 + Facing.offsetsYForSide[var11], var3 + Facing.offsetsZForSide[var11]); + + if (BlockSilverfish.getPosingIdByMetadata(var5)) + { + this.worldObj.setBlock(var1 + Facing.offsetsXForSide[var11], var2 + Facing.offsetsYForSide[var11], var3 + Facing.offsetsZForSide[var11], Block.silverfish.blockID, BlockSilverfish.getMetadataForBlockType(var5), 3); + this.spawnExplosionParticle(); + this.setDead(); + } + else + { + this.updateWanderPath(); + } + } + else if (this.entityToAttack != null && !this.hasPath()) + { + this.entityToAttack = null; + } + } + } + + /** + * Takes a coordinate in and returns a weight to determine how likely this creature will try to path to the block. + * Args: x, y, z + */ + public float getBlockPathWeight(int par1, int par2, int par3) + { + return this.worldObj.getBlockId(par1, par2 - 1, par3) == Block.stone.blockID ? 10.0F : super.getBlockPathWeight(par1, par2, par3); + } + + /** + * Checks to make sure the light is not too bright where the mob is spawning + */ + protected boolean isValidLightLevel() + { + return true; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + if (super.getCanSpawnHere()) + { + EntityPlayer var1 = this.worldObj.getClosestPlayerToEntity(this, 5.0D); + return var1 == null; + } + else + { + return false; + } + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.ARTHROPOD; + } +} diff --git a/src/main/java/net/minecraft/src/EntitySkeleton.java b/src/main/java/net/minecraft/src/EntitySkeleton.java new file mode 100644 index 0000000..0a53ef1 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySkeleton.java @@ -0,0 +1,399 @@ +package net.minecraft.src; + +import java.util.Calendar; + +public class EntitySkeleton extends EntityMob implements IRangedAttackMob +{ + private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F); + private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false); + + public EntitySkeleton(World par1World) + { + super(par1World); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIRestrictSun(this)); + this.tasks.addTask(3, new EntityAIFleeSun(this, 1.0D)); + this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(6, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); + + if (par1World != null && !par1World.isRemote) + { + this.setCombatTask(); + } + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.25D); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(13, new Byte((byte)0)); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return true; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.skeleton.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.skeleton.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.skeleton.death"; + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + this.playSound("mob.skeleton.step", 0.15F, 1.0F); + } + + public boolean attackEntityAsMob(Entity par1Entity) + { + if (super.attackEntityAsMob(par1Entity)) + { + if (this.getSkeletonType() == 1 && par1Entity instanceof EntityLivingBase) + { + ((EntityLivingBase)par1Entity).addPotionEffect(new PotionEffect(Potion.wither.id, 200)); + } + + return true; + } + else + { + return false; + } + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.UNDEAD; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.worldObj.isDaytime() && !this.worldObj.isRemote) + { + float var1 = this.getBrightness(1.0F); + + if (var1 > 0.5F && this.rand.nextFloat() * 30.0F < (var1 - 0.4F) * 2.0F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))) + { + boolean var2 = true; + ItemStack var3 = this.getCurrentItemOrArmor(4); + + if (var3 != null) + { + if (var3.isItemStackDamageable()) + { + var3.setItemDamage(var3.getItemDamageForDisplay() + this.rand.nextInt(2)); + + if (var3.getItemDamageForDisplay() >= var3.getMaxDamage()) + { + this.renderBrokenItemStack(var3); + this.setCurrentItemOrArmor(4, (ItemStack)null); + } + } + + var2 = false; + } + + if (var2) + { + this.setFire(8); + } + } + } + + if (this.worldObj.isRemote && this.getSkeletonType() == 1) + { + this.setSize(0.72F, 2.34F); + } + + super.onLivingUpdate(); + } + + /** + * Handles updating while being ridden by an entity + */ + public void updateRidden() + { + super.updateRidden(); + + if (this.ridingEntity instanceof EntityCreature) + { + EntityCreature var1 = (EntityCreature)this.ridingEntity; + this.renderYawOffset = var1.renderYawOffset; + } + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource par1DamageSource) + { + super.onDeath(par1DamageSource); + + if (par1DamageSource.getSourceOfDamage() instanceof EntityArrow && par1DamageSource.getEntity() instanceof EntityPlayer) + { + EntityPlayer var2 = (EntityPlayer)par1DamageSource.getEntity(); + double var3 = var2.posX - this.posX; + double var5 = var2.posZ - this.posZ; + + if (var3 * var3 + var5 * var5 >= 2500.0D) + { + var2.triggerAchievement(AchievementList.snipeSkeleton); + } + } + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.arrow.itemID; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3; + int var4; + + if (this.getSkeletonType() == 1) + { + var3 = this.rand.nextInt(3 + par2) - 1; + + for (var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Item.coal.itemID, 1); + } + } + else + { + var3 = this.rand.nextInt(3 + par2); + + for (var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Item.arrow.itemID, 1); + } + } + + var3 = this.rand.nextInt(3 + par2); + + for (var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Item.bone.itemID, 1); + } + } + + protected void dropRareDrop(int par1) + { + if (this.getSkeletonType() == 1) + { + this.entityDropItem(new ItemStack(Item.skull.itemID, 1, 1), 0.0F); + } + } + + /** + * Makes entity wear random armor based on difficulty + */ + protected void addRandomArmor() + { + super.addRandomArmor(); + this.setCurrentItemOrArmor(0, new ItemStack(Item.bow)); + } + + public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData) + { + par1EntityLivingData = super.onSpawnWithEgg(par1EntityLivingData); + + if (this.worldObj.provider instanceof WorldProviderHell && this.getRNG().nextInt(5) > 0) + { + this.tasks.addTask(4, this.aiAttackOnCollide); + this.setSkeletonType(1); + this.setCurrentItemOrArmor(0, new ItemStack(Item.swordStone)); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(4.0D); + } + else + { + this.tasks.addTask(4, this.aiArrowAttack); + this.addRandomArmor(); + this.enchantEquipment(); + } + + this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * this.worldObj.getLocationTensionFactor(this.posX, this.posY, this.posZ)); + + if (this.getCurrentItemOrArmor(4) == null) + { + Calendar var2 = this.worldObj.getCurrentDate(); + + if (var2.get(2) + 1 == 10 && var2.get(5) == 31 && this.rand.nextFloat() < 0.25F) + { + this.setCurrentItemOrArmor(4, new ItemStack(this.rand.nextFloat() < 0.1F ? Block.pumpkinLantern : Block.pumpkin)); + this.equipmentDropChances[4] = 0.0F; + } + } + + return par1EntityLivingData; + } + + /** + * sets this entity's combat AI. + */ + public void setCombatTask() + { + this.tasks.removeTask(this.aiAttackOnCollide); + this.tasks.removeTask(this.aiArrowAttack); + ItemStack var1 = this.getHeldItem(); + + if (var1 != null && var1.itemID == Item.bow.itemID) + { + this.tasks.addTask(4, this.aiArrowAttack); + } + else + { + this.tasks.addTask(4, this.aiAttackOnCollide); + } + } + + /** + * Attack the specified entity using a ranged attack. + */ + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) + { + EntityArrow var3 = new EntityArrow(this.worldObj, this, par1EntityLivingBase, 1.6F, (float)(14 - this.worldObj.difficultySetting * 4)); + int var4 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem()); + int var5 = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem()); + var3.setDamage((double)(par2 * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.difficultySetting * 0.11F)); + + if (var4 > 0) + { + var3.setDamage(var3.getDamage() + (double)var4 * 0.5D + 0.5D); + } + + if (var5 > 0) + { + var3.setKnockbackStrength(var5); + } + + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0 || this.getSkeletonType() == 1) + { + var3.setFire(100); + } + + this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); + this.worldObj.spawnEntityInWorld(var3); + } + + /** + * Return this skeleton's type. + */ + public int getSkeletonType() + { + return this.dataWatcher.getWatchableObjectByte(13); + } + + /** + * Set this skeleton's type. + */ + public void setSkeletonType(int par1) + { + this.dataWatcher.updateObject(13, Byte.valueOf((byte)par1)); + this.isImmuneToFire = par1 == 1; + + if (par1 == 1) + { + this.setSize(0.72F, 2.34F); + } + else + { + this.setSize(0.6F, 1.8F); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + + if (par1NBTTagCompound.hasKey("SkeletonType")) + { + byte var2 = par1NBTTagCompound.getByte("SkeletonType"); + this.setSkeletonType(var2); + } + + this.setCombatTask(); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setByte("SkeletonType", (byte)this.getSkeletonType()); + } + + /** + * Sets the held item, or an armor slot. Slot 0 is held item. Slot 1-4 is armor. Params: Item, slot + */ + public void setCurrentItemOrArmor(int par1, ItemStack par2ItemStack) + { + super.setCurrentItemOrArmor(par1, par2ItemStack); + + if (!this.worldObj.isRemote && par1 == 0) + { + this.setCombatTask(); + } + } + + /** + * Returns the Y Offset of this entity. + */ + public double getYOffset() + { + return super.getYOffset() - 0.5D; + } +} diff --git a/src/main/java/net/minecraft/src/EntitySlime.java b/src/main/java/net/minecraft/src/EntitySlime.java new file mode 100644 index 0000000..99e8d65 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySlime.java @@ -0,0 +1,332 @@ +package net.minecraft.src; + +public class EntitySlime extends EntityLiving implements IMob +{ + public float squishAmount; + public float squishFactor; + public float prevSquishFactor; + + /** the time between each jump of the slime */ + private int slimeJumpDelay; + + public EntitySlime(World par1World) + { + super(par1World); + int var2 = 1 << this.rand.nextInt(3); + this.yOffset = 0.0F; + this.slimeJumpDelay = this.rand.nextInt(20) + 10; + this.setSlimeSize(var2); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)1)); + } + + protected void setSlimeSize(int par1) + { + this.dataWatcher.updateObject(16, new Byte((byte)par1)); + this.setSize(0.6F * (float)par1, 0.6F * (float)par1); + this.setPosition(this.posX, this.posY, this.posZ); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute((double)(par1 * par1)); + this.setHealth(this.getMaxHealth()); + this.experienceValue = par1; + } + + /** + * Returns the size of the slime. + */ + public int getSlimeSize() + { + return this.dataWatcher.getWatchableObjectByte(16); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("Size", this.getSlimeSize() - 1); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.setSlimeSize(par1NBTTagCompound.getInteger("Size") + 1); + } + + /** + * Returns the name of a particle effect that may be randomly created by EntitySlime.onUpdate() + */ + protected String getSlimeParticle() + { + return "slime"; + } + + /** + * Returns the name of the sound played when the slime jumps. + */ + protected String getJumpSound() + { + return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small"); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (!this.worldObj.isRemote && this.worldObj.difficultySetting == 0 && this.getSlimeSize() > 0) + { + this.isDead = true; + } + + this.squishFactor += (this.squishAmount - this.squishFactor) * 0.5F; + this.prevSquishFactor = this.squishFactor; + boolean var1 = this.onGround; + super.onUpdate(); + int var2; + + if (this.onGround && !var1) + { + var2 = this.getSlimeSize(); + + for (int var3 = 0; var3 < var2 * 8; ++var3) + { + float var4 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float var5 = this.rand.nextFloat() * 0.5F + 0.5F; + float var6 = MathHelper.sin(var4) * (float)var2 * 0.5F * var5; + float var7 = MathHelper.cos(var4) * (float)var2 * 0.5F * var5; + this.worldObj.spawnParticle(this.getSlimeParticle(), this.posX + (double)var6, this.boundingBox.minY, this.posZ + (double)var7, 0.0D, 0.0D, 0.0D); + } + + if (this.makesSoundOnLand()) + { + this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F); + } + + this.squishAmount = -0.5F; + } + else if (!this.onGround && var1) + { + this.squishAmount = 1.0F; + } + + this.alterSquishAmount(); + + if (this.worldObj.isRemote) + { + var2 = this.getSlimeSize(); + this.setSize(0.6F * (float)var2, 0.6F * (float)var2); + } + } + + protected void updateEntityActionState() + { + this.despawnEntity(); + EntityPlayer var1 = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D); + + if (var1 != null) + { + this.faceEntity(var1, 10.0F, 20.0F); + } + + if (this.onGround && this.slimeJumpDelay-- <= 0) + { + this.slimeJumpDelay = this.getJumpDelay(); + + if (var1 != null) + { + this.slimeJumpDelay /= 3; + } + + this.isJumping = true; + + if (this.makesSoundOnJump()) + { + this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) * 0.8F); + } + + this.moveStrafing = 1.0F - this.rand.nextFloat() * 2.0F; + this.moveForward = (float)(1 * this.getSlimeSize()); + } + else + { + this.isJumping = false; + + if (this.onGround) + { + this.moveStrafing = this.moveForward = 0.0F; + } + } + } + + protected void alterSquishAmount() + { + this.squishAmount *= 0.6F; + } + + /** + * Gets the amount of time the slime needs to wait between jumps. + */ + protected int getJumpDelay() + { + return this.rand.nextInt(20) + 10; + } + + protected EntitySlime createInstance() + { + return new EntitySlime(this.worldObj); + } + + /** + * Will get destroyed next tick. + */ + public void setDead() + { + int var1 = this.getSlimeSize(); + + if (!this.worldObj.isRemote && var1 > 1 && this.getHealth() <= 0.0F) + { + int var2 = 2 + this.rand.nextInt(3); + + for (int var3 = 0; var3 < var2; ++var3) + { + float var4 = ((float)(var3 % 2) - 0.5F) * (float)var1 / 4.0F; + float var5 = ((float)(var3 / 2) - 0.5F) * (float)var1 / 4.0F; + EntitySlime var6 = this.createInstance(); + var6.setSlimeSize(var1 / 2); + var6.setLocationAndAngles(this.posX + (double)var4, this.posY + 0.5D, this.posZ + (double)var5, this.rand.nextFloat() * 360.0F, 0.0F); + this.worldObj.spawnEntityInWorld(var6); + } + } + + super.setDead(); + } + + /** + * Called by a player entity when they collide with an entity + */ + public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) + { + if (this.canDamagePlayer()) + { + int var2 = this.getSlimeSize(); + + if (this.canEntityBeSeen(par1EntityPlayer) && this.getDistanceSqToEntity(par1EntityPlayer) < 0.6D * (double)var2 * 0.6D * (double)var2 && par1EntityPlayer.attackEntityFrom(DamageSource.causeMobDamage(this), (float)this.getAttackStrength())) + { + this.playSound("mob.attack", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + } + } + + /** + * Indicates weather the slime is able to damage the player (based upon the slime's size) + */ + protected boolean canDamagePlayer() + { + return this.getSlimeSize() > 1; + } + + /** + * Gets the amount of damage dealt to the player when "attacked" by the slime. + */ + protected int getAttackStrength() + { + return this.getSlimeSize(); + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small"); + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small"); + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return this.getSlimeSize() == 1 ? Item.slimeBall.itemID : 0; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + Chunk var1 = this.worldObj.getChunkFromBlockCoords(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posZ)); + + if (this.worldObj.getWorldInfo().getTerrainType() == WorldType.FLAT && this.rand.nextInt(4) != 1) + { + return false; + } + else + { + if (this.getSlimeSize() == 1 || this.worldObj.difficultySetting > 0) + { + BiomeGenBase var2 = this.worldObj.getBiomeGenForCoords(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posZ)); + + if (var2 == BiomeGenBase.swampland && this.posY > 50.0D && this.posY < 70.0D && this.rand.nextFloat() < 0.5F && this.rand.nextFloat() < this.worldObj.getCurrentMoonPhaseFactor() && this.worldObj.getBlockLightValue(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) <= this.rand.nextInt(8)) + { + return super.getCanSpawnHere(); + } + + if (this.rand.nextInt(10) == 0 && var1.getRandomWithSeed(987234911L).nextInt(10) == 0 && this.posY < 40.0D) + { + return super.getCanSpawnHere(); + } + } + + return false; + } + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.4F * (float)this.getSlimeSize(); + } + + /** + * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently + * use in wolves. + */ + public int getVerticalFaceSpeed() + { + return 0; + } + + /** + * Returns true if the slime makes a sound when it jumps (based upon the slime's size) + */ + protected boolean makesSoundOnJump() + { + return this.getSlimeSize() > 0; + } + + /** + * Returns true if the slime makes a sound when it lands after a jump (based upon the slime's size) + */ + protected boolean makesSoundOnLand() + { + return this.getSlimeSize() > 2; + } +} diff --git a/src/main/java/net/minecraft/src/EntitySmallFireball.java b/src/main/java/net/minecraft/src/EntitySmallFireball.java new file mode 100644 index 0000000..972e8f0 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySmallFireball.java @@ -0,0 +1,94 @@ +package net.minecraft.src; + +public class EntitySmallFireball extends EntityFireball +{ + public EntitySmallFireball(World par1World) + { + super(par1World); + this.setSize(0.3125F, 0.3125F); + } + + public EntitySmallFireball(World par1World, EntityLivingBase par2EntityLivingBase, double par3, double par5, double par7) + { + super(par1World, par2EntityLivingBase, par3, par5, par7); + this.setSize(0.3125F, 0.3125F); + } + + public EntitySmallFireball(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, par8, par10, par12); + this.setSize(0.3125F, 0.3125F); + } + + /** + * Called when this EntityFireball hits a block or entity. + */ + protected void onImpact(MovingObjectPosition par1MovingObjectPosition) + { + if (!this.worldObj.isRemote) + { + if (par1MovingObjectPosition.entityHit != null) + { + if (!par1MovingObjectPosition.entityHit.isImmuneToFire() && par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 5.0F)) + { + par1MovingObjectPosition.entityHit.setFire(5); + } + } + else + { + int var2 = par1MovingObjectPosition.blockX; + int var3 = par1MovingObjectPosition.blockY; + int var4 = par1MovingObjectPosition.blockZ; + + switch (par1MovingObjectPosition.sideHit) + { + case 0: + --var3; + break; + + case 1: + ++var3; + break; + + case 2: + --var4; + break; + + case 3: + ++var4; + break; + + case 4: + --var2; + break; + + case 5: + ++var2; + } + + if (this.worldObj.isAirBlock(var2, var3, var4)) + { + this.worldObj.setBlock(var2, var3, var4, Block.fire.blockID); + } + } + + this.setDead(); + } + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return false; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/EntitySmokeFX.java b/src/main/java/net/minecraft/src/EntitySmokeFX.java new file mode 100644 index 0000000..ff0921a --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySmokeFX.java @@ -0,0 +1,82 @@ +package net.minecraft.src; + +public class EntitySmokeFX extends EntityFX +{ + float smokeParticleScale; + + public EntitySmokeFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + this(par1World, par2, par4, par6, par8, par10, par12, 1.0F); + } + + public EntitySmokeFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14) + { + super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += par8; + this.motionY += par10; + this.motionZ += par12; + this.particleRed = this.particleGreen = this.particleBlue = (float)(Math.random() * 0.30000001192092896D); + this.particleScale *= 0.75F; + this.particleScale *= par14; + this.smokeParticleScale = this.particleScale; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * par14); + this.noClip = false; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F; + + if (var8 < 0.0F) + { + var8 = 0.0F; + } + + if (var8 > 1.0F) + { + var8 = 1.0F; + } + + this.particleScale = this.smokeParticleScale * var8; + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.motionY += 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntitySnowShovelFX.java b/src/main/java/net/minecraft/src/EntitySnowShovelFX.java new file mode 100644 index 0000000..0882478 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySnowShovelFX.java @@ -0,0 +1,75 @@ +package net.minecraft.src; + +public class EntitySnowShovelFX extends EntityFX +{ + float snowDigParticleScale; + + public EntitySnowShovelFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + this(par1World, par2, par4, par6, par8, par10, par12, 1.0F); + } + + public EntitySnowShovelFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14) + { + super(par1World, par2, par4, par6, par8, par10, par12); + this.motionX *= 0.10000000149011612D; + this.motionY *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + this.motionX += par8; + this.motionY += par10; + this.motionZ += par12; + this.particleRed = this.particleGreen = this.particleBlue = 1.0F - (float)(Math.random() * 0.30000001192092896D); + this.particleScale *= 0.75F; + this.particleScale *= par14; + this.snowDigParticleScale = this.particleScale; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.particleMaxAge = (int)((float)this.particleMaxAge * par14); + this.noClip = false; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F; + + if (var8 < 0.0F) + { + var8 = 0.0F; + } + + if (var8 > 1.0F) + { + var8 = 1.0F; + } + + this.particleScale = this.snowDigParticleScale * var8; + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); + this.motionY -= 0.03D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9900000095367432D; + this.motionY *= 0.9900000095367432D; + this.motionZ *= 0.9900000095367432D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntitySnowball.java b/src/main/java/net/minecraft/src/EntitySnowball.java new file mode 100644 index 0000000..eb817c1 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySnowball.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +public class EntitySnowball extends EntityThrowable +{ + public EntitySnowball(World par1World) + { + super(par1World); + } + + public EntitySnowball(World par1World, EntityLivingBase par2EntityLivingBase) + { + super(par1World, par2EntityLivingBase); + } + + public EntitySnowball(World par1World, double par2, double par4, double par6) + { + super(par1World, par2, par4, par6); + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected void onImpact(MovingObjectPosition par1MovingObjectPosition) + { + if (par1MovingObjectPosition.entityHit != null) + { + byte var2 = 0; + + if (par1MovingObjectPosition.entityHit instanceof EntityBlaze) + { + var2 = 3; + } + + par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)var2); + } + + for (int var3 = 0; var3 < 8; ++var3) + { + this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); + } + + if (!this.worldObj.isRemote) + { + this.setDead(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntitySnowman.java b/src/main/java/net/minecraft/src/EntitySnowman.java new file mode 100644 index 0000000..6affa06 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySnowman.java @@ -0,0 +1,102 @@ +package net.minecraft.src; + +public class EntitySnowman extends EntityGolem implements IRangedAttackMob +{ + public EntitySnowman(World par1World) + { + super(par1World); + this.setSize(0.4F, 1.8F); + this.getNavigator().setAvoidsWater(true); + this.tasks.addTask(1, new EntityAIArrowAttack(this, 1.25D, 20, 10.0F)); + this.tasks.addTask(2, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(4, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, true, false, IMob.mobSelector)); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return true; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(4.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.20000000298023224D); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (this.isWet()) + { + this.attackEntityFrom(DamageSource.drown, 1.0F); + } + + int var1 = MathHelper.floor_double(this.posX); + int var2 = MathHelper.floor_double(this.posZ); + + if (this.worldObj.getBiomeGenForCoords(var1, var2).getFloatTemperature() > 1.0F) + { + this.attackEntityFrom(DamageSource.onFire, 1.0F); + } + + for (var1 = 0; var1 < 4; ++var1) + { + var2 = MathHelper.floor_double(this.posX + (double)((float)(var1 % 2 * 2 - 1) * 0.25F)); + int var3 = MathHelper.floor_double(this.posY); + int var4 = MathHelper.floor_double(this.posZ + (double)((float)(var1 / 2 % 2 * 2 - 1) * 0.25F)); + + if (this.worldObj.getBlockId(var2, var3, var4) == 0 && this.worldObj.getBiomeGenForCoords(var2, var4).getFloatTemperature() < 0.8F && Block.snow.canPlaceBlockAt(this.worldObj, var2, var3, var4)) + { + this.worldObj.setBlock(var2, var3, var4, Block.snow.blockID); + } + } + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.snowball.itemID; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.rand.nextInt(16); + + for (int var4 = 0; var4 < var3; ++var4) + { + this.dropItem(Item.snowball.itemID, 1); + } + } + + /** + * Attack the specified entity using a ranged attack. + */ + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) + { + EntitySnowball var3 = new EntitySnowball(this.worldObj, this); + double var4 = par1EntityLivingBase.posX - this.posX; + double var6 = par1EntityLivingBase.posY + (double)par1EntityLivingBase.getEyeHeight() - 1.100000023841858D - var3.posY; + double var8 = par1EntityLivingBase.posZ - this.posZ; + float var10 = MathHelper.sqrt_double(var4 * var4 + var8 * var8) * 0.2F; + var3.setThrowableHeading(var4, var6 + (double)var10, var8, 1.6F, 12.0F); + this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); + this.worldObj.spawnEntityInWorld(var3); + } +} diff --git a/src/main/java/net/minecraft/src/EntitySorter.java b/src/main/java/net/minecraft/src/EntitySorter.java new file mode 100644 index 0000000..3696050 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySorter.java @@ -0,0 +1,41 @@ +package net.minecraft.src; + +import java.util.Comparator; + +public class EntitySorter implements Comparator +{ + /** Entity position X */ + private double entityPosX; + + /** Entity position Y */ + private double entityPosY; + + /** Entity position Z */ + private double entityPosZ; + + public EntitySorter(Entity par1Entity) + { + this.entityPosX = -par1Entity.posX; + this.entityPosY = -par1Entity.posY; + this.entityPosZ = -par1Entity.posZ; + } + + /** + * Sorts the two world renderers according to their distance to a given entity. + */ + public int sortByDistanceToEntity(WorldRenderer par1WorldRenderer, WorldRenderer par2WorldRenderer) + { + double var3 = (double)par1WorldRenderer.posXPlus + this.entityPosX; + double var5 = (double)par1WorldRenderer.posYPlus + this.entityPosY; + double var7 = (double)par1WorldRenderer.posZPlus + this.entityPosZ; + double var9 = (double)par2WorldRenderer.posXPlus + this.entityPosX; + double var11 = (double)par2WorldRenderer.posYPlus + this.entityPosY; + double var13 = (double)par2WorldRenderer.posZPlus + this.entityPosZ; + return (int)((var3 * var3 + var5 * var5 + var7 * var7 - (var9 * var9 + var11 * var11 + var13 * var13)) * 1024.0D); + } + + public int compare(Object par1Obj, Object par2Obj) + { + return this.sortByDistanceToEntity((WorldRenderer)par1Obj, (WorldRenderer)par2Obj); + } +} diff --git a/src/main/java/net/minecraft/src/EntitySpellParticleFX.java b/src/main/java/net/minecraft/src/EntitySpellParticleFX.java new file mode 100644 index 0000000..f6cb3f8 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySpellParticleFX.java @@ -0,0 +1,83 @@ +package net.minecraft.src; + +public class EntitySpellParticleFX extends EntityFX +{ + /** Base spell texture index */ + private int baseSpellTextureIndex = 128; + + public EntitySpellParticleFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, par8, par10, par12); + this.motionY *= 0.20000000298023224D; + + if (par8 == 0.0D && par12 == 0.0D) + { + this.motionX *= 0.10000000149011612D; + this.motionZ *= 0.10000000149011612D; + } + + this.particleScale *= 0.75F; + this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); + this.noClip = false; + } + + public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + { + float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F; + + if (var8 < 0.0F) + { + var8 = 0.0F; + } + + if (var8 > 1.0F) + { + var8 = 1.0F; + } + + super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) + { + this.setDead(); + } + + this.setParticleTextureIndex(this.baseSpellTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge)); + this.motionY += 0.004D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.posY == this.prevPosY) + { + this.motionX *= 1.1D; + this.motionZ *= 1.1D; + } + + this.motionX *= 0.9599999785423279D; + this.motionY *= 0.9599999785423279D; + this.motionZ *= 0.9599999785423279D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + } + } + + /** + * Sets the base spell texture index + */ + public void setBaseSpellTextureIndex(int par1) + { + this.baseSpellTextureIndex = par1; + } +} diff --git a/src/main/java/net/minecraft/src/EntitySpider.java b/src/main/java/net/minecraft/src/EntitySpider.java new file mode 100644 index 0000000..9456f0e --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySpider.java @@ -0,0 +1,232 @@ +package net.minecraft.src; + +public class EntitySpider extends EntityMob +{ + public EntitySpider(World par1World) + { + super(par1World); + this.setSize(1.4F, 0.9F); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, new Byte((byte)0)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (!this.worldObj.isRemote) + { + this.setBesideClimbableBlock(this.isCollidedHorizontally); + } + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(16.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.800000011920929D); + } + + /** + * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking + * (Animals, Spiders at day, peaceful PigZombies). + */ + protected Entity findPlayerToAttack() + { + float var1 = this.getBrightness(1.0F); + + if (var1 < 0.5F) + { + double var2 = 16.0D; + return this.worldObj.getClosestVulnerablePlayerToEntity(this, var2); + } + else + { + return null; + } + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.spider.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.spider.say"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.spider.death"; + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + this.playSound("mob.spider.step", 0.15F, 1.0F); + } + + /** + * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack. + */ + protected void attackEntity(Entity par1Entity, float par2) + { + float var3 = this.getBrightness(1.0F); + + if (var3 > 0.5F && this.rand.nextInt(100) == 0) + { + this.entityToAttack = null; + } + else + { + if (par2 > 2.0F && par2 < 6.0F && this.rand.nextInt(10) == 0) + { + if (this.onGround) + { + double var4 = par1Entity.posX - this.posX; + double var6 = par1Entity.posZ - this.posZ; + float var8 = MathHelper.sqrt_double(var4 * var4 + var6 * var6); + this.motionX = var4 / (double)var8 * 0.5D * 0.800000011920929D + this.motionX * 0.20000000298023224D; + this.motionZ = var6 / (double)var8 * 0.5D * 0.800000011920929D + this.motionZ * 0.20000000298023224D; + this.motionY = 0.4000000059604645D; + } + } + else + { + super.attackEntity(par1Entity, par2); + } + } + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.silk.itemID; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + super.dropFewItems(par1, par2); + + if (par1 && (this.rand.nextInt(3) == 0 || this.rand.nextInt(1 + par2) > 0)) + { + this.dropItem(Item.spiderEye.itemID, 1); + } + } + + /** + * returns true if this entity is by a ladder, false otherwise + */ + public boolean isOnLadder() + { + return this.isBesideClimbableBlock(); + } + + /** + * Sets the Entity inside a web block. + */ + public void setInWeb() {} + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.ARTHROPOD; + } + + public boolean isPotionApplicable(PotionEffect par1PotionEffect) + { + return par1PotionEffect.getPotionID() == Potion.poison.id ? false : super.isPotionApplicable(par1PotionEffect); + } + + /** + * Returns true if the WatchableObject (Byte) is 0x01 otherwise returns false. The WatchableObject is updated using + * setBesideClimableBlock. + */ + public boolean isBesideClimbableBlock() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + /** + * Updates the WatchableObject (Byte) created in entityInit(), setting it to 0x01 if par1 is true or 0x00 if it is + * false. + */ + public void setBesideClimbableBlock(boolean par1) + { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + + if (par1) + { + var2 = (byte)(var2 | 1); + } + else + { + var2 &= -2; + } + + this.dataWatcher.updateObject(16, Byte.valueOf(var2)); + } + + public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData) + { + Object par1EntityLivingData1 = super.onSpawnWithEgg(par1EntityLivingData); + + if (this.worldObj.rand.nextInt(100) == 0) + { + EntitySkeleton var2 = new EntitySkeleton(this.worldObj); + var2.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); + var2.onSpawnWithEgg((EntityLivingData)null); + this.worldObj.spawnEntityInWorld(var2); + var2.mountEntity(this); + } + + if (par1EntityLivingData1 == null) + { + par1EntityLivingData1 = new SpiderEffectsGroupData(); + + if (this.worldObj.difficultySetting > 2 && this.worldObj.rand.nextFloat() < 0.1F * this.worldObj.getLocationTensionFactor(this.posX, this.posY, this.posZ)) + { + ((SpiderEffectsGroupData)par1EntityLivingData1).func_111104_a(this.worldObj.rand); + } + } + + if (par1EntityLivingData1 instanceof SpiderEffectsGroupData) + { + int var4 = ((SpiderEffectsGroupData)par1EntityLivingData1).field_111105_a; + + if (var4 > 0 && Potion.potionTypes[var4] != null) + { + this.addPotionEffect(new PotionEffect(var4, Integer.MAX_VALUE)); + } + } + + return (EntityLivingData)par1EntityLivingData1; + } +} diff --git a/src/main/java/net/minecraft/src/EntitySplashFX.java b/src/main/java/net/minecraft/src/EntitySplashFX.java new file mode 100644 index 0000000..3fddb67 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySplashFX.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +public class EntitySplashFX extends EntityRainFX +{ + public EntitySplashFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6); + this.particleGravity = 0.04F; + this.nextTextureIndexX(); + + if (par10 == 0.0D && (par8 != 0.0D || par12 != 0.0D)) + { + this.motionX = par8; + this.motionY = par10 + 0.1D; + this.motionZ = par12; + } + } +} diff --git a/src/main/java/net/minecraft/src/EntitySquid.java b/src/main/java/net/minecraft/src/EntitySquid.java new file mode 100644 index 0000000..dfd9f59 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySquid.java @@ -0,0 +1,229 @@ +package net.minecraft.src; + +public class EntitySquid extends EntityWaterMob +{ + public float squidPitch; + public float prevSquidPitch; + public float squidYaw; + public float prevSquidYaw; + + /** + * appears to be rotation in radians; we already have pitch & yaw, so this completes the triumvirate. + */ + public float squidRotation; + + /** previous squidRotation in radians. */ + public float prevSquidRotation; + + /** angle of the tentacles in radians */ + public float tentacleAngle; + + /** the last calculated angle of the tentacles in radians */ + public float prevTentacleAngle; + private float randomMotionSpeed; + + /** change in squidRotation in radians. */ + private float rotationVelocity; + private float field_70871_bB; + private float randomMotionVecX; + private float randomMotionVecY; + private float randomMotionVecZ; + + public EntitySquid(World par1World) + { + super(par1World); + this.setSize(0.95F, 0.95F); + this.rotationVelocity = 1.0F / (this.rand.nextFloat() + 1.0F) * 0.2F; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(10.0D); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return null; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return null; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return null; + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.4F; + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return 0; + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.rand.nextInt(3 + par2) + 1; + + for (int var4 = 0; var4 < var3; ++var4) + { + this.entityDropItem(new ItemStack(Item.dyePowder, 1, 0), 0.0F); + } + } + + /** + * Checks if this entity is inside water (if inWater field is true as a result of handleWaterMovement() returning + * true) + */ + public boolean isInWater() + { + return this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, -0.6000000238418579D, 0.0D), Material.water, this); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + this.prevSquidPitch = this.squidPitch; + this.prevSquidYaw = this.squidYaw; + this.prevSquidRotation = this.squidRotation; + this.prevTentacleAngle = this.tentacleAngle; + this.squidRotation += this.rotationVelocity; + + if (this.squidRotation > ((float)Math.PI * 2F)) + { + this.squidRotation -= ((float)Math.PI * 2F); + + if (this.rand.nextInt(10) == 0) + { + this.rotationVelocity = 1.0F / (this.rand.nextFloat() + 1.0F) * 0.2F; + } + } + + if (this.isInWater()) + { + float var1; + + if (this.squidRotation < (float)Math.PI) + { + var1 = this.squidRotation / (float)Math.PI; + this.tentacleAngle = MathHelper.sin(var1 * var1 * (float)Math.PI) * (float)Math.PI * 0.25F; + + if ((double)var1 > 0.75D) + { + this.randomMotionSpeed = 1.0F; + this.field_70871_bB = 1.0F; + } + else + { + this.field_70871_bB *= 0.8F; + } + } + else + { + this.tentacleAngle = 0.0F; + this.randomMotionSpeed *= 0.9F; + this.field_70871_bB *= 0.99F; + } + + if (!this.worldObj.isRemote) + { + this.motionX = (double)(this.randomMotionVecX * this.randomMotionSpeed); + this.motionY = (double)(this.randomMotionVecY * this.randomMotionSpeed); + this.motionZ = (double)(this.randomMotionVecZ * this.randomMotionSpeed); + } + + var1 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.renderYawOffset += (-((float)Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI - this.renderYawOffset) * 0.1F; + this.rotationYaw = this.renderYawOffset; + this.squidYaw += (float)Math.PI * this.field_70871_bB * 1.5F; + this.squidPitch += (-((float)Math.atan2((double)var1, this.motionY)) * 180.0F / (float)Math.PI - this.squidPitch) * 0.1F; + } + else + { + this.tentacleAngle = MathHelper.abs(MathHelper.sin(this.squidRotation)) * (float)Math.PI * 0.25F; + + if (!this.worldObj.isRemote) + { + this.motionX = 0.0D; + this.motionY -= 0.08D; + this.motionY *= 0.9800000190734863D; + this.motionZ = 0.0D; + } + + this.squidPitch = (float)((double)this.squidPitch + (double)(-90.0F - this.squidPitch) * 0.02D); + } + } + + /** + * Moves the entity based on the specified heading. Args: strafe, forward + */ + public void moveEntityWithHeading(float par1, float par2) + { + this.moveEntity(this.motionX, this.motionY, this.motionZ); + } + + protected void updateEntityActionState() + { + ++this.entityAge; + + if (this.entityAge > 100) + { + this.randomMotionVecX = this.randomMotionVecY = this.randomMotionVecZ = 0.0F; + } + else if (this.rand.nextInt(50) == 0 || !this.inWater || this.randomMotionVecX == 0.0F && this.randomMotionVecY == 0.0F && this.randomMotionVecZ == 0.0F) + { + float var1 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + this.randomMotionVecX = MathHelper.cos(var1) * 0.2F; + this.randomMotionVecY = -0.1F + this.rand.nextFloat() * 0.2F; + this.randomMotionVecZ = MathHelper.sin(var1) * 0.2F; + } + + this.despawnEntity(); + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.posY > 45.0D && this.posY < 63.0D && super.getCanSpawnHere(); + } +} diff --git a/src/main/java/net/minecraft/src/EntitySuspendFX.java b/src/main/java/net/minecraft/src/EntitySuspendFX.java new file mode 100644 index 0000000..912235d --- /dev/null +++ b/src/main/java/net/minecraft/src/EntitySuspendFX.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +public class EntitySuspendFX extends EntityFX +{ + public EntitySuspendFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4 - 0.125D, par6, par8, par10, par12); + this.particleRed = 0.4F; + this.particleGreen = 0.4F; + this.particleBlue = 0.7F; + this.setParticleTextureIndex(0); + this.setSize(0.01F, 0.01F); + this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F; + this.motionX = par8 * 0.0D; + this.motionY = par10 * 0.0D; + this.motionZ = par12 * 0.0D; + this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D)); + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + if (this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) != Material.water) + { + this.setDead(); + } + + if (this.particleMaxAge-- <= 0) + { + this.setDead(); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityTNTPrimed.java b/src/main/java/net/minecraft/src/EntityTNTPrimed.java new file mode 100644 index 0000000..aaaaa91 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityTNTPrimed.java @@ -0,0 +1,121 @@ +package net.minecraft.src; + +public class EntityTNTPrimed extends Entity +{ + /** How long the fuse is */ + public int fuse; + private EntityLivingBase tntPlacedBy; + + public EntityTNTPrimed(World par1World) + { + super(par1World); + this.preventEntitySpawning = true; + this.setSize(0.98F, 0.98F); + this.yOffset = this.height / 2.0F; + } + + public EntityTNTPrimed(World par1World, double par2, double par4, double par6, EntityLivingBase par8EntityLivingBase) + { + this(par1World); + this.setPosition(par2, par4, par6); + float var9 = (float)(Math.random() * Math.PI * 2.0D); + this.motionX = (double)(-((float)Math.sin((double)var9)) * 0.02F); + this.motionY = 0.20000000298023224D; + this.motionZ = (double)(-((float)Math.cos((double)var9)) * 0.02F); + this.fuse = 80; + this.prevPosX = par2; + this.prevPosY = par4; + this.prevPosZ = par6; + this.tntPlacedBy = par8EntityLivingBase; + } + + protected void entityInit() {} + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return !this.isDead; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= 0.03999999910593033D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= 0.9800000190734863D; + this.motionY *= 0.9800000190734863D; + this.motionZ *= 0.9800000190734863D; + + if (this.onGround) + { + this.motionX *= 0.699999988079071D; + this.motionZ *= 0.699999988079071D; + this.motionY *= -0.5D; + } + + if (this.fuse-- <= 0) + { + this.setDead(); + + if (!this.worldObj.isRemote) + { + this.explode(); + } + } + else + { + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + } + } + + private void explode() + { + float var1 = 4.0F; + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, var1, true); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setByte("Fuse", (byte)this.fuse); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.fuse = par1NBTTagCompound.getByte("Fuse"); + } + + public float getShadowSize() + { + return 0.0F; + } + + /** + * returns null or the entityliving it was placed or ignited by + */ + public EntityLivingBase getTntPlacedBy() + { + return this.tntPlacedBy; + } +} diff --git a/src/main/java/net/minecraft/src/EntityTameable.java b/src/main/java/net/minecraft/src/EntityTameable.java new file mode 100644 index 0000000..d29a4c7 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityTameable.java @@ -0,0 +1,195 @@ +package net.minecraft.src; + +public abstract class EntityTameable extends EntityAnimal implements EntityOwnable +{ + protected EntityAISit aiSit = new EntityAISit(this); + + public EntityTameable(World par1World) + { + super(par1World); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Byte.valueOf((byte)0)); + this.dataWatcher.addObject(17, ""); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + + if (this.getOwnerName() == null) + { + par1NBTTagCompound.setString("Owner", ""); + } + else + { + par1NBTTagCompound.setString("Owner", this.getOwnerName()); + } + + par1NBTTagCompound.setBoolean("Sitting", this.isSitting()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + String var2 = par1NBTTagCompound.getString("Owner"); + + if (var2.length() > 0) + { + this.setOwner(var2); + this.setTamed(true); + } + + this.aiSit.setSitting(par1NBTTagCompound.getBoolean("Sitting")); + this.setSitting(par1NBTTagCompound.getBoolean("Sitting")); + } + + /** + * Play the taming effect, will either be hearts or smoke depending on status + */ + protected void playTameEffect(boolean par1) + { + String var2 = "heart"; + + if (!par1) + { + var2 = "smoke"; + } + + for (int var3 = 0; var3 < 7; ++var3) + { + double var4 = this.rand.nextGaussian() * 0.02D; + double var6 = this.rand.nextGaussian() * 0.02D; + double var8 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle(var2, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var4, var6, var8); + } + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 7) + { + this.playTameEffect(true); + } + else if (par1 == 6) + { + this.playTameEffect(false); + } + else + { + super.handleHealthUpdate(par1); + } + } + + public boolean isTamed() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 4) != 0; + } + + public void setTamed(boolean par1) + { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + + if (par1) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 4))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -5))); + } + } + + public boolean isSitting() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; + } + + public void setSitting(boolean par1) + { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + + if (par1) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 1))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -2))); + } + } + + public String getOwnerName() + { + return this.dataWatcher.getWatchableObjectString(17); + } + + public void setOwner(String par1Str) + { + this.dataWatcher.updateObject(17, par1Str); + } + + public EntityLivingBase func_130012_q() + { + return this.worldObj.getPlayerEntityByName(this.getOwnerName()); + } + + public EntityAISit func_70907_r() + { + return this.aiSit; + } + + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) + { + return true; + } + + public Team getTeam() + { + if (this.isTamed()) + { + EntityLivingBase var1 = this.func_130012_q(); + + if (var1 != null) + { + return var1.getTeam(); + } + } + + return super.getTeam(); + } + + public boolean isOnSameTeam(EntityLivingBase par1EntityLivingBase) + { + if (this.isTamed()) + { + EntityLivingBase var2 = this.func_130012_q(); + + if (par1EntityLivingBase == var2) + { + return true; + } + + if (var2 != null) + { + return var2.isOnSameTeam(par1EntityLivingBase); + } + } + + return super.isOnSameTeam(par1EntityLivingBase); + } + + public Entity getOwner() + { + return this.func_130012_q(); + } +} diff --git a/src/main/java/net/minecraft/src/EntityThrowable.java b/src/main/java/net/minecraft/src/EntityThrowable.java new file mode 100644 index 0000000..9554e89 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityThrowable.java @@ -0,0 +1,336 @@ +package net.minecraft.src; + +import java.util.List; + +public abstract class EntityThrowable extends Entity implements IProjectile +{ + private int xTile = -1; + private int yTile = -1; + private int zTile = -1; + private int inTile; + protected boolean inGround; + public int throwableShake; + + /** + * Is the entity that throws this 'thing' (snowball, ender pearl, eye of ender or potion) + */ + private EntityLivingBase thrower; + private String throwerName; + private int ticksInGround; + private int ticksInAir; + + public EntityThrowable(World par1World) + { + super(par1World); + this.setSize(0.25F, 0.25F); + } + + protected void entityInit() {} + + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist(double par1) + { + double var3 = this.boundingBox.getAverageEdgeLength() * 4.0D; + var3 *= 64.0D; + return par1 < var3 * var3; + } + + public EntityThrowable(World par1World, EntityLivingBase par2EntityLivingBase) + { + super(par1World); + this.thrower = par2EntityLivingBase; + this.setSize(0.25F, 0.25F); + this.setLocationAndAngles(par2EntityLivingBase.posX, par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight(), par2EntityLivingBase.posZ, par2EntityLivingBase.rotationYaw, par2EntityLivingBase.rotationPitch); + this.posX -= (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.posY -= 0.10000000149011612D; + this.posZ -= (double)(MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * 0.16F); + this.setPosition(this.posX, this.posY, this.posZ); + this.yOffset = 0.0F; + float var3 = 0.4F; + this.motionX = (double)(-MathHelper.sin(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.motionZ = (double)(MathHelper.cos(this.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float)Math.PI) * var3); + this.motionY = (double)(-MathHelper.sin((this.rotationPitch + this.func_70183_g()) / 180.0F * (float)Math.PI) * var3); + this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, this.func_70182_d(), 1.0F); + } + + public EntityThrowable(World par1World, double par2, double par4, double par6) + { + super(par1World); + this.ticksInGround = 0; + this.setSize(0.25F, 0.25F); + this.setPosition(par2, par4, par6); + this.yOffset = 0.0F; + } + + protected float func_70182_d() + { + return 1.5F; + } + + protected float func_70183_g() + { + return 0.0F; + } + + /** + * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction. + */ + public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) + { + float var9 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); + par1 /= (double)var9; + par3 /= (double)var9; + par5 /= (double)var9; + par1 += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; + par3 += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; + par5 += this.rand.nextGaussian() * 0.007499999832361937D * (double)par8; + par1 *= (double)par7; + par3 *= (double)par7; + par5 *= (double)par7; + this.motionX = par1; + this.motionY = par3; + this.motionZ = par5; + float var10 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)var10) * 180.0D / Math.PI); + this.ticksInGround = 0; + } + + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity(double par1, double par3, double par5) + { + this.motionX = par1; + this.motionY = par3; + this.motionZ = par5; + + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(par1, par5) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(par3, (double)var7) * 180.0D / Math.PI); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); + + if (this.throwableShake > 0) + { + --this.throwableShake; + } + + if (this.inGround) + { + int var1 = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + + if (var1 == this.inTile) + { + ++this.ticksInGround; + + if (this.ticksInGround == 1200) + { + this.setDead(); + } + + return; + } + + this.inGround = false; + this.motionX *= (double)(this.rand.nextFloat() * 0.2F); + this.motionY *= (double)(this.rand.nextFloat() * 0.2F); + this.motionZ *= (double)(this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; + } + else + { + ++this.ticksInAir; + } + + Vec3 var16 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); + Vec3 var2 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + MovingObjectPosition var3 = this.worldObj.clip(var16, var2); + var16 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX, this.posY, this.posZ); + var2 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (var3 != null) + { + var2 = this.worldObj.getWorldVec3Pool().getVecFromPool(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord); + } + + if (!this.worldObj.isRemote) + { + Entity var4 = null; + List var5 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + double var6 = 0.0D; + EntityLivingBase var8 = this.getThrower(); + + for (int var9 = 0; var9 < var5.size(); ++var9) + { + Entity var10 = (Entity)var5.get(var9); + + if (var10.canBeCollidedWith() && (var10 != var8 || this.ticksInAir >= 5)) + { + float var11 = 0.3F; + AxisAlignedBB var12 = var10.boundingBox.expand((double)var11, (double)var11, (double)var11); + MovingObjectPosition var13 = var12.calculateIntercept(var16, var2); + + if (var13 != null) + { + double var14 = var16.distanceTo(var13.hitVec); + + if (var14 < var6 || var6 == 0.0D) + { + var4 = var10; + var6 = var14; + } + } + } + } + + if (var4 != null) + { + var3 = new MovingObjectPosition(var4); + } + } + + if (var3 != null) + { + if (var3.typeOfHit == EnumMovingObjectType.TILE && this.worldObj.getBlockId(var3.blockX, var3.blockY, var3.blockZ) == Block.portal.blockID) + { + this.setInPortal(); + } + else + { + this.onImpact(var3); + } + } + + this.posX += this.motionX; + this.posY += this.motionY; + this.posZ += this.motionZ; + float var17 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float)(Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + + for (this.rotationPitch = (float)(Math.atan2(this.motionY, (double)var17) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } + + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } + + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } + + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + float var18 = 0.99F; + float var19 = this.getGravityVelocity(); + + if (this.isInWater()) + { + for (int var7 = 0; var7 < 4; ++var7) + { + float var20 = 0.25F; + this.worldObj.spawnParticle("bubble", this.posX - this.motionX * (double)var20, this.posY - this.motionY * (double)var20, this.posZ - this.motionZ * (double)var20, this.motionX, this.motionY, this.motionZ); + } + + var18 = 0.8F; + } + + this.motionX *= (double)var18; + this.motionY *= (double)var18; + this.motionZ *= (double)var18; + this.motionY -= (double)var19; + this.setPosition(this.posX, this.posY, this.posZ); + } + + /** + * Gets the amount of gravity to apply to the thrown entity with each tick. + */ + protected float getGravityVelocity() + { + return 0.03F; + } + + /** + * Called when this EntityThrowable hits a block or entity. + */ + protected abstract void onImpact(MovingObjectPosition var1); + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setShort("xTile", (short)this.xTile); + par1NBTTagCompound.setShort("yTile", (short)this.yTile); + par1NBTTagCompound.setShort("zTile", (short)this.zTile); + par1NBTTagCompound.setByte("inTile", (byte)this.inTile); + par1NBTTagCompound.setByte("shake", (byte)this.throwableShake); + par1NBTTagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0)); + + if ((this.throwerName == null || this.throwerName.length() == 0) && this.thrower != null && this.thrower instanceof EntityPlayer) + { + this.throwerName = this.thrower.getEntityName(); + } + + par1NBTTagCompound.setString("ownerName", this.throwerName == null ? "" : this.throwerName); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.xTile = par1NBTTagCompound.getShort("xTile"); + this.yTile = par1NBTTagCompound.getShort("yTile"); + this.zTile = par1NBTTagCompound.getShort("zTile"); + this.inTile = par1NBTTagCompound.getByte("inTile") & 255; + this.throwableShake = par1NBTTagCompound.getByte("shake") & 255; + this.inGround = par1NBTTagCompound.getByte("inGround") == 1; + this.throwerName = par1NBTTagCompound.getString("ownerName"); + + if (this.throwerName != null && this.throwerName.length() == 0) + { + this.throwerName = null; + } + } + + public float getShadowSize() + { + return 0.0F; + } + + public EntityLivingBase getThrower() + { + if (this.thrower == null && this.throwerName != null && this.throwerName.length() > 0) + { + this.thrower = this.worldObj.getPlayerEntityByName(this.throwerName); + } + + return this.thrower; + } +} diff --git a/src/main/java/net/minecraft/src/EntityTracker.java b/src/main/java/net/minecraft/src/EntityTracker.java new file mode 100644 index 0000000..afdbab7 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityTracker.java @@ -0,0 +1,298 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +public class EntityTracker +{ + private final WorldServer theWorld; + + /** + * List of tracked entities, used for iteration operations on tracked entities. + */ + private Set trackedEntities = new HashSet(); + private IntHashMap trackedEntityIDs = new IntHashMap(); + private int entityViewDistance; + + public EntityTracker(WorldServer par1WorldServer) + { + this.theWorld = par1WorldServer; + this.entityViewDistance = par1WorldServer.getMinecraftServer().getConfigurationManager().getEntityViewDistance(); + } + + /** + * if entity is a player sends all tracked events to the player, otherwise, adds with a visibility and update arate + * based on the class type + */ + public void addEntityToTracker(Entity par1Entity) + { + if (par1Entity instanceof EntityPlayerMP) + { + this.addEntityToTracker(par1Entity, 512, 2); + EntityPlayerMP var2 = (EntityPlayerMP)par1Entity; + Iterator var3 = this.trackedEntities.iterator(); + + while (var3.hasNext()) + { + EntityTrackerEntry var4 = (EntityTrackerEntry)var3.next(); + + if (var4.myEntity != var2) + { + var4.tryStartWachingThis(var2); + } + } + } + else if (par1Entity instanceof EntityFishHook) + { + this.addEntityToTracker(par1Entity, 64, 5, true); + } + else if (par1Entity instanceof EntityArrow) + { + this.addEntityToTracker(par1Entity, 64, 20, false); + } + else if (par1Entity instanceof EntitySmallFireball) + { + this.addEntityToTracker(par1Entity, 64, 10, false); + } + else if (par1Entity instanceof EntityFireball) + { + this.addEntityToTracker(par1Entity, 64, 10, false); + } + else if (par1Entity instanceof EntitySnowball) + { + this.addEntityToTracker(par1Entity, 64, 10, true); + } + else if (par1Entity instanceof EntityEnderPearl) + { + this.addEntityToTracker(par1Entity, 64, 10, true); + } + else if (par1Entity instanceof EntityEnderEye) + { + this.addEntityToTracker(par1Entity, 64, 4, true); + } + else if (par1Entity instanceof EntityEgg) + { + this.addEntityToTracker(par1Entity, 64, 10, true); + } + else if (par1Entity instanceof EntityPotion) + { + this.addEntityToTracker(par1Entity, 64, 10, true); + } + else if (par1Entity instanceof EntityExpBottle) + { + this.addEntityToTracker(par1Entity, 64, 10, true); + } + else if (par1Entity instanceof EntityFireworkRocket) + { + this.addEntityToTracker(par1Entity, 64, 10, true); + } + else if (par1Entity instanceof EntityItem) + { + this.addEntityToTracker(par1Entity, 64, 20, true); + } + else if (par1Entity instanceof EntityMinecart) + { + this.addEntityToTracker(par1Entity, 80, 3, true); + } + else if (par1Entity instanceof EntityBoat) + { + this.addEntityToTracker(par1Entity, 80, 3, true); + } + else if (par1Entity instanceof EntitySquid) + { + this.addEntityToTracker(par1Entity, 64, 3, true); + } + else if (par1Entity instanceof EntityWither) + { + this.addEntityToTracker(par1Entity, 80, 3, false); + } + else if (par1Entity instanceof EntityBat) + { + this.addEntityToTracker(par1Entity, 80, 3, false); + } + else if (par1Entity instanceof IAnimals) + { + this.addEntityToTracker(par1Entity, 80, 3, true); + } + else if (par1Entity instanceof EntityDragon) + { + this.addEntityToTracker(par1Entity, 160, 3, true); + } + else if (par1Entity instanceof EntityTNTPrimed) + { + this.addEntityToTracker(par1Entity, 160, 10, true); + } + else if (par1Entity instanceof EntityFallingSand) + { + this.addEntityToTracker(par1Entity, 160, 20, true); + } + else if (par1Entity instanceof EntityHanging) + { + this.addEntityToTracker(par1Entity, 160, Integer.MAX_VALUE, false); + } + else if (par1Entity instanceof EntityXPOrb) + { + this.addEntityToTracker(par1Entity, 160, 20, true); + } + else if (par1Entity instanceof EntityEnderCrystal) + { + this.addEntityToTracker(par1Entity, 256, Integer.MAX_VALUE, false); + } + } + + public void addEntityToTracker(Entity par1Entity, int par2, int par3) + { + this.addEntityToTracker(par1Entity, par2, par3, false); + } + + public void addEntityToTracker(Entity par1Entity, int par2, int par3, boolean par4) + { + if (par2 > this.entityViewDistance) + { + par2 = this.entityViewDistance; + } + + try + { + if (this.trackedEntityIDs.containsItem(par1Entity.entityId)) + { + throw new IllegalStateException("Entity is already tracked!"); + } + + EntityTrackerEntry var5 = new EntityTrackerEntry(par1Entity, par2, par3, par4); + this.trackedEntities.add(var5); + this.trackedEntityIDs.addKey(par1Entity.entityId, var5); + var5.sendEventsToPlayers(this.theWorld.playerEntities); + } + catch (Throwable var11) + { + CrashReport var6 = CrashReport.makeCrashReport(var11, "Adding entity to track"); + CrashReportCategory var7 = var6.makeCategory("Entity To Track"); + var7.addCrashSection("Tracking range", par2 + " blocks"); + var7.addCrashSectionCallable("Update interval", new CallableEntityTracker(this, par3)); + par1Entity.addEntityCrashInfo(var7); + CrashReportCategory var8 = var6.makeCategory("Entity That Is Already Tracked"); + ((EntityTrackerEntry)this.trackedEntityIDs.lookup(par1Entity.entityId)).myEntity.addEntityCrashInfo(var8); + + try + { + throw new ReportedException(var6); + } + catch (ReportedException var10) + { + System.err.println("\"Silently\" catching entity tracking error."); + var10.printStackTrace(); + } + } + } + + public void removeEntityFromAllTrackingPlayers(Entity par1Entity) + { + if (par1Entity instanceof EntityPlayerMP) + { + EntityPlayerMP var2 = (EntityPlayerMP)par1Entity; + Iterator var3 = this.trackedEntities.iterator(); + + while (var3.hasNext()) + { + EntityTrackerEntry var4 = (EntityTrackerEntry)var3.next(); + var4.removeFromWatchingList(var2); + } + } + + EntityTrackerEntry var5 = (EntityTrackerEntry)this.trackedEntityIDs.removeObject(par1Entity.entityId); + + if (var5 != null) + { + this.trackedEntities.remove(var5); + var5.informAllAssociatedPlayersOfItemDestruction(); + } + } + + public void updateTrackedEntities() + { + ArrayList var1 = new ArrayList(); + Iterator var2 = this.trackedEntities.iterator(); + + while (var2.hasNext()) + { + EntityTrackerEntry var3 = (EntityTrackerEntry)var2.next(); + var3.sendLocationToAllClients(this.theWorld.playerEntities); + + if (var3.playerEntitiesUpdated && var3.myEntity instanceof EntityPlayerMP) + { + var1.add((EntityPlayerMP)var3.myEntity); + } + } + + for (int var6 = 0; var6 < var1.size(); ++var6) + { + EntityPlayerMP var7 = (EntityPlayerMP)var1.get(var6); + Iterator var4 = this.trackedEntities.iterator(); + + while (var4.hasNext()) + { + EntityTrackerEntry var5 = (EntityTrackerEntry)var4.next(); + + if (var5.myEntity != var7) + { + var5.tryStartWachingThis(var7); + } + } + } + } + + /** + * does not send the packet to the entity if the entity is a player + */ + public void sendPacketToAllPlayersTrackingEntity(Entity par1Entity, Packet par2Packet) + { + EntityTrackerEntry var3 = (EntityTrackerEntry)this.trackedEntityIDs.lookup(par1Entity.entityId); + + if (var3 != null) + { + var3.sendPacketToAllTrackingPlayers(par2Packet); + } + } + + /** + * sends to the entity if the entity is a player + */ + public void sendPacketToAllAssociatedPlayers(Entity par1Entity, Packet par2Packet) + { + EntityTrackerEntry var3 = (EntityTrackerEntry)this.trackedEntityIDs.lookup(par1Entity.entityId); + + if (var3 != null) + { + var3.sendPacketToAllAssociatedPlayers(par2Packet); + } + } + + public void removePlayerFromTrackers(EntityPlayerMP par1EntityPlayerMP) + { + Iterator var2 = this.trackedEntities.iterator(); + + while (var2.hasNext()) + { + EntityTrackerEntry var3 = (EntityTrackerEntry)var2.next(); + var3.removePlayerFromTracker(par1EntityPlayerMP); + } + } + + public void func_85172_a(EntityPlayerMP par1EntityPlayerMP, Chunk par2Chunk) + { + Iterator var3 = this.trackedEntities.iterator(); + + while (var3.hasNext()) + { + EntityTrackerEntry var4 = (EntityTrackerEntry)var3.next(); + + if (var4.myEntity != par1EntityPlayerMP && var4.myEntity.chunkCoordX == par2Chunk.xPosition && var4.myEntity.chunkCoordZ == par2Chunk.zPosition) + { + var4.tryStartWachingThis(par1EntityPlayerMP); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityTrackerEntry.java b/src/main/java/net/minecraft/src/EntityTrackerEntry.java new file mode 100644 index 0000000..ac1e173 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityTrackerEntry.java @@ -0,0 +1,585 @@ +package net.minecraft.src; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +public class EntityTrackerEntry +{ + public Entity myEntity; + public int blocksDistanceThreshold; + + /** check for sync when ticks % updateFrequency==0 */ + public int updateFrequency; + public int lastScaledXPosition; + public int lastScaledYPosition; + public int lastScaledZPosition; + public int lastYaw; + public int lastPitch; + public int lastHeadMotion; + public double motionX; + public double motionY; + public double motionZ; + public int ticks; + private double posX; + private double posY; + private double posZ; + + /** set to true on first sendLocationToClients */ + private boolean isDataInitialized; + private boolean sendVelocityUpdates; + + /** + * every 400 ticks a full teleport packet is sent, rather than just a "move me +x" command, so that position + * remains fully synced. + */ + private int ticksSinceLastForcedTeleport; + private Entity field_85178_v; + private boolean ridingEntity; + public boolean playerEntitiesUpdated; + + /** + * Holds references to all the players that are currently receiving position updates for this entity. + */ + public Set trackingPlayers = new HashSet(); + + public EntityTrackerEntry(Entity par1Entity, int par2, int par3, boolean par4) + { + this.myEntity = par1Entity; + this.blocksDistanceThreshold = par2; + this.updateFrequency = par3; + this.sendVelocityUpdates = par4; + this.lastScaledXPosition = MathHelper.floor_double(par1Entity.posX * 32.0D); + this.lastScaledYPosition = MathHelper.floor_double(par1Entity.posY * 32.0D); + this.lastScaledZPosition = MathHelper.floor_double(par1Entity.posZ * 32.0D); + this.lastYaw = MathHelper.floor_float(par1Entity.rotationYaw * 256.0F / 360.0F); + this.lastPitch = MathHelper.floor_float(par1Entity.rotationPitch * 256.0F / 360.0F); + this.lastHeadMotion = MathHelper.floor_float(par1Entity.getRotationYawHead() * 256.0F / 360.0F); + } + + public boolean equals(Object par1Obj) + { + return par1Obj instanceof EntityTrackerEntry ? ((EntityTrackerEntry)par1Obj).myEntity.entityId == this.myEntity.entityId : false; + } + + public int hashCode() + { + return this.myEntity.entityId; + } + + /** + * also sends velocity, rotation, and riding info. + */ + public void sendLocationToAllClients(List par1List) + { + this.playerEntitiesUpdated = false; + + if (!this.isDataInitialized || this.myEntity.getDistanceSq(this.posX, this.posY, this.posZ) > 16.0D) + { + this.posX = this.myEntity.posX; + this.posY = this.myEntity.posY; + this.posZ = this.myEntity.posZ; + this.isDataInitialized = true; + this.playerEntitiesUpdated = true; + this.sendEventsToPlayers(par1List); + } + + if (this.field_85178_v != this.myEntity.ridingEntity || this.myEntity.ridingEntity != null && this.ticks % 60 == 0) + { + this.field_85178_v = this.myEntity.ridingEntity; + this.sendPacketToAllTrackingPlayers(new Packet39AttachEntity(0, this.myEntity, this.myEntity.ridingEntity)); + } + + if (this.myEntity instanceof EntityItemFrame && this.ticks % 10 == 0) + { + EntityItemFrame var23 = (EntityItemFrame)this.myEntity; + ItemStack var24 = var23.getDisplayedItem(); + + if (var24 != null && var24.getItem() instanceof ItemMap) + { + MapData var26 = Item.map.getMapData(var24, this.myEntity.worldObj); + Iterator var27 = par1List.iterator(); + + while (var27.hasNext()) + { + EntityPlayer var28 = (EntityPlayer)var27.next(); + EntityPlayerMP var29 = (EntityPlayerMP)var28; + var26.updateVisiblePlayers(var29, var24); + + if (var29.playerNetServerHandler.packetSize() <= 5) + { + Packet var30 = Item.map.createMapDataPacket(var24, this.myEntity.worldObj, var29); + + if (var30 != null) + { + var29.playerNetServerHandler.sendPacketToPlayer(var30); + } + } + } + } + + this.func_111190_b(); + } + else if (this.ticks % this.updateFrequency == 0 || this.myEntity.isAirBorne || this.myEntity.getDataWatcher().hasChanges()) + { + int var2; + int var3; + + if (this.myEntity.ridingEntity == null) + { + ++this.ticksSinceLastForcedTeleport; + var2 = this.myEntity.myEntitySize.multiplyBy32AndRound(this.myEntity.posX); + var3 = MathHelper.floor_double(this.myEntity.posY * 32.0D); + int var4 = this.myEntity.myEntitySize.multiplyBy32AndRound(this.myEntity.posZ); + int var5 = MathHelper.floor_float(this.myEntity.rotationYaw * 256.0F / 360.0F); + int var6 = MathHelper.floor_float(this.myEntity.rotationPitch * 256.0F / 360.0F); + int var7 = var2 - this.lastScaledXPosition; + int var8 = var3 - this.lastScaledYPosition; + int var9 = var4 - this.lastScaledZPosition; + Object var10 = null; + boolean var11 = Math.abs(var7) >= 4 || Math.abs(var8) >= 4 || Math.abs(var9) >= 4 || this.ticks % 60 == 0; + boolean var12 = Math.abs(var5 - this.lastYaw) >= 4 || Math.abs(var6 - this.lastPitch) >= 4; + + if (this.ticks > 0 || this.myEntity instanceof EntityArrow) + { + if (var7 >= -128 && var7 < 128 && var8 >= -128 && var8 < 128 && var9 >= -128 && var9 < 128 && this.ticksSinceLastForcedTeleport <= 400 && !this.ridingEntity) + { + if (var11 && var12) + { + var10 = new Packet33RelEntityMoveLook(this.myEntity.entityId, (byte)var7, (byte)var8, (byte)var9, (byte)var5, (byte)var6); + } + else if (var11) + { + var10 = new Packet31RelEntityMove(this.myEntity.entityId, (byte)var7, (byte)var8, (byte)var9); + } + else if (var12) + { + var10 = new Packet32EntityLook(this.myEntity.entityId, (byte)var5, (byte)var6); + } + } + else + { + this.ticksSinceLastForcedTeleport = 0; + var10 = new Packet34EntityTeleport(this.myEntity.entityId, var2, var3, var4, (byte)var5, (byte)var6); + } + } + + if (this.sendVelocityUpdates) + { + double var13 = this.myEntity.motionX - this.motionX; + double var15 = this.myEntity.motionY - this.motionY; + double var17 = this.myEntity.motionZ - this.motionZ; + double var19 = 0.02D; + double var21 = var13 * var13 + var15 * var15 + var17 * var17; + + if (var21 > var19 * var19 || var21 > 0.0D && this.myEntity.motionX == 0.0D && this.myEntity.motionY == 0.0D && this.myEntity.motionZ == 0.0D) + { + this.motionX = this.myEntity.motionX; + this.motionY = this.myEntity.motionY; + this.motionZ = this.myEntity.motionZ; + this.sendPacketToAllTrackingPlayers(new Packet28EntityVelocity(this.myEntity.entityId, this.motionX, this.motionY, this.motionZ)); + } + } + + if (var10 != null) + { + this.sendPacketToAllTrackingPlayers((Packet)var10); + } + + this.func_111190_b(); + + if (var11) + { + this.lastScaledXPosition = var2; + this.lastScaledYPosition = var3; + this.lastScaledZPosition = var4; + } + + if (var12) + { + this.lastYaw = var5; + this.lastPitch = var6; + } + + this.ridingEntity = false; + } + else + { + var2 = MathHelper.floor_float(this.myEntity.rotationYaw * 256.0F / 360.0F); + var3 = MathHelper.floor_float(this.myEntity.rotationPitch * 256.0F / 360.0F); + boolean var25 = Math.abs(var2 - this.lastYaw) >= 4 || Math.abs(var3 - this.lastPitch) >= 4; + + if (var25) + { + this.sendPacketToAllTrackingPlayers(new Packet32EntityLook(this.myEntity.entityId, (byte)var2, (byte)var3)); + this.lastYaw = var2; + this.lastPitch = var3; + } + + this.lastScaledXPosition = this.myEntity.myEntitySize.multiplyBy32AndRound(this.myEntity.posX); + this.lastScaledYPosition = MathHelper.floor_double(this.myEntity.posY * 32.0D); + this.lastScaledZPosition = this.myEntity.myEntitySize.multiplyBy32AndRound(this.myEntity.posZ); + this.func_111190_b(); + this.ridingEntity = true; + } + + var2 = MathHelper.floor_float(this.myEntity.getRotationYawHead() * 256.0F / 360.0F); + + if (Math.abs(var2 - this.lastHeadMotion) >= 4) + { + this.sendPacketToAllTrackingPlayers(new Packet35EntityHeadRotation(this.myEntity.entityId, (byte)var2)); + this.lastHeadMotion = var2; + } + + this.myEntity.isAirBorne = false; + } + + ++this.ticks; + + if (this.myEntity.velocityChanged) + { + this.sendPacketToAllAssociatedPlayers(new Packet28EntityVelocity(this.myEntity)); + this.myEntity.velocityChanged = false; + } + } + + private void func_111190_b() + { + DataWatcher var1 = this.myEntity.getDataWatcher(); + + if (var1.hasChanges()) + { + this.sendPacketToAllAssociatedPlayers(new Packet40EntityMetadata(this.myEntity.entityId, var1, false)); + } + + if (this.myEntity instanceof EntityLivingBase) + { + ServersideAttributeMap var2 = (ServersideAttributeMap)((EntityLivingBase)this.myEntity).getAttributeMap(); + Set var3 = var2.func_111161_b(); + + if (!var3.isEmpty()) + { + this.sendPacketToAllAssociatedPlayers(new Packet44UpdateAttributes(this.myEntity.entityId, var3)); + } + + var3.clear(); + } + } + + /** + * if this is a player, then it is not informed + */ + public void sendPacketToAllTrackingPlayers(Packet par1Packet) + { + Iterator var2 = this.trackingPlayers.iterator(); + + while (var2.hasNext()) + { + EntityPlayerMP var3 = (EntityPlayerMP)var2.next(); + var3.playerNetServerHandler.sendPacketToPlayer(par1Packet); + } + } + + /** + * if this is a player, then it recieves the message also + */ + public void sendPacketToAllAssociatedPlayers(Packet par1Packet) + { + this.sendPacketToAllTrackingPlayers(par1Packet); + + if (this.myEntity instanceof EntityPlayerMP) + { + ((EntityPlayerMP)this.myEntity).playerNetServerHandler.sendPacketToPlayer(par1Packet); + } + } + + public void informAllAssociatedPlayersOfItemDestruction() + { + Iterator var1 = this.trackingPlayers.iterator(); + + while (var1.hasNext()) + { + EntityPlayerMP var2 = (EntityPlayerMP)var1.next(); + var2.destroyedItemsNetCache.add(Integer.valueOf(this.myEntity.entityId)); + } + } + + public void removeFromWatchingList(EntityPlayerMP par1EntityPlayerMP) + { + if (this.trackingPlayers.contains(par1EntityPlayerMP)) + { + par1EntityPlayerMP.destroyedItemsNetCache.add(Integer.valueOf(this.myEntity.entityId)); + this.trackingPlayers.remove(par1EntityPlayerMP); + } + } + + /** + * if the player is more than the distance threshold (typically 64) then the player is removed instead + */ + public void tryStartWachingThis(EntityPlayerMP par1EntityPlayerMP) + { + if (par1EntityPlayerMP != this.myEntity) + { + double var2 = par1EntityPlayerMP.posX - (double)(this.lastScaledXPosition / 32); + double var4 = par1EntityPlayerMP.posZ - (double)(this.lastScaledZPosition / 32); + + if (var2 >= (double)(-this.blocksDistanceThreshold) && var2 <= (double)this.blocksDistanceThreshold && var4 >= (double)(-this.blocksDistanceThreshold) && var4 <= (double)this.blocksDistanceThreshold) + { + if (!this.trackingPlayers.contains(par1EntityPlayerMP) && (this.isPlayerWatchingThisChunk(par1EntityPlayerMP) || this.myEntity.forceSpawn)) + { + this.trackingPlayers.add(par1EntityPlayerMP); + Packet var6 = this.getPacketForThisEntity(); + par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(var6); + + if (!this.myEntity.getDataWatcher().getIsBlank()) + { + par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet40EntityMetadata(this.myEntity.entityId, this.myEntity.getDataWatcher(), true)); + } + + if (this.myEntity instanceof EntityLivingBase) + { + ServersideAttributeMap var7 = (ServersideAttributeMap)((EntityLivingBase)this.myEntity).getAttributeMap(); + Collection var8 = var7.func_111160_c(); + + if (!var8.isEmpty()) + { + par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet44UpdateAttributes(this.myEntity.entityId, var8)); + } + } + + this.motionX = this.myEntity.motionX; + this.motionY = this.myEntity.motionY; + this.motionZ = this.myEntity.motionZ; + + if (this.sendVelocityUpdates && !(var6 instanceof Packet24MobSpawn)) + { + par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet28EntityVelocity(this.myEntity.entityId, this.myEntity.motionX, this.myEntity.motionY, this.myEntity.motionZ)); + } + + if (this.myEntity.ridingEntity != null) + { + par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet39AttachEntity(0, this.myEntity, this.myEntity.ridingEntity)); + } + + if (this.myEntity instanceof EntityLiving && ((EntityLiving)this.myEntity).getLeashedToEntity() != null) + { + par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet39AttachEntity(1, this.myEntity, ((EntityLiving)this.myEntity).getLeashedToEntity())); + } + + if (this.myEntity instanceof EntityLivingBase) + { + for (int var10 = 0; var10 < 5; ++var10) + { + ItemStack var12 = ((EntityLivingBase)this.myEntity).getCurrentItemOrArmor(var10); + + if (var12 != null) + { + par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet5PlayerInventory(this.myEntity.entityId, var10, var12)); + } + } + } + + if (this.myEntity instanceof EntityPlayer) + { + EntityPlayer var11 = (EntityPlayer)this.myEntity; + + if (var11.isPlayerSleeping()) + { + par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet17Sleep(this.myEntity, 0, MathHelper.floor_double(this.myEntity.posX), MathHelper.floor_double(this.myEntity.posY), MathHelper.floor_double(this.myEntity.posZ))); + } + } + + if (this.myEntity instanceof EntityLivingBase) + { + EntityLivingBase var13 = (EntityLivingBase)this.myEntity; + Iterator var14 = var13.getActivePotionEffects().iterator(); + + while (var14.hasNext()) + { + PotionEffect var9 = (PotionEffect)var14.next(); + par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet41EntityEffect(this.myEntity.entityId, var9)); + } + } + } + } + else if (this.trackingPlayers.contains(par1EntityPlayerMP)) + { + this.trackingPlayers.remove(par1EntityPlayerMP); + par1EntityPlayerMP.destroyedItemsNetCache.add(Integer.valueOf(this.myEntity.entityId)); + } + } + } + + private boolean isPlayerWatchingThisChunk(EntityPlayerMP par1EntityPlayerMP) + { + return par1EntityPlayerMP.getServerForPlayer().getPlayerManager().isPlayerWatchingChunk(par1EntityPlayerMP, this.myEntity.chunkCoordX, this.myEntity.chunkCoordZ); + } + + public void sendEventsToPlayers(List par1List) + { + for (int var2 = 0; var2 < par1List.size(); ++var2) + { + this.tryStartWachingThis((EntityPlayerMP)par1List.get(var2)); + } + } + + private Packet getPacketForThisEntity() + { + if (this.myEntity.isDead) + { + this.myEntity.worldObj.getWorldLogAgent().logWarning("Fetching addPacket for removed entity"); + } + + if (this.myEntity instanceof EntityItem) + { + return new Packet23VehicleSpawn(this.myEntity, 2, 1); + } + else if (this.myEntity instanceof EntityPlayerMP) + { + return new Packet20NamedEntitySpawn((EntityPlayer)this.myEntity); + } + else if (this.myEntity instanceof EntityMinecart) + { + EntityMinecart var9 = (EntityMinecart)this.myEntity; + return new Packet23VehicleSpawn(this.myEntity, 10, var9.getMinecartType()); + } + else if (this.myEntity instanceof EntityBoat) + { + return new Packet23VehicleSpawn(this.myEntity, 1); + } + else if (!(this.myEntity instanceof IAnimals) && !(this.myEntity instanceof EntityDragon)) + { + if (this.myEntity instanceof EntityFishHook) + { + EntityPlayer var8 = ((EntityFishHook)this.myEntity).angler; + return new Packet23VehicleSpawn(this.myEntity, 90, var8 != null ? var8.entityId : this.myEntity.entityId); + } + else if (this.myEntity instanceof EntityArrow) + { + Entity var7 = ((EntityArrow)this.myEntity).shootingEntity; + return new Packet23VehicleSpawn(this.myEntity, 60, var7 != null ? var7.entityId : this.myEntity.entityId); + } + else if (this.myEntity instanceof EntitySnowball) + { + return new Packet23VehicleSpawn(this.myEntity, 61); + } + else if (this.myEntity instanceof EntityPotion) + { + return new Packet23VehicleSpawn(this.myEntity, 73, ((EntityPotion)this.myEntity).getPotionDamage()); + } + else if (this.myEntity instanceof EntityExpBottle) + { + return new Packet23VehicleSpawn(this.myEntity, 75); + } + else if (this.myEntity instanceof EntityEnderPearl) + { + return new Packet23VehicleSpawn(this.myEntity, 65); + } + else if (this.myEntity instanceof EntityEnderEye) + { + return new Packet23VehicleSpawn(this.myEntity, 72); + } + else if (this.myEntity instanceof EntityFireworkRocket) + { + return new Packet23VehicleSpawn(this.myEntity, 76); + } + else + { + Packet23VehicleSpawn var2; + + if (this.myEntity instanceof EntityFireball) + { + EntityFireball var6 = (EntityFireball)this.myEntity; + var2 = null; + byte var3 = 63; + + if (this.myEntity instanceof EntitySmallFireball) + { + var3 = 64; + } + else if (this.myEntity instanceof EntityWitherSkull) + { + var3 = 66; + } + + if (var6.shootingEntity != null) + { + var2 = new Packet23VehicleSpawn(this.myEntity, var3, ((EntityFireball)this.myEntity).shootingEntity.entityId); + } + else + { + var2 = new Packet23VehicleSpawn(this.myEntity, var3, 0); + } + + var2.speedX = (int)(var6.accelerationX * 8000.0D); + var2.speedY = (int)(var6.accelerationY * 8000.0D); + var2.speedZ = (int)(var6.accelerationZ * 8000.0D); + return var2; + } + else if (this.myEntity instanceof EntityEgg) + { + return new Packet23VehicleSpawn(this.myEntity, 62); + } + else if (this.myEntity instanceof EntityTNTPrimed) + { + return new Packet23VehicleSpawn(this.myEntity, 50); + } + else if (this.myEntity instanceof EntityEnderCrystal) + { + return new Packet23VehicleSpawn(this.myEntity, 51); + } + else if (this.myEntity instanceof EntityFallingSand) + { + EntityFallingSand var5 = (EntityFallingSand)this.myEntity; + return new Packet23VehicleSpawn(this.myEntity, 70, var5.blockID | var5.metadata << 16); + } + else if (this.myEntity instanceof EntityPainting) + { + return new Packet25EntityPainting((EntityPainting)this.myEntity); + } + else if (this.myEntity instanceof EntityItemFrame) + { + EntityItemFrame var4 = (EntityItemFrame)this.myEntity; + var2 = new Packet23VehicleSpawn(this.myEntity, 71, var4.hangingDirection); + var2.xPosition = MathHelper.floor_float((float)(var4.xPosition * 32)); + var2.yPosition = MathHelper.floor_float((float)(var4.yPosition * 32)); + var2.zPosition = MathHelper.floor_float((float)(var4.zPosition * 32)); + return var2; + } + else if (this.myEntity instanceof EntityLeashKnot) + { + EntityLeashKnot var1 = (EntityLeashKnot)this.myEntity; + var2 = new Packet23VehicleSpawn(this.myEntity, 77); + var2.xPosition = MathHelper.floor_float((float)(var1.xPosition * 32)); + var2.yPosition = MathHelper.floor_float((float)(var1.yPosition * 32)); + var2.zPosition = MathHelper.floor_float((float)(var1.zPosition * 32)); + return var2; + } + else if (this.myEntity instanceof EntityXPOrb) + { + return new Packet26EntityExpOrb((EntityXPOrb)this.myEntity); + } + else + { + throw new IllegalArgumentException("Don\'t know how to add " + this.myEntity.getClass() + "!"); + } + } + } + else + { + this.lastHeadMotion = MathHelper.floor_float(this.myEntity.getRotationYawHead() * 256.0F / 360.0F); + return new Packet24MobSpawn((EntityLivingBase)this.myEntity); + } + } + + public void removePlayerFromTracker(EntityPlayerMP par1EntityPlayerMP) + { + if (this.trackingPlayers.contains(par1EntityPlayerMP)) + { + this.trackingPlayers.remove(par1EntityPlayerMP); + par1EntityPlayerMP.destroyedItemsNetCache.add(Integer.valueOf(this.myEntity.entityId)); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityVillager.java b/src/main/java/net/minecraft/src/EntityVillager.java new file mode 100644 index 0000000..0e07e54 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityVillager.java @@ -0,0 +1,753 @@ +package net.minecraft.src; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Random; + +public class EntityVillager extends EntityAgeable implements IMerchant, INpc +{ + private int randomTickDivider; + private boolean isMating; + private boolean isPlaying; + Village villageObj; + + /** This villager's current customer. */ + private EntityPlayer buyingPlayer; + + /** Initialises the MerchantRecipeList.java */ + private MerchantRecipeList buyingList; + private int timeUntilReset; + + /** addDefaultEquipmentAndRecipies is called if this is true */ + private boolean needsInitilization; + private int wealth; + + /** Last player to trade with this villager, used for aggressivity. */ + private String lastBuyingPlayer; + private boolean field_82190_bM; + private float field_82191_bN; + + /** + * a villagers recipe list is intialized off this list ; the 2 params are min/max amount they will trade for 1 + * emerald + */ + private static final Map villagerStockList = new HashMap(); + + /** + * Selling list of Blacksmith items. negative numbers mean 1 emerald for n items, positive numbers are n emeralds + * for 1 item + */ + private static final Map blacksmithSellingList = new HashMap(); + + public EntityVillager(World par1World) + { + this(par1World, 0); + } + + public EntityVillager(World par1World, int par2) + { + super(par1World); + this.setProfession(par2); + this.setSize(0.6F, 1.8F); + this.getNavigator().setBreakDoors(true); + this.getNavigator().setAvoidsWater(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); + this.tasks.addTask(1, new EntityAITradePlayer(this)); + this.tasks.addTask(1, new EntityAILookAtTradePlayer(this)); + this.tasks.addTask(2, new EntityAIMoveIndoors(this)); + this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this)); + this.tasks.addTask(4, new EntityAIOpenDoor(this, true)); + this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.6D)); + this.tasks.addTask(6, new EntityAIVillagerMate(this)); + this.tasks.addTask(7, new EntityAIFollowGolem(this)); + this.tasks.addTask(8, new EntityAIPlay(this, 0.32D)); + this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F)); + this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityVillager.class, 5.0F, 0.02F)); + this.tasks.addTask(9, new EntityAIWander(this, 0.6D)); + this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.5D); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return true; + } + + /** + * main AI tick function, replaces updateEntityActionState + */ + protected void updateAITick() + { + if (--this.randomTickDivider <= 0) + { + this.worldObj.villageCollectionObj.addVillagerPosition(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)); + this.randomTickDivider = 70 + this.rand.nextInt(50); + this.villageObj = this.worldObj.villageCollectionObj.findNearestVillage(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ), 32); + + if (this.villageObj == null) + { + this.detachHome(); + } + else + { + ChunkCoordinates var1 = this.villageObj.getCenter(); + this.setHomeArea(var1.posX, var1.posY, var1.posZ, (int)((float)this.villageObj.getVillageRadius() * 0.6F)); + + if (this.field_82190_bM) + { + this.field_82190_bM = false; + this.villageObj.func_82683_b(5); + } + } + } + + if (!this.isTrading() && this.timeUntilReset > 0) + { + --this.timeUntilReset; + + if (this.timeUntilReset <= 0) + { + if (this.needsInitilization) + { + if (this.buyingList.size() > 1) + { + Iterator var3 = this.buyingList.iterator(); + + while (var3.hasNext()) + { + MerchantRecipe var2 = (MerchantRecipe)var3.next(); + + if (var2.func_82784_g()) + { + var2.func_82783_a(this.rand.nextInt(6) + this.rand.nextInt(6) + 2); + } + } + } + + this.addDefaultEquipmentAndRecipies(1); + this.needsInitilization = false; + + if (this.villageObj != null && this.lastBuyingPlayer != null) + { + this.worldObj.setEntityState(this, (byte)14); + this.villageObj.setReputationForPlayer(this.lastBuyingPlayer, 1); + } + } + + this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0)); + } + } + + super.updateAITick(); + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + boolean var3 = var2 != null && var2.itemID == Item.monsterPlacer.itemID; + + if (!var3 && this.isEntityAlive() && !this.isTrading() && !this.isChild()) + { + if (!this.worldObj.isRemote) + { + this.setCustomer(par1EntityPlayer); + par1EntityPlayer.displayGUIMerchant(this, this.getCustomNameTag()); + } + + return true; + } + else + { + return super.interact(par1EntityPlayer); + } + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(16, Integer.valueOf(0)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("Profession", this.getProfession()); + par1NBTTagCompound.setInteger("Riches", this.wealth); + + if (this.buyingList != null) + { + par1NBTTagCompound.setCompoundTag("Offers", this.buyingList.getRecipiesAsTags()); + } + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.setProfession(par1NBTTagCompound.getInteger("Profession")); + this.wealth = par1NBTTagCompound.getInteger("Riches"); + + if (par1NBTTagCompound.hasKey("Offers")) + { + NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("Offers"); + this.buyingList = new MerchantRecipeList(var2); + } + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return false; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return this.isTrading() ? "mob.villager.haggle" : "mob.villager.idle"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.villager.hit"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.villager.death"; + } + + public void setProfession(int par1) + { + this.dataWatcher.updateObject(16, Integer.valueOf(par1)); + } + + public int getProfession() + { + return this.dataWatcher.getWatchableObjectInt(16); + } + + public boolean isMating() + { + return this.isMating; + } + + public void setMating(boolean par1) + { + this.isMating = par1; + } + + public void setPlaying(boolean par1) + { + this.isPlaying = par1; + } + + public boolean isPlaying() + { + return this.isPlaying; + } + + public void setRevengeTarget(EntityLivingBase par1EntityLivingBase) + { + super.setRevengeTarget(par1EntityLivingBase); + + if (this.villageObj != null && par1EntityLivingBase != null) + { + this.villageObj.addOrRenewAgressor(par1EntityLivingBase); + + if (par1EntityLivingBase instanceof EntityPlayer) + { + byte var2 = -1; + + if (this.isChild()) + { + var2 = -3; + } + + this.villageObj.setReputationForPlayer(((EntityPlayer)par1EntityLivingBase).getCommandSenderName(), var2); + + if (this.isEntityAlive()) + { + this.worldObj.setEntityState(this, (byte)13); + } + } + } + } + + /** + * Called when the mob's health reaches 0. + */ + public void onDeath(DamageSource par1DamageSource) + { + if (this.villageObj != null) + { + Entity var2 = par1DamageSource.getEntity(); + + if (var2 != null) + { + if (var2 instanceof EntityPlayer) + { + this.villageObj.setReputationForPlayer(((EntityPlayer)var2).getCommandSenderName(), -2); + } + else if (var2 instanceof IMob) + { + this.villageObj.endMatingSeason(); + } + } + else if (var2 == null) + { + EntityPlayer var3 = this.worldObj.getClosestPlayerToEntity(this, 16.0D); + + if (var3 != null) + { + this.villageObj.endMatingSeason(); + } + } + } + + super.onDeath(par1DamageSource); + } + + public void setCustomer(EntityPlayer par1EntityPlayer) + { + this.buyingPlayer = par1EntityPlayer; + } + + public EntityPlayer getCustomer() + { + return this.buyingPlayer; + } + + public boolean isTrading() + { + return this.buyingPlayer != null; + } + + public void useRecipe(MerchantRecipe par1MerchantRecipe) + { + par1MerchantRecipe.incrementToolUses(); + this.livingSoundTime = -this.getTalkInterval(); + this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch()); + + if (par1MerchantRecipe.hasSameIDsAs((MerchantRecipe)this.buyingList.get(this.buyingList.size() - 1))) + { + this.timeUntilReset = 40; + this.needsInitilization = true; + + if (this.buyingPlayer != null) + { + this.lastBuyingPlayer = this.buyingPlayer.getCommandSenderName(); + } + else + { + this.lastBuyingPlayer = null; + } + } + + if (par1MerchantRecipe.getItemToBuy().itemID == Item.emerald.itemID) + { + this.wealth += par1MerchantRecipe.getItemToBuy().stackSize; + } + } + + public void func_110297_a_(ItemStack par1ItemStack) + { + if (!this.worldObj.isRemote && this.livingSoundTime > -this.getTalkInterval() + 20) + { + this.livingSoundTime = -this.getTalkInterval(); + + if (par1ItemStack != null) + { + this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch()); + } + else + { + this.playSound("mob.villager.no", this.getSoundVolume(), this.getSoundPitch()); + } + } + } + + public MerchantRecipeList getRecipes(EntityPlayer par1EntityPlayer) + { + if (this.buyingList == null) + { + this.addDefaultEquipmentAndRecipies(1); + } + + return this.buyingList; + } + + /** + * Adjusts the probability of obtaining a given recipe being offered by a villager + */ + private float adjustProbability(float par1) + { + float var2 = par1 + this.field_82191_bN; + return var2 > 0.9F ? 0.9F - (var2 - 0.9F) : var2; + } + + /** + * based on the villagers profession add items, equipment, and recipies adds par1 random items to the list of things + * that the villager wants to buy. (at most 1 of each wanted type is added) + */ + private void addDefaultEquipmentAndRecipies(int par1) + { + if (this.buyingList != null) + { + this.field_82191_bN = MathHelper.sqrt_float((float)this.buyingList.size()) * 0.2F; + } + else + { + this.field_82191_bN = 0.0F; + } + + MerchantRecipeList var2; + var2 = new MerchantRecipeList(); + int var6; + label50: + + switch (this.getProfession()) + { + case 0: + addMerchantItem(var2, Item.wheat.itemID, this.rand, this.adjustProbability(0.9F)); + addMerchantItem(var2, Block.cloth.blockID, this.rand, this.adjustProbability(0.5F)); + addMerchantItem(var2, Item.chickenRaw.itemID, this.rand, this.adjustProbability(0.5F)); + addMerchantItem(var2, Item.fishCooked.itemID, this.rand, this.adjustProbability(0.4F)); + addBlacksmithItem(var2, Item.bread.itemID, this.rand, this.adjustProbability(0.9F)); + addBlacksmithItem(var2, Item.melon.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.appleRed.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.cookie.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.shears.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.flintAndSteel.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.chickenCooked.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.arrow.itemID, this.rand, this.adjustProbability(0.5F)); + + if (this.rand.nextFloat() < this.adjustProbability(0.5F)) + { + var2.add(new MerchantRecipe(new ItemStack(Block.gravel, 10), new ItemStack(Item.emerald), new ItemStack(Item.flint.itemID, 4 + this.rand.nextInt(2), 0))); + } + + break; + + case 1: + addMerchantItem(var2, Item.paper.itemID, this.rand, this.adjustProbability(0.8F)); + addMerchantItem(var2, Item.book.itemID, this.rand, this.adjustProbability(0.8F)); + addMerchantItem(var2, Item.writtenBook.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Block.bookShelf.blockID, this.rand, this.adjustProbability(0.8F)); + addBlacksmithItem(var2, Block.glass.blockID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.compass.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.pocketSundial.itemID, this.rand, this.adjustProbability(0.2F)); + + if (this.rand.nextFloat() < this.adjustProbability(0.07F)) + { + Enchantment var8 = Enchantment.enchantmentsBookList[this.rand.nextInt(Enchantment.enchantmentsBookList.length)]; + int var10 = MathHelper.getRandomIntegerInRange(this.rand, var8.getMinLevel(), var8.getMaxLevel()); + ItemStack var11 = Item.enchantedBook.getEnchantedItemStack(new EnchantmentData(var8, var10)); + var6 = 2 + this.rand.nextInt(5 + var10 * 10) + 3 * var10; + var2.add(new MerchantRecipe(new ItemStack(Item.book), new ItemStack(Item.emerald, var6), var11)); + } + + break; + + case 2: + addBlacksmithItem(var2, Item.eyeOfEnder.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.expBottle.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.redstone.itemID, this.rand, this.adjustProbability(0.4F)); + addBlacksmithItem(var2, Block.glowStone.blockID, this.rand, this.adjustProbability(0.3F)); + int[] var3 = new int[] {Item.swordIron.itemID, Item.swordDiamond.itemID, Item.plateIron.itemID, Item.plateDiamond.itemID, Item.axeIron.itemID, Item.axeDiamond.itemID, Item.pickaxeIron.itemID, Item.pickaxeDiamond.itemID}; + int[] var4 = var3; + int var5 = var3.length; + var6 = 0; + + while (true) + { + if (var6 >= var5) + { + break label50; + } + + int var7 = var4[var6]; + + if (this.rand.nextFloat() < this.adjustProbability(0.05F)) + { + var2.add(new MerchantRecipe(new ItemStack(var7, 1, 0), new ItemStack(Item.emerald, 2 + this.rand.nextInt(3), 0), EnchantmentHelper.addRandomEnchantment(this.rand, new ItemStack(var7, 1, 0), 5 + this.rand.nextInt(15)))); + } + + ++var6; + } + + case 3: + addMerchantItem(var2, Item.coal.itemID, this.rand, this.adjustProbability(0.7F)); + addMerchantItem(var2, Item.ingotIron.itemID, this.rand, this.adjustProbability(0.5F)); + addMerchantItem(var2, Item.ingotGold.itemID, this.rand, this.adjustProbability(0.5F)); + addMerchantItem(var2, Item.diamond.itemID, this.rand, this.adjustProbability(0.5F)); + addBlacksmithItem(var2, Item.swordIron.itemID, this.rand, this.adjustProbability(0.5F)); + addBlacksmithItem(var2, Item.swordDiamond.itemID, this.rand, this.adjustProbability(0.5F)); + addBlacksmithItem(var2, Item.axeIron.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.axeDiamond.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.pickaxeIron.itemID, this.rand, this.adjustProbability(0.5F)); + addBlacksmithItem(var2, Item.pickaxeDiamond.itemID, this.rand, this.adjustProbability(0.5F)); + addBlacksmithItem(var2, Item.shovelIron.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.shovelDiamond.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.hoeIron.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.hoeDiamond.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.bootsIron.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.bootsDiamond.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.helmetIron.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.helmetDiamond.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.plateIron.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.plateDiamond.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.legsIron.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.legsDiamond.itemID, this.rand, this.adjustProbability(0.2F)); + addBlacksmithItem(var2, Item.bootsChain.itemID, this.rand, this.adjustProbability(0.1F)); + addBlacksmithItem(var2, Item.helmetChain.itemID, this.rand, this.adjustProbability(0.1F)); + addBlacksmithItem(var2, Item.plateChain.itemID, this.rand, this.adjustProbability(0.1F)); + addBlacksmithItem(var2, Item.legsChain.itemID, this.rand, this.adjustProbability(0.1F)); + break; + + case 4: + addMerchantItem(var2, Item.coal.itemID, this.rand, this.adjustProbability(0.7F)); + addMerchantItem(var2, Item.porkRaw.itemID, this.rand, this.adjustProbability(0.5F)); + addMerchantItem(var2, Item.beefRaw.itemID, this.rand, this.adjustProbability(0.5F)); + addBlacksmithItem(var2, Item.saddle.itemID, this.rand, this.adjustProbability(0.1F)); + addBlacksmithItem(var2, Item.plateLeather.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.bootsLeather.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.helmetLeather.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.legsLeather.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.porkCooked.itemID, this.rand, this.adjustProbability(0.3F)); + addBlacksmithItem(var2, Item.beefCooked.itemID, this.rand, this.adjustProbability(0.3F)); + } + + if (var2.isEmpty()) + { + addMerchantItem(var2, Item.ingotGold.itemID, this.rand, 1.0F); + } + + Collections.shuffle(var2); + + if (this.buyingList == null) + { + this.buyingList = new MerchantRecipeList(); + } + + for (int var9 = 0; var9 < par1 && var9 < var2.size(); ++var9) + { + this.buyingList.addToListWithCheck((MerchantRecipe)var2.get(var9)); + } + } + + public void setRecipes(MerchantRecipeList par1MerchantRecipeList) {} + + /** + * each recipie takes a random stack from villagerStockList and offers it for 1 emerald + */ + private static void addMerchantItem(MerchantRecipeList par0MerchantRecipeList, int par1, Random par2Random, float par3) + { + if (par2Random.nextFloat() < par3) + { + par0MerchantRecipeList.add(new MerchantRecipe(getRandomSizedStack(par1, par2Random), Item.emerald)); + } + } + + private static ItemStack getRandomSizedStack(int par0, Random par1Random) + { + return new ItemStack(par0, getRandomCountForItem(par0, par1Random), 0); + } + + /** + * default to 1, and villagerStockList contains a min/max amount for each index + */ + private static int getRandomCountForItem(int par0, Random par1Random) + { + Tuple var2 = (Tuple)villagerStockList.get(Integer.valueOf(par0)); + return var2 == null ? 1 : (((Integer)var2.getFirst()).intValue() >= ((Integer)var2.getSecond()).intValue() ? ((Integer)var2.getFirst()).intValue() : ((Integer)var2.getFirst()).intValue() + par1Random.nextInt(((Integer)var2.getSecond()).intValue() - ((Integer)var2.getFirst()).intValue())); + } + + private static void addBlacksmithItem(MerchantRecipeList par0MerchantRecipeList, int par1, Random par2Random, float par3) + { + if (par2Random.nextFloat() < par3) + { + int var4 = getRandomCountForBlacksmithItem(par1, par2Random); + ItemStack var5; + ItemStack var6; + + if (var4 < 0) + { + var5 = new ItemStack(Item.emerald.itemID, 1, 0); + var6 = new ItemStack(par1, -var4, 0); + } + else + { + var5 = new ItemStack(Item.emerald.itemID, var4, 0); + var6 = new ItemStack(par1, 1, 0); + } + + par0MerchantRecipeList.add(new MerchantRecipe(var5, var6)); + } + } + + private static int getRandomCountForBlacksmithItem(int par0, Random par1Random) + { + Tuple var2 = (Tuple)blacksmithSellingList.get(Integer.valueOf(par0)); + return var2 == null ? 1 : (((Integer)var2.getFirst()).intValue() >= ((Integer)var2.getSecond()).intValue() ? ((Integer)var2.getFirst()).intValue() : ((Integer)var2.getFirst()).intValue() + par1Random.nextInt(((Integer)var2.getSecond()).intValue() - ((Integer)var2.getFirst()).intValue())); + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 12) + { + this.generateRandomParticles("heart"); + } + else if (par1 == 13) + { + this.generateRandomParticles("angryVillager"); + } + else if (par1 == 14) + { + this.generateRandomParticles("happyVillager"); + } + else + { + super.handleHealthUpdate(par1); + } + } + + /** + * par1 is the particleName + */ + private void generateRandomParticles(String par1Str) + { + for (int var2 = 0; var2 < 5; ++var2) + { + double var3 = this.rand.nextGaussian() * 0.02D; + double var5 = this.rand.nextGaussian() * 0.02D; + double var7 = this.rand.nextGaussian() * 0.02D; + this.worldObj.spawnParticle(par1Str, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 1.0D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var3, var5, var7); + } + } + + public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData) + { + par1EntityLivingData = super.onSpawnWithEgg(par1EntityLivingData); + this.setProfession(this.worldObj.rand.nextInt(5)); + return par1EntityLivingData; + } + + public void func_82187_q() + { + this.field_82190_bM = true; + } + + public EntityVillager func_90012_b(EntityAgeable par1EntityAgeable) + { + EntityVillager var2 = new EntityVillager(this.worldObj); + var2.onSpawnWithEgg((EntityLivingData)null); + return var2; + } + + public boolean allowLeashing() + { + return false; + } + + public EntityAgeable createChild(EntityAgeable par1EntityAgeable) + { + return this.func_90012_b(par1EntityAgeable); + } + + static + { + villagerStockList.put(Integer.valueOf(Item.coal.itemID), new Tuple(Integer.valueOf(16), Integer.valueOf(24))); + villagerStockList.put(Integer.valueOf(Item.ingotIron.itemID), new Tuple(Integer.valueOf(8), Integer.valueOf(10))); + villagerStockList.put(Integer.valueOf(Item.ingotGold.itemID), new Tuple(Integer.valueOf(8), Integer.valueOf(10))); + villagerStockList.put(Integer.valueOf(Item.diamond.itemID), new Tuple(Integer.valueOf(4), Integer.valueOf(6))); + villagerStockList.put(Integer.valueOf(Item.paper.itemID), new Tuple(Integer.valueOf(24), Integer.valueOf(36))); + villagerStockList.put(Integer.valueOf(Item.book.itemID), new Tuple(Integer.valueOf(11), Integer.valueOf(13))); + villagerStockList.put(Integer.valueOf(Item.writtenBook.itemID), new Tuple(Integer.valueOf(1), Integer.valueOf(1))); + villagerStockList.put(Integer.valueOf(Item.enderPearl.itemID), new Tuple(Integer.valueOf(3), Integer.valueOf(4))); + villagerStockList.put(Integer.valueOf(Item.eyeOfEnder.itemID), new Tuple(Integer.valueOf(2), Integer.valueOf(3))); + villagerStockList.put(Integer.valueOf(Item.porkRaw.itemID), new Tuple(Integer.valueOf(14), Integer.valueOf(18))); + villagerStockList.put(Integer.valueOf(Item.beefRaw.itemID), new Tuple(Integer.valueOf(14), Integer.valueOf(18))); + villagerStockList.put(Integer.valueOf(Item.chickenRaw.itemID), new Tuple(Integer.valueOf(14), Integer.valueOf(18))); + villagerStockList.put(Integer.valueOf(Item.fishCooked.itemID), new Tuple(Integer.valueOf(9), Integer.valueOf(13))); + villagerStockList.put(Integer.valueOf(Item.seeds.itemID), new Tuple(Integer.valueOf(34), Integer.valueOf(48))); + villagerStockList.put(Integer.valueOf(Item.melonSeeds.itemID), new Tuple(Integer.valueOf(30), Integer.valueOf(38))); + villagerStockList.put(Integer.valueOf(Item.pumpkinSeeds.itemID), new Tuple(Integer.valueOf(30), Integer.valueOf(38))); + villagerStockList.put(Integer.valueOf(Item.wheat.itemID), new Tuple(Integer.valueOf(18), Integer.valueOf(22))); + villagerStockList.put(Integer.valueOf(Block.cloth.blockID), new Tuple(Integer.valueOf(14), Integer.valueOf(22))); + villagerStockList.put(Integer.valueOf(Item.rottenFlesh.itemID), new Tuple(Integer.valueOf(36), Integer.valueOf(64))); + blacksmithSellingList.put(Integer.valueOf(Item.flintAndSteel.itemID), new Tuple(Integer.valueOf(3), Integer.valueOf(4))); + blacksmithSellingList.put(Integer.valueOf(Item.shears.itemID), new Tuple(Integer.valueOf(3), Integer.valueOf(4))); + blacksmithSellingList.put(Integer.valueOf(Item.swordIron.itemID), new Tuple(Integer.valueOf(7), Integer.valueOf(11))); + blacksmithSellingList.put(Integer.valueOf(Item.swordDiamond.itemID), new Tuple(Integer.valueOf(12), Integer.valueOf(14))); + blacksmithSellingList.put(Integer.valueOf(Item.axeIron.itemID), new Tuple(Integer.valueOf(6), Integer.valueOf(8))); + blacksmithSellingList.put(Integer.valueOf(Item.axeDiamond.itemID), new Tuple(Integer.valueOf(9), Integer.valueOf(12))); + blacksmithSellingList.put(Integer.valueOf(Item.pickaxeIron.itemID), new Tuple(Integer.valueOf(7), Integer.valueOf(9))); + blacksmithSellingList.put(Integer.valueOf(Item.pickaxeDiamond.itemID), new Tuple(Integer.valueOf(10), Integer.valueOf(12))); + blacksmithSellingList.put(Integer.valueOf(Item.shovelIron.itemID), new Tuple(Integer.valueOf(4), Integer.valueOf(6))); + blacksmithSellingList.put(Integer.valueOf(Item.shovelDiamond.itemID), new Tuple(Integer.valueOf(7), Integer.valueOf(8))); + blacksmithSellingList.put(Integer.valueOf(Item.hoeIron.itemID), new Tuple(Integer.valueOf(4), Integer.valueOf(6))); + blacksmithSellingList.put(Integer.valueOf(Item.hoeDiamond.itemID), new Tuple(Integer.valueOf(7), Integer.valueOf(8))); + blacksmithSellingList.put(Integer.valueOf(Item.bootsIron.itemID), new Tuple(Integer.valueOf(4), Integer.valueOf(6))); + blacksmithSellingList.put(Integer.valueOf(Item.bootsDiamond.itemID), new Tuple(Integer.valueOf(7), Integer.valueOf(8))); + blacksmithSellingList.put(Integer.valueOf(Item.helmetIron.itemID), new Tuple(Integer.valueOf(4), Integer.valueOf(6))); + blacksmithSellingList.put(Integer.valueOf(Item.helmetDiamond.itemID), new Tuple(Integer.valueOf(7), Integer.valueOf(8))); + blacksmithSellingList.put(Integer.valueOf(Item.plateIron.itemID), new Tuple(Integer.valueOf(10), Integer.valueOf(14))); + blacksmithSellingList.put(Integer.valueOf(Item.plateDiamond.itemID), new Tuple(Integer.valueOf(16), Integer.valueOf(19))); + blacksmithSellingList.put(Integer.valueOf(Item.legsIron.itemID), new Tuple(Integer.valueOf(8), Integer.valueOf(10))); + blacksmithSellingList.put(Integer.valueOf(Item.legsDiamond.itemID), new Tuple(Integer.valueOf(11), Integer.valueOf(14))); + blacksmithSellingList.put(Integer.valueOf(Item.bootsChain.itemID), new Tuple(Integer.valueOf(5), Integer.valueOf(7))); + blacksmithSellingList.put(Integer.valueOf(Item.helmetChain.itemID), new Tuple(Integer.valueOf(5), Integer.valueOf(7))); + blacksmithSellingList.put(Integer.valueOf(Item.plateChain.itemID), new Tuple(Integer.valueOf(11), Integer.valueOf(15))); + blacksmithSellingList.put(Integer.valueOf(Item.legsChain.itemID), new Tuple(Integer.valueOf(9), Integer.valueOf(11))); + blacksmithSellingList.put(Integer.valueOf(Item.bread.itemID), new Tuple(Integer.valueOf(-4), Integer.valueOf(-2))); + blacksmithSellingList.put(Integer.valueOf(Item.melon.itemID), new Tuple(Integer.valueOf(-8), Integer.valueOf(-4))); + blacksmithSellingList.put(Integer.valueOf(Item.appleRed.itemID), new Tuple(Integer.valueOf(-8), Integer.valueOf(-4))); + blacksmithSellingList.put(Integer.valueOf(Item.cookie.itemID), new Tuple(Integer.valueOf(-10), Integer.valueOf(-7))); + blacksmithSellingList.put(Integer.valueOf(Block.glass.blockID), new Tuple(Integer.valueOf(-5), Integer.valueOf(-3))); + blacksmithSellingList.put(Integer.valueOf(Block.bookShelf.blockID), new Tuple(Integer.valueOf(3), Integer.valueOf(4))); + blacksmithSellingList.put(Integer.valueOf(Item.plateLeather.itemID), new Tuple(Integer.valueOf(4), Integer.valueOf(5))); + blacksmithSellingList.put(Integer.valueOf(Item.bootsLeather.itemID), new Tuple(Integer.valueOf(2), Integer.valueOf(4))); + blacksmithSellingList.put(Integer.valueOf(Item.helmetLeather.itemID), new Tuple(Integer.valueOf(2), Integer.valueOf(4))); + blacksmithSellingList.put(Integer.valueOf(Item.legsLeather.itemID), new Tuple(Integer.valueOf(2), Integer.valueOf(4))); + blacksmithSellingList.put(Integer.valueOf(Item.saddle.itemID), new Tuple(Integer.valueOf(6), Integer.valueOf(8))); + blacksmithSellingList.put(Integer.valueOf(Item.expBottle.itemID), new Tuple(Integer.valueOf(-4), Integer.valueOf(-1))); + blacksmithSellingList.put(Integer.valueOf(Item.redstone.itemID), new Tuple(Integer.valueOf(-4), Integer.valueOf(-1))); + blacksmithSellingList.put(Integer.valueOf(Item.compass.itemID), new Tuple(Integer.valueOf(10), Integer.valueOf(12))); + blacksmithSellingList.put(Integer.valueOf(Item.pocketSundial.itemID), new Tuple(Integer.valueOf(10), Integer.valueOf(12))); + blacksmithSellingList.put(Integer.valueOf(Block.glowStone.blockID), new Tuple(Integer.valueOf(-3), Integer.valueOf(-1))); + blacksmithSellingList.put(Integer.valueOf(Item.porkCooked.itemID), new Tuple(Integer.valueOf(-7), Integer.valueOf(-5))); + blacksmithSellingList.put(Integer.valueOf(Item.beefCooked.itemID), new Tuple(Integer.valueOf(-7), Integer.valueOf(-5))); + blacksmithSellingList.put(Integer.valueOf(Item.chickenCooked.itemID), new Tuple(Integer.valueOf(-8), Integer.valueOf(-6))); + blacksmithSellingList.put(Integer.valueOf(Item.eyeOfEnder.itemID), new Tuple(Integer.valueOf(7), Integer.valueOf(11))); + blacksmithSellingList.put(Integer.valueOf(Item.arrow.itemID), new Tuple(Integer.valueOf(-12), Integer.valueOf(-8))); + } +} diff --git a/src/main/java/net/minecraft/src/EntityWaterMob.java b/src/main/java/net/minecraft/src/EntityWaterMob.java new file mode 100644 index 0000000..950685d --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityWaterMob.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +public abstract class EntityWaterMob extends EntityCreature implements IAnimals +{ + public EntityWaterMob(World par1World) + { + super(par1World); + } + + public boolean canBreatheUnderwater() + { + return true; + } + + /** + * Checks if the entity's current position is a valid location to spawn this entity. + */ + public boolean getCanSpawnHere() + { + return this.worldObj.checkNoEntityCollision(this.boundingBox); + } + + /** + * Get number of ticks, at least during which the living entity will be silent. + */ + public int getTalkInterval() + { + return 120; + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return true; + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer par1EntityPlayer) + { + return 1 + this.worldObj.rand.nextInt(3); + } + + /** + * Gets called every tick from main Entity class + */ + public void onEntityUpdate() + { + int var1 = this.getAir(); + super.onEntityUpdate(); + + if (this.isEntityAlive() && !this.isInWater()) + { + --var1; + this.setAir(var1); + + if (this.getAir() == -20) + { + this.setAir(0); + this.attackEntityFrom(DamageSource.drown, 2.0F); + } + } + else + { + this.setAir(300); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityWeatherEffect.java b/src/main/java/net/minecraft/src/EntityWeatherEffect.java new file mode 100644 index 0000000..1d38925 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityWeatherEffect.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public abstract class EntityWeatherEffect extends Entity +{ + public EntityWeatherEffect(World par1World) + { + super(par1World); + } +} diff --git a/src/main/java/net/minecraft/src/EntityWitch.java b/src/main/java/net/minecraft/src/EntityWitch.java new file mode 100644 index 0000000..c0f655d --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityWitch.java @@ -0,0 +1,261 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + +public class EntityWitch extends EntityMob implements IRangedAttackMob +{ + private static final UUID field_110184_bp = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E"); + private static final AttributeModifier field_110185_bq = (new AttributeModifier(field_110184_bp, "Drinking speed penalty", -0.25D, 0)).setSaved(false); + + /** List of items a witch should drop on death. */ + private static final int[] witchDrops = new int[] {Item.glowstone.itemID, Item.sugar.itemID, Item.redstone.itemID, Item.spiderEye.itemID, Item.glassBottle.itemID, Item.gunpowder.itemID, Item.stick.itemID, Item.stick.itemID}; + + /** + * Timer used as interval for a witch's attack, decremented every tick if aggressive and when reaches zero the witch + * will throw a potion at the target entity. + */ + private int witchAttackTimer; + + public EntityWitch(World par1World) + { + super(par1World); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIArrowAttack(this, 1.0D, 60, 10.0F)); + this.tasks.addTask(2, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(3, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); + } + + protected void entityInit() + { + super.entityInit(); + this.getDataWatcher().addObject(21, Byte.valueOf((byte)0)); + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.witch.idle"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.witch.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.witch.death"; + } + + /** + * Set whether this witch is aggressive at an entity. + */ + public void setAggressive(boolean par1) + { + this.getDataWatcher().updateObject(21, Byte.valueOf((byte)(par1 ? 1 : 0))); + } + + /** + * Return whether this witch is aggressive at an entity. + */ + public boolean getAggressive() + { + return this.getDataWatcher().getWatchableObjectByte(21) == 1; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(26.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.25D); + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return true; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (!this.worldObj.isRemote) + { + if (this.getAggressive()) + { + if (this.witchAttackTimer-- <= 0) + { + this.setAggressive(false); + ItemStack var1 = this.getHeldItem(); + this.setCurrentItemOrArmor(0, (ItemStack)null); + + if (var1 != null && var1.itemID == Item.potion.itemID) + { + List var2 = Item.potion.getEffects(var1); + + if (var2 != null) + { + Iterator var3 = var2.iterator(); + + while (var3.hasNext()) + { + PotionEffect var4 = (PotionEffect)var3.next(); + this.addPotionEffect(new PotionEffect(var4)); + } + } + } + + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).removeModifier(field_110185_bq); + } + } + else + { + short var5 = -1; + + if (this.rand.nextFloat() < 0.15F && this.isBurning() && !this.isPotionActive(Potion.fireResistance)) + { + var5 = 16307; + } + else if (this.rand.nextFloat() < 0.05F && this.getHealth() < this.getMaxHealth()) + { + var5 = 16341; + } + else if (this.rand.nextFloat() < 0.25F && this.getAttackTarget() != null && !this.isPotionActive(Potion.moveSpeed) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D) + { + var5 = 16274; + } + else if (this.rand.nextFloat() < 0.25F && this.getAttackTarget() != null && !this.isPotionActive(Potion.moveSpeed) && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D) + { + var5 = 16274; + } + + if (var5 > -1) + { + this.setCurrentItemOrArmor(0, new ItemStack(Item.potion, 1, var5)); + this.witchAttackTimer = this.getHeldItem().getMaxItemUseDuration(); + this.setAggressive(true); + AttributeInstance var6 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + var6.removeModifier(field_110185_bq); + var6.applyModifier(field_110185_bq); + } + } + + if (this.rand.nextFloat() < 7.5E-4F) + { + this.worldObj.setEntityState(this, (byte)15); + } + } + + super.onLivingUpdate(); + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 15) + { + for (int var2 = 0; var2 < this.rand.nextInt(35) + 10; ++var2) + { + this.worldObj.spawnParticle("witchMagic", this.posX + this.rand.nextGaussian() * 0.12999999523162842D, this.boundingBox.maxY + 0.5D + this.rand.nextGaussian() * 0.12999999523162842D, this.posZ + this.rand.nextGaussian() * 0.12999999523162842D, 0.0D, 0.0D, 0.0D); + } + } + else + { + super.handleHealthUpdate(par1); + } + } + + /** + * Reduces damage, depending on potions + */ + protected float applyPotionDamageCalculations(DamageSource par1DamageSource, float par2) + { + par2 = super.applyPotionDamageCalculations(par1DamageSource, par2); + + if (par1DamageSource.getEntity() == this) + { + par2 = 0.0F; + } + + if (par1DamageSource.isMagicDamage()) + { + par2 = (float)((double)par2 * 0.15D); + } + + return par2; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + int var3 = this.rand.nextInt(3) + 1; + + for (int var4 = 0; var4 < var3; ++var4) + { + int var5 = this.rand.nextInt(3); + int var6 = witchDrops[this.rand.nextInt(witchDrops.length)]; + + if (par2 > 0) + { + var5 += this.rand.nextInt(par2 + 1); + } + + for (int var7 = 0; var7 < var5; ++var7) + { + this.dropItem(var6, 1); + } + } + } + + /** + * Attack the specified entity using a ranged attack. + */ + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) + { + if (!this.getAggressive()) + { + EntityPotion var3 = new EntityPotion(this.worldObj, this, 32732); + var3.rotationPitch -= -20.0F; + double var4 = par1EntityLivingBase.posX + par1EntityLivingBase.motionX - this.posX; + double var6 = par1EntityLivingBase.posY + (double)par1EntityLivingBase.getEyeHeight() - 1.100000023841858D - this.posY; + double var8 = par1EntityLivingBase.posZ + par1EntityLivingBase.motionZ - this.posZ; + float var10 = MathHelper.sqrt_double(var4 * var4 + var8 * var8); + + if (var10 >= 8.0F && !par1EntityLivingBase.isPotionActive(Potion.moveSlowdown)) + { + var3.setPotionDamage(32698); + } + else if (par1EntityLivingBase.getHealth() >= 8.0F && !par1EntityLivingBase.isPotionActive(Potion.poison)) + { + var3.setPotionDamage(32660); + } + else if (var10 <= 3.0F && !par1EntityLivingBase.isPotionActive(Potion.weakness) && this.rand.nextFloat() < 0.25F) + { + var3.setPotionDamage(32696); + } + + var3.setThrowableHeading(var4, var6 + (double)(var10 * 0.2F), var8, 0.75F, 8.0F); + this.worldObj.spawnEntityInWorld(var3); + } + } +} diff --git a/src/main/java/net/minecraft/src/EntityWither.java b/src/main/java/net/minecraft/src/EntityWither.java new file mode 100644 index 0000000..d079c59 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityWither.java @@ -0,0 +1,623 @@ +package net.minecraft.src; + +import java.util.List; + +public class EntityWither extends EntityMob implements IBossDisplayData, IRangedAttackMob +{ + private float[] field_82220_d = new float[2]; + private float[] field_82221_e = new float[2]; + private float[] field_82217_f = new float[2]; + private float[] field_82218_g = new float[2]; + private int[] field_82223_h = new int[2]; + private int[] field_82224_i = new int[2]; + private int field_82222_j; + + /** Selector used to determine the entities a wither boss should attack. */ + private static final IEntitySelector attackEntitySelector = new EntityWitherAttackFilter(); + + public EntityWither(World par1World) + { + super(par1World); + this.setHealth(this.getMaxHealth()); + this.setSize(0.9F, 4.0F); + this.isImmuneToFire = true; + this.getNavigator().setCanSwim(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(2, new EntityAIArrowAttack(this, 1.0D, 40, 20.0F)); + this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(7, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, false, attackEntitySelector)); + this.experienceValue = 50; + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(17, new Integer(0)); + this.dataWatcher.addObject(18, new Integer(0)); + this.dataWatcher.addObject(19, new Integer(0)); + this.dataWatcher.addObject(20, new Integer(0)); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("Invul", this.func_82212_n()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.func_82215_s(par1NBTTagCompound.getInteger("Invul")); + } + + public float getShadowSize() + { + return this.height / 8.0F; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.wither.idle"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.wither.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.wither.death"; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + this.motionY *= 0.6000000238418579D; + double var4; + double var6; + double var8; + + if (!this.worldObj.isRemote && this.getWatchedTargetId(0) > 0) + { + Entity var1 = this.worldObj.getEntityByID(this.getWatchedTargetId(0)); + + if (var1 != null) + { + if (this.posY < var1.posY || !this.isArmored() && this.posY < var1.posY + 5.0D) + { + if (this.motionY < 0.0D) + { + this.motionY = 0.0D; + } + + this.motionY += (0.5D - this.motionY) * 0.6000000238418579D; + } + + double var2 = var1.posX - this.posX; + var4 = var1.posZ - this.posZ; + var6 = var2 * var2 + var4 * var4; + + if (var6 > 9.0D) + { + var8 = (double)MathHelper.sqrt_double(var6); + this.motionX += (var2 / var8 * 0.5D - this.motionX) * 0.6000000238418579D; + this.motionZ += (var4 / var8 * 0.5D - this.motionZ) * 0.6000000238418579D; + } + } + } + + if (this.motionX * this.motionX + this.motionZ * this.motionZ > 0.05000000074505806D) + { + this.rotationYaw = (float)Math.atan2(this.motionZ, this.motionX) * (180F / (float)Math.PI) - 90.0F; + } + + super.onLivingUpdate(); + int var20; + + for (var20 = 0; var20 < 2; ++var20) + { + this.field_82218_g[var20] = this.field_82221_e[var20]; + this.field_82217_f[var20] = this.field_82220_d[var20]; + } + + int var21; + + for (var20 = 0; var20 < 2; ++var20) + { + var21 = this.getWatchedTargetId(var20 + 1); + Entity var3 = null; + + if (var21 > 0) + { + var3 = this.worldObj.getEntityByID(var21); + } + + if (var3 != null) + { + var4 = this.func_82214_u(var20 + 1); + var6 = this.func_82208_v(var20 + 1); + var8 = this.func_82213_w(var20 + 1); + double var10 = var3.posX - var4; + double var12 = var3.posY + (double)var3.getEyeHeight() - var6; + double var14 = var3.posZ - var8; + double var16 = (double)MathHelper.sqrt_double(var10 * var10 + var14 * var14); + float var18 = (float)(Math.atan2(var14, var10) * 180.0D / Math.PI) - 90.0F; + float var19 = (float)(-(Math.atan2(var12, var16) * 180.0D / Math.PI)); + this.field_82220_d[var20] = this.func_82204_b(this.field_82220_d[var20], var19, 40.0F); + this.field_82221_e[var20] = this.func_82204_b(this.field_82221_e[var20], var18, 10.0F); + } + else + { + this.field_82221_e[var20] = this.func_82204_b(this.field_82221_e[var20], this.renderYawOffset, 10.0F); + } + } + + boolean var22 = this.isArmored(); + + for (var21 = 0; var21 < 3; ++var21) + { + double var23 = this.func_82214_u(var21); + double var5 = this.func_82208_v(var21); + double var7 = this.func_82213_w(var21); + this.worldObj.spawnParticle("smoke", var23 + this.rand.nextGaussian() * 0.30000001192092896D, var5 + this.rand.nextGaussian() * 0.30000001192092896D, var7 + this.rand.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D); + + if (var22 && this.worldObj.rand.nextInt(4) == 0) + { + this.worldObj.spawnParticle("mobSpell", var23 + this.rand.nextGaussian() * 0.30000001192092896D, var5 + this.rand.nextGaussian() * 0.30000001192092896D, var7 + this.rand.nextGaussian() * 0.30000001192092896D, 0.699999988079071D, 0.699999988079071D, 0.5D); + } + } + + if (this.func_82212_n() > 0) + { + for (var21 = 0; var21 < 3; ++var21) + { + this.worldObj.spawnParticle("mobSpell", this.posX + this.rand.nextGaussian() * 1.0D, this.posY + (double)(this.rand.nextFloat() * 3.3F), this.posZ + this.rand.nextGaussian() * 1.0D, 0.699999988079071D, 0.699999988079071D, 0.8999999761581421D); + } + } + } + + protected void updateAITasks() + { + int var1; + + if (this.func_82212_n() > 0) + { + var1 = this.func_82212_n() - 1; + + if (var1 <= 0) + { + this.worldObj.newExplosion(this, this.posX, this.posY + (double)this.getEyeHeight(), this.posZ, 7.0F, false, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); + this.worldObj.func_82739_e(1013, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + } + + this.func_82215_s(var1); + + if (this.ticksExisted % 10 == 0) + { + this.heal(10.0F); + } + } + else + { + super.updateAITasks(); + int var12; + + for (var1 = 1; var1 < 3; ++var1) + { + if (this.ticksExisted >= this.field_82223_h[var1 - 1]) + { + this.field_82223_h[var1 - 1] = this.ticksExisted + 10 + this.rand.nextInt(10); + + if (this.worldObj.difficultySetting >= 2) + { + int var10001 = var1 - 1; + int var10003 = this.field_82224_i[var1 - 1]; + this.field_82224_i[var10001] = this.field_82224_i[var1 - 1] + 1; + + if (var10003 > 15) + { + float var2 = 10.0F; + float var3 = 5.0F; + double var4 = MathHelper.getRandomDoubleInRange(this.rand, this.posX - (double)var2, this.posX + (double)var2); + double var6 = MathHelper.getRandomDoubleInRange(this.rand, this.posY - (double)var3, this.posY + (double)var3); + double var8 = MathHelper.getRandomDoubleInRange(this.rand, this.posZ - (double)var2, this.posZ + (double)var2); + this.func_82209_a(var1 + 1, var4, var6, var8, true); + this.field_82224_i[var1 - 1] = 0; + } + } + + var12 = this.getWatchedTargetId(var1); + + if (var12 > 0) + { + Entity var14 = this.worldObj.getEntityByID(var12); + + if (var14 != null && var14.isEntityAlive() && this.getDistanceSqToEntity(var14) <= 900.0D && this.canEntityBeSeen(var14)) + { + this.func_82216_a(var1 + 1, (EntityLivingBase)var14); + this.field_82223_h[var1 - 1] = this.ticksExisted + 40 + this.rand.nextInt(20); + this.field_82224_i[var1 - 1] = 0; + } + else + { + this.func_82211_c(var1, 0); + } + } + else + { + List var13 = this.worldObj.selectEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(20.0D, 8.0D, 20.0D), attackEntitySelector); + + for (int var16 = 0; var16 < 10 && !var13.isEmpty(); ++var16) + { + EntityLivingBase var5 = (EntityLivingBase)var13.get(this.rand.nextInt(var13.size())); + + if (var5 != this && var5.isEntityAlive() && this.canEntityBeSeen(var5)) + { + if (var5 instanceof EntityPlayer) + { + if (!((EntityPlayer)var5).capabilities.disableDamage) + { + this.func_82211_c(var1, var5.entityId); + } + } + else + { + this.func_82211_c(var1, var5.entityId); + } + + break; + } + + var13.remove(var5); + } + } + } + } + + if (this.getAttackTarget() != null) + { + this.func_82211_c(0, this.getAttackTarget().entityId); + } + else + { + this.func_82211_c(0, 0); + } + + if (this.field_82222_j > 0) + { + --this.field_82222_j; + + if (this.field_82222_j == 0 && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) + { + var1 = MathHelper.floor_double(this.posY); + var12 = MathHelper.floor_double(this.posX); + int var15 = MathHelper.floor_double(this.posZ); + boolean var17 = false; + + for (int var18 = -1; var18 <= 1; ++var18) + { + for (int var19 = -1; var19 <= 1; ++var19) + { + for (int var7 = 0; var7 <= 3; ++var7) + { + int var20 = var12 + var18; + int var9 = var1 + var7; + int var10 = var15 + var19; + int var11 = this.worldObj.getBlockId(var20, var9, var10); + + if (var11 > 0 && var11 != Block.bedrock.blockID && var11 != Block.endPortal.blockID && var11 != Block.endPortalFrame.blockID) + { + var17 = this.worldObj.destroyBlock(var20, var9, var10, true) || var17; + } + } + } + } + + if (var17) + { + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1012, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + } + } + } + + if (this.ticksExisted % 20 == 0) + { + this.heal(1.0F); + } + } + } + + public void func_82206_m() + { + this.func_82215_s(220); + this.setHealth(this.getMaxHealth() / 3.0F); + } + + /** + * Sets the Entity inside a web block. + */ + public void setInWeb() {} + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + return 4; + } + + private double func_82214_u(int par1) + { + if (par1 <= 0) + { + return this.posX; + } + else + { + float var2 = (this.renderYawOffset + (float)(180 * (par1 - 1))) / 180.0F * (float)Math.PI; + float var3 = MathHelper.cos(var2); + return this.posX + (double)var3 * 1.3D; + } + } + + private double func_82208_v(int par1) + { + return par1 <= 0 ? this.posY + 3.0D : this.posY + 2.2D; + } + + private double func_82213_w(int par1) + { + if (par1 <= 0) + { + return this.posZ; + } + else + { + float var2 = (this.renderYawOffset + (float)(180 * (par1 - 1))) / 180.0F * (float)Math.PI; + float var3 = MathHelper.sin(var2); + return this.posZ + (double)var3 * 1.3D; + } + } + + private float func_82204_b(float par1, float par2, float par3) + { + float var4 = MathHelper.wrapAngleTo180_float(par2 - par1); + + if (var4 > par3) + { + var4 = par3; + } + + if (var4 < -par3) + { + var4 = -par3; + } + + return par1 + var4; + } + + private void func_82216_a(int par1, EntityLivingBase par2EntityLivingBase) + { + this.func_82209_a(par1, par2EntityLivingBase.posX, par2EntityLivingBase.posY + (double)par2EntityLivingBase.getEyeHeight() * 0.5D, par2EntityLivingBase.posZ, par1 == 0 && this.rand.nextFloat() < 0.001F); + } + + private void func_82209_a(int par1, double par2, double par4, double par6, boolean par8) + { + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1014, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + double var9 = this.func_82214_u(par1); + double var11 = this.func_82208_v(par1); + double var13 = this.func_82213_w(par1); + double var15 = par2 - var9; + double var17 = par4 - var11; + double var19 = par6 - var13; + EntityWitherSkull var21 = new EntityWitherSkull(this.worldObj, this, var15, var17, var19); + + if (par8) + { + var21.setInvulnerable(true); + } + + var21.posY = var11; + var21.posX = var9; + var21.posZ = var13; + this.worldObj.spawnEntityInWorld(var21); + } + + /** + * Attack the specified entity using a ranged attack. + */ + public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) + { + this.func_82216_a(0, par1EntityLivingBase); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else if (par1DamageSource == DamageSource.drown) + { + return false; + } + else if (this.func_82212_n() > 0) + { + return false; + } + else + { + Entity var3; + + if (this.isArmored()) + { + var3 = par1DamageSource.getSourceOfDamage(); + + if (var3 instanceof EntityArrow) + { + return false; + } + } + + var3 = par1DamageSource.getEntity(); + + if (var3 != null && !(var3 instanceof EntityPlayer) && var3 instanceof EntityLivingBase && ((EntityLivingBase)var3).getCreatureAttribute() == this.getCreatureAttribute()) + { + return false; + } + else + { + if (this.field_82222_j <= 0) + { + this.field_82222_j = 20; + } + + for (int var4 = 0; var4 < this.field_82224_i.length; ++var4) + { + this.field_82224_i[var4] += 3; + } + + return super.attackEntityFrom(par1DamageSource, par2); + } + } + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean par1, int par2) + { + this.dropItem(Item.netherStar.itemID, 1); + } + + /** + * Makes the entity despawn if requirements are reached + */ + protected void despawnEntity() + { + this.entityAge = 0; + } + + public int getBrightnessForRender(float par1) + { + return 15728880; + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return !this.isDead; + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float par1) {} + + /** + * adds a PotionEffect to the entity + */ + public void addPotionEffect(PotionEffect par1PotionEffect) {} + + /** + * Returns true if the newer Entity AI code should be run + */ + protected boolean isAIEnabled() + { + return true; + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(300.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.6000000238418579D); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(40.0D); + } + + public float func_82207_a(int par1) + { + return this.field_82221_e[par1]; + } + + public float func_82210_r(int par1) + { + return this.field_82220_d[par1]; + } + + public int func_82212_n() + { + return this.dataWatcher.getWatchableObjectInt(20); + } + + public void func_82215_s(int par1) + { + this.dataWatcher.updateObject(20, Integer.valueOf(par1)); + } + + /** + * Returns the target entity ID if present, or -1 if not @param par1 The target offset, should be from 0-2 + */ + public int getWatchedTargetId(int par1) + { + return this.dataWatcher.getWatchableObjectInt(17 + par1); + } + + public void func_82211_c(int par1, int par2) + { + this.dataWatcher.updateObject(17 + par1, Integer.valueOf(par2)); + } + + /** + * Returns whether the wither is armored with its boss armor or not by checking whether its health is below half of + * its maximum. + */ + public boolean isArmored() + { + return this.getHealth() <= this.getMaxHealth() / 2.0F; + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.UNDEAD; + } + + /** + * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. + */ + public void mountEntity(Entity par1Entity) + { + this.ridingEntity = null; + } +} diff --git a/src/main/java/net/minecraft/src/EntityWitherAttackFilter.java b/src/main/java/net/minecraft/src/EntityWitherAttackFilter.java new file mode 100644 index 0000000..2e7efca --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityWitherAttackFilter.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +final class EntityWitherAttackFilter implements IEntitySelector +{ + /** + * Return whether the specified entity is applicable to this filter. + */ + public boolean isEntityApplicable(Entity par1Entity) + { + return par1Entity instanceof EntityLivingBase && ((EntityLivingBase)par1Entity).getCreatureAttribute() != EnumCreatureAttribute.UNDEAD; + } +} diff --git a/src/main/java/net/minecraft/src/EntityWitherSkull.java b/src/main/java/net/minecraft/src/EntityWitherSkull.java new file mode 100644 index 0000000..d2fa68d --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityWitherSkull.java @@ -0,0 +1,140 @@ +package net.minecraft.src; + +public class EntityWitherSkull extends EntityFireball +{ + public EntityWitherSkull(World par1World) + { + super(par1World); + this.setSize(0.3125F, 0.3125F); + } + + public EntityWitherSkull(World par1World, EntityLivingBase par2EntityLivingBase, double par3, double par5, double par7) + { + super(par1World, par2EntityLivingBase, par3, par5, par7); + this.setSize(0.3125F, 0.3125F); + } + + /** + * Return the motion factor for this projectile. The factor is multiplied by the original motion. + */ + protected float getMotionFactor() + { + return this.isInvulnerable() ? 0.73F : super.getMotionFactor(); + } + + public EntityWitherSkull(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) + { + super(par1World, par2, par4, par6, par8, par10, par12); + this.setSize(0.3125F, 0.3125F); + } + + /** + * Returns true if the entity is on fire. Used by render to add the fire effect on rendering. + */ + public boolean isBurning() + { + return false; + } + + /** + * Gets a block's resistance to this entity's explosion. Used to make rails immune to TNT minecarts' explosions and + * Wither skulls more destructive. + */ + public float getBlockExplosionResistance(Explosion par1Explosion, World par2World, int par3, int par4, int par5, Block par6Block) + { + float var7 = super.getBlockExplosionResistance(par1Explosion, par2World, par3, par4, par5, par6Block); + + if (this.isInvulnerable() && par6Block != Block.bedrock && par6Block != Block.endPortal && par6Block != Block.endPortalFrame) + { + var7 = Math.min(0.8F, var7); + } + + return var7; + } + + /** + * Called when this EntityFireball hits a block or entity. + */ + protected void onImpact(MovingObjectPosition par1MovingObjectPosition) + { + if (!this.worldObj.isRemote) + { + if (par1MovingObjectPosition.entityHit != null) + { + if (this.shootingEntity != null) + { + if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.shootingEntity), 8.0F) && !par1MovingObjectPosition.entityHit.isEntityAlive()) + { + this.shootingEntity.heal(5.0F); + } + } + else + { + par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 5.0F); + } + + if (par1MovingObjectPosition.entityHit instanceof EntityLivingBase) + { + byte var2 = 0; + + if (this.worldObj.difficultySetting > 1) + { + if (this.worldObj.difficultySetting == 2) + { + var2 = 10; + } + else if (this.worldObj.difficultySetting == 3) + { + var2 = 40; + } + } + + if (var2 > 0) + { + ((EntityLivingBase)par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.wither.id, 20 * var2, 1)); + } + } + } + + this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 1.0F, false, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); + this.setDead(); + } + } + + /** + * Returns true if other Entities should be prevented from moving through this Entity. + */ + public boolean canBeCollidedWith() + { + return false; + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + return false; + } + + protected void entityInit() + { + this.dataWatcher.addObject(10, Byte.valueOf((byte)0)); + } + + /** + * Return whether this skull comes from an invulnerable (aura) wither boss. + */ + public boolean isInvulnerable() + { + return this.dataWatcher.getWatchableObjectByte(10) == 1; + } + + /** + * Set whether this skull comes from an invulnerable (aura) wither boss. + */ + public void setInvulnerable(boolean par1) + { + this.dataWatcher.updateObject(10, Byte.valueOf((byte)(par1 ? 1 : 0))); + } +} diff --git a/src/main/java/net/minecraft/src/EntityWolf.java b/src/main/java/net/minecraft/src/EntityWolf.java new file mode 100644 index 0000000..0777e72 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityWolf.java @@ -0,0 +1,604 @@ +package net.minecraft.src; + +public class EntityWolf extends EntityTameable +{ + private float field_70926_e; + private float field_70924_f; + + /** true is the wolf is wet else false */ + private boolean isShaking; + private boolean field_70928_h; + + /** + * This time increases while wolf is shaking and emitting water particles. + */ + private float timeWolfIsShaking; + private float prevTimeWolfIsShaking; + + public EntityWolf(World par1World) + { + super(par1World); + this.setSize(0.6F, 0.8F); + this.getNavigator().setAvoidsWater(true); + this.tasks.addTask(1, new EntityAISwimming(this)); + this.tasks.addTask(2, this.aiSit); + this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F)); + this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true)); + this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F)); + this.tasks.addTask(6, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(8, new EntityAIBeg(this, 8.0F)); + this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(9, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this)); + this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this)); + this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true)); + this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false)); + this.setTamed(false); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.30000001192092896D); + + if (this.isTamed()) + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(20.0D); + } + else + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(8.0D); + } + } + + /** + * Returns true if the newer Entity AI code should be run + */ + public boolean isAIEnabled() + { + return true; + } + + /** + * Sets the active target the Task system uses for tracking + */ + public void setAttackTarget(EntityLivingBase par1EntityLivingBase) + { + super.setAttackTarget(par1EntityLivingBase); + + if (par1EntityLivingBase == null) + { + this.setAngry(false); + } + else if (!this.isTamed()) + { + this.setAngry(true); + } + } + + /** + * main AI tick function, replaces updateEntityActionState + */ + protected void updateAITick() + { + this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth())); + } + + protected void entityInit() + { + super.entityInit(); + this.dataWatcher.addObject(18, new Float(this.getHealth())); + this.dataWatcher.addObject(19, new Byte((byte)0)); + this.dataWatcher.addObject(20, new Byte((byte)BlockColored.getBlockFromDye(1))); + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + this.playSound("mob.wolf.step", 0.15F, 1.0F); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setBoolean("Angry", this.isAngry()); + par1NBTTagCompound.setByte("CollarColor", (byte)this.getCollarColor()); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.setAngry(par1NBTTagCompound.getBoolean("Angry")); + + if (par1NBTTagCompound.hasKey("CollarColor")) + { + this.setCollarColor(par1NBTTagCompound.getByte("CollarColor")); + } + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return this.isAngry() ? "mob.wolf.growl" : (this.rand.nextInt(3) == 0 ? (this.isTamed() && this.dataWatcher.getWatchableObjectFloat(18) < 10.0F ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.wolf.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.wolf.death"; + } + + /** + * Returns the volume for the sounds this mob makes. + */ + protected float getSoundVolume() + { + return 0.4F; + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return -1; + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + + if (!this.worldObj.isRemote && this.isShaking && !this.field_70928_h && !this.hasPath() && this.onGround) + { + this.field_70928_h = true; + this.timeWolfIsShaking = 0.0F; + this.prevTimeWolfIsShaking = 0.0F; + this.worldObj.setEntityState(this, (byte)8); + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + this.field_70924_f = this.field_70926_e; + + if (this.func_70922_bv()) + { + this.field_70926_e += (1.0F - this.field_70926_e) * 0.4F; + } + else + { + this.field_70926_e += (0.0F - this.field_70926_e) * 0.4F; + } + + if (this.func_70922_bv()) + { + this.numTicksToChaseTarget = 10; + } + + if (this.isWet()) + { + this.isShaking = true; + this.field_70928_h = false; + this.timeWolfIsShaking = 0.0F; + this.prevTimeWolfIsShaking = 0.0F; + } + else if ((this.isShaking || this.field_70928_h) && this.field_70928_h) + { + if (this.timeWolfIsShaking == 0.0F) + { + this.playSound("mob.wolf.shake", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + } + + this.prevTimeWolfIsShaking = this.timeWolfIsShaking; + this.timeWolfIsShaking += 0.05F; + + if (this.prevTimeWolfIsShaking >= 2.0F) + { + this.isShaking = false; + this.field_70928_h = false; + this.prevTimeWolfIsShaking = 0.0F; + this.timeWolfIsShaking = 0.0F; + } + + if (this.timeWolfIsShaking > 0.4F) + { + float var1 = (float)this.boundingBox.minY; + int var2 = (int)(MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float)Math.PI) * 7.0F); + + for (int var3 = 0; var3 < var2; ++var3) + { + float var4 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; + float var5 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; + this.worldObj.spawnParticle("splash", this.posX + (double)var4, (double)(var1 + 0.8F), this.posZ + (double)var5, this.motionX, this.motionY, this.motionZ); + } + } + } + } + + public boolean getWolfShaking() + { + return this.isShaking; + } + + /** + * Used when calculating the amount of shading to apply while the wolf is shaking. + */ + public float getShadingWhileShaking(float par1) + { + return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * par1) / 2.0F * 0.25F; + } + + public float getShakeAngle(float par1, float par2) + { + float var3 = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * par1 + par2) / 1.8F; + + if (var3 < 0.0F) + { + var3 = 0.0F; + } + else if (var3 > 1.0F) + { + var3 = 1.0F; + } + + return MathHelper.sin(var3 * (float)Math.PI) * MathHelper.sin(var3 * (float)Math.PI * 11.0F) * 0.15F * (float)Math.PI; + } + + public float getInterestedAngle(float par1) + { + return (this.field_70924_f + (this.field_70926_e - this.field_70924_f) * par1) * 0.15F * (float)Math.PI; + } + + public float getEyeHeight() + { + return this.height * 0.8F; + } + + /** + * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently + * use in wolves. + */ + public int getVerticalFaceSpeed() + { + return this.isSitting() ? 20 : super.getVerticalFaceSpeed(); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + Entity var3 = par1DamageSource.getEntity(); + this.aiSit.setSitting(false); + + if (var3 != null && !(var3 instanceof EntityPlayer) && !(var3 instanceof EntityArrow)) + { + par2 = (par2 + 1.0F) / 2.0F; + } + + return super.attackEntityFrom(par1DamageSource, par2); + } + } + + public boolean attackEntityAsMob(Entity par1Entity) + { + int var2 = this.isTamed() ? 4 : 2; + return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)var2); + } + + public void setTamed(boolean par1) + { + super.setTamed(par1); + + if (par1) + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(20.0D); + } + else + { + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(8.0D); + } + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + + if (this.isTamed()) + { + if (var2 != null) + { + if (Item.itemsList[var2.itemID] instanceof ItemFood) + { + ItemFood var3 = (ItemFood)Item.itemsList[var2.itemID]; + + if (var3.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) + { + if (!par1EntityPlayer.capabilities.isCreativeMode) + { + --var2.stackSize; + } + + this.heal((float)var3.getHealAmount()); + + if (var2.stackSize <= 0) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); + } + + return true; + } + } + else if (var2.itemID == Item.dyePowder.itemID) + { + int var4 = BlockColored.getBlockFromDye(var2.getItemDamage()); + + if (var4 != this.getCollarColor()) + { + this.setCollarColor(var4); + + if (!par1EntityPlayer.capabilities.isCreativeMode && --var2.stackSize <= 0) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); + } + + return true; + } + } + } + + if (par1EntityPlayer.getCommandSenderName().equalsIgnoreCase(this.getOwnerName()) && !this.worldObj.isRemote && !this.isBreedingItem(var2)) + { + this.aiSit.setSitting(!this.isSitting()); + this.isJumping = false; + this.setPathToEntity((PathEntity)null); + this.setTarget((Entity)null); + this.setAttackTarget((EntityLivingBase)null); + } + } + else if (var2 != null && var2.itemID == Item.bone.itemID && !this.isAngry()) + { + if (!par1EntityPlayer.capabilities.isCreativeMode) + { + --var2.stackSize; + } + + if (var2.stackSize <= 0) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); + } + + if (!this.worldObj.isRemote) + { + if (this.rand.nextInt(3) == 0) + { + this.setTamed(true); + this.setPathToEntity((PathEntity)null); + this.setAttackTarget((EntityLivingBase)null); + this.aiSit.setSitting(true); + this.setHealth(20.0F); + this.setOwner(par1EntityPlayer.getCommandSenderName()); + this.playTameEffect(true); + this.worldObj.setEntityState(this, (byte)7); + } + else + { + this.playTameEffect(false); + this.worldObj.setEntityState(this, (byte)6); + } + } + + return true; + } + + return super.interact(par1EntityPlayer); + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 8) + { + this.field_70928_h = true; + this.timeWolfIsShaking = 0.0F; + this.prevTimeWolfIsShaking = 0.0F; + } + else + { + super.handleHealthUpdate(par1); + } + } + + public float getTailRotation() + { + return this.isAngry() ? 1.5393804F : (this.isTamed() ? (0.55F - (20.0F - this.dataWatcher.getWatchableObjectFloat(18)) * 0.02F) * (float)Math.PI : ((float)Math.PI / 5F)); + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack par1ItemStack) + { + return par1ItemStack == null ? false : (!(Item.itemsList[par1ItemStack.itemID] instanceof ItemFood) ? false : ((ItemFood)Item.itemsList[par1ItemStack.itemID]).isWolfsFavoriteMeat()); + } + + /** + * Will return how many at most can spawn in a chunk at once. + */ + public int getMaxSpawnedInChunk() + { + return 8; + } + + /** + * Determines whether this wolf is angry or not. + */ + public boolean isAngry() + { + return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0; + } + + /** + * Sets whether this wolf is angry or not. + */ + public void setAngry(boolean par1) + { + byte var2 = this.dataWatcher.getWatchableObjectByte(16); + + if (par1) + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 | 2))); + } + else + { + this.dataWatcher.updateObject(16, Byte.valueOf((byte)(var2 & -3))); + } + } + + /** + * Return this wolf's collar color. + */ + public int getCollarColor() + { + return this.dataWatcher.getWatchableObjectByte(20) & 15; + } + + /** + * Set this wolf's collar color. + */ + public void setCollarColor(int par1) + { + this.dataWatcher.updateObject(20, Byte.valueOf((byte)(par1 & 15))); + } + + /** + * This function is used when two same-species animals in 'love mode' breed to generate the new baby animal. + */ + public EntityWolf spawnBabyAnimal(EntityAgeable par1EntityAgeable) + { + EntityWolf var2 = new EntityWolf(this.worldObj); + String var3 = this.getOwnerName(); + + if (var3 != null && var3.trim().length() > 0) + { + var2.setOwner(var3); + var2.setTamed(true); + } + + return var2; + } + + public void func_70918_i(boolean par1) + { + if (par1) + { + this.dataWatcher.updateObject(19, Byte.valueOf((byte)1)); + } + else + { + this.dataWatcher.updateObject(19, Byte.valueOf((byte)0)); + } + } + + /** + * Returns true if the mob is currently able to mate with the specified mob. + */ + public boolean canMateWith(EntityAnimal par1EntityAnimal) + { + if (par1EntityAnimal == this) + { + return false; + } + else if (!this.isTamed()) + { + return false; + } + else if (!(par1EntityAnimal instanceof EntityWolf)) + { + return false; + } + else + { + EntityWolf var2 = (EntityWolf)par1EntityAnimal; + return !var2.isTamed() ? false : (var2.isSitting() ? false : this.isInLove() && var2.isInLove()); + } + } + + public boolean func_70922_bv() + { + return this.dataWatcher.getWatchableObjectByte(19) == 1; + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return !this.isTamed() && this.ticksExisted > 2400; + } + + public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase) + { + if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast)) + { + if (par1EntityLivingBase instanceof EntityWolf) + { + EntityWolf var3 = (EntityWolf)par1EntityLivingBase; + + if (var3.isTamed() && var3.func_130012_q() == par2EntityLivingBase) + { + return false; + } + } + + return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).canAttackPlayer((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).isTame(); + } + else + { + return false; + } + } + + public EntityAgeable createChild(EntityAgeable par1EntityAgeable) + { + return this.spawnBabyAnimal(par1EntityAgeable); + } +} diff --git a/src/main/java/net/minecraft/src/EntityXPOrb.java b/src/main/java/net/minecraft/src/EntityXPOrb.java new file mode 100644 index 0000000..a9abe92 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityXPOrb.java @@ -0,0 +1,281 @@ +package net.minecraft.src; + +public class EntityXPOrb extends Entity +{ + /** + * A constantly increasing value that RenderXPOrb uses to control the colour shifting (Green / yellow) + */ + public int xpColor; + + /** The age of the XP orb in ticks. */ + public int xpOrbAge; + public int field_70532_c; + + /** The health of this XP orb. */ + private int xpOrbHealth = 5; + + /** This is how much XP this orb has. */ + private int xpValue; + + /** The closest EntityPlayer to this orb. */ + private EntityPlayer closestPlayer; + + /** Threshold color for tracking players */ + private int xpTargetColor; + + public EntityXPOrb(World par1World, double par2, double par4, double par6, int par8) + { + super(par1World); + this.setSize(0.5F, 0.5F); + this.yOffset = this.height / 2.0F; + this.setPosition(par2, par4, par6); + this.rotationYaw = (float)(Math.random() * 360.0D); + this.motionX = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F); + this.motionY = (double)((float)(Math.random() * 0.2D) * 2.0F); + this.motionZ = (double)((float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F); + this.xpValue = par8; + } + + /** + * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to + * prevent them from trampling crops + */ + protected boolean canTriggerWalking() + { + return false; + } + + public EntityXPOrb(World par1World) + { + super(par1World); + this.setSize(0.25F, 0.25F); + this.yOffset = this.height / 2.0F; + } + + protected void entityInit() {} + + public int getBrightnessForRender(float par1) + { + float var2 = 0.5F; + + if (var2 < 0.0F) + { + var2 = 0.0F; + } + + if (var2 > 1.0F) + { + var2 = 1.0F; + } + + int var3 = super.getBrightnessForRender(par1); + int var4 = var3 & 255; + int var5 = var3 >> 16 & 255; + var4 += (int)(var2 * 15.0F * 16.0F); + + if (var4 > 240) + { + var4 = 240; + } + + return var4 | var5 << 16; + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + super.onUpdate(); + + if (this.field_70532_c > 0) + { + --this.field_70532_c; + } + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + this.motionY -= 0.029999999329447746D; + + if (this.worldObj.getBlockMaterial(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) == Material.lava) + { + this.motionY = 0.20000000298023224D; + this.motionX = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.motionZ = (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F); + this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F); + } + + this.pushOutOfBlocks(this.posX, (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D, this.posZ); + double var1 = 8.0D; + + if (this.xpTargetColor < this.xpColor - 20 + this.entityId % 100) + { + if (this.closestPlayer == null || this.closestPlayer.getDistanceSqToEntity(this) > var1 * var1) + { + this.closestPlayer = this.worldObj.getClosestPlayerToEntity(this, var1); + } + + this.xpTargetColor = this.xpColor; + } + + if (this.closestPlayer != null) + { + double var3 = (this.closestPlayer.posX - this.posX) / var1; + double var5 = (this.closestPlayer.posY + (double)this.closestPlayer.getEyeHeight() - this.posY) / var1; + double var7 = (this.closestPlayer.posZ - this.posZ) / var1; + double var9 = Math.sqrt(var3 * var3 + var5 * var5 + var7 * var7); + double var11 = 1.0D - var9; + + if (var11 > 0.0D) + { + var11 *= var11; + this.motionX += var3 / var9 * var11 * 0.1D; + this.motionY += var5 / var9 * var11 * 0.1D; + this.motionZ += var7 / var9 * var11 * 0.1D; + } + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + float var13 = 0.98F; + + if (this.onGround) + { + var13 = 0.58800006F; + int var4 = this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.boundingBox.minY) - 1, MathHelper.floor_double(this.posZ)); + + if (var4 > 0) + { + var13 = Block.blocksList[var4].slipperiness * 0.98F; + } + } + + this.motionX *= (double)var13; + this.motionY *= 0.9800000190734863D; + this.motionZ *= (double)var13; + + if (this.onGround) + { + this.motionY *= -0.8999999761581421D; + } + + ++this.xpColor; + ++this.xpOrbAge; + + if (this.xpOrbAge >= 6000) + { + this.setDead(); + } + } + + /** + * Returns if this entity is in water and will end up adding the waters velocity to the entity + */ + public boolean handleWaterMovement() + { + return this.worldObj.handleMaterialAcceleration(this.boundingBox, Material.water, this); + } + + /** + * Will deal the specified amount of damage to the entity if the entity isn't immune to fire damage. Args: + * amountDamage + */ + protected void dealFireDamage(int par1) + { + this.attackEntityFrom(DamageSource.inFire, (float)par1); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (this.isEntityInvulnerable()) + { + return false; + } + else + { + this.setBeenAttacked(); + this.xpOrbHealth = (int)((float)this.xpOrbHealth - par2); + + if (this.xpOrbHealth <= 0) + { + this.setDead(); + } + + return false; + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setShort("Health", (short)((byte)this.xpOrbHealth)); + par1NBTTagCompound.setShort("Age", (short)this.xpOrbAge); + par1NBTTagCompound.setShort("Value", (short)this.xpValue); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.xpOrbHealth = par1NBTTagCompound.getShort("Health") & 255; + this.xpOrbAge = par1NBTTagCompound.getShort("Age"); + this.xpValue = par1NBTTagCompound.getShort("Value"); + } + + /** + * Called by a player entity when they collide with an entity + */ + public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) + { + if (!this.worldObj.isRemote) + { + if (this.field_70532_c == 0 && par1EntityPlayer.xpCooldown == 0) + { + par1EntityPlayer.xpCooldown = 2; + this.playSound("random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); + par1EntityPlayer.onItemPickup(this, 1); + par1EntityPlayer.addExperience(this.xpValue); + this.setDead(); + } + } + } + + /** + * Returns the XP value of this XP orb. + */ + public int getXpValue() + { + return this.xpValue; + } + + /** + * Returns a number from 1 to 10 based on how much XP this orb is worth. This is used by RenderXPOrb to determine + * what texture to use. + */ + public int getTextureByXP() + { + return this.xpValue >= 2477 ? 10 : (this.xpValue >= 1237 ? 9 : (this.xpValue >= 617 ? 8 : (this.xpValue >= 307 ? 7 : (this.xpValue >= 149 ? 6 : (this.xpValue >= 73 ? 5 : (this.xpValue >= 37 ? 4 : (this.xpValue >= 17 ? 3 : (this.xpValue >= 7 ? 2 : (this.xpValue >= 3 ? 1 : 0))))))))); + } + + /** + * Get xp split rate (Is called until the xp drop code in EntityLiving.onEntityUpdate is complete) + */ + public static int getXPSplit(int par0) + { + return par0 >= 2477 ? 2477 : (par0 >= 1237 ? 1237 : (par0 >= 617 ? 617 : (par0 >= 307 ? 307 : (par0 >= 149 ? 149 : (par0 >= 73 ? 73 : (par0 >= 37 ? 37 : (par0 >= 17 ? 17 : (par0 >= 7 ? 7 : (par0 >= 3 ? 3 : 1))))))))); + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/EntityZombie.java b/src/main/java/net/minecraft/src/EntityZombie.java new file mode 100644 index 0000000..852f577 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityZombie.java @@ -0,0 +1,588 @@ +package net.minecraft.src; + +import java.util.Calendar; +import java.util.UUID; + +public class EntityZombie extends EntityMob +{ + protected static final Attribute field_110186_bp = (new RangedAttribute("zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).func_111117_a("Spawn Reinforcements Chance"); + private static final UUID babySpeedBoostUUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); + private static final AttributeModifier babySpeedBoostModifier = new AttributeModifier(babySpeedBoostUUID, "Baby speed boost", 0.5D, 1); + + /** + * Ticker used to determine the time remaining for this zombie to convert into a villager when cured. + */ + private int conversionTime; + + public EntityZombie(World par1World) + { + super(par1World); + this.getNavigator().setBreakDoors(true); + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIBreakDoor(this)); + this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); + this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true)); + this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); + this.tasks.addTask(5, new EntityAIMoveThroughVillage(this, 1.0D, false)); + this.tasks.addTask(6, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); + this.tasks.addTask(7, new EntityAILookIdle(this)); + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false)); + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(40.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.23000000417232513D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(3.0D); + this.getAttributeMap().func_111150_b(field_110186_bp).setAttribute(this.rand.nextDouble() * 0.10000000149011612D); + } + + protected void entityInit() + { + super.entityInit(); + this.getDataWatcher().addObject(12, Byte.valueOf((byte)0)); + this.getDataWatcher().addObject(13, Byte.valueOf((byte)0)); + this.getDataWatcher().addObject(14, Byte.valueOf((byte)0)); + } + + /** + * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue + */ + public int getTotalArmorValue() + { + int var1 = super.getTotalArmorValue() + 2; + + if (var1 > 20) + { + var1 = 20; + } + + return var1; + } + + /** + * Returns true if the newer Entity AI code should be run + */ + protected boolean isAIEnabled() + { + return true; + } + + /** + * If Animal, checks if the age timer is negative + */ + public boolean isChild() + { + return this.getDataWatcher().getWatchableObjectByte(12) == 1; + } + + /** + * Set whether this zombie is a child. + */ + public void setChild(boolean par1) + { + this.getDataWatcher().updateObject(12, Byte.valueOf((byte)(par1 ? 1 : 0))); + + if (this.worldObj != null && !this.worldObj.isRemote) + { + AttributeInstance var2 = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + var2.removeModifier(babySpeedBoostModifier); + + if (par1) + { + var2.applyModifier(babySpeedBoostModifier); + } + } + } + + /** + * Return whether this zombie is a villager. + */ + public boolean isVillager() + { + return this.getDataWatcher().getWatchableObjectByte(13) == 1; + } + + /** + * Set whether this zombie is a villager. + */ + public void setVillager(boolean par1) + { + this.getDataWatcher().updateObject(13, Byte.valueOf((byte)(par1 ? 1 : 0))); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + if (this.worldObj.isDaytime() && !this.worldObj.isRemote && !this.isChild()) + { + float var1 = this.getBrightness(1.0F); + + if (var1 > 0.5F && this.rand.nextFloat() * 30.0F < (var1 - 0.4F) * 2.0F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ))) + { + boolean var2 = true; + ItemStack var3 = this.getCurrentItemOrArmor(4); + + if (var3 != null) + { + if (var3.isItemStackDamageable()) + { + var3.setItemDamage(var3.getItemDamageForDisplay() + this.rand.nextInt(2)); + + if (var3.getItemDamageForDisplay() >= var3.getMaxDamage()) + { + this.renderBrokenItemStack(var3); + this.setCurrentItemOrArmor(4, (ItemStack)null); + } + } + + var2 = false; + } + + if (var2) + { + this.setFire(8); + } + } + } + + super.onLivingUpdate(); + } + + /** + * Called when the entity is attacked. + */ + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) + { + if (!super.attackEntityFrom(par1DamageSource, par2)) + { + return false; + } + else + { + EntityLivingBase var3 = this.getAttackTarget(); + + if (var3 == null && this.getEntityToAttack() instanceof EntityLivingBase) + { + var3 = (EntityLivingBase)this.getEntityToAttack(); + } + + if (var3 == null && par1DamageSource.getEntity() instanceof EntityLivingBase) + { + var3 = (EntityLivingBase)par1DamageSource.getEntity(); + } + + if (var3 != null && this.worldObj.difficultySetting >= 3 && (double)this.rand.nextFloat() < this.getEntityAttribute(field_110186_bp).getAttributeValue()) + { + int var4 = MathHelper.floor_double(this.posX); + int var5 = MathHelper.floor_double(this.posY); + int var6 = MathHelper.floor_double(this.posZ); + EntityZombie var7 = new EntityZombie(this.worldObj); + + for (int var8 = 0; var8 < 50; ++var8) + { + int var9 = var4 + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); + int var10 = var5 + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); + int var11 = var6 + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1); + + if (this.worldObj.doesBlockHaveSolidTopSurface(var9, var10 - 1, var11) && this.worldObj.getBlockLightValue(var9, var10, var11) < 10) + { + var7.setPosition((double)var9, (double)var10, (double)var11); + + if (this.worldObj.checkNoEntityCollision(var7.boundingBox) && this.worldObj.getCollidingBoundingBoxes(var7, var7.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(var7.boundingBox)) + { + this.worldObj.spawnEntityInWorld(var7); + var7.setAttackTarget(var3); + var7.onSpawnWithEgg((EntityLivingData)null); + this.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); + var7.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); + break; + } + } + } + } + + return true; + } + } + + /** + * Called to update the entity's position/logic. + */ + public void onUpdate() + { + if (!this.worldObj.isRemote && this.isConverting()) + { + int var1 = this.getConversionTimeBoost(); + this.conversionTime -= var1; + + if (this.conversionTime <= 0) + { + this.convertToVillager(); + } + } + + super.onUpdate(); + } + + public boolean attackEntityAsMob(Entity par1Entity) + { + boolean var2 = super.attackEntityAsMob(par1Entity); + + if (var2 && this.getHeldItem() == null && this.isBurning() && this.rand.nextFloat() < (float)this.worldObj.difficultySetting * 0.3F) + { + par1Entity.setFire(2 * this.worldObj.difficultySetting); + } + + return var2; + } + + /** + * Returns the sound this mob makes while it's alive. + */ + protected String getLivingSound() + { + return "mob.zombie.say"; + } + + /** + * Returns the sound this mob makes when it is hurt. + */ + protected String getHurtSound() + { + return "mob.zombie.hurt"; + } + + /** + * Returns the sound this mob makes on death. + */ + protected String getDeathSound() + { + return "mob.zombie.death"; + } + + /** + * Plays step sound at given x, y, z for the entity + */ + protected void playStepSound(int par1, int par2, int par3, int par4) + { + this.playSound("mob.zombie.step", 0.15F, 1.0F); + } + + /** + * Returns the item ID for the item the mob drops on death. + */ + protected int getDropItemId() + { + return Item.rottenFlesh.itemID; + } + + /** + * Get this Entity's EnumCreatureAttribute + */ + public EnumCreatureAttribute getCreatureAttribute() + { + return EnumCreatureAttribute.UNDEAD; + } + + protected void dropRareDrop(int par1) + { + switch (this.rand.nextInt(3)) + { + case 0: + this.dropItem(Item.ingotIron.itemID, 1); + break; + + case 1: + this.dropItem(Item.carrot.itemID, 1); + break; + + case 2: + this.dropItem(Item.potato.itemID, 1); + } + } + + /** + * Makes entity wear random armor based on difficulty + */ + protected void addRandomArmor() + { + super.addRandomArmor(); + + if (this.rand.nextFloat() < (this.worldObj.difficultySetting == 3 ? 0.05F : 0.01F)) + { + int var1 = this.rand.nextInt(3); + + if (var1 == 0) + { + this.setCurrentItemOrArmor(0, new ItemStack(Item.swordIron)); + } + else + { + this.setCurrentItemOrArmor(0, new ItemStack(Item.shovelIron)); + } + } + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + + if (this.isChild()) + { + par1NBTTagCompound.setBoolean("IsBaby", true); + } + + if (this.isVillager()) + { + par1NBTTagCompound.setBoolean("IsVillager", true); + } + + par1NBTTagCompound.setInteger("ConversionTime", this.isConverting() ? this.conversionTime : -1); + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + + if (par1NBTTagCompound.getBoolean("IsBaby")) + { + this.setChild(true); + } + + if (par1NBTTagCompound.getBoolean("IsVillager")) + { + this.setVillager(true); + } + + if (par1NBTTagCompound.hasKey("ConversionTime") && par1NBTTagCompound.getInteger("ConversionTime") > -1) + { + this.startConversion(par1NBTTagCompound.getInteger("ConversionTime")); + } + } + + /** + * This method gets called when the entity kills another one. + */ + public void onKillEntity(EntityLivingBase par1EntityLivingBase) + { + super.onKillEntity(par1EntityLivingBase); + + if (this.worldObj.difficultySetting >= 2 && par1EntityLivingBase instanceof EntityVillager) + { + if (this.worldObj.difficultySetting == 2 && this.rand.nextBoolean()) + { + return; + } + + EntityZombie var2 = new EntityZombie(this.worldObj); + var2.copyLocationAndAnglesFrom(par1EntityLivingBase); + this.worldObj.removeEntity(par1EntityLivingBase); + var2.onSpawnWithEgg((EntityLivingData)null); + var2.setVillager(true); + + if (par1EntityLivingBase.isChild()) + { + var2.setChild(true); + } + + this.worldObj.spawnEntityInWorld(var2); + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + } + } + + public EntityLivingData onSpawnWithEgg(EntityLivingData par1EntityLivingData) + { + Object par1EntityLivingData1 = super.onSpawnWithEgg(par1EntityLivingData); + float var2 = this.worldObj.getLocationTensionFactor(this.posX, this.posY, this.posZ); + this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * var2); + + if (par1EntityLivingData1 == null) + { + par1EntityLivingData1 = new EntityZombieGroupData(this, this.worldObj.rand.nextFloat() < 0.05F, this.worldObj.rand.nextFloat() < 0.05F, (EntityZombieINNER1)null); + } + + if (par1EntityLivingData1 instanceof EntityZombieGroupData) + { + EntityZombieGroupData var3 = (EntityZombieGroupData)par1EntityLivingData1; + + if (var3.field_142046_b) + { + this.setVillager(true); + } + + if (var3.field_142048_a) + { + this.setChild(true); + } + } + + this.addRandomArmor(); + this.enchantEquipment(); + + if (this.getCurrentItemOrArmor(4) == null) + { + Calendar var5 = this.worldObj.getCurrentDate(); + + if (var5.get(2) + 1 == 10 && var5.get(5) == 31 && this.rand.nextFloat() < 0.25F) + { + this.setCurrentItemOrArmor(4, new ItemStack(this.rand.nextFloat() < 0.1F ? Block.pumpkinLantern : Block.pumpkin)); + this.equipmentDropChances[4] = 0.0F; + } + } + + this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextDouble() * 0.05000000074505806D, 0)); + this.getEntityAttribute(SharedMonsterAttributes.followRange).applyModifier(new AttributeModifier("Random zombie-spawn bonus", this.rand.nextDouble() * 1.5D, 2)); + + if (this.rand.nextFloat() < var2 * 0.05F) + { + this.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Leader zombie bonus", this.rand.nextDouble() * 0.25D + 0.5D, 0)); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier("Leader zombie bonus", this.rand.nextDouble() * 3.0D + 1.0D, 2)); + } + + return (EntityLivingData)par1EntityLivingData1; + } + + /** + * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. + */ + public boolean interact(EntityPlayer par1EntityPlayer) + { + ItemStack var2 = par1EntityPlayer.getCurrentEquippedItem(); + + if (var2 != null && var2.getItem() == Item.appleGold && var2.getItemDamage() == 0 && this.isVillager() && this.isPotionActive(Potion.weakness)) + { + if (!par1EntityPlayer.capabilities.isCreativeMode) + { + --var2.stackSize; + } + + if (var2.stackSize <= 0) + { + par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack)null); + } + + if (!this.worldObj.isRemote) + { + this.startConversion(this.rand.nextInt(2401) + 3600); + } + + return true; + } + else + { + return false; + } + } + + /** + * Starts converting this zombie into a villager. The zombie converts into a villager after the specified time in + * ticks. + */ + protected void startConversion(int par1) + { + this.conversionTime = par1; + this.getDataWatcher().updateObject(14, Byte.valueOf((byte)1)); + this.removePotionEffect(Potion.weakness.id); + this.addPotionEffect(new PotionEffect(Potion.damageBoost.id, par1, Math.min(this.worldObj.difficultySetting - 1, 0))); + this.worldObj.setEntityState(this, (byte)16); + } + + public void handleHealthUpdate(byte par1) + { + if (par1 == 16) + { + this.worldObj.playSound(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "mob.zombie.remedy", 1.0F + this.rand.nextFloat(), this.rand.nextFloat() * 0.7F + 0.3F, false); + } + else + { + super.handleHealthUpdate(par1); + } + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return !this.isConverting(); + } + + /** + * Returns whether this zombie is in the process of converting to a villager + */ + public boolean isConverting() + { + return this.getDataWatcher().getWatchableObjectByte(14) == 1; + } + + /** + * Convert this zombie into a villager. + */ + protected void convertToVillager() + { + EntityVillager var1 = new EntityVillager(this.worldObj); + var1.copyLocationAndAnglesFrom(this); + var1.onSpawnWithEgg((EntityLivingData)null); + var1.func_82187_q(); + + if (this.isChild()) + { + var1.setGrowingAge(-24000); + } + + this.worldObj.removeEntity(this); + this.worldObj.spawnEntityInWorld(var1); + var1.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0)); + this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1017, (int)this.posX, (int)this.posY, (int)this.posZ, 0); + } + + /** + * Return the amount of time decremented from conversionTime every tick. + */ + protected int getConversionTimeBoost() + { + int var1 = 1; + + if (this.rand.nextFloat() < 0.01F) + { + int var2 = 0; + + for (int var3 = (int)this.posX - 4; var3 < (int)this.posX + 4 && var2 < 14; ++var3) + { + for (int var4 = (int)this.posY - 4; var4 < (int)this.posY + 4 && var2 < 14; ++var4) + { + for (int var5 = (int)this.posZ - 4; var5 < (int)this.posZ + 4 && var2 < 14; ++var5) + { + int var6 = this.worldObj.getBlockId(var3, var4, var5); + + if (var6 == Block.fenceIron.blockID || var6 == Block.bed.blockID) + { + if (this.rand.nextFloat() < 0.3F) + { + ++var1; + } + + ++var2; + } + } + } + } + } + + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/EntityZombieGroupData.java b/src/main/java/net/minecraft/src/EntityZombieGroupData.java new file mode 100644 index 0000000..168be35 --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityZombieGroupData.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +class EntityZombieGroupData implements EntityLivingData +{ + public boolean field_142048_a; + public boolean field_142046_b; + + final EntityZombie field_142047_c; + + private EntityZombieGroupData(EntityZombie par1EntityZombie, boolean par2, boolean par3) + { + this.field_142047_c = par1EntityZombie; + this.field_142048_a = false; + this.field_142046_b = false; + this.field_142048_a = par2; + this.field_142046_b = par3; + } + + EntityZombieGroupData(EntityZombie par1EntityZombie, boolean par2, boolean par3, EntityZombieINNER1 par4EntityZombieINNER1) + { + this(par1EntityZombie, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/EntityZombieINNER1.java b/src/main/java/net/minecraft/src/EntityZombieINNER1.java new file mode 100644 index 0000000..e1930dc --- /dev/null +++ b/src/main/java/net/minecraft/src/EntityZombieINNER1.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +class EntityZombieINNER1 +{ +} diff --git a/src/main/java/net/minecraft/src/EnumAction.java b/src/main/java/net/minecraft/src/EnumAction.java new file mode 100644 index 0000000..1ea0780 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumAction.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public enum EnumAction +{ + none, + eat, + drink, + block, + bow; +} diff --git a/src/main/java/net/minecraft/src/EnumArmorMaterial.java b/src/main/java/net/minecraft/src/EnumArmorMaterial.java new file mode 100644 index 0000000..9376b3d --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumArmorMaterial.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +public enum EnumArmorMaterial +{ + CLOTH(5, new int[]{1, 3, 2, 1}, 15), + CHAIN(15, new int[]{2, 5, 4, 1}, 12), + IRON(15, new int[]{2, 6, 5, 2}, 9), + GOLD(7, new int[]{2, 5, 3, 1}, 25), + DIAMOND(33, new int[]{3, 8, 6, 3}, 10); + + /** + * Holds the maximum damage factor (each piece multiply this by it's own value) of the material, this is the item + * damage (how much can absorb before breaks) + */ + private int maxDamageFactor; + + /** + * Holds the damage reduction (each 1 points is half a shield on gui) of each piece of armor (helmet, plate, legs + * and boots) + */ + private int[] damageReductionAmountArray; + + /** Return the enchantability factor of the material */ + private int enchantability; + + private EnumArmorMaterial(int par3, int[] par4ArrayOfInteger, int par5) + { + this.maxDamageFactor = par3; + this.damageReductionAmountArray = par4ArrayOfInteger; + this.enchantability = par5; + } + + /** + * Returns the durability for a armor slot of for this type. + */ + public int getDurability(int par1) + { + return ItemArmor.getMaxDamageArray()[par1] * this.maxDamageFactor; + } + + /** + * Return the damage reduction (each 1 point is a half a shield on gui) of the piece index passed (0 = helmet, 1 = + * plate, 2 = legs and 3 = boots) + */ + public int getDamageReductionAmount(int par1) + { + return this.damageReductionAmountArray[par1]; + } + + /** + * Return the enchantability factor of the material. + */ + public int getEnchantability() + { + return this.enchantability; + } + + /** + * Return the crafting material for this armor material, used to determine the item that can be used to repair an + * armor piece with an anvil + */ + public int getArmorCraftingMaterial() + { + return this == CLOTH ? Item.leather.itemID : (this == CHAIN ? Item.ingotIron.itemID : (this == GOLD ? Item.ingotGold.itemID : (this == IRON ? Item.ingotIron.itemID : (this == DIAMOND ? Item.diamond.itemID : 0)))); + } +} diff --git a/src/main/java/net/minecraft/src/EnumArt.java b/src/main/java/net/minecraft/src/EnumArt.java new file mode 100644 index 0000000..a46ab31 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumArt.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +public enum EnumArt +{ + Kebab("Kebab", 16, 16, 0, 0), + Aztec("Aztec", 16, 16, 16, 0), + Alban("Alban", 16, 16, 32, 0), + Aztec2("Aztec2", 16, 16, 48, 0), + Bomb("Bomb", 16, 16, 64, 0), + Plant("Plant", 16, 16, 80, 0), + Wasteland("Wasteland", 16, 16, 96, 0), + Pool("Pool", 32, 16, 0, 32), + Courbet("Courbet", 32, 16, 32, 32), + Sea("Sea", 32, 16, 64, 32), + Sunset("Sunset", 32, 16, 96, 32), + Creebet("Creebet", 32, 16, 128, 32), + Wanderer("Wanderer", 16, 32, 0, 64), + Graham("Graham", 16, 32, 16, 64), + Match("Match", 32, 32, 0, 128), + Bust("Bust", 32, 32, 32, 128), + Stage("Stage", 32, 32, 64, 128), + Void("Void", 32, 32, 96, 128), + SkullAndRoses("SkullAndRoses", 32, 32, 128, 128), + Wither("Wither", 32, 32, 160, 128), + Fighters("Fighters", 64, 32, 0, 96), + Pointer("Pointer", 64, 64, 0, 192), + Pigscene("Pigscene", 64, 64, 64, 192), + BurningSkull("BurningSkull", 64, 64, 128, 192), + Skeleton("Skeleton", 64, 48, 192, 64), + DonkeyKong("DonkeyKong", 64, 48, 192, 112); + + /** Holds the maximum length of paintings art title. */ + public static final int maxArtTitleLength = "SkullAndRoses".length(); + + /** Painting Title. */ + public final String title; + public final int sizeX; + public final int sizeY; + public final int offsetX; + public final int offsetY; + + private EnumArt(String par3Str, int par4, int par5, int par6, int par7) + { + this.title = par3Str; + this.sizeX = par4; + this.sizeY = par5; + this.offsetX = par6; + this.offsetY = par7; + } +} diff --git a/src/main/java/net/minecraft/src/EnumChatFormatting.java b/src/main/java/net/minecraft/src/EnumChatFormatting.java new file mode 100644 index 0000000..6b26716 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumChatFormatting.java @@ -0,0 +1,120 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Pattern; + +public enum EnumChatFormatting +{ + BLACK('0'), + DARK_BLUE('1'), + DARK_GREEN('2'), + DARK_AQUA('3'), + DARK_RED('4'), + DARK_PURPLE('5'), + GOLD('6'), + GRAY('7'), + DARK_GRAY('8'), + BLUE('9'), + GREEN('a'), + AQUA('b'), + RED('c'), + LIGHT_PURPLE('d'), + YELLOW('e'), + WHITE('f'), + OBFUSCATED('k', true), + BOLD('l', true), + STRIKETHROUGH('m', true), + UNDERLINE('n', true), + ITALIC('o', true), + RESET('r'); + private static final Map field_96321_w = new HashMap(); + private static final Map field_96331_x = new HashMap(); + private static final Pattern field_96330_y = Pattern.compile("(?i)" + String.valueOf('\u00a7') + "[0-9A-FK-OR]"); + private final char field_96329_z; + private final boolean field_96303_A; + private final String field_96304_B; + + private EnumChatFormatting(char par3) + { + this(par3, false); + } + + private EnumChatFormatting(char par3, boolean par4) + { + this.field_96329_z = par3; + this.field_96303_A = par4; + this.field_96304_B = "\u00a7" + par3; + } + + public char func_96298_a() + { + return this.field_96329_z; + } + + public boolean func_96301_b() + { + return this.field_96303_A; + } + + /** + * Checks if typo is a color. + */ + public boolean isColor() + { + return !this.field_96303_A && this != RESET; + } + + public String func_96297_d() + { + return this.name().toLowerCase(); + } + + public String toString() + { + return this.field_96304_B; + } + + public static String func_110646_a(String par0Str) + { + return par0Str == null ? null : field_96330_y.matcher(par0Str).replaceAll(""); + } + + public static EnumChatFormatting func_96300_b(String par0Str) + { + return par0Str == null ? null : (EnumChatFormatting)field_96331_x.get(par0Str.toLowerCase()); + } + + public static Collection func_96296_a(boolean par0, boolean par1) + { + ArrayList var2 = new ArrayList(); + EnumChatFormatting[] var3 = values(); + int var4 = var3.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + EnumChatFormatting var6 = var3[var5]; + + if ((!var6.isColor() || par0) && (!var6.func_96301_b() || par1)) + { + var2.add(var6.func_96297_d()); + } + } + + return var2; + } + + static { + EnumChatFormatting[] var0 = values(); + int var1 = var0.length; + + for (int var2 = 0; var2 < var1; ++var2) + { + EnumChatFormatting var3 = var0[var2]; + field_96321_w.put(Character.valueOf(var3.func_96298_a()), var3); + field_96331_x.put(var3.func_96297_d(), var3); + } + } +} diff --git a/src/main/java/net/minecraft/src/EnumCreatureAttribute.java b/src/main/java/net/minecraft/src/EnumCreatureAttribute.java new file mode 100644 index 0000000..a1d101f --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumCreatureAttribute.java @@ -0,0 +1,8 @@ +package net.minecraft.src; + +public enum EnumCreatureAttribute +{ + UNDEFINED, + UNDEAD, + ARTHROPOD; +} diff --git a/src/main/java/net/minecraft/src/EnumCreatureType.java b/src/main/java/net/minecraft/src/EnumCreatureType.java new file mode 100644 index 0000000..c8ceaee --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumCreatureType.java @@ -0,0 +1,63 @@ +package net.minecraft.src; + +public enum EnumCreatureType +{ + monster(IMob.class, 70, Material.air, false, false), + creature(EntityAnimal.class, 10, Material.air, true, true), + ambient(EntityAmbientCreature.class, 15, Material.air, true, false), + waterCreature(EntityWaterMob.class, 5, Material.water, true, false); + + /** + * The root class of creatures associated with this EnumCreatureType (IMobs for aggressive creatures, EntityAnimals + * for friendly ones) + */ + private final Class creatureClass; + private final int maxNumberOfCreature; + private final Material creatureMaterial; + + /** A flag indicating whether this creature type is peaceful. */ + private final boolean isPeacefulCreature; + + /** Whether this creature type is an animal. */ + private final boolean isAnimal; + + private EnumCreatureType(Class par3Class, int par4, Material par5Material, boolean par6, boolean par7) + { + this.creatureClass = par3Class; + this.maxNumberOfCreature = par4; + this.creatureMaterial = par5Material; + this.isPeacefulCreature = par6; + this.isAnimal = par7; + } + + public Class getCreatureClass() + { + return this.creatureClass; + } + + public int getMaxNumberOfCreature() + { + return this.maxNumberOfCreature; + } + + public Material getCreatureMaterial() + { + return this.creatureMaterial; + } + + /** + * Gets whether or not this creature type is peaceful. + */ + public boolean getPeacefulCreature() + { + return this.isPeacefulCreature; + } + + /** + * Return whether this creature type is an animal. + */ + public boolean getAnimal() + { + return this.isAnimal; + } +} diff --git a/src/main/java/net/minecraft/src/EnumDoor.java b/src/main/java/net/minecraft/src/EnumDoor.java new file mode 100644 index 0000000..8c2b450 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumDoor.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public enum EnumDoor +{ + OPENING, + WOOD_DOOR, + GRATES, + IRON_DOOR; +} diff --git a/src/main/java/net/minecraft/src/EnumDoorHelper.java b/src/main/java/net/minecraft/src/EnumDoorHelper.java new file mode 100644 index 0000000..6034170 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumDoorHelper.java @@ -0,0 +1,45 @@ +package net.minecraft.src; + +class EnumDoorHelper +{ + static final int[] doorEnum = new int[EnumDoor.values().length]; + + static + { + try + { + doorEnum[EnumDoor.OPENING.ordinal()] = 1; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + doorEnum[EnumDoor.WOOD_DOOR.ordinal()] = 2; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + doorEnum[EnumDoor.GRATES.ordinal()] = 3; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + doorEnum[EnumDoor.IRON_DOOR.ordinal()] = 4; + } + catch (NoSuchFieldError var1) + { + ; + } + } +} diff --git a/src/main/java/net/minecraft/src/EnumEnchantmentType.java b/src/main/java/net/minecraft/src/EnumEnchantmentType.java new file mode 100644 index 0000000..92715ff --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumEnchantmentType.java @@ -0,0 +1,41 @@ +package net.minecraft.src; + +public enum EnumEnchantmentType +{ + all, + armor, + armor_feet, + armor_legs, + armor_torso, + armor_head, + weapon, + digger, + bow; + + /** + * Return true if the item passed can be enchanted by a enchantment of this type. + */ + public boolean canEnchantItem(Item par1Item) + { + if (this == all) + { + return true; + } + else if (par1Item instanceof ItemArmor) + { + if (this == armor) + { + return true; + } + else + { + ItemArmor var2 = (ItemArmor)par1Item; + return var2.armorType == 0 ? this == armor_head : (var2.armorType == 2 ? this == armor_legs : (var2.armorType == 1 ? this == armor_torso : (var2.armorType == 3 ? this == armor_feet : false))); + } + } + else + { + return par1Item instanceof ItemSword ? this == weapon : (par1Item instanceof ItemTool ? this == digger : (par1Item instanceof ItemBow ? this == bow : false)); + } + } +} diff --git a/src/main/java/net/minecraft/src/EnumEntitySize.java b/src/main/java/net/minecraft/src/EnumEntitySize.java new file mode 100644 index 0000000..594b472 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumEntitySize.java @@ -0,0 +1,98 @@ +package net.minecraft.src; + +public enum EnumEntitySize +{ + SIZE_1, + SIZE_2, + SIZE_3, + SIZE_4, + SIZE_5, + SIZE_6; + + public int multiplyBy32AndRound(double par1) + { + double var3 = par1 - ((double)MathHelper.floor_double(par1) + 0.5D); + + switch (EnumEntitySizeHelper.field_96565_a[this.ordinal()]) + { + case 1: + if (var3 < 0.0D) + { + if (var3 < -0.3125D) + { + return MathHelper.ceiling_double_int(par1 * 32.0D); + } + } + else if (var3 < 0.3125D) + { + return MathHelper.ceiling_double_int(par1 * 32.0D); + } + + return MathHelper.floor_double(par1 * 32.0D); + + case 2: + if (var3 < 0.0D) + { + if (var3 < -0.3125D) + { + return MathHelper.floor_double(par1 * 32.0D); + } + } + else if (var3 < 0.3125D) + { + return MathHelper.floor_double(par1 * 32.0D); + } + + return MathHelper.ceiling_double_int(par1 * 32.0D); + + case 3: + if (var3 > 0.0D) + { + return MathHelper.floor_double(par1 * 32.0D); + } + + return MathHelper.ceiling_double_int(par1 * 32.0D); + + case 4: + if (var3 < 0.0D) + { + if (var3 < -0.1875D) + { + return MathHelper.ceiling_double_int(par1 * 32.0D); + } + } + else if (var3 < 0.1875D) + { + return MathHelper.ceiling_double_int(par1 * 32.0D); + } + + return MathHelper.floor_double(par1 * 32.0D); + + case 5: + if (var3 < 0.0D) + { + if (var3 < -0.1875D) + { + return MathHelper.floor_double(par1 * 32.0D); + } + } + else if (var3 < 0.1875D) + { + return MathHelper.floor_double(par1 * 32.0D); + } + + return MathHelper.ceiling_double_int(par1 * 32.0D); + + case 6: + default: + if (var3 > 0.0D) + { + return MathHelper.ceiling_double_int(par1 * 32.0D); + } + else + { + return MathHelper.floor_double(par1 * 32.0D); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/EnumEntitySizeHelper.java b/src/main/java/net/minecraft/src/EnumEntitySizeHelper.java new file mode 100644 index 0000000..c290270 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumEntitySizeHelper.java @@ -0,0 +1,63 @@ +package net.minecraft.src; + +class EnumEntitySizeHelper +{ + static final int[] field_96565_a = new int[EnumEntitySize.values().length]; + + static + { + try + { + field_96565_a[EnumEntitySize.SIZE_1.ordinal()] = 1; + } + catch (NoSuchFieldError var6) + { + ; + } + + try + { + field_96565_a[EnumEntitySize.SIZE_2.ordinal()] = 2; + } + catch (NoSuchFieldError var5) + { + ; + } + + try + { + field_96565_a[EnumEntitySize.SIZE_3.ordinal()] = 3; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + field_96565_a[EnumEntitySize.SIZE_4.ordinal()] = 4; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + field_96565_a[EnumEntitySize.SIZE_5.ordinal()] = 5; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + field_96565_a[EnumEntitySize.SIZE_6.ordinal()] = 6; + } + catch (NoSuchFieldError var1) + { + ; + } + } +} diff --git a/src/main/java/net/minecraft/src/EnumFacing.java b/src/main/java/net/minecraft/src/EnumFacing.java new file mode 100644 index 0000000..e34bfe8 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumFacing.java @@ -0,0 +1,72 @@ +package net.minecraft.src; + +public enum EnumFacing +{ + DOWN(0, 1, 0, -1, 0), + UP(1, 0, 0, 1, 0), + NORTH(2, 3, 0, 0, -1), + SOUTH(3, 2, 0, 0, 1), + EAST(4, 5, -1, 0, 0), + WEST(5, 4, 1, 0, 0); + + /** Face order for D-U-N-S-E-W. */ + private final int order_a; + + /** Face order for U-D-S-N-W-E. */ + private final int order_b; + private final int frontOffsetX; + private final int frontOffsetY; + private final int frontOffsetZ; + + /** List of all values in EnumFacing. Order is D-U-N-S-E-W. */ + private static final EnumFacing[] faceList = new EnumFacing[6]; + + private EnumFacing(int par3, int par4, int par5, int par6, int par7) + { + this.order_a = par3; + this.order_b = par4; + this.frontOffsetX = par5; + this.frontOffsetY = par6; + this.frontOffsetZ = par7; + } + + /** + * Returns a offset that addresses the block in front of this facing. + */ + public int getFrontOffsetX() + { + return this.frontOffsetX; + } + + public int getFrontOffsetY() + { + return this.frontOffsetY; + } + + /** + * Returns a offset that addresses the block in front of this facing. + */ + public int getFrontOffsetZ() + { + return this.frontOffsetZ; + } + + /** + * Returns the facing that represents the block in front of it. + */ + public static EnumFacing getFront(int par0) + { + return faceList[par0 % faceList.length]; + } + + static { + EnumFacing[] var0 = values(); + int var1 = var0.length; + + for (int var2 = 0; var2 < var1; ++var2) + { + EnumFacing var3 = var0[var2]; + faceList[var3.order_a] = var3; + } + } +} diff --git a/src/main/java/net/minecraft/src/EnumGameType.java b/src/main/java/net/minecraft/src/EnumGameType.java new file mode 100644 index 0000000..4f2c6f1 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumGameType.java @@ -0,0 +1,121 @@ +package net.minecraft.src; + +public enum EnumGameType +{ + NOT_SET(-1, ""), + SURVIVAL(0, "survival"), + CREATIVE(1, "creative"), + ADVENTURE(2, "adventure"); + int id; + String name; + + private EnumGameType(int par3, String par4Str) + { + this.id = par3; + this.name = par4Str; + } + + /** + * Returns the ID of this game type + */ + public int getID() + { + return this.id; + } + + /** + * Returns the name of this game type + */ + public String getName() + { + return this.name; + } + + /** + * Configures the player capabilities based on the game type + */ + public void configurePlayerCapabilities(PlayerCapabilities par1PlayerCapabilities) + { + if (this == CREATIVE) + { + par1PlayerCapabilities.allowFlying = true; + par1PlayerCapabilities.isCreativeMode = true; + par1PlayerCapabilities.disableDamage = true; + } + else + { + par1PlayerCapabilities.allowFlying = false; + par1PlayerCapabilities.isCreativeMode = false; + par1PlayerCapabilities.disableDamage = false; + par1PlayerCapabilities.isFlying = false; + } + + par1PlayerCapabilities.allowEdit = !this.isAdventure(); + } + + /** + * Returns true if this is the ADVENTURE game type + */ + public boolean isAdventure() + { + return this == ADVENTURE; + } + + /** + * Returns true if this is the CREATIVE game type + */ + public boolean isCreative() + { + return this == CREATIVE; + } + + /** + * Returns true if this is the SURVIVAL or ADVENTURE game type + */ + public boolean isSurvivalOrAdventure() + { + return this == SURVIVAL || this == ADVENTURE; + } + + /** + * Returns the game type with the specified ID, or SURVIVAL if none found. Args: id + */ + public static EnumGameType getByID(int par0) + { + EnumGameType[] var1 = values(); + int var2 = var1.length; + + for (int var3 = 0; var3 < var2; ++var3) + { + EnumGameType var4 = var1[var3]; + + if (var4.id == par0) + { + return var4; + } + } + + return SURVIVAL; + } + + /** + * Returns the game type with the specified name, or SURVIVAL if none found. This is case sensitive. Args: name + */ + public static EnumGameType getByName(String par0Str) + { + EnumGameType[] var1 = values(); + int var2 = var1.length; + + for (int var3 = 0; var3 < var2; ++var3) + { + EnumGameType var4 = var1[var3]; + + if (var4.name.equals(par0Str)) + { + return var4; + } + } + + return SURVIVAL; + } +} diff --git a/src/main/java/net/minecraft/src/EnumMobType.java b/src/main/java/net/minecraft/src/EnumMobType.java new file mode 100644 index 0000000..3f712f2 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumMobType.java @@ -0,0 +1,8 @@ +package net.minecraft.src; + +public enum EnumMobType +{ + everything, + mobs, + players; +} diff --git a/src/main/java/net/minecraft/src/EnumMovingObjectType.java b/src/main/java/net/minecraft/src/EnumMovingObjectType.java new file mode 100644 index 0000000..1d0f907 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumMovingObjectType.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public enum EnumMovingObjectType +{ + TILE, + ENTITY; +} diff --git a/src/main/java/net/minecraft/src/EnumOS.java b/src/main/java/net/minecraft/src/EnumOS.java new file mode 100644 index 0000000..79ba36f --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumOS.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public enum EnumOS +{ + LINUX, + SOLARIS, + WINDOWS, + MACOS, + UNKNOWN; +} diff --git a/src/main/java/net/minecraft/src/EnumOptions.java b/src/main/java/net/minecraft/src/EnumOptions.java new file mode 100644 index 0000000..9f58dcb --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumOptions.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +public enum EnumOptions +{ + MUSIC("options.music", true, false), + SOUND("options.sound", true, false), + INVERT_MOUSE("options.invertMouse", false, true), + SENSITIVITY("options.sensitivity", true, false), + FOV("options.fov", true, false), + GAMMA("options.gamma", true, false), + RENDER_DISTANCE("options.renderDistance", false, false), + VIEW_BOBBING("options.viewBobbing", false, true), + ANAGLYPH("options.anaglyph", false, true), + ADVANCED_OPENGL("options.advancedOpengl", false, true), + FRAMERATE_LIMIT("options.framerateLimit", false, false), + DIFFICULTY("options.difficulty", false, false), + GRAPHICS("options.graphics", false, false), + AMBIENT_OCCLUSION("options.ao", false, false), + GUI_SCALE("options.guiScale", false, false), + RENDER_CLOUDS("options.renderClouds", false, true), + PARTICLES("options.particles", false, false), + CHAT_VISIBILITY("options.chat.visibility", false, false), + CHAT_COLOR("options.chat.color", false, true), + CHAT_LINKS("options.chat.links", false, true), + CHAT_OPACITY("options.chat.opacity", true, false), + CHAT_LINKS_PROMPT("options.chat.links.prompt", false, true), + USE_SERVER_TEXTURES("options.serverTextures", false, true), + SNOOPER_ENABLED("options.snooper", false, true), + USE_FULLSCREEN("options.fullscreen", false, true), + ENABLE_VSYNC("options.vsync", false, true), + SHOW_CAPE("options.showCape", false, true), + TOUCHSCREEN("options.touchscreen", false, true), + CHAT_SCALE("options.chat.scale", true, false), + CHAT_WIDTH("options.chat.width", true, false), + CHAT_HEIGHT_FOCUSED("options.chat.height.focused", true, false), + CHAT_HEIGHT_UNFOCUSED("options.chat.height.unfocused", true, false); + private final boolean enumFloat; + private final boolean enumBoolean; + private final String enumString; + + public static EnumOptions getEnumOptions(int par0) + { + EnumOptions[] var1 = values(); + int var2 = var1.length; + + for (int var3 = 0; var3 < var2; ++var3) + { + EnumOptions var4 = var1[var3]; + + if (var4.returnEnumOrdinal() == par0) + { + return var4; + } + } + + return null; + } + + private EnumOptions(String par3Str, boolean par4, boolean par5) + { + this.enumString = par3Str; + this.enumFloat = par4; + this.enumBoolean = par5; + } + + public boolean getEnumFloat() + { + return this.enumFloat; + } + + public boolean getEnumBoolean() + { + return this.enumBoolean; + } + + public int returnEnumOrdinal() + { + return this.ordinal(); + } + + public String getEnumString() + { + return this.enumString; + } +} diff --git a/src/main/java/net/minecraft/src/EnumOptionsHelper.java b/src/main/java/net/minecraft/src/EnumOptionsHelper.java new file mode 100644 index 0000000..7a88b33 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumOptionsHelper.java @@ -0,0 +1,135 @@ +package net.minecraft.src; + +class EnumOptionsHelper +{ + static final int[] enumOptionsMappingHelperArray = new int[EnumOptions.values().length]; + + static + { + try + { + enumOptionsMappingHelperArray[EnumOptions.INVERT_MOUSE.ordinal()] = 1; + } + catch (NoSuchFieldError var14) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.VIEW_BOBBING.ordinal()] = 2; + } + catch (NoSuchFieldError var13) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.ANAGLYPH.ordinal()] = 3; + } + catch (NoSuchFieldError var12) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.ADVANCED_OPENGL.ordinal()] = 4; + } + catch (NoSuchFieldError var11) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.RENDER_CLOUDS.ordinal()] = 5; + } + catch (NoSuchFieldError var10) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.CHAT_COLOR.ordinal()] = 6; + } + catch (NoSuchFieldError var9) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.CHAT_LINKS.ordinal()] = 7; + } + catch (NoSuchFieldError var8) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.CHAT_LINKS_PROMPT.ordinal()] = 8; + } + catch (NoSuchFieldError var7) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.USE_SERVER_TEXTURES.ordinal()] = 9; + } + catch (NoSuchFieldError var6) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.SNOOPER_ENABLED.ordinal()] = 10; + } + catch (NoSuchFieldError var5) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.USE_FULLSCREEN.ordinal()] = 11; + } + catch (NoSuchFieldError var4) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.ENABLE_VSYNC.ordinal()] = 12; + } + catch (NoSuchFieldError var3) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.SHOW_CAPE.ordinal()] = 13; + } + catch (NoSuchFieldError var2) + { + ; + } + + try + { + enumOptionsMappingHelperArray[EnumOptions.TOUCHSCREEN.ordinal()] = 14; + } + catch (NoSuchFieldError var1) + { + ; + } + } +} diff --git a/src/main/java/net/minecraft/src/EnumRarity.java b/src/main/java/net/minecraft/src/EnumRarity.java new file mode 100644 index 0000000..10edf71 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumRarity.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +public enum EnumRarity +{ + common(15, "Common"), + uncommon(14, "Uncommon"), + rare(11, "Rare"), + epic(13, "Epic"); + + /** + * A decimal representation of the hex color codes of a the color assigned to this rarity type. (13 becomes d as in + * \247d which is light purple) + */ + public final int rarityColor; + + /** Rarity name. */ + public final String rarityName; + + private EnumRarity(int par3, String par4Str) + { + this.rarityColor = par3; + this.rarityName = par4Str; + } +} diff --git a/src/main/java/net/minecraft/src/EnumSkyBlock.java b/src/main/java/net/minecraft/src/EnumSkyBlock.java new file mode 100644 index 0000000..432de98 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumSkyBlock.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +public enum EnumSkyBlock +{ + Sky(15), + Block(0); + public final int defaultLightValue; + + private EnumSkyBlock(int par3) + { + this.defaultLightValue = par3; + } +} diff --git a/src/main/java/net/minecraft/src/EnumStatus.java b/src/main/java/net/minecraft/src/EnumStatus.java new file mode 100644 index 0000000..9cb231c --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumStatus.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public enum EnumStatus +{ + OK, + NOT_POSSIBLE_HERE, + NOT_POSSIBLE_NOW, + TOO_FAR_AWAY, + OTHER_PROBLEM, + NOT_SAFE; +} diff --git a/src/main/java/net/minecraft/src/EnumToolMaterial.java b/src/main/java/net/minecraft/src/EnumToolMaterial.java new file mode 100644 index 0000000..e0412c5 --- /dev/null +++ b/src/main/java/net/minecraft/src/EnumToolMaterial.java @@ -0,0 +1,89 @@ +package net.minecraft.src; + +public enum EnumToolMaterial +{ + WOOD(0, 59, 2.0F, 0.0F, 15), + STONE(1, 131, 4.0F, 1.0F, 5), + IRON(2, 250, 6.0F, 2.0F, 14), + EMERALD(3, 1561, 8.0F, 3.0F, 10), + GOLD(0, 32, 12.0F, 0.0F, 22); + + /** + * The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD) + */ + private final int harvestLevel; + + /** + * The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32) + */ + private final int maxUses; + + /** + * The strength of this tool material against blocks which it is effective against. + */ + private final float efficiencyOnProperMaterial; + + /** Damage versus entities. */ + private final float damageVsEntity; + + /** Defines the natural enchantability factor of the material. */ + private final int enchantability; + + private EnumToolMaterial(int par3, int par4, float par5, float par6, int par7) + { + this.harvestLevel = par3; + this.maxUses = par4; + this.efficiencyOnProperMaterial = par5; + this.damageVsEntity = par6; + this.enchantability = par7; + } + + /** + * The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32) + */ + public int getMaxUses() + { + return this.maxUses; + } + + /** + * The strength of this tool material against blocks which it is effective against. + */ + public float getEfficiencyOnProperMaterial() + { + return this.efficiencyOnProperMaterial; + } + + /** + * Damage versus entities. + */ + public float getDamageVsEntity() + { + return this.damageVsEntity; + } + + /** + * The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD) + */ + public int getHarvestLevel() + { + return this.harvestLevel; + } + + /** + * Return the natural enchantability factor of the material. + */ + public int getEnchantability() + { + return this.enchantability; + } + + /** + * Return the crafting material for this tool material, used to determine the item that can be used to repair a tool + * with an anvil + */ + public int getToolCraftingMaterial() + { + return this == WOOD ? Block.planks.blockID : (this == STONE ? Block.cobblestone.blockID : (this == GOLD ? Item.ingotGold.itemID : (this == IRON ? Item.ingotIron.itemID : (this == EMERALD ? Item.diamond.itemID : 0)))); + } +} diff --git a/src/main/java/net/minecraft/src/ExceptionMcoHttp.java b/src/main/java/net/minecraft/src/ExceptionMcoHttp.java new file mode 100644 index 0000000..edb78ec --- /dev/null +++ b/src/main/java/net/minecraft/src/ExceptionMcoHttp.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public class ExceptionMcoHttp extends RuntimeException +{ + public ExceptionMcoHttp(String par1Str, Exception par2Exception) + { + super(par1Str, par2Exception); + } +} diff --git a/src/main/java/net/minecraft/src/ExceptionMcoService.java b/src/main/java/net/minecraft/src/ExceptionMcoService.java new file mode 100644 index 0000000..d020726 --- /dev/null +++ b/src/main/java/net/minecraft/src/ExceptionMcoService.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public class ExceptionMcoService extends Exception +{ + public final int field_96392_a; + public final String field_96391_b; + public final int field_130097_c; + + public ExceptionMcoService(int par1, String par2Str, int par3) + { + super(par2Str); + this.field_96392_a = par1; + this.field_96391_b = par2Str; + this.field_130097_c = par3; + } + + public String toString() + { + return this.field_130097_c != -1 ? "Realms ( ErrorCode: " + this.field_130097_c + " )" : "Realms: " + this.field_96391_b; + } +} diff --git a/src/main/java/net/minecraft/src/ExceptionRetryCall.java b/src/main/java/net/minecraft/src/ExceptionRetryCall.java new file mode 100644 index 0000000..e0a9e6d --- /dev/null +++ b/src/main/java/net/minecraft/src/ExceptionRetryCall.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +public class ExceptionRetryCall extends ExceptionMcoService +{ + public final int field_96393_c; + + public ExceptionRetryCall(int par1) + { + super(503, "Retry operation", -1); + this.field_96393_c = par1; + } +} diff --git a/src/main/java/net/minecraft/src/Explosion.java b/src/main/java/net/minecraft/src/Explosion.java new file mode 100644 index 0000000..fe37af8 --- /dev/null +++ b/src/main/java/net/minecraft/src/Explosion.java @@ -0,0 +1,254 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public class Explosion +{ + /** whether or not the explosion sets fire to blocks around it */ + public boolean isFlaming; + + /** whether or not this explosion spawns smoke particles */ + public boolean isSmoking = true; + private int field_77289_h = 16; + private Random explosionRNG = new Random(); + private World worldObj; + public double explosionX; + public double explosionY; + public double explosionZ; + public Entity exploder; + public float explosionSize; + + /** A list of ChunkPositions of blocks affected by this explosion */ + public List affectedBlockPositions = new ArrayList(); + private Map field_77288_k = new HashMap(); + + public Explosion(World par1World, Entity par2Entity, double par3, double par5, double par7, float par9) + { + this.worldObj = par1World; + this.exploder = par2Entity; + this.explosionSize = par9; + this.explosionX = par3; + this.explosionY = par5; + this.explosionZ = par7; + } + + /** + * Does the first part of the explosion (destroy blocks) + */ + public void doExplosionA() + { + float var1 = this.explosionSize; + HashSet var2 = new HashSet(); + int var3; + int var4; + int var5; + double var15; + double var17; + double var19; + + for (var3 = 0; var3 < this.field_77289_h; ++var3) + { + for (var4 = 0; var4 < this.field_77289_h; ++var4) + { + for (var5 = 0; var5 < this.field_77289_h; ++var5) + { + if (var3 == 0 || var3 == this.field_77289_h - 1 || var4 == 0 || var4 == this.field_77289_h - 1 || var5 == 0 || var5 == this.field_77289_h - 1) + { + double var6 = (double)((float)var3 / ((float)this.field_77289_h - 1.0F) * 2.0F - 1.0F); + double var8 = (double)((float)var4 / ((float)this.field_77289_h - 1.0F) * 2.0F - 1.0F); + double var10 = (double)((float)var5 / ((float)this.field_77289_h - 1.0F) * 2.0F - 1.0F); + double var12 = Math.sqrt(var6 * var6 + var8 * var8 + var10 * var10); + var6 /= var12; + var8 /= var12; + var10 /= var12; + float var14 = this.explosionSize * (0.7F + this.worldObj.rand.nextFloat() * 0.6F); + var15 = this.explosionX; + var17 = this.explosionY; + var19 = this.explosionZ; + + for (float var21 = 0.3F; var14 > 0.0F; var14 -= var21 * 0.75F) + { + int var22 = MathHelper.floor_double(var15); + int var23 = MathHelper.floor_double(var17); + int var24 = MathHelper.floor_double(var19); + int var25 = this.worldObj.getBlockId(var22, var23, var24); + + if (var25 > 0) + { + Block var26 = Block.blocksList[var25]; + float var27 = this.exploder != null ? this.exploder.getBlockExplosionResistance(this, this.worldObj, var22, var23, var24, var26) : var26.getExplosionResistance(this.exploder); + var14 -= (var27 + 0.3F) * var21; + } + + if (var14 > 0.0F && (this.exploder == null || this.exploder.shouldExplodeBlock(this, this.worldObj, var22, var23, var24, var25, var14))) + { + var2.add(new ChunkPosition(var22, var23, var24)); + } + + var15 += var6 * (double)var21; + var17 += var8 * (double)var21; + var19 += var10 * (double)var21; + } + } + } + } + } + + this.affectedBlockPositions.addAll(var2); + this.explosionSize *= 2.0F; + var3 = MathHelper.floor_double(this.explosionX - (double)this.explosionSize - 1.0D); + var4 = MathHelper.floor_double(this.explosionX + (double)this.explosionSize + 1.0D); + var5 = MathHelper.floor_double(this.explosionY - (double)this.explosionSize - 1.0D); + int var29 = MathHelper.floor_double(this.explosionY + (double)this.explosionSize + 1.0D); + int var7 = MathHelper.floor_double(this.explosionZ - (double)this.explosionSize - 1.0D); + int var30 = MathHelper.floor_double(this.explosionZ + (double)this.explosionSize + 1.0D); + List var9 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getAABBPool().getAABB((double)var3, (double)var5, (double)var7, (double)var4, (double)var29, (double)var30)); + Vec3 var31 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.explosionX, this.explosionY, this.explosionZ); + + for (int var11 = 0; var11 < var9.size(); ++var11) + { + Entity var32 = (Entity)var9.get(var11); + double var13 = var32.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double)this.explosionSize; + + if (var13 <= 1.0D) + { + var15 = var32.posX - this.explosionX; + var17 = var32.posY + (double)var32.getEyeHeight() - this.explosionY; + var19 = var32.posZ - this.explosionZ; + double var33 = (double)MathHelper.sqrt_double(var15 * var15 + var17 * var17 + var19 * var19); + + if (var33 != 0.0D) + { + var15 /= var33; + var17 /= var33; + var19 /= var33; + double var34 = (double)this.worldObj.getBlockDensity(var31, var32.boundingBox); + double var35 = (1.0D - var13) * var34; + var32.attackEntityFrom(DamageSource.setExplosionSource(this), (float)((int)((var35 * var35 + var35) / 2.0D * 8.0D * (double)this.explosionSize + 1.0D))); + double var36 = EnchantmentProtection.func_92092_a(var32, var35); + var32.motionX += var15 * var36; + var32.motionY += var17 * var36; + var32.motionZ += var19 * var36; + + if (var32 instanceof EntityPlayer) + { + this.field_77288_k.put((EntityPlayer)var32, this.worldObj.getWorldVec3Pool().getVecFromPool(var15 * var35, var17 * var35, var19 * var35)); + } + } + } + } + + this.explosionSize = var1; + } + + /** + * Does the second part of the explosion (sound, particles, drop spawn) + */ + public void doExplosionB(boolean par1) + { + this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); + + if (this.explosionSize >= 2.0F && this.isSmoking) + { + this.worldObj.spawnParticle("hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); + } + else + { + this.worldObj.spawnParticle("largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); + } + + Iterator var2; + ChunkPosition var3; + int var4; + int var5; + int var6; + int var7; + + if (this.isSmoking) + { + var2 = this.affectedBlockPositions.iterator(); + + while (var2.hasNext()) + { + var3 = (ChunkPosition)var2.next(); + var4 = var3.x; + var5 = var3.y; + var6 = var3.z; + var7 = this.worldObj.getBlockId(var4, var5, var6); + + if (par1) + { + double var8 = (double)((float)var4 + this.worldObj.rand.nextFloat()); + double var10 = (double)((float)var5 + this.worldObj.rand.nextFloat()); + double var12 = (double)((float)var6 + this.worldObj.rand.nextFloat()); + double var14 = var8 - this.explosionX; + double var16 = var10 - this.explosionY; + double var18 = var12 - this.explosionZ; + double var20 = (double)MathHelper.sqrt_double(var14 * var14 + var16 * var16 + var18 * var18); + var14 /= var20; + var16 /= var20; + var18 /= var20; + double var22 = 0.5D / (var20 / (double)this.explosionSize + 0.1D); + var22 *= (double)(this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat() + 0.3F); + var14 *= var22; + var16 *= var22; + var18 *= var22; + this.worldObj.spawnParticle("explode", (var8 + this.explosionX * 1.0D) / 2.0D, (var10 + this.explosionY * 1.0D) / 2.0D, (var12 + this.explosionZ * 1.0D) / 2.0D, var14, var16, var18); + this.worldObj.spawnParticle("smoke", var8, var10, var12, var14, var16, var18); + } + + if (var7 > 0) + { + Block var24 = Block.blocksList[var7]; + + if (var24.canDropFromExplosion(this)) + { + var24.dropBlockAsItemWithChance(this.worldObj, var4, var5, var6, this.worldObj.getBlockMetadata(var4, var5, var6), 1.0F / this.explosionSize, 0); + } + + this.worldObj.setBlock(var4, var5, var6, 0, 0, 3); + var24.onBlockDestroyedByExplosion(this.worldObj, var4, var5, var6, this); + } + } + } + + if (this.isFlaming) + { + var2 = this.affectedBlockPositions.iterator(); + + while (var2.hasNext()) + { + var3 = (ChunkPosition)var2.next(); + var4 = var3.x; + var5 = var3.y; + var6 = var3.z; + var7 = this.worldObj.getBlockId(var4, var5, var6); + int var25 = this.worldObj.getBlockId(var4, var5 - 1, var6); + + if (var7 == 0 && Block.opaqueCubeLookup[var25] && this.explosionRNG.nextInt(3) == 0) + { + this.worldObj.setBlock(var4, var5, var6, Block.fire.blockID); + } + } + } + } + + public Map func_77277_b() + { + return this.field_77288_k; + } + + /** + * Returns either the entity that placed the explosive block, the entity that caused the explosion or null. + */ + public EntityLivingBase getExplosivePlacedBy() + { + return this.exploder == null ? null : (this.exploder instanceof EntityTNTPrimed ? ((EntityTNTPrimed)this.exploder).getTntPlacedBy() : (this.exploder instanceof EntityLivingBase ? (EntityLivingBase)this.exploder : null)); + } +} diff --git a/src/main/java/net/minecraft/src/ExtendedBlockStorage.java b/src/main/java/net/minecraft/src/ExtendedBlockStorage.java new file mode 100644 index 0000000..75bcbbd --- /dev/null +++ b/src/main/java/net/minecraft/src/ExtendedBlockStorage.java @@ -0,0 +1,323 @@ +package net.minecraft.src; + +public class ExtendedBlockStorage +{ + /** + * Contains the bottom-most Y block represented by this ExtendedBlockStorage. Typically a multiple of 16. + */ + private int yBase; + + /** + * A total count of the number of non-air blocks in this block storage's Chunk. + */ + private int blockRefCount; + + /** + * Contains the number of blocks in this block storage's parent chunk that require random ticking. Used to cull the + * Chunk from random tick updates for performance reasons. + */ + private int tickRefCount; + + /** + * Contains the least significant 8 bits of each block ID belonging to this block storage's parent Chunk. + */ + private byte[] blockLSBArray; + + /** + * Contains the most significant 4 bits of each block ID belonging to this block storage's parent Chunk. + */ + private NibbleArray blockMSBArray; + + /** + * Stores the metadata associated with blocks in this ExtendedBlockStorage. + */ + private NibbleArray blockMetadataArray; + + /** The NibbleArray containing a block of Block-light data. */ + private NibbleArray blocklightArray; + + /** The NibbleArray containing a block of Sky-light data. */ + private NibbleArray skylightArray; + + public ExtendedBlockStorage(int par1, boolean par2) + { + this.yBase = par1; + this.blockLSBArray = new byte[4096]; + this.blockMetadataArray = new NibbleArray(this.blockLSBArray.length, 4); + this.blocklightArray = new NibbleArray(this.blockLSBArray.length, 4); + + if (par2) + { + this.skylightArray = new NibbleArray(this.blockLSBArray.length, 4); + } + } + + /** + * Returns the extended block ID for a location in a chunk, merged from a byte array and a NibbleArray to form a + * full 12-bit block ID. + */ + public int getExtBlockID(int par1, int par2, int par3) + { + int var4 = this.blockLSBArray[par2 << 8 | par3 << 4 | par1] & 255; + return this.blockMSBArray != null ? this.blockMSBArray.get(par1, par2, par3) << 8 | var4 : var4; + } + + /** + * Sets the extended block ID for a location in a chunk, splitting bits 11..8 into a NibbleArray and bits 7..0 into + * a byte array. Also performs reference counting to determine whether or not to broadly cull this Chunk from the + * random-update tick list. + */ + public void setExtBlockID(int par1, int par2, int par3, int par4) + { + int var5 = this.blockLSBArray[par2 << 8 | par3 << 4 | par1] & 255; + + if (this.blockMSBArray != null) + { + var5 |= this.blockMSBArray.get(par1, par2, par3) << 8; + } + + if (var5 == 0 && par4 != 0) + { + ++this.blockRefCount; + + if (Block.blocksList[par4] != null && Block.blocksList[par4].getTickRandomly()) + { + ++this.tickRefCount; + } + } + else if (var5 != 0 && par4 == 0) + { + --this.blockRefCount; + + if (Block.blocksList[var5] != null && Block.blocksList[var5].getTickRandomly()) + { + --this.tickRefCount; + } + } + else if (Block.blocksList[var5] != null && Block.blocksList[var5].getTickRandomly() && (Block.blocksList[par4] == null || !Block.blocksList[par4].getTickRandomly())) + { + --this.tickRefCount; + } + else if ((Block.blocksList[var5] == null || !Block.blocksList[var5].getTickRandomly()) && Block.blocksList[par4] != null && Block.blocksList[par4].getTickRandomly()) + { + ++this.tickRefCount; + } + + this.blockLSBArray[par2 << 8 | par3 << 4 | par1] = (byte)(par4 & 255); + + if (par4 > 255) + { + if (this.blockMSBArray == null) + { + this.blockMSBArray = new NibbleArray(this.blockLSBArray.length, 4); + } + + this.blockMSBArray.set(par1, par2, par3, (par4 & 3840) >> 8); + } + else if (this.blockMSBArray != null) + { + this.blockMSBArray.set(par1, par2, par3, 0); + } + } + + /** + * Returns the metadata associated with the block at the given coordinates in this ExtendedBlockStorage. + */ + public int getExtBlockMetadata(int par1, int par2, int par3) + { + return this.blockMetadataArray.get(par1, par2, par3); + } + + /** + * Sets the metadata of the Block at the given coordinates in this ExtendedBlockStorage to the given metadata. + */ + public void setExtBlockMetadata(int par1, int par2, int par3, int par4) + { + this.blockMetadataArray.set(par1, par2, par3, par4); + } + + /** + * Returns whether or not this block storage's Chunk is fully empty, based on its internal reference count. + */ + public boolean isEmpty() + { + return this.blockRefCount == 0; + } + + /** + * Returns whether or not this block storage's Chunk will require random ticking, used to avoid looping through + * random block ticks when there are no blocks that would randomly tick. + */ + public boolean getNeedsRandomTick() + { + return this.tickRefCount > 0; + } + + /** + * Returns the Y location of this ExtendedBlockStorage. + */ + public int getYLocation() + { + return this.yBase; + } + + /** + * Sets the saved Sky-light value in the extended block storage structure. + */ + public void setExtSkylightValue(int par1, int par2, int par3, int par4) + { + this.skylightArray.set(par1, par2, par3, par4); + } + + /** + * Gets the saved Sky-light value in the extended block storage structure. + */ + public int getExtSkylightValue(int par1, int par2, int par3) + { + return this.skylightArray.get(par1, par2, par3); + } + + /** + * Sets the saved Block-light value in the extended block storage structure. + */ + public void setExtBlocklightValue(int par1, int par2, int par3, int par4) + { + this.blocklightArray.set(par1, par2, par3, par4); + } + + /** + * Gets the saved Block-light value in the extended block storage structure. + */ + public int getExtBlocklightValue(int par1, int par2, int par3) + { + return this.blocklightArray.get(par1, par2, par3); + } + + public void removeInvalidBlocks() + { + this.blockRefCount = 0; + this.tickRefCount = 0; + + for (int var1 = 0; var1 < 16; ++var1) + { + for (int var2 = 0; var2 < 16; ++var2) + { + for (int var3 = 0; var3 < 16; ++var3) + { + int var4 = this.getExtBlockID(var1, var2, var3); + + if (var4 > 0) + { + if (Block.blocksList[var4] == null) + { + this.blockLSBArray[var2 << 8 | var3 << 4 | var1] = 0; + + if (this.blockMSBArray != null) + { + this.blockMSBArray.set(var1, var2, var3, 0); + } + } + else + { + ++this.blockRefCount; + + if (Block.blocksList[var4].getTickRandomly()) + { + ++this.tickRefCount; + } + } + } + } + } + } + } + + public byte[] getBlockLSBArray() + { + return this.blockLSBArray; + } + + public void clearMSBArray() + { + this.blockMSBArray = null; + } + + /** + * Returns the block ID MSB (bits 11..8) array for this storage array's Chunk. + */ + public NibbleArray getBlockMSBArray() + { + return this.blockMSBArray; + } + + public NibbleArray getMetadataArray() + { + return this.blockMetadataArray; + } + + /** + * Returns the NibbleArray instance containing Block-light data. + */ + public NibbleArray getBlocklightArray() + { + return this.blocklightArray; + } + + /** + * Returns the NibbleArray instance containing Sky-light data. + */ + public NibbleArray getSkylightArray() + { + return this.skylightArray; + } + + /** + * Sets the array of block ID least significant bits for this ExtendedBlockStorage. + */ + public void setBlockLSBArray(byte[] par1ArrayOfByte) + { + this.blockLSBArray = par1ArrayOfByte; + } + + /** + * Sets the array of blockID most significant bits (blockMSBArray) for this ExtendedBlockStorage. + */ + public void setBlockMSBArray(NibbleArray par1NibbleArray) + { + this.blockMSBArray = par1NibbleArray; + } + + /** + * Sets the NibbleArray of block metadata (blockMetadataArray) for this ExtendedBlockStorage. + */ + public void setBlockMetadataArray(NibbleArray par1NibbleArray) + { + this.blockMetadataArray = par1NibbleArray; + } + + /** + * Sets the NibbleArray instance used for Block-light values in this particular storage block. + */ + public void setBlocklightArray(NibbleArray par1NibbleArray) + { + this.blocklightArray = par1NibbleArray; + } + + /** + * Sets the NibbleArray instance used for Sky-light values in this particular storage block. + */ + public void setSkylightArray(NibbleArray par1NibbleArray) + { + this.skylightArray = par1NibbleArray; + } + + /** + * Called by a Chunk to initialize the MSB array if getBlockMSBArray returns null. Returns the newly-created + * NibbleArray instance. + */ + public NibbleArray createBlockMSBArray() + { + this.blockMSBArray = new NibbleArray(this.blockLSBArray.length, 4); + return this.blockMSBArray; + } +} diff --git a/src/main/java/net/minecraft/src/Facing.java b/src/main/java/net/minecraft/src/Facing.java new file mode 100644 index 0000000..996e3a2 --- /dev/null +++ b/src/main/java/net/minecraft/src/Facing.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public class Facing +{ + /** + * Converts a side to the opposite side. This is the same as XOR'ing it with 1. + */ + public static final int[] oppositeSide = new int[] {1, 0, 3, 2, 5, 4}; + + /** + * gives the offset required for this axis to get the block at that side. + */ + public static final int[] offsetsXForSide = new int[] {0, 0, 0, 0, -1, 1}; + + /** + * gives the offset required for this axis to get the block at that side. + */ + public static final int[] offsetsYForSide = new int[] { -1, 1, 0, 0, 0, 0}; + + /** + * gives the offset required for this axis to get the block at that side. + */ + public static final int[] offsetsZForSide = new int[] {0, 0, -1, 1, 0, 0}; + public static final String[] facings = new String[] {"DOWN", "UP", "NORTH", "SOUTH", "WEST", "EAST"}; +} diff --git a/src/main/java/net/minecraft/src/FallbackResourceManager.java b/src/main/java/net/minecraft/src/FallbackResourceManager.java new file mode 100644 index 0000000..2c0557a --- /dev/null +++ b/src/main/java/net/minecraft/src/FallbackResourceManager.java @@ -0,0 +1,93 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +public class FallbackResourceManager implements ResourceManager +{ + protected final List resourcePacks = new ArrayList(); + private final MetadataSerializer frmMetadataSerializer; + + public FallbackResourceManager(MetadataSerializer par1MetadataSerializer) + { + this.frmMetadataSerializer = par1MetadataSerializer; + } + + public void addResourcePack(ResourcePack par1ResourcePack) + { + this.resourcePacks.add(par1ResourcePack); + } + + public Set getResourceDomains() + { + return null; + } + + public Resource getResource(ResourceLocation par1ResourceLocation) throws IOException + { + ResourcePack var2 = null; + ResourceLocation var3 = getLocationMcmeta(par1ResourceLocation); + + for (int var4 = this.resourcePacks.size() - 1; var4 >= 0; --var4) + { + ResourcePack var5 = (ResourcePack)this.resourcePacks.get(var4); + + if (var2 == null && var5.resourceExists(var3)) + { + var2 = var5; + } + + if (var5.resourceExists(par1ResourceLocation)) + { + InputStream var6 = null; + + if (var2 != null) + { + var6 = var2.getInputStream(var3); + } + + return new SimpleResource(par1ResourceLocation, var5.getInputStream(par1ResourceLocation), var6, this.frmMetadataSerializer); + } + } + + throw new FileNotFoundException(par1ResourceLocation.toString()); + } + + public List getAllResources(ResourceLocation par1ResourceLocation) throws IOException + { + ArrayList var2 = Lists.newArrayList(); + ResourceLocation var3 = getLocationMcmeta(par1ResourceLocation); + Iterator var4 = this.resourcePacks.iterator(); + + while (var4.hasNext()) + { + ResourcePack var5 = (ResourcePack)var4.next(); + + if (var5.resourceExists(par1ResourceLocation)) + { + InputStream var6 = var5.resourceExists(var3) ? var5.getInputStream(var3) : null; + var2.add(new SimpleResource(par1ResourceLocation, var5.getInputStream(par1ResourceLocation), var6, this.frmMetadataSerializer)); + } + } + + if (var2.isEmpty()) + { + throw new FileNotFoundException(par1ResourceLocation.toString()); + } + else + { + return var2; + } + } + + static ResourceLocation getLocationMcmeta(ResourceLocation par0ResourceLocation) + { + return new ResourceLocation(par0ResourceLocation.getResourceDomain(), par0ResourceLocation.getResourcePath() + ".mcmeta"); + } +} diff --git a/src/main/java/net/minecraft/src/FileResourcePack.java b/src/main/java/net/minecraft/src/FileResourcePack.java new file mode 100644 index 0000000..139836b --- /dev/null +++ b/src/main/java/net/minecraft/src/FileResourcePack.java @@ -0,0 +1,137 @@ +package net.minecraft.src; + +import com.google.common.base.Splitter; +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.io.Closeable; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +public class FileResourcePack extends AbstractResourcePack implements Closeable +{ + public static final Splitter entryNameSplitter = Splitter.on('/').omitEmptyStrings().limit(3); + private ZipFile resourcePackZipFile; + + public FileResourcePack(File par1File) + { + super(par1File); + } + + private ZipFile getResourcePackZipFile() throws IOException + { + if (this.resourcePackZipFile == null) + { + this.resourcePackZipFile = new ZipFile(this.resourcePackFile); + } + + return this.resourcePackZipFile; + } + + protected InputStream getInputStreamByName(String par1Str) throws IOException + { + ZipFile var2 = this.getResourcePackZipFile(); + ZipEntry var3 = var2.getEntry(par1Str); + + if (var3 == null) + { + throw new ResourcePackFileNotFoundException(this.resourcePackFile, par1Str); + } + else + { + return var2.getInputStream(var3); + } + } + + public boolean hasResourceName(String par1Str) + { + try + { + return this.getResourcePackZipFile().getEntry(par1Str) != null; + } + catch (IOException var3) + { + return false; + } + } + + public Set getResourceDomains() + { + ZipFile var1; + + try + { + var1 = this.getResourcePackZipFile(); + } + catch (IOException var8) + { + return Collections.emptySet(); + } + + Enumeration var2 = var1.entries(); + HashSet var3 = Sets.newHashSet(); + + while (var2.hasMoreElements()) + { + ZipEntry var4 = (ZipEntry)var2.nextElement(); + String var5 = var4.getName(); + + if (var5.startsWith("assets/")) + { + ArrayList var6 = Lists.newArrayList(entryNameSplitter.split(var5)); + + if (var6.size() > 1) + { + String var7 = (String)var6.get(1); + + if (!var7.equals(var7.toLowerCase())) + { + this.logNameNotLowercase(var7); + } + else + { + var3.add(var7); + } + } + } + } + + return var3; + } + + protected void finalize() + { + this.close(); + + try + { + super.finalize(); + } + catch (Throwable t) + { + } + } + + public void close() + { + if (this.resourcePackZipFile != null) + { + try + { + this.resourcePackZipFile.close(); + } + catch (Exception ex) + { + } + + this.resourcePackZipFile = null; + } + } +} diff --git a/src/main/java/net/minecraft/src/FilterIMob.java b/src/main/java/net/minecraft/src/FilterIMob.java new file mode 100644 index 0000000..2c168f0 --- /dev/null +++ b/src/main/java/net/minecraft/src/FilterIMob.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +final class FilterIMob implements IEntitySelector +{ + /** + * Return whether the specified entity is applicable to this filter. + */ + public boolean isEntityApplicable(Entity par1Entity) + { + return par1Entity instanceof IMob; + } +} diff --git a/src/main/java/net/minecraft/src/FlatGeneratorInfo.java b/src/main/java/net/minecraft/src/FlatGeneratorInfo.java new file mode 100644 index 0000000..1b2088d --- /dev/null +++ b/src/main/java/net/minecraft/src/FlatGeneratorInfo.java @@ -0,0 +1,320 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +public class FlatGeneratorInfo +{ + /** List of layers on this preset. */ + private final List flatLayers = new ArrayList(); + + /** List of world features enabled on this preset. */ + private final Map worldFeatures = new HashMap(); + private int biomeToUse; + + /** + * Return the biome used on this preset. + */ + public int getBiome() + { + return this.biomeToUse; + } + + /** + * Set the biome used on this preset. + */ + public void setBiome(int par1) + { + this.biomeToUse = par1; + } + + /** + * Return the list of world features enabled on this preset. + */ + public Map getWorldFeatures() + { + return this.worldFeatures; + } + + /** + * Return the list of layers on this preset. + */ + public List getFlatLayers() + { + return this.flatLayers; + } + + public void func_82645_d() + { + int var1 = 0; + FlatLayerInfo var3; + + for (Iterator var2 = this.flatLayers.iterator(); var2.hasNext(); var1 += var3.getLayerCount()) + { + var3 = (FlatLayerInfo)var2.next(); + var3.setMinY(var1); + } + } + + public String toString() + { + StringBuilder var1 = new StringBuilder(); + var1.append(2); + var1.append(";"); + int var2; + + for (var2 = 0; var2 < this.flatLayers.size(); ++var2) + { + if (var2 > 0) + { + var1.append(","); + } + + var1.append(((FlatLayerInfo)this.flatLayers.get(var2)).toString()); + } + + var1.append(";"); + var1.append(this.biomeToUse); + + if (!this.worldFeatures.isEmpty()) + { + var1.append(";"); + var2 = 0; + Iterator var3 = this.worldFeatures.entrySet().iterator(); + + while (var3.hasNext()) + { + Entry var4 = (Entry)var3.next(); + + if (var2++ > 0) + { + var1.append(","); + } + + var1.append(((String)var4.getKey()).toLowerCase()); + Map var5 = (Map)var4.getValue(); + + if (!var5.isEmpty()) + { + var1.append("("); + int var6 = 0; + Iterator var7 = var5.entrySet().iterator(); + + while (var7.hasNext()) + { + Entry var8 = (Entry)var7.next(); + + if (var6++ > 0) + { + var1.append(" "); + } + + var1.append((String)var8.getKey()); + var1.append("="); + var1.append((String)var8.getValue()); + } + + var1.append(")"); + } + } + } + else + { + var1.append(";"); + } + + return var1.toString(); + } + + private static FlatLayerInfo func_82646_a(String par0Str, int par1) + { + String[] var2 = par0Str.split("x", 2); + int var3 = 1; + int var5 = 0; + + if (var2.length == 2) + { + try + { + var3 = Integer.parseInt(var2[0]); + + if (par1 + var3 >= 256) + { + var3 = 256 - par1; + } + + if (var3 < 0) + { + var3 = 0; + } + } + catch (Throwable var7) + { + return null; + } + } + + int var4; + + try + { + String var6 = var2[var2.length - 1]; + var2 = var6.split(":", 2); + var4 = Integer.parseInt(var2[0]); + + if (var2.length > 1) + { + var5 = Integer.parseInt(var2[1]); + } + + if (Block.blocksList[var4] == null) + { + var4 = 0; + var5 = 0; + } + + if (var5 < 0 || var5 > 15) + { + var5 = 0; + } + } + catch (Throwable var8) + { + return null; + } + + FlatLayerInfo var9 = new FlatLayerInfo(var3, var4, var5); + var9.setMinY(par1); + return var9; + } + + private static List func_82652_b(String par0Str) + { + if (par0Str != null && par0Str.length() >= 1) + { + ArrayList var1 = new ArrayList(); + String[] var2 = par0Str.split(","); + int var3 = 0; + String[] var4 = var2; + int var5 = var2.length; + + for (int var6 = 0; var6 < var5; ++var6) + { + String var7 = var4[var6]; + FlatLayerInfo var8 = func_82646_a(var7, var3); + + if (var8 == null) + { + return null; + } + + var1.add(var8); + var3 += var8.getLayerCount(); + } + + return var1; + } + else + { + return null; + } + } + + public static FlatGeneratorInfo createFlatGeneratorFromString(String par0Str) + { + if (par0Str == null) + { + return getDefaultFlatGenerator(); + } + else + { + String[] var1 = par0Str.split(";", -1); + int var2 = var1.length == 1 ? 0 : MathHelper.parseIntWithDefault(var1[0], 0); + + if (var2 >= 0 && var2 <= 2) + { + FlatGeneratorInfo var3 = new FlatGeneratorInfo(); + int var4 = var1.length == 1 ? 0 : 1; + List var5 = func_82652_b(var1[var4++]); + + if (var5 != null && !var5.isEmpty()) + { + var3.getFlatLayers().addAll(var5); + var3.func_82645_d(); + int var6 = BiomeGenBase.plains.biomeID; + + if (var2 > 0 && var1.length > var4) + { + var6 = MathHelper.parseIntWithDefault(var1[var4++], var6); + } + + var3.setBiome(var6); + + if (var2 > 0 && var1.length > var4) + { + String[] var7 = var1[var4++].toLowerCase().split(","); + String[] var8 = var7; + int var9 = var7.length; + + for (int var10 = 0; var10 < var9; ++var10) + { + String var11 = var8[var10]; + String[] var12 = var11.split("\\(", 2); + HashMap var13 = new HashMap(); + + if (var12[0].length() > 0) + { + var3.getWorldFeatures().put(var12[0], var13); + + if (var12.length > 1 && var12[1].endsWith(")") && var12[1].length() > 1) + { + String[] var14 = var12[1].substring(0, var12[1].length() - 1).split(" "); + + for (int var15 = 0; var15 < var14.length; ++var15) + { + String[] var16 = var14[var15].split("=", 2); + + if (var16.length == 2) + { + var13.put(var16[0], var16[1]); + } + } + } + } + } + } + else + { + var3.getWorldFeatures().put("village", new HashMap()); + } + + return var3; + } + else + { + return getDefaultFlatGenerator(); + } + } + else + { + return getDefaultFlatGenerator(); + } + } + } + + public static FlatGeneratorInfo getDefaultFlatGenerator() + { + FlatGeneratorInfo var0 = new FlatGeneratorInfo(); + var0.setBiome(BiomeGenBase.plains.biomeID); + var0.getFlatLayers().add(new FlatLayerInfo(1, Block.bedrock.blockID)); + var0.getFlatLayers().add(new FlatLayerInfo(2, Block.dirt.blockID)); + var0.getFlatLayers().add(new FlatLayerInfo(1, Block.grass.blockID)); + var0.func_82645_d(); + var0.getWorldFeatures().put("village", new HashMap()); + return var0; + } +} diff --git a/src/main/java/net/minecraft/src/FlatLayerInfo.java b/src/main/java/net/minecraft/src/FlatLayerInfo.java new file mode 100644 index 0000000..b91b12a --- /dev/null +++ b/src/main/java/net/minecraft/src/FlatLayerInfo.java @@ -0,0 +1,84 @@ +package net.minecraft.src; + +public class FlatLayerInfo +{ + /** Amount of layers for this set of layers. */ + private int layerCount; + + /** Block type used on this set of layers. */ + private int layerFillBlock; + + /** Block metadata used on this set of laeyrs. */ + private int layerFillBlockMeta; + private int layerMinimumY; + + public FlatLayerInfo(int par1, int par2) + { + this.layerCount = 1; + this.layerCount = par1; + this.layerFillBlock = par2; + } + + public FlatLayerInfo(int par1, int par2, int par3) + { + this(par1, par2); + this.layerFillBlockMeta = par3; + } + + /** + * Return the amount of layers for this set of layers. + */ + public int getLayerCount() + { + return this.layerCount; + } + + /** + * Return the block type used on this set of layers. + */ + public int getFillBlock() + { + return this.layerFillBlock; + } + + /** + * Return the block metadata used on this set of layers. + */ + public int getFillBlockMeta() + { + return this.layerFillBlockMeta; + } + + /** + * Return the minimum Y coordinate for this layer, set during generation. + */ + public int getMinY() + { + return this.layerMinimumY; + } + + /** + * Set the minimum Y coordinate for this layer. + */ + public void setMinY(int par1) + { + this.layerMinimumY = par1; + } + + public String toString() + { + String var1 = Integer.toString(this.layerFillBlock); + + if (this.layerCount > 1) + { + var1 = this.layerCount + "x" + var1; + } + + if (this.layerFillBlockMeta > 0) + { + var1 = var1 + ":" + this.layerFillBlockMeta; + } + + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/FolderResourcePack.java b/src/main/java/net/minecraft/src/FolderResourcePack.java new file mode 100644 index 0000000..08035d1 --- /dev/null +++ b/src/main/java/net/minecraft/src/FolderResourcePack.java @@ -0,0 +1,58 @@ +package net.minecraft.src; + +import com.google.common.collect.Sets; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashSet; +import java.util.Set; +import org.apache.commons.io.filefilter.DirectoryFileFilter; + +public class FolderResourcePack extends AbstractResourcePack +{ + public FolderResourcePack(File par1File) + { + super(par1File); + } + + protected InputStream getInputStreamByName(String par1Str) throws IOException + { + return new BufferedInputStream(new FileInputStream(new File(this.resourcePackFile, par1Str))); + } + + protected boolean hasResourceName(String par1Str) + { + return (new File(this.resourcePackFile, par1Str)).isFile(); + } + + public Set getResourceDomains() + { + HashSet var1 = Sets.newHashSet(); + File var2 = new File(this.resourcePackFile, "assets/"); + + if (var2.isDirectory()) + { + File[] var3 = var2.listFiles((java.io.FileFilter)DirectoryFileFilter.DIRECTORY); + int var4 = var3.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + File var6 = var3[var5]; + String var7 = getRelativeName(var2, var6); + + if (!var7.equals(var7.toLowerCase())) + { + this.logNameNotLowercase(var7); + } + else + { + var1.add(var7.substring(0, var7.length() - 1)); + } + } + } + + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/FoliageColorReloadListener.java b/src/main/java/net/minecraft/src/FoliageColorReloadListener.java new file mode 100644 index 0000000..73f7d4b --- /dev/null +++ b/src/main/java/net/minecraft/src/FoliageColorReloadListener.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +import java.io.IOException; + +public class FoliageColorReloadListener implements ResourceManagerReloadListener +{ + private static final ResourceLocation field_130079_a = new ResourceLocation("textures/colormap/foliage.png"); + + public void onResourceManagerReload(ResourceManager par1ResourceManager) + { + try + { + ColorizerFoliage.setFoliageBiomeColorizer(TextureUtil.readImageData(par1ResourceManager, field_130079_a)); + } + catch (IOException var3) + { + ; + } + } +} diff --git a/src/main/java/net/minecraft/src/FontMetadataSection.java b/src/main/java/net/minecraft/src/FontMetadataSection.java new file mode 100644 index 0000000..01789e0 --- /dev/null +++ b/src/main/java/net/minecraft/src/FontMetadataSection.java @@ -0,0 +1,15 @@ +package net.minecraft.src; + +public class FontMetadataSection implements MetadataSection +{ + private final float[] charWidths; + private final float[] charLefts; + private final float[] charSpacings; + + public FontMetadataSection(float[] par1ArrayOfFloat, float[] par2ArrayOfFloat, float[] par3ArrayOfFloat) + { + this.charWidths = par1ArrayOfFloat; + this.charLefts = par2ArrayOfFloat; + this.charSpacings = par3ArrayOfFloat; + } +} diff --git a/src/main/java/net/minecraft/src/FontMetadataSectionSerializer.java b/src/main/java/net/minecraft/src/FontMetadataSectionSerializer.java new file mode 100644 index 0000000..ab93a10 --- /dev/null +++ b/src/main/java/net/minecraft/src/FontMetadataSectionSerializer.java @@ -0,0 +1,84 @@ +package net.minecraft.src; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.lang.reflect.Type; + +public class FontMetadataSectionSerializer extends BaseMetadataSectionSerializer +{ + public FontMetadataSection func_110490_a(JsonElement par1JsonElement, Type par2Type, JsonDeserializationContext par3JsonDeserializationContext) + { + JsonObject var4 = par1JsonElement.getAsJsonObject(); + float[] var5 = new float[256]; + float[] var6 = new float[256]; + float[] var7 = new float[256]; + float var8 = 1.0F; + float var9 = 0.0F; + float var10 = 0.0F; + + if (var4.has("characters")) + { + if (!var4.get("characters").isJsonObject()) + { + throw new JsonParseException("Invalid font->characters: expected object, was " + var4.get("characters")); + } + + JsonObject var11 = var4.getAsJsonObject("characters"); + + if (var11.has("default")) + { + if (!var11.get("default").isJsonObject()) + { + throw new JsonParseException("Invalid font->characters->default: expected object, was " + var11.get("default")); + } + + JsonObject var12 = var11.getAsJsonObject("default"); + var8 = this.func_110487_a(var12.get("width"), "characters->default->width", Float.valueOf(var8), 0.0F, 2.14748365E9F); + var9 = this.func_110487_a(var12.get("spacing"), "characters->default->spacing", Float.valueOf(var9), 0.0F, 2.14748365E9F); + var10 = this.func_110487_a(var12.get("left"), "characters->default->left", Float.valueOf(var10), 0.0F, 2.14748365E9F); + } + + for (int var18 = 0; var18 < 256; ++var18) + { + JsonElement var13 = var11.get(Integer.toString(var18)); + float var14 = var8; + float var15 = var9; + float var16 = var10; + + if (var13 != null) + { + if (!var13.isJsonObject()) + { + throw new JsonParseException("Invalid font->characters->" + var18 + ": expected object, was " + var13); + } + + JsonObject var17 = var13.getAsJsonObject(); + var14 = this.func_110487_a(var17.get("width"), "characters->" + var18 + "->width", Float.valueOf(var8), 0.0F, 2.14748365E9F); + var15 = this.func_110487_a(var17.get("spacing"), "characters->" + var18 + "->spacing", Float.valueOf(var9), 0.0F, 2.14748365E9F); + var16 = this.func_110487_a(var17.get("left"), "characters->" + var18 + "->left", Float.valueOf(var10), 0.0F, 2.14748365E9F); + } + + var5[var18] = var14; + var6[var18] = var15; + var7[var18] = var16; + } + } + + return new FontMetadataSection(var5, var7, var6); + } + + /** + * The name of this section type as it appears in JSON. + */ + public String getSectionName() + { + return "font"; + } + + public Object deserialize(JsonElement par1JsonElement, Type par2Type, JsonDeserializationContext par3JsonDeserializationContext) + { + return this.func_110490_a(par1JsonElement, par2Type, par3JsonDeserializationContext); + } +} diff --git a/src/main/java/net/minecraft/src/FontRenderer.java b/src/main/java/net/minecraft/src/FontRenderer.java new file mode 100644 index 0000000..0925cc0 --- /dev/null +++ b/src/main/java/net/minecraft/src/FontRenderer.java @@ -0,0 +1,1031 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.text.Bidi; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import javax.imageio.ImageIO; +import org.lwjgl.opengl.GL11; + +public class FontRenderer implements ResourceManagerReloadListener +{ + private static final ResourceLocation[] unicodePageLocations = new ResourceLocation[256]; + + /** Array of width of all the characters in default.png */ + private int[] charWidth = new int[256]; + + /** the height in pixels of default text */ + public int FONT_HEIGHT = 9; + public Random fontRandom = new Random(); + + /** + * Array of the start/end column (in upper/lower nibble) for every glyph in the /font directory. + */ + private byte[] glyphWidth = new byte[65536]; + + /** + * Array of RGB triplets defining the 16 standard chat colors followed by 16 darker version of the same colors for + * drop shadows. + */ + private int[] colorCode = new int[32]; + private final ResourceLocation locationFontTexture; + + /** The RenderEngine used to load and setup glyph textures. */ + private final TextureManager renderEngine; + + /** Current X coordinate at which to draw the next character. */ + private float posX; + + /** Current Y coordinate at which to draw the next character. */ + private float posY; + + /** + * If true, strings should be rendered with Unicode fonts instead of the default.png font + */ + private boolean unicodeFlag; + + /** + * If true, the Unicode Bidirectional Algorithm should be run before rendering any string. + */ + private boolean bidiFlag; + + /** Used to specify new red value for the current color. */ + private float red; + + /** Used to specify new blue value for the current color. */ + private float blue; + + /** Used to specify new green value for the current color. */ + private float green; + + /** Used to speify new alpha value for the current color. */ + private float alpha; + + /** Text color of the currently rendering string. */ + private int textColor; + + /** Set if the "k" style (random) is active in currently rendering string */ + private boolean randomStyle; + + /** Set if the "l" style (bold) is active in currently rendering string */ + private boolean boldStyle; + + /** Set if the "o" style (italic) is active in currently rendering string */ + private boolean italicStyle; + + /** + * Set if the "n" style (underlined) is active in currently rendering string + */ + private boolean underlineStyle; + + /** + * Set if the "m" style (strikethrough) is active in currently rendering string + */ + private boolean strikethroughStyle; + + public FontRenderer(GameSettings par1GameSettings, ResourceLocation par2ResourceLocation, TextureManager par3TextureManager, boolean par4) + { + this.locationFontTexture = par2ResourceLocation; + this.renderEngine = par3TextureManager; + this.unicodeFlag = par4; + par3TextureManager.bindTexture(this.locationFontTexture); + + for (int var5 = 0; var5 < 32; ++var5) + { + int var6 = (var5 >> 3 & 1) * 85; + int var7 = (var5 >> 2 & 1) * 170 + var6; + int var8 = (var5 >> 1 & 1) * 170 + var6; + int var9 = (var5 >> 0 & 1) * 170 + var6; + + if (var5 == 6) + { + var7 += 85; + } + + if (par1GameSettings.anaglyph) + { + int var10 = (var7 * 30 + var8 * 59 + var9 * 11) / 100; + int var11 = (var7 * 30 + var8 * 70) / 100; + int var12 = (var7 * 30 + var9 * 70) / 100; + var7 = var10; + var8 = var11; + var9 = var12; + } + + if (var5 >= 16) + { + var7 /= 4; + var8 /= 4; + var9 /= 4; + } + + this.colorCode[var5] = (var7 & 255) << 16 | (var8 & 255) << 8 | var9 & 255; + } + + this.readGlyphSizes(); + } + + public void onResourceManagerReload(ResourceManager par1ResourceManager) + { + this.readFontTexture(); + } + + private void readFontTexture() + { + BufferedImage var1; + + try + { + var1 = ImageIO.read(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream()); + } + catch (IOException var17) + { + throw new RuntimeException(var17); + } + + int var2 = var1.getWidth(); + int var3 = var1.getHeight(); + int[] var4 = new int[var2 * var3]; + var1.getRGB(0, 0, var2, var3, var4, 0, var2); + int var5 = var3 / 16; + int var6 = var2 / 16; + byte var7 = 1; + float var8 = 8.0F / (float)var6; + int var9 = 0; + + while (var9 < 256) + { + int var10 = var9 % 16; + int var11 = var9 / 16; + + if (var9 == 32) + { + this.charWidth[var9] = 3 + var7; + } + + int var12 = var6 - 1; + + while (true) + { + if (var12 >= 0) + { + int var13 = var10 * var6 + var12; + boolean var14 = true; + + for (int var15 = 0; var15 < var5 && var14; ++var15) + { + int var16 = (var11 * var6 + var15) * var2; + + if ((var4[var13 + var16] >> 24 & 255) != 0) + { + var14 = false; + } + } + + if (var14) + { + --var12; + continue; + } + } + + ++var12; + this.charWidth[var9] = (int)(0.5D + (double)((float)var12 * var8)) + var7; + ++var9; + break; + } + } + } + + private void readGlyphSizes() + { + try + { + InputStream var1 = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream(); + var1.read(this.glyphWidth); + } + catch (IOException var2) + { + throw new RuntimeException(var2); + } + } + + /** + * Pick how to render a single character and return the width used. + */ + private float renderCharAtPos(int par1, char par2, boolean par3) + { + return par2 == 32 ? 4.0F : (par1 > 0 && !this.unicodeFlag ? this.renderDefaultChar(par1 + 32, par3) : this.renderUnicodeChar(par2, par3)); + } + + /** + * Render a single character with the default.png font at current (posX,posY) location... + */ + private float renderDefaultChar(int par1, boolean par2) + { + float var3 = (float)(par1 % 16 * 8); + float var4 = (float)(par1 / 16 * 8); + float var5 = par2 ? 1.0F : 0.0F; + this.renderEngine.bindTexture(this.locationFontTexture); + float var6 = (float)this.charWidth[par1] - 0.01F; + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); + GL11.glTexCoord2f(var3 / 128.0F, var4 / 128.0F); + GL11.glVertex3f(this.posX + var5, this.posY, 0.0F); + GL11.glTexCoord2f(var3 / 128.0F, (var4 + 7.99F) / 128.0F); + GL11.glVertex3f(this.posX - var5, this.posY + 7.99F, 0.0F); + GL11.glTexCoord2f((var3 + var6 - 1.0F) / 128.0F, var4 / 128.0F); + GL11.glVertex3f(this.posX + var6 - 1.0F + var5, this.posY, 0.0F); + GL11.glTexCoord2f((var3 + var6 - 1.0F) / 128.0F, (var4 + 7.99F) / 128.0F); + GL11.glVertex3f(this.posX + var6 - 1.0F - var5, this.posY + 7.99F, 0.0F); + GL11.glEnd(); + return (float)this.charWidth[par1]; + } + + private ResourceLocation getUnicodePageLocation(int par1) + { + if (unicodePageLocations[par1] == null) + { + unicodePageLocations[par1] = new ResourceLocation(String.format("textures/font/unicode_page_%02x.png", new Object[] {Integer.valueOf(par1)})); + } + + return unicodePageLocations[par1]; + } + + /** + * Load one of the /font/glyph_XX.png into a new GL texture and store the texture ID in glyphTextureName array. + */ + private void loadGlyphTexture(int par1) + { + this.renderEngine.bindTexture(this.getUnicodePageLocation(par1)); + } + + /** + * Render a single Unicode character at current (posX,posY) location using one of the /font/glyph_XX.png files... + */ + private float renderUnicodeChar(char par1, boolean par2) + { + if (this.glyphWidth[par1] == 0) + { + return 0.0F; + } + else + { + int var3 = par1 / 256; + this.loadGlyphTexture(var3); + int var4 = this.glyphWidth[par1] >>> 4; + int var5 = this.glyphWidth[par1] & 15; + float var6 = (float)var4; + float var7 = (float)(var5 + 1); + float var8 = (float)(par1 % 16 * 16) + var6; + float var9 = (float)((par1 & 255) / 16 * 16); + float var10 = var7 - var6 - 0.02F; + float var11 = par2 ? 1.0F : 0.0F; + GL11.glBegin(GL11.GL_TRIANGLE_STRIP); + GL11.glTexCoord2f(var8 / 256.0F, var9 / 256.0F); + GL11.glVertex3f(this.posX + var11, this.posY, 0.0F); + GL11.glTexCoord2f(var8 / 256.0F, (var9 + 15.98F) / 256.0F); + GL11.glVertex3f(this.posX - var11, this.posY + 7.99F, 0.0F); + GL11.glTexCoord2f((var8 + var10) / 256.0F, var9 / 256.0F); + GL11.glVertex3f(this.posX + var10 / 2.0F + var11, this.posY, 0.0F); + GL11.glTexCoord2f((var8 + var10) / 256.0F, (var9 + 15.98F) / 256.0F); + GL11.glVertex3f(this.posX + var10 / 2.0F - var11, this.posY + 7.99F, 0.0F); + GL11.glEnd(); + return (var7 - var6) / 2.0F + 1.0F; + } + } + + /** + * Draws the specified string with a shadow. + */ + public int drawStringWithShadow(String par1Str, int par2, int par3, int par4) + { + return this.drawString(par1Str, par2, par3, par4, true); + } + + /** + * Draws the specified string. + */ + public int drawString(String par1Str, int par2, int par3, int par4) + { + return this.drawString(par1Str, par2, par3, par4, false); + } + + /** + * Draws the specified string. Args: string, x, y, color, dropShadow + */ + public int drawString(String par1Str, int par2, int par3, int par4, boolean par5) + { + this.resetStyles(); + + if (this.bidiFlag) + { + par1Str = this.bidiReorder(par1Str); + } + + int var6; + + if (par5) + { + var6 = this.renderString(par1Str, par2 + 1, par3 + 1, par4, true); + var6 = Math.max(var6, this.renderString(par1Str, par2, par3, par4, false)); + } + else + { + var6 = this.renderString(par1Str, par2, par3, par4, false); + } + + return var6; + } + + /** + * Apply Unicode Bidirectional Algorithm to string and return a new possibly reordered string for visual rendering. + */ + private String bidiReorder(String par1Str) + { + if (par1Str != null && Bidi.requiresBidi(par1Str.toCharArray(), 0, par1Str.length())) + { + Bidi var2 = new Bidi(par1Str, -2); + byte[] var3 = new byte[var2.getRunCount()]; + String[] var4 = new String[var3.length]; + int var7; + + for (int var5 = 0; var5 < var3.length; ++var5) + { + int var6 = var2.getRunStart(var5); + var7 = var2.getRunLimit(var5); + int var8 = var2.getRunLevel(var5); + String var9 = par1Str.substring(var6, var7); + var3[var5] = (byte)var8; + var4[var5] = var9; + } + + String[] var11 = (String[])var4.clone(); + Bidi.reorderVisually(var3, 0, var4, 0, var3.length); + StringBuilder var12 = new StringBuilder(); + var7 = 0; + + while (var7 < var4.length) + { + byte var13 = var3[var7]; + int var14 = 0; + + while (true) + { + if (var14 < var11.length) + { + if (!var11[var14].equals(var4[var7])) + { + ++var14; + continue; + } + + var13 = var3[var14]; + } + + if ((var13 & 1) == 0) + { + var12.append(var4[var7]); + } + else + { + for (var14 = var4[var7].length() - 1; var14 >= 0; --var14) + { + char var10 = var4[var7].charAt(var14); + + if (var10 == 40) + { + var10 = 41; + } + else if (var10 == 41) + { + var10 = 40; + } + + var12.append(var10); + } + } + + ++var7; + break; + } + } + + return var12.toString(); + } + else + { + return par1Str; + } + } + + /** + * Reset all style flag fields in the class to false; called at the start of string rendering + */ + private void resetStyles() + { + this.randomStyle = false; + this.boldStyle = false; + this.italicStyle = false; + this.underlineStyle = false; + this.strikethroughStyle = false; + } + + /** + * Render a single line string at the current (posX,posY) and update posX + */ + private void renderStringAtPos(String par1Str, boolean par2) + { + for (int var3 = 0; var3 < par1Str.length(); ++var3) + { + char var4 = par1Str.charAt(var3); + int var5; + int var6; + + if (var4 == 167 && var3 + 1 < par1Str.length()) + { + var5 = "0123456789abcdefklmnor".indexOf(par1Str.toLowerCase().charAt(var3 + 1)); + + if (var5 < 16) + { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + + if (var5 < 0 || var5 > 15) + { + var5 = 15; + } + + if (par2) + { + var5 += 16; + } + + var6 = this.colorCode[var5]; + this.textColor = var6; + GL11.glColor4f((float)(var6 >> 16) / 255.0F, (float)(var6 >> 8 & 255) / 255.0F, (float)(var6 & 255) / 255.0F, this.alpha); + } + else if (var5 == 16) + { + this.randomStyle = true; + } + else if (var5 == 17) + { + this.boldStyle = true; + } + else if (var5 == 18) + { + this.strikethroughStyle = true; + } + else if (var5 == 19) + { + this.underlineStyle = true; + } + else if (var5 == 20) + { + this.italicStyle = true; + } + else if (var5 == 21) + { + this.randomStyle = false; + this.boldStyle = false; + this.strikethroughStyle = false; + this.underlineStyle = false; + this.italicStyle = false; + GL11.glColor4f(this.red, this.blue, this.green, this.alpha); + } + + ++var3; + } + else + { + var5 = ChatAllowedCharacters.allowedCharacters.indexOf(var4); + + if (this.randomStyle && var5 > 0) + { + do + { + var6 = this.fontRandom.nextInt(ChatAllowedCharacters.allowedCharacters.length()); + } + while (this.charWidth[var5 + 32] != this.charWidth[var6 + 32]); + + var5 = var6; + } + + float var11 = this.unicodeFlag ? 0.5F : 1.0F; + boolean var7 = (var5 <= 0 || this.unicodeFlag) && par2; + + if (var7) + { + this.posX -= var11; + this.posY -= var11; + } + + float var8 = this.renderCharAtPos(var5, var4, this.italicStyle); + + if (var7) + { + this.posX += var11; + this.posY += var11; + } + + if (this.boldStyle) + { + this.posX += var11; + + if (var7) + { + this.posX -= var11; + this.posY -= var11; + } + + this.renderCharAtPos(var5, var4, this.italicStyle); + this.posX -= var11; + + if (var7) + { + this.posX += var11; + this.posY += var11; + } + + ++var8; + } + + Tessellator var9; + + if (this.strikethroughStyle) + { + var9 = Tessellator.instance; + GL11.glDisable(GL11.GL_TEXTURE_2D); + var9.startDrawingQuads(); + var9.addVertex((double)this.posX, (double)(this.posY + (float)(this.FONT_HEIGHT / 2)), 0.0D); + var9.addVertex((double)(this.posX + var8), (double)(this.posY + (float)(this.FONT_HEIGHT / 2)), 0.0D); + var9.addVertex((double)(this.posX + var8), (double)(this.posY + (float)(this.FONT_HEIGHT / 2) - 1.0F), 0.0D); + var9.addVertex((double)this.posX, (double)(this.posY + (float)(this.FONT_HEIGHT / 2) - 1.0F), 0.0D); + var9.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + if (this.underlineStyle) + { + var9 = Tessellator.instance; + GL11.glDisable(GL11.GL_TEXTURE_2D); + var9.startDrawingQuads(); + int var10 = this.underlineStyle ? -1 : 0; + var9.addVertex((double)(this.posX + (float)var10), (double)(this.posY + (float)this.FONT_HEIGHT), 0.0D); + var9.addVertex((double)(this.posX + var8), (double)(this.posY + (float)this.FONT_HEIGHT), 0.0D); + var9.addVertex((double)(this.posX + var8), (double)(this.posY + (float)this.FONT_HEIGHT - 1.0F), 0.0D); + var9.addVertex((double)(this.posX + (float)var10), (double)(this.posY + (float)this.FONT_HEIGHT - 1.0F), 0.0D); + var9.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + this.posX += (float)((int)var8); + } + } + } + + /** + * Render string either left or right aligned depending on bidiFlag + */ + private int renderStringAligned(String par1Str, int par2, int par3, int par4, int par5, boolean par6) + { + if (this.bidiFlag) + { + par1Str = this.bidiReorder(par1Str); + int var7 = this.getStringWidth(par1Str); + par2 = par2 + par4 - var7; + } + + return this.renderString(par1Str, par2, par3, par5, par6); + } + + /** + * Render single line string by setting GL color, current (posX,posY), and calling renderStringAtPos() + */ + private int renderString(String par1Str, int par2, int par3, int par4, boolean par5) + { + if (par1Str == null) + { + return 0; + } + else + { + if ((par4 & -67108864) == 0) + { + par4 |= -16777216; + } + + if (par5) + { + par4 = (par4 & 16579836) >> 2 | par4 & -16777216; + } + + this.red = (float)(par4 >> 16 & 255) / 255.0F; + this.blue = (float)(par4 >> 8 & 255) / 255.0F; + this.green = (float)(par4 & 255) / 255.0F; + this.alpha = (float)(par4 >> 24 & 255) / 255.0F; + GL11.glColor4f(this.red, this.blue, this.green, this.alpha); + this.posX = (float)par2; + this.posY = (float)par3; + this.renderStringAtPos(par1Str, par5); + return (int)this.posX; + } + } + + /** + * Returns the width of this string. Equivalent of FontMetrics.stringWidth(String s). + */ + public int getStringWidth(String par1Str) + { + if (par1Str == null) + { + return 0; + } + else + { + int var2 = 0; + boolean var3 = false; + + for (int var4 = 0; var4 < par1Str.length(); ++var4) + { + char var5 = par1Str.charAt(var4); + int var6 = this.getCharWidth(var5); + + if (var6 < 0 && var4 < par1Str.length() - 1) + { + ++var4; + var5 = par1Str.charAt(var4); + + if (var5 != 108 && var5 != 76) + { + if (var5 == 114 || var5 == 82) + { + var3 = false; + } + } + else + { + var3 = true; + } + + var6 = 0; + } + + var2 += var6; + + if (var3) + { + ++var2; + } + } + + return var2; + } + } + + /** + * Returns the width of this character as rendered. + */ + public int getCharWidth(char par1) + { + if (par1 == 167) + { + return -1; + } + else if (par1 == 32) + { + return 4; + } + else + { + int var2 = ChatAllowedCharacters.allowedCharacters.indexOf(par1); + + if (var2 >= 0 && !this.unicodeFlag) + { + return this.charWidth[var2 + 32]; + } + else if (this.glyphWidth[par1] != 0) + { + int var3 = this.glyphWidth[par1] >>> 4; + int var4 = this.glyphWidth[par1] & 15; + + if (var4 > 7) + { + var4 = 15; + var3 = 0; + } + + ++var4; + return (var4 - var3) / 2 + 1; + } + else + { + return 0; + } + } + } + + /** + * Trims a string to fit a specified Width. + */ + public String trimStringToWidth(String par1Str, int par2) + { + return this.trimStringToWidth(par1Str, par2, false); + } + + /** + * Trims a string to a specified width, and will reverse it if par3 is set. + */ + public String trimStringToWidth(String par1Str, int par2, boolean par3) + { + StringBuilder var4 = new StringBuilder(); + int var5 = 0; + int var6 = par3 ? par1Str.length() - 1 : 0; + int var7 = par3 ? -1 : 1; + boolean var8 = false; + boolean var9 = false; + + for (int var10 = var6; var10 >= 0 && var10 < par1Str.length() && var5 < par2; var10 += var7) + { + char var11 = par1Str.charAt(var10); + int var12 = this.getCharWidth(var11); + + if (var8) + { + var8 = false; + + if (var11 != 108 && var11 != 76) + { + if (var11 == 114 || var11 == 82) + { + var9 = false; + } + } + else + { + var9 = true; + } + } + else if (var12 < 0) + { + var8 = true; + } + else + { + var5 += var12; + + if (var9) + { + ++var5; + } + } + + if (var5 > par2) + { + break; + } + + if (par3) + { + var4.insert(0, var11); + } + else + { + var4.append(var11); + } + } + + return var4.toString(); + } + + /** + * Remove all newline characters from the end of the string + */ + private String trimStringNewline(String par1Str) + { + while (par1Str != null && par1Str.endsWith("\n")) + { + par1Str = par1Str.substring(0, par1Str.length() - 1); + } + + return par1Str; + } + + /** + * Splits and draws a String with wordwrap (maximum length is parameter k) + */ + public void drawSplitString(String par1Str, int par2, int par3, int par4, int par5) + { + this.resetStyles(); + this.textColor = par5; + par1Str = this.trimStringNewline(par1Str); + this.renderSplitString(par1Str, par2, par3, par4, false); + } + + /** + * Perform actual work of rendering a multi-line string with wordwrap and with darker drop shadow color if flag is + * set + */ + private void renderSplitString(String par1Str, int par2, int par3, int par4, boolean par5) + { + List var6 = this.listFormattedStringToWidth(par1Str, par4); + + for (Iterator var7 = var6.iterator(); var7.hasNext(); par3 += this.FONT_HEIGHT) + { + String var8 = (String)var7.next(); + this.renderStringAligned(var8, par2, par3, par4, this.textColor, par5); + } + } + + /** + * Returns the width of the wordwrapped String (maximum length is parameter k) + */ + public int splitStringWidth(String par1Str, int par2) + { + return this.FONT_HEIGHT * this.listFormattedStringToWidth(par1Str, par2).size(); + } + + /** + * Set unicodeFlag controlling whether strings should be rendered with Unicode fonts instead of the default.png + * font. + */ + public void setUnicodeFlag(boolean par1) + { + this.unicodeFlag = par1; + } + + /** + * Get unicodeFlag controlling whether strings should be rendered with Unicode fonts instead of the default.png + * font. + */ + public boolean getUnicodeFlag() + { + return this.unicodeFlag; + } + + /** + * Set bidiFlag to control if the Unicode Bidirectional Algorithm should be run before rendering any string. + */ + public void setBidiFlag(boolean par1) + { + this.bidiFlag = par1; + } + + /** + * Breaks a string into a list of pieces that will fit a specified width. + */ + public List listFormattedStringToWidth(String par1Str, int par2) + { + return Arrays.asList(this.wrapFormattedStringToWidth(par1Str, par2).split("\n")); + } + + /** + * Inserts newline and formatting into a string to wrap it within the specified width. + */ + String wrapFormattedStringToWidth(String par1Str, int par2) + { + int var3 = this.sizeStringToWidth(par1Str, par2); + + if (par1Str.length() <= var3) + { + return par1Str; + } + else + { + String var4 = par1Str.substring(0, var3); + char var5 = par1Str.charAt(var3); + boolean var6 = var5 == 32 || var5 == 10; + String var7 = getFormatFromString(var4) + par1Str.substring(var3 + (var6 ? 1 : 0)); + return var4 + "\n" + this.wrapFormattedStringToWidth(var7, par2); + } + } + + /** + * Determines how many characters from the string will fit into the specified width. + */ + private int sizeStringToWidth(String par1Str, int par2) + { + int var3 = par1Str.length(); + int var4 = 0; + int var5 = 0; + int var6 = -1; + + for (boolean var7 = false; var5 < var3; ++var5) + { + char var8 = par1Str.charAt(var5); + + switch (var8) + { + case 10: + --var5; + break; + + case 167: + if (var5 < var3 - 1) + { + ++var5; + char var9 = par1Str.charAt(var5); + + if (var9 != 108 && var9 != 76) + { + if (var9 == 114 || var9 == 82 || isFormatColor(var9)) + { + var7 = false; + } + } + else + { + var7 = true; + } + } + + break; + + case 32: + var6 = var5; + + default: + var4 += this.getCharWidth(var8); + + if (var7) + { + ++var4; + } + } + + if (var8 == 10) + { + ++var5; + var6 = var5; + break; + } + + if (var4 > par2) + { + break; + } + } + + return var5 != var3 && var6 != -1 && var6 < var5 ? var6 : var5; + } + + /** + * Checks if the char code is a hexadecimal character, used to set colour. + */ + private static boolean isFormatColor(char par0) + { + return par0 >= 48 && par0 <= 57 || par0 >= 97 && par0 <= 102 || par0 >= 65 && par0 <= 70; + } + + /** + * Checks if the char code is O-K...lLrRk-o... used to set special formatting. + */ + private static boolean isFormatSpecial(char par0) + { + return par0 >= 107 && par0 <= 111 || par0 >= 75 && par0 <= 79 || par0 == 114 || par0 == 82; + } + + /** + * Digests a string for nonprinting formatting characters then returns a string containing only that formatting. + */ + private static String getFormatFromString(String par0Str) + { + String var1 = ""; + int var2 = -1; + int var3 = par0Str.length(); + + while ((var2 = par0Str.indexOf(167, var2 + 1)) != -1) + { + if (var2 < var3 - 1) + { + char var4 = par0Str.charAt(var2 + 1); + + if (isFormatColor(var4)) + { + var1 = "\u00a7" + var4; + } + else if (isFormatSpecial(var4)) + { + var1 = var1 + "\u00a7" + var4; + } + } + } + + return var1; + } + + /** + * Get bidiFlag that controls if the Unicode Bidirectional Algorithm should be run before rendering any string + */ + public boolean getBidiFlag() + { + return this.bidiFlag; + } +} diff --git a/src/main/java/net/minecraft/src/FoodStats.java b/src/main/java/net/minecraft/src/FoodStats.java new file mode 100644 index 0000000..246516a --- /dev/null +++ b/src/main/java/net/minecraft/src/FoodStats.java @@ -0,0 +1,159 @@ +package net.minecraft.src; + +public class FoodStats +{ + /** The player's food level. */ + private int foodLevel = 20; + + /** The player's food saturation. */ + private float foodSaturationLevel = 5.0F; + + /** The player's food exhaustion. */ + private float foodExhaustionLevel; + + /** The player's food timer value. */ + private int foodTimer; + private int prevFoodLevel = 20; + + /** + * Args: int foodLevel, float foodSaturationModifier + */ + public void addStats(int par1, float par2) + { + this.foodLevel = Math.min(par1 + this.foodLevel, 20); + this.foodSaturationLevel = Math.min(this.foodSaturationLevel + (float)par1 * par2 * 2.0F, (float)this.foodLevel); + } + + /** + * Eat some food. + */ + public void addStats(ItemFood par1ItemFood) + { + this.addStats(par1ItemFood.getHealAmount(), par1ItemFood.getSaturationModifier()); + } + + /** + * Handles the food game logic. + */ + public void onUpdate(EntityPlayer par1EntityPlayer) + { + int var2 = par1EntityPlayer.worldObj.difficultySetting; + this.prevFoodLevel = this.foodLevel; + + if (this.foodExhaustionLevel > 4.0F) + { + this.foodExhaustionLevel -= 4.0F; + + if (this.foodSaturationLevel > 0.0F) + { + this.foodSaturationLevel = Math.max(this.foodSaturationLevel - 1.0F, 0.0F); + } + else if (var2 > 0) + { + this.foodLevel = Math.max(this.foodLevel - 1, 0); + } + } + + if (par1EntityPlayer.worldObj.getGameRules().getGameRuleBooleanValue("naturalRegeneration") && this.foodLevel >= 18 && par1EntityPlayer.shouldHeal()) + { + ++this.foodTimer; + + if (this.foodTimer >= 80) + { + par1EntityPlayer.heal(1.0F); + this.addExhaustion(3.0F); + this.foodTimer = 0; + } + } + else if (this.foodLevel <= 0) + { + ++this.foodTimer; + + if (this.foodTimer >= 80) + { + if (par1EntityPlayer.getHealth() > 10.0F || var2 >= 3 || par1EntityPlayer.getHealth() > 1.0F && var2 >= 2) + { + par1EntityPlayer.attackEntityFrom(DamageSource.starve, 1.0F); + } + + this.foodTimer = 0; + } + } + else + { + this.foodTimer = 0; + } + } + + /** + * Reads food stats from an NBT object. + */ + public void readNBT(NBTTagCompound par1NBTTagCompound) + { + if (par1NBTTagCompound.hasKey("foodLevel")) + { + this.foodLevel = par1NBTTagCompound.getInteger("foodLevel"); + this.foodTimer = par1NBTTagCompound.getInteger("foodTickTimer"); + this.foodSaturationLevel = par1NBTTagCompound.getFloat("foodSaturationLevel"); + this.foodExhaustionLevel = par1NBTTagCompound.getFloat("foodExhaustionLevel"); + } + } + + /** + * Writes food stats to an NBT object. + */ + public void writeNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setInteger("foodLevel", this.foodLevel); + par1NBTTagCompound.setInteger("foodTickTimer", this.foodTimer); + par1NBTTagCompound.setFloat("foodSaturationLevel", this.foodSaturationLevel); + par1NBTTagCompound.setFloat("foodExhaustionLevel", this.foodExhaustionLevel); + } + + /** + * Get the player's food level. + */ + public int getFoodLevel() + { + return this.foodLevel; + } + + public int getPrevFoodLevel() + { + return this.prevFoodLevel; + } + + /** + * If foodLevel is not max. + */ + public boolean needFood() + { + return this.foodLevel < 20; + } + + /** + * adds input to foodExhaustionLevel to a max of 40 + */ + public void addExhaustion(float par1) + { + this.foodExhaustionLevel = Math.min(this.foodExhaustionLevel + par1, 40.0F); + } + + /** + * Get the player's food saturation level. + */ + public float getSaturationLevel() + { + return this.foodSaturationLevel; + } + + public void setFoodLevel(int par1) + { + this.foodLevel = par1; + } + + public void setFoodSaturationLevel(float par1) + { + this.foodSaturationLevel = par1; + } +} diff --git a/src/main/java/net/minecraft/src/Frustrum.java b/src/main/java/net/minecraft/src/Frustrum.java new file mode 100644 index 0000000..e7a3a18 --- /dev/null +++ b/src/main/java/net/minecraft/src/Frustrum.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +public class Frustrum implements ICamera +{ + private ClippingHelper clippingHelper = ClippingHelperImpl.getInstance(); + private double xPosition; + private double yPosition; + private double zPosition; + + public void setPosition(double par1, double par3, double par5) + { + this.xPosition = par1; + this.yPosition = par3; + this.zPosition = par5; + } + + /** + * Calls the clipping helper. Returns true if the box is inside all 6 clipping planes, otherwise returns false. + */ + public boolean isBoxInFrustum(double par1, double par3, double par5, double par7, double par9, double par11) + { + return this.clippingHelper.isBoxInFrustum(par1 - this.xPosition, par3 - this.yPosition, par5 - this.zPosition, par7 - this.xPosition, par9 - this.yPosition, par11 - this.zPosition); + } + + /** + * Returns true if the bounding box is inside all 6 clipping planes, otherwise returns false. + */ + public boolean isBoundingBoxInFrustum(AxisAlignedBB par1AxisAlignedBB) + { + return this.isBoxInFrustum(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ, par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); + } +} diff --git a/src/main/java/net/minecraft/src/FurnaceRecipes.java b/src/main/java/net/minecraft/src/FurnaceRecipes.java new file mode 100644 index 0000000..1a48ce9 --- /dev/null +++ b/src/main/java/net/minecraft/src/FurnaceRecipes.java @@ -0,0 +1,72 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.Map; + +public class FurnaceRecipes +{ + private static final FurnaceRecipes smeltingBase = new FurnaceRecipes(); + + /** The list of smelting results. */ + private Map smeltingList = new HashMap(); + private Map experienceList = new HashMap(); + + /** + * Used to call methods addSmelting and getSmeltingResult. + */ + public static final FurnaceRecipes smelting() + { + return smeltingBase; + } + + private FurnaceRecipes() + { + this.addSmelting(Block.oreIron.blockID, new ItemStack(Item.ingotIron), 0.7F); + this.addSmelting(Block.oreGold.blockID, new ItemStack(Item.ingotGold), 1.0F); + this.addSmelting(Block.oreDiamond.blockID, new ItemStack(Item.diamond), 1.0F); + this.addSmelting(Block.sand.blockID, new ItemStack(Block.glass), 0.1F); + this.addSmelting(Item.porkRaw.itemID, new ItemStack(Item.porkCooked), 0.35F); + this.addSmelting(Item.beefRaw.itemID, new ItemStack(Item.beefCooked), 0.35F); + this.addSmelting(Item.chickenRaw.itemID, new ItemStack(Item.chickenCooked), 0.35F); + this.addSmelting(Item.fishRaw.itemID, new ItemStack(Item.fishCooked), 0.35F); + this.addSmelting(Block.cobblestone.blockID, new ItemStack(Block.stone), 0.1F); + this.addSmelting(Item.clay.itemID, new ItemStack(Item.brick), 0.3F); + this.addSmelting(Block.blockClay.blockID, new ItemStack(Block.hardenedClay), 0.35F); + this.addSmelting(Block.cactus.blockID, new ItemStack(Item.dyePowder, 1, 2), 0.2F); + this.addSmelting(Block.wood.blockID, new ItemStack(Item.coal, 1, 1), 0.15F); + this.addSmelting(Block.oreEmerald.blockID, new ItemStack(Item.emerald), 1.0F); + this.addSmelting(Item.potato.itemID, new ItemStack(Item.bakedPotato), 0.35F); + this.addSmelting(Block.netherrack.blockID, new ItemStack(Item.netherrackBrick), 0.1F); + this.addSmelting(Block.oreCoal.blockID, new ItemStack(Item.coal), 0.1F); + this.addSmelting(Block.oreRedstone.blockID, new ItemStack(Item.redstone), 0.7F); + this.addSmelting(Block.oreLapis.blockID, new ItemStack(Item.dyePowder, 1, 4), 0.2F); + this.addSmelting(Block.oreNetherQuartz.blockID, new ItemStack(Item.netherQuartz), 0.2F); + } + + /** + * Adds a smelting recipe. + */ + public void addSmelting(int par1, ItemStack par2ItemStack, float par3) + { + this.smeltingList.put(Integer.valueOf(par1), par2ItemStack); + this.experienceList.put(Integer.valueOf(par2ItemStack.itemID), Float.valueOf(par3)); + } + + /** + * Returns the smelting result of an item. + */ + public ItemStack getSmeltingResult(int par1) + { + return (ItemStack)this.smeltingList.get(Integer.valueOf(par1)); + } + + public Map getSmeltingList() + { + return this.smeltingList; + } + + public float getExperience(int par1) + { + return this.experienceList.containsKey(Integer.valueOf(par1)) ? ((Float)this.experienceList.get(Integer.valueOf(par1))).floatValue() : 0.0F; + } +} diff --git a/src/main/java/net/minecraft/src/GLAllocation.java b/src/main/java/net/minecraft/src/GLAllocation.java new file mode 100644 index 0000000..5401a0a --- /dev/null +++ b/src/main/java/net/minecraft/src/GLAllocation.java @@ -0,0 +1,86 @@ +package net.minecraft.src; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import org.lwjgl.opengl.GL11; + +public class GLAllocation +{ + private static final Map field_74531_a = new HashMap(); + private static final List field_74530_b = new ArrayList(); + + /** + * Generates the specified number of display lists and returns the first index. + */ + public static synchronized int generateDisplayLists(int par0) + { + int var1 = GL11.glGenLists(par0); + field_74531_a.put(Integer.valueOf(var1), Integer.valueOf(par0)); + return var1; + } + + public static synchronized void deleteDisplayLists(int par0) + { + GL11.glDeleteLists(par0, ((Integer)field_74531_a.remove(Integer.valueOf(par0))).intValue()); + } + + public static synchronized void func_98302_b() + { + for (int var0 = 0; var0 < field_74530_b.size(); ++var0) + { + GL11.glDeleteTextures(((Integer)field_74530_b.get(var0)).intValue()); + } + + field_74530_b.clear(); + } + + /** + * Deletes all textures and display lists. Called when Minecraft is shutdown to free up resources. + */ + public static synchronized void deleteTexturesAndDisplayLists() + { + Iterator var0 = field_74531_a.entrySet().iterator(); + + while (var0.hasNext()) + { + Entry var1 = (Entry)var0.next(); + GL11.glDeleteLists(((Integer)var1.getKey()).intValue(), ((Integer)var1.getValue()).intValue()); + } + + field_74531_a.clear(); + func_98302_b(); + } + + /** + * Creates and returns a direct byte buffer with the specified capacity. Applies native ordering to speed up access. + */ + public static synchronized ByteBuffer createDirectByteBuffer(int par0) + { + return ByteBuffer.allocateDirect(par0).order(ByteOrder.nativeOrder()); + } + + /** + * Creates and returns a direct int buffer with the specified capacity. Applies native ordering to speed up access. + */ + public static IntBuffer createDirectIntBuffer(int par0) + { + return createDirectByteBuffer(par0 << 2).asIntBuffer(); + } + + /** + * Creates and returns a direct float buffer with the specified capacity. Applies native ordering to speed up + * access. + */ + public static FloatBuffer createDirectFloatBuffer(int par0) + { + return createDirectByteBuffer(par0 << 2).asFloatBuffer(); + } +} diff --git a/src/main/java/net/minecraft/src/GameRuleValue.java b/src/main/java/net/minecraft/src/GameRuleValue.java new file mode 100644 index 0000000..0d88784 --- /dev/null +++ b/src/main/java/net/minecraft/src/GameRuleValue.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +class GameRuleValue +{ + private String valueString; + private boolean valueBoolean; + private int valueInteger; + private double valueDouble; + + public GameRuleValue(String par1Str) + { + this.setValue(par1Str); + } + + /** + * Set this game rule value. + */ + public void setValue(String par1Str) + { + this.valueString = par1Str; + this.valueBoolean = Boolean.parseBoolean(par1Str); + + try + { + this.valueInteger = Integer.parseInt(par1Str); + } + catch (NumberFormatException var4) + { + ; + } + + try + { + this.valueDouble = Double.parseDouble(par1Str); + } + catch (NumberFormatException var3) + { + ; + } + } + + /** + * Gets the GameRule's value as String. + */ + public String getGameRuleStringValue() + { + return this.valueString; + } + + /** + * Gets the GameRule's value as boolean. + */ + public boolean getGameRuleBooleanValue() + { + return this.valueBoolean; + } +} diff --git a/src/main/java/net/minecraft/src/GameRules.java b/src/main/java/net/minecraft/src/GameRules.java new file mode 100644 index 0000000..c389ccc --- /dev/null +++ b/src/main/java/net/minecraft/src/GameRules.java @@ -0,0 +1,114 @@ +package net.minecraft.src; + +import java.util.Collection; +import java.util.Iterator; +import java.util.TreeMap; + +public class GameRules +{ + private TreeMap theGameRules = new TreeMap(); + + public GameRules() + { + this.addGameRule("doFireTick", "true"); + this.addGameRule("mobGriefing", "true"); + this.addGameRule("keepInventory", "false"); + this.addGameRule("doMobSpawning", "true"); + this.addGameRule("doMobLoot", "true"); + this.addGameRule("doTileDrops", "true"); + this.addGameRule("commandBlockOutput", "true"); + this.addGameRule("naturalRegeneration", "true"); + this.addGameRule("doDaylightCycle", "true"); + } + + /** + * Define a game rule and its default value. + */ + public void addGameRule(String par1Str, String par2Str) + { + this.theGameRules.put(par1Str, new GameRuleValue(par2Str)); + } + + public void setOrCreateGameRule(String par1Str, String par2Str) + { + GameRuleValue var3 = (GameRuleValue)this.theGameRules.get(par1Str); + + if (var3 != null) + { + var3.setValue(par2Str); + } + else + { + this.addGameRule(par1Str, par2Str); + } + } + + /** + * Gets the string Game Rule value. + */ + public String getGameRuleStringValue(String par1Str) + { + GameRuleValue var2 = (GameRuleValue)this.theGameRules.get(par1Str); + return var2 != null ? var2.getGameRuleStringValue() : ""; + } + + /** + * Gets the boolean Game Rule value. + */ + public boolean getGameRuleBooleanValue(String par1Str) + { + GameRuleValue var2 = (GameRuleValue)this.theGameRules.get(par1Str); + return var2 != null ? var2.getGameRuleBooleanValue() : false; + } + + /** + * Return the defined game rules as NBT. + */ + public NBTTagCompound writeGameRulesToNBT() + { + NBTTagCompound var1 = new NBTTagCompound("GameRules"); + Iterator var2 = this.theGameRules.keySet().iterator(); + + while (var2.hasNext()) + { + String var3 = (String)var2.next(); + GameRuleValue var4 = (GameRuleValue)this.theGameRules.get(var3); + var1.setString(var3, var4.getGameRuleStringValue()); + } + + return var1; + } + + /** + * Set defined game rules from NBT. + */ + public void readGameRulesFromNBT(NBTTagCompound par1NBTTagCompound) + { + Collection var2 = par1NBTTagCompound.getTags(); + Iterator var3 = var2.iterator(); + + while (var3.hasNext()) + { + NBTBase var4 = (NBTBase)var3.next(); + String var5 = var4.getName(); + String var6 = par1NBTTagCompound.getString(var4.getName()); + this.setOrCreateGameRule(var5, var6); + } + } + + /** + * Return the defined game rules. + */ + public String[] getRules() + { + return (String[])this.theGameRules.keySet().toArray(new String[0]); + } + + /** + * Return whether the specified game rule is defined. + */ + public boolean hasRule(String par1Str) + { + return this.theGameRules.containsKey(par1Str); + } +} diff --git a/src/main/java/net/minecraft/src/GameSettings.java b/src/main/java/net/minecraft/src/GameSettings.java new file mode 100644 index 0000000..e595efc --- /dev/null +++ b/src/main/java/net/minecraft/src/GameSettings.java @@ -0,0 +1,866 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.PrintWriter; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; + +public class GameSettings +{ + private static final String[] RENDER_DISTANCES = new String[] {"options.renderDistance.far", "options.renderDistance.normal", "options.renderDistance.short", "options.renderDistance.tiny"}; + private static final String[] DIFFICULTIES = new String[] {"options.difficulty.peaceful", "options.difficulty.easy", "options.difficulty.normal", "options.difficulty.hard"}; + + /** GUI scale values */ + private static final String[] GUISCALES = new String[] {"options.guiScale.auto", "options.guiScale.small", "options.guiScale.normal", "options.guiScale.large"}; + private static final String[] CHAT_VISIBILITIES = new String[] {"options.chat.visibility.full", "options.chat.visibility.system", "options.chat.visibility.hidden"}; + private static final String[] PARTICLES = new String[] {"options.particles.all", "options.particles.decreased", "options.particles.minimal"}; + + /** Limit framerate labels */ + private static final String[] LIMIT_FRAMERATES = new String[] {"performance.max", "performance.balanced", "performance.powersaver"}; + private static final String[] AMBIENT_OCCLUSIONS = new String[] {"options.ao.off", "options.ao.min", "options.ao.max"}; + public float musicVolume = 1.0F; + public float soundVolume = 1.0F; + public float mouseSensitivity = 0.5F; + public boolean invertMouse; + public int renderDistance; + public boolean viewBobbing = true; + public boolean anaglyph; + + /** Advanced OpenGL */ + public boolean advancedOpengl; + public int limitFramerate = 1; + public boolean fancyGraphics = true; + + /** Smooth Lighting */ + public int ambientOcclusion = 2; + + /** Clouds flag */ + public boolean clouds = true; + + /** The name of the selected texture pack. */ + public String skin = "Default"; + public int chatVisibility; + public boolean chatColours = true; + public boolean chatLinks = true; + public boolean chatLinksPrompt = true; + public float chatOpacity = 1.0F; + public boolean serverTextures = true; + public boolean snooperEnabled = true; + public boolean fullScreen; + public boolean enableVsync = true; + public boolean hideServerAddress; + + /** + * Whether to show advanced information on item tooltips, toggled by F3+H + */ + public boolean advancedItemTooltips; + + /** Whether to pause when the game loses focus, toggled by F3+P */ + public boolean pauseOnLostFocus = true; + + /** Whether to show your cape */ + public boolean showCape = true; + public boolean touchscreen; + public int overrideWidth; + public int overrideHeight; + public boolean heldItemTooltips = true; + public float chatScale = 1.0F; + public float chatWidth = 1.0F; + public float chatHeightUnfocused = 0.44366196F; + public float chatHeightFocused = 1.0F; + public KeyBinding keyBindForward = new KeyBinding("key.forward", 17); + public KeyBinding keyBindLeft = new KeyBinding("key.left", 30); + public KeyBinding keyBindBack = new KeyBinding("key.back", 31); + public KeyBinding keyBindRight = new KeyBinding("key.right", 32); + public KeyBinding keyBindJump = new KeyBinding("key.jump", 57); + public KeyBinding keyBindInventory = new KeyBinding("key.inventory", 18); + public KeyBinding keyBindDrop = new KeyBinding("key.drop", 16); + public KeyBinding keyBindChat = new KeyBinding("key.chat", 20); + public KeyBinding keyBindSneak = new KeyBinding("key.sneak", 42); + public KeyBinding keyBindAttack = new KeyBinding("key.attack", -100); + public KeyBinding keyBindUseItem = new KeyBinding("key.use", -99); + public KeyBinding keyBindPlayerList = new KeyBinding("key.playerlist", 15); + public KeyBinding keyBindPickBlock = new KeyBinding("key.pickItem", -98); + public KeyBinding keyBindCommand = new KeyBinding("key.command", 53); + public KeyBinding[] keyBindings; + protected Minecraft mc; + private File optionsFile; + public int difficulty; + public boolean hideGUI; + public int thirdPersonView; + + /** true if debug info should be displayed instead of version */ + public boolean showDebugInfo; + public boolean showDebugProfilerChart; + + /** The lastServer string. */ + public String lastServer; + + /** No clipping for singleplayer */ + public boolean noclip; + + /** Smooth Camera Toggle */ + public boolean smoothCamera; + public boolean debugCamEnable; + + /** No clipping movement rate */ + public float noclipRate; + + /** Change rate for debug camera */ + public float debugCamRate; + public float fovSetting; + public float gammaSetting; + + /** GUI scale */ + public int guiScale; + + /** Determines amount of particles. 0 = All, 1 = Decreased, 2 = Minimal */ + public int particleSetting; + + /** Game settings language */ + public String language; + + public GameSettings(Minecraft par1Minecraft, File par2File) + { + this.keyBindings = new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand}; + this.difficulty = 2; + this.lastServer = ""; + this.noclipRate = 1.0F; + this.debugCamRate = 1.0F; + this.language = "en_US"; + this.mc = par1Minecraft; + this.optionsFile = new File(par2File, "options.txt"); + this.loadOptions(); + } + + public GameSettings() + { + this.keyBindings = new KeyBinding[] {this.keyBindAttack, this.keyBindUseItem, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindSneak, this.keyBindDrop, this.keyBindInventory, this.keyBindChat, this.keyBindPlayerList, this.keyBindPickBlock, this.keyBindCommand}; + this.difficulty = 2; + this.lastServer = ""; + this.noclipRate = 1.0F; + this.debugCamRate = 1.0F; + this.language = "en_US"; + } + + public String getKeyBindingDescription(int par1) + { + return I18n.getString(this.keyBindings[par1].keyDescription); + } + + /** + * The string that appears inside the button/slider in the options menu. + */ + public String getOptionDisplayString(int par1) + { + int var2 = this.keyBindings[par1].keyCode; + return getKeyDisplayString(var2); + } + + /** + * Represents a key or mouse button as a string. Args: key + */ + public static String getKeyDisplayString(int par0) + { + return par0 < 0 ? I18n.getStringParams("key.mouseButton", new Object[] {Integer.valueOf(par0 + 101)}): Keyboard.getKeyName(par0); + } + + /** + * Returns whether the specified key binding is currently being pressed. + */ + public static boolean isKeyDown(KeyBinding par0KeyBinding) + { + return par0KeyBinding.keyCode < 0 ? Mouse.isButtonDown(par0KeyBinding.keyCode + 100) : Keyboard.isKeyDown(par0KeyBinding.keyCode); + } + + /** + * Sets a key binding. + */ + public void setKeyBinding(int par1, int par2) + { + this.keyBindings[par1].keyCode = par2; + this.saveOptions(); + } + + /** + * If the specified option is controlled by a slider (float value), this will set the float value. + */ + public void setOptionFloatValue(EnumOptions par1EnumOptions, float par2) + { + if (par1EnumOptions == EnumOptions.MUSIC) + { + this.musicVolume = par2; + this.mc.sndManager.onSoundOptionsChanged(); + } + + if (par1EnumOptions == EnumOptions.SOUND) + { + this.soundVolume = par2; + this.mc.sndManager.onSoundOptionsChanged(); + } + + if (par1EnumOptions == EnumOptions.SENSITIVITY) + { + this.mouseSensitivity = par2; + } + + if (par1EnumOptions == EnumOptions.FOV) + { + this.fovSetting = par2; + } + + if (par1EnumOptions == EnumOptions.GAMMA) + { + this.gammaSetting = par2; + } + + if (par1EnumOptions == EnumOptions.CHAT_OPACITY) + { + this.chatOpacity = par2; + this.mc.ingameGUI.getChatGUI().func_96132_b(); + } + + if (par1EnumOptions == EnumOptions.CHAT_HEIGHT_FOCUSED) + { + this.chatHeightFocused = par2; + this.mc.ingameGUI.getChatGUI().func_96132_b(); + } + + if (par1EnumOptions == EnumOptions.CHAT_HEIGHT_UNFOCUSED) + { + this.chatHeightUnfocused = par2; + this.mc.ingameGUI.getChatGUI().func_96132_b(); + } + + if (par1EnumOptions == EnumOptions.CHAT_WIDTH) + { + this.chatWidth = par2; + this.mc.ingameGUI.getChatGUI().func_96132_b(); + } + + if (par1EnumOptions == EnumOptions.CHAT_SCALE) + { + this.chatScale = par2; + this.mc.ingameGUI.getChatGUI().func_96132_b(); + } + } + + /** + * For non-float options. Toggles the option on/off, or cycles through the list i.e. render distances. + */ + public void setOptionValue(EnumOptions par1EnumOptions, int par2) + { + if (par1EnumOptions == EnumOptions.INVERT_MOUSE) + { + this.invertMouse = !this.invertMouse; + } + + if (par1EnumOptions == EnumOptions.RENDER_DISTANCE) + { + this.renderDistance = this.renderDistance + par2 & 3; + } + + if (par1EnumOptions == EnumOptions.GUI_SCALE) + { + this.guiScale = this.guiScale + par2 & 3; + } + + if (par1EnumOptions == EnumOptions.PARTICLES) + { + this.particleSetting = (this.particleSetting + par2) % 3; + } + + if (par1EnumOptions == EnumOptions.VIEW_BOBBING) + { + this.viewBobbing = !this.viewBobbing; + } + + if (par1EnumOptions == EnumOptions.RENDER_CLOUDS) + { + this.clouds = !this.clouds; + } + + if (par1EnumOptions == EnumOptions.ADVANCED_OPENGL) + { + this.advancedOpengl = !this.advancedOpengl; + this.mc.renderGlobal.loadRenderers(); + } + + if (par1EnumOptions == EnumOptions.ANAGLYPH) + { + this.anaglyph = !this.anaglyph; + this.mc.refreshResources(); + } + + if (par1EnumOptions == EnumOptions.FRAMERATE_LIMIT) + { + this.limitFramerate = (this.limitFramerate + par2 + 3) % 3; + } + + if (par1EnumOptions == EnumOptions.DIFFICULTY) + { + this.difficulty = this.difficulty + par2 & 3; + } + + if (par1EnumOptions == EnumOptions.GRAPHICS) + { + this.fancyGraphics = !this.fancyGraphics; + this.mc.renderGlobal.loadRenderers(); + } + + if (par1EnumOptions == EnumOptions.AMBIENT_OCCLUSION) + { + this.ambientOcclusion = (this.ambientOcclusion + par2) % 3; + this.mc.renderGlobal.loadRenderers(); + } + + if (par1EnumOptions == EnumOptions.CHAT_VISIBILITY) + { + this.chatVisibility = (this.chatVisibility + par2) % 3; + } + + if (par1EnumOptions == EnumOptions.CHAT_COLOR) + { + this.chatColours = !this.chatColours; + } + + if (par1EnumOptions == EnumOptions.CHAT_LINKS) + { + this.chatLinks = !this.chatLinks; + } + + if (par1EnumOptions == EnumOptions.CHAT_LINKS_PROMPT) + { + this.chatLinksPrompt = !this.chatLinksPrompt; + } + + if (par1EnumOptions == EnumOptions.USE_SERVER_TEXTURES) + { + this.serverTextures = !this.serverTextures; + } + + if (par1EnumOptions == EnumOptions.SNOOPER_ENABLED) + { + this.snooperEnabled = !this.snooperEnabled; + } + + if (par1EnumOptions == EnumOptions.SHOW_CAPE) + { + this.showCape = !this.showCape; + } + + if (par1EnumOptions == EnumOptions.TOUCHSCREEN) + { + this.touchscreen = !this.touchscreen; + } + + if (par1EnumOptions == EnumOptions.USE_FULLSCREEN) + { + this.fullScreen = !this.fullScreen; + + if (this.mc.isFullScreen() != this.fullScreen) + { + this.mc.toggleFullscreen(); + } + } + + if (par1EnumOptions == EnumOptions.ENABLE_VSYNC) + { + this.enableVsync = !this.enableVsync; + Display.setVSyncEnabled(this.enableVsync); + } + + this.saveOptions(); + } + + public float getOptionFloatValue(EnumOptions par1EnumOptions) + { + return par1EnumOptions == EnumOptions.FOV ? this.fovSetting : (par1EnumOptions == EnumOptions.GAMMA ? this.gammaSetting : (par1EnumOptions == EnumOptions.MUSIC ? this.musicVolume : (par1EnumOptions == EnumOptions.SOUND ? this.soundVolume : (par1EnumOptions == EnumOptions.SENSITIVITY ? this.mouseSensitivity : (par1EnumOptions == EnumOptions.CHAT_OPACITY ? this.chatOpacity : (par1EnumOptions == EnumOptions.CHAT_HEIGHT_FOCUSED ? this.chatHeightFocused : (par1EnumOptions == EnumOptions.CHAT_HEIGHT_UNFOCUSED ? this.chatHeightUnfocused : (par1EnumOptions == EnumOptions.CHAT_SCALE ? this.chatScale : (par1EnumOptions == EnumOptions.CHAT_WIDTH ? this.chatWidth : 0.0F))))))))); + } + + public boolean getOptionOrdinalValue(EnumOptions par1EnumOptions) + { + switch (EnumOptionsHelper.enumOptionsMappingHelperArray[par1EnumOptions.ordinal()]) + { + case 1: + return this.invertMouse; + + case 2: + return this.viewBobbing; + + case 3: + return this.anaglyph; + + case 4: + return this.advancedOpengl; + + case 5: + return this.clouds; + + case 6: + return this.chatColours; + + case 7: + return this.chatLinks; + + case 8: + return this.chatLinksPrompt; + + case 9: + return this.serverTextures; + + case 10: + return this.snooperEnabled; + + case 11: + return this.fullScreen; + + case 12: + return this.enableVsync; + + case 13: + return this.showCape; + + case 14: + return this.touchscreen; + + default: + return false; + } + } + + /** + * Returns the translation of the given index in the given String array. If the index is smaller than 0 or greater + * than/equal to the length of the String array, it is changed to 0. + */ + private static String getTranslation(String[] par0ArrayOfStr, int par1) + { + if (par1 < 0 || par1 >= par0ArrayOfStr.length) + { + par1 = 0; + } + + return I18n.getString(par0ArrayOfStr[par1]); + } + + /** + * Gets a key binding. + */ + public String getKeyBinding(EnumOptions par1EnumOptions) + { + String var2 = I18n.getString(par1EnumOptions.getEnumString()) + ": "; + + if (par1EnumOptions.getEnumFloat()) + { + float var5 = this.getOptionFloatValue(par1EnumOptions); + return par1EnumOptions == EnumOptions.SENSITIVITY ? (var5 == 0.0F ? var2 + I18n.getString("options.sensitivity.min") : (var5 == 1.0F ? var2 + I18n.getString("options.sensitivity.max") : var2 + (int)(var5 * 200.0F) + "%")) : (par1EnumOptions == EnumOptions.FOV ? (var5 == 0.0F ? var2 + I18n.getString("options.fov.min") : (var5 == 1.0F ? var2 + I18n.getString("options.fov.max") : var2 + (int)(70.0F + var5 * 40.0F))) : (par1EnumOptions == EnumOptions.GAMMA ? (var5 == 0.0F ? var2 + I18n.getString("options.gamma.min") : (var5 == 1.0F ? var2 + I18n.getString("options.gamma.max") : var2 + "+" + (int)(var5 * 100.0F) + "%")) : (par1EnumOptions == EnumOptions.CHAT_OPACITY ? var2 + (int)(var5 * 90.0F + 10.0F) + "%" : (par1EnumOptions == EnumOptions.CHAT_HEIGHT_UNFOCUSED ? var2 + GuiNewChat.func_96130_b(var5) + "px" : (par1EnumOptions == EnumOptions.CHAT_HEIGHT_FOCUSED ? var2 + GuiNewChat.func_96130_b(var5) + "px" : (par1EnumOptions == EnumOptions.CHAT_WIDTH ? var2 + GuiNewChat.func_96128_a(var5) + "px" : (var5 == 0.0F ? var2 + I18n.getString("options.off") : var2 + (int)(var5 * 100.0F) + "%"))))))); + } + else if (par1EnumOptions.getEnumBoolean()) + { + boolean var4 = this.getOptionOrdinalValue(par1EnumOptions); + return var4 ? var2 + I18n.getString("options.on") : var2 + I18n.getString("options.off"); + } + else if (par1EnumOptions == EnumOptions.RENDER_DISTANCE) + { + return var2 + getTranslation(RENDER_DISTANCES, this.renderDistance); + } + else if (par1EnumOptions == EnumOptions.DIFFICULTY) + { + return var2 + getTranslation(DIFFICULTIES, this.difficulty); + } + else if (par1EnumOptions == EnumOptions.GUI_SCALE) + { + return var2 + getTranslation(GUISCALES, this.guiScale); + } + else if (par1EnumOptions == EnumOptions.CHAT_VISIBILITY) + { + return var2 + getTranslation(CHAT_VISIBILITIES, this.chatVisibility); + } + else if (par1EnumOptions == EnumOptions.PARTICLES) + { + return var2 + getTranslation(PARTICLES, this.particleSetting); + } + else if (par1EnumOptions == EnumOptions.FRAMERATE_LIMIT) + { + return var2 + getTranslation(LIMIT_FRAMERATES, this.limitFramerate); + } + else if (par1EnumOptions == EnumOptions.AMBIENT_OCCLUSION) + { + return var2 + getTranslation(AMBIENT_OCCLUSIONS, this.ambientOcclusion); + } + else if (par1EnumOptions == EnumOptions.GRAPHICS) + { + if (this.fancyGraphics) + { + return var2 + I18n.getString("options.graphics.fancy"); + } + else + { + String var3 = "options.graphics.fast"; + return var2 + I18n.getString("options.graphics.fast"); + } + } + else + { + return var2; + } + } + + /** + * Loads the options from the options file. It appears that this has replaced the previous 'loadOptions' + */ + public void loadOptions() + { + try + { + if (!this.optionsFile.exists()) + { + return; + } + + BufferedReader var1 = new BufferedReader(new FileReader(this.optionsFile)); + String var2 = ""; + + while ((var2 = var1.readLine()) != null) + { + try + { + String[] var3 = var2.split(":"); + + if (var3[0].equals("music")) + { + this.musicVolume = this.parseFloat(var3[1]); + } + + if (var3[0].equals("sound")) + { + this.soundVolume = this.parseFloat(var3[1]); + } + + if (var3[0].equals("mouseSensitivity")) + { + this.mouseSensitivity = this.parseFloat(var3[1]); + } + + if (var3[0].equals("fov")) + { + this.fovSetting = this.parseFloat(var3[1]); + } + + if (var3[0].equals("gamma")) + { + this.gammaSetting = this.parseFloat(var3[1]); + } + + if (var3[0].equals("invertYMouse")) + { + this.invertMouse = var3[1].equals("true"); + } + + if (var3[0].equals("viewDistance")) + { + this.renderDistance = Integer.parseInt(var3[1]); + } + + if (var3[0].equals("guiScale")) + { + this.guiScale = Integer.parseInt(var3[1]); + } + + if (var3[0].equals("particles")) + { + this.particleSetting = Integer.parseInt(var3[1]); + } + + if (var3[0].equals("bobView")) + { + this.viewBobbing = var3[1].equals("true"); + } + + if (var3[0].equals("anaglyph3d")) + { + this.anaglyph = var3[1].equals("true"); + } + + if (var3[0].equals("advancedOpengl")) + { + this.advancedOpengl = var3[1].equals("true"); + } + + if (var3[0].equals("fpsLimit")) + { + this.limitFramerate = Integer.parseInt(var3[1]); + } + + if (var3[0].equals("difficulty")) + { + this.difficulty = Integer.parseInt(var3[1]); + } + + if (var3[0].equals("fancyGraphics")) + { + this.fancyGraphics = var3[1].equals("true"); + } + + if (var3[0].equals("ao")) + { + if (var3[1].equals("true")) + { + this.ambientOcclusion = 2; + } + else if (var3[1].equals("false")) + { + this.ambientOcclusion = 0; + } + else + { + this.ambientOcclusion = Integer.parseInt(var3[1]); + } + } + + if (var3[0].equals("clouds")) + { + this.clouds = var3[1].equals("true"); + } + + if (var3[0].equals("skin")) + { + this.skin = var3[1]; + } + + if (var3[0].equals("lastServer") && var3.length >= 2) + { + this.lastServer = var2.substring(var2.indexOf(58) + 1); + } + + if (var3[0].equals("lang") && var3.length >= 2) + { + this.language = var3[1]; + } + + if (var3[0].equals("chatVisibility")) + { + this.chatVisibility = Integer.parseInt(var3[1]); + } + + if (var3[0].equals("chatColors")) + { + this.chatColours = var3[1].equals("true"); + } + + if (var3[0].equals("chatLinks")) + { + this.chatLinks = var3[1].equals("true"); + } + + if (var3[0].equals("chatLinksPrompt")) + { + this.chatLinksPrompt = var3[1].equals("true"); + } + + if (var3[0].equals("chatOpacity")) + { + this.chatOpacity = this.parseFloat(var3[1]); + } + + if (var3[0].equals("serverTextures")) + { + this.serverTextures = var3[1].equals("true"); + } + + if (var3[0].equals("snooperEnabled")) + { + this.snooperEnabled = var3[1].equals("true"); + } + + if (var3[0].equals("fullscreen")) + { + this.fullScreen = var3[1].equals("true"); + } + + if (var3[0].equals("enableVsync")) + { + this.enableVsync = var3[1].equals("true"); + } + + if (var3[0].equals("hideServerAddress")) + { + this.hideServerAddress = var3[1].equals("true"); + } + + if (var3[0].equals("advancedItemTooltips")) + { + this.advancedItemTooltips = var3[1].equals("true"); + } + + if (var3[0].equals("pauseOnLostFocus")) + { + this.pauseOnLostFocus = var3[1].equals("true"); + } + + if (var3[0].equals("showCape")) + { + this.showCape = var3[1].equals("true"); + } + + if (var3[0].equals("touchscreen")) + { + this.touchscreen = var3[1].equals("true"); + } + + if (var3[0].equals("overrideHeight")) + { + this.overrideHeight = Integer.parseInt(var3[1]); + } + + if (var3[0].equals("overrideWidth")) + { + this.overrideWidth = Integer.parseInt(var3[1]); + } + + if (var3[0].equals("heldItemTooltips")) + { + this.heldItemTooltips = var3[1].equals("true"); + } + + if (var3[0].equals("chatHeightFocused")) + { + this.chatHeightFocused = this.parseFloat(var3[1]); + } + + if (var3[0].equals("chatHeightUnfocused")) + { + this.chatHeightUnfocused = this.parseFloat(var3[1]); + } + + if (var3[0].equals("chatScale")) + { + this.chatScale = this.parseFloat(var3[1]); + } + + if (var3[0].equals("chatWidth")) + { + this.chatWidth = this.parseFloat(var3[1]); + } + + for (int var4 = 0; var4 < this.keyBindings.length; ++var4) + { + if (var3[0].equals("key_" + this.keyBindings[var4].keyDescription)) + { + this.keyBindings[var4].keyCode = Integer.parseInt(var3[1]); + } + } + } + catch (Exception var5) + { + this.mc.getLogAgent().logWarning("Skipping bad option: " + var2); + } + } + + KeyBinding.resetKeyBindingArrayAndHash(); + var1.close(); + } + catch (Exception var6) + { + this.mc.getLogAgent().logWarning("Failed to load options"); + var6.printStackTrace(); + } + } + + /** + * Parses a string into a float. + */ + private float parseFloat(String par1Str) + { + return par1Str.equals("true") ? 1.0F : (par1Str.equals("false") ? 0.0F : Float.parseFloat(par1Str)); + } + + /** + * Saves the options to the options file. + */ + public void saveOptions() + { + try + { + PrintWriter var1 = new PrintWriter(new FileWriter(this.optionsFile)); + var1.println("music:" + this.musicVolume); + var1.println("sound:" + this.soundVolume); + var1.println("invertYMouse:" + this.invertMouse); + var1.println("mouseSensitivity:" + this.mouseSensitivity); + var1.println("fov:" + this.fovSetting); + var1.println("gamma:" + this.gammaSetting); + var1.println("viewDistance:" + this.renderDistance); + var1.println("guiScale:" + this.guiScale); + var1.println("particles:" + this.particleSetting); + var1.println("bobView:" + this.viewBobbing); + var1.println("anaglyph3d:" + this.anaglyph); + var1.println("advancedOpengl:" + this.advancedOpengl); + var1.println("fpsLimit:" + this.limitFramerate); + var1.println("difficulty:" + this.difficulty); + var1.println("fancyGraphics:" + this.fancyGraphics); + var1.println("ao:" + this.ambientOcclusion); + var1.println("clouds:" + this.clouds); + var1.println("skin:" + this.skin); + var1.println("lastServer:" + this.lastServer); + var1.println("lang:" + this.language); + var1.println("chatVisibility:" + this.chatVisibility); + var1.println("chatColors:" + this.chatColours); + var1.println("chatLinks:" + this.chatLinks); + var1.println("chatLinksPrompt:" + this.chatLinksPrompt); + var1.println("chatOpacity:" + this.chatOpacity); + var1.println("serverTextures:" + this.serverTextures); + var1.println("snooperEnabled:" + this.snooperEnabled); + var1.println("fullscreen:" + this.fullScreen); + var1.println("enableVsync:" + this.enableVsync); + var1.println("hideServerAddress:" + this.hideServerAddress); + var1.println("advancedItemTooltips:" + this.advancedItemTooltips); + var1.println("pauseOnLostFocus:" + this.pauseOnLostFocus); + var1.println("showCape:" + this.showCape); + var1.println("touchscreen:" + this.touchscreen); + var1.println("overrideWidth:" + this.overrideWidth); + var1.println("overrideHeight:" + this.overrideHeight); + var1.println("heldItemTooltips:" + this.heldItemTooltips); + var1.println("chatHeightFocused:" + this.chatHeightFocused); + var1.println("chatHeightUnfocused:" + this.chatHeightUnfocused); + var1.println("chatScale:" + this.chatScale); + var1.println("chatWidth:" + this.chatWidth); + + for (int var2 = 0; var2 < this.keyBindings.length; ++var2) + { + var1.println("key_" + this.keyBindings[var2].keyDescription + ":" + this.keyBindings[var2].keyCode); + } + + var1.close(); + } + catch (Exception var3) + { + this.mc.getLogAgent().logWarning("Failed to save options"); + var3.printStackTrace(); + } + + this.sendSettingsToServer(); + } + + /** + * Send a client info packet with settings information to the server + */ + public void sendSettingsToServer() + { + if (this.mc.thePlayer != null) + { + this.mc.thePlayer.sendQueue.addToSendQueue(new Packet204ClientInfo(this.language, this.renderDistance, this.chatVisibility, this.chatColours, this.difficulty, this.showCape)); + } + } + + /** + * Should render clouds + */ + public boolean shouldRenderClouds() + { + return this.renderDistance < 2 && this.clouds; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayer.java b/src/main/java/net/minecraft/src/GenLayer.java new file mode 100644 index 0000000..ed9c056 --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayer.java @@ -0,0 +1,152 @@ +package net.minecraft.src; + +public abstract class GenLayer +{ + /** seed from World#getWorldSeed that is used in the LCG prng */ + private long worldGenSeed; + + /** parent GenLayer that was provided via the constructor */ + protected GenLayer parent; + + /** + * final part of the LCG prng that uses the chunk X, Z coords along with the other two seeds to generate + * pseudorandom numbers + */ + private long chunkSeed; + + /** base seed to the LCG prng provided via the constructor */ + private long baseSeed; + + /** + * the first array item is a linked list of the bioms, the second is the zoom function, the third is the same as the + * first. + */ + public static GenLayer[] initializeAllBiomeGenerators(long par0, WorldType par2WorldType) + { + GenLayerIsland var3 = new GenLayerIsland(1L); + GenLayerFuzzyZoom var9 = new GenLayerFuzzyZoom(2000L, var3); + GenLayerAddIsland var10 = new GenLayerAddIsland(1L, var9); + GenLayerZoom var11 = new GenLayerZoom(2001L, var10); + var10 = new GenLayerAddIsland(2L, var11); + GenLayerAddSnow var12 = new GenLayerAddSnow(2L, var10); + var11 = new GenLayerZoom(2002L, var12); + var10 = new GenLayerAddIsland(3L, var11); + var11 = new GenLayerZoom(2003L, var10); + var10 = new GenLayerAddIsland(4L, var11); + GenLayerAddMushroomIsland var15 = new GenLayerAddMushroomIsland(5L, var10); + byte var4 = 4; + + if (par2WorldType == WorldType.LARGE_BIOMES) + { + var4 = 6; + } + + GenLayer var5 = GenLayerZoom.magnify(1000L, var15, 0); + GenLayerRiverInit var13 = new GenLayerRiverInit(100L, var5); + var5 = GenLayerZoom.magnify(1000L, var13, var4 + 2); + GenLayerRiver var14 = new GenLayerRiver(1L, var5); + GenLayerSmooth var16 = new GenLayerSmooth(1000L, var14); + GenLayer var6 = GenLayerZoom.magnify(1000L, var15, 0); + GenLayerBiome var17 = new GenLayerBiome(200L, var6, par2WorldType); + var6 = GenLayerZoom.magnify(1000L, var17, 2); + Object var18 = new GenLayerHills(1000L, var6); + + for (int var7 = 0; var7 < var4; ++var7) + { + var18 = new GenLayerZoom((long)(1000 + var7), (GenLayer)var18); + + if (var7 == 0) + { + var18 = new GenLayerAddIsland(3L, (GenLayer)var18); + } + + if (var7 == 1) + { + var18 = new GenLayerShore(1000L, (GenLayer)var18); + } + + if (var7 == 1) + { + var18 = new GenLayerSwampRivers(1000L, (GenLayer)var18); + } + } + + GenLayerSmooth var19 = new GenLayerSmooth(1000L, (GenLayer)var18); + GenLayerRiverMix var20 = new GenLayerRiverMix(100L, var19, var16); + GenLayerVoronoiZoom var8 = new GenLayerVoronoiZoom(10L, var20); + var20.initWorldGenSeed(par0); + var8.initWorldGenSeed(par0); + return new GenLayer[] {var20, var8, var20}; + } + + public GenLayer(long par1) + { + this.baseSeed = par1; + this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L; + this.baseSeed += par1; + this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L; + this.baseSeed += par1; + this.baseSeed *= this.baseSeed * 6364136223846793005L + 1442695040888963407L; + this.baseSeed += par1; + } + + /** + * Initialize layer's local worldGenSeed based on its own baseSeed and the world's global seed (passed in as an + * argument). + */ + public void initWorldGenSeed(long par1) + { + this.worldGenSeed = par1; + + if (this.parent != null) + { + this.parent.initWorldGenSeed(par1); + } + + this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L; + this.worldGenSeed += this.baseSeed; + this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L; + this.worldGenSeed += this.baseSeed; + this.worldGenSeed *= this.worldGenSeed * 6364136223846793005L + 1442695040888963407L; + this.worldGenSeed += this.baseSeed; + } + + /** + * Initialize layer's current chunkSeed based on the local worldGenSeed and the (x,z) chunk coordinates. + */ + public void initChunkSeed(long par1, long par3) + { + this.chunkSeed = this.worldGenSeed; + this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; + this.chunkSeed += par1; + this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; + this.chunkSeed += par3; + this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; + this.chunkSeed += par1; + this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; + this.chunkSeed += par3; + } + + /** + * returns a LCG pseudo random number from [0, x). Args: int x + */ + protected int nextInt(int par1) + { + int var2 = (int)((this.chunkSeed >> 24) % (long)par1); + + if (var2 < 0) + { + var2 += par1; + } + + this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; + this.chunkSeed += this.worldGenSeed; + return var2; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public abstract int[] getInts(int var1, int var2, int var3, int var4); +} diff --git a/src/main/java/net/minecraft/src/GenLayerAddIsland.java b/src/main/java/net/minecraft/src/GenLayerAddIsland.java new file mode 100644 index 0000000..fc516b5 --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerAddIsland.java @@ -0,0 +1,100 @@ +package net.minecraft.src; + +public class GenLayerAddIsland extends GenLayer +{ + public GenLayerAddIsland(long par1, GenLayer par3GenLayer) + { + super(par1); + this.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int var5 = par1 - 1; + int var6 = par2 - 1; + int var7 = par3 + 2; + int var8 = par4 + 2; + int[] var9 = this.parent.getInts(var5, var6, var7, var8); + int[] var10 = IntCache.getIntCache(par3 * par4); + + for (int var11 = 0; var11 < par4; ++var11) + { + for (int var12 = 0; var12 < par3; ++var12) + { + int var13 = var9[var12 + 0 + (var11 + 0) * var7]; + int var14 = var9[var12 + 2 + (var11 + 0) * var7]; + int var15 = var9[var12 + 0 + (var11 + 2) * var7]; + int var16 = var9[var12 + 2 + (var11 + 2) * var7]; + int var17 = var9[var12 + 1 + (var11 + 1) * var7]; + this.initChunkSeed((long)(var12 + par1), (long)(var11 + par2)); + + if (var17 == 0 && (var13 != 0 || var14 != 0 || var15 != 0 || var16 != 0)) + { + int var18 = 1; + int var19 = 1; + + if (var13 != 0 && this.nextInt(var18++) == 0) + { + var19 = var13; + } + + if (var14 != 0 && this.nextInt(var18++) == 0) + { + var19 = var14; + } + + if (var15 != 0 && this.nextInt(var18++) == 0) + { + var19 = var15; + } + + if (var16 != 0 && this.nextInt(var18++) == 0) + { + var19 = var16; + } + + if (this.nextInt(3) == 0) + { + var10[var12 + var11 * par3] = var19; + } + else if (var19 == BiomeGenBase.icePlains.biomeID) + { + var10[var12 + var11 * par3] = BiomeGenBase.frozenOcean.biomeID; + } + else + { + var10[var12 + var11 * par3] = 0; + } + } + else if (var17 > 0 && (var13 == 0 || var14 == 0 || var15 == 0 || var16 == 0)) + { + if (this.nextInt(5) == 0) + { + if (var17 == BiomeGenBase.icePlains.biomeID) + { + var10[var12 + var11 * par3] = BiomeGenBase.frozenOcean.biomeID; + } + else + { + var10[var12 + var11 * par3] = 0; + } + } + else + { + var10[var12 + var11 * par3] = var17; + } + } + else + { + var10[var12 + var11 * par3] = var17; + } + } + } + + return var10; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerAddMushroomIsland.java b/src/main/java/net/minecraft/src/GenLayerAddMushroomIsland.java new file mode 100644 index 0000000..fce4d5b --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerAddMushroomIsland.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +public class GenLayerAddMushroomIsland extends GenLayer +{ + public GenLayerAddMushroomIsland(long par1, GenLayer par3GenLayer) + { + super(par1); + this.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int var5 = par1 - 1; + int var6 = par2 - 1; + int var7 = par3 + 2; + int var8 = par4 + 2; + int[] var9 = this.parent.getInts(var5, var6, var7, var8); + int[] var10 = IntCache.getIntCache(par3 * par4); + + for (int var11 = 0; var11 < par4; ++var11) + { + for (int var12 = 0; var12 < par3; ++var12) + { + int var13 = var9[var12 + 0 + (var11 + 0) * var7]; + int var14 = var9[var12 + 2 + (var11 + 0) * var7]; + int var15 = var9[var12 + 0 + (var11 + 2) * var7]; + int var16 = var9[var12 + 2 + (var11 + 2) * var7]; + int var17 = var9[var12 + 1 + (var11 + 1) * var7]; + this.initChunkSeed((long)(var12 + par1), (long)(var11 + par2)); + + if (var17 == 0 && var13 == 0 && var14 == 0 && var15 == 0 && var16 == 0 && this.nextInt(100) == 0) + { + var10[var12 + var11 * par3] = BiomeGenBase.mushroomIsland.biomeID; + } + else + { + var10[var12 + var11 * par3] = var17; + } + } + } + + return var10; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerAddSnow.java b/src/main/java/net/minecraft/src/GenLayerAddSnow.java new file mode 100644 index 0000000..99e3bbb --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerAddSnow.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +public class GenLayerAddSnow extends GenLayer +{ + public GenLayerAddSnow(long par1, GenLayer par3GenLayer) + { + super(par1); + this.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int var5 = par1 - 1; + int var6 = par2 - 1; + int var7 = par3 + 2; + int var8 = par4 + 2; + int[] var9 = this.parent.getInts(var5, var6, var7, var8); + int[] var10 = IntCache.getIntCache(par3 * par4); + + for (int var11 = 0; var11 < par4; ++var11) + { + for (int var12 = 0; var12 < par3; ++var12) + { + int var13 = var9[var12 + 1 + (var11 + 1) * var7]; + this.initChunkSeed((long)(var12 + par1), (long)(var11 + par2)); + + if (var13 == 0) + { + var10[var12 + var11 * par3] = 0; + } + else + { + int var14 = this.nextInt(5); + + if (var14 == 0) + { + var14 = BiomeGenBase.icePlains.biomeID; + } + else + { + var14 = 1; + } + + var10[var12 + var11 * par3] = var14; + } + } + } + + return var10; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerBiome.java b/src/main/java/net/minecraft/src/GenLayerBiome.java new file mode 100644 index 0000000..9edb3dc --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerBiome.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +public class GenLayerBiome extends GenLayer +{ + /** this sets all the biomes that are allowed to appear in the overworld */ + private BiomeGenBase[] allowedBiomes; + + public GenLayerBiome(long par1, GenLayer par3GenLayer, WorldType par4WorldType) + { + super(par1); + this.allowedBiomes = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga, BiomeGenBase.jungle}; + this.parent = par3GenLayer; + + if (par4WorldType == WorldType.DEFAULT_1_1) + { + this.allowedBiomes = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga}; + } + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int[] var5 = this.parent.getInts(par1, par2, par3, par4); + int[] var6 = IntCache.getIntCache(par3 * par4); + + for (int var7 = 0; var7 < par4; ++var7) + { + for (int var8 = 0; var8 < par3; ++var8) + { + this.initChunkSeed((long)(var8 + par1), (long)(var7 + par2)); + int var9 = var5[var8 + var7 * par3]; + + if (var9 == 0) + { + var6[var8 + var7 * par3] = 0; + } + else if (var9 == BiomeGenBase.mushroomIsland.biomeID) + { + var6[var8 + var7 * par3] = var9; + } + else if (var9 == 1) + { + var6[var8 + var7 * par3] = this.allowedBiomes[this.nextInt(this.allowedBiomes.length)].biomeID; + } + else + { + int var10 = this.allowedBiomes[this.nextInt(this.allowedBiomes.length)].biomeID; + + if (var10 == BiomeGenBase.taiga.biomeID) + { + var6[var8 + var7 * par3] = var10; + } + else + { + var6[var8 + var7 * par3] = BiomeGenBase.icePlains.biomeID; + } + } + } + } + + return var6; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerFuzzyZoom.java b/src/main/java/net/minecraft/src/GenLayerFuzzyZoom.java new file mode 100644 index 0000000..c2e8d26 --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerFuzzyZoom.java @@ -0,0 +1,73 @@ +package net.minecraft.src; + +public class GenLayerFuzzyZoom extends GenLayer +{ + public GenLayerFuzzyZoom(long par1, GenLayer par3GenLayer) + { + super(par1); + super.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int var5 = par1 >> 1; + int var6 = par2 >> 1; + int var7 = (par3 >> 1) + 3; + int var8 = (par4 >> 1) + 3; + int[] var9 = this.parent.getInts(var5, var6, var7, var8); + int[] var10 = IntCache.getIntCache(var7 * 2 * var8 * 2); + int var11 = var7 << 1; + int var13; + + for (int var12 = 0; var12 < var8 - 1; ++var12) + { + var13 = var12 << 1; + int var14 = var13 * var11; + int var15 = var9[0 + (var12 + 0) * var7]; + int var16 = var9[0 + (var12 + 1) * var7]; + + for (int var17 = 0; var17 < var7 - 1; ++var17) + { + this.initChunkSeed((long)(var17 + var5 << 1), (long)(var12 + var6 << 1)); + int var18 = var9[var17 + 1 + (var12 + 0) * var7]; + int var19 = var9[var17 + 1 + (var12 + 1) * var7]; + var10[var14] = var15; + var10[var14++ + var11] = this.choose(var15, var16); + var10[var14] = this.choose(var15, var18); + var10[var14++ + var11] = this.choose(var15, var18, var16, var19); + var15 = var18; + var16 = var19; + } + } + + int[] var20 = IntCache.getIntCache(par3 * par4); + + for (var13 = 0; var13 < par4; ++var13) + { + System.arraycopy(var10, (var13 + (par2 & 1)) * (var7 << 1) + (par1 & 1), var20, var13 * par3, par3); + } + + return var20; + } + + /** + * randomly choose between the two args + */ + protected int choose(int par1, int par2) + { + return this.nextInt(2) == 0 ? par1 : par2; + } + + /** + * randomly choose between the four args + */ + protected int choose(int par1, int par2, int par3, int par4) + { + int var5 = this.nextInt(4); + return var5 == 0 ? par1 : (var5 == 1 ? par2 : (var5 == 2 ? par3 : par4)); + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerHills.java b/src/main/java/net/minecraft/src/GenLayerHills.java new file mode 100644 index 0000000..e49cbf0 --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerHills.java @@ -0,0 +1,86 @@ +package net.minecraft.src; + +public class GenLayerHills extends GenLayer +{ + public GenLayerHills(long par1, GenLayer par3GenLayer) + { + super(par1); + this.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int[] var5 = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2); + int[] var6 = IntCache.getIntCache(par3 * par4); + + for (int var7 = 0; var7 < par4; ++var7) + { + for (int var8 = 0; var8 < par3; ++var8) + { + this.initChunkSeed((long)(var8 + par1), (long)(var7 + par2)); + int var9 = var5[var8 + 1 + (var7 + 1) * (par3 + 2)]; + + if (this.nextInt(3) == 0) + { + int var10 = var9; + + if (var9 == BiomeGenBase.desert.biomeID) + { + var10 = BiomeGenBase.desertHills.biomeID; + } + else if (var9 == BiomeGenBase.forest.biomeID) + { + var10 = BiomeGenBase.forestHills.biomeID; + } + else if (var9 == BiomeGenBase.taiga.biomeID) + { + var10 = BiomeGenBase.taigaHills.biomeID; + } + else if (var9 == BiomeGenBase.plains.biomeID) + { + var10 = BiomeGenBase.forest.biomeID; + } + else if (var9 == BiomeGenBase.icePlains.biomeID) + { + var10 = BiomeGenBase.iceMountains.biomeID; + } + else if (var9 == BiomeGenBase.jungle.biomeID) + { + var10 = BiomeGenBase.jungleHills.biomeID; + } + + if (var10 == var9) + { + var6[var8 + var7 * par3] = var9; + } + else + { + int var11 = var5[var8 + 1 + (var7 + 1 - 1) * (par3 + 2)]; + int var12 = var5[var8 + 1 + 1 + (var7 + 1) * (par3 + 2)]; + int var13 = var5[var8 + 1 - 1 + (var7 + 1) * (par3 + 2)]; + int var14 = var5[var8 + 1 + (var7 + 1 + 1) * (par3 + 2)]; + + if (var11 == var9 && var12 == var9 && var13 == var9 && var14 == var9) + { + var6[var8 + var7 * par3] = var10; + } + else + { + var6[var8 + var7 * par3] = var9; + } + } + } + else + { + var6[var8 + var7 * par3] = var9; + } + } + } + + return var6; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerIsland.java b/src/main/java/net/minecraft/src/GenLayerIsland.java new file mode 100644 index 0000000..9f6fe12 --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerIsland.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class GenLayerIsland extends GenLayer +{ + public GenLayerIsland(long par1) + { + super(par1); + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int[] var5 = IntCache.getIntCache(par3 * par4); + + for (int var6 = 0; var6 < par4; ++var6) + { + for (int var7 = 0; var7 < par3; ++var7) + { + this.initChunkSeed((long)(par1 + var7), (long)(par2 + var6)); + var5[var7 + var6 * par3] = this.nextInt(10) == 0 ? 1 : 0; + } + } + + if (par1 > -par3 && par1 <= 0 && par2 > -par4 && par2 <= 0) + { + var5[-par1 + -par2 * par3] = 1; + } + + return var5; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerRiver.java b/src/main/java/net/minecraft/src/GenLayerRiver.java new file mode 100644 index 0000000..dce8657 --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerRiver.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +public class GenLayerRiver extends GenLayer +{ + public GenLayerRiver(long par1, GenLayer par3GenLayer) + { + super(par1); + super.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int var5 = par1 - 1; + int var6 = par2 - 1; + int var7 = par3 + 2; + int var8 = par4 + 2; + int[] var9 = this.parent.getInts(var5, var6, var7, var8); + int[] var10 = IntCache.getIntCache(par3 * par4); + + for (int var11 = 0; var11 < par4; ++var11) + { + for (int var12 = 0; var12 < par3; ++var12) + { + int var13 = var9[var12 + 0 + (var11 + 1) * var7]; + int var14 = var9[var12 + 2 + (var11 + 1) * var7]; + int var15 = var9[var12 + 1 + (var11 + 0) * var7]; + int var16 = var9[var12 + 1 + (var11 + 2) * var7]; + int var17 = var9[var12 + 1 + (var11 + 1) * var7]; + + if (var17 != 0 && var13 != 0 && var14 != 0 && var15 != 0 && var16 != 0 && var17 == var13 && var17 == var15 && var17 == var14 && var17 == var16) + { + var10[var12 + var11 * par3] = -1; + } + else + { + var10[var12 + var11 * par3] = BiomeGenBase.river.biomeID; + } + } + } + + return var10; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerRiverInit.java b/src/main/java/net/minecraft/src/GenLayerRiverInit.java new file mode 100644 index 0000000..b83015a --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerRiverInit.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +public class GenLayerRiverInit extends GenLayer +{ + public GenLayerRiverInit(long par1, GenLayer par3GenLayer) + { + super(par1); + this.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int[] var5 = this.parent.getInts(par1, par2, par3, par4); + int[] var6 = IntCache.getIntCache(par3 * par4); + + for (int var7 = 0; var7 < par4; ++var7) + { + for (int var8 = 0; var8 < par3; ++var8) + { + this.initChunkSeed((long)(var8 + par1), (long)(var7 + par2)); + var6[var8 + var7 * par3] = var5[var8 + var7 * par3] > 0 ? this.nextInt(2) + 2 : 0; + } + } + + return var6; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerRiverMix.java b/src/main/java/net/minecraft/src/GenLayerRiverMix.java new file mode 100644 index 0000000..4c90103 --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerRiverMix.java @@ -0,0 +1,65 @@ +package net.minecraft.src; + +public class GenLayerRiverMix extends GenLayer +{ + private GenLayer biomePatternGeneratorChain; + private GenLayer riverPatternGeneratorChain; + + public GenLayerRiverMix(long par1, GenLayer par3GenLayer, GenLayer par4GenLayer) + { + super(par1); + this.biomePatternGeneratorChain = par3GenLayer; + this.riverPatternGeneratorChain = par4GenLayer; + } + + /** + * Initialize layer's local worldGenSeed based on its own baseSeed and the world's global seed (passed in as an + * argument). + */ + public void initWorldGenSeed(long par1) + { + this.biomePatternGeneratorChain.initWorldGenSeed(par1); + this.riverPatternGeneratorChain.initWorldGenSeed(par1); + super.initWorldGenSeed(par1); + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int[] var5 = this.biomePatternGeneratorChain.getInts(par1, par2, par3, par4); + int[] var6 = this.riverPatternGeneratorChain.getInts(par1, par2, par3, par4); + int[] var7 = IntCache.getIntCache(par3 * par4); + + for (int var8 = 0; var8 < par3 * par4; ++var8) + { + if (var5[var8] == BiomeGenBase.ocean.biomeID) + { + var7[var8] = var5[var8]; + } + else if (var6[var8] >= 0) + { + if (var5[var8] == BiomeGenBase.icePlains.biomeID) + { + var7[var8] = BiomeGenBase.frozenRiver.biomeID; + } + else if (var5[var8] != BiomeGenBase.mushroomIsland.biomeID && var5[var8] != BiomeGenBase.mushroomIslandShore.biomeID) + { + var7[var8] = var6[var8]; + } + else + { + var7[var8] = BiomeGenBase.mushroomIslandShore.biomeID; + } + } + else + { + var7[var8] = var5[var8]; + } + } + + return var7; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerShore.java b/src/main/java/net/minecraft/src/GenLayerShore.java new file mode 100644 index 0000000..6807a86 --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerShore.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +public class GenLayerShore extends GenLayer +{ + public GenLayerShore(long par1, GenLayer par3GenLayer) + { + super(par1); + this.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int[] var5 = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2); + int[] var6 = IntCache.getIntCache(par3 * par4); + + for (int var7 = 0; var7 < par4; ++var7) + { + for (int var8 = 0; var8 < par3; ++var8) + { + this.initChunkSeed((long)(var8 + par1), (long)(var7 + par2)); + int var9 = var5[var8 + 1 + (var7 + 1) * (par3 + 2)]; + int var10; + int var11; + int var12; + int var13; + + if (var9 == BiomeGenBase.mushroomIsland.biomeID) + { + var10 = var5[var8 + 1 + (var7 + 1 - 1) * (par3 + 2)]; + var11 = var5[var8 + 1 + 1 + (var7 + 1) * (par3 + 2)]; + var12 = var5[var8 + 1 - 1 + (var7 + 1) * (par3 + 2)]; + var13 = var5[var8 + 1 + (var7 + 1 + 1) * (par3 + 2)]; + + if (var10 != BiomeGenBase.ocean.biomeID && var11 != BiomeGenBase.ocean.biomeID && var12 != BiomeGenBase.ocean.biomeID && var13 != BiomeGenBase.ocean.biomeID) + { + var6[var8 + var7 * par3] = var9; + } + else + { + var6[var8 + var7 * par3] = BiomeGenBase.mushroomIslandShore.biomeID; + } + } + else if (var9 != BiomeGenBase.ocean.biomeID && var9 != BiomeGenBase.river.biomeID && var9 != BiomeGenBase.swampland.biomeID && var9 != BiomeGenBase.extremeHills.biomeID) + { + var10 = var5[var8 + 1 + (var7 + 1 - 1) * (par3 + 2)]; + var11 = var5[var8 + 1 + 1 + (var7 + 1) * (par3 + 2)]; + var12 = var5[var8 + 1 - 1 + (var7 + 1) * (par3 + 2)]; + var13 = var5[var8 + 1 + (var7 + 1 + 1) * (par3 + 2)]; + + if (var10 != BiomeGenBase.ocean.biomeID && var11 != BiomeGenBase.ocean.biomeID && var12 != BiomeGenBase.ocean.biomeID && var13 != BiomeGenBase.ocean.biomeID) + { + var6[var8 + var7 * par3] = var9; + } + else + { + var6[var8 + var7 * par3] = BiomeGenBase.beach.biomeID; + } + } + else if (var9 == BiomeGenBase.extremeHills.biomeID) + { + var10 = var5[var8 + 1 + (var7 + 1 - 1) * (par3 + 2)]; + var11 = var5[var8 + 1 + 1 + (var7 + 1) * (par3 + 2)]; + var12 = var5[var8 + 1 - 1 + (var7 + 1) * (par3 + 2)]; + var13 = var5[var8 + 1 + (var7 + 1 + 1) * (par3 + 2)]; + + if (var10 == BiomeGenBase.extremeHills.biomeID && var11 == BiomeGenBase.extremeHills.biomeID && var12 == BiomeGenBase.extremeHills.biomeID && var13 == BiomeGenBase.extremeHills.biomeID) + { + var6[var8 + var7 * par3] = var9; + } + else + { + var6[var8 + var7 * par3] = BiomeGenBase.extremeHillsEdge.biomeID; + } + } + else + { + var6[var8 + var7 * par3] = var9; + } + } + } + + return var6; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerSmooth.java b/src/main/java/net/minecraft/src/GenLayerSmooth.java new file mode 100644 index 0000000..b30b12c --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerSmooth.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +public class GenLayerSmooth extends GenLayer +{ + public GenLayerSmooth(long par1, GenLayer par3GenLayer) + { + super(par1); + super.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int var5 = par1 - 1; + int var6 = par2 - 1; + int var7 = par3 + 2; + int var8 = par4 + 2; + int[] var9 = this.parent.getInts(var5, var6, var7, var8); + int[] var10 = IntCache.getIntCache(par3 * par4); + + for (int var11 = 0; var11 < par4; ++var11) + { + for (int var12 = 0; var12 < par3; ++var12) + { + int var13 = var9[var12 + 0 + (var11 + 1) * var7]; + int var14 = var9[var12 + 2 + (var11 + 1) * var7]; + int var15 = var9[var12 + 1 + (var11 + 0) * var7]; + int var16 = var9[var12 + 1 + (var11 + 2) * var7]; + int var17 = var9[var12 + 1 + (var11 + 1) * var7]; + + if (var13 == var14 && var15 == var16) + { + this.initChunkSeed((long)(var12 + par1), (long)(var11 + par2)); + + if (this.nextInt(2) == 0) + { + var17 = var13; + } + else + { + var17 = var15; + } + } + else + { + if (var13 == var14) + { + var17 = var13; + } + + if (var15 == var16) + { + var17 = var15; + } + } + + var10[var12 + var11 * par3] = var17; + } + } + + return var10; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerSwampRivers.java b/src/main/java/net/minecraft/src/GenLayerSwampRivers.java new file mode 100644 index 0000000..89f8e94 --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerSwampRivers.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +public class GenLayerSwampRivers extends GenLayer +{ + public GenLayerSwampRivers(long par1, GenLayer par3GenLayer) + { + super(par1); + this.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int[] var5 = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2); + int[] var6 = IntCache.getIntCache(par3 * par4); + + for (int var7 = 0; var7 < par4; ++var7) + { + for (int var8 = 0; var8 < par3; ++var8) + { + this.initChunkSeed((long)(var8 + par1), (long)(var7 + par2)); + int var9 = var5[var8 + 1 + (var7 + 1) * (par3 + 2)]; + + if ((var9 != BiomeGenBase.swampland.biomeID || this.nextInt(6) != 0) && (var9 != BiomeGenBase.jungle.biomeID && var9 != BiomeGenBase.jungleHills.biomeID || this.nextInt(8) != 0)) + { + var6[var8 + var7 * par3] = var9; + } + else + { + var6[var8 + var7 * par3] = BiomeGenBase.river.biomeID; + } + } + } + + return var6; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerVoronoiZoom.java b/src/main/java/net/minecraft/src/GenLayerVoronoiZoom.java new file mode 100644 index 0000000..00432c2 --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerVoronoiZoom.java @@ -0,0 +1,98 @@ +package net.minecraft.src; + +public class GenLayerVoronoiZoom extends GenLayer +{ + public GenLayerVoronoiZoom(long par1, GenLayer par3GenLayer) + { + super(par1); + super.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + par1 -= 2; + par2 -= 2; + byte var5 = 2; + int var6 = 1 << var5; + int var7 = par1 >> var5; + int var8 = par2 >> var5; + int var9 = (par3 >> var5) + 3; + int var10 = (par4 >> var5) + 3; + int[] var11 = this.parent.getInts(var7, var8, var9, var10); + int var12 = var9 << var5; + int var13 = var10 << var5; + int[] var14 = IntCache.getIntCache(var12 * var13); + int var16; + + for (int var15 = 0; var15 < var10 - 1; ++var15) + { + var16 = var11[0 + (var15 + 0) * var9]; + int var17 = var11[0 + (var15 + 1) * var9]; + + for (int var18 = 0; var18 < var9 - 1; ++var18) + { + double var19 = (double)var6 * 0.9D; + this.initChunkSeed((long)(var18 + var7 << var5), (long)(var15 + var8 << var5)); + double var21 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * var19; + double var23 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * var19; + this.initChunkSeed((long)(var18 + var7 + 1 << var5), (long)(var15 + var8 << var5)); + double var25 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * var19 + (double)var6; + double var27 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * var19; + this.initChunkSeed((long)(var18 + var7 << var5), (long)(var15 + var8 + 1 << var5)); + double var29 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * var19; + double var31 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * var19 + (double)var6; + this.initChunkSeed((long)(var18 + var7 + 1 << var5), (long)(var15 + var8 + 1 << var5)); + double var33 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * var19 + (double)var6; + double var35 = ((double)this.nextInt(1024) / 1024.0D - 0.5D) * var19 + (double)var6; + int var37 = var11[var18 + 1 + (var15 + 0) * var9]; + int var38 = var11[var18 + 1 + (var15 + 1) * var9]; + + for (int var39 = 0; var39 < var6; ++var39) + { + int var40 = ((var15 << var5) + var39) * var12 + (var18 << var5); + + for (int var41 = 0; var41 < var6; ++var41) + { + double var42 = ((double)var39 - var23) * ((double)var39 - var23) + ((double)var41 - var21) * ((double)var41 - var21); + double var44 = ((double)var39 - var27) * ((double)var39 - var27) + ((double)var41 - var25) * ((double)var41 - var25); + double var46 = ((double)var39 - var31) * ((double)var39 - var31) + ((double)var41 - var29) * ((double)var41 - var29); + double var48 = ((double)var39 - var35) * ((double)var39 - var35) + ((double)var41 - var33) * ((double)var41 - var33); + + if (var42 < var44 && var42 < var46 && var42 < var48) + { + var14[var40++] = var16; + } + else if (var44 < var42 && var44 < var46 && var44 < var48) + { + var14[var40++] = var37; + } + else if (var46 < var42 && var46 < var44 && var46 < var48) + { + var14[var40++] = var17; + } + else + { + var14[var40++] = var38; + } + } + } + + var16 = var37; + var17 = var38; + } + } + + int[] var50 = IntCache.getIntCache(par3 * par4); + + for (var16 = 0; var16 < par4; ++var16) + { + System.arraycopy(var14, (var16 + (par2 & var6 - 1)) * (var9 << var5) + (par1 & var6 - 1), var50, var16 * par3, par3); + } + + return var50; + } +} diff --git a/src/main/java/net/minecraft/src/GenLayerZoom.java b/src/main/java/net/minecraft/src/GenLayerZoom.java new file mode 100644 index 0000000..f5305a2 --- /dev/null +++ b/src/main/java/net/minecraft/src/GenLayerZoom.java @@ -0,0 +1,155 @@ +package net.minecraft.src; + +public class GenLayerZoom extends GenLayer +{ + public GenLayerZoom(long par1, GenLayer par3GenLayer) + { + super(par1); + super.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int var5 = par1 >> 1; + int var6 = par2 >> 1; + int var7 = (par3 >> 1) + 3; + int var8 = (par4 >> 1) + 3; + int[] var9 = this.parent.getInts(var5, var6, var7, var8); + int[] var10 = IntCache.getIntCache(var7 * 2 * var8 * 2); + int var11 = var7 << 1; + int var13; + + for (int var12 = 0; var12 < var8 - 1; ++var12) + { + var13 = var12 << 1; + int var14 = var13 * var11; + int var15 = var9[0 + (var12 + 0) * var7]; + int var16 = var9[0 + (var12 + 1) * var7]; + + for (int var17 = 0; var17 < var7 - 1; ++var17) + { + this.initChunkSeed((long)(var17 + var5 << 1), (long)(var12 + var6 << 1)); + int var18 = var9[var17 + 1 + (var12 + 0) * var7]; + int var19 = var9[var17 + 1 + (var12 + 1) * var7]; + var10[var14] = var15; + var10[var14++ + var11] = this.choose(var15, var16); + var10[var14] = this.choose(var15, var18); + var10[var14++ + var11] = this.modeOrRandom(var15, var18, var16, var19); + var15 = var18; + var16 = var19; + } + } + + int[] var20 = IntCache.getIntCache(par3 * par4); + + for (var13 = 0; var13 < par4; ++var13) + { + System.arraycopy(var10, (var13 + (par2 & 1)) * (var7 << 1) + (par1 & 1), var20, var13 * par3, par3); + } + + return var20; + } + + /** + * Chooses one of the two inputs randomly. + */ + protected int choose(int par1, int par2) + { + return this.nextInt(2) == 0 ? par1 : par2; + } + + /** + * returns the mode (most frequently occuring number) or a random number from the 4 integers provided + */ + protected int modeOrRandom(int par1, int par2, int par3, int par4) + { + if (par2 == par3 && par3 == par4) + { + return par2; + } + else if (par1 == par2 && par1 == par3) + { + return par1; + } + else if (par1 == par2 && par1 == par4) + { + return par1; + } + else if (par1 == par3 && par1 == par4) + { + return par1; + } + else if (par1 == par2 && par3 != par4) + { + return par1; + } + else if (par1 == par3 && par2 != par4) + { + return par1; + } + else if (par1 == par4 && par2 != par3) + { + return par1; + } + else if (par2 == par1 && par3 != par4) + { + return par2; + } + else if (par2 == par3 && par1 != par4) + { + return par2; + } + else if (par2 == par4 && par1 != par3) + { + return par2; + } + else if (par3 == par1 && par2 != par4) + { + return par3; + } + else if (par3 == par2 && par1 != par4) + { + return par3; + } + else if (par3 == par4 && par1 != par2) + { + return par3; + } + else if (par4 == par1 && par2 != par3) + { + return par3; + } + else if (par4 == par2 && par1 != par3) + { + return par3; + } + else if (par4 == par3 && par1 != par2) + { + return par3; + } + else + { + int var5 = this.nextInt(4); + return var5 == 0 ? par1 : (var5 == 1 ? par2 : (var5 == 2 ? par3 : par4)); + } + } + + /** + * Magnify a layer. Parms are seed adjustment, layer, number of times to magnify + */ + public static GenLayer magnify(long par0, GenLayer par2GenLayer, int par3) + { + Object var4 = par2GenLayer; + + for (int var5 = 0; var5 < par3; ++var5) + { + var4 = new GenLayerZoom(par0 + (long)var5, (GenLayer)var4); + } + + return (GenLayer)var4; + } +} diff --git a/src/main/java/net/minecraft/src/GrassColorReloadListener.java b/src/main/java/net/minecraft/src/GrassColorReloadListener.java new file mode 100644 index 0000000..677e128 --- /dev/null +++ b/src/main/java/net/minecraft/src/GrassColorReloadListener.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +import java.io.IOException; + +public class GrassColorReloadListener implements ResourceManagerReloadListener +{ + private static final ResourceLocation field_130078_a = new ResourceLocation("textures/colormap/grass.png"); + + public void onResourceManagerReload(ResourceManager par1ResourceManager) + { + try + { + ColorizerGrass.setGrassBiomeColorizer(TextureUtil.readImageData(par1ResourceManager, field_130078_a)); + } + catch (IOException var3) + { + ; + } + } +} diff --git a/src/main/java/net/minecraft/src/Gui.java b/src/main/java/net/minecraft/src/Gui.java new file mode 100644 index 0000000..5ef265f --- /dev/null +++ b/src/main/java/net/minecraft/src/Gui.java @@ -0,0 +1,151 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class Gui +{ + public static final ResourceLocation optionsBackground = new ResourceLocation("textures/gui/options_background.png"); + public static final ResourceLocation statIcons = new ResourceLocation("textures/gui/container/stats_icons.png"); + public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png"); + protected float zLevel; + + protected void drawHorizontalLine(int par1, int par2, int par3, int par4) + { + if (par2 < par1) + { + int var5 = par1; + par1 = par2; + par2 = var5; + } + + drawRect(par1, par3, par2 + 1, par3 + 1, par4); + } + + protected void drawVerticalLine(int par1, int par2, int par3, int par4) + { + if (par3 < par2) + { + int var5 = par2; + par2 = par3; + par3 = var5; + } + + drawRect(par1, par2 + 1, par1 + 1, par3, par4); + } + + /** + * Draws a solid color rectangle with the specified coordinates and color. Args: x1, y1, x2, y2, color + */ + public static void drawRect(int par0, int par1, int par2, int par3, int par4) + { + int var5; + + if (par0 < par2) + { + var5 = par0; + par0 = par2; + par2 = var5; + } + + if (par1 < par3) + { + var5 = par1; + par1 = par3; + par3 = var5; + } + + float var10 = (float)(par4 >> 24 & 255) / 255.0F; + float var6 = (float)(par4 >> 16 & 255) / 255.0F; + float var7 = (float)(par4 >> 8 & 255) / 255.0F; + float var8 = (float)(par4 & 255) / 255.0F; + Tessellator var9 = Tessellator.instance; + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(var6, var7, var8, var10); + var9.startDrawingQuads(); + var9.addVertex((double)par0, (double)par3, 0.0D); + var9.addVertex((double)par2, (double)par3, 0.0D); + var9.addVertex((double)par2, (double)par1, 0.0D); + var9.addVertex((double)par0, (double)par1, 0.0D); + var9.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_BLEND); + } + + /** + * Draws a rectangle with a vertical gradient between the specified colors. + */ + protected void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) + { + float var7 = (float)(par5 >> 24 & 255) / 255.0F; + float var8 = (float)(par5 >> 16 & 255) / 255.0F; + float var9 = (float)(par5 >> 8 & 255) / 255.0F; + float var10 = (float)(par5 & 255) / 255.0F; + float var11 = (float)(par6 >> 24 & 255) / 255.0F; + float var12 = (float)(par6 >> 16 & 255) / 255.0F; + float var13 = (float)(par6 >> 8 & 255) / 255.0F; + float var14 = (float)(par6 & 255) / 255.0F; + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glShadeModel(GL11.GL_SMOOTH); + Tessellator var15 = Tessellator.instance; + var15.startDrawingQuads(); + var15.setColorRGBA_F(var8, var9, var10, var7); + var15.addVertex((double)par3, (double)par2, (double)this.zLevel); + var15.addVertex((double)par1, (double)par2, (double)this.zLevel); + var15.setColorRGBA_F(var12, var13, var14, var11); + var15.addVertex((double)par1, (double)par4, (double)this.zLevel); + var15.addVertex((double)par3, (double)par4, (double)this.zLevel); + var15.draw(); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + /** + * Renders the specified text to the screen, center-aligned. + */ + public void drawCenteredString(FontRenderer par1FontRenderer, String par2Str, int par3, int par4, int par5) + { + par1FontRenderer.drawStringWithShadow(par2Str, par3 - par1FontRenderer.getStringWidth(par2Str) / 2, par4, par5); + } + + /** + * Renders the specified text to the screen. + */ + public void drawString(FontRenderer par1FontRenderer, String par2Str, int par3, int par4, int par5) + { + par1FontRenderer.drawStringWithShadow(par2Str, par3, par4, par5); + } + + /** + * Draws a textured rectangle at the stored z-value. Args: x, y, u, v, width, height + */ + public void drawTexturedModalRect(int par1, int par2, int par3, int par4, int par5, int par6) + { + float var7 = 0.00390625F; + float var8 = 0.00390625F; + Tessellator var9 = Tessellator.instance; + var9.startDrawingQuads(); + var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + par6), (double)this.zLevel, (double)((float)(par3 + 0) * var7), (double)((float)(par4 + par6) * var8)); + var9.addVertexWithUV((double)(par1 + par5), (double)(par2 + par6), (double)this.zLevel, (double)((float)(par3 + par5) * var7), (double)((float)(par4 + par6) * var8)); + var9.addVertexWithUV((double)(par1 + par5), (double)(par2 + 0), (double)this.zLevel, (double)((float)(par3 + par5) * var7), (double)((float)(par4 + 0) * var8)); + var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)this.zLevel, (double)((float)(par3 + 0) * var7), (double)((float)(par4 + 0) * var8)); + var9.draw(); + } + + public void drawTexturedModelRectFromIcon(int par1, int par2, Icon par3Icon, int par4, int par5) + { + Tessellator var6 = Tessellator.instance; + var6.startDrawingQuads(); + var6.addVertexWithUV((double)(par1 + 0), (double)(par2 + par5), (double)this.zLevel, (double)par3Icon.getMinU(), (double)par3Icon.getMaxV()); + var6.addVertexWithUV((double)(par1 + par4), (double)(par2 + par5), (double)this.zLevel, (double)par3Icon.getMaxU(), (double)par3Icon.getMaxV()); + var6.addVertexWithUV((double)(par1 + par4), (double)(par2 + 0), (double)this.zLevel, (double)par3Icon.getMaxU(), (double)par3Icon.getMinV()); + var6.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)this.zLevel, (double)par3Icon.getMinU(), (double)par3Icon.getMinV()); + var6.draw(); + } +} diff --git a/src/main/java/net/minecraft/src/GuiAchievement.java b/src/main/java/net/minecraft/src/GuiAchievement.java new file mode 100644 index 0000000..80ec8c8 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiAchievement.java @@ -0,0 +1,150 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiAchievement extends Gui +{ + private static final ResourceLocation achievementTextures = new ResourceLocation("textures/gui/achievement/achievement_background.png"); + + /** Holds the instance of the game (Minecraft) */ + private Minecraft theGame; + + /** Holds the latest width scaled to fit the game window. */ + private int achievementWindowWidth; + + /** Holds the latest height scaled to fit the game window. */ + private int achievementWindowHeight; + private String achievementGetLocalText; + private String achievementStatName; + + /** Holds the achievement that will be displayed on the GUI. */ + private Achievement theAchievement; + private long achievementTime; + + /** + * Holds a instance of RenderItem, used to draw the achievement icons on screen (is based on ItemStack) + */ + private RenderItem itemRender; + private boolean haveAchiement; + + public GuiAchievement(Minecraft par1Minecraft) + { + this.theGame = par1Minecraft; + this.itemRender = new RenderItem(); + } + + /** + * Queue a taken achievement to be displayed. + */ + public void queueTakenAchievement(Achievement par1Achievement) + { + this.achievementGetLocalText = I18n.getString("achievement.get"); + this.achievementStatName = I18n.getString(par1Achievement.getName()); + this.achievementTime = Minecraft.getSystemTime(); + this.theAchievement = par1Achievement; + this.haveAchiement = false; + } + + /** + * Queue a information about a achievement to be displayed. + */ + public void queueAchievementInformation(Achievement par1Achievement) + { + this.achievementGetLocalText = I18n.getString(par1Achievement.getName()); + this.achievementStatName = par1Achievement.getDescription(); + this.achievementTime = Minecraft.getSystemTime() - 2500L; + this.theAchievement = par1Achievement; + this.haveAchiement = true; + } + + /** + * Update the display of the achievement window to match the game window. + */ + private void updateAchievementWindowScale() + { + GL11.glViewport(0, 0, this.theGame.displayWidth, this.theGame.displayHeight); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + this.achievementWindowWidth = this.theGame.displayWidth; + this.achievementWindowHeight = this.theGame.displayHeight; + ScaledResolution var1 = new ScaledResolution(this.theGame.gameSettings, this.theGame.displayWidth, this.theGame.displayHeight); + this.achievementWindowWidth = var1.getScaledWidth(); + this.achievementWindowHeight = var1.getScaledHeight(); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, (double)this.achievementWindowWidth, (double)this.achievementWindowHeight, 0.0D, 1000.0D, 3000.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -2000.0F); + } + + /** + * Updates the small achievement tooltip window, showing a queued achievement if is needed. + */ + public void updateAchievementWindow() + { + if (this.theAchievement != null && this.achievementTime != 0L) + { + double var1 = (double)(Minecraft.getSystemTime() - this.achievementTime) / 3000.0D; + + if (!this.haveAchiement && (var1 < 0.0D || var1 > 1.0D)) + { + this.achievementTime = 0L; + } + else + { + this.updateAchievementWindowScale(); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + double var3 = var1 * 2.0D; + + if (var3 > 1.0D) + { + var3 = 2.0D - var3; + } + + var3 *= 4.0D; + var3 = 1.0D - var3; + + if (var3 < 0.0D) + { + var3 = 0.0D; + } + + var3 *= var3; + var3 *= var3; + int var5 = this.achievementWindowWidth - 160; + int var6 = 0 - (int)(var3 * 36.0D); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(GL11.GL_TEXTURE_2D); + this.theGame.getTextureManager().bindTexture(achievementTextures); + GL11.glDisable(GL11.GL_LIGHTING); + this.drawTexturedModalRect(var5, var6, 96, 202, 160, 32); + + if (this.haveAchiement) + { + this.theGame.fontRenderer.drawSplitString(this.achievementStatName, var5 + 30, var6 + 7, 120, -1); + } + else + { + this.theGame.fontRenderer.drawString(this.achievementGetLocalText, var5 + 30, var6 + 7, -256); + this.theGame.fontRenderer.drawString(this.achievementStatName, var5 + 30, var6 + 18, -1); + } + + RenderHelper.enableGUIStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glEnable(GL11.GL_LIGHTING); + this.itemRender.renderItemAndEffectIntoGUI(this.theGame.fontRenderer, this.theGame.getTextureManager(), this.theAchievement.theItemStack, var5 + 8, var6 + 8); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiAchievements.java b/src/main/java/net/minecraft/src/GuiAchievements.java new file mode 100644 index 0000000..f03aa1e --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiAchievements.java @@ -0,0 +1,463 @@ +package net.minecraft.src; + +import java.util.Random; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiAchievements extends GuiScreen +{ + /** The top x coordinate of the achievement map */ + private static final int guiMapTop = AchievementList.minDisplayColumn * 24 - 112; + + /** The left y coordinate of the achievement map */ + private static final int guiMapLeft = AchievementList.minDisplayRow * 24 - 112; + + /** The bottom x coordinate of the achievement map */ + private static final int guiMapBottom = AchievementList.maxDisplayColumn * 24 - 77; + + /** The right y coordinate of the achievement map */ + private static final int guiMapRight = AchievementList.maxDisplayRow * 24 - 77; + private static final ResourceLocation achievementTextures = new ResourceLocation("textures/gui/achievement/achievement_background.png"); + protected int achievementsPaneWidth = 256; + protected int achievementsPaneHeight = 202; + + /** The current mouse x coordinate */ + protected int mouseX; + + /** The current mouse y coordinate */ + protected int mouseY; + protected double field_74117_m; + protected double field_74115_n; + + /** The x position of the achievement map */ + protected double guiMapX; + + /** The y position of the achievement map */ + protected double guiMapY; + protected double field_74124_q; + protected double field_74123_r; + + /** Whether the Mouse Button is down or not */ + private int isMouseButtonDown; + private StatFileWriter statFileWriter; + + public GuiAchievements(StatFileWriter par1StatFileWriter) + { + this.statFileWriter = par1StatFileWriter; + short var2 = 141; + short var3 = 141; + this.field_74117_m = this.guiMapX = this.field_74124_q = (double)(AchievementList.openInventory.displayColumn * 24 - var2 / 2 - 12); + this.field_74115_n = this.guiMapY = this.field_74123_r = (double)(AchievementList.openInventory.displayRow * 24 - var3 / 2); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + this.buttonList.add(new GuiSmallButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.getString("gui.done"))); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 1) + { + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + } + + super.actionPerformed(par1GuiButton); + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (par2 == this.mc.gameSettings.keyBindInventory.keyCode) + { + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + } + else + { + super.keyTyped(par1, par2); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + if (Mouse.isButtonDown(0)) + { + int var4 = (this.width - this.achievementsPaneWidth) / 2; + int var5 = (this.height - this.achievementsPaneHeight) / 2; + int var6 = var4 + 8; + int var7 = var5 + 17; + + if ((this.isMouseButtonDown == 0 || this.isMouseButtonDown == 1) && par1 >= var6 && par1 < var6 + 224 && par2 >= var7 && par2 < var7 + 155) + { + if (this.isMouseButtonDown == 0) + { + this.isMouseButtonDown = 1; + } + else + { + this.guiMapX -= (double)(par1 - this.mouseX); + this.guiMapY -= (double)(par2 - this.mouseY); + this.field_74124_q = this.field_74117_m = this.guiMapX; + this.field_74123_r = this.field_74115_n = this.guiMapY; + } + + this.mouseX = par1; + this.mouseY = par2; + } + + if (this.field_74124_q < (double)guiMapTop) + { + this.field_74124_q = (double)guiMapTop; + } + + if (this.field_74123_r < (double)guiMapLeft) + { + this.field_74123_r = (double)guiMapLeft; + } + + if (this.field_74124_q >= (double)guiMapBottom) + { + this.field_74124_q = (double)(guiMapBottom - 1); + } + + if (this.field_74123_r >= (double)guiMapRight) + { + this.field_74123_r = (double)(guiMapRight - 1); + } + } + else + { + this.isMouseButtonDown = 0; + } + + this.drawDefaultBackground(); + this.genAchievementBackground(par1, par2, par3); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + this.drawTitle(); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.field_74117_m = this.guiMapX; + this.field_74115_n = this.guiMapY; + double var1 = this.field_74124_q - this.guiMapX; + double var3 = this.field_74123_r - this.guiMapY; + + if (var1 * var1 + var3 * var3 < 4.0D) + { + this.guiMapX += var1; + this.guiMapY += var3; + } + else + { + this.guiMapX += var1 * 0.85D; + this.guiMapY += var3 * 0.85D; + } + } + + /** + * Draws the "Achievements" title at the top of the GUI. + */ + protected void drawTitle() + { + int var1 = (this.width - this.achievementsPaneWidth) / 2; + int var2 = (this.height - this.achievementsPaneHeight) / 2; + this.fontRenderer.drawString("Achievements", var1 + 15, var2 + 5, 4210752); + } + + protected void genAchievementBackground(int par1, int par2, float par3) + { + int var4 = MathHelper.floor_double(this.field_74117_m + (this.guiMapX - this.field_74117_m) * (double)par3); + int var5 = MathHelper.floor_double(this.field_74115_n + (this.guiMapY - this.field_74115_n) * (double)par3); + + if (var4 < guiMapTop) + { + var4 = guiMapTop; + } + + if (var5 < guiMapLeft) + { + var5 = guiMapLeft; + } + + if (var4 >= guiMapBottom) + { + var4 = guiMapBottom - 1; + } + + if (var5 >= guiMapRight) + { + var5 = guiMapRight - 1; + } + + int var6 = (this.width - this.achievementsPaneWidth) / 2; + int var7 = (this.height - this.achievementsPaneHeight) / 2; + int var8 = var6 + 16; + int var9 = var7 + 17; + this.zLevel = 0.0F; + GL11.glDepthFunc(GL11.GL_GEQUAL); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.0F, -200.0F); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + int var10 = var4 + 288 >> 4; + int var11 = var5 + 288 >> 4; + int var12 = (var4 + 288) % 16; + int var13 = (var5 + 288) % 16; + boolean var14 = true; + boolean var15 = true; + boolean var16 = true; + boolean var17 = true; + boolean var18 = true; + Random var19 = new Random(); + int var20; + int var22; + int var23; + + for (var20 = 0; var20 * 16 - var13 < 155; ++var20) + { + float var21 = 0.6F - (float)(var11 + var20) / 25.0F * 0.3F; + GL11.glColor4f(var21, var21, var21, 1.0F); + + for (var22 = 0; var22 * 16 - var12 < 224; ++var22) + { + var19.setSeed((long)(1234 + var10 + var22)); + var19.nextInt(); + var23 = var19.nextInt(1 + var11 + var20) + (var11 + var20) / 2; + Icon var24 = Block.sand.getIcon(0, 0); + + if (var23 <= 37 && var11 + var20 != 35) + { + if (var23 == 22) + { + if (var19.nextInt(2) == 0) + { + var24 = Block.oreDiamond.getIcon(0, 0); + } + else + { + var24 = Block.oreRedstone.getIcon(0, 0); + } + } + else if (var23 == 10) + { + var24 = Block.oreIron.getIcon(0, 0); + } + else if (var23 == 8) + { + var24 = Block.oreCoal.getIcon(0, 0); + } + else if (var23 > 4) + { + var24 = Block.stone.getIcon(0, 0); + } + else if (var23 > 0) + { + var24 = Block.dirt.getIcon(0, 0); + } + } + else + { + var24 = Block.bedrock.getIcon(0, 0); + } + + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + this.drawTexturedModelRectFromIcon(var8 + var22 * 16 - var12, var9 + var20 * 16 - var13, var24, 16, 16); + } + } + + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthFunc(GL11.GL_LEQUAL); + GL11.glDisable(GL11.GL_TEXTURE_2D); + int var25; + int var28; + int var37; + + for (var20 = 0; var20 < AchievementList.achievementList.size(); ++var20) + { + Achievement var31 = (Achievement)AchievementList.achievementList.get(var20); + + if (var31.parentAchievement != null) + { + var22 = var31.displayColumn * 24 - var4 + 11 + var8; + var23 = var31.displayRow * 24 - var5 + 11 + var9; + var37 = var31.parentAchievement.displayColumn * 24 - var4 + 11 + var8; + var25 = var31.parentAchievement.displayRow * 24 - var5 + 11 + var9; + boolean var26 = this.statFileWriter.hasAchievementUnlocked(var31); + boolean var27 = this.statFileWriter.canUnlockAchievement(var31); + var28 = Math.sin((double)(Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) > 0.6D ? 255 : 130; + int var29 = -16777216; + + if (var26) + { + var29 = -9408400; + } + else if (var27) + { + var29 = 65280 + (var28 << 24); + } + + this.drawHorizontalLine(var22, var37, var23, var29); + this.drawVerticalLine(var37, var23, var25, var29); + } + } + + Achievement var30 = null; + RenderItem var32 = new RenderItem(); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + int var38; + int var39; + + for (var22 = 0; var22 < AchievementList.achievementList.size(); ++var22) + { + Achievement var33 = (Achievement)AchievementList.achievementList.get(var22); + var37 = var33.displayColumn * 24 - var4; + var25 = var33.displayRow * 24 - var5; + + if (var37 >= -24 && var25 >= -24 && var37 <= 224 && var25 <= 155) + { + float var36; + + if (this.statFileWriter.hasAchievementUnlocked(var33)) + { + var36 = 1.0F; + GL11.glColor4f(var36, var36, var36, 1.0F); + } + else if (this.statFileWriter.canUnlockAchievement(var33)) + { + var36 = Math.sin((double)(Minecraft.getSystemTime() % 600L) / 600.0D * Math.PI * 2.0D) < 0.6D ? 0.6F : 0.8F; + GL11.glColor4f(var36, var36, var36, 1.0F); + } + else + { + var36 = 0.3F; + GL11.glColor4f(var36, var36, var36, 1.0F); + } + + this.mc.getTextureManager().bindTexture(achievementTextures); + var38 = var8 + var37; + var39 = var9 + var25; + + if (var33.getSpecial()) + { + this.drawTexturedModalRect(var38 - 2, var39 - 2, 26, 202, 26, 26); + } + else + { + this.drawTexturedModalRect(var38 - 2, var39 - 2, 0, 202, 26, 26); + } + + if (!this.statFileWriter.canUnlockAchievement(var33)) + { + float var40 = 0.1F; + GL11.glColor4f(var40, var40, var40, 1.0F); + var32.renderWithColor = false; + } + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_CULL_FACE); + var32.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), var33.theItemStack, var38 + 3, var39 + 3); + GL11.glDisable(GL11.GL_LIGHTING); + + if (!this.statFileWriter.canUnlockAchievement(var33)) + { + var32.renderWithColor = true; + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + if (par1 >= var8 && par2 >= var9 && par1 < var8 + 224 && par2 < var9 + 155 && par1 >= var38 && par1 <= var38 + 22 && par2 >= var39 && par2 <= var39 + 22) + { + var30 = var33; + } + } + } + + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_BLEND); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(achievementTextures); + this.drawTexturedModalRect(var6, var7, 0, 0, this.achievementsPaneWidth, this.achievementsPaneHeight); + GL11.glPopMatrix(); + this.zLevel = 0.0F; + GL11.glDepthFunc(GL11.GL_LEQUAL); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_TEXTURE_2D); + super.drawScreen(par1, par2, par3); + + if (var30 != null) + { + String var34 = I18n.getString(var30.getName()); + String var35 = var30.getDescription(); + var37 = par1 + 12; + var25 = par2 - 4; + + if (this.statFileWriter.canUnlockAchievement(var30)) + { + var38 = Math.max(this.fontRenderer.getStringWidth(var34), 120); + var39 = this.fontRenderer.splitStringWidth(var35, var38); + + if (this.statFileWriter.hasAchievementUnlocked(var30)) + { + var39 += 12; + } + + this.drawGradientRect(var37 - 3, var25 - 3, var37 + var38 + 3, var25 + var39 + 3 + 12, -1073741824, -1073741824); + this.fontRenderer.drawSplitString(var35, var37, var25 + 12, var38, -6250336); + + if (this.statFileWriter.hasAchievementUnlocked(var30)) + { + this.fontRenderer.drawStringWithShadow(I18n.getString("achievement.taken"), var37, var25 + var39 + 4, -7302913); + } + } + else + { + var38 = Math.max(this.fontRenderer.getStringWidth(var34), 120); + String var41 = I18n.getStringParams("achievement.requires", new Object[] {I18n.getString(var30.parentAchievement.getName())}); + var28 = this.fontRenderer.splitStringWidth(var41, var38); + this.drawGradientRect(var37 - 3, var25 - 3, var37 + var38 + 3, var25 + var28 + 12 + 3, -1073741824, -1073741824); + this.fontRenderer.drawSplitString(var41, var37, var25 + 12, var38, -9416624); + } + + this.fontRenderer.drawStringWithShadow(var34, var37, var25, this.statFileWriter.canUnlockAchievement(var30) ? (var30.getSpecial() ? -128 : -1) : (var30.getSpecial() ? -8355776 : -8355712)); + } + + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_LIGHTING); + RenderHelper.disableStandardItemLighting(); + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/GuiBeacon.java b/src/main/java/net/minecraft/src/GuiBeacon.java new file mode 100644 index 0000000..63501cf --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiBeacon.java @@ -0,0 +1,212 @@ +package net.minecraft.src; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.util.Iterator; +import org.lwjgl.opengl.GL11; + +public class GuiBeacon extends GuiContainer +{ + private static final ResourceLocation beaconGuiTextures = new ResourceLocation("textures/gui/container/beacon.png"); + private TileEntityBeacon beacon; + private GuiBeaconButtonConfirm beaconConfirmButton; + private boolean buttonsNotDrawn; + + public GuiBeacon(InventoryPlayer par1InventoryPlayer, TileEntityBeacon par2TileEntityBeacon) + { + super(new ContainerBeacon(par1InventoryPlayer, par2TileEntityBeacon)); + this.beacon = par2TileEntityBeacon; + this.xSize = 230; + this.ySize = 219; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + super.initGui(); + this.buttonList.add(this.beaconConfirmButton = new GuiBeaconButtonConfirm(this, -1, this.guiLeft + 164, this.guiTop + 107)); + this.buttonList.add(new GuiBeaconButtonCancel(this, -2, this.guiLeft + 190, this.guiTop + 107)); + this.buttonsNotDrawn = true; + this.beaconConfirmButton.enabled = false; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + + if (this.buttonsNotDrawn && this.beacon.getLevels() >= 0) + { + this.buttonsNotDrawn = false; + int var2; + int var3; + int var4; + int var5; + GuiBeaconButtonPower var6; + + for (int var1 = 0; var1 <= 2; ++var1) + { + var2 = TileEntityBeacon.effectsList[var1].length; + var3 = var2 * 22 + (var2 - 1) * 2; + + for (var4 = 0; var4 < var2; ++var4) + { + var5 = TileEntityBeacon.effectsList[var1][var4].id; + var6 = new GuiBeaconButtonPower(this, var1 << 8 | var5, this.guiLeft + 76 + var4 * 24 - var3 / 2, this.guiTop + 22 + var1 * 25, var5, var1); + this.buttonList.add(var6); + + if (var1 >= this.beacon.getLevels()) + { + var6.enabled = false; + } + else if (var5 == this.beacon.getPrimaryEffect()) + { + var6.func_82254_b(true); + } + } + } + + byte var7 = 3; + var2 = TileEntityBeacon.effectsList[var7].length + 1; + var3 = var2 * 22 + (var2 - 1) * 2; + + for (var4 = 0; var4 < var2 - 1; ++var4) + { + var5 = TileEntityBeacon.effectsList[var7][var4].id; + var6 = new GuiBeaconButtonPower(this, var7 << 8 | var5, this.guiLeft + 167 + var4 * 24 - var3 / 2, this.guiTop + 47, var5, var7); + this.buttonList.add(var6); + + if (var7 >= this.beacon.getLevels()) + { + var6.enabled = false; + } + else if (var5 == this.beacon.getSecondaryEffect()) + { + var6.func_82254_b(true); + } + } + + if (this.beacon.getPrimaryEffect() > 0) + { + GuiBeaconButtonPower var8 = new GuiBeaconButtonPower(this, var7 << 8 | this.beacon.getPrimaryEffect(), this.guiLeft + 167 + (var2 - 1) * 24 - var3 / 2, this.guiTop + 47, this.beacon.getPrimaryEffect(), var7); + this.buttonList.add(var8); + + if (var7 >= this.beacon.getLevels()) + { + var8.enabled = false; + } + else if (this.beacon.getPrimaryEffect() == this.beacon.getSecondaryEffect()) + { + var8.func_82254_b(true); + } + } + } + + this.beaconConfirmButton.enabled = this.beacon.getStackInSlot(0) != null && this.beacon.getPrimaryEffect() > 0; + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == -2) + { + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (par1GuiButton.id == -1) + { + String var2 = "MC|Beacon"; + ByteArrayOutputStream var3 = new ByteArrayOutputStream(); + DataOutputStream var4 = new DataOutputStream(var3); + + try + { + var4.writeInt(this.beacon.getPrimaryEffect()); + var4.writeInt(this.beacon.getSecondaryEffect()); + this.mc.getNetHandler().addToSendQueue(new Packet250CustomPayload(var2, var3.toByteArray())); + } + catch (Exception var6) + { + var6.printStackTrace(); + } + + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (par1GuiButton instanceof GuiBeaconButtonPower) + { + if (((GuiBeaconButtonPower)par1GuiButton).func_82255_b()) + { + return; + } + + int var7 = par1GuiButton.id; + int var8 = var7 & 255; + int var9 = var7 >> 8; + + if (var9 < 3) + { + this.beacon.setPrimaryEffect(var8); + } + else + { + this.beacon.setSecondaryEffect(var8); + } + + this.buttonList.clear(); + this.initGui(); + this.updateScreen(); + } + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + RenderHelper.disableStandardItemLighting(); + this.drawCenteredString(this.fontRenderer, I18n.getString("tile.beacon.primary"), 62, 10, 14737632); + this.drawCenteredString(this.fontRenderer, I18n.getString("tile.beacon.secondary"), 169, 10, 14737632); + Iterator var3 = this.buttonList.iterator(); + + while (var3.hasNext()) + { + GuiButton var4 = (GuiButton)var3.next(); + + if (var4.func_82252_a()) + { + var4.func_82251_b(par1 - this.guiLeft, par2 - this.guiTop); + break; + } + } + + RenderHelper.enableGUIStandardItemLighting(); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(beaconGuiTextures); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.ySize); + itemRenderer.zLevel = 100.0F; + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), new ItemStack(Item.emerald), var4 + 42, var5 + 109); + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), new ItemStack(Item.diamond), var4 + 42 + 22, var5 + 109); + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), new ItemStack(Item.ingotGold), var4 + 42 + 44, var5 + 109); + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), new ItemStack(Item.ingotIron), var4 + 42 + 66, var5 + 109); + itemRenderer.zLevel = 0.0F; + } + + static ResourceLocation getBeaconGuiTextures() + { + return beaconGuiTextures; + } +} diff --git a/src/main/java/net/minecraft/src/GuiBeaconButton.java b/src/main/java/net/minecraft/src/GuiBeaconButton.java new file mode 100644 index 0000000..ff860d7 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiBeaconButton.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +class GuiBeaconButton extends GuiButton +{ + /** Texture for this button. */ + private final ResourceLocation buttonTexture; + private final int field_82257_l; + private final int field_82258_m; + private boolean field_82256_n; + + protected GuiBeaconButton(int par1, int par2, int par3, ResourceLocation par4ResourceLocation, int par5, int par6) + { + super(par1, par2, par3, 22, 22, ""); + this.buttonTexture = par4ResourceLocation; + this.field_82257_l = par5; + this.field_82258_m = par6; + } + + /** + * Draws this button to the screen. + */ + public void drawButton(Minecraft par1Minecraft, int par2, int par3) + { + if (this.drawButton) + { + par1Minecraft.getTextureManager().bindTexture(GuiBeacon.getBeaconGuiTextures()); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.field_82253_i = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; + short var4 = 219; + int var5 = 0; + + if (!this.enabled) + { + var5 += this.width * 2; + } + else if (this.field_82256_n) + { + var5 += this.width * 1; + } + else if (this.field_82253_i) + { + var5 += this.width * 3; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, var5, var4, this.width, this.height); + + if (!GuiBeacon.getBeaconGuiTextures().equals(this.buttonTexture)) + { + par1Minecraft.getTextureManager().bindTexture(this.buttonTexture); + } + + this.drawTexturedModalRect(this.xPosition + 2, this.yPosition + 2, this.field_82257_l, this.field_82258_m, 18, 18); + } + } + + public boolean func_82255_b() + { + return this.field_82256_n; + } + + public void func_82254_b(boolean par1) + { + this.field_82256_n = par1; + } +} diff --git a/src/main/java/net/minecraft/src/GuiBeaconButtonCancel.java b/src/main/java/net/minecraft/src/GuiBeaconButtonCancel.java new file mode 100644 index 0000000..b0dabb2 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiBeaconButtonCancel.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +class GuiBeaconButtonCancel extends GuiBeaconButton +{ + /** Beacon GUI this button belongs to. */ + final GuiBeacon beaconGui; + + public GuiBeaconButtonCancel(GuiBeacon par1GuiBeacon, int par2, int par3, int par4) + { + super(par2, par3, par4, GuiBeacon.getBeaconGuiTextures(), 112, 220); + this.beaconGui = par1GuiBeacon; + } + + public void func_82251_b(int par1, int par2) + { + this.beaconGui.drawCreativeTabHoveringText(I18n.getString("gui.cancel"), par1, par2); + } +} diff --git a/src/main/java/net/minecraft/src/GuiBeaconButtonConfirm.java b/src/main/java/net/minecraft/src/GuiBeaconButtonConfirm.java new file mode 100644 index 0000000..0cc9b9d --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiBeaconButtonConfirm.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +class GuiBeaconButtonConfirm extends GuiBeaconButton +{ + /** Beacon GUI this button belongs to. */ + final GuiBeacon beaconGui; + + public GuiBeaconButtonConfirm(GuiBeacon par1GuiBeacon, int par2, int par3, int par4) + { + super(par2, par3, par4, GuiBeacon.getBeaconGuiTextures(), 90, 220); + this.beaconGui = par1GuiBeacon; + } + + public void func_82251_b(int par1, int par2) + { + this.beaconGui.drawCreativeTabHoveringText(I18n.getString("gui.done"), par1, par2); + } +} diff --git a/src/main/java/net/minecraft/src/GuiBeaconButtonPower.java b/src/main/java/net/minecraft/src/GuiBeaconButtonPower.java new file mode 100644 index 0000000..e476230 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiBeaconButtonPower.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +class GuiBeaconButtonPower extends GuiBeaconButton +{ + private final int field_82261_l; + private final int field_82262_m; + + /** Beacon GUI this button belongs to. */ + final GuiBeacon beaconGui; + + public GuiBeaconButtonPower(GuiBeacon par1GuiBeacon, int par2, int par3, int par4, int par5, int par6) + { + super(par2, par3, par4, GuiContainer.field_110408_a, 0 + Potion.potionTypes[par5].getStatusIconIndex() % 8 * 18, 198 + Potion.potionTypes[par5].getStatusIconIndex() / 8 * 18); + this.beaconGui = par1GuiBeacon; + this.field_82261_l = par5; + this.field_82262_m = par6; + } + + public void func_82251_b(int par1, int par2) + { + String var3 = I18n.getString(Potion.potionTypes[this.field_82261_l].getName()); + + if (this.field_82262_m >= 3 && this.field_82261_l != Potion.regeneration.id) + { + var3 = var3 + " II"; + } + + this.beaconGui.drawCreativeTabHoveringText(var3, par1, par2); + } +} diff --git a/src/main/java/net/minecraft/src/GuiBrewingStand.java b/src/main/java/net/minecraft/src/GuiBrewingStand.java new file mode 100644 index 0000000..a91cd62 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiBrewingStand.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiBrewingStand extends GuiContainer +{ + private static final ResourceLocation brewingStandGuiTextures = new ResourceLocation("textures/gui/container/brewing_stand.png"); + private TileEntityBrewingStand brewingStand; + + public GuiBrewingStand(InventoryPlayer par1InventoryPlayer, TileEntityBrewingStand par2TileEntityBrewingStand) + { + super(new ContainerBrewingStand(par1InventoryPlayer, par2TileEntityBrewingStand)); + this.brewingStand = par2TileEntityBrewingStand; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + String var3 = this.brewingStand.isInvNameLocalized() ? this.brewingStand.getInvName() : I18n.getString(this.brewingStand.getInvName()); + this.fontRenderer.drawString(var3, this.xSize / 2 - this.fontRenderer.getStringWidth(var3) / 2, 6, 4210752); + this.fontRenderer.drawString(I18n.getString("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(brewingStandGuiTextures); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.ySize); + int var6 = this.brewingStand.getBrewTime(); + + if (var6 > 0) + { + int var7 = (int)(28.0F * (1.0F - (float)var6 / 400.0F)); + + if (var7 > 0) + { + this.drawTexturedModalRect(var4 + 97, var5 + 16, 176, 0, 9, var7); + } + + int var8 = var6 / 2 % 7; + + switch (var8) + { + case 0: + var7 = 29; + break; + + case 1: + var7 = 24; + break; + + case 2: + var7 = 20; + break; + + case 3: + var7 = 16; + break; + + case 4: + var7 = 11; + break; + + case 5: + var7 = 6; + break; + + case 6: + var7 = 0; + } + + if (var7 > 0) + { + this.drawTexturedModalRect(var4 + 65, var5 + 14 + 29 - var7, 185, 29 - var7, 12, var7); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiButton.java b/src/main/java/net/minecraft/src/GuiButton.java new file mode 100644 index 0000000..bc2e94f --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiButton.java @@ -0,0 +1,128 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiButton extends Gui +{ + protected static final ResourceLocation buttonTextures = new ResourceLocation("textures/gui/widgets.png"); + + /** Button width in pixels */ + protected int width; + + /** Button height in pixels */ + protected int height; + + /** The x position of this control. */ + public int xPosition; + + /** The y position of this control. */ + public int yPosition; + + /** The string displayed on this control. */ + public String displayString; + + /** ID for this control. */ + public int id; + + /** True if this control is enabled, false to disable. */ + public boolean enabled; + + /** Hides the button completely if false. */ + public boolean drawButton; + protected boolean field_82253_i; + + public GuiButton(int par1, int par2, int par3, String par4Str) + { + this(par1, par2, par3, 200, 20, par4Str); + } + + public GuiButton(int par1, int par2, int par3, int par4, int par5, String par6Str) + { + this.width = 200; + this.height = 20; + this.enabled = true; + this.drawButton = true; + this.id = par1; + this.xPosition = par2; + this.yPosition = par3; + this.width = par4; + this.height = par5; + this.displayString = par6Str; + } + + /** + * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over + * this button. + */ + protected int getHoverState(boolean par1) + { + byte var2 = 1; + + if (!this.enabled) + { + var2 = 0; + } + else if (par1) + { + var2 = 2; + } + + return var2; + } + + /** + * Draws this button to the screen. + */ + public void drawButton(Minecraft par1Minecraft, int par2, int par3) + { + if (this.drawButton) + { + FontRenderer var4 = par1Minecraft.fontRenderer; + par1Minecraft.getTextureManager().bindTexture(buttonTextures); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.field_82253_i = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; + int var5 = this.getHoverState(this.field_82253_i); + this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + var5 * 20, this.width / 2, this.height); + this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + var5 * 20, this.width / 2, this.height); + this.mouseDragged(par1Minecraft, par2, par3); + int var6 = 14737632; + + if (!this.enabled) + { + var6 = -6250336; + } + else if (this.field_82253_i) + { + var6 = 16777120; + } + + this.drawCenteredString(var4, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, var6); + } + } + + /** + * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e). + */ + protected void mouseDragged(Minecraft par1Minecraft, int par2, int par3) {} + + /** + * Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e). + */ + public void mouseReleased(int par1, int par2) {} + + /** + * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent + * e). + */ + public boolean mousePressed(Minecraft par1Minecraft, int par2, int par3) + { + return this.enabled && this.drawButton && par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; + } + + public boolean func_82252_a() + { + return this.field_82253_i; + } + + public void func_82251_b(int par1, int par2) {} +} diff --git a/src/main/java/net/minecraft/src/GuiButtonLanguage.java b/src/main/java/net/minecraft/src/GuiButtonLanguage.java new file mode 100644 index 0000000..13bee12 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiButtonLanguage.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiButtonLanguage extends GuiButton +{ + public GuiButtonLanguage(int par1, int par2, int par3) + { + super(par1, par2, par3, 20, 20, ""); + } + + /** + * Draws this button to the screen. + */ + public void drawButton(Minecraft par1Minecraft, int par2, int par3) + { + if (this.drawButton) + { + par1Minecraft.getTextureManager().bindTexture(GuiButton.buttonTextures); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + boolean var4 = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; + int var5 = 106; + + if (var4) + { + var5 += this.height; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, var5, this.width, this.height); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiButtonLink.java b/src/main/java/net/minecraft/src/GuiButtonLink.java new file mode 100644 index 0000000..1476808 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiButtonLink.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +import java.net.URI; + +public class GuiButtonLink extends GuiButton +{ + public GuiButtonLink(int par1, int par2, int par3, int par4, int par5, String par6Str) + { + super(par1, par2, par3, par4, par5, par6Str); + } + + public void func_96135_a(String par1Str) + { + try + { + URI var2 = new URI(par1Str); + Class var3 = Class.forName("java.awt.Desktop"); + Object var4 = var3.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]); + var3.getMethod("browse", new Class[] {URI.class}).invoke(var4, new Object[] {var2}); + } + catch (Throwable var5) + { + var5.printStackTrace(); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiButtonMerchant.java b/src/main/java/net/minecraft/src/GuiButtonMerchant.java new file mode 100644 index 0000000..840acf1 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiButtonMerchant.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +class GuiButtonMerchant extends GuiButton +{ + /** + * If true, then next page button will face to right, if false then next page button will face to left. + */ + private final boolean mirrored; + + public GuiButtonMerchant(int par1, int par2, int par3, boolean par4) + { + super(par1, par2, par3, 12, 19, ""); + this.mirrored = par4; + } + + /** + * Draws this button to the screen. + */ + public void drawButton(Minecraft par1Minecraft, int par2, int par3) + { + if (this.drawButton) + { + par1Minecraft.getTextureManager().bindTexture(GuiMerchant.func_110417_h()); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + boolean var4 = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; + int var5 = 0; + int var6 = 176; + + if (!this.enabled) + { + var6 += this.width * 2; + } + else if (var4) + { + var6 += this.width; + } + + if (!this.mirrored) + { + var5 += this.height; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, var6, var5, this.width, this.height); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiButtonNextPage.java b/src/main/java/net/minecraft/src/GuiButtonNextPage.java new file mode 100644 index 0000000..0f93db9 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiButtonNextPage.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +class GuiButtonNextPage extends GuiButton +{ + /** + * True for pointing right (next page), false for pointing left (previous page). + */ + private final boolean nextPage; + + public GuiButtonNextPage(int par1, int par2, int par3, boolean par4) + { + super(par1, par2, par3, 23, 13, ""); + this.nextPage = par4; + } + + /** + * Draws this button to the screen. + */ + public void drawButton(Minecraft par1Minecraft, int par2, int par3) + { + if (this.drawButton) + { + boolean var4 = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + par1Minecraft.getTextureManager().bindTexture(GuiScreenBook.func_110404_g()); + int var5 = 0; + int var6 = 192; + + if (var4) + { + var5 += 23; + } + + if (!this.nextPage) + { + var6 += 13; + } + + this.drawTexturedModalRect(this.xPosition, this.yPosition, var5, var6, 23, 13); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiChat.java b/src/main/java/net/minecraft/src/GuiChat.java new file mode 100644 index 0000000..20b3e31 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiChat.java @@ -0,0 +1,371 @@ +package net.minecraft.src; + +import java.net.URI; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +public class GuiChat extends GuiScreen +{ + private String field_73898_b = ""; + + /** + * keeps position of which chat message you will select when you press up, (does not increase for duplicated + * messages sent immediately after each other) + */ + private int sentHistoryCursor = -1; + private boolean field_73897_d; + private boolean field_73905_m; + private int field_73903_n; + private List field_73904_o = new ArrayList(); + + /** used to pass around the URI to various dialogues and to the host os */ + private URI clickedURI; + + /** Chat entry field */ + protected GuiTextField inputField; + + /** + * is the text that appears when you press the chat key and the input box appears pre-filled + */ + private String defaultInputFieldText = ""; + + public GuiChat() {} + + public GuiChat(String par1Str) + { + this.defaultInputFieldText = par1Str; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.sentHistoryCursor = this.mc.ingameGUI.getChatGUI().getSentMessages().size(); + this.inputField = new GuiTextField(this.fontRenderer, 4, this.height - 12, this.width - 4, 12); + this.inputField.setMaxStringLength(100); + this.inputField.setEnableBackgroundDrawing(false); + this.inputField.setFocused(true); + this.inputField.setText(this.defaultInputFieldText); + this.inputField.setCanLoseFocus(false); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + this.mc.ingameGUI.getChatGUI().resetScroll(); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.inputField.updateCursorCounter(); + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + this.field_73905_m = false; + + if (par2 == 15) + { + this.completePlayerName(); + } + else + { + this.field_73897_d = false; + } + + if (par2 == 1) + { + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (par2 != 28 && par2 != 156) + { + if (par2 == 200) + { + this.getSentHistory(-1); + } + else if (par2 == 208) + { + this.getSentHistory(1); + } + else if (par2 == 201) + { + this.mc.ingameGUI.getChatGUI().scroll(this.mc.ingameGUI.getChatGUI().func_96127_i() - 1); + } + else if (par2 == 209) + { + this.mc.ingameGUI.getChatGUI().scroll(-this.mc.ingameGUI.getChatGUI().func_96127_i() + 1); + } + else + { + this.inputField.textboxKeyTyped(par1, par2); + } + } + else + { + String var3 = this.inputField.getText().trim(); + + if (var3.length() > 0) + { + this.mc.ingameGUI.getChatGUI().addToSentMessages(var3); + + if (!this.mc.handleClientCommand(var3)) + { + this.mc.thePlayer.sendChatMessage(var3); + } + } + + this.mc.displayGuiScreen((GuiScreen)null); + } + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() + { + super.handleMouseInput(); + int var1 = Mouse.getEventDWheel(); + + if (var1 != 0) + { + if (var1 > 1) + { + var1 = 1; + } + + if (var1 < -1) + { + var1 = -1; + } + + if (!isShiftKeyDown()) + { + var1 *= 7; + } + + this.mc.ingameGUI.getChatGUI().scroll(var1); + } + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + if (par3 == 0 && this.mc.gameSettings.chatLinks) + { + ChatClickData var4 = this.mc.ingameGUI.getChatGUI().func_73766_a(Mouse.getX(), Mouse.getY()); + + if (var4 != null) + { + URI var5 = var4.getURI(); + + if (var5 != null) + { + if (this.mc.gameSettings.chatLinksPrompt) + { + this.clickedURI = var5; + this.mc.displayGuiScreen(new GuiConfirmOpenLink(this, var4.getClickedUrl(), 0, false)); + } + else + { + this.func_73896_a(var5); + } + + return; + } + } + } + + this.inputField.mouseClicked(par1, par2, par3); + super.mouseClicked(par1, par2, par3); + } + + public void confirmClicked(boolean par1, int par2) + { + if (par2 == 0) + { + if (par1) + { + this.func_73896_a(this.clickedURI); + } + + this.clickedURI = null; + this.mc.displayGuiScreen(this); + } + } + + private void func_73896_a(URI par1URI) + { + try + { + Class var2 = Class.forName("java.awt.Desktop"); + Object var3 = var2.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]); + var2.getMethod("browse", new Class[] {URI.class}).invoke(var3, new Object[] {par1URI}); + } + catch (Throwable var4) + { + var4.printStackTrace(); + } + } + + /** + * Autocompletes player name + */ + public void completePlayerName() + { + String var3; + + if (this.field_73897_d) + { + this.inputField.deleteFromCursor(this.inputField.func_73798_a(-1, this.inputField.getCursorPosition(), false) - this.inputField.getCursorPosition()); + + if (this.field_73903_n >= this.field_73904_o.size()) + { + this.field_73903_n = 0; + } + } + else + { + int var1 = this.inputField.func_73798_a(-1, this.inputField.getCursorPosition(), false); + this.field_73904_o.clear(); + this.field_73903_n = 0; + String var2 = this.inputField.getText().substring(var1).toLowerCase(); + var3 = this.inputField.getText().substring(0, this.inputField.getCursorPosition()); + this.func_73893_a(var3, var2); + + if (this.field_73904_o.isEmpty()) + { + return; + } + + this.field_73897_d = true; + this.inputField.deleteFromCursor(var1 - this.inputField.getCursorPosition()); + } + + if (this.field_73904_o.size() > 1) + { + StringBuilder var4 = new StringBuilder(); + + for (Iterator var5 = this.field_73904_o.iterator(); var5.hasNext(); var4.append(var3)) + { + var3 = (String)var5.next(); + + if (var4.length() > 0) + { + var4.append(", "); + } + } + + this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(var4.toString(), 1); + } + + this.inputField.writeText((String)this.field_73904_o.get(this.field_73903_n++)); + } + + private void func_73893_a(String par1Str, String par2Str) + { + if (par1Str.length() >= 1) + { + this.mc.thePlayer.sendQueue.addToSendQueue(new Packet203AutoComplete(par1Str)); + this.field_73905_m = true; + } + } + + /** + * input is relative and is applied directly to the sentHistoryCursor so -1 is the previous message, 1 is the next + * message from the current cursor position + */ + public void getSentHistory(int par1) + { + int var2 = this.sentHistoryCursor + par1; + int var3 = this.mc.ingameGUI.getChatGUI().getSentMessages().size(); + + if (var2 < 0) + { + var2 = 0; + } + + if (var2 > var3) + { + var2 = var3; + } + + if (var2 != this.sentHistoryCursor) + { + if (var2 == var3) + { + this.sentHistoryCursor = var3; + this.inputField.setText(this.field_73898_b); + } + else + { + if (this.sentHistoryCursor == var3) + { + this.field_73898_b = this.inputField.getText(); + } + + this.inputField.setText((String)this.mc.ingameGUI.getChatGUI().getSentMessages().get(var2)); + this.sentHistoryCursor = var2; + } + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE); + this.inputField.drawTextBox(); + super.drawScreen(par1, par2, par3); + } + + public void func_73894_a(String[] par1ArrayOfStr) + { + if (this.field_73905_m) + { + this.field_73904_o.clear(); + String[] var2 = par1ArrayOfStr; + int var3 = par1ArrayOfStr.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + String var5 = var2[var4]; + + if (var5.length() > 0) + { + this.field_73904_o.add(var5); + } + } + + if (this.field_73904_o.size() > 0) + { + this.field_73897_d = true; + this.completePlayerName(); + } + } + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/GuiChest.java b/src/main/java/net/minecraft/src/GuiChest.java new file mode 100644 index 0000000..49f365e --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiChest.java @@ -0,0 +1,49 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiChest extends GuiContainer +{ + private static final ResourceLocation field_110421_t = new ResourceLocation("textures/gui/container/generic_54.png"); + private IInventory upperChestInventory; + private IInventory lowerChestInventory; + + /** + * window height is calculated with this values, the more rows, the heigher + */ + private int inventoryRows; + + public GuiChest(IInventory par1IInventory, IInventory par2IInventory) + { + super(new ContainerChest(par1IInventory, par2IInventory)); + this.upperChestInventory = par1IInventory; + this.lowerChestInventory = par2IInventory; + this.allowUserInput = false; + short var3 = 222; + int var4 = var3 - 108; + this.inventoryRows = par2IInventory.getSizeInventory() / 9; + this.ySize = var4 + this.inventoryRows * 18; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + this.fontRenderer.drawString(this.lowerChestInventory.isInvNameLocalized() ? this.lowerChestInventory.getInvName() : I18n.getString(this.lowerChestInventory.getInvName()), 8, 6, 4210752); + this.fontRenderer.drawString(this.upperChestInventory.isInvNameLocalized() ? this.upperChestInventory.getInvName() : I18n.getString(this.upperChestInventory.getInvName()), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(field_110421_t); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.inventoryRows * 18 + 17); + this.drawTexturedModalRect(var4, var5 + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96); + } +} diff --git a/src/main/java/net/minecraft/src/GuiCommandBlock.java b/src/main/java/net/minecraft/src/GuiCommandBlock.java new file mode 100644 index 0000000..e8f02d5 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiCommandBlock.java @@ -0,0 +1,133 @@ +package net.minecraft.src; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import org.lwjgl.input.Keyboard; + +public class GuiCommandBlock extends GuiScreen +{ + /** Text field containing the command block's command. */ + private GuiTextField commandTextField; + + /** Command block being edited. */ + private final TileEntityCommandBlock commandBlock; + private GuiButton doneBtn; + private GuiButton cancelBtn; + + public GuiCommandBlock(TileEntityCommandBlock par1TileEntityCommandBlock) + { + this.commandBlock = par1TileEntityCommandBlock; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.commandTextField.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(this.doneBtn = new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.getString("gui.done"))); + this.buttonList.add(this.cancelBtn = new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.getString("gui.cancel"))); + this.commandTextField = new GuiTextField(this.fontRenderer, this.width / 2 - 150, 60, 300, 20); + this.commandTextField.setMaxStringLength(32767); + this.commandTextField.setFocused(true); + this.commandTextField.setText(this.commandBlock.getCommand()); + this.doneBtn.enabled = this.commandTextField.getText().trim().length() > 0; + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 1) + { + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (par1GuiButton.id == 0) + { + String var2 = "MC|AdvCdm"; + ByteArrayOutputStream var3 = new ByteArrayOutputStream(); + DataOutputStream var4 = new DataOutputStream(var3); + + try + { + var4.writeInt(this.commandBlock.xCoord); + var4.writeInt(this.commandBlock.yCoord); + var4.writeInt(this.commandBlock.zCoord); + Packet.writeString(this.commandTextField.getText(), var4); + this.mc.getNetHandler().addToSendQueue(new Packet250CustomPayload(var2, var3.toByteArray())); + } + catch (Exception var6) + { + var6.printStackTrace(); + } + + this.mc.displayGuiScreen((GuiScreen)null); + } + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + this.commandTextField.textboxKeyTyped(par1, par2); + this.doneBtn.enabled = this.commandTextField.getText().trim().length() > 0; + + if (par2 != 28 && par2 != 156) + { + if (par2 == 1) + { + this.actionPerformed(this.cancelBtn); + } + } + else + { + this.actionPerformed(this.doneBtn); + } + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + this.commandTextField.mouseClicked(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, I18n.getString("advMode.setCommand"), this.width / 2, 20, 16777215); + this.drawString(this.fontRenderer, I18n.getString("advMode.command"), this.width / 2 - 150, 47, 10526880); + this.drawString(this.fontRenderer, I18n.getString("advMode.nearestPlayer"), this.width / 2 - 150, 97, 10526880); + this.drawString(this.fontRenderer, I18n.getString("advMode.randomPlayer"), this.width / 2 - 150, 108, 10526880); + this.drawString(this.fontRenderer, I18n.getString("advMode.allPlayers"), this.width / 2 - 150, 119, 10526880); + this.commandTextField.drawTextBox(); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiConfirmOpenLink.java b/src/main/java/net/minecraft/src/GuiConfirmOpenLink.java new file mode 100644 index 0000000..a619317 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiConfirmOpenLink.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +public class GuiConfirmOpenLink extends GuiYesNo +{ + /** Text to warn players from opening unsafe links. */ + private String openLinkWarning; + + /** Label for the Copy to Clipboard button. */ + private String copyLinkButtonText; + private String field_92028_p; + private boolean field_92027_q = true; + + public GuiConfirmOpenLink(GuiScreen par1GuiScreen, String par2Str, int par3, boolean par4) + { + super(par1GuiScreen, I18n.getString(par4 ? "chat.link.confirmTrusted" : "chat.link.confirm"), par2Str, par3); + this.buttonText1 = I18n.getString(par4 ? "chat.link.open" : "gui.yes"); + this.buttonText2 = I18n.getString(par4 ? "gui.cancel" : "gui.no"); + this.copyLinkButtonText = I18n.getString("chat.copy"); + this.openLinkWarning = I18n.getString("chat.link.warning"); + this.field_92028_p = par2Str; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.add(new GuiButton(0, this.width / 3 - 83 + 0, this.height / 6 + 96, 100, 20, this.buttonText1)); + this.buttonList.add(new GuiButton(2, this.width / 3 - 83 + 105, this.height / 6 + 96, 100, 20, this.copyLinkButtonText)); + this.buttonList.add(new GuiButton(1, this.width / 3 - 83 + 210, this.height / 6 + 96, 100, 20, this.buttonText2)); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 2) + { + this.copyLinkToClipboard(); + } + + this.parentScreen.confirmClicked(par1GuiButton.id == 0, this.worldNumber); + } + + /** + * Copies the link to the system clipboard. + */ + public void copyLinkToClipboard() + { + setClipboardString(this.field_92028_p); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + super.drawScreen(par1, par2, par3); + + if (this.field_92027_q) + { + this.drawCenteredString(this.fontRenderer, this.openLinkWarning, this.width / 2, 110, 16764108); + } + } + + public void func_92026_h() + { + this.field_92027_q = false; + } +} diff --git a/src/main/java/net/minecraft/src/GuiConnecting.java b/src/main/java/net/minecraft/src/GuiConnecting.java new file mode 100644 index 0000000..efaf03d --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiConnecting.java @@ -0,0 +1,150 @@ +package net.minecraft.src; + +public class GuiConnecting extends GuiScreen +{ + /** A reference to the NetClientHandler. */ + private NetClientHandler clientHandler; + + /** True if the connection attempt has been cancelled. */ + private boolean cancelled; + private final GuiScreen field_98098_c; + + public GuiConnecting(GuiScreen par1GuiScreen, Minecraft par2Minecraft, ServerData par3ServerData) + { + this.mc = par2Minecraft; + this.field_98098_c = par1GuiScreen; + ServerAddress var4 = ServerAddress.func_78860_a(par3ServerData.serverIP); + par2Minecraft.loadWorld((WorldClient)null); + par2Minecraft.setServerData(par3ServerData); + this.spawnNewServerThread(var4.getIP(), var4.getPort()); + } + + public GuiConnecting(GuiScreen par1GuiScreen, Minecraft par2Minecraft, String par3Str, int par4) + { + this.mc = par2Minecraft; + this.field_98098_c = par1GuiScreen; + par2Minecraft.loadWorld((WorldClient)null); + this.spawnNewServerThread(par3Str, par4); + } + + private void spawnNewServerThread(String par1Str, int par2) + { + this.mc.getLogAgent().logInfo("Connecting to " + par1Str + ", " + par2); + (new ThreadConnectToServer(this, par1Str, par2)).start(); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + if (this.clientHandler != null) + { + this.clientHandler.processReadPackets(); + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) {} + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.getString("gui.cancel"))); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 0) + { + this.cancelled = true; + + if (this.clientHandler != null) + { + this.clientHandler.disconnect(); + } + + this.mc.displayGuiScreen(this.field_98098_c); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + + if (this.clientHandler == null) + { + this.drawCenteredString(this.fontRenderer, I18n.getString("connect.connecting"), this.width / 2, this.height / 2 - 50, 16777215); + this.drawCenteredString(this.fontRenderer, "", this.width / 2, this.height / 2 - 10, 16777215); + } + else + { + this.drawCenteredString(this.fontRenderer, I18n.getString("connect.authorizing"), this.width / 2, this.height / 2 - 50, 16777215); + this.drawCenteredString(this.fontRenderer, this.clientHandler.field_72560_a, this.width / 2, this.height / 2 - 10, 16777215); + } + + super.drawScreen(par1, par2, par3); + } + + /** + * Sets the NetClientHandler. + */ + static NetClientHandler setNetClientHandler(GuiConnecting par0GuiConnecting, NetClientHandler par1NetClientHandler) + { + return par0GuiConnecting.clientHandler = par1NetClientHandler; + } + + static Minecraft func_74256_a(GuiConnecting par0GuiConnecting) + { + return par0GuiConnecting.mc; + } + + static boolean isCancelled(GuiConnecting par0GuiConnecting) + { + return par0GuiConnecting.cancelled; + } + + static Minecraft func_74254_c(GuiConnecting par0GuiConnecting) + { + return par0GuiConnecting.mc; + } + + /** + * Gets the NetClientHandler. + */ + static NetClientHandler getNetClientHandler(GuiConnecting par0GuiConnecting) + { + return par0GuiConnecting.clientHandler; + } + + static GuiScreen func_98097_e(GuiConnecting par0GuiConnecting) + { + return par0GuiConnecting.field_98098_c; + } + + static Minecraft func_74250_f(GuiConnecting par0GuiConnecting) + { + return par0GuiConnecting.mc; + } + + static Minecraft func_74251_g(GuiConnecting par0GuiConnecting) + { + return par0GuiConnecting.mc; + } + + static Minecraft func_98096_h(GuiConnecting par0GuiConnecting) + { + return par0GuiConnecting.mc; + } +} diff --git a/src/main/java/net/minecraft/src/GuiContainer.java b/src/main/java/net/minecraft/src/GuiContainer.java new file mode 100644 index 0000000..402ef41 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiContainer.java @@ -0,0 +1,859 @@ +package net.minecraft.src; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public abstract class GuiContainer extends GuiScreen +{ + protected static final ResourceLocation field_110408_a = new ResourceLocation("textures/gui/container/inventory.png"); + + /** Stacks renderer. Icons, stack size, health, etc... */ + protected static RenderItem itemRenderer = new RenderItem(); + + /** The X size of the inventory window in pixels. */ + protected int xSize = 176; + + /** The Y size of the inventory window in pixels. */ + protected int ySize = 166; + + /** A list of the players inventory slots. */ + public Container inventorySlots; + + /** + * Starting X position for the Gui. Inconsistent use for Gui backgrounds. + */ + protected int guiLeft; + + /** + * Starting Y position for the Gui. Inconsistent use for Gui backgrounds. + */ + protected int guiTop; + private Slot theSlot; + + /** Used when touchscreen is enabled */ + private Slot clickedSlot; + + /** Used when touchscreen is enabled */ + private boolean isRightMouseClick; + + /** Used when touchscreen is enabled */ + private ItemStack draggedStack; + private int field_85049_r; + private int field_85048_s; + private Slot returningStackDestSlot; + private long returningStackTime; + + /** Used when touchscreen is enabled */ + private ItemStack returningStack; + private Slot field_92033_y; + private long field_92032_z; + protected final Set field_94077_p = new HashSet(); + protected boolean field_94076_q; + private int field_94071_C; + private int field_94067_D; + private boolean field_94068_E; + private int field_94069_F; + private long field_94070_G; + private Slot field_94072_H; + private int field_94073_I; + private boolean field_94074_J; + private ItemStack field_94075_K; + + public GuiContainer(Container par1Container) + { + this.inventorySlots = par1Container; + this.field_94068_E = true; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + super.initGui(); + this.mc.thePlayer.openContainer = this.inventorySlots; + this.guiLeft = (this.width - this.xSize) / 2; + this.guiTop = (this.height - this.ySize) / 2; + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + int var4 = this.guiLeft; + int var5 = this.guiTop; + this.drawGuiContainerBackgroundLayer(par3, par1, par2); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + super.drawScreen(par1, par2, par3); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var4, (float)var5, 0.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + this.theSlot = null; + short var6 = 240; + short var7 = 240; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)var6 / 1.0F, (float)var7 / 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + int var9; + + for (int var13 = 0; var13 < this.inventorySlots.inventorySlots.size(); ++var13) + { + Slot var15 = (Slot)this.inventorySlots.inventorySlots.get(var13); + this.drawSlotInventory(var15); + + if (this.isMouseOverSlot(var15, par1, par2) && var15.func_111238_b()) + { + this.theSlot = var15; + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + int var8 = var15.xDisplayPosition; + var9 = var15.yDisplayPosition; + this.drawGradientRect(var8, var9, var8 + 16, var9 + 16, -2130706433, -2130706433); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + } + + this.drawGuiContainerForegroundLayer(par1, par2); + InventoryPlayer var14 = this.mc.thePlayer.inventory; + ItemStack var16 = this.draggedStack == null ? var14.getItemStack() : this.draggedStack; + + if (var16 != null) + { + byte var17 = 8; + var9 = this.draggedStack == null ? 8 : 16; + String var10 = null; + + if (this.draggedStack != null && this.isRightMouseClick) + { + var16 = var16.copy(); + var16.stackSize = MathHelper.ceiling_float_int((float)var16.stackSize / 2.0F); + } + else if (this.field_94076_q && this.field_94077_p.size() > 1) + { + var16 = var16.copy(); + var16.stackSize = this.field_94069_F; + + if (var16.stackSize == 0) + { + var10 = "" + EnumChatFormatting.YELLOW + "0"; + } + } + + this.drawItemStack(var16, par1 - var4 - var17, par2 - var5 - var9, var10); + } + + if (this.returningStack != null) + { + float var18 = (float)(Minecraft.getSystemTime() - this.returningStackTime) / 100.0F; + + if (var18 >= 1.0F) + { + var18 = 1.0F; + this.returningStack = null; + } + + var9 = this.returningStackDestSlot.xDisplayPosition - this.field_85049_r; + int var20 = this.returningStackDestSlot.yDisplayPosition - this.field_85048_s; + int var11 = this.field_85049_r + (int)((float)var9 * var18); + int var12 = this.field_85048_s + (int)((float)var20 * var18); + this.drawItemStack(this.returningStack, var11, var12, (String)null); + } + + GL11.glPopMatrix(); + + if (var14.getItemStack() == null && this.theSlot != null && this.theSlot.getHasStack()) + { + ItemStack var19 = this.theSlot.getStack(); + this.drawItemStackTooltip(var19, par1, par2); + } + + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + RenderHelper.enableStandardItemLighting(); + } + + private void drawItemStack(ItemStack par1ItemStack, int par2, int par3, String par4Str) + { + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + this.zLevel = 200.0F; + itemRenderer.zLevel = 200.0F; + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), par1ItemStack, par2, par3); + itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.getTextureManager(), par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str); + this.zLevel = 0.0F; + itemRenderer.zLevel = 0.0F; + } + + protected void drawItemStackTooltip(ItemStack par1ItemStack, int par2, int par3) + { + List var4 = par1ItemStack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips); + + for (int var5 = 0; var5 < var4.size(); ++var5) + { + if (var5 == 0) + { + var4.set(var5, "\u00a7" + Integer.toHexString(par1ItemStack.getRarity().rarityColor) + (String)var4.get(var5)); + } + else + { + var4.set(var5, EnumChatFormatting.GRAY + (String)var4.get(var5)); + } + } + + this.func_102021_a(var4, par2, par3); + } + + /** + * Draws the text when mouse is over creative inventory tab. Params: current creative tab to be checked, current + * mouse x position, current mouse y position. + */ + protected void drawCreativeTabHoveringText(String par1Str, int par2, int par3) + { + this.func_102021_a(Arrays.asList(new String[] {par1Str}), par2, par3); + } + + protected void func_102021_a(List par1List, int par2, int par3) + { + if (!par1List.isEmpty()) + { + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_DEPTH_TEST); + int var4 = 0; + Iterator var5 = par1List.iterator(); + + while (var5.hasNext()) + { + String var6 = (String)var5.next(); + int var7 = this.fontRenderer.getStringWidth(var6); + + if (var7 > var4) + { + var4 = var7; + } + } + + int var14 = par2 + 12; + int var15 = par3 - 12; + int var8 = 8; + + if (par1List.size() > 1) + { + var8 += 2 + (par1List.size() - 1) * 10; + } + + if (var14 + var4 > this.width) + { + var14 -= 28 + var4; + } + + if (var15 + var8 + 6 > this.height) + { + var15 = this.height - var8 - 6; + } + + this.zLevel = 300.0F; + itemRenderer.zLevel = 300.0F; + int var9 = -267386864; + this.drawGradientRect(var14 - 3, var15 - 4, var14 + var4 + 3, var15 - 3, var9, var9); + this.drawGradientRect(var14 - 3, var15 + var8 + 3, var14 + var4 + 3, var15 + var8 + 4, var9, var9); + this.drawGradientRect(var14 - 3, var15 - 3, var14 + var4 + 3, var15 + var8 + 3, var9, var9); + this.drawGradientRect(var14 - 4, var15 - 3, var14 - 3, var15 + var8 + 3, var9, var9); + this.drawGradientRect(var14 + var4 + 3, var15 - 3, var14 + var4 + 4, var15 + var8 + 3, var9, var9); + int var10 = 1347420415; + int var11 = (var10 & 16711422) >> 1 | var10 & -16777216; + this.drawGradientRect(var14 - 3, var15 - 3 + 1, var14 - 3 + 1, var15 + var8 + 3 - 1, var10, var11); + this.drawGradientRect(var14 + var4 + 2, var15 - 3 + 1, var14 + var4 + 3, var15 + var8 + 3 - 1, var10, var11); + this.drawGradientRect(var14 - 3, var15 - 3, var14 + var4 + 3, var15 - 3 + 1, var10, var10); + this.drawGradientRect(var14 - 3, var15 + var8 + 2, var14 + var4 + 3, var15 + var8 + 3, var11, var11); + + for (int var12 = 0; var12 < par1List.size(); ++var12) + { + String var13 = (String)par1List.get(var12); + this.fontRenderer.drawStringWithShadow(var13, var14, var15, -1); + + if (var12 == 0) + { + var15 += 2; + } + + var15 += 10; + } + + this.zLevel = 0.0F; + itemRenderer.zLevel = 0.0F; + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + RenderHelper.enableStandardItemLighting(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + } + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) {} + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected abstract void drawGuiContainerBackgroundLayer(float var1, int var2, int var3); + + /** + * Draws an inventory slot + */ + private void drawSlotInventory(Slot par1Slot) + { + int var2 = par1Slot.xDisplayPosition; + int var3 = par1Slot.yDisplayPosition; + ItemStack var4 = par1Slot.getStack(); + boolean var5 = false; + boolean var6 = par1Slot == this.clickedSlot && this.draggedStack != null && !this.isRightMouseClick; + ItemStack var7 = this.mc.thePlayer.inventory.getItemStack(); + String var8 = null; + + if (par1Slot == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && var4 != null) + { + var4 = var4.copy(); + var4.stackSize /= 2; + } + else if (this.field_94076_q && this.field_94077_p.contains(par1Slot) && var7 != null) + { + if (this.field_94077_p.size() == 1) + { + return; + } + + if (Container.func_94527_a(par1Slot, var7, true) && this.inventorySlots.canDragIntoSlot(par1Slot)) + { + var4 = var7.copy(); + var5 = true; + Container.func_94525_a(this.field_94077_p, this.field_94071_C, var4, par1Slot.getStack() == null ? 0 : par1Slot.getStack().stackSize); + + if (var4.stackSize > var4.getMaxStackSize()) + { + var8 = EnumChatFormatting.YELLOW + "" + var4.getMaxStackSize(); + var4.stackSize = var4.getMaxStackSize(); + } + + if (var4.stackSize > par1Slot.getSlotStackLimit()) + { + var8 = EnumChatFormatting.YELLOW + "" + par1Slot.getSlotStackLimit(); + var4.stackSize = par1Slot.getSlotStackLimit(); + } + } + else + { + this.field_94077_p.remove(par1Slot); + this.func_94066_g(); + } + } + + this.zLevel = 100.0F; + itemRenderer.zLevel = 100.0F; + + if (var4 == null) + { + Icon var9 = par1Slot.getBackgroundIconIndex(); + + if (var9 != null) + { + GL11.glDisable(GL11.GL_LIGHTING); + this.mc.getTextureManager().bindTexture(TextureMap.locationItemsTexture); + this.drawTexturedModelRectFromIcon(var2, var3, var9, 16, 16); + GL11.glEnable(GL11.GL_LIGHTING); + var6 = true; + } + } + + if (!var6) + { + if (var5) + { + drawRect(var2, var3, var2 + 16, var3 + 16, -2130706433); + } + + GL11.glEnable(GL11.GL_DEPTH_TEST); + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), var4, var2, var3); + itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.getTextureManager(), var4, var2, var3, var8); + } + + itemRenderer.zLevel = 0.0F; + this.zLevel = 0.0F; + } + + private void func_94066_g() + { + ItemStack var1 = this.mc.thePlayer.inventory.getItemStack(); + + if (var1 != null && this.field_94076_q) + { + this.field_94069_F = var1.stackSize; + ItemStack var4; + int var5; + + for (Iterator var2 = this.field_94077_p.iterator(); var2.hasNext(); this.field_94069_F -= var4.stackSize - var5) + { + Slot var3 = (Slot)var2.next(); + var4 = var1.copy(); + var5 = var3.getStack() == null ? 0 : var3.getStack().stackSize; + Container.func_94525_a(this.field_94077_p, this.field_94071_C, var4, var5); + + if (var4.stackSize > var4.getMaxStackSize()) + { + var4.stackSize = var4.getMaxStackSize(); + } + + if (var4.stackSize > var3.getSlotStackLimit()) + { + var4.stackSize = var3.getSlotStackLimit(); + } + } + } + } + + /** + * Returns the slot at the given coordinates or null if there is none. + */ + private Slot getSlotAtPosition(int par1, int par2) + { + for (int var3 = 0; var3 < this.inventorySlots.inventorySlots.size(); ++var3) + { + Slot var4 = (Slot)this.inventorySlots.inventorySlots.get(var3); + + if (this.isMouseOverSlot(var4, par1, par2)) + { + return var4; + } + } + + return null; + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + boolean var4 = par3 == this.mc.gameSettings.keyBindPickBlock.keyCode + 100; + Slot var5 = this.getSlotAtPosition(par1, par2); + long var6 = Minecraft.getSystemTime(); + this.field_94074_J = this.field_94072_H == var5 && var6 - this.field_94070_G < 250L && this.field_94073_I == par3; + this.field_94068_E = false; + + if (par3 == 0 || par3 == 1 || var4) + { + int var8 = this.guiLeft; + int var9 = this.guiTop; + boolean var10 = par1 < var8 || par2 < var9 || par1 >= var8 + this.xSize || par2 >= var9 + this.ySize; + int var11 = -1; + + if (var5 != null) + { + var11 = var5.slotNumber; + } + + if (var10) + { + var11 = -999; + } + + if (this.mc.gameSettings.touchscreen && var10 && this.mc.thePlayer.inventory.getItemStack() == null) + { + this.mc.displayGuiScreen((GuiScreen)null); + return; + } + + if (var11 != -1) + { + if (this.mc.gameSettings.touchscreen) + { + if (var5 != null && var5.getHasStack()) + { + this.clickedSlot = var5; + this.draggedStack = null; + this.isRightMouseClick = par3 == 1; + } + else + { + this.clickedSlot = null; + } + } + else if (!this.field_94076_q) + { + if (this.mc.thePlayer.inventory.getItemStack() == null) + { + if (par3 == this.mc.gameSettings.keyBindPickBlock.keyCode + 100) + { + this.handleMouseClick(var5, var11, par3, 3); + } + else + { + boolean var12 = var11 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)); + byte var13 = 0; + + if (var12) + { + this.field_94075_K = var5 != null && var5.getHasStack() ? var5.getStack() : null; + var13 = 1; + } + else if (var11 == -999) + { + var13 = 4; + } + + this.handleMouseClick(var5, var11, par3, var13); + } + + this.field_94068_E = true; + } + else + { + this.field_94076_q = true; + this.field_94067_D = par3; + this.field_94077_p.clear(); + + if (par3 == 0) + { + this.field_94071_C = 0; + } + else if (par3 == 1) + { + this.field_94071_C = 1; + } + } + } + } + } + + this.field_94072_H = var5; + this.field_94070_G = var6; + this.field_94073_I = par3; + } + + /** + * Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX, mouseY, + * lastButtonClicked & timeSinceMouseClick. + */ + protected void mouseClickMove(int par1, int par2, int par3, long par4) + { + Slot var6 = this.getSlotAtPosition(par1, par2); + ItemStack var7 = this.mc.thePlayer.inventory.getItemStack(); + + if (this.clickedSlot != null && this.mc.gameSettings.touchscreen) + { + if (par3 == 0 || par3 == 1) + { + if (this.draggedStack == null) + { + if (var6 != this.clickedSlot) + { + this.draggedStack = this.clickedSlot.getStack().copy(); + } + } + else if (this.draggedStack.stackSize > 1 && var6 != null && Container.func_94527_a(var6, this.draggedStack, false)) + { + long var8 = Minecraft.getSystemTime(); + + if (this.field_92033_y == var6) + { + if (var8 - this.field_92032_z > 500L) + { + this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0); + this.handleMouseClick(var6, var6.slotNumber, 1, 0); + this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0); + this.field_92032_z = var8 + 750L; + --this.draggedStack.stackSize; + } + } + else + { + this.field_92033_y = var6; + this.field_92032_z = var8; + } + } + } + } + else if (this.field_94076_q && var6 != null && var7 != null && var7.stackSize > this.field_94077_p.size() && Container.func_94527_a(var6, var7, true) && var6.isItemValid(var7) && this.inventorySlots.canDragIntoSlot(var6)) + { + this.field_94077_p.add(var6); + this.func_94066_g(); + } + } + + /** + * Called when the mouse is moved or a mouse button is released. Signature: (mouseX, mouseY, which) which==-1 is + * mouseMove, which==0 or which==1 is mouseUp + */ + protected void mouseMovedOrUp(int par1, int par2, int par3) + { + Slot var4 = this.getSlotAtPosition(par1, par2); + int var5 = this.guiLeft; + int var6 = this.guiTop; + boolean var7 = par1 < var5 || par2 < var6 || par1 >= var5 + this.xSize || par2 >= var6 + this.ySize; + int var8 = -1; + + if (var4 != null) + { + var8 = var4.slotNumber; + } + + if (var7) + { + var8 = -999; + } + + Slot var10; + Iterator var11; + + if (this.field_94074_J && var4 != null && par3 == 0 && this.inventorySlots.func_94530_a((ItemStack)null, var4)) + { + if (isShiftKeyDown()) + { + if (var4 != null && var4.inventory != null && this.field_94075_K != null) + { + var11 = this.inventorySlots.inventorySlots.iterator(); + + while (var11.hasNext()) + { + var10 = (Slot)var11.next(); + + if (var10 != null && var10.canTakeStack(this.mc.thePlayer) && var10.getHasStack() && var10.inventory == var4.inventory && Container.func_94527_a(var10, this.field_94075_K, true)) + { + this.handleMouseClick(var10, var10.slotNumber, par3, 1); + } + } + } + } + else + { + this.handleMouseClick(var4, var8, par3, 6); + } + + this.field_94074_J = false; + this.field_94070_G = 0L; + } + else + { + if (this.field_94076_q && this.field_94067_D != par3) + { + this.field_94076_q = false; + this.field_94077_p.clear(); + this.field_94068_E = true; + return; + } + + if (this.field_94068_E) + { + this.field_94068_E = false; + return; + } + + boolean var9; + + if (this.clickedSlot != null && this.mc.gameSettings.touchscreen) + { + if (par3 == 0 || par3 == 1) + { + if (this.draggedStack == null && var4 != this.clickedSlot) + { + this.draggedStack = this.clickedSlot.getStack(); + } + + var9 = Container.func_94527_a(var4, this.draggedStack, false); + + if (var8 != -1 && this.draggedStack != null && var9) + { + this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, par3, 0); + this.handleMouseClick(var4, var8, 0, 0); + + if (this.mc.thePlayer.inventory.getItemStack() != null) + { + this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, par3, 0); + this.field_85049_r = par1 - var5; + this.field_85048_s = par2 - var6; + this.returningStackDestSlot = this.clickedSlot; + this.returningStack = this.draggedStack; + this.returningStackTime = Minecraft.getSystemTime(); + } + else + { + this.returningStack = null; + } + } + else if (this.draggedStack != null) + { + this.field_85049_r = par1 - var5; + this.field_85048_s = par2 - var6; + this.returningStackDestSlot = this.clickedSlot; + this.returningStack = this.draggedStack; + this.returningStackTime = Minecraft.getSystemTime(); + } + + this.draggedStack = null; + this.clickedSlot = null; + } + } + else if (this.field_94076_q && !this.field_94077_p.isEmpty()) + { + this.handleMouseClick((Slot)null, -999, Container.func_94534_d(0, this.field_94071_C), 5); + var11 = this.field_94077_p.iterator(); + + while (var11.hasNext()) + { + var10 = (Slot)var11.next(); + this.handleMouseClick(var10, var10.slotNumber, Container.func_94534_d(1, this.field_94071_C), 5); + } + + this.handleMouseClick((Slot)null, -999, Container.func_94534_d(2, this.field_94071_C), 5); + } + else if (this.mc.thePlayer.inventory.getItemStack() != null) + { + if (par3 == this.mc.gameSettings.keyBindPickBlock.keyCode + 100) + { + this.handleMouseClick(var4, var8, par3, 3); + } + else + { + var9 = var8 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54)); + + if (var9) + { + this.field_94075_K = var4 != null && var4.getHasStack() ? var4.getStack() : null; + } + + this.handleMouseClick(var4, var8, par3, var9 ? 1 : 0); + } + } + } + + if (this.mc.thePlayer.inventory.getItemStack() == null) + { + this.field_94070_G = 0L; + } + + this.field_94076_q = false; + } + + /** + * Returns if the passed mouse position is over the specified slot. + */ + private boolean isMouseOverSlot(Slot par1Slot, int par2, int par3) + { + return this.isPointInRegion(par1Slot.xDisplayPosition, par1Slot.yDisplayPosition, 16, 16, par2, par3); + } + + /** + * Args: left, top, width, height, pointX, pointY. Note: left, top are local to Gui, pointX, pointY are local to + * screen + */ + protected boolean isPointInRegion(int par1, int par2, int par3, int par4, int par5, int par6) + { + int var7 = this.guiLeft; + int var8 = this.guiTop; + par5 -= var7; + par6 -= var8; + return par5 >= par1 - 1 && par5 < par1 + par3 + 1 && par6 >= par2 - 1 && par6 < par2 + par4 + 1; + } + + protected void handleMouseClick(Slot par1Slot, int par2, int par3, int par4) + { + if (par1Slot != null) + { + par2 = par1Slot.slotNumber; + } + + this.mc.playerController.windowClick(this.inventorySlots.windowId, par2, par3, par4, this.mc.thePlayer); + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (par2 == 1 || par2 == this.mc.gameSettings.keyBindInventory.keyCode) + { + this.mc.thePlayer.closeScreen(); + } + + this.checkHotbarKeys(par2); + + if (this.theSlot != null && this.theSlot.getHasStack()) + { + if (par2 == this.mc.gameSettings.keyBindPickBlock.keyCode) + { + this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, 0, 3); + } + else if (par2 == this.mc.gameSettings.keyBindDrop.keyCode) + { + this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, isCtrlKeyDown() ? 1 : 0, 4); + } + } + } + + /** + * This function is what controls the hotbar shortcut check when you press a number key when hovering a stack. + */ + protected boolean checkHotbarKeys(int par1) + { + if (this.mc.thePlayer.inventory.getItemStack() == null && this.theSlot != null) + { + for (int var2 = 0; var2 < 9; ++var2) + { + if (par1 == 2 + var2) + { + this.handleMouseClick(this.theSlot, this.theSlot.slotNumber, var2, 2); + return true; + } + } + } + + return false; + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + if (this.mc.thePlayer != null) + { + this.inventorySlots.onContainerClosed(this.mc.thePlayer); + } + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return false; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + + if (!this.mc.thePlayer.isEntityAlive() || this.mc.thePlayer.isDead) + { + this.mc.thePlayer.closeScreen(); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiContainerCreative.java b/src/main/java/net/minecraft/src/GuiContainerCreative.java new file mode 100644 index 0000000..6220232 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiContainerCreative.java @@ -0,0 +1,908 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiContainerCreative extends InventoryEffectRenderer +{ + private static final ResourceLocation field_110424_t = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png"); + private static InventoryBasic inventory = new InventoryBasic("tmp", true, 45); + + /** Currently selected creative inventory tab index. */ + private static int selectedTabIndex = CreativeTabs.tabBlock.getTabIndex(); + + /** Amount scrolled in Creative mode inventory (0 = top, 1 = bottom) */ + private float currentScroll; + + /** True if the scrollbar is being dragged */ + private boolean isScrolling; + + /** + * True if the left mouse button was held down last time drawScreen was called. + */ + private boolean wasClicking; + private GuiTextField searchField; + + /** + * Used to back up the ContainerCreative's inventory slots before filling it with the player's inventory slots for + * the inventory tab. + */ + private List backupContainerSlots; + private Slot field_74235_v; + private boolean field_74234_w; + private CreativeCrafting field_82324_x; + + public GuiContainerCreative(EntityPlayer par1EntityPlayer) + { + super(new ContainerCreative(par1EntityPlayer)); + par1EntityPlayer.openContainer = this.inventorySlots; + this.allowUserInput = true; + par1EntityPlayer.addStat(AchievementList.openInventory, 1); + this.ySize = 136; + this.xSize = 195; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + if (!this.mc.playerController.isInCreativeMode()) + { + this.mc.displayGuiScreen(new GuiInventory(this.mc.thePlayer)); + } + } + + protected void handleMouseClick(Slot par1Slot, int par2, int par3, int par4) + { + this.field_74234_w = true; + boolean var5 = par4 == 1; + par4 = par2 == -999 && par4 == 0 ? 4 : par4; + ItemStack var7; + InventoryPlayer var11; + + if (par1Slot == null && selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && par4 != 5) + { + var11 = this.mc.thePlayer.inventory; + + if (var11.getItemStack() != null) + { + if (par3 == 0) + { + this.mc.thePlayer.dropPlayerItem(var11.getItemStack()); + this.mc.playerController.func_78752_a(var11.getItemStack()); + var11.setItemStack((ItemStack)null); + } + + if (par3 == 1) + { + var7 = var11.getItemStack().splitStack(1); + this.mc.thePlayer.dropPlayerItem(var7); + this.mc.playerController.func_78752_a(var7); + + if (var11.getItemStack().stackSize == 0) + { + var11.setItemStack((ItemStack)null); + } + } + } + } + else + { + int var10; + + if (par1Slot == this.field_74235_v && var5) + { + for (var10 = 0; var10 < this.mc.thePlayer.inventoryContainer.getInventory().size(); ++var10) + { + this.mc.playerController.sendSlotPacket((ItemStack)null, var10); + } + } + else + { + ItemStack var6; + + if (selectedTabIndex == CreativeTabs.tabInventory.getTabIndex()) + { + if (par1Slot == this.field_74235_v) + { + this.mc.thePlayer.inventory.setItemStack((ItemStack)null); + } + else if (par4 == 4 && par1Slot != null && par1Slot.getHasStack()) + { + var6 = par1Slot.decrStackSize(par3 == 0 ? 1 : par1Slot.getStack().getMaxStackSize()); + this.mc.thePlayer.dropPlayerItem(var6); + this.mc.playerController.func_78752_a(var6); + } + else if (par4 == 4 && this.mc.thePlayer.inventory.getItemStack() != null) + { + this.mc.thePlayer.dropPlayerItem(this.mc.thePlayer.inventory.getItemStack()); + this.mc.playerController.func_78752_a(this.mc.thePlayer.inventory.getItemStack()); + this.mc.thePlayer.inventory.setItemStack((ItemStack)null); + } + else + { + this.mc.thePlayer.inventoryContainer.slotClick(par1Slot == null ? par2 : SlotCreativeInventory.func_75240_a((SlotCreativeInventory)par1Slot).slotNumber, par3, par4, this.mc.thePlayer); + this.mc.thePlayer.inventoryContainer.detectAndSendChanges(); + } + } + else if (par4 != 5 && par1Slot.inventory == inventory) + { + var11 = this.mc.thePlayer.inventory; + var7 = var11.getItemStack(); + ItemStack var8 = par1Slot.getStack(); + ItemStack var9; + + if (par4 == 2) + { + if (var8 != null && par3 >= 0 && par3 < 9) + { + var9 = var8.copy(); + var9.stackSize = var9.getMaxStackSize(); + this.mc.thePlayer.inventory.setInventorySlotContents(par3, var9); + this.mc.thePlayer.inventoryContainer.detectAndSendChanges(); + } + + return; + } + + if (par4 == 3) + { + if (var11.getItemStack() == null && par1Slot.getHasStack()) + { + var9 = par1Slot.getStack().copy(); + var9.stackSize = var9.getMaxStackSize(); + var11.setItemStack(var9); + } + + return; + } + + if (par4 == 4) + { + if (var8 != null) + { + var9 = var8.copy(); + var9.stackSize = par3 == 0 ? 1 : var9.getMaxStackSize(); + this.mc.thePlayer.dropPlayerItem(var9); + this.mc.playerController.func_78752_a(var9); + } + + return; + } + + if (var7 != null && var8 != null && var7.isItemEqual(var8)) + { + if (par3 == 0) + { + if (var5) + { + var7.stackSize = var7.getMaxStackSize(); + } + else if (var7.stackSize < var7.getMaxStackSize()) + { + ++var7.stackSize; + } + } + else if (var7.stackSize <= 1) + { + var11.setItemStack((ItemStack)null); + } + else + { + --var7.stackSize; + } + } + else if (var8 != null && var7 == null) + { + var11.setItemStack(ItemStack.copyItemStack(var8)); + var7 = var11.getItemStack(); + + if (var5) + { + var7.stackSize = var7.getMaxStackSize(); + } + } + else + { + var11.setItemStack((ItemStack)null); + } + } + else + { + this.inventorySlots.slotClick(par1Slot == null ? par2 : par1Slot.slotNumber, par3, par4, this.mc.thePlayer); + + if (Container.func_94532_c(par3) == 2) + { + for (var10 = 0; var10 < 9; ++var10) + { + this.mc.playerController.sendSlotPacket(this.inventorySlots.getSlot(45 + var10).getStack(), 36 + var10); + } + } + else if (par1Slot != null) + { + var6 = this.inventorySlots.getSlot(par1Slot.slotNumber).getStack(); + this.mc.playerController.sendSlotPacket(var6, par1Slot.slotNumber - this.inventorySlots.inventorySlots.size() + 9 + 36); + } + } + } + } + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + if (this.mc.playerController.isInCreativeMode()) + { + super.initGui(); + this.buttonList.clear(); + Keyboard.enableRepeatEvents(true); + this.searchField = new GuiTextField(this.fontRenderer, this.guiLeft + 82, this.guiTop + 6, 89, this.fontRenderer.FONT_HEIGHT); + this.searchField.setMaxStringLength(15); + this.searchField.setEnableBackgroundDrawing(false); + this.searchField.setVisible(false); + this.searchField.setTextColor(16777215); + int var1 = selectedTabIndex; + selectedTabIndex = -1; + this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[var1]); + this.field_82324_x = new CreativeCrafting(this.mc); + this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_82324_x); + } + else + { + this.mc.displayGuiScreen(new GuiInventory(this.mc.thePlayer)); + } + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + super.onGuiClosed(); + + if (this.mc.thePlayer != null && this.mc.thePlayer.inventory != null) + { + this.mc.thePlayer.inventoryContainer.removeCraftingFromCrafters(this.field_82324_x); + } + + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex()) + { + if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat)) + { + this.setCurrentCreativeTab(CreativeTabs.tabAllSearch); + } + else + { + super.keyTyped(par1, par2); + } + } + else + { + if (this.field_74234_w) + { + this.field_74234_w = false; + this.searchField.setText(""); + } + + if (!this.checkHotbarKeys(par2)) + { + if (this.searchField.textboxKeyTyped(par1, par2)) + { + this.updateCreativeSearch(); + } + else + { + super.keyTyped(par1, par2); + } + } + } + } + + private void updateCreativeSearch() + { + ContainerCreative var1 = (ContainerCreative)this.inventorySlots; + var1.itemList.clear(); + Item[] var2 = Item.itemsList; + int var3 = var2.length; + int var4; + + for (var4 = 0; var4 < var3; ++var4) + { + Item var5 = var2[var4]; + + if (var5 != null && var5.getCreativeTab() != null) + { + var5.getSubItems(var5.itemID, (CreativeTabs)null, var1.itemList); + } + } + + Enchantment[] var8 = Enchantment.enchantmentsList; + var3 = var8.length; + + for (var4 = 0; var4 < var3; ++var4) + { + Enchantment var11 = var8[var4]; + + if (var11 != null && var11.type != null) + { + Item.enchantedBook.func_92113_a(var11, var1.itemList); + } + } + + Iterator var9 = var1.itemList.iterator(); + String var10 = this.searchField.getText().toLowerCase(); + + while (var9.hasNext()) + { + ItemStack var12 = (ItemStack)var9.next(); + boolean var13 = false; + Iterator var6 = var12.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips).iterator(); + + while (true) + { + if (var6.hasNext()) + { + String var7 = (String)var6.next(); + + if (!var7.toLowerCase().contains(var10)) + { + continue; + } + + var13 = true; + } + + if (!var13) + { + var9.remove(); + } + + break; + } + } + + this.currentScroll = 0.0F; + var1.scrollTo(0.0F); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + CreativeTabs var3 = CreativeTabs.creativeTabArray[selectedTabIndex]; + + if (var3.drawInForegroundOfTab()) + { + this.fontRenderer.drawString(I18n.getString(var3.getTranslatedTabLabel()), 8, 6, 4210752); + } + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + if (par3 == 0) + { + int var4 = par1 - this.guiLeft; + int var5 = par2 - this.guiTop; + CreativeTabs[] var6 = CreativeTabs.creativeTabArray; + int var7 = var6.length; + + for (int var8 = 0; var8 < var7; ++var8) + { + CreativeTabs var9 = var6[var8]; + + if (this.func_74232_a(var9, var4, var5)) + { + return; + } + } + } + + super.mouseClicked(par1, par2, par3); + } + + /** + * Called when the mouse is moved or a mouse button is released. Signature: (mouseX, mouseY, which) which==-1 is + * mouseMove, which==0 or which==1 is mouseUp + */ + protected void mouseMovedOrUp(int par1, int par2, int par3) + { + if (par3 == 0) + { + int var4 = par1 - this.guiLeft; + int var5 = par2 - this.guiTop; + CreativeTabs[] var6 = CreativeTabs.creativeTabArray; + int var7 = var6.length; + + for (int var8 = 0; var8 < var7; ++var8) + { + CreativeTabs var9 = var6[var8]; + + if (this.func_74232_a(var9, var4, var5)) + { + this.setCurrentCreativeTab(var9); + return; + } + } + } + + super.mouseMovedOrUp(par1, par2, par3); + } + + /** + * returns (if you are not on the inventoryTab) and (the flag isn't set) and( you have more than 1 page of items) + */ + private boolean needsScrollBars() + { + return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((ContainerCreative)this.inventorySlots).hasMoreThan1PageOfItemsInList(); + } + + private void setCurrentCreativeTab(CreativeTabs par1CreativeTabs) + { + int var2 = selectedTabIndex; + selectedTabIndex = par1CreativeTabs.getTabIndex(); + ContainerCreative var3 = (ContainerCreative)this.inventorySlots; + this.field_94077_p.clear(); + var3.itemList.clear(); + par1CreativeTabs.displayAllReleventItems(var3.itemList); + + if (par1CreativeTabs == CreativeTabs.tabInventory) + { + Container var4 = this.mc.thePlayer.inventoryContainer; + + if (this.backupContainerSlots == null) + { + this.backupContainerSlots = var3.inventorySlots; + } + + var3.inventorySlots = new ArrayList(); + + for (int var5 = 0; var5 < var4.inventorySlots.size(); ++var5) + { + SlotCreativeInventory var6 = new SlotCreativeInventory(this, (Slot)var4.inventorySlots.get(var5), var5); + var3.inventorySlots.add(var6); + int var7; + int var8; + int var9; + + if (var5 >= 5 && var5 < 9) + { + var7 = var5 - 5; + var8 = var7 / 2; + var9 = var7 % 2; + var6.xDisplayPosition = 9 + var8 * 54; + var6.yDisplayPosition = 6 + var9 * 27; + } + else if (var5 >= 0 && var5 < 5) + { + var6.yDisplayPosition = -2000; + var6.xDisplayPosition = -2000; + } + else if (var5 < var4.inventorySlots.size()) + { + var7 = var5 - 9; + var8 = var7 % 9; + var9 = var7 / 9; + var6.xDisplayPosition = 9 + var8 * 18; + + if (var5 >= 36) + { + var6.yDisplayPosition = 112; + } + else + { + var6.yDisplayPosition = 54 + var9 * 18; + } + } + } + + this.field_74235_v = new Slot(inventory, 0, 173, 112); + var3.inventorySlots.add(this.field_74235_v); + } + else if (var2 == CreativeTabs.tabInventory.getTabIndex()) + { + var3.inventorySlots = this.backupContainerSlots; + this.backupContainerSlots = null; + } + + if (this.searchField != null) + { + if (par1CreativeTabs == CreativeTabs.tabAllSearch) + { + this.searchField.setVisible(true); + this.searchField.setCanLoseFocus(false); + this.searchField.setFocused(true); + this.searchField.setText(""); + this.updateCreativeSearch(); + } + else + { + this.searchField.setVisible(false); + this.searchField.setCanLoseFocus(true); + this.searchField.setFocused(false); + } + } + + this.currentScroll = 0.0F; + var3.scrollTo(0.0F); + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() + { + super.handleMouseInput(); + int var1 = Mouse.getEventDWheel(); + + if (var1 != 0 && this.needsScrollBars()) + { + int var2 = ((ContainerCreative)this.inventorySlots).itemList.size() / 9 - 5 + 1; + + if (var1 > 0) + { + var1 = 1; + } + + if (var1 < 0) + { + var1 = -1; + } + + this.currentScroll = (float)((double)this.currentScroll - (double)var1 / (double)var2); + + if (this.currentScroll < 0.0F) + { + this.currentScroll = 0.0F; + } + + if (this.currentScroll > 1.0F) + { + this.currentScroll = 1.0F; + } + + ((ContainerCreative)this.inventorySlots).scrollTo(this.currentScroll); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + boolean var4 = Mouse.isButtonDown(0); + int var5 = this.guiLeft; + int var6 = this.guiTop; + int var7 = var5 + 175; + int var8 = var6 + 18; + int var9 = var7 + 14; + int var10 = var8 + 112; + + if (!this.wasClicking && var4 && par1 >= var7 && par2 >= var8 && par1 < var9 && par2 < var10) + { + this.isScrolling = this.needsScrollBars(); + } + + if (!var4) + { + this.isScrolling = false; + } + + this.wasClicking = var4; + + if (this.isScrolling) + { + this.currentScroll = ((float)(par2 - var8) - 7.5F) / ((float)(var10 - var8) - 15.0F); + + if (this.currentScroll < 0.0F) + { + this.currentScroll = 0.0F; + } + + if (this.currentScroll > 1.0F) + { + this.currentScroll = 1.0F; + } + + ((ContainerCreative)this.inventorySlots).scrollTo(this.currentScroll); + } + + super.drawScreen(par1, par2, par3); + CreativeTabs[] var11 = CreativeTabs.creativeTabArray; + int var12 = var11.length; + + for (int var13 = 0; var13 < var12; ++var13) + { + CreativeTabs var14 = var11[var13]; + + if (this.renderCreativeInventoryHoveringText(var14, par1, par2)) + { + break; + } + } + + if (this.field_74235_v != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_74235_v.xDisplayPosition, this.field_74235_v.yDisplayPosition, 16, 16, par1, par2)) + { + this.drawCreativeTabHoveringText(I18n.getString("inventory.binSlot"), par1, par2); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + } + + protected void drawItemStackTooltip(ItemStack par1ItemStack, int par2, int par3) + { + if (selectedTabIndex == CreativeTabs.tabAllSearch.getTabIndex()) + { + List var4 = par1ItemStack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips); + CreativeTabs var5 = par1ItemStack.getItem().getCreativeTab(); + + if (var5 == null && par1ItemStack.itemID == Item.enchantedBook.itemID) + { + Map var6 = EnchantmentHelper.getEnchantments(par1ItemStack); + + if (var6.size() == 1) + { + Enchantment var7 = Enchantment.enchantmentsList[((Integer)var6.keySet().iterator().next()).intValue()]; + CreativeTabs[] var8 = CreativeTabs.creativeTabArray; + int var9 = var8.length; + + for (int var10 = 0; var10 < var9; ++var10) + { + CreativeTabs var11 = var8[var10]; + + if (var11.func_111226_a(var7.type)) + { + var5 = var11; + break; + } + } + } + } + + if (var5 != null) + { + var4.add(1, "" + EnumChatFormatting.BOLD + EnumChatFormatting.BLUE + I18n.getString(var5.getTranslatedTabLabel())); + } + + for (int var12 = 0; var12 < var4.size(); ++var12) + { + if (var12 == 0) + { + var4.set(var12, "\u00a7" + Integer.toHexString(par1ItemStack.getRarity().rarityColor) + (String)var4.get(var12)); + } + else + { + var4.set(var12, EnumChatFormatting.GRAY + (String)var4.get(var12)); + } + } + + this.func_102021_a(var4, par2, par3); + } + else + { + super.drawItemStackTooltip(par1ItemStack, par2, par3); + } + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + RenderHelper.enableGUIStandardItemLighting(); + CreativeTabs var4 = CreativeTabs.creativeTabArray[selectedTabIndex]; + CreativeTabs[] var5 = CreativeTabs.creativeTabArray; + int var6 = var5.length; + int var7; + + for (var7 = 0; var7 < var6; ++var7) + { + CreativeTabs var8 = var5[var7]; + this.mc.getTextureManager().bindTexture(field_110424_t); + + if (var8.getTabIndex() != selectedTabIndex) + { + this.renderCreativeTab(var8); + } + } + + this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + var4.getBackgroundImageName())); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); + this.searchField.drawTextBox(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + int var9 = this.guiLeft + 175; + var6 = this.guiTop + 18; + var7 = var6 + 112; + this.mc.getTextureManager().bindTexture(field_110424_t); + + if (var4.shouldHidePlayerInventory()) + { + this.drawTexturedModalRect(var9, var6 + (int)((float)(var7 - var6 - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15); + } + + this.renderCreativeTab(var4); + + if (var4 == CreativeTabs.tabInventory) + { + GuiInventory.func_110423_a(this.guiLeft + 43, this.guiTop + 45, 20, (float)(this.guiLeft + 43 - par2), (float)(this.guiTop + 45 - 30 - par3), this.mc.thePlayer); + } + } + + protected boolean func_74232_a(CreativeTabs par1CreativeTabs, int par2, int par3) + { + int var4 = par1CreativeTabs.getTabColumn(); + int var5 = 28 * var4; + byte var6 = 0; + + if (var4 == 5) + { + var5 = this.xSize - 28 + 2; + } + else if (var4 > 0) + { + var5 += var4; + } + + int var7; + + if (par1CreativeTabs.isTabInFirstRow()) + { + var7 = var6 - 32; + } + else + { + var7 = var6 + this.ySize; + } + + return par2 >= var5 && par2 <= var5 + 28 && par3 >= var7 && par3 <= var7 + 32; + } + + /** + * Renders the creative inventory hovering text if mouse is over it. Returns true if did render or false otherwise. + * Params: current creative tab to be checked, current mouse x position, current mouse y position. + */ + protected boolean renderCreativeInventoryHoveringText(CreativeTabs par1CreativeTabs, int par2, int par3) + { + int var4 = par1CreativeTabs.getTabColumn(); + int var5 = 28 * var4; + byte var6 = 0; + + if (var4 == 5) + { + var5 = this.xSize - 28 + 2; + } + else if (var4 > 0) + { + var5 += var4; + } + + int var7; + + if (par1CreativeTabs.isTabInFirstRow()) + { + var7 = var6 - 32; + } + else + { + var7 = var6 + this.ySize; + } + + if (this.isPointInRegion(var5 + 3, var7 + 3, 23, 27, par2, par3)) + { + this.drawCreativeTabHoveringText(I18n.getString(par1CreativeTabs.getTranslatedTabLabel()), par2, par3); + return true; + } + else + { + return false; + } + } + + /** + * Renders passed creative inventory tab into the screen. + */ + protected void renderCreativeTab(CreativeTabs par1CreativeTabs) + { + boolean var2 = par1CreativeTabs.getTabIndex() == selectedTabIndex; + boolean var3 = par1CreativeTabs.isTabInFirstRow(); + int var4 = par1CreativeTabs.getTabColumn(); + int var5 = var4 * 28; + int var6 = 0; + int var7 = this.guiLeft + 28 * var4; + int var8 = this.guiTop; + byte var9 = 32; + + if (var2) + { + var6 += 32; + } + + if (var4 == 5) + { + var7 = this.guiLeft + this.xSize - 28; + } + else if (var4 > 0) + { + var7 += var4; + } + + if (var3) + { + var8 -= 28; + } + else + { + var6 += 64; + var8 += this.ySize - 4; + } + + GL11.glDisable(GL11.GL_LIGHTING); + this.drawTexturedModalRect(var7, var8, var5, var6, 28, var9); + this.zLevel = 100.0F; + itemRenderer.zLevel = 100.0F; + var7 += 6; + var8 += 8 + (var3 ? 1 : -1); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + ItemStack var10 = new ItemStack(par1CreativeTabs.getTabIconItem()); + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), var10, var7, var8); + itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.getTextureManager(), var10, var7, var8); + GL11.glDisable(GL11.GL_LIGHTING); + itemRenderer.zLevel = 0.0F; + this.zLevel = 0.0F; + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(new GuiAchievements(this.mc.statFileWriter)); + } + + if (par1GuiButton.id == 1) + { + this.mc.displayGuiScreen(new GuiStats(this, this.mc.statFileWriter)); + } + } + + /** + * Returns the current creative tab index. + */ + public int getCurrentTabIndex() + { + return selectedTabIndex; + } + + /** + * Returns the creative inventory + */ + static InventoryBasic getInventory() + { + return inventory; + } +} diff --git a/src/main/java/net/minecraft/src/GuiControls.java b/src/main/java/net/minecraft/src/GuiControls.java new file mode 100644 index 0000000..37aa19e --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiControls.java @@ -0,0 +1,155 @@ +package net.minecraft.src; + +public class GuiControls extends GuiScreen +{ + /** + * A reference to the screen object that created this. Used for navigating between screens. + */ + private GuiScreen parentScreen; + + /** The title string that is displayed in the top-center of the screen. */ + protected String screenTitle = "Controls"; + + /** Reference to the GameSettings object. */ + private GameSettings options; + + /** The ID of the button that has been pressed. */ + private int buttonId = -1; + + public GuiControls(GuiScreen par1GuiScreen, GameSettings par2GameSettings) + { + this.parentScreen = par1GuiScreen; + this.options = par2GameSettings; + } + + /** + * Gets the distance from the left border of the window to left border of the controls screen + */ + private int getLeftBorder() + { + return this.width / 2 - 155; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + int var1 = this.getLeftBorder(); + + for (int var2 = 0; var2 < this.options.keyBindings.length; ++var2) + { + this.buttonList.add(new GuiSmallButton(var2, var1 + var2 % 2 * 160, this.height / 6 + 24 * (var2 >> 1), 70, 20, this.options.getOptionDisplayString(var2))); + } + + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.getString("gui.done"))); + this.screenTitle = I18n.getString("controls.title"); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + for (int var2 = 0; var2 < this.options.keyBindings.length; ++var2) + { + ((GuiButton)this.buttonList.get(var2)).displayString = this.options.getOptionDisplayString(var2); + } + + if (par1GuiButton.id == 200) + { + this.mc.displayGuiScreen(this.parentScreen); + } + else + { + this.buttonId = par1GuiButton.id; + par1GuiButton.displayString = "> " + this.options.getOptionDisplayString(par1GuiButton.id) + " <"; + } + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + if (this.buttonId >= 0) + { + this.options.setKeyBinding(this.buttonId, -100 + par3); + ((GuiButton)this.buttonList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId); + this.buttonId = -1; + KeyBinding.resetKeyBindingArrayAndHash(); + } + else + { + super.mouseClicked(par1, par2, par3); + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (this.buttonId >= 0) + { + this.options.setKeyBinding(this.buttonId, par2); + ((GuiButton)this.buttonList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId); + this.buttonId = -1; + KeyBinding.resetKeyBindingArrayAndHash(); + } + else + { + super.keyTyped(par1, par2); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215); + int var4 = this.getLeftBorder(); + int var5 = 0; + + while (var5 < this.options.keyBindings.length) + { + boolean var6 = false; + int var7 = 0; + + while (true) + { + if (var7 < this.options.keyBindings.length) + { + if (var7 == var5 || this.options.keyBindings[var5].keyCode != this.options.keyBindings[var7].keyCode) + { + ++var7; + continue; + } + + var6 = true; + } + + if (this.buttonId == var5) + { + ((GuiButton)this.buttonList.get(var5)).displayString = "" + EnumChatFormatting.WHITE + "> " + EnumChatFormatting.YELLOW + "??? " + EnumChatFormatting.WHITE + "<"; + } + else if (var6) + { + ((GuiButton)this.buttonList.get(var5)).displayString = EnumChatFormatting.RED + this.options.getOptionDisplayString(var5); + } + else + { + ((GuiButton)this.buttonList.get(var5)).displayString = this.options.getOptionDisplayString(var5); + } + + this.drawString(this.fontRenderer, this.options.getKeyBindingDescription(var5), var4 + var5 % 2 * 160 + 70 + 6, this.height / 6 + 24 * (var5 >> 1) + 7, -1); + ++var5; + break; + } + } + + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiCrafting.java b/src/main/java/net/minecraft/src/GuiCrafting.java new file mode 100644 index 0000000..5538469 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiCrafting.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiCrafting extends GuiContainer +{ + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation("textures/gui/container/crafting_table.png"); + + public GuiCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) + { + super(new ContainerWorkbench(par1InventoryPlayer, par2World, par3, par4, par5)); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + this.fontRenderer.drawString(I18n.getString("container.crafting"), 28, 6, 4210752); + this.fontRenderer.drawString(I18n.getString("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(craftingTableGuiTextures); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/main/java/net/minecraft/src/GuiCreateFlatWorld.java b/src/main/java/net/minecraft/src/GuiCreateFlatWorld.java new file mode 100644 index 0000000..828deb3 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiCreateFlatWorld.java @@ -0,0 +1,120 @@ +package net.minecraft.src; + +public class GuiCreateFlatWorld extends GuiScreen +{ + private static RenderItem theRenderItem = new RenderItem(); + private final GuiCreateWorld createWorldGui; + private FlatGeneratorInfo theFlatGeneratorInfo = FlatGeneratorInfo.getDefaultFlatGenerator(); + private String customizationTitle; + private String layerMaterialLabel; + private String heightLabel; + private GuiCreateFlatWorldListSlot createFlatWorldListSlotGui; + private GuiButton buttonAddLayer; + private GuiButton buttonEditLayer; + private GuiButton buttonRemoveLayer; + + public GuiCreateFlatWorld(GuiCreateWorld par1GuiCreateWorld, String par2Str) + { + this.createWorldGui = par1GuiCreateWorld; + this.setFlatGeneratorInfo(par2Str); + } + + public String getFlatGeneratorInfo() + { + return this.theFlatGeneratorInfo.toString(); + } + + public void setFlatGeneratorInfo(String par1Str) + { + this.theFlatGeneratorInfo = FlatGeneratorInfo.createFlatGeneratorFromString(par1Str); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + this.customizationTitle = I18n.getString("createWorld.customize.flat.title"); + this.layerMaterialLabel = I18n.getString("createWorld.customize.flat.tile"); + this.heightLabel = I18n.getString("createWorld.customize.flat.height"); + this.createFlatWorldListSlotGui = new GuiCreateFlatWorldListSlot(this); + this.buttonList.add(this.buttonAddLayer = new GuiButton(2, this.width / 2 - 154, this.height - 52, 100, 20, I18n.getString("createWorld.customize.flat.addLayer") + " (NYI)")); + this.buttonList.add(this.buttonEditLayer = new GuiButton(3, this.width / 2 - 50, this.height - 52, 100, 20, I18n.getString("createWorld.customize.flat.editLayer") + " (NYI)")); + this.buttonList.add(this.buttonRemoveLayer = new GuiButton(4, this.width / 2 - 155, this.height - 52, 150, 20, I18n.getString("createWorld.customize.flat.removeLayer"))); + this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.getString("gui.done"))); + this.buttonList.add(new GuiButton(5, this.width / 2 + 5, this.height - 52, 150, 20, I18n.getString("createWorld.customize.presets"))); + this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.getString("gui.cancel"))); + this.buttonAddLayer.drawButton = this.buttonEditLayer.drawButton = false; + this.theFlatGeneratorInfo.func_82645_d(); + this.func_82270_g(); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + int var2 = this.theFlatGeneratorInfo.getFlatLayers().size() - this.createFlatWorldListSlotGui.field_82454_a - 1; + + if (par1GuiButton.id == 1) + { + this.mc.displayGuiScreen(this.createWorldGui); + } + else if (par1GuiButton.id == 0) + { + this.createWorldGui.generatorOptionsToUse = this.getFlatGeneratorInfo(); + this.mc.displayGuiScreen(this.createWorldGui); + } + else if (par1GuiButton.id == 5) + { + this.mc.displayGuiScreen(new GuiFlatPresets(this)); + } + else if (par1GuiButton.id == 4 && this.func_82272_i()) + { + this.theFlatGeneratorInfo.getFlatLayers().remove(var2); + this.createFlatWorldListSlotGui.field_82454_a = Math.min(this.createFlatWorldListSlotGui.field_82454_a, this.theFlatGeneratorInfo.getFlatLayers().size() - 1); + } + + this.theFlatGeneratorInfo.func_82645_d(); + this.func_82270_g(); + } + + public void func_82270_g() + { + boolean var1 = this.func_82272_i(); + this.buttonRemoveLayer.enabled = var1; + this.buttonEditLayer.enabled = var1; + this.buttonEditLayer.enabled = false; + this.buttonAddLayer.enabled = false; + } + + private boolean func_82272_i() + { + return this.createFlatWorldListSlotGui.field_82454_a > -1 && this.createFlatWorldListSlotGui.field_82454_a < this.theFlatGeneratorInfo.getFlatLayers().size(); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.createFlatWorldListSlotGui.drawScreen(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, this.customizationTitle, this.width / 2, 8, 16777215); + int var4 = this.width / 2 - 92 - 16; + this.drawString(this.fontRenderer, this.layerMaterialLabel, var4, 32, 16777215); + this.drawString(this.fontRenderer, this.heightLabel, var4 + 2 + 213 - this.fontRenderer.getStringWidth(this.heightLabel), 32, 16777215); + super.drawScreen(par1, par2, par3); + } + + static RenderItem getRenderItem() + { + return theRenderItem; + } + + static FlatGeneratorInfo func_82271_a(GuiCreateFlatWorld par0GuiCreateFlatWorld) + { + return par0GuiCreateFlatWorld.theFlatGeneratorInfo; + } +} diff --git a/src/main/java/net/minecraft/src/GuiCreateFlatWorldListSlot.java b/src/main/java/net/minecraft/src/GuiCreateFlatWorldListSlot.java new file mode 100644 index 0000000..2024be2 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiCreateFlatWorldListSlot.java @@ -0,0 +1,112 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +class GuiCreateFlatWorldListSlot extends GuiSlot +{ + public int field_82454_a; + + final GuiCreateFlatWorld createFlatWorldGui; + + public GuiCreateFlatWorldListSlot(GuiCreateFlatWorld par1GuiCreateFlatWorld) + { + super(par1GuiCreateFlatWorld.mc, par1GuiCreateFlatWorld.width, par1GuiCreateFlatWorld.height, 43, par1GuiCreateFlatWorld.height - 60, 24); + this.createFlatWorldGui = par1GuiCreateFlatWorld; + this.field_82454_a = -1; + } + + private void func_82452_a(int par1, int par2, ItemStack par3ItemStack) + { + this.func_82451_d(par1 + 1, par2 + 1); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + + if (par3ItemStack != null) + { + RenderHelper.enableGUIStandardItemLighting(); + GuiCreateFlatWorld.getRenderItem().renderItemIntoGUI(this.createFlatWorldGui.fontRenderer, this.createFlatWorldGui.mc.getTextureManager(), par3ItemStack, par1 + 2, par2 + 2); + RenderHelper.disableStandardItemLighting(); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } + + private void func_82451_d(int par1, int par2) + { + this.func_82450_b(par1, par2, 0, 0); + } + + private void func_82450_b(int par1, int par2, int par3, int par4) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.createFlatWorldGui.mc.getTextureManager().bindTexture(Gui.statIcons); + float var5 = 0.0078125F; + float var6 = 0.0078125F; + boolean var7 = true; + boolean var8 = true; + Tessellator var9 = Tessellator.instance; + var9.startDrawingQuads(); + var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + 18), (double)this.createFlatWorldGui.zLevel, (double)((float)(par3 + 0) * 0.0078125F), (double)((float)(par4 + 18) * 0.0078125F)); + var9.addVertexWithUV((double)(par1 + 18), (double)(par2 + 18), (double)this.createFlatWorldGui.zLevel, (double)((float)(par3 + 18) * 0.0078125F), (double)((float)(par4 + 18) * 0.0078125F)); + var9.addVertexWithUV((double)(par1 + 18), (double)(par2 + 0), (double)this.createFlatWorldGui.zLevel, (double)((float)(par3 + 18) * 0.0078125F), (double)((float)(par4 + 0) * 0.0078125F)); + var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)this.createFlatWorldGui.zLevel, (double)((float)(par3 + 0) * 0.0078125F), (double)((float)(par4 + 0) * 0.0078125F)); + var9.draw(); + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return GuiCreateFlatWorld.func_82271_a(this.createFlatWorldGui).getFlatLayers().size(); + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) + { + this.field_82454_a = par1; + this.createFlatWorldGui.func_82270_g(); + } + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return par1 == this.field_82454_a; + } + + protected void drawBackground() {} + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + FlatLayerInfo var6 = (FlatLayerInfo)GuiCreateFlatWorld.func_82271_a(this.createFlatWorldGui).getFlatLayers().get(GuiCreateFlatWorld.func_82271_a(this.createFlatWorldGui).getFlatLayers().size() - par1 - 1); + ItemStack var7 = var6.getFillBlock() == 0 ? null : new ItemStack(var6.getFillBlock(), 1, var6.getFillBlockMeta()); + String var8 = var7 == null ? "Air" : Item.itemsList[var6.getFillBlock()].getItemStackDisplayName(var7); + this.func_82452_a(par2, par3, var7); + this.createFlatWorldGui.fontRenderer.drawString(var8, par2 + 18 + 5, par3 + 3, 16777215); + String var9; + + if (par1 == 0) + { + var9 = I18n.getStringParams("createWorld.customize.flat.layer.top", new Object[] {Integer.valueOf(var6.getLayerCount())}); + } + else if (par1 == GuiCreateFlatWorld.func_82271_a(this.createFlatWorldGui).getFlatLayers().size() - 1) + { + var9 = I18n.getStringParams("createWorld.customize.flat.layer.bottom", new Object[] {Integer.valueOf(var6.getLayerCount())}); + } + else + { + var9 = I18n.getStringParams("createWorld.customize.flat.layer", new Object[] {Integer.valueOf(var6.getLayerCount())}); + } + + this.createFlatWorldGui.fontRenderer.drawString(var9, par2 + 2 + 213 - this.createFlatWorldGui.fontRenderer.getStringWidth(var9), par3 + 3, 16777215); + } + + protected int getScrollBarX() + { + return this.createFlatWorldGui.width - 70; + } +} diff --git a/src/main/java/net/minecraft/src/GuiCreateWorld.java b/src/main/java/net/minecraft/src/GuiCreateWorld.java new file mode 100644 index 0000000..04af351 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiCreateWorld.java @@ -0,0 +1,487 @@ +package net.minecraft.src; + +import java.util.Random; +import org.lwjgl.input.Keyboard; + +public class GuiCreateWorld extends GuiScreen +{ + private GuiScreen parentGuiScreen; + private GuiTextField textboxWorldName; + private GuiTextField textboxSeed; + private String folderName; + + /** hardcore', 'creative' or 'survival */ + private String gameMode = "survival"; + private boolean generateStructures = true; + private boolean commandsAllowed; + + /** True iif player has clicked buttonAllowCommands at least once */ + private boolean commandsToggled; + + /** toggles when GUIButton 7 is pressed */ + private boolean bonusItems; + + /** True if and only if gameMode.equals("hardcore") */ + private boolean isHardcore; + private boolean createClicked; + + /** + * True if the extra options (Seed box, structure toggle button, world type button, etc.) are being shown + */ + private boolean moreOptions; + + /** The GUIButton that you click to change game modes. */ + private GuiButton buttonGameMode; + + /** + * The GUIButton that you click to get to options like the seed when creating a world. + */ + private GuiButton moreWorldOptions; + + /** The GuiButton in the 'More World Options' screen. Toggles ON/OFF */ + private GuiButton buttonGenerateStructures; + private GuiButton buttonBonusItems; + + /** The GuiButton in the more world options screen. */ + private GuiButton buttonWorldType; + private GuiButton buttonAllowCommands; + + /** GuiButton in the more world options screen. */ + private GuiButton buttonCustomize; + + /** The first line of text describing the currently selected game mode. */ + private String gameModeDescriptionLine1; + + /** The second line of text describing the currently selected game mode. */ + private String gameModeDescriptionLine2; + + /** The current textboxSeed text */ + private String seed; + + /** E.g. New World, Neue Welt, Nieuwe wereld, Neuvo Mundo */ + private String localizedNewWorldText; + private int worldTypeId; + + /** Generator options to use when creating the world. */ + public String generatorOptionsToUse = ""; + + /** + * If the world name is one of these, it'll be surrounded with underscores. + */ + private static final String[] ILLEGAL_WORLD_NAMES = new String[] {"CON", "COM", "PRN", "AUX", "CLOCK$", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}; + + public GuiCreateWorld(GuiScreen par1GuiScreen) + { + this.parentGuiScreen = par1GuiScreen; + this.seed = ""; + this.localizedNewWorldText = I18n.getString("selectWorld.newWorld"); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.textboxWorldName.updateCursorCounter(); + this.textboxSeed.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.getString("selectWorld.create"))); + this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.getString("gui.cancel"))); + this.buttonList.add(this.buttonGameMode = new GuiButton(2, this.width / 2 - 75, 115, 150, 20, I18n.getString("selectWorld.gameMode"))); + this.buttonList.add(this.moreWorldOptions = new GuiButton(3, this.width / 2 - 75, 187, 150, 20, I18n.getString("selectWorld.moreWorldOptions"))); + this.buttonList.add(this.buttonGenerateStructures = new GuiButton(4, this.width / 2 - 155, 100, 150, 20, I18n.getString("selectWorld.mapFeatures"))); + this.buttonGenerateStructures.drawButton = false; + this.buttonList.add(this.buttonBonusItems = new GuiButton(7, this.width / 2 + 5, 151, 150, 20, I18n.getString("selectWorld.bonusItems"))); + this.buttonBonusItems.drawButton = false; + this.buttonList.add(this.buttonWorldType = new GuiButton(5, this.width / 2 + 5, 100, 150, 20, I18n.getString("selectWorld.mapType"))); + this.buttonWorldType.drawButton = false; + this.buttonList.add(this.buttonAllowCommands = new GuiButton(6, this.width / 2 - 155, 151, 150, 20, I18n.getString("selectWorld.allowCommands"))); + this.buttonAllowCommands.drawButton = false; + this.buttonList.add(this.buttonCustomize = new GuiButton(8, this.width / 2 + 5, 120, 150, 20, I18n.getString("selectWorld.customizeType"))); + this.buttonCustomize.drawButton = false; + this.textboxWorldName = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20); + this.textboxWorldName.setFocused(true); + this.textboxWorldName.setText(this.localizedNewWorldText); + this.textboxSeed = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20); + this.textboxSeed.setText(this.seed); + this.func_82288_a(this.moreOptions); + this.makeUseableName(); + this.updateButtonText(); + } + + /** + * Makes a the name for a world save folder based on your world name, replacing specific characters for _s and + * appending -s to the end until a free name is available. + */ + private void makeUseableName() + { + this.folderName = this.textboxWorldName.getText().trim(); + char[] var1 = ChatAllowedCharacters.allowedCharactersArray; + int var2 = var1.length; + + for (int var3 = 0; var3 < var2; ++var3) + { + char var4 = var1[var3]; + this.folderName = this.folderName.replace(var4, '_'); + } + + if (MathHelper.stringNullOrLengthZero(this.folderName)) + { + this.folderName = "World"; + } + + this.folderName = func_73913_a(this.mc.getSaveLoader(), this.folderName); + } + + private void updateButtonText() + { + this.buttonGameMode.displayString = I18n.getString("selectWorld.gameMode") + " " + I18n.getString("selectWorld.gameMode." + this.gameMode); + this.gameModeDescriptionLine1 = I18n.getString("selectWorld.gameMode." + this.gameMode + ".line1"); + this.gameModeDescriptionLine2 = I18n.getString("selectWorld.gameMode." + this.gameMode + ".line2"); + this.buttonGenerateStructures.displayString = I18n.getString("selectWorld.mapFeatures") + " "; + + if (this.generateStructures) + { + this.buttonGenerateStructures.displayString = this.buttonGenerateStructures.displayString + I18n.getString("options.on"); + } + else + { + this.buttonGenerateStructures.displayString = this.buttonGenerateStructures.displayString + I18n.getString("options.off"); + } + + this.buttonBonusItems.displayString = I18n.getString("selectWorld.bonusItems") + " "; + + if (this.bonusItems && !this.isHardcore) + { + this.buttonBonusItems.displayString = this.buttonBonusItems.displayString + I18n.getString("options.on"); + } + else + { + this.buttonBonusItems.displayString = this.buttonBonusItems.displayString + I18n.getString("options.off"); + } + + this.buttonWorldType.displayString = I18n.getString("selectWorld.mapType") + " " + I18n.getString(WorldType.worldTypes[this.worldTypeId].getTranslateName()); + this.buttonAllowCommands.displayString = I18n.getString("selectWorld.allowCommands") + " "; + + if (this.commandsAllowed && !this.isHardcore) + { + this.buttonAllowCommands.displayString = this.buttonAllowCommands.displayString + I18n.getString("options.on"); + } + else + { + this.buttonAllowCommands.displayString = this.buttonAllowCommands.displayString + I18n.getString("options.off"); + } + } + + public static String func_73913_a(ISaveFormat par0ISaveFormat, String par1Str) + { + par1Str = par1Str.replaceAll("[\\./\"]", "_"); + String[] var2 = ILLEGAL_WORLD_NAMES; + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + String var5 = var2[var4]; + + if (par1Str.equalsIgnoreCase(var5)) + { + par1Str = "_" + par1Str + "_"; + } + } + + while (par0ISaveFormat.getWorldInfo(par1Str) != null) + { + par1Str = par1Str + "-"; + } + + return par1Str; + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 1) + { + this.mc.displayGuiScreen(this.parentGuiScreen); + } + else if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen((GuiScreen)null); + + if (this.createClicked) + { + return; + } + + this.createClicked = true; + long var2 = (new Random()).nextLong(); + String var4 = this.textboxSeed.getText(); + + if (!MathHelper.stringNullOrLengthZero(var4)) + { + try + { + long var5 = Long.parseLong(var4); + + if (var5 != 0L) + { + var2 = var5; + } + } + catch (NumberFormatException var7) + { + var2 = (long)var4.hashCode(); + } + } + + EnumGameType var8 = EnumGameType.getByName(this.gameMode); + WorldSettings var6 = new WorldSettings(var2, var8, this.generateStructures, this.isHardcore, WorldType.worldTypes[this.worldTypeId]); + var6.func_82750_a(this.generatorOptionsToUse); + + if (this.bonusItems && !this.isHardcore) + { + var6.enableBonusChest(); + } + + if (this.commandsAllowed && !this.isHardcore) + { + var6.enableCommands(); + } + + this.mc.launchIntegratedServer(this.folderName, this.textboxWorldName.getText().trim(), var6); + this.mc.statFileWriter.readStat(StatList.createWorldStat, 1); + } + else if (par1GuiButton.id == 3) + { + this.func_82287_i(); + } + else if (par1GuiButton.id == 2) + { + if (this.gameMode.equals("survival")) + { + if (!this.commandsToggled) + { + this.commandsAllowed = false; + } + + this.isHardcore = false; + this.gameMode = "hardcore"; + this.isHardcore = true; + this.buttonAllowCommands.enabled = false; + this.buttonBonusItems.enabled = false; + this.updateButtonText(); + } + else if (this.gameMode.equals("hardcore")) + { + if (!this.commandsToggled) + { + this.commandsAllowed = true; + } + + this.isHardcore = false; + this.gameMode = "creative"; + this.updateButtonText(); + this.isHardcore = false; + this.buttonAllowCommands.enabled = true; + this.buttonBonusItems.enabled = true; + } + else + { + if (!this.commandsToggled) + { + this.commandsAllowed = false; + } + + this.gameMode = "survival"; + this.updateButtonText(); + this.buttonAllowCommands.enabled = true; + this.buttonBonusItems.enabled = true; + this.isHardcore = false; + } + + this.updateButtonText(); + } + else if (par1GuiButton.id == 4) + { + this.generateStructures = !this.generateStructures; + this.updateButtonText(); + } + else if (par1GuiButton.id == 7) + { + this.bonusItems = !this.bonusItems; + this.updateButtonText(); + } + else if (par1GuiButton.id == 5) + { + ++this.worldTypeId; + + if (this.worldTypeId >= WorldType.worldTypes.length) + { + this.worldTypeId = 0; + } + + while (WorldType.worldTypes[this.worldTypeId] == null || !WorldType.worldTypes[this.worldTypeId].getCanBeCreated()) + { + ++this.worldTypeId; + + if (this.worldTypeId >= WorldType.worldTypes.length) + { + this.worldTypeId = 0; + } + } + + this.generatorOptionsToUse = ""; + this.updateButtonText(); + this.func_82288_a(this.moreOptions); + } + else if (par1GuiButton.id == 6) + { + this.commandsToggled = true; + this.commandsAllowed = !this.commandsAllowed; + this.updateButtonText(); + } + else if (par1GuiButton.id == 8) + { + this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.generatorOptionsToUse)); + } + } + } + + private void func_82287_i() + { + this.func_82288_a(!this.moreOptions); + } + + private void func_82288_a(boolean par1) + { + this.moreOptions = par1; + this.buttonGameMode.drawButton = !this.moreOptions; + this.buttonGenerateStructures.drawButton = this.moreOptions; + this.buttonBonusItems.drawButton = this.moreOptions; + this.buttonWorldType.drawButton = this.moreOptions; + this.buttonAllowCommands.drawButton = this.moreOptions; + this.buttonCustomize.drawButton = this.moreOptions && WorldType.worldTypes[this.worldTypeId] == WorldType.FLAT; + + if (this.moreOptions) + { + this.moreWorldOptions.displayString = I18n.getString("gui.done"); + } + else + { + this.moreWorldOptions.displayString = I18n.getString("selectWorld.moreWorldOptions"); + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (this.textboxWorldName.isFocused() && !this.moreOptions) + { + this.textboxWorldName.textboxKeyTyped(par1, par2); + this.localizedNewWorldText = this.textboxWorldName.getText(); + } + else if (this.textboxSeed.isFocused() && this.moreOptions) + { + this.textboxSeed.textboxKeyTyped(par1, par2); + this.seed = this.textboxSeed.getText(); + } + + if (par2 == 28 || par2 == 156) + { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + + ((GuiButton)this.buttonList.get(0)).enabled = this.textboxWorldName.getText().length() > 0; + this.makeUseableName(); + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + + if (this.moreOptions) + { + this.textboxSeed.mouseClicked(par1, par2, par3); + } + else + { + this.textboxWorldName.mouseClicked(par1, par2, par3); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, I18n.getString("selectWorld.create"), this.width / 2, 20, 16777215); + + if (this.moreOptions) + { + this.drawString(this.fontRenderer, I18n.getString("selectWorld.enterSeed"), this.width / 2 - 100, 47, 10526880); + this.drawString(this.fontRenderer, I18n.getString("selectWorld.seedInfo"), this.width / 2 - 100, 85, 10526880); + this.drawString(this.fontRenderer, I18n.getString("selectWorld.mapFeatures.info"), this.width / 2 - 150, 122, 10526880); + this.drawString(this.fontRenderer, I18n.getString("selectWorld.allowCommands.info"), this.width / 2 - 150, 172, 10526880); + this.textboxSeed.drawTextBox(); + } + else + { + this.drawString(this.fontRenderer, I18n.getString("selectWorld.enterName"), this.width / 2 - 100, 47, 10526880); + this.drawString(this.fontRenderer, I18n.getString("selectWorld.resultFolder") + " " + this.folderName, this.width / 2 - 100, 85, 10526880); + this.textboxWorldName.drawTextBox(); + this.drawString(this.fontRenderer, this.gameModeDescriptionLine1, this.width / 2 - 100, 137, 10526880); + this.drawString(this.fontRenderer, this.gameModeDescriptionLine2, this.width / 2 - 100, 149, 10526880); + } + + super.drawScreen(par1, par2, par3); + } + + public void func_82286_a(WorldInfo par1WorldInfo) + { + this.localizedNewWorldText = I18n.getStringParams("selectWorld.newWorld.copyOf", new Object[] {par1WorldInfo.getWorldName()}); + this.seed = par1WorldInfo.getSeed() + ""; + this.worldTypeId = par1WorldInfo.getTerrainType().getWorldTypeID(); + this.generatorOptionsToUse = par1WorldInfo.getGeneratorOptions(); + this.generateStructures = par1WorldInfo.isMapFeaturesEnabled(); + this.commandsAllowed = par1WorldInfo.areCommandsAllowed(); + + if (par1WorldInfo.isHardcoreModeEnabled()) + { + this.gameMode = "hardcore"; + } + else if (par1WorldInfo.getGameType().isSurvivalOrAdventure()) + { + this.gameMode = "survival"; + } + else if (par1WorldInfo.getGameType().isCreative()) + { + this.gameMode = "creative"; + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiDisconnected.java b/src/main/java/net/minecraft/src/GuiDisconnected.java new file mode 100644 index 0000000..5d21542 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiDisconnected.java @@ -0,0 +1,79 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class GuiDisconnected extends GuiScreen +{ + /** The error message. */ + private String errorMessage; + + /** The details about the error. */ + private String errorDetail; + private Object[] field_74247_c; + private List field_74245_d; + private final GuiScreen field_98095_n; + + public GuiDisconnected(GuiScreen par1GuiScreen, String par2Str, String par3Str, Object ... par4ArrayOfObj) + { + this.field_98095_n = par1GuiScreen; + this.errorMessage = I18n.getString(par2Str); + this.errorDetail = par3Str; + this.field_74247_c = par4ArrayOfObj; + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) {} + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.getString("gui.toMenu"))); + + if (this.field_74247_c != null) + { + this.field_74245_d = this.fontRenderer.listFormattedStringToWidth(I18n.getStringParams(this.errorDetail, this.field_74247_c), this.width - 50); + } + else + { + this.field_74245_d = this.fontRenderer.listFormattedStringToWidth(I18n.getString(this.errorDetail), this.width - 50); + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(this.field_98095_n); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.errorMessage, this.width / 2, this.height / 2 - 50, 11184810); + int var4 = this.height / 2 - 30; + + if (this.field_74245_d != null) + { + for (Iterator var5 = this.field_74245_d.iterator(); var5.hasNext(); var4 += this.fontRenderer.FONT_HEIGHT) + { + String var6 = (String)var5.next(); + this.drawCenteredString(this.fontRenderer, var6, this.width / 2, var4, 16777215); + } + } + + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiDispenser.java b/src/main/java/net/minecraft/src/GuiDispenser.java new file mode 100644 index 0000000..efc99c4 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiDispenser.java @@ -0,0 +1,37 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiDispenser extends GuiContainer +{ + private static final ResourceLocation dispenserGuiTextures = new ResourceLocation("textures/gui/container/dispenser.png"); + public TileEntityDispenser theDispenser; + + public GuiDispenser(InventoryPlayer par1InventoryPlayer, TileEntityDispenser par2TileEntityDispenser) + { + super(new ContainerDispenser(par1InventoryPlayer, par2TileEntityDispenser)); + this.theDispenser = par2TileEntityDispenser; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + String var3 = this.theDispenser.isInvNameLocalized() ? this.theDispenser.getInvName() : I18n.getString(this.theDispenser.getInvName()); + this.fontRenderer.drawString(var3, this.xSize / 2 - this.fontRenderer.getStringWidth(var3) / 2, 6, 4210752); + this.fontRenderer.drawString(I18n.getString("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(dispenserGuiTextures); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/main/java/net/minecraft/src/GuiDownloadTerrain.java b/src/main/java/net/minecraft/src/GuiDownloadTerrain.java new file mode 100644 index 0000000..ebe1a43 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiDownloadTerrain.java @@ -0,0 +1,56 @@ +package net.minecraft.src; + +public class GuiDownloadTerrain extends GuiScreen +{ + /** Network object that downloads the terrain data. */ + private NetClientHandler netHandler; + + /** Counts the number of screen updates. */ + private int updateCounter; + + public GuiDownloadTerrain(NetClientHandler par1NetClientHandler) + { + this.netHandler = par1NetClientHandler; + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) {} + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + ++this.updateCounter; + + if (this.updateCounter % 20 == 0) + { + this.netHandler.addToSendQueue(new Packet0KeepAlive()); + } + + if (this.netHandler != null) + { + this.netHandler.processReadPackets(); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawBackground(0); + this.drawCenteredString(this.fontRenderer, I18n.getString("multiplayer.downloadingTerrain"), this.width / 2, this.height / 2 - 50, 16777215); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiEditSign.java b/src/main/java/net/minecraft/src/GuiEditSign.java new file mode 100644 index 0000000..e01d7a0 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiEditSign.java @@ -0,0 +1,168 @@ +package net.minecraft.src; + +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +public class GuiEditSign extends GuiScreen +{ + /** + * This String is just a local copy of the characters allowed in text rendering of minecraft. + */ + private static final String allowedCharacters = ChatAllowedCharacters.allowedCharacters; + + /** The title string that is displayed in the top-center of the screen. */ + protected String screenTitle = "Edit sign message:"; + + /** Reference to the sign object. */ + private TileEntitySign entitySign; + + /** Counts the number of screen updates. */ + private int updateCounter; + + /** The number of the line that is being edited. */ + private int editLine; + + /** "Done" button for the GUI. */ + private GuiButton doneBtn; + + public GuiEditSign(TileEntitySign par1TileEntitySign) + { + this.entitySign = par1TileEntitySign; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + Keyboard.enableRepeatEvents(true); + this.buttonList.add(this.doneBtn = new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120, "Done")); + this.entitySign.setEditable(false); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + NetClientHandler var1 = this.mc.getNetHandler(); + + if (var1 != null) + { + var1.addToSendQueue(new Packet130UpdateSign(this.entitySign.xCoord, this.entitySign.yCoord, this.entitySign.zCoord, this.entitySign.signText)); + } + + this.entitySign.setEditable(true); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + ++this.updateCounter; + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 0) + { + this.entitySign.onInventoryChanged(); + this.mc.displayGuiScreen((GuiScreen)null); + } + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (par2 == 200) + { + this.editLine = this.editLine - 1 & 3; + } + + if (par2 == 208 || par2 == 28 || par2 == 156) + { + this.editLine = this.editLine + 1 & 3; + } + + if (par2 == 14 && this.entitySign.signText[this.editLine].length() > 0) + { + this.entitySign.signText[this.editLine] = this.entitySign.signText[this.editLine].substring(0, this.entitySign.signText[this.editLine].length() - 1); + } + + if (allowedCharacters.indexOf(par1) >= 0 && this.entitySign.signText[this.editLine].length() < 15) + { + this.entitySign.signText[this.editLine] = this.entitySign.signText[this.editLine] + par1; + } + + if (par2 == 1) + { + this.actionPerformed(this.doneBtn); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 40, 16777215); + GL11.glPushMatrix(); + GL11.glTranslatef((float)(this.width / 2), 0.0F, 50.0F); + float var4 = 93.75F; + GL11.glScalef(-var4, -var4, -var4); + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + Block var5 = this.entitySign.getBlockType(); + + if (var5 == Block.signPost) + { + float var6 = (float)(this.entitySign.getBlockMetadata() * 360) / 16.0F; + GL11.glRotatef(var6, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, -1.0625F, 0.0F); + } + else + { + int var8 = this.entitySign.getBlockMetadata(); + float var7 = 0.0F; + + if (var8 == 2) + { + var7 = 180.0F; + } + + if (var8 == 4) + { + var7 = 90.0F; + } + + if (var8 == 5) + { + var7 = -90.0F; + } + + GL11.glRotatef(var7, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, -1.0625F, 0.0F); + } + + if (this.updateCounter / 6 % 2 == 0) + { + this.entitySign.lineBeingEdited = this.editLine; + } + + TileEntityRenderer.instance.renderTileEntityAt(this.entitySign, -0.5D, -0.75D, -0.5D, 0.0F); + this.entitySign.lineBeingEdited = -1; + GL11.glPopMatrix(); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiEnchantment.java b/src/main/java/net/minecraft/src/GuiEnchantment.java new file mode 100644 index 0000000..bab9c26 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiEnchantment.java @@ -0,0 +1,259 @@ +package net.minecraft.src; + +import java.util.Random; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; +import org.lwjgl.util.glu.Project; + +public class GuiEnchantment extends GuiContainer +{ + private static final ResourceLocation enchantingTableGuiTextures = new ResourceLocation("textures/gui/container/enchanting_table.png"); + private static final ResourceLocation enchantingTableBookTextures = new ResourceLocation("textures/entity/enchanting_table_book.png"); + + /** The book model used on the GUI. */ + private static final ModelBook bookModel = new ModelBook(); + private Random rand = new Random(); + + /** ContainerEnchantment object associated with this gui */ + private ContainerEnchantment containerEnchantment; + public int field_74214_o; + public float field_74213_p; + public float field_74212_q; + public float field_74211_r; + public float field_74210_s; + public float field_74209_t; + public float field_74208_u; + ItemStack theItemStack; + private String field_94079_C; + + public GuiEnchantment(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5, String par6Str) + { + super(new ContainerEnchantment(par1InventoryPlayer, par2World, par3, par4, par5)); + this.containerEnchantment = (ContainerEnchantment)this.inventorySlots; + this.field_94079_C = par6Str; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + this.fontRenderer.drawString(this.field_94079_C == null ? I18n.getString("container.enchant") : this.field_94079_C, 12, 5, 4210752); + this.fontRenderer.drawString(I18n.getString("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + this.func_74205_h(); + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + + for (int var6 = 0; var6 < 3; ++var6) + { + int var7 = par1 - (var4 + 60); + int var8 = par2 - (var5 + 14 + 19 * var6); + + if (var7 >= 0 && var8 >= 0 && var7 < 108 && var8 < 19 && this.containerEnchantment.enchantItem(this.mc.thePlayer, var6)) + { + this.mc.playerController.sendEnchantPacket(this.containerEnchantment.windowId, var6); + } + } + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(enchantingTableGuiTextures); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.ySize); + GL11.glPushMatrix(); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glPushMatrix(); + GL11.glLoadIdentity(); + ScaledResolution var6 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + GL11.glViewport((var6.getScaledWidth() - 320) / 2 * var6.getScaleFactor(), (var6.getScaledHeight() - 240) / 2 * var6.getScaleFactor(), 320 * var6.getScaleFactor(), 240 * var6.getScaleFactor()); + GL11.glTranslatef(-0.34F, 0.23F, 0.0F); + Project.gluPerspective(90.0F, 1.3333334F, 9.0F, 80.0F); + float var7 = 1.0F; + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + RenderHelper.enableStandardItemLighting(); + GL11.glTranslatef(0.0F, 3.3F, -16.0F); + GL11.glScalef(var7, var7, var7); + float var8 = 5.0F; + GL11.glScalef(var8, var8, var8); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + this.mc.getTextureManager().bindTexture(enchantingTableBookTextures); + GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); + float var9 = this.field_74208_u + (this.field_74209_t - this.field_74208_u) * par1; + GL11.glTranslatef((1.0F - var9) * 0.2F, (1.0F - var9) * 0.1F, (1.0F - var9) * 0.25F); + GL11.glRotatef(-(1.0F - var9) * 90.0F - 90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); + float var10 = this.field_74212_q + (this.field_74213_p - this.field_74212_q) * par1 + 0.25F; + float var11 = this.field_74212_q + (this.field_74213_p - this.field_74212_q) * par1 + 0.75F; + var10 = (var10 - (float)MathHelper.truncateDoubleToInt((double)var10)) * 1.6F - 0.3F; + var11 = (var11 - (float)MathHelper.truncateDoubleToInt((double)var11)) * 1.6F - 0.3F; + + if (var10 < 0.0F) + { + var10 = 0.0F; + } + + if (var11 < 0.0F) + { + var11 = 0.0F; + } + + if (var10 > 1.0F) + { + var10 = 1.0F; + } + + if (var11 > 1.0F) + { + var11 = 1.0F; + } + + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + bookModel.render((Entity)null, 0.0F, var10, var11, var9, 0.0F, 0.0625F); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + EnchantmentNameParts.instance.setRandSeed(this.containerEnchantment.nameSeed); + + for (int var12 = 0; var12 < 3; ++var12) + { + String var13 = EnchantmentNameParts.instance.generateRandomEnchantName(); + this.zLevel = 0.0F; + this.mc.getTextureManager().bindTexture(enchantingTableGuiTextures); + int var14 = this.containerEnchantment.enchantLevels[var12]; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + if (var14 == 0) + { + this.drawTexturedModalRect(var4 + 60, var5 + 14 + 19 * var12, 0, 185, 108, 19); + } + else + { + String var15 = "" + var14; + FontRenderer var16 = this.mc.standardGalacticFontRenderer; + int var17 = 6839882; + + if (this.mc.thePlayer.experienceLevel < var14 && !this.mc.thePlayer.capabilities.isCreativeMode) + { + this.drawTexturedModalRect(var4 + 60, var5 + 14 + 19 * var12, 0, 185, 108, 19); + var16.drawSplitString(var13, var4 + 62, var5 + 16 + 19 * var12, 104, (var17 & 16711422) >> 1); + var16 = this.mc.fontRenderer; + var17 = 4226832; + var16.drawStringWithShadow(var15, var4 + 62 + 104 - var16.getStringWidth(var15), var5 + 16 + 19 * var12 + 7, var17); + } + else + { + int var18 = par2 - (var4 + 60); + int var19 = par3 - (var5 + 14 + 19 * var12); + + if (var18 >= 0 && var19 >= 0 && var18 < 108 && var19 < 19) + { + this.drawTexturedModalRect(var4 + 60, var5 + 14 + 19 * var12, 0, 204, 108, 19); + var17 = 16777088; + } + else + { + this.drawTexturedModalRect(var4 + 60, var5 + 14 + 19 * var12, 0, 166, 108, 19); + } + + var16.drawSplitString(var13, var4 + 62, var5 + 16 + 19 * var12, 104, var17); + var16 = this.mc.fontRenderer; + var17 = 8453920; + var16.drawStringWithShadow(var15, var4 + 62 + 104 - var16.getStringWidth(var15), var5 + 16 + 19 * var12 + 7, var17); + } + } + } + } + + public void func_74205_h() + { + ItemStack var1 = this.inventorySlots.getSlot(0).getStack(); + + if (!ItemStack.areItemStacksEqual(var1, this.theItemStack)) + { + this.theItemStack = var1; + + do + { + this.field_74211_r += (float)(this.rand.nextInt(4) - this.rand.nextInt(4)); + } + while (this.field_74213_p <= this.field_74211_r + 1.0F && this.field_74213_p >= this.field_74211_r - 1.0F); + } + + ++this.field_74214_o; + this.field_74212_q = this.field_74213_p; + this.field_74208_u = this.field_74209_t; + boolean var2 = false; + + for (int var3 = 0; var3 < 3; ++var3) + { + if (this.containerEnchantment.enchantLevels[var3] != 0) + { + var2 = true; + } + } + + if (var2) + { + this.field_74209_t += 0.2F; + } + else + { + this.field_74209_t -= 0.2F; + } + + if (this.field_74209_t < 0.0F) + { + this.field_74209_t = 0.0F; + } + + if (this.field_74209_t > 1.0F) + { + this.field_74209_t = 1.0F; + } + + float var5 = (this.field_74211_r - this.field_74213_p) * 0.4F; + float var4 = 0.2F; + + if (var5 < -var4) + { + var5 = -var4; + } + + if (var5 > var4) + { + var5 = var4; + } + + this.field_74210_s += (var5 - this.field_74210_s) * 0.9F; + this.field_74213_p += this.field_74210_s; + } +} diff --git a/src/main/java/net/minecraft/src/GuiErrorScreen.java b/src/main/java/net/minecraft/src/GuiErrorScreen.java new file mode 100644 index 0000000..9517ade --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiErrorScreen.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +public class GuiErrorScreen extends GuiScreen +{ + /** + * Unused class. Would contain a message drawn to the center of the screen. + */ + private String message1; + + /** + * Unused class. Would contain a message drawn to the center of the screen. + */ + private String message2; + + public GuiErrorScreen(String par1Str, String par2Str) + { + this.message1 = par1Str; + this.message2 = par2Str; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + super.initGui(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, 140, I18n.getString("gui.cancel"))); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawGradientRect(0, 0, this.width, this.height, -12574688, -11530224); + this.drawCenteredString(this.fontRenderer, this.message1, this.width / 2, 90, 16777215); + this.drawCenteredString(this.fontRenderer, this.message2, this.width / 2, 110, 16777215); + super.drawScreen(par1, par2, par3); + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) {} + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + this.mc.displayGuiScreen((GuiScreen)null); + } +} diff --git a/src/main/java/net/minecraft/src/GuiFlatPresets.java b/src/main/java/net/minecraft/src/GuiFlatPresets.java new file mode 100644 index 0000000..7a2dc7e --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiFlatPresets.java @@ -0,0 +1,201 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import org.lwjgl.input.Keyboard; + +public class GuiFlatPresets extends GuiScreen +{ + /** RenderItem instance used to render preset icons. */ + private static RenderItem presetIconRenderer = new RenderItem(); + + /** List of defined flat world presets. */ + private static final List presets = new ArrayList(); + private final GuiCreateFlatWorld createFlatWorldGui; + private String field_82300_d; + private String field_82308_m; + private String field_82306_n; + private GuiFlatPresetsListSlot theFlatPresetsListSlot; + private GuiButton theButton; + private GuiTextField theTextField; + + public GuiFlatPresets(GuiCreateFlatWorld par1GuiCreateFlatWorld) + { + this.createFlatWorldGui = par1GuiCreateFlatWorld; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + Keyboard.enableRepeatEvents(true); + this.field_82300_d = I18n.getString("createWorld.customize.presets.title"); + this.field_82308_m = I18n.getString("createWorld.customize.presets.share"); + this.field_82306_n = I18n.getString("createWorld.customize.presets.list"); + this.theTextField = new GuiTextField(this.fontRenderer, 50, 40, this.width - 100, 20); + this.theFlatPresetsListSlot = new GuiFlatPresetsListSlot(this); + this.theTextField.setMaxStringLength(1230); + this.theTextField.setText(this.createFlatWorldGui.getFlatGeneratorInfo()); + this.buttonList.add(this.theButton = new GuiButton(0, this.width / 2 - 155, this.height - 28, 150, 20, I18n.getString("createWorld.customize.presets.select"))); + this.buttonList.add(new GuiButton(1, this.width / 2 + 5, this.height - 28, 150, 20, I18n.getString("gui.cancel"))); + this.func_82296_g(); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + this.theTextField.mouseClicked(par1, par2, par3); + super.mouseClicked(par1, par2, par3); + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (!this.theTextField.textboxKeyTyped(par1, par2)) + { + super.keyTyped(par1, par2); + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 0 && this.func_82293_j()) + { + this.createFlatWorldGui.setFlatGeneratorInfo(this.theTextField.getText()); + this.mc.displayGuiScreen(this.createFlatWorldGui); + } + else if (par1GuiButton.id == 1) + { + this.mc.displayGuiScreen(this.createFlatWorldGui); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.theFlatPresetsListSlot.drawScreen(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, this.field_82300_d, this.width / 2, 8, 16777215); + this.drawString(this.fontRenderer, this.field_82308_m, 50, 30, 10526880); + this.drawString(this.fontRenderer, this.field_82306_n, 50, 70, 10526880); + this.theTextField.drawTextBox(); + super.drawScreen(par1, par2, par3); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.theTextField.updateCursorCounter(); + super.updateScreen(); + } + + public void func_82296_g() + { + boolean var1 = this.func_82293_j(); + this.theButton.enabled = var1; + } + + private boolean func_82293_j() + { + return this.theFlatPresetsListSlot.field_82459_a > -1 && this.theFlatPresetsListSlot.field_82459_a < presets.size() || this.theTextField.getText().length() > 1; + } + + /** + * Add a flat world preset with no world features. + */ + private static void addPresetNoFeatures(String par0Str, int par1, BiomeGenBase par2BiomeGenBase, FlatLayerInfo ... par3ArrayOfFlatLayerInfo) + { + addPreset(par0Str, par1, par2BiomeGenBase, (List)null, par3ArrayOfFlatLayerInfo); + } + + /** + * Add a flat world preset. + */ + private static void addPreset(String par0Str, int par1, BiomeGenBase par2BiomeGenBase, List par3List, FlatLayerInfo ... par4ArrayOfFlatLayerInfo) + { + FlatGeneratorInfo var5 = new FlatGeneratorInfo(); + + for (int var6 = par4ArrayOfFlatLayerInfo.length - 1; var6 >= 0; --var6) + { + var5.getFlatLayers().add(par4ArrayOfFlatLayerInfo[var6]); + } + + var5.setBiome(par2BiomeGenBase.biomeID); + var5.func_82645_d(); + + if (par3List != null) + { + Iterator var8 = par3List.iterator(); + + while (var8.hasNext()) + { + String var7 = (String)var8.next(); + var5.getWorldFeatures().put(var7, new HashMap()); + } + } + + presets.add(new GuiFlatPresetsItem(par1, par0Str, var5.toString())); + } + + /** + * Return the RenderItem instance used to render preset icons. + */ + static RenderItem getPresetIconRenderer() + { + return presetIconRenderer; + } + + /** + * Return the list of defined flat world presets. + */ + static List getPresets() + { + return presets; + } + + static GuiFlatPresetsListSlot func_82292_a(GuiFlatPresets par0GuiFlatPresets) + { + return par0GuiFlatPresets.theFlatPresetsListSlot; + } + + static GuiTextField func_82298_b(GuiFlatPresets par0GuiFlatPresets) + { + return par0GuiFlatPresets.theTextField; + } + + static + { + addPreset("Classic Flat", Block.grass.blockID, BiomeGenBase.plains, Arrays.asList(new String[] {"village"}), new FlatLayerInfo[] {new FlatLayerInfo(1, Block.grass.blockID), new FlatLayerInfo(2, Block.dirt.blockID), new FlatLayerInfo(1, Block.bedrock.blockID)}); + addPreset("Tunnelers\' Dream", Block.stone.blockID, BiomeGenBase.extremeHills, Arrays.asList(new String[] {"biome_1", "dungeon", "decoration", "stronghold", "mineshaft"}), new FlatLayerInfo[] {new FlatLayerInfo(1, Block.grass.blockID), new FlatLayerInfo(5, Block.dirt.blockID), new FlatLayerInfo(230, Block.stone.blockID), new FlatLayerInfo(1, Block.bedrock.blockID)}); + addPreset("Water World", Block.waterMoving.blockID, BiomeGenBase.plains, Arrays.asList(new String[] {"village", "biome_1"}), new FlatLayerInfo[] {new FlatLayerInfo(90, Block.waterStill.blockID), new FlatLayerInfo(5, Block.sand.blockID), new FlatLayerInfo(5, Block.dirt.blockID), new FlatLayerInfo(5, Block.stone.blockID), new FlatLayerInfo(1, Block.bedrock.blockID)}); + addPreset("Overworld", Block.tallGrass.blockID, BiomeGenBase.plains, Arrays.asList(new String[] {"village", "biome_1", "decoration", "stronghold", "mineshaft", "dungeon", "lake", "lava_lake"}), new FlatLayerInfo[] {new FlatLayerInfo(1, Block.grass.blockID), new FlatLayerInfo(3, Block.dirt.blockID), new FlatLayerInfo(59, Block.stone.blockID), new FlatLayerInfo(1, Block.bedrock.blockID)}); + addPreset("Snowy Kingdom", Block.snow.blockID, BiomeGenBase.icePlains, Arrays.asList(new String[] {"village", "biome_1"}), new FlatLayerInfo[] {new FlatLayerInfo(1, Block.snow.blockID), new FlatLayerInfo(1, Block.grass.blockID), new FlatLayerInfo(3, Block.dirt.blockID), new FlatLayerInfo(59, Block.stone.blockID), new FlatLayerInfo(1, Block.bedrock.blockID)}); + addPreset("Bottomless Pit", Item.feather.itemID, BiomeGenBase.plains, Arrays.asList(new String[] {"village", "biome_1"}), new FlatLayerInfo[] {new FlatLayerInfo(1, Block.grass.blockID), new FlatLayerInfo(3, Block.dirt.blockID), new FlatLayerInfo(2, Block.cobblestone.blockID)}); + addPreset("Desert", Block.sand.blockID, BiomeGenBase.desert, Arrays.asList(new String[] {"village", "biome_1", "decoration", "stronghold", "mineshaft", "dungeon"}), new FlatLayerInfo[] {new FlatLayerInfo(8, Block.sand.blockID), new FlatLayerInfo(52, Block.sandStone.blockID), new FlatLayerInfo(3, Block.stone.blockID), new FlatLayerInfo(1, Block.bedrock.blockID)}); + addPresetNoFeatures("Redstone Ready", Item.redstone.itemID, BiomeGenBase.desert, new FlatLayerInfo[] {new FlatLayerInfo(52, Block.sandStone.blockID), new FlatLayerInfo(3, Block.stone.blockID), new FlatLayerInfo(1, Block.bedrock.blockID)}); + } +} diff --git a/src/main/java/net/minecraft/src/GuiFlatPresetsItem.java b/src/main/java/net/minecraft/src/GuiFlatPresetsItem.java new file mode 100644 index 0000000..de908a0 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiFlatPresetsItem.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +class GuiFlatPresetsItem +{ + /** ID for the item used as icon for this preset. */ + public int iconId; + + /** Name for this preset. */ + public String presetName; + + /** Data for this preset. */ + public String presetData; + + public GuiFlatPresetsItem(int par1, String par2Str, String par3Str) + { + this.iconId = par1; + this.presetName = par2Str; + this.presetData = par3Str; + } +} diff --git a/src/main/java/net/minecraft/src/GuiFlatPresetsListSlot.java b/src/main/java/net/minecraft/src/GuiFlatPresetsListSlot.java new file mode 100644 index 0000000..68be247 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiFlatPresetsListSlot.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +class GuiFlatPresetsListSlot extends GuiSlot +{ + public int field_82459_a; + + final GuiFlatPresets flatPresetsGui; + + public GuiFlatPresetsListSlot(GuiFlatPresets par1GuiFlatPresets) + { + super(par1GuiFlatPresets.mc, par1GuiFlatPresets.width, par1GuiFlatPresets.height, 80, par1GuiFlatPresets.height - 37, 24); + this.flatPresetsGui = par1GuiFlatPresets; + this.field_82459_a = -1; + } + + private void func_82457_a(int par1, int par2, int par3) + { + this.func_82456_d(par1 + 1, par2 + 1); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + RenderHelper.enableGUIStandardItemLighting(); + GuiFlatPresets.getPresetIconRenderer().renderItemIntoGUI(this.flatPresetsGui.fontRenderer, this.flatPresetsGui.mc.getTextureManager(), new ItemStack(par3, 1, 0), par1 + 2, par2 + 2); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } + + private void func_82456_d(int par1, int par2) + { + this.func_82455_b(par1, par2, 0, 0); + } + + private void func_82455_b(int par1, int par2, int par3, int par4) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.flatPresetsGui.mc.getTextureManager().bindTexture(Gui.statIcons); + float var5 = 0.0078125F; + float var6 = 0.0078125F; + boolean var7 = true; + boolean var8 = true; + Tessellator var9 = Tessellator.instance; + var9.startDrawingQuads(); + var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + 18), (double)this.flatPresetsGui.zLevel, (double)((float)(par3 + 0) * 0.0078125F), (double)((float)(par4 + 18) * 0.0078125F)); + var9.addVertexWithUV((double)(par1 + 18), (double)(par2 + 18), (double)this.flatPresetsGui.zLevel, (double)((float)(par3 + 18) * 0.0078125F), (double)((float)(par4 + 18) * 0.0078125F)); + var9.addVertexWithUV((double)(par1 + 18), (double)(par2 + 0), (double)this.flatPresetsGui.zLevel, (double)((float)(par3 + 18) * 0.0078125F), (double)((float)(par4 + 0) * 0.0078125F)); + var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)this.flatPresetsGui.zLevel, (double)((float)(par3 + 0) * 0.0078125F), (double)((float)(par4 + 0) * 0.0078125F)); + var9.draw(); + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return GuiFlatPresets.getPresets().size(); + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) + { + this.field_82459_a = par1; + this.flatPresetsGui.func_82296_g(); + GuiFlatPresets.func_82298_b(this.flatPresetsGui).setText(((GuiFlatPresetsItem)GuiFlatPresets.getPresets().get(GuiFlatPresets.func_82292_a(this.flatPresetsGui).field_82459_a)).presetData); + } + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return par1 == this.field_82459_a; + } + + protected void drawBackground() {} + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + GuiFlatPresetsItem var6 = (GuiFlatPresetsItem)GuiFlatPresets.getPresets().get(par1); + this.func_82457_a(par2, par3, var6.iconId); + this.flatPresetsGui.fontRenderer.drawString(var6.presetName, par2 + 18 + 5, par3 + 6, 16777215); + } +} diff --git a/src/main/java/net/minecraft/src/GuiFurnace.java b/src/main/java/net/minecraft/src/GuiFurnace.java new file mode 100644 index 0000000..c6817ab --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiFurnace.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiFurnace extends GuiContainer +{ + private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("textures/gui/container/furnace.png"); + private TileEntityFurnace furnaceInventory; + + public GuiFurnace(InventoryPlayer par1InventoryPlayer, TileEntityFurnace par2TileEntityFurnace) + { + super(new ContainerFurnace(par1InventoryPlayer, par2TileEntityFurnace)); + this.furnaceInventory = par2TileEntityFurnace; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + String var3 = this.furnaceInventory.isInvNameLocalized() ? this.furnaceInventory.getInvName() : I18n.getString(this.furnaceInventory.getInvName()); + this.fontRenderer.drawString(var3, this.xSize / 2 - this.fontRenderer.getStringWidth(var3) / 2, 6, 4210752); + this.fontRenderer.drawString(I18n.getString("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(furnaceGuiTextures); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.ySize); + int var6; + + if (this.furnaceInventory.isBurning()) + { + var6 = this.furnaceInventory.getBurnTimeRemainingScaled(12); + this.drawTexturedModalRect(var4 + 56, var5 + 36 + 12 - var6, 176, 12 - var6, 14, var6 + 2); + } + + var6 = this.furnaceInventory.getCookProgressScaled(24); + this.drawTexturedModalRect(var4 + 79, var5 + 34, 176, 14, var6 + 1, 16); + } +} diff --git a/src/main/java/net/minecraft/src/GuiGameOver.java b/src/main/java/net/minecraft/src/GuiGameOver.java new file mode 100644 index 0000000..befda65 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiGameOver.java @@ -0,0 +1,121 @@ +package net.minecraft.src; + +import java.util.Iterator; +import org.lwjgl.opengl.GL11; + +public class GuiGameOver extends GuiScreen +{ + /** + * The cooldown timer for the buttons, increases every tick and enables all buttons when reaching 20. + */ + private int cooldownTimer; + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + + if (this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) + { + if (this.mc.isIntegratedServerRunning()) + { + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 96, I18n.getString("deathScreen.deleteWorld"))); + } + else + { + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 96, I18n.getString("deathScreen.leaveServer"))); + } + } + else + { + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 72, I18n.getString("deathScreen.respawn"))); + this.buttonList.add(new GuiButton(2, this.width / 2 - 100, this.height / 4 + 96, I18n.getString("deathScreen.titleScreen"))); + + if (this.mc.getSession() == null) + { + ((GuiButton)this.buttonList.get(1)).enabled = false; + } + } + + GuiButton var2; + + for (Iterator var1 = this.buttonList.iterator(); var1.hasNext(); var2.enabled = false) + { + var2 = (GuiButton)var1.next(); + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) {} + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + switch (par1GuiButton.id) + { + case 1: + this.mc.thePlayer.respawnPlayer(); + this.mc.displayGuiScreen((GuiScreen)null); + break; + + case 2: + this.mc.theWorld.sendQuittingDisconnectingPacket(); + this.mc.loadWorld((WorldClient)null); + this.mc.displayGuiScreen(new GuiMainMenu()); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawGradientRect(0, 0, this.width, this.height, 1615855616, -1602211792); + GL11.glPushMatrix(); + GL11.glScalef(2.0F, 2.0F, 2.0F); + boolean var4 = this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled(); + String var5 = var4 ? I18n.getString("deathScreen.title.hardcore") : I18n.getString("deathScreen.title"); + this.drawCenteredString(this.fontRenderer, var5, this.width / 2 / 2, 30, 16777215); + GL11.glPopMatrix(); + + if (var4) + { + this.drawCenteredString(this.fontRenderer, I18n.getString("deathScreen.hardcoreInfo"), this.width / 2, 144, 16777215); + } + + this.drawCenteredString(this.fontRenderer, I18n.getString("deathScreen.score") + ": " + EnumChatFormatting.YELLOW + this.mc.thePlayer.getScore(), this.width / 2, 100, 16777215); + super.drawScreen(par1, par2, par3); + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return false; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + ++this.cooldownTimer; + GuiButton var2; + + if (this.cooldownTimer == 20) + { + for (Iterator var1 = this.buttonList.iterator(); var1.hasNext(); var2.enabled = true) + { + var2 = (GuiButton)var1.next(); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiHopper.java b/src/main/java/net/minecraft/src/GuiHopper.java new file mode 100644 index 0000000..173900f --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiHopper.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiHopper extends GuiContainer +{ + private static final ResourceLocation hopperGuiTextures = new ResourceLocation("textures/gui/container/hopper.png"); + private IInventory field_94081_r; + private IInventory field_94080_s; + + public GuiHopper(InventoryPlayer par1InventoryPlayer, IInventory par2IInventory) + { + super(new ContainerHopper(par1InventoryPlayer, par2IInventory)); + this.field_94081_r = par1InventoryPlayer; + this.field_94080_s = par2IInventory; + this.allowUserInput = false; + this.ySize = 133; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + this.fontRenderer.drawString(this.field_94080_s.isInvNameLocalized() ? this.field_94080_s.getInvName() : I18n.getString(this.field_94080_s.getInvName()), 8, 6, 4210752); + this.fontRenderer.drawString(this.field_94081_r.isInvNameLocalized() ? this.field_94081_r.getInvName() : I18n.getString(this.field_94081_r.getInvName()), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(hopperGuiTextures); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.ySize); + } +} diff --git a/src/main/java/net/minecraft/src/GuiIngame.java b/src/main/java/net/minecraft/src/GuiIngame.java new file mode 100644 index 0000000..a1ead66 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiIngame.java @@ -0,0 +1,995 @@ +package net.minecraft.src; + +import java.awt.Color; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiIngame extends Gui +{ + private static final ResourceLocation vignetteTexPath = new ResourceLocation("textures/misc/vignette.png"); + private static final ResourceLocation widgetsTexPath = new ResourceLocation("textures/gui/widgets.png"); + private static final ResourceLocation pumpkinBlurTexPath = new ResourceLocation("textures/misc/pumpkinblur.png"); + private static final RenderItem itemRenderer = new RenderItem(); + private final Random rand = new Random(); + private final Minecraft mc; + + /** ChatGUI instance that retains all previous chat data */ + private final GuiNewChat persistantChatGUI; + private int updateCounter; + + /** The string specifying which record music is playing */ + private String recordPlaying = ""; + + /** How many ticks the record playing message will be displayed */ + private int recordPlayingUpFor; + private boolean recordIsPlaying; + + /** Previous frame vignette brightness (slowly changes by 1% each frame) */ + public float prevVignetteBrightness = 1.0F; + + /** Remaining ticks the item highlight should be visible */ + private int remainingHighlightTicks; + + /** The ItemStack that is currently being highlighted */ + private ItemStack highlightingItemStack; + + public GuiIngame(Minecraft par1Minecraft) + { + this.mc = par1Minecraft; + this.persistantChatGUI = new GuiNewChat(par1Minecraft); + } + + /** + * Render the ingame overlay with quick icon bar, ... + */ + public void renderGameOverlay(float par1, boolean par2, int par3, int par4) + { + ScaledResolution var5 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + int var6 = var5.getScaledWidth(); + int var7 = var5.getScaledHeight(); + FontRenderer var8 = this.mc.fontRenderer; + this.mc.entityRenderer.setupOverlayRendering(); + GL11.glEnable(GL11.GL_BLEND); + + if (Minecraft.isFancyGraphicsEnabled()) + { + this.renderVignette(this.mc.thePlayer.getBrightness(par1), var6, var7); + } + else + { + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + } + + ItemStack var9 = this.mc.thePlayer.inventory.armorItemInSlot(3); + + if (this.mc.gameSettings.thirdPersonView == 0 && var9 != null && var9.itemID == Block.pumpkin.blockID) + { + this.renderPumpkinBlur(var6, var7); + } + + if (!this.mc.thePlayer.isPotionActive(Potion.confusion)) + { + float var10 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * par1; + + if (var10 > 0.0F) + { + this.func_130015_b(var10, var6, var7); + } + } + + int var11; + int var12; + int var13; + + if (!this.mc.playerController.enableEverythingIsScrewedUpMode()) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(widgetsTexPath); + InventoryPlayer var31 = this.mc.thePlayer.inventory; + this.zLevel = -90.0F; + this.drawTexturedModalRect(var6 / 2 - 91, var7 - 22, 0, 0, 182, 22); + this.drawTexturedModalRect(var6 / 2 - 91 - 1 + var31.currentItem * 20, var7 - 22 - 1, 0, 22, 24, 22); + this.mc.getTextureManager().bindTexture(icons); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR); + this.drawTexturedModalRect(var6 / 2 - 7, var7 / 2 - 7, 0, 0, 16, 16); + GL11.glDisable(GL11.GL_BLEND); + this.mc.mcProfiler.startSection("bossHealth"); + this.renderBossHealth(); + this.mc.mcProfiler.endSection(); + + if (this.mc.playerController.shouldDrawHUD()) + { + this.func_110327_a(var6, var7); + } + + GL11.glDisable(GL11.GL_BLEND); + this.mc.mcProfiler.startSection("actionBar"); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + RenderHelper.enableGUIStandardItemLighting(); + + for (var11 = 0; var11 < 9; ++var11) + { + var12 = var6 / 2 - 90 + var11 * 20 + 2; + var13 = var7 - 16 - 3; + this.renderInventorySlot(var11, var12, var13, par1); + } + + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + this.mc.mcProfiler.endSection(); + } + + int var32; + + if (this.mc.thePlayer.getSleepTimer() > 0) + { + this.mc.mcProfiler.startSection("sleep"); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDisable(GL11.GL_ALPHA_TEST); + var32 = this.mc.thePlayer.getSleepTimer(); + float var33 = (float)var32 / 100.0F; + + if (var33 > 1.0F) + { + var33 = 1.0F - (float)(var32 - 100) / 10.0F; + } + + var12 = (int)(220.0F * var33) << 24 | 1052704; + drawRect(0, 0, var6, var7, var12); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_DEPTH_TEST); + this.mc.mcProfiler.endSection(); + } + + var32 = 16777215; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + var11 = var6 / 2 - 91; + int var14; + int var15; + int var16; + int var17; + float var34; + short var35; + + if (this.mc.thePlayer.isRidingHorse()) + { + this.mc.mcProfiler.startSection("jumpBar"); + this.mc.getTextureManager().bindTexture(Gui.icons); + var34 = this.mc.thePlayer.getHorseJumpPower(); + var35 = 182; + var14 = (int)(var34 * (float)(var35 + 1)); + var15 = var7 - 32 + 3; + this.drawTexturedModalRect(var11, var15, 0, 84, var35, 5); + + if (var14 > 0) + { + this.drawTexturedModalRect(var11, var15, 0, 89, var14, 5); + } + + this.mc.mcProfiler.endSection(); + } + else if (this.mc.playerController.func_78763_f()) + { + this.mc.mcProfiler.startSection("expBar"); + this.mc.getTextureManager().bindTexture(Gui.icons); + var12 = this.mc.thePlayer.xpBarCap(); + + if (var12 > 0) + { + var35 = 182; + var14 = (int)(this.mc.thePlayer.experience * (float)(var35 + 1)); + var15 = var7 - 32 + 3; + this.drawTexturedModalRect(var11, var15, 0, 64, var35, 5); + + if (var14 > 0) + { + this.drawTexturedModalRect(var11, var15, 0, 69, var14, 5); + } + } + + this.mc.mcProfiler.endSection(); + + if (this.mc.thePlayer.experienceLevel > 0) + { + this.mc.mcProfiler.startSection("expLevel"); + boolean var37 = false; + var14 = var37 ? 16777215 : 8453920; + String var39 = "" + this.mc.thePlayer.experienceLevel; + var16 = (var6 - var8.getStringWidth(var39)) / 2; + var17 = var7 - 31 - 4; + boolean var18 = false; + var8.drawString(var39, var16 + 1, var17, 0); + var8.drawString(var39, var16 - 1, var17, 0); + var8.drawString(var39, var16, var17 + 1, 0); + var8.drawString(var39, var16, var17 - 1, 0); + var8.drawString(var39, var16, var17, var14); + this.mc.mcProfiler.endSection(); + } + } + + String var36; + + if (this.mc.gameSettings.heldItemTooltips) + { + this.mc.mcProfiler.startSection("toolHighlight"); + + if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null) + { + var36 = this.highlightingItemStack.getDisplayName(); + var13 = (var6 - var8.getStringWidth(var36)) / 2; + var14 = var7 - 59; + + if (!this.mc.playerController.shouldDrawHUD()) + { + var14 += 14; + } + + var15 = (int)((float)this.remainingHighlightTicks * 256.0F / 10.0F); + + if (var15 > 255) + { + var15 = 255; + } + + if (var15 > 0) + { + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + var8.drawStringWithShadow(var36, var13, var14, 16777215 + (var15 << 24)); + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + } + } + + this.mc.mcProfiler.endSection(); + } + + if (this.mc.isDemo()) + { + this.mc.mcProfiler.startSection("demo"); + var36 = ""; + + if (this.mc.theWorld.getTotalWorldTime() >= 120500L) + { + var36 = I18n.getString("demo.demoExpired"); + } + else + { + var36 = I18n.getStringParams("demo.remainingTime", new Object[] {StringUtils.ticksToElapsedTime((int)(120500L - this.mc.theWorld.getTotalWorldTime()))}); + } + + var13 = var8.getStringWidth(var36); + var8.drawStringWithShadow(var36, var6 - var13 - 10, 5, 16777215); + this.mc.mcProfiler.endSection(); + } + + int var21; + int var22; + int var23; + + if (this.mc.gameSettings.showDebugInfo) + { + this.mc.mcProfiler.startSection("debug"); + GL11.glPushMatrix(); + var8.drawStringWithShadow("Minecraft 1.6.4 (" + this.mc.debug + ")", 2, 2, 16777215); + var8.drawStringWithShadow(this.mc.debugInfoRenders(), 2, 12, 16777215); + var8.drawStringWithShadow(this.mc.getEntityDebug(), 2, 22, 16777215); + var8.drawStringWithShadow(this.mc.debugInfoEntities(), 2, 32, 16777215); + var8.drawStringWithShadow(this.mc.getWorldProviderName(), 2, 42, 16777215); + long var38 = Runtime.getRuntime().maxMemory(); + long var41 = Runtime.getRuntime().totalMemory(); + long var43 = Runtime.getRuntime().freeMemory(); + long var45 = var41 - var43; + String var20 = "Used memory: " + var45 * 100L / var38 + "% (" + var45 / 1024L / 1024L + "MB) of " + var38 / 1024L / 1024L + "MB"; + var21 = 14737632; + this.drawString(var8, var20, var6 - var8.getStringWidth(var20) - 2, 2, 14737632); + var20 = "Allocated memory: " + var41 * 100L / var38 + "% (" + var41 / 1024L / 1024L + "MB)"; + this.drawString(var8, var20, var6 - var8.getStringWidth(var20) - 2, 12, 14737632); + var22 = MathHelper.floor_double(this.mc.thePlayer.posX); + var23 = MathHelper.floor_double(this.mc.thePlayer.posY); + int var24 = MathHelper.floor_double(this.mc.thePlayer.posZ); + this.drawString(var8, String.format("x: %.5f (%d) // c: %d (%d)", new Object[] {Double.valueOf(this.mc.thePlayer.posX), Integer.valueOf(var22), Integer.valueOf(var22 >> 4), Integer.valueOf(var22 & 15)}), 2, 64, 14737632); + this.drawString(var8, String.format("y: %.3f (feet pos, %.3f eyes pos)", new Object[] {Double.valueOf(this.mc.thePlayer.boundingBox.minY), Double.valueOf(this.mc.thePlayer.posY)}), 2, 72, 14737632); + this.drawString(var8, String.format("z: %.5f (%d) // c: %d (%d)", new Object[] {Double.valueOf(this.mc.thePlayer.posZ), Integer.valueOf(var24), Integer.valueOf(var24 >> 4), Integer.valueOf(var24 & 15)}), 2, 80, 14737632); + int var25 = MathHelper.floor_double((double)(this.mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + this.drawString(var8, "f: " + var25 + " (" + Direction.directions[var25] + ") / " + MathHelper.wrapAngleTo180_float(this.mc.thePlayer.rotationYaw), 2, 88, 14737632); + + if (this.mc.theWorld != null && this.mc.theWorld.blockExists(var22, var23, var24)) + { + Chunk var26 = this.mc.theWorld.getChunkFromBlockCoords(var22, var24); + this.drawString(var8, "lc: " + (var26.getTopFilledSegment() + 15) + " b: " + var26.getBiomeGenForWorldCoords(var22 & 15, var24 & 15, this.mc.theWorld.getWorldChunkManager()).biomeName + " bl: " + var26.getSavedLightValue(EnumSkyBlock.Block, var22 & 15, var23, var24 & 15) + " sl: " + var26.getSavedLightValue(EnumSkyBlock.Sky, var22 & 15, var23, var24 & 15) + " rl: " + var26.getBlockLightValue(var22 & 15, var23, var24 & 15, 0), 2, 96, 14737632); + } + + this.drawString(var8, String.format("ws: %.3f, fs: %.3f, g: %b, fl: %d", new Object[] {Float.valueOf(this.mc.thePlayer.capabilities.getWalkSpeed()), Float.valueOf(this.mc.thePlayer.capabilities.getFlySpeed()), Boolean.valueOf(this.mc.thePlayer.onGround), Integer.valueOf(this.mc.theWorld.getHeightValue(var22, var24))}), 2, 104, 14737632); + GL11.glPopMatrix(); + this.mc.mcProfiler.endSection(); + } + + if (this.recordPlayingUpFor > 0) + { + this.mc.mcProfiler.startSection("overlayMessage"); + var34 = (float)this.recordPlayingUpFor - par1; + var13 = (int)(var34 * 255.0F / 20.0F); + + if (var13 > 255) + { + var13 = 255; + } + + if (var13 > 8) + { + GL11.glPushMatrix(); + GL11.glTranslatef((float)(var6 / 2), (float)(var7 - 68), 0.0F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + var14 = 16777215; + + if (this.recordIsPlaying) + { + var14 = Color.HSBtoRGB(var34 / 50.0F, 0.7F, 0.6F) & 16777215; + } + + var8.drawString(this.recordPlaying, -var8.getStringWidth(this.recordPlaying) / 2, -4, var14 + (var13 << 24 & -16777216)); + GL11.glDisable(GL11.GL_BLEND); + GL11.glPopMatrix(); + } + + this.mc.mcProfiler.endSection(); + } + + ScoreObjective var40 = this.mc.theWorld.getScoreboard().func_96539_a(1); + + if (var40 != null) + { + this.func_96136_a(var40, var7, var6, var8); + } + + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, (float)(var7 - 48), 0.0F); + this.mc.mcProfiler.startSection("chat"); + this.persistantChatGUI.drawChat(this.updateCounter); + this.mc.mcProfiler.endSection(); + GL11.glPopMatrix(); + var40 = this.mc.theWorld.getScoreboard().func_96539_a(0); + + if (this.mc.gameSettings.keyBindPlayerList.pressed && (!this.mc.isIntegratedServerRunning() || this.mc.thePlayer.sendQueue.playerInfoList.size() > 1 || var40 != null)) + { + this.mc.mcProfiler.startSection("playerList"); + NetClientHandler var42 = this.mc.thePlayer.sendQueue; + List var44 = var42.playerInfoList; + var15 = var42.currentServerMaxPlayers; + var16 = var15; + + for (var17 = 1; var16 > 20; var16 = (var15 + var17 - 1) / var17) + { + ++var17; + } + + int var46 = 300 / var17; + + if (var46 > 150) + { + var46 = 150; + } + + int var19 = (var6 - var17 * var46) / 2; + byte var47 = 10; + drawRect(var19 - 1, var47 - 1, var19 + var46 * var17, var47 + 9 * var16, Integer.MIN_VALUE); + + for (var21 = 0; var21 < var15; ++var21) + { + var22 = var19 + var21 % var17 * var46; + var23 = var47 + var21 / var17 * 9; + drawRect(var22, var23, var22 + var46 - 1, var23 + 8, 553648127); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(GL11.GL_ALPHA_TEST); + + if (var21 < var44.size()) + { + GuiPlayerInfo var48 = (GuiPlayerInfo)var44.get(var21); + ScorePlayerTeam var49 = this.mc.theWorld.getScoreboard().getPlayersTeam(var48.name); + String var50 = ScorePlayerTeam.formatPlayerName(var49, var48.name); + var8.drawStringWithShadow(var50, var22, var23, 16777215); + + if (var40 != null) + { + int var27 = var22 + var8.getStringWidth(var50) + 5; + int var28 = var22 + var46 - 12 - 5; + + if (var28 - var27 > 5) + { + Score var29 = var40.getScoreboard().func_96529_a(var48.name, var40); + String var30 = EnumChatFormatting.YELLOW + "" + var29.getScorePoints(); + var8.drawStringWithShadow(var30, var28 - var8.getStringWidth(var30), var23, 16777215); + } + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(icons); + byte var51 = 0; + boolean var52 = false; + byte var53; + + if (var48.responseTime < 0) + { + var53 = 5; + } + else if (var48.responseTime < 150) + { + var53 = 0; + } + else if (var48.responseTime < 300) + { + var53 = 1; + } + else if (var48.responseTime < 600) + { + var53 = 2; + } + else if (var48.responseTime < 1000) + { + var53 = 3; + } + else + { + var53 = 4; + } + + this.zLevel += 100.0F; + this.drawTexturedModalRect(var22 + var46 - 12, var23, 0 + var51 * 10, 176 + var53 * 8, 10, 8); + this.zLevel -= 100.0F; + } + } + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_ALPHA_TEST); + } + + private void func_96136_a(ScoreObjective par1ScoreObjective, int par2, int par3, FontRenderer par4FontRenderer) + { + Scoreboard var5 = par1ScoreObjective.getScoreboard(); + Collection var6 = var5.func_96534_i(par1ScoreObjective); + + if (var6.size() <= 15) + { + int var7 = par4FontRenderer.getStringWidth(par1ScoreObjective.getDisplayName()); + String var11; + + for (Iterator var8 = var6.iterator(); var8.hasNext(); var7 = Math.max(var7, par4FontRenderer.getStringWidth(var11))) + { + Score var9 = (Score)var8.next(); + ScorePlayerTeam var10 = var5.getPlayersTeam(var9.getPlayerName()); + var11 = ScorePlayerTeam.formatPlayerName(var10, var9.getPlayerName()) + ": " + EnumChatFormatting.RED + var9.getScorePoints(); + } + + int var22 = var6.size() * par4FontRenderer.FONT_HEIGHT; + int var23 = par2 / 2 + var22 / 3; + byte var24 = 3; + int var25 = par3 - var7 - var24; + int var12 = 0; + Iterator var13 = var6.iterator(); + + while (var13.hasNext()) + { + Score var14 = (Score)var13.next(); + ++var12; + ScorePlayerTeam var15 = var5.getPlayersTeam(var14.getPlayerName()); + String var16 = ScorePlayerTeam.formatPlayerName(var15, var14.getPlayerName()); + String var17 = EnumChatFormatting.RED + "" + var14.getScorePoints(); + int var19 = var23 - var12 * par4FontRenderer.FONT_HEIGHT; + int var20 = par3 - var24 + 2; + drawRect(var25 - 2, var19, var20, var19 + par4FontRenderer.FONT_HEIGHT, 1342177280); + par4FontRenderer.drawString(var16, var25, var19, 553648127); + par4FontRenderer.drawString(var17, var20 - par4FontRenderer.getStringWidth(var17), var19, 553648127); + + if (var12 == var6.size()) + { + String var21 = par1ScoreObjective.getDisplayName(); + drawRect(var25 - 2, var19 - par4FontRenderer.FONT_HEIGHT - 1, var20, var19 - 1, 1610612736); + drawRect(var25 - 2, var19 - 1, var20, var19, 1342177280); + par4FontRenderer.drawString(var21, var25 + var7 / 2 - par4FontRenderer.getStringWidth(var21) / 2, var19 - par4FontRenderer.FONT_HEIGHT, 553648127); + } + } + } + } + + private void func_110327_a(int par1, int par2) + { + boolean var3 = this.mc.thePlayer.hurtResistantTime / 3 % 2 == 1; + + if (this.mc.thePlayer.hurtResistantTime < 10) + { + var3 = false; + } + + int var4 = MathHelper.ceiling_float_int(this.mc.thePlayer.getHealth()); + int var5 = MathHelper.ceiling_float_int(this.mc.thePlayer.prevHealth); + this.rand.setSeed((long)(this.updateCounter * 312871)); + boolean var6 = false; + FoodStats var7 = this.mc.thePlayer.getFoodStats(); + int var8 = var7.getFoodLevel(); + int var9 = var7.getPrevFoodLevel(); + AttributeInstance var10 = this.mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth); + int var11 = par1 / 2 - 91; + int var12 = par1 / 2 + 91; + int var13 = par2 - 39; + float var14 = (float)var10.getAttributeValue(); + float var15 = this.mc.thePlayer.getAbsorptionAmount(); + int var16 = MathHelper.ceiling_float_int((var14 + var15) / 2.0F / 10.0F); + int var17 = Math.max(10 - (var16 - 2), 3); + int var18 = var13 - (var16 - 1) * var17 - 10; + float var19 = var15; + int var20 = this.mc.thePlayer.getTotalArmorValue(); + int var21 = -1; + + if (this.mc.thePlayer.isPotionActive(Potion.regeneration)) + { + var21 = this.updateCounter % MathHelper.ceiling_float_int(var14 + 5.0F); + } + + this.mc.mcProfiler.startSection("armor"); + int var22; + int var23; + + for (var22 = 0; var22 < 10; ++var22) + { + if (var20 > 0) + { + var23 = var11 + var22 * 8; + + if (var22 * 2 + 1 < var20) + { + this.drawTexturedModalRect(var23, var18, 34, 9, 9, 9); + } + + if (var22 * 2 + 1 == var20) + { + this.drawTexturedModalRect(var23, var18, 25, 9, 9, 9); + } + + if (var22 * 2 + 1 > var20) + { + this.drawTexturedModalRect(var23, var18, 16, 9, 9, 9); + } + } + } + + this.mc.mcProfiler.endStartSection("health"); + int var25; + int var26; + int var27; + + for (var22 = MathHelper.ceiling_float_int((var14 + var15) / 2.0F) - 1; var22 >= 0; --var22) + { + var23 = 16; + + if (this.mc.thePlayer.isPotionActive(Potion.poison)) + { + var23 += 36; + } + else if (this.mc.thePlayer.isPotionActive(Potion.wither)) + { + var23 += 72; + } + + byte var24 = 0; + + if (var3) + { + var24 = 1; + } + + var25 = MathHelper.ceiling_float_int((float)(var22 + 1) / 10.0F) - 1; + var26 = var11 + var22 % 10 * 8; + var27 = var13 - var25 * var17; + + if (var4 <= 4) + { + var27 += this.rand.nextInt(2); + } + + if (var22 == var21) + { + var27 -= 2; + } + + byte var28 = 0; + + if (this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) + { + var28 = 5; + } + + this.drawTexturedModalRect(var26, var27, 16 + var24 * 9, 9 * var28, 9, 9); + + if (var3) + { + if (var22 * 2 + 1 < var5) + { + this.drawTexturedModalRect(var26, var27, var23 + 54, 9 * var28, 9, 9); + } + + if (var22 * 2 + 1 == var5) + { + this.drawTexturedModalRect(var26, var27, var23 + 63, 9 * var28, 9, 9); + } + } + + if (var19 > 0.0F) + { + if (var19 == var15 && var15 % 2.0F == 1.0F) + { + this.drawTexturedModalRect(var26, var27, var23 + 153, 9 * var28, 9, 9); + } + else + { + this.drawTexturedModalRect(var26, var27, var23 + 144, 9 * var28, 9, 9); + } + + var19 -= 2.0F; + } + else + { + if (var22 * 2 + 1 < var4) + { + this.drawTexturedModalRect(var26, var27, var23 + 36, 9 * var28, 9, 9); + } + + if (var22 * 2 + 1 == var4) + { + this.drawTexturedModalRect(var26, var27, var23 + 45, 9 * var28, 9, 9); + } + } + } + + Entity var34 = this.mc.thePlayer.ridingEntity; + int var35; + + if (var34 == null) + { + this.mc.mcProfiler.endStartSection("food"); + + for (var23 = 0; var23 < 10; ++var23) + { + var35 = var13; + var25 = 16; + byte var36 = 0; + + if (this.mc.thePlayer.isPotionActive(Potion.hunger)) + { + var25 += 36; + var36 = 13; + } + + if (this.mc.thePlayer.getFoodStats().getSaturationLevel() <= 0.0F && this.updateCounter % (var8 * 3 + 1) == 0) + { + var35 = var13 + (this.rand.nextInt(3) - 1); + } + + if (var6) + { + var36 = 1; + } + + var27 = var12 - var23 * 8 - 9; + this.drawTexturedModalRect(var27, var35, 16 + var36 * 9, 27, 9, 9); + + if (var6) + { + if (var23 * 2 + 1 < var9) + { + this.drawTexturedModalRect(var27, var35, var25 + 54, 27, 9, 9); + } + + if (var23 * 2 + 1 == var9) + { + this.drawTexturedModalRect(var27, var35, var25 + 63, 27, 9, 9); + } + } + + if (var23 * 2 + 1 < var8) + { + this.drawTexturedModalRect(var27, var35, var25 + 36, 27, 9, 9); + } + + if (var23 * 2 + 1 == var8) + { + this.drawTexturedModalRect(var27, var35, var25 + 45, 27, 9, 9); + } + } + } + else if (var34 instanceof EntityLivingBase) + { + this.mc.mcProfiler.endStartSection("mountHealth"); + EntityLivingBase var37 = (EntityLivingBase)var34; + var35 = (int)Math.ceil((double)var37.getHealth()); + float var38 = var37.getMaxHealth(); + var26 = (int)(var38 + 0.5F) / 2; + + if (var26 > 30) + { + var26 = 30; + } + + var27 = var13; + + for (int var39 = 0; var26 > 0; var39 += 20) + { + int var29 = Math.min(var26, 10); + var26 -= var29; + + for (int var30 = 0; var30 < var29; ++var30) + { + byte var31 = 52; + byte var32 = 0; + + if (var6) + { + var32 = 1; + } + + int var33 = var12 - var30 * 8 - 9; + this.drawTexturedModalRect(var33, var27, var31 + var32 * 9, 9, 9, 9); + + if (var30 * 2 + 1 + var39 < var35) + { + this.drawTexturedModalRect(var33, var27, var31 + 36, 9, 9, 9); + } + + if (var30 * 2 + 1 + var39 == var35) + { + this.drawTexturedModalRect(var33, var27, var31 + 45, 9, 9, 9); + } + } + + var27 -= 10; + } + } + + this.mc.mcProfiler.endStartSection("air"); + + if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) + { + var23 = this.mc.thePlayer.getAir(); + var35 = MathHelper.ceiling_double_int((double)(var23 - 2) * 10.0D / 300.0D); + var25 = MathHelper.ceiling_double_int((double)var23 * 10.0D / 300.0D) - var35; + + for (var26 = 0; var26 < var35 + var25; ++var26) + { + if (var26 < var35) + { + this.drawTexturedModalRect(var12 - var26 * 8 - 9, var18, 16, 18, 9, 9); + } + else + { + this.drawTexturedModalRect(var12 - var26 * 8 - 9, var18, 25, 18, 9, 9); + } + } + } + + this.mc.mcProfiler.endSection(); + } + + /** + * Renders dragon's (boss) health on the HUD + */ + private void renderBossHealth() + { + if (BossStatus.bossName != null && BossStatus.statusBarLength > 0) + { + --BossStatus.statusBarLength; + FontRenderer var1 = this.mc.fontRenderer; + ScaledResolution var2 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + int var3 = var2.getScaledWidth(); + short var4 = 182; + int var5 = var3 / 2 - var4 / 2; + int var6 = (int)(BossStatus.healthScale * (float)(var4 + 1)); + byte var7 = 12; + this.drawTexturedModalRect(var5, var7, 0, 74, var4, 5); + this.drawTexturedModalRect(var5, var7, 0, 74, var4, 5); + + if (var6 > 0) + { + this.drawTexturedModalRect(var5, var7, 0, 79, var6, 5); + } + + String var8 = BossStatus.bossName; + var1.drawStringWithShadow(var8, var3 / 2 - var1.getStringWidth(var8) / 2, var7 - 10, 16777215); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(icons); + } + } + + private void renderPumpkinBlur(int par1, int par2) + { + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_ALPHA_TEST); + this.mc.getTextureManager().bindTexture(pumpkinBlurTexPath); + Tessellator var3 = Tessellator.instance; + var3.startDrawingQuads(); + var3.addVertexWithUV(0.0D, (double)par2, -90.0D, 0.0D, 1.0D); + var3.addVertexWithUV((double)par1, (double)par2, -90.0D, 1.0D, 1.0D); + var3.addVertexWithUV((double)par1, 0.0D, -90.0D, 1.0D, 0.0D); + var3.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D); + var3.draw(); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Renders the vignette. Args: vignetteBrightness, width, height + */ + private void renderVignette(float par1, int par2, int par3) + { + par1 = 1.0F - par1; + + if (par1 < 0.0F) + { + par1 = 0.0F; + } + + if (par1 > 1.0F) + { + par1 = 1.0F; + } + + this.prevVignetteBrightness = (float)((double)this.prevVignetteBrightness + (double)(par1 - this.prevVignetteBrightness) * 0.01D); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_COLOR); + GL11.glColor4f(this.prevVignetteBrightness, this.prevVignetteBrightness, this.prevVignetteBrightness, 1.0F); + this.mc.getTextureManager().bindTexture(vignetteTexPath); + Tessellator var4 = Tessellator.instance; + var4.startDrawingQuads(); + var4.addVertexWithUV(0.0D, (double)par3, -90.0D, 0.0D, 1.0D); + var4.addVertexWithUV((double)par2, (double)par3, -90.0D, 1.0D, 1.0D); + var4.addVertexWithUV((double)par2, 0.0D, -90.0D, 1.0D, 0.0D); + var4.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D); + var4.draw(); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + } + + private void func_130015_b(float par1, int par2, int par3) + { + if (par1 < 1.0F) + { + par1 *= par1; + par1 *= par1; + par1 = par1 * 0.8F + 0.2F; + } + + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, par1); + Icon var4 = Block.portal.getBlockTextureFromSide(1); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + float var5 = var4.getMinU(); + float var6 = var4.getMinV(); + float var7 = var4.getMaxU(); + float var8 = var4.getMaxV(); + Tessellator var9 = Tessellator.instance; + var9.startDrawingQuads(); + var9.addVertexWithUV(0.0D, (double)par3, -90.0D, (double)var5, (double)var8); + var9.addVertexWithUV((double)par2, (double)par3, -90.0D, (double)var7, (double)var8); + var9.addVertexWithUV((double)par2, 0.0D, -90.0D, (double)var7, (double)var6); + var9.addVertexWithUV(0.0D, 0.0D, -90.0D, (double)var5, (double)var6); + var9.draw(); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Renders the specified item of the inventory slot at the specified location. Args: slot, x, y, partialTick + */ + private void renderInventorySlot(int par1, int par2, int par3, float par4) + { + ItemStack var5 = this.mc.thePlayer.inventory.mainInventory[par1]; + + if (var5 != null) + { + float var6 = (float)var5.animationsToGo - par4; + + if (var6 > 0.0F) + { + GL11.glPushMatrix(); + float var7 = 1.0F + var6 / 5.0F; + GL11.glTranslatef((float)(par2 + 8), (float)(par3 + 12), 0.0F); + GL11.glScalef(1.0F / var7, (var7 + 1.0F) / 2.0F, 1.0F); + GL11.glTranslatef((float)(-(par2 + 8)), (float)(-(par3 + 12)), 0.0F); + } + + itemRenderer.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), var5, par2, par3); + + if (var6 > 0.0F) + { + GL11.glPopMatrix(); + } + + itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), var5, par2, par3); + } + } + + /** + * The update tick for the ingame UI + */ + public void updateTick() + { + if (this.recordPlayingUpFor > 0) + { + --this.recordPlayingUpFor; + } + + ++this.updateCounter; + + if (this.mc.thePlayer != null) + { + ItemStack var1 = this.mc.thePlayer.inventory.getCurrentItem(); + + if (var1 == null) + { + this.remainingHighlightTicks = 0; + } + else if (this.highlightingItemStack != null && var1.itemID == this.highlightingItemStack.itemID && ItemStack.areItemStackTagsEqual(var1, this.highlightingItemStack) && (var1.isItemStackDamageable() || var1.getItemDamage() == this.highlightingItemStack.getItemDamage())) + { + if (this.remainingHighlightTicks > 0) + { + --this.remainingHighlightTicks; + } + } + else + { + this.remainingHighlightTicks = 40; + } + + this.highlightingItemStack = var1; + } + } + + public void setRecordPlayingMessage(String par1Str) + { + this.func_110326_a("Now playing: " + par1Str, true); + } + + public void func_110326_a(String par1Str, boolean par2) + { + this.recordPlaying = par1Str; + this.recordPlayingUpFor = 60; + this.recordIsPlaying = par2; + } + + /** + * returns a pointer to the persistant Chat GUI, containing all previous chat messages and such + */ + public GuiNewChat getChatGUI() + { + return this.persistantChatGUI; + } + + public int getUpdateCounter() + { + return this.updateCounter; + } +} diff --git a/src/main/java/net/minecraft/src/GuiIngameMenu.java b/src/main/java/net/minecraft/src/GuiIngameMenu.java new file mode 100644 index 0000000..bac5bde --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiIngameMenu.java @@ -0,0 +1,96 @@ +package net.minecraft.src; + +public class GuiIngameMenu extends GuiScreen +{ + /** Also counts the number of updates, not certain as to why yet. */ + private int updateCounter2; + + /** Counts the number of screen updates. */ + private int updateCounter; + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.updateCounter2 = 0; + this.buttonList.clear(); + byte var1 = -16; + boolean var2 = true; + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + var1, I18n.getString("menu.returnToMenu"))); + + if (!this.mc.isIntegratedServerRunning()) + { + ((GuiButton)this.buttonList.get(0)).displayString = I18n.getString("menu.disconnect"); + } + + this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + var1, I18n.getString("menu.returnToGame"))); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + var1, 98, 20, I18n.getString("menu.options"))); + GuiButton var3; + this.buttonList.add(var3 = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + var1, 98, 20, I18n.getString("menu.shareToLan"))); + this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + var1, 98, 20, I18n.getString("gui.achievements"))); + this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + var1, 98, 20, I18n.getString("gui.stats"))); + var3.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic(); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + switch (par1GuiButton.id) + { + case 0: + this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings)); + break; + + case 1: + par1GuiButton.enabled = false; + this.mc.statFileWriter.readStat(StatList.leaveGameStat, 1); + this.mc.theWorld.sendQuittingDisconnectingPacket(); + this.mc.loadWorld((WorldClient)null); + this.mc.displayGuiScreen(new GuiMainMenu()); + + case 2: + case 3: + default: + break; + + case 4: + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + this.mc.sndManager.resumeAllSounds(); + break; + + case 5: + this.mc.displayGuiScreen(new GuiAchievements(this.mc.statFileWriter)); + break; + + case 6: + this.mc.displayGuiScreen(new GuiStats(this, this.mc.statFileWriter)); + break; + + case 7: + this.mc.displayGuiScreen(new GuiShareToLan(this)); + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + ++this.updateCounter; + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, "Game menu", this.width / 2, 40, 16777215); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiInventory.java b/src/main/java/net/minecraft/src/GuiInventory.java new file mode 100644 index 0000000..fbf467b --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiInventory.java @@ -0,0 +1,136 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiInventory extends InventoryEffectRenderer +{ + /** + * x size of the inventory window in pixels. Defined as float, passed as int + */ + private float xSize_lo; + + /** + * y size of the inventory window in pixels. Defined as float, passed as int. + */ + private float ySize_lo; + + public GuiInventory(EntityPlayer par1EntityPlayer) + { + super(par1EntityPlayer.inventoryContainer); + this.allowUserInput = true; + par1EntityPlayer.addStat(AchievementList.openInventory, 1); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + if (this.mc.playerController.isInCreativeMode()) + { + this.mc.displayGuiScreen(new GuiContainerCreative(this.mc.thePlayer)); + } + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + + if (this.mc.playerController.isInCreativeMode()) + { + this.mc.displayGuiScreen(new GuiContainerCreative(this.mc.thePlayer)); + } + else + { + super.initGui(); + } + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + this.fontRenderer.drawString(I18n.getString("container.crafting"), 86, 16, 4210752); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + super.drawScreen(par1, par2, par3); + this.xSize_lo = (float)par1; + this.ySize_lo = (float)par2; + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(field_110408_a); + int var4 = this.guiLeft; + int var5 = this.guiTop; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.ySize); + func_110423_a(var4 + 51, var5 + 75, 30, (float)(var4 + 51) - this.xSize_lo, (float)(var5 + 75 - 50) - this.ySize_lo, this.mc.thePlayer); + } + + public static void func_110423_a(int par0, int par1, int par2, float par3, float par4, EntityLivingBase par5EntityLivingBase) + { + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glPushMatrix(); + GL11.glTranslatef((float)par0, (float)par1, 50.0F); + GL11.glScalef((float)(-par2), (float)par2, (float)par2); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + float var6 = par5EntityLivingBase.renderYawOffset; + float var7 = par5EntityLivingBase.rotationYaw; + float var8 = par5EntityLivingBase.rotationPitch; + float var9 = par5EntityLivingBase.prevRotationYawHead; + float var10 = par5EntityLivingBase.rotationYawHead; + GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-((float)Math.atan((double)(par4 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); + par5EntityLivingBase.renderYawOffset = (float)Math.atan((double)(par3 / 40.0F)) * 20.0F; + par5EntityLivingBase.rotationYaw = (float)Math.atan((double)(par3 / 40.0F)) * 40.0F; + par5EntityLivingBase.rotationPitch = -((float)Math.atan((double)(par4 / 40.0F))) * 20.0F; + par5EntityLivingBase.rotationYawHead = par5EntityLivingBase.rotationYaw; + par5EntityLivingBase.prevRotationYawHead = par5EntityLivingBase.rotationYaw; + GL11.glTranslatef(0.0F, par5EntityLivingBase.yOffset, 0.0F); + RenderManager.instance.playerViewY = 180.0F; + RenderManager.instance.renderEntityWithPosYaw(par5EntityLivingBase, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + par5EntityLivingBase.renderYawOffset = var6; + par5EntityLivingBase.rotationYaw = var7; + par5EntityLivingBase.rotationPitch = var8; + par5EntityLivingBase.prevRotationYawHead = var9; + par5EntityLivingBase.rotationYawHead = var10; + GL11.glPopMatrix(); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GL11.glDisable(GL11.GL_TEXTURE_2D); + OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(new GuiAchievements(this.mc.statFileWriter)); + } + + if (par1GuiButton.id == 1) + { + this.mc.displayGuiScreen(new GuiStats(this, this.mc.statFileWriter)); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiLanguage.java b/src/main/java/net/minecraft/src/GuiLanguage.java new file mode 100644 index 0000000..5ba4d5c --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiLanguage.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +public class GuiLanguage extends GuiScreen +{ + /** This GUI's parent GUI. */ + protected GuiScreen parentGui; + + /** This GUI's language list. */ + private GuiSlotLanguage languageList; + + /** For saving the user's language selection to disk. */ + private final GameSettings theGameSettings; + private final LanguageManager field_135014_d; + + /** This GUI's 'Done' button. */ + private GuiSmallButton doneButton; + + public GuiLanguage(GuiScreen par1GuiScreen, GameSettings par2GameSettings, LanguageManager par3LanguageManager) + { + this.parentGui = par1GuiScreen; + this.theGameSettings = par2GameSettings; + this.field_135014_d = par3LanguageManager; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.add(this.doneButton = new GuiSmallButton(6, this.width / 2 - 75, this.height - 38, I18n.getString("gui.done"))); + this.languageList = new GuiSlotLanguage(this); + this.languageList.registerScrollButtons(7, 8); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + switch (par1GuiButton.id) + { + case 5: + break; + + case 6: + this.mc.displayGuiScreen(this.parentGui); + break; + + default: + this.languageList.actionPerformed(par1GuiButton); + } + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.languageList.drawScreen(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, I18n.getString("options.language"), this.width / 2, 16, 16777215); + this.drawCenteredString(this.fontRenderer, "(" + I18n.getString("options.languageWarning") + ")", this.width / 2, this.height - 56, 8421504); + super.drawScreen(par1, par2, par3); + } + + static LanguageManager func_135011_a(GuiLanguage par0GuiLanguage) + { + return par0GuiLanguage.field_135014_d; + } + + /** + * Gets the relevant instance of GameSettings. Synthetic method for use in GuiSlotLanguage + */ + static GameSettings getGameSettings(GuiLanguage par0GuiLanguage) + { + return par0GuiLanguage.theGameSettings; + } + + /** + * Returns the private doneButton field. + */ + static GuiSmallButton getDoneButton(GuiLanguage par0GuiLanguage) + { + return par0GuiLanguage.doneButton; + } +} diff --git a/src/main/java/net/minecraft/src/GuiMainMenu.java b/src/main/java/net/minecraft/src/GuiMainMenu.java new file mode 100644 index 0000000..f9237ac --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiMainMenu.java @@ -0,0 +1,611 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URI; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Random; +import org.apache.commons.io.Charsets; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.Project; + +public class GuiMainMenu extends GuiScreen +{ + /** The RNG used by the Main Menu Screen. */ + private static final Random rand = new Random(); + + /** Counts the number of screen updates. */ + private float updateCounter; + + /** The splash message. */ + private String splashText = "missingno"; + private GuiButton buttonResetDemo; + + /** Timer used to rotate the panorama, increases every tick. */ + private int panoramaTimer; + + /** + * Texture allocated for the current viewport of the main menu's panorama background. + */ + private DynamicTexture viewportTexture; + private boolean field_96141_q = true; + private static boolean field_96140_r; + private static boolean field_96139_s; + private final Object field_104025_t = new Object(); + private String field_92025_p; + private String field_104024_v; + private static final ResourceLocation splashTexts = new ResourceLocation("texts/splashes.txt"); + private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("textures/gui/title/minecraft.png"); + + /** An array of all the paths to the panorama pictures. */ + private static final ResourceLocation[] titlePanoramaPaths = new ResourceLocation[] {new ResourceLocation("textures/gui/title/background/panorama_0.png"), new ResourceLocation("textures/gui/title/background/panorama_1.png"), new ResourceLocation("textures/gui/title/background/panorama_2.png"), new ResourceLocation("textures/gui/title/background/panorama_3.png"), new ResourceLocation("textures/gui/title/background/panorama_4.png"), new ResourceLocation("textures/gui/title/background/panorama_5.png")}; + public static final String field_96138_a = "Please click " + EnumChatFormatting.UNDERLINE + "here" + EnumChatFormatting.RESET + " for more information."; + private int field_92024_r; + private int field_92023_s; + private int field_92022_t; + private int field_92021_u; + private int field_92020_v; + private int field_92019_w; + private ResourceLocation field_110351_G; + private GuiButton minecraftRealmsButton; + + public GuiMainMenu() + { + BufferedReader var1 = null; + String var3; + + try + { + ArrayList var2 = new ArrayList(); + var1 = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(splashTexts).getInputStream(), Charsets.UTF_8)); + + while ((var3 = var1.readLine()) != null) + { + var3 = var3.trim(); + + if (!var3.isEmpty()) + { + var2.add(var3); + } + } + + do + { + this.splashText = (String)var2.get(rand.nextInt(var2.size())); + } + while (this.splashText.hashCode() == 125780783); + } + catch (IOException var12) + { + ; + } + finally + { + if (var1 != null) + { + try + { + var1.close(); + } + catch (IOException var11) + { + ; + } + } + } + + this.updateCounter = rand.nextFloat(); + this.field_92025_p = ""; + String var14 = System.getProperty("os_architecture"); + var3 = System.getProperty("java_version"); + + if ("ppc".equalsIgnoreCase(var14)) + { + this.field_92025_p = "" + EnumChatFormatting.BOLD + "Notice!" + EnumChatFormatting.RESET + " PowerPC compatibility will be dropped in Minecraft 1.6"; + this.field_104024_v = "http://tinyurl.com/javappc"; + } + else if (var3 != null && var3.startsWith("1.5")) + { + this.field_92025_p = "" + EnumChatFormatting.BOLD + "Notice!" + EnumChatFormatting.RESET + " Java 1.5 compatibility will be dropped in Minecraft 1.6"; + this.field_104024_v = "http://tinyurl.com/javappc"; + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + ++this.panoramaTimer; + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return false; + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) {} + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.viewportTexture = new DynamicTexture(256, 256); + this.field_110351_G = this.mc.getTextureManager().getDynamicTextureLocation("background", this.viewportTexture); + Calendar var1 = Calendar.getInstance(); + var1.setTime(new Date()); + + if (var1.get(2) + 1 == 11 && var1.get(5) == 9) + { + this.splashText = "Happy birthday, ez!"; + } + else if (var1.get(2) + 1 == 6 && var1.get(5) == 1) + { + this.splashText = "Happy birthday, Notch!"; + } + else if (var1.get(2) + 1 == 12 && var1.get(5) == 24) + { + this.splashText = "Merry X-mas!"; + } + else if (var1.get(2) + 1 == 1 && var1.get(5) == 1) + { + this.splashText = "Happy new year!"; + } + else if (var1.get(2) + 1 == 10 && var1.get(5) == 31) + { + this.splashText = "OOoooOOOoooo! Spooky!"; + } + + boolean var2 = true; + int var3 = this.height / 4 + 48; + + if (this.mc.isDemo()) + { + this.addDemoButtons(var3, 24); + } + else + { + this.addSingleplayerMultiplayerButtons(var3, 24); + } + + this.func_130020_g(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, var3 + 72 + 12, 98, 20, I18n.getString("menu.options"))); + this.buttonList.add(new GuiButton(4, this.width / 2 + 2, var3 + 72 + 12, 98, 20, I18n.getString("menu.quit"))); + this.buttonList.add(new GuiButtonLanguage(5, this.width / 2 - 124, var3 + 72 + 12)); + Object var4 = this.field_104025_t; + + synchronized (this.field_104025_t) + { + this.field_92023_s = this.fontRenderer.getStringWidth(this.field_92025_p); + this.field_92024_r = this.fontRenderer.getStringWidth(field_96138_a); + int var5 = Math.max(this.field_92023_s, this.field_92024_r); + this.field_92022_t = (this.width - var5) / 2; + this.field_92021_u = ((GuiButton)this.buttonList.get(0)).yPosition - 24; + this.field_92020_v = this.field_92022_t + var5; + this.field_92019_w = this.field_92021_u + 24; + } + } + + private void func_130020_g() + { + if (this.field_96141_q) + { + if (!field_96140_r) + { + field_96140_r = true; + (new RunnableTitleScreen(this)).start(); + } + else if (field_96139_s) + { + this.func_130022_h(); + } + } + } + + private void func_130022_h() + { + this.minecraftRealmsButton.drawButton = true; + } + + /** + * Adds Singleplayer and Multiplayer buttons on Main Menu for players who have bought the game. + */ + private void addSingleplayerMultiplayerButtons(int par1, int par2) + { + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, par1, I18n.getString("menu.singleplayer"))); + this.buttonList.add(new GuiButton(2, this.width / 2 - 100, par1 + par2 * 1, I18n.getString("menu.multiplayer"))); + this.buttonList.add(this.minecraftRealmsButton = new GuiButton(14, this.width / 2 - 100, par1 + par2 * 2, I18n.getString("menu.online"))); + this.minecraftRealmsButton.drawButton = false; + } + + /** + * Adds Demo buttons on Main Menu for players who are playing Demo. + */ + private void addDemoButtons(int par1, int par2) + { + this.buttonList.add(new GuiButton(11, this.width / 2 - 100, par1, I18n.getString("menu.playdemo"))); + this.buttonList.add(this.buttonResetDemo = new GuiButton(12, this.width / 2 - 100, par1 + par2 * 1, I18n.getString("menu.resetdemo"))); + ISaveFormat var3 = this.mc.getSaveLoader(); + WorldInfo var4 = var3.getWorldInfo("Demo_World"); + + if (var4 == null) + { + this.buttonResetDemo.enabled = false; + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings)); + } + + if (par1GuiButton.id == 5) + { + this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager())); + } + + if (par1GuiButton.id == 1) + { + this.mc.displayGuiScreen(new GuiSelectWorld(this)); + } + + if (par1GuiButton.id == 2) + { + this.mc.displayGuiScreen(new GuiMultiplayer(this)); + } + + if (par1GuiButton.id == 14 && this.minecraftRealmsButton.drawButton) + { + this.func_140005_i(); + } + + if (par1GuiButton.id == 4) + { + this.mc.shutdown(); + } + + if (par1GuiButton.id == 11) + { + this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings); + } + + if (par1GuiButton.id == 12) + { + ISaveFormat var2 = this.mc.getSaveLoader(); + WorldInfo var3 = var2.getWorldInfo("Demo_World"); + + if (var3 != null) + { + GuiYesNo var4 = GuiSelectWorld.getDeleteWorldScreen(this, var3.getWorldName(), 12); + this.mc.displayGuiScreen(var4); + } + } + } + + private void func_140005_i() + { + McoClient var1 = new McoClient(this.mc.getSession()); + + try + { + if (var1.func_140054_c().booleanValue()) + { + this.mc.displayGuiScreen(new GuiScreenClientOutdated(this)); + } + else + { + this.mc.displayGuiScreen(new GuiScreenOnlineServers(this)); + } + } + catch (ExceptionMcoService var3) + { + this.mc.getLogAgent().logSevere(var3.toString()); + } + catch (IOException var4) + { + this.mc.getLogAgent().logSevere(var4.getLocalizedMessage()); + } + } + + public void confirmClicked(boolean par1, int par2) + { + if (par1 && par2 == 12) + { + ISaveFormat var6 = this.mc.getSaveLoader(); + var6.flushCache(); + var6.deleteWorldDirectory("Demo_World"); + this.mc.displayGuiScreen(this); + } + else if (par2 == 13) + { + if (par1) + { + try + { + Class var3 = Class.forName("java.awt.Desktop"); + Object var4 = var3.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]); + var3.getMethod("browse", new Class[] {URI.class}).invoke(var4, new Object[] {new URI(this.field_104024_v)}); + } + catch (Throwable var5) + { + var5.printStackTrace(); + } + } + + this.mc.displayGuiScreen(this); + } + } + + /** + * Draws the main menu panorama + */ + private void drawPanorama(int par1, int par2, float par3) + { + Tessellator var4 = Tessellator.instance; + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glPushMatrix(); + GL11.glLoadIdentity(); + Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glPushMatrix(); + GL11.glLoadIdentity(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glDepthMask(false); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + byte var5 = 8; + + for (int var6 = 0; var6 < var5 * var5; ++var6) + { + GL11.glPushMatrix(); + float var7 = ((float)(var6 % var5) / (float)var5 - 0.5F) / 64.0F; + float var8 = ((float)(var6 / var5) / (float)var5 - 0.5F) / 64.0F; + float var9 = 0.0F; + GL11.glTranslatef(var7, var8, var9); + GL11.glRotatef(MathHelper.sin(((float)this.panoramaTimer + par3) / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(-((float)this.panoramaTimer + par3) * 0.1F, 0.0F, 1.0F, 0.0F); + + for (int var10 = 0; var10 < 6; ++var10) + { + GL11.glPushMatrix(); + + if (var10 == 1) + { + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + } + + if (var10 == 2) + { + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + } + + if (var10 == 3) + { + GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); + } + + if (var10 == 4) + { + GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + } + + if (var10 == 5) + { + GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); + } + + this.mc.getTextureManager().bindTexture(titlePanoramaPaths[var10]); + var4.startDrawingQuads(); + var4.setColorRGBA_I(16777215, 255 / (var6 + 1)); + float var11 = 0.0F; + var4.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double)(0.0F + var11), (double)(0.0F + var11)); + var4.addVertexWithUV(1.0D, -1.0D, 1.0D, (double)(1.0F - var11), (double)(0.0F + var11)); + var4.addVertexWithUV(1.0D, 1.0D, 1.0D, (double)(1.0F - var11), (double)(1.0F - var11)); + var4.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double)(0.0F + var11), (double)(1.0F - var11)); + var4.draw(); + GL11.glPopMatrix(); + } + + GL11.glPopMatrix(); + GL11.glColorMask(true, true, true, false); + } + + var4.setTranslation(0.0D, 0.0D, 0.0D); + GL11.glColorMask(true, true, true, true); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glPopMatrix(); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_DEPTH_TEST); + } + + /** + * Rotate and blurs the skybox view in the main menu + */ + private void rotateAndBlurSkybox(float par1) + { + this.mc.getTextureManager().bindTexture(this.field_110351_G); + GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColorMask(true, true, true, false); + Tessellator var2 = Tessellator.instance; + var2.startDrawingQuads(); + byte var3 = 3; + + for (int var4 = 0; var4 < var3; ++var4) + { + var2.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (float)(var4 + 1)); + int var5 = this.width; + int var6 = this.height; + float var7 = (float)(var4 - var3 / 2) / 256.0F; + var2.addVertexWithUV((double)var5, (double)var6, (double)this.zLevel, (double)(0.0F + var7), 0.0D); + var2.addVertexWithUV((double)var5, 0.0D, (double)this.zLevel, (double)(1.0F + var7), 0.0D); + var2.addVertexWithUV(0.0D, 0.0D, (double)this.zLevel, (double)(1.0F + var7), 1.0D); + var2.addVertexWithUV(0.0D, (double)var6, (double)this.zLevel, (double)(0.0F + var7), 1.0D); + } + + var2.draw(); + GL11.glColorMask(true, true, true, true); + } + + /** + * Renders the skybox in the main menu + */ + private void renderSkybox(int par1, int par2, float par3) + { + GL11.glViewport(0, 0, 256, 256); + this.drawPanorama(par1, par2, par3); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_TEXTURE_2D); + this.rotateAndBlurSkybox(par3); + this.rotateAndBlurSkybox(par3); + this.rotateAndBlurSkybox(par3); + this.rotateAndBlurSkybox(par3); + this.rotateAndBlurSkybox(par3); + this.rotateAndBlurSkybox(par3); + this.rotateAndBlurSkybox(par3); + this.rotateAndBlurSkybox(par3); + GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); + Tessellator var4 = Tessellator.instance; + var4.startDrawingQuads(); + float var5 = this.width > this.height ? 120.0F / (float)this.width : 120.0F / (float)this.height; + float var6 = (float)this.height * var5 / 256.0F; + float var7 = (float)this.width * var5 / 256.0F; + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + var4.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F); + int var8 = this.width; + int var9 = this.height; + var4.addVertexWithUV(0.0D, (double)var9, (double)this.zLevel, (double)(0.5F - var6), (double)(0.5F + var7)); + var4.addVertexWithUV((double)var8, (double)var9, (double)this.zLevel, (double)(0.5F - var6), (double)(0.5F - var7)); + var4.addVertexWithUV((double)var8, 0.0D, (double)this.zLevel, (double)(0.5F + var6), (double)(0.5F - var7)); + var4.addVertexWithUV(0.0D, 0.0D, (double)this.zLevel, (double)(0.5F + var6), (double)(0.5F + var7)); + var4.draw(); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.renderSkybox(par1, par2, par3); + Tessellator var4 = Tessellator.instance; + short var5 = 274; + int var6 = this.width / 2 - var5 / 2; + byte var7 = 30; + this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215); + this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE); + this.mc.getTextureManager().bindTexture(minecraftTitleTextures); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + if ((double)this.updateCounter < 1.0E-4D) + { + this.drawTexturedModalRect(var6 + 0, var7 + 0, 0, 0, 99, 44); + this.drawTexturedModalRect(var6 + 99, var7 + 0, 129, 0, 27, 44); + this.drawTexturedModalRect(var6 + 99 + 26, var7 + 0, 126, 0, 3, 44); + this.drawTexturedModalRect(var6 + 99 + 26 + 3, var7 + 0, 99, 0, 26, 44); + this.drawTexturedModalRect(var6 + 155, var7 + 0, 0, 45, 155, 44); + } + else + { + this.drawTexturedModalRect(var6 + 0, var7 + 0, 0, 0, 155, 44); + this.drawTexturedModalRect(var6 + 155, var7 + 0, 0, 45, 155, 44); + } + + var4.setColorOpaque_I(16777215); + GL11.glPushMatrix(); + GL11.glTranslatef((float)(this.width / 2 + 90), 70.0F, 0.0F); + GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F); + float var8 = 1.8F - MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) / 1000.0F * (float)Math.PI * 2.0F) * 0.1F); + var8 = var8 * 100.0F / (float)(this.fontRenderer.getStringWidth(this.splashText) + 32); + GL11.glScalef(var8, var8, var8); + this.drawCenteredString(this.fontRenderer, this.splashText, 0, -8, 16776960); + GL11.glPopMatrix(); + String var9 = "Minecraft 1.6.4"; + + if (this.mc.isDemo()) + { + var9 = var9 + " Demo"; + } + + this.drawString(this.fontRenderer, var9, 2, this.height - 10, 16777215); + String var10 = "Copyright Mojang AB. Do not distribute!"; + this.drawString(this.fontRenderer, var10, this.width - this.fontRenderer.getStringWidth(var10) - 2, this.height - 10, 16777215); + + if (this.field_92025_p != null && this.field_92025_p.length() > 0) + { + drawRect(this.field_92022_t - 2, this.field_92021_u - 2, this.field_92020_v + 2, this.field_92019_w - 1, 1428160512); + this.drawString(this.fontRenderer, this.field_92025_p, this.field_92022_t, this.field_92021_u, 16777215); + this.drawString(this.fontRenderer, field_96138_a, (this.width - this.field_92024_r) / 2, ((GuiButton)this.buttonList.get(0)).yPosition - 12, 16777215); + } + + super.drawScreen(par1, par2, par3); + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + Object var4 = this.field_104025_t; + + synchronized (this.field_104025_t) + { + if (this.field_92025_p.length() > 0 && par1 >= this.field_92022_t && par1 <= this.field_92020_v && par2 >= this.field_92021_u && par2 <= this.field_92019_w) + { + GuiConfirmOpenLink var5 = new GuiConfirmOpenLink(this, this.field_104024_v, 13, true); + var5.func_92026_h(); + this.mc.displayGuiScreen(var5); + } + } + } + + static Minecraft func_110348_a(GuiMainMenu par0GuiMainMenu) + { + return par0GuiMainMenu.mc; + } + + static void func_130021_b(GuiMainMenu par0GuiMainMenu) + { + par0GuiMainMenu.func_130022_h(); + } + + static boolean func_110349_a(boolean par0) + { + field_96139_s = par0; + return par0; + } + + static Minecraft func_130018_c(GuiMainMenu par0GuiMainMenu) + { + return par0GuiMainMenu.mc; + } + + static Minecraft func_130019_d(GuiMainMenu par0GuiMainMenu) + { + return par0GuiMainMenu.mc; + } +} diff --git a/src/main/java/net/minecraft/src/GuiMemoryErrorScreen.java b/src/main/java/net/minecraft/src/GuiMemoryErrorScreen.java new file mode 100644 index 0000000..5965c61 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiMemoryErrorScreen.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +public class GuiMemoryErrorScreen extends GuiScreen +{ + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + this.buttonList.add(new GuiSmallButton(0, this.width / 2 - 155, this.height / 4 + 120 + 12, I18n.getString("gui.toMenu"))); + this.buttonList.add(new GuiSmallButton(1, this.width / 2 - 155 + 160, this.height / 4 + 120 + 12, I18n.getString("menu.quit"))); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(new GuiMainMenu()); + } + else if (par1GuiButton.id == 1) + { + this.mc.shutdown(); + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) {} + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, "Out of memory!", this.width / 2, this.height / 4 - 60 + 20, 16777215); + this.drawString(this.fontRenderer, "Minecraft has run out of memory.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 0, 10526880); + this.drawString(this.fontRenderer, "This could be caused by a bug in the game or by the", this.width / 2 - 140, this.height / 4 - 60 + 60 + 18, 10526880); + this.drawString(this.fontRenderer, "Java Virtual Machine not being allocated enough", this.width / 2 - 140, this.height / 4 - 60 + 60 + 27, 10526880); + this.drawString(this.fontRenderer, "memory. If you are playing in a web browser, try", this.width / 2 - 140, this.height / 4 - 60 + 60 + 36, 10526880); + this.drawString(this.fontRenderer, "downloading the game and playing it offline.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 45, 10526880); + this.drawString(this.fontRenderer, "To prevent level corruption, the current game has quit.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 63, 10526880); + this.drawString(this.fontRenderer, "We\'ve tried to free up enough memory to let you go back to", this.width / 2 - 140, this.height / 4 - 60 + 60 + 81, 10526880); + this.drawString(this.fontRenderer, "the main menu and back to playing, but this may not have worked.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 90, 10526880); + this.drawString(this.fontRenderer, "Please restart the game if you see this message again.", this.width / 2 - 140, this.height / 4 - 60 + 60 + 99, 10526880); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiMerchant.java b/src/main/java/net/minecraft/src/GuiMerchant.java new file mode 100644 index 0000000..54a3650 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiMerchant.java @@ -0,0 +1,198 @@ +package net.minecraft.src; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiMerchant extends GuiContainer +{ + private static final ResourceLocation merchantGuiTextures = new ResourceLocation("textures/gui/container/villager.png"); + + /** Instance of IMerchant interface. */ + private IMerchant theIMerchant; + private GuiButtonMerchant nextRecipeButtonIndex; + private GuiButtonMerchant previousRecipeButtonIndex; + private int currentRecipeIndex; + private String field_94082_v; + + public GuiMerchant(InventoryPlayer par1InventoryPlayer, IMerchant par2IMerchant, World par3World, String par4Str) + { + super(new ContainerMerchant(par1InventoryPlayer, par2IMerchant, par3World)); + this.theIMerchant = par2IMerchant; + this.field_94082_v = par4Str != null && par4Str.length() >= 1 ? par4Str : I18n.getString("entity.Villager.name"); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + super.initGui(); + int var1 = (this.width - this.xSize) / 2; + int var2 = (this.height - this.ySize) / 2; + this.buttonList.add(this.nextRecipeButtonIndex = new GuiButtonMerchant(1, var1 + 120 + 27, var2 + 24 - 1, true)); + this.buttonList.add(this.previousRecipeButtonIndex = new GuiButtonMerchant(2, var1 + 36 - 19, var2 + 24 - 1, false)); + this.nextRecipeButtonIndex.enabled = false; + this.previousRecipeButtonIndex.enabled = false; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + this.fontRenderer.drawString(this.field_94082_v, this.xSize / 2 - this.fontRenderer.getStringWidth(this.field_94082_v) / 2, 6, 4210752); + this.fontRenderer.drawString(I18n.getString("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + MerchantRecipeList var1 = this.theIMerchant.getRecipes(this.mc.thePlayer); + + if (var1 != null) + { + this.nextRecipeButtonIndex.enabled = this.currentRecipeIndex < var1.size() - 1; + this.previousRecipeButtonIndex.enabled = this.currentRecipeIndex > 0; + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + boolean var2 = false; + + if (par1GuiButton == this.nextRecipeButtonIndex) + { + ++this.currentRecipeIndex; + var2 = true; + } + else if (par1GuiButton == this.previousRecipeButtonIndex) + { + --this.currentRecipeIndex; + var2 = true; + } + + if (var2) + { + ((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.currentRecipeIndex); + ByteArrayOutputStream var3 = new ByteArrayOutputStream(); + DataOutputStream var4 = new DataOutputStream(var3); + + try + { + var4.writeInt(this.currentRecipeIndex); + this.mc.getNetHandler().addToSendQueue(new Packet250CustomPayload("MC|TrSel", var3.toByteArray())); + } + catch (Exception var6) + { + var6.printStackTrace(); + } + } + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(merchantGuiTextures); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.ySize); + MerchantRecipeList var6 = this.theIMerchant.getRecipes(this.mc.thePlayer); + + if (var6 != null && !var6.isEmpty()) + { + int var7 = this.currentRecipeIndex; + MerchantRecipe var8 = (MerchantRecipe)var6.get(var7); + + if (var8.func_82784_g()) + { + this.mc.getTextureManager().bindTexture(merchantGuiTextures); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 21, 212, 0, 28, 21); + this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 51, 212, 0, 28, 21); + } + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + super.drawScreen(par1, par2, par3); + MerchantRecipeList var4 = this.theIMerchant.getRecipes(this.mc.thePlayer); + + if (var4 != null && !var4.isEmpty()) + { + int var5 = (this.width - this.xSize) / 2; + int var6 = (this.height - this.ySize) / 2; + int var7 = this.currentRecipeIndex; + MerchantRecipe var8 = (MerchantRecipe)var4.get(var7); + GL11.glPushMatrix(); + ItemStack var9 = var8.getItemToBuy(); + ItemStack var10 = var8.getSecondItemToBuy(); + ItemStack var11 = var8.getItemToSell(); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glEnable(GL11.GL_LIGHTING); + itemRenderer.zLevel = 100.0F; + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), var9, var5 + 36, var6 + 24); + itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.getTextureManager(), var9, var5 + 36, var6 + 24); + + if (var10 != null) + { + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), var10, var5 + 62, var6 + 24); + itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.getTextureManager(), var10, var5 + 62, var6 + 24); + } + + itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), var11, var5 + 120, var6 + 24); + itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.getTextureManager(), var11, var5 + 120, var6 + 24); + itemRenderer.zLevel = 0.0F; + GL11.glDisable(GL11.GL_LIGHTING); + + if (this.isPointInRegion(36, 24, 16, 16, par1, par2)) + { + this.drawItemStackTooltip(var9, par1, par2); + } + else if (var10 != null && this.isPointInRegion(62, 24, 16, 16, par1, par2)) + { + this.drawItemStackTooltip(var10, par1, par2); + } + else if (this.isPointInRegion(120, 24, 16, 16, par1, par2)) + { + this.drawItemStackTooltip(var11, par1, par2); + } + + GL11.glPopMatrix(); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_DEPTH_TEST); + RenderHelper.enableStandardItemLighting(); + } + } + + /** + * Gets the Instance of IMerchant interface. + */ + public IMerchant getIMerchant() + { + return this.theIMerchant; + } + + static ResourceLocation func_110417_h() + { + return merchantGuiTextures; + } +} diff --git a/src/main/java/net/minecraft/src/GuiMultiplayer.java b/src/main/java/net/minecraft/src/GuiMultiplayer.java new file mode 100644 index 0000000..099c892 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiMultiplayer.java @@ -0,0 +1,602 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.util.Collections; +import java.util.List; +import org.lwjgl.input.Keyboard; + +public class GuiMultiplayer extends GuiScreen +{ + /** Number of outstanding ThreadPollServers threads */ + private static int threadsPending; + + /** Lock object for use with synchronized() */ + private static Object lock = new Object(); + + /** + * A reference to the screen object that created this. Used for navigating between screens. + */ + private GuiScreen parentScreen; + + /** Slot container for the server list */ + private GuiSlotServer serverSlotContainer; + private ServerList internetServerList; + + /** Index of the currently selected server */ + private int selectedServer = -1; + private GuiButton field_96289_p; + + /** The 'Join Server' button */ + private GuiButton buttonSelect; + + /** The 'Delete' button */ + private GuiButton buttonDelete; + + /** The 'Delete' button was clicked */ + private boolean deleteClicked; + + /** The 'Add server' button was clicked */ + private boolean addClicked; + + /** The 'Edit' button was clicked */ + private boolean editClicked; + + /** The 'Direct Connect' button was clicked */ + private boolean directClicked; + + /** This GUI's lag tooltip text or null if no lag icon is being hovered. */ + private String lagTooltip; + + /** Instance of ServerData. */ + private ServerData theServerData; + private LanServerList localNetworkServerList; + private ThreadLanServerFind localServerFindThread; + + /** How many ticks this Gui is already opened */ + private int ticksOpened; + private boolean field_74024_A; + private List listofLanServers = Collections.emptyList(); + + public GuiMultiplayer(GuiScreen par1GuiScreen) + { + this.parentScreen = par1GuiScreen; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + + if (!this.field_74024_A) + { + this.field_74024_A = true; + this.internetServerList = new ServerList(this.mc); + this.internetServerList.loadServerList(); + this.localNetworkServerList = new LanServerList(); + + try + { + this.localServerFindThread = new ThreadLanServerFind(this.localNetworkServerList); + this.localServerFindThread.start(); + } + catch (Exception var2) + { + this.mc.getLogAgent().logWarning("Unable to start LAN server detection: " + var2.getMessage()); + } + + this.serverSlotContainer = new GuiSlotServer(this); + } + else + { + this.serverSlotContainer.func_77207_a(this.width, this.height, 32, this.height - 64); + } + + this.initGuiControls(); + } + + /** + * Populate the GuiScreen controlList + */ + public void initGuiControls() + { + this.buttonList.add(this.field_96289_p = new GuiButton(7, this.width / 2 - 154, this.height - 28, 70, 20, I18n.getString("selectServer.edit"))); + this.buttonList.add(this.buttonDelete = new GuiButton(2, this.width / 2 - 74, this.height - 28, 70, 20, I18n.getString("selectServer.delete"))); + this.buttonList.add(this.buttonSelect = new GuiButton(1, this.width / 2 - 154, this.height - 52, 100, 20, I18n.getString("selectServer.select"))); + this.buttonList.add(new GuiButton(4, this.width / 2 - 50, this.height - 52, 100, 20, I18n.getString("selectServer.direct"))); + this.buttonList.add(new GuiButton(3, this.width / 2 + 4 + 50, this.height - 52, 100, 20, I18n.getString("selectServer.add"))); + this.buttonList.add(new GuiButton(8, this.width / 2 + 4, this.height - 28, 70, 20, I18n.getString("selectServer.refresh"))); + this.buttonList.add(new GuiButton(0, this.width / 2 + 4 + 76, this.height - 28, 75, 20, I18n.getString("gui.cancel"))); + boolean var1 = this.selectedServer >= 0 && this.selectedServer < this.serverSlotContainer.getSize(); + this.buttonSelect.enabled = var1; + this.field_96289_p.enabled = var1; + this.buttonDelete.enabled = var1; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + ++this.ticksOpened; + + if (this.localNetworkServerList.getWasUpdated()) + { + this.listofLanServers = this.localNetworkServerList.getLanServers(); + this.localNetworkServerList.setWasNotUpdated(); + } + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + + if (this.localServerFindThread != null) + { + this.localServerFindThread.interrupt(); + this.localServerFindThread = null; + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 2) + { + String var2 = this.internetServerList.getServerData(this.selectedServer).serverName; + + if (var2 != null) + { + this.deleteClicked = true; + String var3 = I18n.getString("selectServer.deleteQuestion"); + String var4 = "\'" + var2 + "\' " + I18n.getString("selectServer.deleteWarning"); + String var5 = I18n.getString("selectServer.deleteButton"); + String var6 = I18n.getString("gui.cancel"); + GuiYesNo var7 = new GuiYesNo(this, var3, var4, var5, var6, this.selectedServer); + this.mc.displayGuiScreen(var7); + } + } + else if (par1GuiButton.id == 1) + { + this.joinServer(this.selectedServer); + } + else if (par1GuiButton.id == 4) + { + this.directClicked = true; + this.mc.displayGuiScreen(new GuiScreenServerList(this, this.theServerData = new ServerData(I18n.getString("selectServer.defaultName"), ""))); + } + else if (par1GuiButton.id == 3) + { + this.addClicked = true; + this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.theServerData = new ServerData(I18n.getString("selectServer.defaultName"), ""))); + } + else if (par1GuiButton.id == 7) + { + this.editClicked = true; + ServerData var8 = this.internetServerList.getServerData(this.selectedServer); + this.theServerData = new ServerData(var8.serverName, var8.serverIP); + this.theServerData.setHideAddress(var8.isHidingAddress()); + this.mc.displayGuiScreen(new GuiScreenAddServer(this, this.theServerData)); + } + else if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(this.parentScreen); + } + else if (par1GuiButton.id == 8) + { + this.mc.displayGuiScreen(new GuiMultiplayer(this.parentScreen)); + } + else + { + this.serverSlotContainer.actionPerformed(par1GuiButton); + } + } + } + + public void confirmClicked(boolean par1, int par2) + { + if (this.deleteClicked) + { + this.deleteClicked = false; + + if (par1) + { + this.internetServerList.removeServerData(par2); + this.internetServerList.saveServerList(); + this.selectedServer = -1; + } + + this.mc.displayGuiScreen(this); + } + else if (this.directClicked) + { + this.directClicked = false; + + if (par1) + { + this.connectToServer(this.theServerData); + } + else + { + this.mc.displayGuiScreen(this); + } + } + else if (this.addClicked) + { + this.addClicked = false; + + if (par1) + { + this.internetServerList.addServerData(this.theServerData); + this.internetServerList.saveServerList(); + this.selectedServer = -1; + } + + this.mc.displayGuiScreen(this); + } + else if (this.editClicked) + { + this.editClicked = false; + + if (par1) + { + ServerData var3 = this.internetServerList.getServerData(this.selectedServer); + var3.serverName = this.theServerData.serverName; + var3.serverIP = this.theServerData.serverIP; + var3.setHideAddress(this.theServerData.isHidingAddress()); + this.internetServerList.saveServerList(); + } + + this.mc.displayGuiScreen(this); + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + int var3 = this.selectedServer; + + if (par2 == 59) + { + this.mc.gameSettings.hideServerAddress = !this.mc.gameSettings.hideServerAddress; + this.mc.gameSettings.saveOptions(); + } + else + { + if (isShiftKeyDown() && par2 == 200) + { + if (var3 > 0 && var3 < this.internetServerList.countServers()) + { + this.internetServerList.swapServers(var3, var3 - 1); + --this.selectedServer; + + if (var3 < this.internetServerList.countServers() - 1) + { + this.serverSlotContainer.func_77208_b(-this.serverSlotContainer.slotHeight); + } + } + } + else if (isShiftKeyDown() && par2 == 208) + { + if (var3 >= 0 & var3 < this.internetServerList.countServers() - 1) + { + this.internetServerList.swapServers(var3, var3 + 1); + ++this.selectedServer; + + if (var3 > 0) + { + this.serverSlotContainer.func_77208_b(this.serverSlotContainer.slotHeight); + } + } + } + else if (par2 != 28 && par2 != 156) + { + super.keyTyped(par1, par2); + } + else + { + this.actionPerformed((GuiButton)this.buttonList.get(2)); + } + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.lagTooltip = null; + this.drawDefaultBackground(); + this.serverSlotContainer.drawScreen(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, I18n.getString("multiplayer.title"), this.width / 2, 20, 16777215); + super.drawScreen(par1, par2, par3); + + if (this.lagTooltip != null) + { + this.func_74007_a(this.lagTooltip, par1, par2); + } + } + + /** + * Join server by slot index + */ + private void joinServer(int par1) + { + if (par1 < this.internetServerList.countServers()) + { + this.connectToServer(this.internetServerList.getServerData(par1)); + } + else + { + par1 -= this.internetServerList.countServers(); + + if (par1 < this.listofLanServers.size()) + { + LanServer var2 = (LanServer)this.listofLanServers.get(par1); + this.connectToServer(new ServerData(var2.getServerMotd(), var2.getServerIpPort())); + } + } + } + + private void connectToServer(ServerData par1ServerData) + { + this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, par1ServerData)); + } + + private static void func_74017_b(ServerData par0ServerData) throws IOException + { + ServerAddress var1 = ServerAddress.func_78860_a(par0ServerData.serverIP); + Socket var2 = null; + DataInputStream var3 = null; + DataOutputStream var4 = null; + + try + { + var2 = new Socket(); + var2.setSoTimeout(3000); + var2.setTcpNoDelay(true); + var2.setTrafficClass(18); + var2.connect(new InetSocketAddress(var1.getIP(), var1.getPort()), 3000); + var3 = new DataInputStream(var2.getInputStream()); + var4 = new DataOutputStream(var2.getOutputStream()); + Packet254ServerPing var5 = new Packet254ServerPing(78, var1.getIP(), var1.getPort()); + var4.writeByte(var5.getPacketId()); + var5.writePacketData(var4); + + if (var3.read() != 255) + { + throw new IOException("Bad message"); + } + + String var6 = Packet.readString(var3, 256); + char[] var7 = var6.toCharArray(); + + for (int var8 = 0; var8 < var7.length; ++var8) + { + if (var7[var8] != 167 && var7[var8] != 0 && ChatAllowedCharacters.allowedCharacters.indexOf(var7[var8]) < 0) + { + var7[var8] = 63; + } + } + + var6 = new String(var7); + int var9; + int var10; + String[] var27; + + if (var6.startsWith("\u00a7") && var6.length() > 1) + { + var27 = var6.substring(1).split("\u0000"); + + if (MathHelper.parseIntWithDefault(var27[0], 0) == 1) + { + par0ServerData.serverMOTD = var27[3]; + par0ServerData.field_82821_f = MathHelper.parseIntWithDefault(var27[1], par0ServerData.field_82821_f); + par0ServerData.gameVersion = var27[2]; + var9 = MathHelper.parseIntWithDefault(var27[4], 0); + var10 = MathHelper.parseIntWithDefault(var27[5], 0); + + if (var9 >= 0 && var10 >= 0) + { + par0ServerData.populationInfo = EnumChatFormatting.GRAY + "" + var9 + "" + EnumChatFormatting.DARK_GRAY + "/" + EnumChatFormatting.GRAY + var10; + } + else + { + par0ServerData.populationInfo = "" + EnumChatFormatting.DARK_GRAY + "???"; + } + } + else + { + par0ServerData.gameVersion = "???"; + par0ServerData.serverMOTD = "" + EnumChatFormatting.DARK_GRAY + "???"; + par0ServerData.field_82821_f = 79; + par0ServerData.populationInfo = "" + EnumChatFormatting.DARK_GRAY + "???"; + } + } + else + { + var27 = var6.split("\u00a7"); + var6 = var27[0]; + var9 = -1; + var10 = -1; + + try + { + var9 = Integer.parseInt(var27[1]); + var10 = Integer.parseInt(var27[2]); + } + catch (Exception var25) + { + ; + } + + par0ServerData.serverMOTD = EnumChatFormatting.GRAY + var6; + + if (var9 >= 0 && var10 > 0) + { + par0ServerData.populationInfo = EnumChatFormatting.GRAY + "" + var9 + "" + EnumChatFormatting.DARK_GRAY + "/" + EnumChatFormatting.GRAY + var10; + } + else + { + par0ServerData.populationInfo = "" + EnumChatFormatting.DARK_GRAY + "???"; + } + + par0ServerData.gameVersion = "1.3"; + par0ServerData.field_82821_f = 77; + } + } + finally + { + try + { + if (var3 != null) + { + var3.close(); + } + } + catch (Throwable var24) + { + ; + } + + try + { + if (var4 != null) + { + var4.close(); + } + } + catch (Throwable var23) + { + ; + } + + try + { + if (var2 != null) + { + var2.close(); + } + } + catch (Throwable var22) + { + ; + } + } + } + + protected void func_74007_a(String par1Str, int par2, int par3) + { + if (par1Str != null) + { + int var4 = par2 + 12; + int var5 = par3 - 12; + int var6 = this.fontRenderer.getStringWidth(par1Str); + this.drawGradientRect(var4 - 3, var5 - 3, var4 + var6 + 3, var5 + 8 + 3, -1073741824, -1073741824); + this.fontRenderer.drawStringWithShadow(par1Str, var4, var5, -1); + } + } + + static ServerList getInternetServerList(GuiMultiplayer par0GuiMultiplayer) + { + return par0GuiMultiplayer.internetServerList; + } + + static List getListOfLanServers(GuiMultiplayer par0GuiMultiplayer) + { + return par0GuiMultiplayer.listofLanServers; + } + + static int getSelectedServer(GuiMultiplayer par0GuiMultiplayer) + { + return par0GuiMultiplayer.selectedServer; + } + + static int getAndSetSelectedServer(GuiMultiplayer par0GuiMultiplayer, int par1) + { + return par0GuiMultiplayer.selectedServer = par1; + } + + /** + * Return buttonSelect GuiButton + */ + static GuiButton getButtonSelect(GuiMultiplayer par0GuiMultiplayer) + { + return par0GuiMultiplayer.buttonSelect; + } + + /** + * Return buttonEdit GuiButton + */ + static GuiButton getButtonEdit(GuiMultiplayer par0GuiMultiplayer) + { + return par0GuiMultiplayer.field_96289_p; + } + + /** + * Return buttonDelete GuiButton + */ + static GuiButton getButtonDelete(GuiMultiplayer par0GuiMultiplayer) + { + return par0GuiMultiplayer.buttonDelete; + } + + static void func_74008_b(GuiMultiplayer par0GuiMultiplayer, int par1) + { + par0GuiMultiplayer.joinServer(par1); + } + + static int getTicksOpened(GuiMultiplayer par0GuiMultiplayer) + { + return par0GuiMultiplayer.ticksOpened; + } + + /** + * Returns the lock object for use with synchronized() + */ + static Object getLock() + { + return lock; + } + + static int getThreadsPending() + { + return threadsPending; + } + + static int increaseThreadsPending() + { + return threadsPending++; + } + + static void func_82291_a(ServerData par0ServerData) throws IOException + { + func_74017_b(par0ServerData); + } + + static int decreaseThreadsPending() + { + return threadsPending--; + } + + static String getAndSetLagTooltip(GuiMultiplayer par0GuiMultiplayer, String par1Str) + { + return par0GuiMultiplayer.lagTooltip = par1Str; + } +} diff --git a/src/main/java/net/minecraft/src/GuiNewChat.java b/src/main/java/net/minecraft/src/GuiNewChat.java new file mode 100644 index 0000000..0c60049 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiNewChat.java @@ -0,0 +1,386 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import org.lwjgl.opengl.GL11; + +public class GuiNewChat extends Gui +{ + /** The Minecraft instance. */ + private final Minecraft mc; + + /** A list of messages previously sent through the chat GUI */ + private final List sentMessages = new ArrayList(); + + /** Chat lines to be displayed in the chat box */ + private final List chatLines = new ArrayList(); + private final List field_96134_d = new ArrayList(); + private int field_73768_d; + private boolean field_73769_e; + + public GuiNewChat(Minecraft par1Minecraft) + { + this.mc = par1Minecraft; + } + + public void drawChat(int par1) + { + if (this.mc.gameSettings.chatVisibility != 2) + { + int var2 = this.func_96127_i(); + boolean var3 = false; + int var4 = 0; + int var5 = this.field_96134_d.size(); + float var6 = this.mc.gameSettings.chatOpacity * 0.9F + 0.1F; + + if (var5 > 0) + { + if (this.getChatOpen()) + { + var3 = true; + } + + float var7 = this.func_96131_h(); + int var8 = MathHelper.ceiling_float_int((float)this.func_96126_f() / var7); + GL11.glPushMatrix(); + GL11.glTranslatef(2.0F, 20.0F, 0.0F); + GL11.glScalef(var7, var7, 1.0F); + int var9; + int var11; + int var14; + + for (var9 = 0; var9 + this.field_73768_d < this.field_96134_d.size() && var9 < var2; ++var9) + { + ChatLine var10 = (ChatLine)this.field_96134_d.get(var9 + this.field_73768_d); + + if (var10 != null) + { + var11 = par1 - var10.getUpdatedCounter(); + + if (var11 < 200 || var3) + { + double var12 = (double)var11 / 200.0D; + var12 = 1.0D - var12; + var12 *= 10.0D; + + if (var12 < 0.0D) + { + var12 = 0.0D; + } + + if (var12 > 1.0D) + { + var12 = 1.0D; + } + + var12 *= var12; + var14 = (int)(255.0D * var12); + + if (var3) + { + var14 = 255; + } + + var14 = (int)((float)var14 * var6); + ++var4; + + if (var14 > 3) + { + byte var15 = 0; + int var16 = -var9 * 9; + drawRect(var15, var16 - 9, var15 + var8 + 4, var16, var14 / 2 << 24); + GL11.glEnable(GL11.GL_BLEND); + String var17 = var10.getChatLineString(); + + if (!this.mc.gameSettings.chatColours) + { + var17 = StringUtils.stripControlCodes(var17); + } + + this.mc.fontRenderer.drawStringWithShadow(var17, var15, var16 - 8, 16777215 + (var14 << 24)); + } + } + } + } + + if (var3) + { + var9 = this.mc.fontRenderer.FONT_HEIGHT; + GL11.glTranslatef(-3.0F, 0.0F, 0.0F); + int var18 = var5 * var9 + var5; + var11 = var4 * var9 + var4; + int var19 = this.field_73768_d * var11 / var5; + int var13 = var11 * var11 / var18; + + if (var18 != var11) + { + var14 = var19 > 0 ? 170 : 96; + int var20 = this.field_73769_e ? 13382451 : 3355562; + drawRect(0, -var19, 2, -var19 - var13, var20 + (var14 << 24)); + drawRect(2, -var19, 1, -var19 - var13, 13421772 + (var14 << 24)); + } + } + + GL11.glPopMatrix(); + } + } + } + + /** + * Clears the chat. + */ + public void clearChatMessages() + { + this.field_96134_d.clear(); + this.chatLines.clear(); + this.sentMessages.clear(); + } + + /** + * takes a String and prints it to chat + */ + public void printChatMessage(String par1Str) + { + this.printChatMessageWithOptionalDeletion(par1Str, 0); + } + + /** + * prints the String to Chat. If the ID is not 0, deletes an existing Chat Line of that ID from the GUI + */ + public void printChatMessageWithOptionalDeletion(String par1Str, int par2) + { + this.func_96129_a(par1Str, par2, this.mc.ingameGUI.getUpdateCounter(), false); + this.mc.getLogAgent().logInfo("[CHAT] " + EnumChatFormatting.func_110646_a(par1Str)); + } + + private void func_96129_a(String par1Str, int par2, int par3, boolean par4) + { + boolean var5 = this.getChatOpen(); + boolean var6 = true; + + if (par2 != 0) + { + this.deleteChatLine(par2); + } + + Iterator var7 = this.mc.fontRenderer.listFormattedStringToWidth(par1Str, MathHelper.floor_float((float)this.func_96126_f() / this.func_96131_h())).iterator(); + + while (var7.hasNext()) + { + String var8 = (String)var7.next(); + + if (var5 && this.field_73768_d > 0) + { + this.field_73769_e = true; + this.scroll(1); + } + + if (!var6) + { + var8 = " " + var8; + } + + var6 = false; + this.field_96134_d.add(0, new ChatLine(par3, var8, par2)); + } + + while (this.field_96134_d.size() > 100) + { + this.field_96134_d.remove(this.field_96134_d.size() - 1); + } + + if (!par4) + { + this.chatLines.add(0, new ChatLine(par3, par1Str.trim(), par2)); + + while (this.chatLines.size() > 100) + { + this.chatLines.remove(this.chatLines.size() - 1); + } + } + } + + public void func_96132_b() + { + this.field_96134_d.clear(); + this.resetScroll(); + + for (int var1 = this.chatLines.size() - 1; var1 >= 0; --var1) + { + ChatLine var2 = (ChatLine)this.chatLines.get(var1); + this.func_96129_a(var2.getChatLineString(), var2.getChatLineID(), var2.getUpdatedCounter(), true); + } + } + + /** + * Gets the list of messages previously sent through the chat GUI + */ + public List getSentMessages() + { + return this.sentMessages; + } + + /** + * Adds this string to the list of sent messages, for recall using the up/down arrow keys + */ + public void addToSentMessages(String par1Str) + { + if (this.sentMessages.isEmpty() || !((String)this.sentMessages.get(this.sentMessages.size() - 1)).equals(par1Str)) + { + this.sentMessages.add(par1Str); + } + } + + /** + * Resets the chat scroll (executed when the GUI is closed) + */ + public void resetScroll() + { + this.field_73768_d = 0; + this.field_73769_e = false; + } + + /** + * Scrolls the chat by the given number of lines. + */ + public void scroll(int par1) + { + this.field_73768_d += par1; + int var2 = this.field_96134_d.size(); + + if (this.field_73768_d > var2 - this.func_96127_i()) + { + this.field_73768_d = var2 - this.func_96127_i(); + } + + if (this.field_73768_d <= 0) + { + this.field_73768_d = 0; + this.field_73769_e = false; + } + } + + public ChatClickData func_73766_a(int par1, int par2) + { + if (!this.getChatOpen()) + { + return null; + } + else + { + ScaledResolution var3 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + int var4 = var3.getScaleFactor(); + float var5 = this.func_96131_h(); + int var6 = par1 / var4 - 3; + int var7 = par2 / var4 - 25; + var6 = MathHelper.floor_float((float)var6 / var5); + var7 = MathHelper.floor_float((float)var7 / var5); + + if (var6 >= 0 && var7 >= 0) + { + int var8 = Math.min(this.func_96127_i(), this.field_96134_d.size()); + + if (var6 <= MathHelper.floor_float((float)this.func_96126_f() / this.func_96131_h()) && var7 < this.mc.fontRenderer.FONT_HEIGHT * var8 + var8) + { + int var9 = var7 / (this.mc.fontRenderer.FONT_HEIGHT + 1) + this.field_73768_d; + return new ChatClickData(this.mc.fontRenderer, (ChatLine)this.field_96134_d.get(var9), var6, var7 - (var9 - this.field_73768_d) * this.mc.fontRenderer.FONT_HEIGHT + var9); + } + else + { + return null; + } + } + else + { + return null; + } + } + } + + /** + * Adds a message to the chat after translating to the client's locale. + */ + public void addTranslatedMessage(String par1Str, Object ... par2ArrayOfObj) + { + this.printChatMessage(I18n.getStringParams(par1Str, par2ArrayOfObj)); + } + + /** + * @return {@code true} if the chat GUI is open + */ + public boolean getChatOpen() + { + return this.mc.currentScreen instanceof GuiChat; + } + + /** + * finds and deletes a Chat line by ID + */ + public void deleteChatLine(int par1) + { + Iterator var2 = this.field_96134_d.iterator(); + ChatLine var3; + + do + { + if (!var2.hasNext()) + { + var2 = this.chatLines.iterator(); + + do + { + if (!var2.hasNext()) + { + return; + } + + var3 = (ChatLine)var2.next(); + } + while (var3.getChatLineID() != par1); + + var2.remove(); + return; + } + + var3 = (ChatLine)var2.next(); + } + while (var3.getChatLineID() != par1); + + var2.remove(); + } + + public int func_96126_f() + { + return func_96128_a(this.mc.gameSettings.chatWidth); + } + + public int func_96133_g() + { + return func_96130_b(this.getChatOpen() ? this.mc.gameSettings.chatHeightFocused : this.mc.gameSettings.chatHeightUnfocused); + } + + public float func_96131_h() + { + return this.mc.gameSettings.chatScale; + } + + public static final int func_96128_a(float par0) + { + short var1 = 320; + byte var2 = 40; + return MathHelper.floor_float(par0 * (float)(var1 - var2) + (float)var2); + } + + public static final int func_96130_b(float par0) + { + short var1 = 180; + byte var2 = 20; + return MathHelper.floor_float(par0 * (float)(var1 - var2) + (float)var2); + } + + public int func_96127_i() + { + return this.func_96133_g() / 9; + } +} diff --git a/src/main/java/net/minecraft/src/GuiOptions.java b/src/main/java/net/minecraft/src/GuiOptions.java new file mode 100644 index 0000000..ebf850d --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiOptions.java @@ -0,0 +1,136 @@ +package net.minecraft.src; + +public class GuiOptions extends GuiScreen +{ + /** + * An array of options that can be changed directly from the options GUI. + */ + private static final EnumOptions[] relevantOptions = new EnumOptions[] {EnumOptions.MUSIC, EnumOptions.SOUND, EnumOptions.INVERT_MOUSE, EnumOptions.SENSITIVITY, EnumOptions.FOV, EnumOptions.DIFFICULTY, EnumOptions.TOUCHSCREEN}; + + /** + * A reference to the screen object that created this. Used for navigating between screens. + */ + private final GuiScreen parentScreen; + + /** Reference to the GameSettings object. */ + private final GameSettings options; + + /** The title string that is displayed in the top-center of the screen. */ + protected String screenTitle = "Options"; + + public GuiOptions(GuiScreen par1GuiScreen, GameSettings par2GameSettings) + { + this.parentScreen = par1GuiScreen; + this.options = par2GameSettings; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + int var1 = 0; + this.screenTitle = I18n.getString("options.title"); + EnumOptions[] var2 = relevantOptions; + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + EnumOptions var5 = var2[var4]; + + if (var5.getEnumFloat()) + { + this.buttonList.add(new GuiSlider(var5.returnEnumOrdinal(), this.width / 2 - 155 + var1 % 2 * 160, this.height / 6 - 12 + 24 * (var1 >> 1), var5, this.options.getKeyBinding(var5), this.options.getOptionFloatValue(var5))); + } + else + { + GuiSmallButton var6 = new GuiSmallButton(var5.returnEnumOrdinal(), this.width / 2 - 155 + var1 % 2 * 160, this.height / 6 - 12 + 24 * (var1 >> 1), var5, this.options.getKeyBinding(var5)); + + if (var5 == EnumOptions.DIFFICULTY && this.mc.theWorld != null && this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) + { + var6.enabled = false; + var6.displayString = I18n.getString("options.difficulty") + ": " + I18n.getString("options.difficulty.hardcore"); + } + + this.buttonList.add(var6); + } + + ++var1; + } + + this.buttonList.add(new GuiButton(101, this.width / 2 - 152, this.height / 6 + 96 - 6, 150, 20, I18n.getString("options.video"))); + this.buttonList.add(new GuiButton(100, this.width / 2 + 2, this.height / 6 + 96 - 6, 150, 20, I18n.getString("options.controls"))); + this.buttonList.add(new GuiButton(102, this.width / 2 - 152, this.height / 6 + 120 - 6, 150, 20, I18n.getString("options.language"))); + this.buttonList.add(new GuiButton(103, this.width / 2 + 2, this.height / 6 + 120 - 6, 150, 20, I18n.getString("options.multiplayer.title"))); + this.buttonList.add(new GuiButton(105, this.width / 2 - 152, this.height / 6 + 144 - 6, 150, 20, I18n.getString("options.resourcepack"))); + this.buttonList.add(new GuiButton(104, this.width / 2 + 2, this.height / 6 + 144 - 6, 150, 20, I18n.getString("options.snooper.view"))); + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.getString("gui.done"))); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id < 100 && par1GuiButton instanceof GuiSmallButton) + { + this.options.setOptionValue(((GuiSmallButton)par1GuiButton).returnEnumOptions(), 1); + par1GuiButton.displayString = this.options.getKeyBinding(EnumOptions.getEnumOptions(par1GuiButton.id)); + } + + if (par1GuiButton.id == 101) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiVideoSettings(this, this.options)); + } + + if (par1GuiButton.id == 100) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiControls(this, this.options)); + } + + if (par1GuiButton.id == 102) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiLanguage(this, this.options, this.mc.getLanguageManager())); + } + + if (par1GuiButton.id == 103) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new ScreenChatOptions(this, this.options)); + } + + if (par1GuiButton.id == 104) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiSnooper(this, this.options)); + } + + if (par1GuiButton.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.parentScreen); + } + + if (par1GuiButton.id == 105) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(new GuiScreenTemporaryResourcePackSelect(this, this.options)); + } + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 15, 16777215); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiPlayerInfo.java b/src/main/java/net/minecraft/src/GuiPlayerInfo.java new file mode 100644 index 0000000..84b1a27 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiPlayerInfo.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class GuiPlayerInfo +{ + /** The string value of the object */ + public final String name; + + /** Player name in lowercase. */ + private final String nameinLowerCase; + + /** Player response time to server in milliseconds */ + public int responseTime; + + public GuiPlayerInfo(String par1Str) + { + this.name = par1Str; + this.nameinLowerCase = par1Str.toLowerCase(); + } +} diff --git a/src/main/java/net/minecraft/src/GuiRenameWorld.java b/src/main/java/net/minecraft/src/GuiRenameWorld.java new file mode 100644 index 0000000..5bb18ba --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiRenameWorld.java @@ -0,0 +1,104 @@ +package net.minecraft.src; + +import org.lwjgl.input.Keyboard; + +public class GuiRenameWorld extends GuiScreen +{ + private GuiScreen parentGuiScreen; + private GuiTextField theGuiTextField; + private final String worldName; + + public GuiRenameWorld(GuiScreen par1GuiScreen, String par2Str) + { + this.parentGuiScreen = par1GuiScreen; + this.worldName = par2Str; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.theGuiTextField.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.getString("selectWorld.renameButton"))); + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.getString("gui.cancel"))); + ISaveFormat var1 = this.mc.getSaveLoader(); + WorldInfo var2 = var1.getWorldInfo(this.worldName); + String var3 = var2.getWorldName(); + this.theGuiTextField = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 60, 200, 20); + this.theGuiTextField.setFocused(true); + this.theGuiTextField.setText(var3); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 1) + { + this.mc.displayGuiScreen(this.parentGuiScreen); + } + else if (par1GuiButton.id == 0) + { + ISaveFormat var2 = this.mc.getSaveLoader(); + var2.renameWorld(this.worldName, this.theGuiTextField.getText().trim()); + this.mc.displayGuiScreen(this.parentGuiScreen); + } + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + this.theGuiTextField.textboxKeyTyped(par1, par2); + ((GuiButton)this.buttonList.get(0)).enabled = this.theGuiTextField.getText().trim().length() > 0; + + if (par2 == 28 || par2 == 156) + { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + this.theGuiTextField.mouseClicked(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, I18n.getString("selectWorld.renameTitle"), this.width / 2, 20, 16777215); + this.drawString(this.fontRenderer, I18n.getString("selectWorld.enterName"), this.width / 2 - 100, 47, 10526880); + this.theGuiTextField.drawTextBox(); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiRepair.java b/src/main/java/net/minecraft/src/GuiRepair.java new file mode 100644 index 0000000..ec49cfd --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiRepair.java @@ -0,0 +1,197 @@ +package net.minecraft.src; + +import java.util.List; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +public class GuiRepair extends GuiContainer implements ICrafting +{ + private static final ResourceLocation anvilGuiTextures = new ResourceLocation("textures/gui/container/anvil.png"); + private ContainerRepair repairContainer; + private GuiTextField itemNameField; + private InventoryPlayer field_82325_q; + + public GuiRepair(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) + { + super(new ContainerRepair(par1InventoryPlayer, par2World, par3, par4, par5, Minecraft.getMinecraft().thePlayer)); + this.field_82325_q = par1InventoryPlayer; + this.repairContainer = (ContainerRepair)this.inventorySlots; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + super.initGui(); + Keyboard.enableRepeatEvents(true); + int var1 = (this.width - this.xSize) / 2; + int var2 = (this.height - this.ySize) / 2; + this.itemNameField = new GuiTextField(this.fontRenderer, var1 + 62, var2 + 24, 103, 12); + this.itemNameField.setTextColor(-1); + this.itemNameField.setDisabledTextColour(-1); + this.itemNameField.setEnableBackgroundDrawing(false); + this.itemNameField.setMaxStringLength(40); + this.inventorySlots.removeCraftingFromCrafters(this); + this.inventorySlots.addCraftingToCrafters(this); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + super.onGuiClosed(); + Keyboard.enableRepeatEvents(false); + this.inventorySlots.removeCraftingFromCrafters(this); + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + GL11.glDisable(GL11.GL_LIGHTING); + this.fontRenderer.drawString(I18n.getString("container.repair"), 60, 6, 4210752); + + if (this.repairContainer.maximumCost > 0) + { + int var3 = 8453920; + boolean var4 = true; + String var5 = I18n.getStringParams("container.repair.cost", new Object[] {Integer.valueOf(this.repairContainer.maximumCost)}); + + if (this.repairContainer.maximumCost >= 40 && !this.mc.thePlayer.capabilities.isCreativeMode) + { + var5 = I18n.getString("container.repair.expensive"); + var3 = 16736352; + } + else if (!this.repairContainer.getSlot(2).getHasStack()) + { + var4 = false; + } + else if (!this.repairContainer.getSlot(2).canTakeStack(this.field_82325_q.player)) + { + var3 = 16736352; + } + + if (var4) + { + int var6 = -16777216 | (var3 & 16579836) >> 2 | var3 & -16777216; + int var7 = this.xSize - 8 - this.fontRenderer.getStringWidth(var5); + byte var8 = 67; + + if (this.fontRenderer.getUnicodeFlag()) + { + drawRect(var7 - 3, var8 - 2, this.xSize - 7, var8 + 10, -16777216); + drawRect(var7 - 2, var8 - 1, this.xSize - 8, var8 + 9, -12895429); + } + else + { + this.fontRenderer.drawString(var5, var7, var8 + 1, var6); + this.fontRenderer.drawString(var5, var7 + 1, var8, var6); + this.fontRenderer.drawString(var5, var7 + 1, var8 + 1, var6); + } + + this.fontRenderer.drawString(var5, var7, var8, var3); + } + } + + GL11.glEnable(GL11.GL_LIGHTING); + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (this.itemNameField.textboxKeyTyped(par1, par2)) + { + this.func_135015_g(); + } + else + { + super.keyTyped(par1, par2); + } + } + + private void func_135015_g() + { + String var1 = this.itemNameField.getText(); + Slot var2 = this.repairContainer.getSlot(0); + + if (var2 != null && var2.getHasStack() && !var2.getStack().hasDisplayName() && var1.equals(var2.getStack().getDisplayName())) + { + var1 = ""; + } + + this.repairContainer.updateItemName(var1); + this.mc.thePlayer.sendQueue.addToSendQueue(new Packet250CustomPayload("MC|ItemName", var1.getBytes())); + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + this.itemNameField.mouseClicked(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + super.drawScreen(par1, par2, par3); + GL11.glDisable(GL11.GL_LIGHTING); + this.itemNameField.drawTextBox(); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(anvilGuiTextures); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.ySize); + this.drawTexturedModalRect(var4 + 59, var5 + 20, 0, this.ySize + (this.repairContainer.getSlot(0).getHasStack() ? 0 : 16), 110, 16); + + if ((this.repairContainer.getSlot(0).getHasStack() || this.repairContainer.getSlot(1).getHasStack()) && !this.repairContainer.getSlot(2).getHasStack()) + { + this.drawTexturedModalRect(var4 + 99, var5 + 45, this.xSize, 0, 28, 21); + } + } + + public void sendContainerAndContentsToPlayer(Container par1Container, List par2List) + { + this.sendSlotContents(par1Container, 0, par1Container.getSlot(0).getStack()); + } + + /** + * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual + * contents of that slot. Args: Container, slot number, slot contents + */ + public void sendSlotContents(Container par1Container, int par2, ItemStack par3ItemStack) + { + if (par2 == 0) + { + this.itemNameField.setText(par3ItemStack == null ? "" : par3ItemStack.getDisplayName()); + this.itemNameField.setEnabled(par3ItemStack != null); + + if (par3ItemStack != null) + { + this.func_135015_g(); + } + } + } + + /** + * Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress, + * and enchanting level. Normally the first int identifies which variable to update, and the second contains the new + * value. Both are truncated to shorts in non-local SMP. + */ + public void sendProgressBarUpdate(Container par1Container, int par2, int par3) {} +} diff --git a/src/main/java/net/minecraft/src/GuiScreen.java b/src/main/java/net/minecraft/src/GuiScreen.java new file mode 100644 index 0000000..efb6533 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreen.java @@ -0,0 +1,311 @@ +package net.minecraft.src; + +import java.awt.Toolkit; +import java.awt.datatransfer.ClipboardOwner; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.util.ArrayList; +import java.util.List; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +public class GuiScreen extends Gui +{ + /** Reference to the Minecraft object. */ + protected Minecraft mc; + + /** The width of the screen object. */ + public int width; + + /** The height of the screen object. */ + public int height; + + /** A list of all the buttons in this container. */ + protected List buttonList = new ArrayList(); + public boolean allowUserInput; + + /** The FontRenderer used by GuiScreen */ + protected FontRenderer fontRenderer; + + /** The button that was just pressed. */ + private GuiButton selectedButton; + private int eventButton; + private long lastMouseEvent; + private int field_92018_d; + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + for (int var4 = 0; var4 < this.buttonList.size(); ++var4) + { + GuiButton var5 = (GuiButton)this.buttonList.get(var4); + var5.drawButton(this.mc, par1, par2); + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (par2 == 1) + { + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + } + } + + /** + * Returns a string stored in the system clipboard. + */ + public static String getClipboardString() + { + try + { + Transferable var0 = Toolkit.getDefaultToolkit().getSystemClipboard().getContents((Object)null); + + if (var0 != null && var0.isDataFlavorSupported(DataFlavor.stringFlavor)) + { + return (String)var0.getTransferData(DataFlavor.stringFlavor); + } + } + catch (Exception var1) + { + ; + } + + return ""; + } + + /** + * store a string in the system clipboard + */ + public static void setClipboardString(String par0Str) + { + try + { + StringSelection var1 = new StringSelection(par0Str); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(var1, (ClipboardOwner)null); + } + catch (Exception var2) + { + ; + } + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + if (par3 == 0) + { + for (int var4 = 0; var4 < this.buttonList.size(); ++var4) + { + GuiButton var5 = (GuiButton)this.buttonList.get(var4); + + if (var5.mousePressed(this.mc, par1, par2)) + { + this.selectedButton = var5; + this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F); + this.actionPerformed(var5); + } + } + } + } + + /** + * Called when the mouse is moved or a mouse button is released. Signature: (mouseX, mouseY, which) which==-1 is + * mouseMove, which==0 or which==1 is mouseUp + */ + protected void mouseMovedOrUp(int par1, int par2, int par3) + { + if (this.selectedButton != null && par3 == 0) + { + this.selectedButton.mouseReleased(par1, par2); + this.selectedButton = null; + } + } + + /** + * Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX, mouseY, + * lastButtonClicked & timeSinceMouseClick. + */ + protected void mouseClickMove(int par1, int par2, int par3, long par4) {} + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) {} + + /** + * Causes the screen to lay out its subcomponents again. This is the equivalent of the Java call + * Container.validate() + */ + public void setWorldAndResolution(Minecraft par1Minecraft, int par2, int par3) + { + this.mc = par1Minecraft; + this.fontRenderer = par1Minecraft.fontRenderer; + this.width = par2; + this.height = par3; + this.buttonList.clear(); + this.initGui(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() {} + + /** + * Delegates mouse and keyboard input. + */ + public void handleInput() + { + while (Mouse.next()) + { + this.handleMouseInput(); + } + + while (Keyboard.next()) + { + this.handleKeyboardInput(); + } + } + + /** + * Handles mouse input. + */ + public void handleMouseInput() + { + int var1 = Mouse.getEventX() * this.width / this.mc.displayWidth; + int var2 = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1; + int var3 = Mouse.getEventButton(); + + if (Minecraft.isRunningOnMac && var3 == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157))) + { + var3 = 1; + } + + if (Mouse.getEventButtonState()) + { + if (this.mc.gameSettings.touchscreen && this.field_92018_d++ > 0) + { + return; + } + + this.eventButton = var3; + this.lastMouseEvent = Minecraft.getSystemTime(); + this.mouseClicked(var1, var2, this.eventButton); + } + else if (var3 != -1) + { + if (this.mc.gameSettings.touchscreen && --this.field_92018_d > 0) + { + return; + } + + this.eventButton = -1; + this.mouseMovedOrUp(var1, var2, var3); + } + else if (this.eventButton != -1 && this.lastMouseEvent > 0L) + { + long var4 = Minecraft.getSystemTime() - this.lastMouseEvent; + this.mouseClickMove(var1, var2, this.eventButton, var4); + } + } + + /** + * Handles keyboard input. + */ + public void handleKeyboardInput() + { + if (Keyboard.getEventKeyState()) + { + int var1 = Keyboard.getEventKey(); + char var2 = Keyboard.getEventCharacter(); + + if (var1 == 87) + { + this.mc.toggleFullscreen(); + return; + } + + this.keyTyped(var2, var1); + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() {} + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() {} + + /** + * Draws either a gradient over the background screen (when it exists) or a flat gradient over background.png + */ + public void drawDefaultBackground() + { + this.drawWorldBackground(0); + } + + public void drawWorldBackground(int par1) + { + if (this.mc.theWorld != null) + { + this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680); + } + else + { + this.drawBackground(par1); + } + } + + /** + * Draws the background (i is always 0 as of 1.2.2) + */ + public void drawBackground(int par1) + { + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_FOG); + Tessellator var2 = Tessellator.instance; + this.mc.getTextureManager().bindTexture(optionsBackground); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var3 = 32.0F; + var2.startDrawingQuads(); + var2.setColorOpaque_I(4210752); + var2.addVertexWithUV(0.0D, (double)this.height, 0.0D, 0.0D, (double)((float)this.height / var3 + (float)par1)); + var2.addVertexWithUV((double)this.width, (double)this.height, 0.0D, (double)((float)this.width / var3), (double)((float)this.height / var3 + (float)par1)); + var2.addVertexWithUV((double)this.width, 0.0D, 0.0D, (double)((float)this.width / var3), (double)par1); + var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, (double)par1); + var2.draw(); + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return true; + } + + public void confirmClicked(boolean par1, int par2) {} + + public static boolean isCtrlKeyDown() + { + return Minecraft.isRunningOnMac ? Keyboard.isKeyDown(219) || Keyboard.isKeyDown(220) : Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157); + } + + public static boolean isShiftKeyDown() + { + return Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenAddServer.java b/src/main/java/net/minecraft/src/GuiScreenAddServer.java new file mode 100644 index 0000000..f57527e --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenAddServer.java @@ -0,0 +1,127 @@ +package net.minecraft.src; + +import org.lwjgl.input.Keyboard; + +public class GuiScreenAddServer extends GuiScreen +{ + /** This GUI's parent GUI. */ + private GuiScreen parentGui; + private GuiTextField serverAddress; + private GuiTextField serverName; + + /** ServerData to be modified by this GUI */ + private ServerData newServerData; + + public GuiScreenAddServer(GuiScreen par1GuiScreen, ServerData par2ServerData) + { + this.parentGui = par1GuiScreen; + this.newServerData = par2ServerData; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.serverName.updateCursorCounter(); + this.serverAddress.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.getString("addServer.add"))); + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.getString("gui.cancel"))); + this.buttonList.add(new GuiButton(2, this.width / 2 - 100, 142, I18n.getString("addServer.hideAddress") + ": " + (this.newServerData.isHidingAddress() ? I18n.getString("gui.yes") : I18n.getString("gui.no")))); + this.serverName = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 66, 200, 20); + this.serverName.setFocused(true); + this.serverName.setText(this.newServerData.serverName); + this.serverAddress = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 106, 200, 20); + this.serverAddress.setMaxStringLength(128); + this.serverAddress.setText(this.newServerData.serverIP); + ((GuiButton)this.buttonList.get(0)).enabled = this.serverAddress.getText().length() > 0 && this.serverAddress.getText().split(":").length > 0 && this.serverName.getText().length() > 0; + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 1) + { + this.parentGui.confirmClicked(false, 0); + } + else if (par1GuiButton.id == 0) + { + this.newServerData.serverName = this.serverName.getText(); + this.newServerData.serverIP = this.serverAddress.getText(); + this.parentGui.confirmClicked(true, 0); + } + else if (par1GuiButton.id == 2) + { + this.newServerData.setHideAddress(!this.newServerData.isHidingAddress()); + ((GuiButton)this.buttonList.get(2)).displayString = I18n.getString("addServer.hideAddress") + ": " + (this.newServerData.isHidingAddress() ? I18n.getString("gui.yes") : I18n.getString("gui.no")); + } + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + this.serverName.textboxKeyTyped(par1, par2); + this.serverAddress.textboxKeyTyped(par1, par2); + + if (par2 == 15) + { + this.serverName.setFocused(!this.serverName.isFocused()); + this.serverAddress.setFocused(!this.serverAddress.isFocused()); + } + + if (par2 == 28 || par2 == 156) + { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + + ((GuiButton)this.buttonList.get(0)).enabled = this.serverAddress.getText().length() > 0 && this.serverAddress.getText().split(":").length > 0 && this.serverName.getText().length() > 0; + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + this.serverAddress.mouseClicked(par1, par2, par3); + this.serverName.mouseClicked(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, I18n.getString("addServer.title"), this.width / 2, 17, 16777215); + this.drawString(this.fontRenderer, I18n.getString("addServer.enterName"), this.width / 2 - 100, 53, 10526880); + this.drawString(this.fontRenderer, I18n.getString("addServer.enterIp"), this.width / 2 - 100, 94, 10526880); + this.serverName.drawTextBox(); + this.serverAddress.drawTextBox(); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenBackup.java b/src/main/java/net/minecraft/src/GuiScreenBackup.java new file mode 100644 index 0000000..b18a792 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenBackup.java @@ -0,0 +1,166 @@ +package net.minecraft.src; + +import java.util.Collections; +import java.util.List; +import org.lwjgl.input.Keyboard; + +public class GuiScreenBackup extends GuiScreen +{ + private final GuiScreenConfigureWorld field_110380_a; + private final long field_110377_b; + private List field_110378_c = Collections.emptyList(); + private GuiScreenBackupSelectionList field_110375_d; + private int field_110376_e = -1; + private GuiButton field_110379_p; + + public GuiScreenBackup(GuiScreenConfigureWorld par1GuiScreenConfigureWorld, long par2) + { + this.field_110380_a = par1GuiScreenConfigureWorld; + this.field_110377_b = par2; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.field_110375_d = new GuiScreenBackupSelectionList(this); + (new GuiScreenBackupDownloadThread(this)).start(); + this.func_110369_g(); + } + + private void func_110369_g() + { + this.buttonList.add(new GuiButton(0, this.width / 2 + 6, this.height - 52, 153, 20, I18n.getString("gui.back"))); + this.buttonList.add(this.field_110379_p = new GuiButton(1, this.width / 2 - 154, this.height - 52, 153, 20, I18n.getString("mco.backup.button.restore"))); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 1) + { + String var2 = I18n.getString("mco.configure.world.restore.question.line1"); + String var3 = I18n.getString("mco.configure.world.restore.question.line2"); + this.mc.displayGuiScreen(new GuiScreenConfirmation(this, GuiScreenConfirmationType.Warning, var2, var3, 1)); + } + else if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(this.field_110380_a); + } + else + { + this.field_110375_d.actionPerformed(par1GuiButton); + } + } + } + + public void confirmClicked(boolean par1, int par2) + { + if (par1 && par2 == 1) + { + this.func_110374_h(); + } + else + { + this.mc.displayGuiScreen(this); + } + } + + private void func_110374_h() + { + if (this.field_110376_e >= 0 && this.field_110376_e < this.field_110378_c.size()) + { + Backup var1 = (Backup)this.field_110378_c.get(this.field_110376_e); + GuiScreenBackupRestoreTask var2 = new GuiScreenBackupRestoreTask(this, var1, (GuiScreenBackupDownloadThread)null); + GuiScreenLongRunningTask var3 = new GuiScreenLongRunningTask(this.mc, this.field_110380_a, var2); + var3.func_98117_g(); + this.mc.displayGuiScreen(var3); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.field_110375_d.drawScreen(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, I18n.getString("mco.backup.title"), this.width / 2, 20, 16777215); + super.drawScreen(par1, par2, par3); + } + + static Minecraft func_110366_a(GuiScreenBackup par0GuiScreenBackup) + { + return par0GuiScreenBackup.mc; + } + + static List func_110373_a(GuiScreenBackup par0GuiScreenBackup, List par1List) + { + return par0GuiScreenBackup.field_110378_c = par1List; + } + + static long func_110367_b(GuiScreenBackup par0GuiScreenBackup) + { + return par0GuiScreenBackup.field_110377_b; + } + + static Minecraft func_130030_c(GuiScreenBackup par0GuiScreenBackup) + { + return par0GuiScreenBackup.mc; + } + + static GuiScreenConfigureWorld func_130031_d(GuiScreenBackup par0GuiScreenBackup) + { + return par0GuiScreenBackup.field_110380_a; + } + + static Minecraft func_130035_e(GuiScreenBackup par0GuiScreenBackup) + { + return par0GuiScreenBackup.mc; + } + + static Minecraft func_130036_f(GuiScreenBackup par0GuiScreenBackup) + { + return par0GuiScreenBackup.mc; + } + + static List func_110370_e(GuiScreenBackup par0GuiScreenBackup) + { + return par0GuiScreenBackup.field_110378_c; + } + + static int func_130029_a(GuiScreenBackup par0GuiScreenBackup, int par1) + { + return par0GuiScreenBackup.field_110376_e = par1; + } + + static int func_130034_h(GuiScreenBackup par0GuiScreenBackup) + { + return par0GuiScreenBackup.field_110376_e; + } + + static FontRenderer func_130032_i(GuiScreenBackup par0GuiScreenBackup) + { + return par0GuiScreenBackup.fontRenderer; + } + + static FontRenderer func_130033_j(GuiScreenBackup par0GuiScreenBackup) + { + return par0GuiScreenBackup.fontRenderer; + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenBackupDownloadThread.java b/src/main/java/net/minecraft/src/GuiScreenBackupDownloadThread.java new file mode 100644 index 0000000..01614d0 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenBackupDownloadThread.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +class GuiScreenBackupDownloadThread extends Thread +{ + final GuiScreenBackup field_111250_a; + + GuiScreenBackupDownloadThread(GuiScreenBackup par1GuiScreenBackup) + { + this.field_111250_a = par1GuiScreenBackup; + } + + public void run() + { + McoClient var1 = new McoClient(GuiScreenBackup.func_110366_a(this.field_111250_a).getSession()); + + try + { + GuiScreenBackup.func_110373_a(this.field_111250_a, var1.func_111232_c(GuiScreenBackup.func_110367_b(this.field_111250_a)).field_111223_a); + } + catch (ExceptionMcoService var3) + { + GuiScreenBackup.func_130030_c(this.field_111250_a).getLogAgent().logSevere(var3.toString()); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenBackupRestoreTask.java b/src/main/java/net/minecraft/src/GuiScreenBackupRestoreTask.java new file mode 100644 index 0000000..561827a --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenBackupRestoreTask.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +class GuiScreenBackupRestoreTask extends TaskLongRunning +{ + /** The backup being restored */ + private final Backup theBackup; + + /** The screen running this task */ + final GuiScreenBackup theBackupScreen; + + private GuiScreenBackupRestoreTask(GuiScreenBackup par1GuiScreenBackup, Backup par2Backup) + { + this.theBackupScreen = par1GuiScreenBackup; + this.theBackup = par2Backup; + } + + public void run() + { + this.setMessage(I18n.getString("mco.backup.restoring")); + + try + { + McoClient var1 = new McoClient(this.getMinecraft().getSession()); + var1.func_111235_c(GuiScreenBackup.func_110367_b(this.theBackupScreen), this.theBackup.field_110727_a); + + try + { + Thread.sleep(1000L); + } + catch (InterruptedException var3) + { + Thread.currentThread().interrupt(); + } + + this.getMinecraft().displayGuiScreen(GuiScreenBackup.func_130031_d(this.theBackupScreen)); + } + catch (ExceptionMcoService var4) + { + GuiScreenBackup.func_130035_e(this.theBackupScreen).getLogAgent().logSevere(var4.toString()); + this.setFailedMessage(var4.toString()); + } + catch (Exception var5) + { + this.setFailedMessage(var5.getLocalizedMessage()); + } + } + + GuiScreenBackupRestoreTask(GuiScreenBackup par1GuiScreenBackup, Backup par2Backup, GuiScreenBackupDownloadThread par3GuiScreenBackupDownloadThread) + { + this(par1GuiScreenBackup, par2Backup); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenBackupSelectionList.java b/src/main/java/net/minecraft/src/GuiScreenBackupSelectionList.java new file mode 100644 index 0000000..99c78a0 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenBackupSelectionList.java @@ -0,0 +1,115 @@ +package net.minecraft.src; + +import java.text.DateFormat; +import java.util.Date; +import net.minecraft.server.MinecraftServer; + +class GuiScreenBackupSelectionList extends GuiScreenSelectLocation +{ + final GuiScreenBackup field_111249_a; + + public GuiScreenBackupSelectionList(GuiScreenBackup par1GuiScreenBackup) + { + super(GuiScreenBackup.func_130036_f(par1GuiScreenBackup), par1GuiScreenBackup.width, par1GuiScreenBackup.height, 32, par1GuiScreenBackup.height - 64, 36); + this.field_111249_a = par1GuiScreenBackup; + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return GuiScreenBackup.func_110370_e(this.field_111249_a).size() + 1; + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) + { + if (par1 < GuiScreenBackup.func_110370_e(this.field_111249_a).size()) + { + GuiScreenBackup.func_130029_a(this.field_111249_a, par1); + } + } + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return par1 == GuiScreenBackup.func_130034_h(this.field_111249_a); + } + + protected boolean func_104086_b(int par1) + { + return false; + } + + protected int func_130003_b() + { + return this.getSize() * 36; + } + + protected void func_130004_c() + { + this.field_111249_a.drawDefaultBackground(); + } + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + if (par1 < GuiScreenBackup.func_110370_e(this.field_111249_a).size()) + { + this.func_111246_b(par1, par2, par3, par4, par5Tessellator); + } + } + + private void func_111246_b(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + Backup var6 = (Backup)GuiScreenBackup.func_110370_e(this.field_111249_a).get(par1); + this.field_111249_a.drawString(GuiScreenBackup.func_130032_i(this.field_111249_a), "Backup (" + this.func_111248_a(Long.valueOf(MinecraftServer.getSystemTimeMillis() - var6.field_110725_b.getTime())) + ")", par2 + 2, par3 + 1, 16777215); + this.field_111249_a.drawString(GuiScreenBackup.func_130033_j(this.field_111249_a), this.func_111247_a(var6.field_110725_b), par2 + 2, par3 + 12, 7105644); + } + + private String func_111247_a(Date par1Date) + { + return DateFormat.getDateTimeInstance(3, 3).format(par1Date); + } + + private String func_111248_a(Long par1) + { + if (par1.longValue() < 0L) + { + return "right now"; + } + else + { + long var2 = par1.longValue() / 1000L; + + if (var2 < 60L) + { + return (var2 == 1L ? "1 second" : var2 + " seconds") + " ago"; + } + else + { + long var4; + + if (var2 < 3600L) + { + var4 = var2 / 60L; + return (var4 == 1L ? "1 minute" : var4 + " minutes") + " ago"; + } + else if (var2 < 86400L) + { + var4 = var2 / 3600L; + return (var4 == 1L ? "1 hour" : var4 + " hours") + " ago"; + } + else + { + var4 = var2 / 86400L; + return (var4 == 1L ? "1 day" : var4 + " days") + " ago"; + } + } + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenBook.java b/src/main/java/net/minecraft/src/GuiScreenBook.java new file mode 100644 index 0000000..fb64af1 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenBook.java @@ -0,0 +1,451 @@ +package net.minecraft.src; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +public class GuiScreenBook extends GuiScreen +{ + private static final ResourceLocation bookGuiTextures = new ResourceLocation("textures/gui/book.png"); + + /** The player editing the book */ + private final EntityPlayer editingPlayer; + private final ItemStack itemstackBook; + + /** Whether the book is signed or can still be edited */ + private final boolean bookIsUnsigned; + private boolean bookModified; + private boolean editingTitle; + + /** Update ticks since the gui was opened */ + private int updateCount; + private int bookImageWidth = 192; + private int bookImageHeight = 192; + private int bookTotalPages = 1; + private int currPage; + private NBTTagList bookPages; + private String bookTitle = ""; + private GuiButtonNextPage buttonNextPage; + private GuiButtonNextPage buttonPreviousPage; + private GuiButton buttonDone; + + /** The GuiButton to sign this book. */ + private GuiButton buttonSign; + private GuiButton buttonFinalize; + private GuiButton buttonCancel; + + public GuiScreenBook(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack, boolean par3) + { + this.editingPlayer = par1EntityPlayer; + this.itemstackBook = par2ItemStack; + this.bookIsUnsigned = par3; + + if (par2ItemStack.hasTagCompound()) + { + NBTTagCompound var4 = par2ItemStack.getTagCompound(); + this.bookPages = var4.getTagList("pages"); + + if (this.bookPages != null) + { + this.bookPages = (NBTTagList)this.bookPages.copy(); + this.bookTotalPages = this.bookPages.tagCount(); + + if (this.bookTotalPages < 1) + { + this.bookTotalPages = 1; + } + } + } + + if (this.bookPages == null && par3) + { + this.bookPages = new NBTTagList("pages"); + this.bookPages.appendTag(new NBTTagString("1", "")); + this.bookTotalPages = 1; + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + ++this.updateCount; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + Keyboard.enableRepeatEvents(true); + + if (this.bookIsUnsigned) + { + this.buttonList.add(this.buttonSign = new GuiButton(3, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.getString("book.signButton"))); + this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.getString("gui.done"))); + this.buttonList.add(this.buttonFinalize = new GuiButton(5, this.width / 2 - 100, 4 + this.bookImageHeight, 98, 20, I18n.getString("book.finalizeButton"))); + this.buttonList.add(this.buttonCancel = new GuiButton(4, this.width / 2 + 2, 4 + this.bookImageHeight, 98, 20, I18n.getString("gui.cancel"))); + } + else + { + this.buttonList.add(this.buttonDone = new GuiButton(0, this.width / 2 - 100, 4 + this.bookImageHeight, 200, 20, I18n.getString("gui.done"))); + } + + int var1 = (this.width - this.bookImageWidth) / 2; + byte var2 = 2; + this.buttonList.add(this.buttonNextPage = new GuiButtonNextPage(1, var1 + 120, var2 + 154, true)); + this.buttonList.add(this.buttonPreviousPage = new GuiButtonNextPage(2, var1 + 38, var2 + 154, false)); + this.updateButtons(); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + private void updateButtons() + { + this.buttonNextPage.drawButton = !this.editingTitle && (this.currPage < this.bookTotalPages - 1 || this.bookIsUnsigned); + this.buttonPreviousPage.drawButton = !this.editingTitle && this.currPage > 0; + this.buttonDone.drawButton = !this.bookIsUnsigned || !this.editingTitle; + + if (this.bookIsUnsigned) + { + this.buttonSign.drawButton = !this.editingTitle; + this.buttonCancel.drawButton = this.editingTitle; + this.buttonFinalize.drawButton = this.editingTitle; + this.buttonFinalize.enabled = this.bookTitle.trim().length() > 0; + } + } + + private void sendBookToServer(boolean par1) + { + if (this.bookIsUnsigned && this.bookModified) + { + if (this.bookPages != null) + { + while (this.bookPages.tagCount() > 1) + { + NBTTagString var2 = (NBTTagString)this.bookPages.tagAt(this.bookPages.tagCount() - 1); + + if (var2.data != null && var2.data.length() != 0) + { + break; + } + + this.bookPages.removeTag(this.bookPages.tagCount() - 1); + } + + if (this.itemstackBook.hasTagCompound()) + { + NBTTagCompound var7 = this.itemstackBook.getTagCompound(); + var7.setTag("pages", this.bookPages); + } + else + { + this.itemstackBook.setTagInfo("pages", this.bookPages); + } + + String var8 = "MC|BEdit"; + + if (par1) + { + var8 = "MC|BSign"; + this.itemstackBook.setTagInfo("author", new NBTTagString("author", this.editingPlayer.getCommandSenderName())); + this.itemstackBook.setTagInfo("title", new NBTTagString("title", this.bookTitle.trim())); + this.itemstackBook.itemID = Item.writtenBook.itemID; + } + + ByteArrayOutputStream var3 = new ByteArrayOutputStream(); + DataOutputStream var4 = new DataOutputStream(var3); + + try + { + Packet.writeItemStack(this.itemstackBook, var4); + this.mc.getNetHandler().addToSendQueue(new Packet250CustomPayload(var8, var3.toByteArray())); + } + catch (Exception var6) + { + var6.printStackTrace(); + } + } + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen((GuiScreen)null); + this.sendBookToServer(false); + } + else if (par1GuiButton.id == 3 && this.bookIsUnsigned) + { + this.editingTitle = true; + } + else if (par1GuiButton.id == 1) + { + if (this.currPage < this.bookTotalPages - 1) + { + ++this.currPage; + } + else if (this.bookIsUnsigned) + { + this.addNewPage(); + + if (this.currPage < this.bookTotalPages - 1) + { + ++this.currPage; + } + } + } + else if (par1GuiButton.id == 2) + { + if (this.currPage > 0) + { + --this.currPage; + } + } + else if (par1GuiButton.id == 5 && this.editingTitle) + { + this.sendBookToServer(true); + this.mc.displayGuiScreen((GuiScreen)null); + } + else if (par1GuiButton.id == 4 && this.editingTitle) + { + this.editingTitle = false; + } + + this.updateButtons(); + } + } + + private void addNewPage() + { + if (this.bookPages != null && this.bookPages.tagCount() < 50) + { + this.bookPages.appendTag(new NBTTagString("" + (this.bookTotalPages + 1), "")); + ++this.bookTotalPages; + this.bookModified = true; + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + super.keyTyped(par1, par2); + + if (this.bookIsUnsigned) + { + if (this.editingTitle) + { + this.func_74162_c(par1, par2); + } + else + { + this.keyTypedInBook(par1, par2); + } + } + } + + /** + * Processes keystrokes when editing the text of a book + */ + private void keyTypedInBook(char par1, int par2) + { + switch (par1) + { + case 22: + this.func_74160_b(GuiScreen.getClipboardString()); + return; + + default: + switch (par2) + { + case 14: + String var3 = this.func_74158_i(); + + if (var3.length() > 0) + { + this.func_74159_a(var3.substring(0, var3.length() - 1)); + } + + return; + + case 28: + case 156: + this.func_74160_b("\n"); + return; + + default: + if (ChatAllowedCharacters.isAllowedCharacter(par1)) + { + this.func_74160_b(Character.toString(par1)); + } + } + } + } + + private void func_74162_c(char par1, int par2) + { + switch (par2) + { + case 14: + if (!this.bookTitle.isEmpty()) + { + this.bookTitle = this.bookTitle.substring(0, this.bookTitle.length() - 1); + this.updateButtons(); + } + + return; + + case 28: + case 156: + if (!this.bookTitle.isEmpty()) + { + this.sendBookToServer(true); + this.mc.displayGuiScreen((GuiScreen)null); + } + + return; + + default: + if (this.bookTitle.length() < 16 && ChatAllowedCharacters.isAllowedCharacter(par1)) + { + this.bookTitle = this.bookTitle + Character.toString(par1); + this.updateButtons(); + this.bookModified = true; + } + } + } + + private String func_74158_i() + { + if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) + { + NBTTagString var1 = (NBTTagString)this.bookPages.tagAt(this.currPage); + return var1.toString(); + } + else + { + return ""; + } + } + + private void func_74159_a(String par1Str) + { + if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) + { + NBTTagString var2 = (NBTTagString)this.bookPages.tagAt(this.currPage); + var2.data = par1Str; + this.bookModified = true; + } + } + + private void func_74160_b(String par1Str) + { + String var2 = this.func_74158_i(); + String var3 = var2 + par1Str; + int var4 = this.fontRenderer.splitStringWidth(var3 + "" + EnumChatFormatting.BLACK + "_", 118); + + if (var4 <= 118 && var3.length() < 256) + { + this.func_74159_a(var3); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(bookGuiTextures); + int var4 = (this.width - this.bookImageWidth) / 2; + byte var5 = 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.bookImageWidth, this.bookImageHeight); + String var6; + String var7; + int var8; + + if (this.editingTitle) + { + var6 = this.bookTitle; + + if (this.bookIsUnsigned) + { + if (this.updateCount / 6 % 2 == 0) + { + var6 = var6 + "" + EnumChatFormatting.BLACK + "_"; + } + else + { + var6 = var6 + "" + EnumChatFormatting.GRAY + "_"; + } + } + + var7 = I18n.getString("book.editTitle"); + var8 = this.fontRenderer.getStringWidth(var7); + this.fontRenderer.drawString(var7, var4 + 36 + (116 - var8) / 2, var5 + 16 + 16, 0); + int var9 = this.fontRenderer.getStringWidth(var6); + this.fontRenderer.drawString(var6, var4 + 36 + (116 - var9) / 2, var5 + 48, 0); + String var10 = String.format(I18n.getString("book.byAuthor"), new Object[] {this.editingPlayer.getCommandSenderName()}); + int var11 = this.fontRenderer.getStringWidth(var10); + this.fontRenderer.drawString(EnumChatFormatting.DARK_GRAY + var10, var4 + 36 + (116 - var11) / 2, var5 + 48 + 10, 0); + String var12 = I18n.getString("book.finalizeWarning"); + this.fontRenderer.drawSplitString(var12, var4 + 36, var5 + 80, 116, 0); + } + else + { + var6 = String.format(I18n.getString("book.pageIndicator"), new Object[] {Integer.valueOf(this.currPage + 1), Integer.valueOf(this.bookTotalPages)}); + var7 = ""; + + if (this.bookPages != null && this.currPage >= 0 && this.currPage < this.bookPages.tagCount()) + { + NBTTagString var13 = (NBTTagString)this.bookPages.tagAt(this.currPage); + var7 = var13.toString(); + } + + if (this.bookIsUnsigned) + { + if (this.fontRenderer.getBidiFlag()) + { + var7 = var7 + "_"; + } + else if (this.updateCount / 6 % 2 == 0) + { + var7 = var7 + "" + EnumChatFormatting.BLACK + "_"; + } + else + { + var7 = var7 + "" + EnumChatFormatting.GRAY + "_"; + } + } + + var8 = this.fontRenderer.getStringWidth(var6); + this.fontRenderer.drawString(var6, var4 - var8 + this.bookImageWidth - 44, var5 + 16, 0); + this.fontRenderer.drawSplitString(var7, var4 + 36, var5 + 16 + 16, 116, 0); + } + + super.drawScreen(par1, par2, par3); + } + + static ResourceLocation func_110404_g() + { + return bookGuiTextures; + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenClientOutdated.java b/src/main/java/net/minecraft/src/GuiScreenClientOutdated.java new file mode 100644 index 0000000..bf1233e --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenClientOutdated.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +public class GuiScreenClientOutdated extends GuiScreen +{ + private final GuiScreen previousScreen; + + public GuiScreenClientOutdated(GuiScreen par1GuiScreen) + { + this.previousScreen = par1GuiScreen; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, "Back")); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + String var4 = I18n.getString("mco.client.outdated.title"); + String var5 = I18n.getString("mco.client.outdated.msg"); + this.drawCenteredString(this.fontRenderer, var4, this.width / 2, this.height / 2 - 50, 16711680); + this.drawCenteredString(this.fontRenderer, var5, this.width / 2, this.height / 2 - 30, 16777215); + super.drawScreen(par1, par2, par3); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(this.previousScreen); + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (par2 == 28 || par2 == 156) + { + this.mc.displayGuiScreen(this.previousScreen); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenConfigureWorld.java b/src/main/java/net/minecraft/src/GuiScreenConfigureWorld.java new file mode 100644 index 0000000..32449d2 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenConfigureWorld.java @@ -0,0 +1,322 @@ +package net.minecraft.src; + +import java.io.IOException; +import org.lwjgl.input.Keyboard; + +public class GuiScreenConfigureWorld extends GuiScreen +{ + private final GuiScreen field_96285_a; + private McoServer field_96280_b; + private SelectionListInvited field_96282_c; + private int field_96277_d; + private int field_96286_n; + private int field_96287_o; + private int field_96284_p = -1; + private String field_96283_q; + private GuiButton field_96281_r; + private GuiButton field_96279_s; + private GuiButton field_96278_t; + private GuiButton field_96276_u; + private GuiButton field_98128_v; + private GuiButton field_98127_w; + private GuiButton field_98129_x; + private GuiButton field_110381_z; + private boolean field_102020_y; + + public GuiScreenConfigureWorld(GuiScreen par1GuiScreen, McoServer par2McoServer) + { + this.field_96285_a = par1GuiScreen; + this.field_96280_b = par2McoServer; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() {} + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.field_96277_d = this.width / 2 - 200; + this.field_96286_n = 180; + this.field_96287_o = this.width / 2; + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + + if (this.field_96280_b.field_96404_d.equals("CLOSED")) + { + this.buttonList.add(this.field_96281_r = new GuiButton(0, this.field_96277_d, this.func_96264_a(12), this.field_96286_n / 2 - 2, 20, I18n.getString("mco.configure.world.buttons.open"))); + this.field_96281_r.enabled = !this.field_96280_b.field_98166_h; + } + else + { + this.buttonList.add(this.field_96279_s = new GuiButton(1, this.field_96277_d, this.func_96264_a(12), this.field_96286_n / 2 - 2, 20, I18n.getString("mco.configure.world.buttons.close"))); + this.field_96279_s.enabled = !this.field_96280_b.field_98166_h; + } + + this.buttonList.add(this.field_98129_x = new GuiButton(7, this.field_96277_d + this.field_96286_n / 2 + 2, this.func_96264_a(12), this.field_96286_n / 2 - 2, 20, I18n.getString("mco.configure.world.buttons.subscription"))); + this.buttonList.add(this.field_96278_t = new GuiButton(5, this.field_96277_d, this.func_96264_a(10), this.field_96286_n / 2 - 2, 20, I18n.getString("mco.configure.world.buttons.edit"))); + this.buttonList.add(this.field_96276_u = new GuiButton(6, this.field_96277_d + this.field_96286_n / 2 + 2, this.func_96264_a(10), this.field_96286_n / 2 - 2, 20, I18n.getString("mco.configure.world.buttons.reset"))); + this.buttonList.add(this.field_98128_v = new GuiButton(4, this.field_96287_o, this.func_96264_a(10), this.field_96286_n / 2 - 2, 20, I18n.getString("mco.configure.world.buttons.invite"))); + this.buttonList.add(this.field_98127_w = new GuiButton(3, this.field_96287_o + this.field_96286_n / 2 + 2, this.func_96264_a(10), this.field_96286_n / 2 - 2, 20, I18n.getString("mco.configure.world.buttons.uninvite"))); + this.buttonList.add(this.field_110381_z = new GuiButton(8, this.field_96287_o, this.func_96264_a(12), this.field_96286_n / 2 - 2, 20, I18n.getString("mco.configure.world.buttons.backup"))); + this.buttonList.add(new GuiButton(10, this.field_96287_o + this.field_96286_n / 2 + 2, this.func_96264_a(12), this.field_96286_n / 2 - 2, 20, I18n.getString("gui.back"))); + this.field_96282_c = new SelectionListInvited(this); + this.field_96278_t.enabled = !this.field_96280_b.field_98166_h; + this.field_96276_u.enabled = !this.field_96280_b.field_98166_h; + this.field_98128_v.enabled = !this.field_96280_b.field_98166_h; + this.field_98127_w.enabled = !this.field_96280_b.field_98166_h; + this.field_110381_z.enabled = !this.field_96280_b.field_98166_h; + } + + private int func_96264_a(int par1) + { + return 40 + par1 * 13; + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 10) + { + if (this.field_102020_y) + { + ((GuiScreenOnlineServers)this.field_96285_a).func_102018_a(this.field_96280_b.field_96408_a); + } + + this.mc.displayGuiScreen(this.field_96285_a); + } + else if (par1GuiButton.id == 5) + { + this.mc.displayGuiScreen(new GuiScreenEditOnlineWorld(this, this.field_96285_a, this.field_96280_b)); + } + else if (par1GuiButton.id == 1) + { + String var2 = I18n.getString("mco.configure.world.close.question.line1"); + String var3 = I18n.getString("mco.configure.world.close.question.line2"); + this.mc.displayGuiScreen(new GuiScreenConfirmation(this, GuiScreenConfirmationType.Info, var2, var3, 1)); + } + else if (par1GuiButton.id == 0) + { + this.func_96268_g(); + } + else if (par1GuiButton.id == 4) + { + this.mc.displayGuiScreen(new GuiScreenInvite(this.field_96285_a, this, this.field_96280_b)); + } + else if (par1GuiButton.id == 3) + { + this.func_96272_i(); + } + else if (par1GuiButton.id == 6) + { + this.mc.displayGuiScreen(new GuiScreenResetWorld(this, this.field_96280_b)); + } + else if (par1GuiButton.id == 7) + { + this.mc.displayGuiScreen(new GuiScreenSubscription(this, this.field_96280_b)); + } + else if (par1GuiButton.id == 8) + { + this.mc.displayGuiScreen(new GuiScreenBackup(this, this.field_96280_b.field_96408_a)); + } + } + } + + private void func_96268_g() + { + McoClient var1 = new McoClient(this.mc.getSession()); + + try + { + Boolean var2 = var1.func_96383_b(this.field_96280_b.field_96408_a); + + if (var2.booleanValue()) + { + this.field_102020_y = true; + this.field_96280_b.field_96404_d = "OPEN"; + this.initGui(); + } + } + catch (ExceptionMcoService var3) + { + this.mc.getLogAgent().logSevere(var3.toString()); + } + catch (IOException var4) + { + this.mc.getLogAgent().logWarning("Realms: could not parse response"); + } + } + + private void func_96275_h() + { + McoClient var1 = new McoClient(this.mc.getSession()); + + try + { + boolean var2 = var1.func_96378_c(this.field_96280_b.field_96408_a).booleanValue(); + + if (var2) + { + this.field_102020_y = true; + this.field_96280_b.field_96404_d = "CLOSED"; + this.initGui(); + } + } + catch (ExceptionMcoService var3) + { + this.mc.getLogAgent().logSevere(var3.toString()); + } + catch (IOException var4) + { + this.mc.getLogAgent().logWarning("Realms: could not parse response"); + } + } + + private void func_96272_i() + { + if (this.field_96284_p >= 0 && this.field_96284_p < this.field_96280_b.field_96402_f.size()) + { + this.field_96283_q = (String)this.field_96280_b.field_96402_f.get(this.field_96284_p); + GuiYesNo var1 = new GuiYesNo(this, "Warning!", I18n.getString("mco.configure.world.uninvite.question") + " \'" + this.field_96283_q + "\'", 3); + this.mc.displayGuiScreen(var1); + } + } + + public void confirmClicked(boolean par1, int par2) + { + if (par2 == 3) + { + if (par1) + { + McoClient var3 = new McoClient(this.mc.getSession()); + + try + { + var3.func_96381_a(this.field_96280_b.field_96408_a, this.field_96283_q); + } + catch (ExceptionMcoService var5) + { + this.mc.getLogAgent().logSevere(var5.toString()); + } + + this.func_96267_d(this.field_96284_p); + } + + this.mc.displayGuiScreen(new GuiScreenConfigureWorld(this.field_96285_a, this.field_96280_b)); + } + + if (par2 == 1) + { + if (par1) + { + this.func_96275_h(); + } + + this.mc.displayGuiScreen(this); + } + } + + private void func_96267_d(int par1) + { + this.field_96280_b.field_96402_f.remove(par1); + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) {} + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.field_96282_c.func_96612_a(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, I18n.getString("mco.configure.world.title"), this.width / 2, 17, 16777215); + this.drawString(this.fontRenderer, I18n.getString("mco.configure.world.name"), this.field_96277_d, this.func_96264_a(1), 10526880); + this.drawString(this.fontRenderer, this.field_96280_b.func_96398_b(), this.field_96277_d, this.func_96264_a(2), 16777215); + this.drawString(this.fontRenderer, I18n.getString("mco.configure.world.description"), this.field_96277_d, this.func_96264_a(4), 10526880); + this.drawString(this.fontRenderer, this.field_96280_b.func_96397_a(), this.field_96277_d, this.func_96264_a(5), 16777215); + this.drawString(this.fontRenderer, I18n.getString("mco.configure.world.status"), this.field_96277_d, this.func_96264_a(7), 10526880); + this.drawString(this.fontRenderer, this.func_104045_j(), this.field_96277_d, this.func_96264_a(8), 16777215); + this.drawString(this.fontRenderer, I18n.getString("mco.configure.world.invited"), this.field_96287_o, this.func_96264_a(1), 10526880); + super.drawScreen(par1, par2, par3); + } + + private String func_104045_j() + { + if (this.field_96280_b.field_98166_h) + { + return "Expired"; + } + else + { + String var1 = this.field_96280_b.field_96404_d.toLowerCase(); + return Character.toUpperCase(var1.charAt(0)) + var1.substring(1); + } + } + + static Minecraft getMinecraft(GuiScreenConfigureWorld par0GuiScreenConfigureWorld) + { + return par0GuiScreenConfigureWorld.mc; + } + + static int func_96271_b(GuiScreenConfigureWorld par0GuiScreenConfigureWorld) + { + return par0GuiScreenConfigureWorld.field_96287_o; + } + + static int func_96274_a(GuiScreenConfigureWorld par0GuiScreenConfigureWorld, int par1) + { + return par0GuiScreenConfigureWorld.func_96264_a(par1); + } + + static int func_96269_c(GuiScreenConfigureWorld par0GuiScreenConfigureWorld) + { + return par0GuiScreenConfigureWorld.field_96286_n; + } + + static McoServer func_96266_d(GuiScreenConfigureWorld par0GuiScreenConfigureWorld) + { + return par0GuiScreenConfigureWorld.field_96280_b; + } + + static int func_96270_b(GuiScreenConfigureWorld par0GuiScreenConfigureWorld, int par1) + { + return par0GuiScreenConfigureWorld.field_96284_p = par1; + } + + static int func_96263_e(GuiScreenConfigureWorld par0GuiScreenConfigureWorld) + { + return par0GuiScreenConfigureWorld.field_96284_p; + } + + static FontRenderer func_96273_f(GuiScreenConfigureWorld par0GuiScreenConfigureWorld) + { + return par0GuiScreenConfigureWorld.fontRenderer; + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenConfirmation.java b/src/main/java/net/minecraft/src/GuiScreenConfirmation.java new file mode 100644 index 0000000..174804d --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenConfirmation.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +public class GuiScreenConfirmation extends GuiScreen +{ + private final GuiScreenConfirmationType field_140045_e; + private final String field_140049_p; + private final String field_96288_n; + protected final GuiScreen field_140048_a; + protected final String field_140046_b; + protected final String field_140047_c; + protected final int field_140044_d; + + public GuiScreenConfirmation(GuiScreen par1GuiScreen, GuiScreenConfirmationType par2GuiScreenConfirmationType, String par3Str, String par4Str, int par5) + { + this.field_140048_a = par1GuiScreen; + this.field_140044_d = par5; + this.field_140045_e = par2GuiScreenConfirmationType; + this.field_140049_p = par3Str; + this.field_96288_n = par4Str; + this.field_140046_b = I18n.getString("gui.yes"); + this.field_140047_c = I18n.getString("gui.no"); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.add(new GuiSmallButton(0, this.width / 2 - 155, this.height / 6 + 112, this.field_140046_b)); + this.buttonList.add(new GuiSmallButton(1, this.width / 2 - 155 + 160, this.height / 6 + 112, this.field_140047_c)); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + this.field_140048_a.confirmClicked(par1GuiButton.id == 0, this.field_140044_d); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.field_140045_e.field_140072_d, this.width / 2, 70, this.field_140045_e.field_140075_c); + this.drawCenteredString(this.fontRenderer, this.field_140049_p, this.width / 2, 90, 16777215); + this.drawCenteredString(this.fontRenderer, this.field_96288_n, this.width / 2, 110, 16777215); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenConfirmationType.java b/src/main/java/net/minecraft/src/GuiScreenConfirmationType.java new file mode 100644 index 0000000..eed3741 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenConfirmationType.java @@ -0,0 +1,15 @@ +package net.minecraft.src; + +public enum GuiScreenConfirmationType +{ + Warning("Warning!", 16711680), + Info("Info!", 8226750); + public final int field_140075_c; + public final String field_140072_d; + + private GuiScreenConfirmationType(String par3Str, int par4) + { + this.field_140072_d = par3Str; + this.field_140075_c = par4; + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenCreateOnlineWorld.java b/src/main/java/net/minecraft/src/GuiScreenCreateOnlineWorld.java new file mode 100644 index 0000000..133cf4b --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenCreateOnlineWorld.java @@ -0,0 +1,211 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Collections; +import org.lwjgl.input.Keyboard; + +public class GuiScreenCreateOnlineWorld extends ScreenWithCallback +{ + private GuiScreen field_96260_a; + private GuiTextField field_96257_c; + private GuiTextField field_96255_b; + private String field_98108_c; + private String field_98109_n; + private static int field_96253_d; + private static int field_96261_n = 1; + private static int field_110357_r = 2; + private boolean field_96256_r; + private String field_96254_s = "You must enter a name!"; + private WorldTemplate field_110356_u; + + public GuiScreenCreateOnlineWorld(GuiScreen par1GuiScreen) + { + super.buttonList = Collections.synchronizedList(new ArrayList()); + this.field_96260_a = par1GuiScreen; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.field_96257_c.updateCursorCounter(); + this.field_98108_c = this.field_96257_c.getText(); + this.field_96255_b.updateCursorCounter(); + this.field_98109_n = this.field_96255_b.getText(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(field_96253_d, this.width / 2 - 100, this.height / 4 + 120 + 17, 97, 20, I18n.getString("mco.create.world"))); + this.buttonList.add(new GuiButton(field_96261_n, this.width / 2 + 5, this.height / 4 + 120 + 17, 95, 20, I18n.getString("gui.cancel"))); + this.field_96257_c = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 65, 200, 20); + this.field_96257_c.setFocused(true); + + if (this.field_98108_c != null) + { + this.field_96257_c.setText(this.field_98108_c); + } + + this.field_96255_b = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 111, 200, 20); + + if (this.field_98109_n != null) + { + this.field_96255_b.setText(this.field_98109_n); + } + + if (this.field_110356_u == null) + { + this.buttonList.add(new GuiButton(field_110357_r, this.width / 2 - 100, 147, 200, 20, I18n.getString("mco.template.default.name"))); + } + else + { + this.field_96255_b.setText(""); + this.field_96255_b.setEnabled(false); + this.field_96255_b.setFocused(false); + this.buttonList.add(new GuiButton(field_110357_r, this.width / 2 - 100, 147, 200, 20, I18n.getString("mco.template.name") + ": " + this.field_110356_u.field_110732_b)); + } + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == field_96261_n) + { + this.mc.displayGuiScreen(this.field_96260_a); + } + else if (par1GuiButton.id == field_96253_d) + { + this.func_96252_h(); + } + else if (par1GuiButton.id == field_110357_r) + { + this.mc.displayGuiScreen(new GuiScreenMcoWorldTemplate(this, this.field_110356_u)); + } + } + } + + private void func_96252_h() + { + if (this.func_96249_i()) + { + TaskWorldCreation var1 = new TaskWorldCreation(this, this.field_96257_c.getText(), "Minecraft Realms Server", this.field_98109_n, this.field_110356_u); + GuiScreenLongRunningTask var2 = new GuiScreenLongRunningTask(this.mc, this.field_96260_a, var1); + var2.func_98117_g(); + this.mc.displayGuiScreen(var2); + } + } + + private boolean func_96249_i() + { + this.field_96256_r = this.field_96257_c.getText() == null || this.field_96257_c.getText().trim().equals(""); + return !this.field_96256_r; + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + this.field_96257_c.textboxKeyTyped(par1, par2); + this.field_96255_b.textboxKeyTyped(par1, par2); + + if (par2 == 15) + { + this.field_96257_c.setFocused(!this.field_96257_c.isFocused()); + this.field_96255_b.setFocused(!this.field_96255_b.isFocused()); + } + + if (par2 == 28 || par2 == 156) + { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + this.field_96257_c.mouseClicked(par1, par2, par3); + this.field_96255_b.mouseClicked(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, I18n.getString("mco.selectServer.create"), this.width / 2, 11, 16777215); + this.drawString(this.fontRenderer, I18n.getString("mco.configure.world.name"), this.width / 2 - 100, 52, 10526880); + this.drawString(this.fontRenderer, I18n.getString("mco.create.world.seed"), this.width / 2 - 100, 98, 10526880); + + if (this.field_96256_r) + { + this.drawCenteredString(this.fontRenderer, this.field_96254_s, this.width / 2, 167, 16711680); + } + + this.field_96257_c.drawTextBox(); + this.field_96255_b.drawTextBox(); + super.drawScreen(par1, par2, par3); + } + + public void func_110355_a(WorldTemplate par1WorldTemplate) + { + this.field_110356_u = par1WorldTemplate; + } + + public void func_110354_a(Object par1Obj) + { + this.func_110355_a((WorldTemplate)par1Obj); + } + + static Minecraft func_96248_a(GuiScreenCreateOnlineWorld par0GuiScreenCreateOnlineWorld) + { + return par0GuiScreenCreateOnlineWorld.mc; + } + + static GuiScreen func_96247_b(GuiScreenCreateOnlineWorld par0GuiScreenCreateOnlineWorld) + { + return par0GuiScreenCreateOnlineWorld.field_96260_a; + } + + static Minecraft func_96246_c(GuiScreenCreateOnlineWorld par0GuiScreenCreateOnlineWorld) + { + return par0GuiScreenCreateOnlineWorld.mc; + } + + static Minecraft func_130026_d(GuiScreenCreateOnlineWorld par0GuiScreenCreateOnlineWorld) + { + return par0GuiScreenCreateOnlineWorld.mc; + } + + static Minecraft func_130027_e(GuiScreenCreateOnlineWorld par0GuiScreenCreateOnlineWorld) + { + return par0GuiScreenCreateOnlineWorld.mc; + } + + static Minecraft func_130028_f(GuiScreenCreateOnlineWorld par0GuiScreenCreateOnlineWorld) + { + return par0GuiScreenCreateOnlineWorld.mc; + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenDemo.java b/src/main/java/net/minecraft/src/GuiScreenDemo.java new file mode 100644 index 0000000..8d8373b --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenDemo.java @@ -0,0 +1,89 @@ +package net.minecraft.src; + +import java.net.URI; +import org.lwjgl.opengl.GL11; + +public class GuiScreenDemo extends GuiScreen +{ + private static final ResourceLocation field_110407_a = new ResourceLocation("textures/gui/demo_background.png"); + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + byte var1 = -16; + this.buttonList.add(new GuiButton(1, this.width / 2 - 116, this.height / 2 + 62 + var1, 114, 20, I18n.getString("demo.help.buy"))); + this.buttonList.add(new GuiButton(2, this.width / 2 + 2, this.height / 2 + 62 + var1, 114, 20, I18n.getString("demo.help.later"))); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + switch (par1GuiButton.id) + { + case 1: + par1GuiButton.enabled = false; + + try + { + Class var2 = Class.forName("java.awt.Desktop"); + Object var3 = var2.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]); + var2.getMethod("browse", new Class[] {URI.class}).invoke(var3, new Object[] {new URI("http://www.minecraft.net/store?source=demo")}); + } + catch (Throwable var4) + { + var4.printStackTrace(); + } + + break; + + case 2: + this.mc.displayGuiScreen((GuiScreen)null); + this.mc.setIngameFocus(); + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + } + + /** + * Draws either a gradient over the background screen (when it exists) or a flat gradient over background.png + */ + public void drawDefaultBackground() + { + super.drawDefaultBackground(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(field_110407_a); + int var1 = (this.width - 248) / 2; + int var2 = (this.height - 166) / 2; + this.drawTexturedModalRect(var1, var2, 0, 0, 248, 166); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + int var4 = (this.width - 248) / 2 + 10; + int var5 = (this.height - 166) / 2 + 8; + this.fontRenderer.drawString(I18n.getString("demo.help.title"), var4, var5, 2039583); + var5 += 12; + GameSettings var6 = this.mc.gameSettings; + this.fontRenderer.drawString(I18n.getStringParams("demo.help.movementShort", new Object[] {GameSettings.getKeyDisplayString(var6.keyBindForward.keyCode), GameSettings.getKeyDisplayString(var6.keyBindLeft.keyCode), GameSettings.getKeyDisplayString(var6.keyBindBack.keyCode), GameSettings.getKeyDisplayString(var6.keyBindRight.keyCode)}), var4, var5, 5197647); + this.fontRenderer.drawString(I18n.getString("demo.help.movementMouse"), var4, var5 + 12, 5197647); + this.fontRenderer.drawString(I18n.getStringParams("demo.help.jump", new Object[] {GameSettings.getKeyDisplayString(var6.keyBindJump.keyCode)}), var4, var5 + 24, 5197647); + this.fontRenderer.drawString(I18n.getStringParams("demo.help.inventory", new Object[] {GameSettings.getKeyDisplayString(var6.keyBindInventory.keyCode)}), var4, var5 + 36, 5197647); + this.fontRenderer.drawSplitString(I18n.getString("demo.help.fullWrapped"), var4, var5 + 68, 218, 2039583); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenDisconnectedOnline.java b/src/main/java/net/minecraft/src/GuiScreenDisconnectedOnline.java new file mode 100644 index 0000000..992c831 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenDisconnectedOnline.java @@ -0,0 +1,76 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class GuiScreenDisconnectedOnline extends GuiScreen +{ + private String field_98113_a; + private String field_98111_b; + private Object[] field_98112_c; + private List field_98110_d; + private final GuiScreen field_98114_n; + + public GuiScreenDisconnectedOnline(GuiScreen par1GuiScreen, String par2Str, String par3Str, Object ... par4ArrayOfObj) + { + this.field_98114_n = par1GuiScreen; + this.field_98113_a = I18n.getString(par2Str); + this.field_98111_b = par3Str; + this.field_98112_c = par4ArrayOfObj; + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) {} + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.getString("gui.back"))); + + if (this.field_98112_c != null) + { + this.field_98110_d = this.fontRenderer.listFormattedStringToWidth(I18n.getStringParams(this.field_98111_b, this.field_98112_c), this.width - 50); + } + else + { + this.field_98110_d = this.fontRenderer.listFormattedStringToWidth(I18n.getString(this.field_98111_b), this.width - 50); + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(this.field_98114_n); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.field_98113_a, this.width / 2, this.height / 2 - 50, 11184810); + int var4 = this.height / 2 - 30; + + if (this.field_98110_d != null) + { + for (Iterator var5 = this.field_98110_d.iterator(); var5.hasNext(); var4 += this.fontRenderer.FONT_HEIGHT) + { + String var6 = (String)var5.next(); + this.drawCenteredString(this.fontRenderer, var6, this.width / 2, var4, 16777215); + } + } + + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenEditOnlineWorld.java b/src/main/java/net/minecraft/src/GuiScreenEditOnlineWorld.java new file mode 100644 index 0000000..b8d91df --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenEditOnlineWorld.java @@ -0,0 +1,162 @@ +package net.minecraft.src; + +import java.io.UnsupportedEncodingException; +import org.lwjgl.input.Keyboard; + +public class GuiScreenEditOnlineWorld extends GuiScreen +{ + private GuiScreen field_96204_a; + private GuiScreen field_96202_b; + private GuiTextField field_96203_c; + private GuiTextField field_96201_d; + private McoServer field_96205_n; + private GuiButton field_96206_o; + private int field_104054_p; + private int field_104053_q; + private int field_104052_r; + private GuiScreenOnlineServersSubscreen field_104051_s; + + public GuiScreenEditOnlineWorld(GuiScreen par1GuiScreen, GuiScreen par2GuiScreen, McoServer par3McoServer) + { + this.field_96204_a = par1GuiScreen; + this.field_96202_b = par2GuiScreen; + this.field_96205_n = par3McoServer; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.field_96201_d.updateCursorCounter(); + this.field_96203_c.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.field_104054_p = this.width / 4; + this.field_104053_q = this.width / 4 - 2; + this.field_104052_r = this.width / 2 + 4; + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(this.field_96206_o = new GuiButton(0, this.field_104054_p, this.height / 4 + 120 + 22, this.field_104053_q, 20, I18n.getString("mco.configure.world.buttons.done"))); + this.buttonList.add(new GuiButton(1, this.field_104052_r, this.height / 4 + 120 + 22, this.field_104053_q, 20, I18n.getString("gui.cancel"))); + this.field_96201_d = new GuiTextField(this.fontRenderer, this.field_104054_p, 56, 212, 20); + this.field_96201_d.setFocused(true); + this.field_96201_d.setMaxStringLength(32); + this.field_96201_d.setText(this.field_96205_n.func_96398_b()); + this.field_96203_c = new GuiTextField(this.fontRenderer, this.field_104054_p, 96, 212, 20); + this.field_96203_c.setMaxStringLength(32); + this.field_96203_c.setText(this.field_96205_n.func_96397_a()); + this.field_104051_s = new GuiScreenOnlineServersSubscreen(this.width, this.height, this.field_104054_p, 122, this.field_96205_n.field_110729_i, this.field_96205_n.field_110728_j); + this.buttonList.addAll(this.field_104051_s.field_104079_a); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 1) + { + this.mc.displayGuiScreen(this.field_96204_a); + } + else if (par1GuiButton.id == 0) + { + this.func_96200_g(); + } + else if (par1GuiButton.id == 2) + { + this.mc.displayGuiScreen(new GuiScreenResetWorld(this, this.field_96205_n)); + } + else + { + this.field_104051_s.func_104069_a(par1GuiButton); + } + } + } + + private void func_96200_g() + { + McoClient var1 = new McoClient(this.mc.getSession()); + + try + { + String var2 = this.field_96203_c.getText() != null && !this.field_96203_c.getText().trim().equals("") ? this.field_96203_c.getText() : null; + var1.func_96384_a(this.field_96205_n.field_96408_a, this.field_96201_d.getText(), var2, this.field_104051_s.field_104076_e, this.field_104051_s.field_104073_f); + this.field_96205_n.func_96399_a(this.field_96201_d.getText()); + this.field_96205_n.func_96400_b(this.field_96203_c.getText()); + this.field_96205_n.field_110729_i = this.field_104051_s.field_104076_e; + this.field_96205_n.field_110728_j = this.field_104051_s.field_104073_f; + this.mc.displayGuiScreen(new GuiScreenConfigureWorld(this.field_96202_b, this.field_96205_n)); + } + catch (ExceptionMcoService var3) + { + this.mc.getLogAgent().logSevere(var3.toString()); + } + catch (UnsupportedEncodingException var4) + { + this.mc.getLogAgent().logWarning("Realms: " + var4.getLocalizedMessage()); + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + this.field_96201_d.textboxKeyTyped(par1, par2); + this.field_96203_c.textboxKeyTyped(par1, par2); + + if (par2 == 15) + { + this.field_96201_d.setFocused(!this.field_96201_d.isFocused()); + this.field_96203_c.setFocused(!this.field_96203_c.isFocused()); + } + + if (par2 == 28 || par2 == 156) + { + this.func_96200_g(); + } + + this.field_96206_o.enabled = this.field_96201_d.getText() != null && !this.field_96201_d.getText().trim().equals(""); + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + this.field_96203_c.mouseClicked(par1, par2, par3); + this.field_96201_d.mouseClicked(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, I18n.getString("mco.configure.world.edit.title"), this.width / 2, 17, 16777215); + this.drawString(this.fontRenderer, I18n.getString("mco.configure.world.name"), this.field_104054_p, 43, 10526880); + this.drawString(this.fontRenderer, I18n.getString("mco.configure.world.description"), this.field_104054_p, 84, 10526880); + this.field_96201_d.drawTextBox(); + this.field_96203_c.drawTextBox(); + this.field_104051_s.func_104071_a(this, this.fontRenderer); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenHorseInventory.java b/src/main/java/net/minecraft/src/GuiScreenHorseInventory.java new file mode 100644 index 0000000..9dfd053 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenHorseInventory.java @@ -0,0 +1,65 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiScreenHorseInventory extends GuiContainer +{ + private static final ResourceLocation horseGuiTextures = new ResourceLocation("textures/gui/container/horse.png"); + private IInventory field_110413_u; + private IInventory field_110412_v; + private EntityHorse field_110411_w; + private float field_110416_x; + private float field_110415_y; + + public GuiScreenHorseInventory(IInventory par1IInventory, IInventory par2IInventory, EntityHorse par3EntityHorse) + { + super(new ContainerHorseInventory(par1IInventory, par2IInventory, par3EntityHorse)); + this.field_110413_u = par1IInventory; + this.field_110412_v = par2IInventory; + this.field_110411_w = par3EntityHorse; + this.allowUserInput = false; + } + + /** + * Draw the foreground layer for the GuiContainer (everything in front of the items) + */ + protected void drawGuiContainerForegroundLayer(int par1, int par2) + { + this.fontRenderer.drawString(this.field_110412_v.isInvNameLocalized() ? this.field_110412_v.getInvName() : I18n.getString(this.field_110412_v.getInvName()), 8, 6, 4210752); + this.fontRenderer.drawString(this.field_110413_u.isInvNameLocalized() ? this.field_110413_u.getInvName() : I18n.getString(this.field_110413_u.getInvName()), 8, this.ySize - 96 + 2, 4210752); + } + + /** + * Draw the background layer for the GuiContainer (everything behind the items) + */ + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(horseGuiTextures); + int var4 = (this.width - this.xSize) / 2; + int var5 = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(var4, var5, 0, 0, this.xSize, this.ySize); + + if (this.field_110411_w.isChested()) + { + this.drawTexturedModalRect(var4 + 79, var5 + 17, 0, this.ySize, 90, 54); + } + + if (this.field_110411_w.func_110259_cr()) + { + this.drawTexturedModalRect(var4 + 7, var5 + 35, 0, this.ySize + 54, 18, 18); + } + + GuiInventory.func_110423_a(var4 + 51, var5 + 60, 17, (float)(var4 + 51) - this.field_110416_x, (float)(var5 + 75 - 50) - this.field_110415_y, this.field_110411_w); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.field_110416_x = (float)par1; + this.field_110415_y = (float)par2; + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenInvite.java b/src/main/java/net/minecraft/src/GuiScreenInvite.java new file mode 100644 index 0000000..4a36460 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenInvite.java @@ -0,0 +1,158 @@ +package net.minecraft.src; + +import java.io.IOException; +import org.lwjgl.input.Keyboard; + +public class GuiScreenInvite extends GuiScreen +{ + private GuiTextField field_96227_a; + private McoServer field_96223_b; + private final GuiScreen field_96224_c; + private final GuiScreenConfigureWorld field_96222_d; + private final int field_96228_n = 0; + private final int field_96229_o = 1; + private String field_101016_p = "Could not invite the provided name"; + private String field_96226_p; + private boolean field_96225_q; + + public GuiScreenInvite(GuiScreen par1GuiScreen, GuiScreenConfigureWorld par2GuiScreenConfigureWorld, McoServer par3McoServer) + { + this.field_96224_c = par1GuiScreen; + this.field_96222_d = par2GuiScreenConfigureWorld; + this.field_96223_b = par3McoServer; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.field_96227_a.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.getString("mco.configure.world.buttons.invite"))); + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.getString("gui.cancel"))); + this.field_96227_a = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 66, 200, 20); + this.field_96227_a.setFocused(true); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 1) + { + this.mc.displayGuiScreen(this.field_96222_d); + } + else if (par1GuiButton.id == 0) + { + McoClient var2 = new McoClient(this.mc.getSession()); + + if (this.field_96227_a.getText() == null || this.field_96227_a.getText().isEmpty()) + { + return; + } + + try + { + McoServer var3 = var2.func_96387_b(this.field_96223_b.field_96408_a, this.field_96227_a.getText()); + + if (var3 != null) + { + this.field_96223_b.field_96402_f = var3.field_96402_f; + this.mc.displayGuiScreen(new GuiScreenConfigureWorld(this.field_96224_c, this.field_96223_b)); + } + else + { + this.func_101015_a(this.field_101016_p); + } + } + catch (ExceptionMcoService var4) + { + this.mc.getLogAgent().logSevere(var4.toString()); + this.func_101015_a(var4.field_96391_b); + } + catch (IOException var5) + { + this.mc.getLogAgent().logWarning("Realms: could not parse response"); + this.func_101015_a(this.field_101016_p); + } + } + } + } + + private void func_101015_a(String par1Str) + { + this.field_96225_q = true; + this.field_96226_p = par1Str; + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + this.field_96227_a.textboxKeyTyped(par1, par2); + + if (par2 == 15) + { + if (this.field_96227_a.isFocused()) + { + this.field_96227_a.setFocused(false); + } + else + { + this.field_96227_a.setFocused(true); + } + } + + if (par2 == 28 || par2 == 156) + { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + this.field_96227_a.mouseClicked(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawString(this.fontRenderer, I18n.getString("mco.configure.world.invite.profile.name"), this.width / 2 - 100, 53, 10526880); + + if (this.field_96225_q) + { + this.drawCenteredString(this.fontRenderer, this.field_96226_p, this.width / 2, 100, 16711680); + } + + this.field_96227_a.drawTextBox(); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenLongRunningTask.java b/src/main/java/net/minecraft/src/GuiScreenLongRunningTask.java new file mode 100644 index 0000000..97d07d2 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenLongRunningTask.java @@ -0,0 +1,126 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Collections; + +public class GuiScreenLongRunningTask extends GuiScreen +{ + private final int field_96213_b = 666; + private final GuiScreen previousScreen; + private final Thread taskThread; + private volatile String message = ""; + private volatile boolean taskFailed; + private volatile String failedMessage; + + /** + * Set to true when back button is clicked, or any other button with ID 666 + */ + private volatile boolean screenWasClosed; + + /** Incremented every tick, used to display progress indicator. */ + private int progressCounter; + + /** The long running task this GUI is showing the progress of. */ + private TaskLongRunning task; + public static final String[] PROGRESS_TEXT = new String[] {"\u00e2\u2013\u0192 \u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e \u00e2\u2013\u0192", "_ \u00e2\u2013\u0192 \u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e", "_ _ \u00e2\u2013\u0192 \u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026", "_ _ _ \u00e2\u2013\u0192 \u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020", "_ _ _ _ \u00e2\u2013\u0192 \u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021", "_ _ _ _ _ \u00e2\u2013\u0192 \u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6", "_ _ _ _ \u00e2\u2013\u0192 \u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021", "_ _ _ \u00e2\u2013\u0192 \u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020", "_ _ \u00e2\u2013\u0192 \u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026", "_ \u00e2\u2013\u0192 \u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e", "\u00e2\u2013\u0192 \u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e \u00e2\u2013\u0192", "\u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e \u00e2\u2013\u0192 _", "\u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e \u00e2\u2013\u0192 _ _", "\u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e \u00e2\u2013\u0192 _ _ _", "\u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e \u00e2\u2013\u0192 _ _ _ _", "\u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e \u00e2\u2013\u0192 _ _ _ _ _", "\u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e \u00e2\u2013\u0192 _ _ _ _", "\u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e \u00e2\u2013\u0192 _ _ _", "\u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e \u00e2\u2013\u0192 _ _", "\u00e2\u2013\u201e \u00e2\u2013\u2026 \u00e2\u2013\u2020 \u00e2\u2013\u2021 \u00e2\u2013\u02c6 \u00e2\u2013\u2021 \u00e2\u2013\u2020 \u00e2\u2013\u2026 \u00e2\u2013\u201e \u00e2\u2013\u0192 _"}; + + public GuiScreenLongRunningTask(Minecraft par1Minecraft, GuiScreen par2GuiScreen, TaskLongRunning par3TaskLongRunning) + { + super.buttonList = Collections.synchronizedList(new ArrayList()); + this.mc = par1Minecraft; + this.previousScreen = par2GuiScreen; + this.task = par3TaskLongRunning; + par3TaskLongRunning.setGUI(this); + this.taskThread = new Thread(par3TaskLongRunning); + } + + public void func_98117_g() + { + this.taskThread.start(); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + ++this.progressCounter; + this.task.updateScreen(); + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) {} + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.task.initGUI(); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 666) + { + this.screenWasClosed = true; + this.mc.displayGuiScreen(this.previousScreen); + } + + this.task.buttonClicked(par1GuiButton); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.message, this.width / 2, this.height / 2 - 50, 16777215); + this.drawCenteredString(this.fontRenderer, "", this.width / 2, this.height / 2 - 10, 16777215); + + if (!this.taskFailed) + { + this.drawCenteredString(this.fontRenderer, PROGRESS_TEXT[this.progressCounter % PROGRESS_TEXT.length], this.width / 2, this.height / 2 + 15, 8421504); + } + + if (this.taskFailed) + { + this.drawCenteredString(this.fontRenderer, this.failedMessage, this.width / 2, this.height / 2 + 15, 16711680); + } + + super.drawScreen(par1, par2, par3); + } + + public void setFailedMessage(String par1Str) + { + this.taskFailed = true; + this.failedMessage = par1Str; + this.buttonList.clear(); + this.buttonList.add(new GuiButton(666, this.width / 2 - 100, this.height / 4 + 120 + 12, "Back")); + } + + public Minecraft func_96208_g() + { + return this.mc; + } + + public void setMessage(String par1Str) + { + this.message = par1Str; + } + + /** + * Returns the value of screenWasClosed + */ + public boolean wasScreenClosed() + { + return this.screenWasClosed; + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenMcoWorldTemplate.java b/src/main/java/net/minecraft/src/GuiScreenMcoWorldTemplate.java new file mode 100644 index 0000000..af99299 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenMcoWorldTemplate.java @@ -0,0 +1,155 @@ +package net.minecraft.src; + +import java.util.Collections; +import java.util.List; +import org.lwjgl.input.Keyboard; + +public class GuiScreenMcoWorldTemplate extends GuiScreen +{ + private final ScreenWithCallback field_110401_a; + private WorldTemplate field_110398_b; + private List field_110399_c = Collections.emptyList(); + private GuiScreenMcoWorldTemplateSelectionList field_110396_d; + private int field_110397_e = -1; + private GuiButton field_110400_p; + + public GuiScreenMcoWorldTemplate(ScreenWithCallback par1ScreenWithCallback, WorldTemplate par2WorldTemplate) + { + this.field_110401_a = par1ScreenWithCallback; + this.field_110398_b = par2WorldTemplate; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.field_110396_d = new GuiScreenMcoWorldTemplateSelectionList(this); + (new GuiScreenMcoWorldTemplateDownloadThread(this)).start(); + this.func_110385_g(); + } + + private void func_110385_g() + { + this.buttonList.add(new GuiButton(0, this.width / 2 + 6, this.height - 52, 153, 20, I18n.getString("gui.cancel"))); + this.buttonList.add(this.field_110400_p = new GuiButton(1, this.width / 2 - 154, this.height - 52, 153, 20, I18n.getString("mco.template.button.select"))); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 1) + { + this.func_110394_h(); + } + else if (par1GuiButton.id == 0) + { + this.field_110401_a.func_110354_a((Object)null); + this.mc.displayGuiScreen(this.field_110401_a); + } + else + { + this.field_110396_d.actionPerformed(par1GuiButton); + } + } + } + + private void func_110394_h() + { + if (this.field_110397_e >= 0 && this.field_110397_e < this.field_110399_c.size()) + { + this.field_110401_a.func_110354_a(this.field_110399_c.get(this.field_110397_e)); + this.mc.displayGuiScreen(this.field_110401_a); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.field_110396_d.drawScreen(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, I18n.getString("mco.template.title"), this.width / 2, 20, 16777215); + super.drawScreen(par1, par2, par3); + } + + static Minecraft func_110382_a(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate) + { + return par0GuiScreenMcoWorldTemplate.mc; + } + + static List func_110388_a(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate, List par1List) + { + return par0GuiScreenMcoWorldTemplate.field_110399_c = par1List; + } + + static Minecraft func_110392_b(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate) + { + return par0GuiScreenMcoWorldTemplate.mc; + } + + static Minecraft func_130066_c(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate) + { + return par0GuiScreenMcoWorldTemplate.mc; + } + + static List func_110395_c(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate) + { + return par0GuiScreenMcoWorldTemplate.field_110399_c; + } + + static int func_130064_a(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate, int par1) + { + return par0GuiScreenMcoWorldTemplate.field_110397_e = par1; + } + + static WorldTemplate func_130065_a(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate, WorldTemplate par1WorldTemplate) + { + return par0GuiScreenMcoWorldTemplate.field_110398_b = par1WorldTemplate; + } + + static WorldTemplate func_130067_e(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate) + { + return par0GuiScreenMcoWorldTemplate.field_110398_b; + } + + static int func_130062_f(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate) + { + return par0GuiScreenMcoWorldTemplate.field_110397_e; + } + + static FontRenderer func_110389_g(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate) + { + return par0GuiScreenMcoWorldTemplate.fontRenderer; + } + + static FontRenderer func_110387_h(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate) + { + return par0GuiScreenMcoWorldTemplate.fontRenderer; + } + + static FontRenderer func_110384_i(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate) + { + return par0GuiScreenMcoWorldTemplate.fontRenderer; + } + + static FontRenderer func_130063_j(GuiScreenMcoWorldTemplate par0GuiScreenMcoWorldTemplate) + { + return par0GuiScreenMcoWorldTemplate.fontRenderer; + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenMcoWorldTemplateDownloadThread.java b/src/main/java/net/minecraft/src/GuiScreenMcoWorldTemplateDownloadThread.java new file mode 100644 index 0000000..4433995 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenMcoWorldTemplateDownloadThread.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +class GuiScreenMcoWorldTemplateDownloadThread extends Thread +{ + final GuiScreenMcoWorldTemplate field_111256_a; + + GuiScreenMcoWorldTemplateDownloadThread(GuiScreenMcoWorldTemplate par1GuiScreenMcoWorldTemplate) + { + this.field_111256_a = par1GuiScreenMcoWorldTemplate; + } + + public void run() + { + McoClient var1 = new McoClient(GuiScreenMcoWorldTemplate.func_110382_a(this.field_111256_a).getSession()); + + try + { + GuiScreenMcoWorldTemplate.func_110388_a(this.field_111256_a, var1.func_111231_d().field_110736_a); + } + catch (ExceptionMcoService var3) + { + GuiScreenMcoWorldTemplate.func_110392_b(this.field_111256_a).getLogAgent().logSevere(var3.toString()); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenMcoWorldTemplateSelectionList.java b/src/main/java/net/minecraft/src/GuiScreenMcoWorldTemplateSelectionList.java new file mode 100644 index 0000000..6c13eda --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenMcoWorldTemplateSelectionList.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +class GuiScreenMcoWorldTemplateSelectionList extends GuiScreenSelectLocation +{ + final GuiScreenMcoWorldTemplate field_111245_a; + + public GuiScreenMcoWorldTemplateSelectionList(GuiScreenMcoWorldTemplate par1GuiScreenMcoWorldTemplate) + { + super(GuiScreenMcoWorldTemplate.func_130066_c(par1GuiScreenMcoWorldTemplate), par1GuiScreenMcoWorldTemplate.width, par1GuiScreenMcoWorldTemplate.height, 32, par1GuiScreenMcoWorldTemplate.height - 64, 36); + this.field_111245_a = par1GuiScreenMcoWorldTemplate; + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return GuiScreenMcoWorldTemplate.func_110395_c(this.field_111245_a).size() + 1; + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) + { + if (par1 < GuiScreenMcoWorldTemplate.func_110395_c(this.field_111245_a).size()) + { + GuiScreenMcoWorldTemplate.func_130064_a(this.field_111245_a, par1); + GuiScreenMcoWorldTemplate.func_130065_a(this.field_111245_a, (WorldTemplate)null); + } + } + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return GuiScreenMcoWorldTemplate.func_110395_c(this.field_111245_a).size() == 0 ? false : (par1 >= GuiScreenMcoWorldTemplate.func_110395_c(this.field_111245_a).size() ? false : (GuiScreenMcoWorldTemplate.func_130067_e(this.field_111245_a) != null ? GuiScreenMcoWorldTemplate.func_130067_e(this.field_111245_a).field_110732_b.equals(((WorldTemplate)GuiScreenMcoWorldTemplate.func_110395_c(this.field_111245_a).get(par1)).field_110732_b) : par1 == GuiScreenMcoWorldTemplate.func_130062_f(this.field_111245_a))); + } + + protected boolean func_104086_b(int par1) + { + return false; + } + + protected int func_130003_b() + { + return this.getSize() * 36; + } + + protected void func_130004_c() + { + this.field_111245_a.drawDefaultBackground(); + } + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + if (par1 < GuiScreenMcoWorldTemplate.func_110395_c(this.field_111245_a).size()) + { + this.func_111244_b(par1, par2, par3, par4, par5Tessellator); + } + } + + private void func_111244_b(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + WorldTemplate var6 = (WorldTemplate)GuiScreenMcoWorldTemplate.func_110395_c(this.field_111245_a).get(par1); + this.field_111245_a.drawString(GuiScreenMcoWorldTemplate.func_110389_g(this.field_111245_a), var6.field_110732_b, par2 + 2, par3 + 1, 16777215); + this.field_111245_a.drawString(GuiScreenMcoWorldTemplate.func_110387_h(this.field_111245_a), var6.field_110731_d, par2 + 2, par3 + 12, 7105644); + this.field_111245_a.drawString(GuiScreenMcoWorldTemplate.func_110384_i(this.field_111245_a), var6.field_110733_c, par2 + 2 + 207 - GuiScreenMcoWorldTemplate.func_130063_j(this.field_111245_a).getStringWidth(var6.field_110733_c), par3 + 1, 5000268); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenOnlineServers.java b/src/main/java/net/minecraft/src/GuiScreenOnlineServers.java new file mode 100644 index 0000000..fa5f582 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenOnlineServers.java @@ -0,0 +1,774 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.util.Iterator; +import java.util.List; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +public class GuiScreenOnlineServers extends GuiScreen +{ + private static final ResourceLocation field_130039_a = new ResourceLocation("textures/gui/widgets.png"); + private GuiScreen field_96188_a; + private GuiSlotOnlineServerList field_96186_b; + private static int field_96187_c; + private static final Object field_96185_d = new Object(); + private long field_96189_n = -1L; + private GuiButton field_96190_o; + private GuiButton field_96198_p; + private GuiButtonLink field_96197_q; + private GuiButton field_96196_r; + private String field_96195_s; + private static McoServerList field_96194_t = new McoServerList(); + private boolean field_96193_u; + private List field_96192_v = Lists.newArrayList(); + private volatile int field_96199_x = 0; + private Long field_102019_y; + private int field_104044_y; + + public GuiScreenOnlineServers(GuiScreen par1GuiScreen) + { + this.field_96188_a = par1GuiScreen; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + field_96194_t.func_130129_a(this.mc.getSession()); + + if (!this.field_96193_u) + { + this.field_96193_u = true; + this.field_96186_b = new GuiSlotOnlineServerList(this); + } + else + { + this.field_96186_b.func_104084_a(this.width, this.height, 32, this.height - 64); + } + + this.func_96178_g(); + } + + public void func_96178_g() + { + this.buttonList.add(this.field_96196_r = new GuiButton(1, this.width / 2 - 154, this.height - 52, 100, 20, I18n.getString("mco.selectServer.play"))); + this.buttonList.add(this.field_96198_p = new GuiButton(2, this.width / 2 - 48, this.height - 52, 100, 20, I18n.getString("mco.selectServer.create"))); + this.buttonList.add(this.field_96190_o = new GuiButton(3, this.width / 2 + 58, this.height - 52, 100, 20, I18n.getString("mco.selectServer.configure"))); + this.buttonList.add(this.field_96197_q = new GuiButtonLink(4, this.width / 2 - 154, this.height - 28, 154, 20, I18n.getString("mco.selectServer.moreinfo"))); + this.buttonList.add(new GuiButton(0, this.width / 2 + 6, this.height - 28, 153, 20, I18n.getString("gui.cancel"))); + McoServer var1 = this.func_140030_b(this.field_96189_n); + this.field_96196_r.enabled = var1 != null && var1.field_96404_d.equals("OPEN") && !var1.field_98166_h; + this.field_96198_p.enabled = this.field_96199_x > 0; + + if (var1 != null && !var1.field_96405_e.equals(this.mc.getSession().getUsername())) + { + this.field_96190_o.displayString = I18n.getString("mco.selectServer.leave"); + } + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + ++this.field_104044_y; + + if (field_96194_t.func_130127_a()) + { + List var1 = field_96194_t.func_98252_c(); + Iterator var2 = var1.iterator(); + + while (var2.hasNext()) + { + McoServer var3 = (McoServer)var2.next(); + Iterator var4 = this.field_96192_v.iterator(); + + while (var4.hasNext()) + { + McoServer var5 = (McoServer)var4.next(); + + if (var3.field_96408_a == var5.field_96408_a) + { + var3.func_96401_a(var5); + + if (this.field_102019_y != null && this.field_102019_y.longValue() == var3.field_96408_a) + { + this.field_102019_y = null; + var3.field_96411_l = false; + } + + break; + } + } + } + + this.field_96199_x = field_96194_t.func_140056_e(); + this.field_96192_v = var1; + field_96194_t.func_98250_b(); + } + + this.field_96198_p.enabled = this.field_96199_x > 0; + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 1) + { + this.func_140032_e(this.field_96189_n); + } + else if (par1GuiButton.id == 3) + { + this.func_140019_s(); + } + else if (par1GuiButton.id == 0) + { + field_96194_t.func_98248_d(); + this.mc.displayGuiScreen(this.field_96188_a); + } + else if (par1GuiButton.id == 2) + { + field_96194_t.func_98248_d(); + this.mc.displayGuiScreen(new GuiScreenCreateOnlineWorld(this)); + } + else if (par1GuiButton.id == 4) + { + this.field_96197_q.func_96135_a("http://realms.minecraft.net/"); + } + else + { + this.field_96186_b.actionPerformed(par1GuiButton); + } + } + } + + private void func_140019_s() + { + McoServer var1 = this.func_140030_b(this.field_96189_n); + + if (var1 != null) + { + if (this.mc.getSession().getUsername().equals(var1.field_96405_e)) + { + McoServer var2 = this.func_98086_a(var1.field_96408_a); + + if (var2 != null) + { + field_96194_t.func_98248_d(); + this.mc.displayGuiScreen(new GuiScreenConfigureWorld(this, var2)); + } + } + else + { + String var4 = I18n.getString("mco.configure.world.leave.question.line1"); + String var3 = I18n.getString("mco.configure.world.leave.question.line2"); + this.mc.displayGuiScreen(new GuiScreenConfirmation(this, GuiScreenConfirmationType.Info, var4, var3, 3)); + } + } + } + + private McoServer func_140030_b(long par1) + { + Iterator var3 = this.field_96192_v.iterator(); + McoServer var4; + + do + { + if (!var3.hasNext()) + { + return null; + } + + var4 = (McoServer)var3.next(); + } + while (var4.field_96408_a != par1); + + return var4; + } + + private int func_140009_c(long par1) + { + for (int var3 = 0; var3 < this.field_96192_v.size(); ++var3) + { + if (((McoServer)this.field_96192_v.get(var3)).field_96408_a == par1) + { + return var3; + } + } + + return -1; + } + + public void confirmClicked(boolean par1, int par2) + { + if (par2 == 3 && par1) + { + (new ThreadOnlineScreen(this)).start(); + } + + this.mc.displayGuiScreen(this); + } + + private void func_140012_t() + { + int var1 = this.func_140009_c(this.field_96189_n); + + if (this.field_96192_v.size() - 1 == var1) + { + --var1; + } + + if (this.field_96192_v.size() == 0) + { + var1 = -1; + } + + if (var1 >= 0 && var1 < this.field_96192_v.size()) + { + this.field_96189_n = ((McoServer)this.field_96192_v.get(var1)).field_96408_a; + } + } + + public void func_102018_a(long par1) + { + this.field_96189_n = -1L; + this.field_102019_y = Long.valueOf(par1); + } + + private McoServer func_98086_a(long par1) + { + McoClient var3 = new McoClient(this.mc.getSession()); + + try + { + return var3.func_98176_a(par1); + } + catch (ExceptionMcoService var5) + { + this.mc.getLogAgent().logSevere(var5.toString()); + } + catch (IOException var6) + { + this.mc.getLogAgent().logWarning("Realms: could not parse response"); + } + + return null; + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (par2 == 59) + { + this.mc.gameSettings.hideServerAddress = !this.mc.gameSettings.hideServerAddress; + this.mc.gameSettings.saveOptions(); + } + else + { + if (par2 != 28 && par2 != 156) + { + super.keyTyped(par1, par2); + } + else + { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.field_96195_s = null; + this.drawDefaultBackground(); + this.field_96186_b.drawScreen(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, I18n.getString("mco.title"), this.width / 2, 20, 16777215); + super.drawScreen(par1, par2, par3); + + if (this.field_96195_s != null) + { + this.func_96165_a(this.field_96195_s, par1, par2); + } + + this.func_130038_b(par1, par2); + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + + if (this.func_130037_c(par1, par2) && field_96194_t.func_130124_d() != 0) + { + GuiScreenPendingInvitation var4 = new GuiScreenPendingInvitation(this); + this.mc.displayGuiScreen(var4); + } + } + + private void func_130038_b(int par1, int par2) + { + int var3 = field_96194_t.func_130124_d(); + boolean var4 = this.func_130037_c(par1, par2); + this.mc.getTextureManager().bindTexture(field_130039_a); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPushMatrix(); + this.drawTexturedModalRect(this.width / 2 + 58, 15, var4 ? 166 : 182, 22, 16, 16); + GL11.glPopMatrix(); + int var5; + int var6; + + if (var3 != 0) + { + var5 = 198 + (Math.min(var3, 6) - 1) * 8; + var6 = (int)(Math.max(0.0F, Math.max(MathHelper.sin((float)(10 + this.field_104044_y) * 0.57F), MathHelper.cos((float)this.field_104044_y * 0.35F))) * -6.0F); + this.mc.getTextureManager().bindTexture(field_130039_a); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPushMatrix(); + this.drawTexturedModalRect(this.width / 2 + 58 + 4, 19 + var6, var5, 22, 8, 8); + GL11.glPopMatrix(); + } + + if (var4 && var3 != 0) + { + var5 = par1 + 12; + var6 = par2 - 12; + String var7 = I18n.getString("mco.invites.pending"); + int var8 = this.fontRenderer.getStringWidth(var7); + this.drawGradientRect(var5 - 3, var6 - 3, var5 + var8 + 3, var6 + 8 + 3, -1073741824, -1073741824); + this.fontRenderer.drawStringWithShadow(var7, var5, var6, -1); + } + } + + private boolean func_130037_c(int par1, int par2) + { + int var3 = this.width / 2 + 56; + int var4 = this.width / 2 + 78; + byte var5 = 13; + byte var6 = 27; + return var3 <= par1 && par1 <= var4 && var5 <= par2 && par2 <= var6; + } + + private void func_140032_e(long par1) + { + McoServer var3 = this.func_140030_b(par1); + + if (var3 != null) + { + field_96194_t.func_98248_d(); + GuiScreenLongRunningTask var4 = new GuiScreenLongRunningTask(this.mc, this, new TaskOnlineConnect(this, var3)); + var4.func_98117_g(); + this.mc.displayGuiScreen(var4); + } + } + + private void func_101008_c(int par1, int par2, int par3, int par4) + { + this.mc.getTextureManager().bindTexture(field_130039_a); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPushMatrix(); + GL11.glScalef(0.5F, 0.5F, 0.5F); + this.drawTexturedModalRect(par1 * 2, par2 * 2, 191, 0, 16, 15); + GL11.glPopMatrix(); + + if (par3 >= par1 && par3 <= par1 + 9 && par4 >= par2 && par4 <= par2 + 9) + { + this.field_96195_s = I18n.getString("mco.selectServer.expired"); + } + } + + private void func_104039_b(int par1, int par2, int par3, int par4, int par5) + { + if (this.field_104044_y % 20 < 10) + { + this.mc.getTextureManager().bindTexture(field_130039_a); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPushMatrix(); + GL11.glScalef(0.5F, 0.5F, 0.5F); + this.drawTexturedModalRect(par1 * 2, par2 * 2, 207, 0, 16, 15); + GL11.glPopMatrix(); + } + + if (par3 >= par1 && par3 <= par1 + 9 && par4 >= par2 && par4 <= par2 + 9) + { + if (par5 == 0) + { + this.field_96195_s = I18n.getString("mco.selectServer.expires.soon"); + } + else if (par5 == 1) + { + this.field_96195_s = I18n.getString("mco.selectServer.expires.day"); + } + else + { + this.field_96195_s = I18n.getStringParams("mco.selectServer.expires.days", new Object[] {Integer.valueOf(par5)}); + } + } + } + + private void func_101006_d(int par1, int par2, int par3, int par4) + { + this.mc.getTextureManager().bindTexture(field_130039_a); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPushMatrix(); + GL11.glScalef(0.5F, 0.5F, 0.5F); + this.drawTexturedModalRect(par1 * 2, par2 * 2, 207, 0, 16, 15); + GL11.glPopMatrix(); + + if (par3 >= par1 && par3 <= par1 + 9 && par4 >= par2 && par4 <= par2 + 9) + { + this.field_96195_s = I18n.getString("mco.selectServer.open"); + } + } + + private void func_101001_e(int par1, int par2, int par3, int par4) + { + this.mc.getTextureManager().bindTexture(field_130039_a); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPushMatrix(); + GL11.glScalef(0.5F, 0.5F, 0.5F); + this.drawTexturedModalRect(par1 * 2, par2 * 2, 223, 0, 16, 15); + GL11.glPopMatrix(); + + if (par3 >= par1 && par3 <= par1 + 9 && par4 >= par2 && par4 <= par2 + 9) + { + this.field_96195_s = I18n.getString("mco.selectServer.closed"); + } + } + + protected void func_96165_a(String par1Str, int par2, int par3) + { + if (par1Str != null) + { + int var4 = par2 + 12; + int var5 = par3 - 12; + int var6 = this.fontRenderer.getStringWidth(par1Str); + this.drawGradientRect(var4 - 3, var5 - 3, var4 + var6 + 3, var5 + 8 + 3, -1073741824, -1073741824); + this.fontRenderer.drawStringWithShadow(par1Str, var4, var5, -1); + } + } + + private void func_96174_a(McoServer par1McoServer) throws IOException + { + if (par1McoServer.field_96414_k.equals("")) + { + par1McoServer.field_96414_k = EnumChatFormatting.GRAY + "" + 0; + } + + par1McoServer.field_96415_h = 78; + ServerAddress var2 = ServerAddress.func_78860_a(par1McoServer.field_96403_g); + Socket var3 = null; + DataInputStream var4 = null; + DataOutputStream var5 = null; + + try + { + var3 = new Socket(); + var3.setSoTimeout(3000); + var3.setTcpNoDelay(true); + var3.setTrafficClass(18); + var3.connect(new InetSocketAddress(var2.getIP(), var2.getPort()), 3000); + var4 = new DataInputStream(var3.getInputStream()); + var5 = new DataOutputStream(var3.getOutputStream()); + var5.write(254); + var5.write(1); + + if (var4.read() != 255) + { + throw new IOException("Bad message"); + } + + String var6 = Packet.readString(var4, 256); + char[] var7 = var6.toCharArray(); + + for (int var8 = 0; var8 < var7.length; ++var8) + { + if (var7[var8] != 167 && var7[var8] != 0 && ChatAllowedCharacters.allowedCharacters.indexOf(var7[var8]) < 0) + { + var7[var8] = 63; + } + } + + var6 = new String(var7); + int var9; + int var10; + String[] var27; + + if (var6.startsWith("\u00a7") && var6.length() > 1) + { + var27 = var6.substring(1).split("\u0000"); + + if (MathHelper.parseIntWithDefault(var27[0], 0) == 1) + { + par1McoServer.field_96415_h = MathHelper.parseIntWithDefault(var27[1], par1McoServer.field_96415_h); + var9 = MathHelper.parseIntWithDefault(var27[4], 0); + var10 = MathHelper.parseIntWithDefault(var27[5], 0); + + if (var9 >= 0 && var10 >= 0) + { + par1McoServer.field_96414_k = EnumChatFormatting.GRAY + "" + var9; + } + else + { + par1McoServer.field_96414_k = "" + EnumChatFormatting.DARK_GRAY + "???"; + } + } + else + { + par1McoServer.field_96415_h = 79; + par1McoServer.field_96414_k = "" + EnumChatFormatting.DARK_GRAY + "???"; + } + } + else + { + var27 = var6.split("\u00a7"); + var6 = var27[0]; + var9 = -1; + var10 = -1; + + try + { + var9 = Integer.parseInt(var27[1]); + var10 = Integer.parseInt(var27[2]); + } + catch (Exception var25) + { + ; + } + + par1McoServer.field_96407_c = EnumChatFormatting.GRAY + var6; + + if (var9 >= 0 && var10 > 0) + { + par1McoServer.field_96414_k = EnumChatFormatting.GRAY + "" + var9; + } + else + { + par1McoServer.field_96414_k = "" + EnumChatFormatting.DARK_GRAY + "???"; + } + + par1McoServer.field_96415_h = 77; + } + } + finally + { + try + { + if (var4 != null) + { + var4.close(); + } + } + catch (Throwable var24) + { + ; + } + + try + { + if (var5 != null) + { + var5.close(); + } + } + catch (Throwable var23) + { + ; + } + + try + { + if (var3 != null) + { + var3.close(); + } + } + catch (Throwable var22) + { + ; + } + } + } + + static long func_140041_a(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.field_96189_n; + } + + static McoServer func_140011_a(GuiScreenOnlineServers par0GuiScreenOnlineServers, long par1) + { + return par0GuiScreenOnlineServers.func_140030_b(par1); + } + + static Minecraft func_98075_b(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.mc; + } + + static McoServerList func_140040_h() + { + return field_96194_t; + } + + static List func_140013_c(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.field_96192_v; + } + + static void func_140017_d(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + par0GuiScreenOnlineServers.func_140012_t(); + } + + static Minecraft func_98076_f(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.mc; + } + + static Minecraft func_140037_f(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.mc; + } + + static long func_140036_b(GuiScreenOnlineServers par0GuiScreenOnlineServers, long par1) + { + return par0GuiScreenOnlineServers.field_96189_n = par1; + } + + static Minecraft func_140015_g(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.mc; + } + + static GuiButton func_140038_h(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.field_96190_o; + } + + static GuiButton func_140033_i(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.field_96196_r; + } + + static void func_140008_c(GuiScreenOnlineServers par0GuiScreenOnlineServers, long par1) + { + par0GuiScreenOnlineServers.func_140032_e(par1); + } + + static int func_140027_d(GuiScreenOnlineServers par0GuiScreenOnlineServers, long par1) + { + return par0GuiScreenOnlineServers.func_140009_c(par1); + } + + static Minecraft func_104032_j(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.mc; + } + + static FontRenderer func_140023_k(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.fontRenderer; + } + + static void func_104031_c(GuiScreenOnlineServers par0GuiScreenOnlineServers, int par1, int par2, int par3, int par4) + { + par0GuiScreenOnlineServers.func_101008_c(par1, par2, par3, par4); + } + + static void func_140035_b(GuiScreenOnlineServers par0GuiScreenOnlineServers, int par1, int par2, int par3, int par4) + { + par0GuiScreenOnlineServers.func_101001_e(par1, par2, par3, par4); + } + + static Minecraft func_140014_l(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.mc; + } + + static void func_140031_a(GuiScreenOnlineServers par0GuiScreenOnlineServers, int par1, int par2, int par3, int par4, int par5) + { + par0GuiScreenOnlineServers.func_104039_b(par1, par2, par3, par4, par5); + } + + static void func_140020_c(GuiScreenOnlineServers par0GuiScreenOnlineServers, int par1, int par2, int par3, int par4) + { + par0GuiScreenOnlineServers.func_101006_d(par1, par2, par3, par4); + } + + static FontRenderer func_140039_m(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.fontRenderer; + } + + static FontRenderer func_98079_k(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.fontRenderer; + } + + static Object func_140029_i() + { + return field_96185_d; + } + + static int func_140018_j() + { + return field_96187_c; + } + + static int func_140016_k() + { + return field_96187_c++; + } + + static void func_140024_a(GuiScreenOnlineServers par0GuiScreenOnlineServers, McoServer par1McoServer) throws IOException + { + par0GuiScreenOnlineServers.func_96174_a(par1McoServer); + } + + static int func_140021_r() + { + return field_96187_c--; + } + + static FontRenderer func_110402_q(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.fontRenderer; + } + + static FontRenderer func_140010_p(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.fontRenderer; + } + + static Minecraft func_142023_q(GuiScreenOnlineServers par0GuiScreenOnlineServers) + { + return par0GuiScreenOnlineServers.mc; + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenOnlineServersSubscreen.java b/src/main/java/net/minecraft/src/GuiScreenOnlineServersSubscreen.java new file mode 100644 index 0000000..065b674 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenOnlineServersSubscreen.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class GuiScreenOnlineServersSubscreen +{ + private final int field_104074_g; + private final int field_104081_h; + private final int field_104082_i; + private final int field_104080_j; + List field_104079_a = new ArrayList(); + String[] field_104077_b; + String[] field_104078_c; + String[][] field_104075_d; + int field_104076_e; + int field_104073_f; + + public GuiScreenOnlineServersSubscreen(int par1, int par2, int par3, int par4, int par5, int par6) + { + this.field_104074_g = par1; + this.field_104081_h = par2; + this.field_104082_i = par3; + this.field_104080_j = par4; + this.field_104076_e = par5; + this.field_104073_f = par6; + this.func_104068_a(); + } + + private void func_104068_a() + { + this.func_104070_b(); + this.field_104079_a.add(new GuiButton(5005, this.field_104082_i, this.field_104080_j + 1, 212, 20, this.func_104072_c())); + this.field_104079_a.add(new GuiButton(5006, this.field_104082_i, this.field_104080_j + 25, 212, 20, this.func_104067_d())); + } + + private void func_104070_b() + { + this.field_104077_b = new String[] {I18n.getString("options.difficulty.peaceful"), I18n.getString("options.difficulty.easy"), I18n.getString("options.difficulty.normal"), I18n.getString("options.difficulty.hard")}; + this.field_104078_c = new String[] {I18n.getString("selectWorld.gameMode.survival"), I18n.getString("selectWorld.gameMode.creative"), I18n.getString("selectWorld.gameMode.adventure")}; + this.field_104075_d = new String[][] {{I18n.getString("selectWorld.gameMode.survival.line1"), I18n.getString("selectWorld.gameMode.survival.line2")}, {I18n.getString("selectWorld.gameMode.creative.line1"), I18n.getString("selectWorld.gameMode.creative.line2")}, {I18n.getString("selectWorld.gameMode.adventure.line1"), I18n.getString("selectWorld.gameMode.adventure.line2")}}; + } + + private String func_104072_c() + { + String var1 = I18n.getString("options.difficulty"); + return var1 + ": " + this.field_104077_b[this.field_104076_e]; + } + + private String func_104067_d() + { + String var1 = I18n.getString("selectWorld.gameMode"); + return var1 + ": " + this.field_104078_c[this.field_104073_f]; + } + + void func_104069_a(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 5005) + { + this.field_104076_e = (this.field_104076_e + 1) % this.field_104077_b.length; + par1GuiButton.displayString = this.func_104072_c(); + } + else if (par1GuiButton.id == 5006) + { + this.field_104073_f = (this.field_104073_f + 1) % this.field_104078_c.length; + par1GuiButton.displayString = this.func_104067_d(); + } + } + } + + public void func_104071_a(GuiScreen par1GuiScreen, FontRenderer par2FontRenderer) + { + par1GuiScreen.drawString(par2FontRenderer, this.field_104075_d[this.field_104073_f][0], this.field_104082_i, this.field_104080_j + 50, 10526880); + par1GuiScreen.drawString(par2FontRenderer, this.field_104075_d[this.field_104073_f][1], this.field_104082_i, this.field_104080_j + 60, 10526880); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenPendingInvitation.java b/src/main/java/net/minecraft/src/GuiScreenPendingInvitation.java new file mode 100644 index 0000000..b39740e --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenPendingInvitation.java @@ -0,0 +1,185 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import java.util.List; +import org.lwjgl.input.Keyboard; + +public class GuiScreenPendingInvitation extends GuiScreen +{ + private final GuiScreen field_130061_a; + private GuiScreenPendingInvitationList field_130059_b; + private List field_130060_c = Lists.newArrayList(); + private int field_130058_d = -1; + + public GuiScreenPendingInvitation(GuiScreen par1GuiScreen) + { + this.field_130061_a = par1GuiScreen; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.field_130059_b = new GuiScreenPendingInvitationList(this); + (new GuiScreenPendingInvitationINNER1(this)).start(); + this.func_130050_g(); + } + + private void func_130050_g() + { + this.buttonList.add(new GuiButton(1, this.width / 2 - 154, this.height - 52, 153, 20, I18n.getString("mco.invites.button.accept"))); + this.buttonList.add(new GuiButton(2, this.width / 2 + 6, this.height - 52, 153, 20, I18n.getString("mco.invites.button.reject"))); + this.buttonList.add(new GuiButton(0, this.width / 2 - 75, this.height - 28, 153, 20, I18n.getString("gui.back"))); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 1) + { + this.func_130051_i(); + } + else if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(this.field_130061_a); + } + else if (par1GuiButton.id == 2) + { + this.func_130057_h(); + } + else + { + this.field_130059_b.actionPerformed(par1GuiButton); + } + } + } + + private void func_130057_h() + { + if (this.field_130058_d >= 0 && this.field_130058_d < this.field_130060_c.size()) + { + (new GuiScreenPendingInvitationINNER2(this)).start(); + } + } + + private void func_130051_i() + { + if (this.field_130058_d >= 0 && this.field_130058_d < this.field_130060_c.size()) + { + (new GuiScreenPendingInvitationINNER3(this)).start(); + } + } + + private void func_130047_j() + { + int var1 = this.field_130058_d; + + if (this.field_130060_c.size() - 1 == this.field_130058_d) + { + --this.field_130058_d; + } + + this.field_130060_c.remove(var1); + + if (this.field_130060_c.size() == 0) + { + this.field_130058_d = -1; + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.field_130059_b.drawScreen(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, I18n.getString("mco.invites.title"), this.width / 2, 20, 16777215); + super.drawScreen(par1, par2, par3); + } + + static Minecraft func_130048_a(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + return par0GuiScreenPendingInvitation.mc; + } + + static List func_130043_a(GuiScreenPendingInvitation par0GuiScreenPendingInvitation, List par1List) + { + return par0GuiScreenPendingInvitation.field_130060_c = par1List; + } + + static Minecraft func_130044_b(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + return par0GuiScreenPendingInvitation.mc; + } + + static Minecraft func_130041_c(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + return par0GuiScreenPendingInvitation.mc; + } + + static int func_130049_d(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + return par0GuiScreenPendingInvitation.field_130058_d; + } + + static List func_130042_e(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + return par0GuiScreenPendingInvitation.field_130060_c; + } + + static void func_130040_f(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + par0GuiScreenPendingInvitation.func_130047_j(); + } + + static Minecraft func_130056_g(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + return par0GuiScreenPendingInvitation.mc; + } + + static Minecraft func_130046_h(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + return par0GuiScreenPendingInvitation.mc; + } + + static Minecraft func_130055_i(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + return par0GuiScreenPendingInvitation.mc; + } + + static Minecraft func_130054_j(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + return par0GuiScreenPendingInvitation.mc; + } + + static int func_130053_a(GuiScreenPendingInvitation par0GuiScreenPendingInvitation, int par1) + { + return par0GuiScreenPendingInvitation.field_130058_d = par1; + } + + static FontRenderer func_130045_k(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + return par0GuiScreenPendingInvitation.fontRenderer; + } + + static FontRenderer func_130052_l(GuiScreenPendingInvitation par0GuiScreenPendingInvitation) + { + return par0GuiScreenPendingInvitation.fontRenderer; + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenPendingInvitationINNER1.java b/src/main/java/net/minecraft/src/GuiScreenPendingInvitationINNER1.java new file mode 100644 index 0000000..c600123 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenPendingInvitationINNER1.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +class GuiScreenPendingInvitationINNER1 extends Thread +{ + final GuiScreenPendingInvitation field_130121_a; + + GuiScreenPendingInvitationINNER1(GuiScreenPendingInvitation par1GuiScreenPendingInvitation) + { + this.field_130121_a = par1GuiScreenPendingInvitation; + } + + public void run() + { + McoClient var1 = new McoClient(GuiScreenPendingInvitation.func_130048_a(this.field_130121_a).getSession()); + + try + { + GuiScreenPendingInvitation.func_130043_a(this.field_130121_a, var1.func_130108_f().field_130096_a); + } + catch (ExceptionMcoService var3) + { + GuiScreenPendingInvitation.func_130044_b(this.field_130121_a).getLogAgent().logSevere(var3.toString()); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenPendingInvitationINNER2.java b/src/main/java/net/minecraft/src/GuiScreenPendingInvitationINNER2.java new file mode 100644 index 0000000..4c65119 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenPendingInvitationINNER2.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +class GuiScreenPendingInvitationINNER2 extends Thread +{ + final GuiScreenPendingInvitation field_130132_a; + + GuiScreenPendingInvitationINNER2(GuiScreenPendingInvitation par1GuiScreenPendingInvitation) + { + this.field_130132_a = par1GuiScreenPendingInvitation; + } + + public void run() + { + try + { + McoClient var1 = new McoClient(GuiScreenPendingInvitation.func_130041_c(this.field_130132_a).getSession()); + var1.func_130109_b(((PendingInvite)GuiScreenPendingInvitation.func_130042_e(this.field_130132_a).get(GuiScreenPendingInvitation.func_130049_d(this.field_130132_a))).field_130094_a); + GuiScreenPendingInvitation.func_130040_f(this.field_130132_a); + } + catch (ExceptionMcoService var2) + { + GuiScreenPendingInvitation.func_130056_g(this.field_130132_a).getLogAgent().logSevere(var2.toString()); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenPendingInvitationINNER3.java b/src/main/java/net/minecraft/src/GuiScreenPendingInvitationINNER3.java new file mode 100644 index 0000000..5830869 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenPendingInvitationINNER3.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +class GuiScreenPendingInvitationINNER3 extends Thread +{ + final GuiScreenPendingInvitation field_130131_a; + + GuiScreenPendingInvitationINNER3(GuiScreenPendingInvitation par1GuiScreenPendingInvitation) + { + this.field_130131_a = par1GuiScreenPendingInvitation; + } + + public void run() + { + try + { + McoClient var1 = new McoClient(GuiScreenPendingInvitation.func_130046_h(this.field_130131_a).getSession()); + var1.func_130107_a(((PendingInvite)GuiScreenPendingInvitation.func_130042_e(this.field_130131_a).get(GuiScreenPendingInvitation.func_130049_d(this.field_130131_a))).field_130094_a); + GuiScreenPendingInvitation.func_130040_f(this.field_130131_a); + } + catch (ExceptionMcoService var2) + { + GuiScreenPendingInvitation.func_130055_i(this.field_130131_a).getLogAgent().logSevere(var2.toString()); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenPendingInvitationList.java b/src/main/java/net/minecraft/src/GuiScreenPendingInvitationList.java new file mode 100644 index 0000000..ba79281 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenPendingInvitationList.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +class GuiScreenPendingInvitationList extends GuiScreenSelectLocation +{ + final GuiScreenPendingInvitation field_130120_a; + + public GuiScreenPendingInvitationList(GuiScreenPendingInvitation par1GuiScreenPendingInvitation) + { + super(GuiScreenPendingInvitation.func_130054_j(par1GuiScreenPendingInvitation), par1GuiScreenPendingInvitation.width, par1GuiScreenPendingInvitation.height, 32, par1GuiScreenPendingInvitation.height - 64, 36); + this.field_130120_a = par1GuiScreenPendingInvitation; + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return GuiScreenPendingInvitation.func_130042_e(this.field_130120_a).size() + 1; + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) + { + if (par1 < GuiScreenPendingInvitation.func_130042_e(this.field_130120_a).size()) + { + GuiScreenPendingInvitation.func_130053_a(this.field_130120_a, par1); + } + } + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return par1 == GuiScreenPendingInvitation.func_130049_d(this.field_130120_a); + } + + protected boolean func_104086_b(int par1) + { + return false; + } + + protected int func_130003_b() + { + return this.getSize() * 36; + } + + protected void func_130004_c() + { + this.field_130120_a.drawDefaultBackground(); + } + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + if (par1 < GuiScreenPendingInvitation.func_130042_e(this.field_130120_a).size()) + { + this.func_130119_b(par1, par2, par3, par4, par5Tessellator); + } + } + + private void func_130119_b(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + PendingInvite var6 = (PendingInvite)GuiScreenPendingInvitation.func_130042_e(this.field_130120_a).get(par1); + this.field_130120_a.drawString(GuiScreenPendingInvitation.func_130045_k(this.field_130120_a), var6.field_130092_b, par2 + 2, par3 + 1, 16777215); + this.field_130120_a.drawString(GuiScreenPendingInvitation.func_130052_l(this.field_130120_a), var6.field_130093_c, par2 + 2, par3 + 12, 7105644); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenResetWorld.java b/src/main/java/net/minecraft/src/GuiScreenResetWorld.java new file mode 100644 index 0000000..daccdb7 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenResetWorld.java @@ -0,0 +1,173 @@ +package net.minecraft.src; + +import org.lwjgl.input.Keyboard; + +public class GuiScreenResetWorld extends ScreenWithCallback +{ + private GuiScreen field_96152_a; + private McoServer field_96150_b; + private GuiTextField field_96151_c; + private final int field_96149_d = 1; + private final int field_96153_n = 2; + private static int field_110360_p = 3; + private WorldTemplate field_110359_q; + private GuiButton field_96154_o; + + public GuiScreenResetWorld(GuiScreen par1GuiScreen, McoServer par2McoServer) + { + this.field_96152_a = par1GuiScreen; + this.field_96150_b = par2McoServer; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.field_96151_c.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(this.field_96154_o = new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, 97, 20, I18n.getString("mco.configure.world.buttons.reset"))); + this.buttonList.add(new GuiButton(2, this.width / 2 + 5, this.height / 4 + 120 + 12, 97, 20, I18n.getString("gui.cancel"))); + this.field_96151_c = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 99, 200, 20); + this.field_96151_c.setFocused(true); + this.field_96151_c.setMaxStringLength(32); + this.field_96151_c.setText(""); + + if (this.field_110359_q == null) + { + this.buttonList.add(new GuiButton(field_110360_p, this.width / 2 - 100, 125, 200, 20, I18n.getString("mco.template.default.name"))); + } + else + { + this.field_96151_c.setText(""); + this.field_96151_c.setEnabled(false); + this.field_96151_c.setFocused(false); + this.buttonList.add(new GuiButton(field_110360_p, this.width / 2 - 100, 125, 200, 20, I18n.getString("mco.template.name") + ": " + this.field_110359_q.field_110732_b)); + } + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + this.field_96151_c.textboxKeyTyped(par1, par2); + + if (par2 == 28 || par2 == 156) + { + this.actionPerformed(this.field_96154_o); + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 2) + { + this.mc.displayGuiScreen(this.field_96152_a); + } + else if (par1GuiButton.id == 1) + { + String var2 = I18n.getString("mco.configure.world.reset.question.line1"); + String var3 = I18n.getString("mco.configure.world.reset.question.line2"); + this.mc.displayGuiScreen(new GuiScreenConfirmation(this, GuiScreenConfirmationType.Warning, var2, var3, 1)); + } + else if (par1GuiButton.id == field_110360_p) + { + this.mc.displayGuiScreen(new GuiScreenMcoWorldTemplate(this, this.field_110359_q)); + } + } + } + + public void confirmClicked(boolean par1, int par2) + { + if (par1 && par2 == 1) + { + this.func_140006_g(); + } + else + { + this.mc.displayGuiScreen(this); + } + } + + private void func_140006_g() + { + TaskResetWorld var1 = new TaskResetWorld(this, this.field_96150_b.field_96408_a, this.field_96151_c.getText(), this.field_110359_q); + GuiScreenLongRunningTask var2 = new GuiScreenLongRunningTask(this.mc, this.field_96152_a, var1); + var2.func_98117_g(); + this.mc.displayGuiScreen(var2); + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + this.field_96151_c.mouseClicked(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, I18n.getString("mco.reset.world.title"), this.width / 2, 17, 16777215); + this.drawCenteredString(this.fontRenderer, I18n.getString("mco.reset.world.warning"), this.width / 2, 56, 16711680); + this.drawString(this.fontRenderer, I18n.getString("mco.reset.world.seed"), this.width / 2 - 100, 86, 10526880); + this.field_96151_c.drawTextBox(); + super.drawScreen(par1, par2, par3); + } + + void func_110358_a(WorldTemplate par1WorldTemplate) + { + this.field_110359_q = par1WorldTemplate; + } + + void func_110354_a(Object par1Obj) + { + this.func_110358_a((WorldTemplate)par1Obj); + } + + static GuiScreen func_96148_a(GuiScreenResetWorld par0GuiScreenResetWorld) + { + return par0GuiScreenResetWorld.field_96152_a; + } + + static Minecraft func_96147_b(GuiScreenResetWorld par0GuiScreenResetWorld) + { + return par0GuiScreenResetWorld.mc; + } + + static Minecraft func_130025_c(GuiScreenResetWorld par0GuiScreenResetWorld) + { + return par0GuiScreenResetWorld.mc; + } + + static Minecraft func_130024_d(GuiScreenResetWorld par0GuiScreenResetWorld) + { + return par0GuiScreenResetWorld.mc; + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenSelectLocation.java b/src/main/java/net/minecraft/src/GuiScreenSelectLocation.java new file mode 100644 index 0000000..1330212 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenSelectLocation.java @@ -0,0 +1,418 @@ +package net.minecraft.src; + +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +public abstract class GuiScreenSelectLocation +{ + private final Minecraft field_104092_f; + private int field_104093_g; + private int field_104105_h; + protected int field_104098_a; + protected int field_104096_b; + private int field_104106_i; + private int field_104103_j; + protected final int field_104097_c; + private int field_104104_k; + private int field_104101_l; + protected int field_104094_d; + protected int field_104095_e; + private float field_104102_m = -2.0F; + private float field_104099_n; + private float field_104100_o; + private int field_104111_p = -1; + private long field_104110_q; + private boolean field_104109_r = true; + private boolean field_104108_s; + private int field_104107_t; + + public GuiScreenSelectLocation(Minecraft par1Minecraft, int par2, int par3, int par4, int par5, int par6) + { + this.field_104092_f = par1Minecraft; + this.field_104093_g = par2; + this.field_104105_h = par3; + this.field_104098_a = par4; + this.field_104096_b = par5; + this.field_104097_c = par6; + this.field_104103_j = 0; + this.field_104106_i = par2; + } + + public void func_104084_a(int par1, int par2, int par3, int par4) + { + this.field_104093_g = par1; + this.field_104105_h = par2; + this.field_104098_a = par3; + this.field_104096_b = par4; + this.field_104103_j = 0; + this.field_104106_i = par1; + } + + /** + * Gets the size of the current slot list. + */ + protected abstract int getSize(); + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected abstract void elementClicked(int var1, boolean var2); + + /** + * returns true if the element passed in is currently selected + */ + protected abstract boolean isSelected(int var1); + + protected abstract boolean func_104086_b(int var1); + + protected int func_130003_b() + { + return this.getSize() * this.field_104097_c + this.field_104107_t; + } + + protected abstract void func_130004_c(); + + protected abstract void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5); + + protected void func_104088_a(int par1, int par2, Tessellator par3Tessellator) {} + + protected void func_104089_a(int par1, int par2) {} + + protected void func_104087_b(int par1, int par2) {} + + private void func_104091_h() + { + int var1 = this.func_104085_d(); + + if (var1 < 0) + { + var1 /= 2; + } + + if (this.field_104100_o < 0.0F) + { + this.field_104100_o = 0.0F; + } + + if (this.field_104100_o > (float)var1) + { + this.field_104100_o = (float)var1; + } + } + + public int func_104085_d() + { + return this.func_130003_b() - (this.field_104096_b - this.field_104098_a - 4); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + public void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == this.field_104104_k) + { + this.field_104100_o -= (float)(this.field_104097_c * 2 / 3); + this.field_104102_m = -2.0F; + this.func_104091_h(); + } + else if (par1GuiButton.id == this.field_104101_l) + { + this.field_104100_o += (float)(this.field_104097_c * 2 / 3); + this.field_104102_m = -2.0F; + this.func_104091_h(); + } + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.field_104094_d = par1; + this.field_104095_e = par2; + this.func_130004_c(); + int var4 = this.getSize(); + int var5 = this.func_104090_g(); + int var6 = var5 + 6; + int var9; + int var10; + int var11; + int var13; + int var20; + + if (Mouse.isButtonDown(0)) + { + if (this.field_104102_m == -1.0F) + { + boolean var7 = true; + + if (par2 >= this.field_104098_a && par2 <= this.field_104096_b) + { + int var8 = this.field_104093_g / 2 - 110; + var9 = this.field_104093_g / 2 + 110; + var10 = par2 - this.field_104098_a - this.field_104107_t + (int)this.field_104100_o - 4; + var11 = var10 / this.field_104097_c; + + if (par1 >= var8 && par1 <= var9 && var11 >= 0 && var10 >= 0 && var11 < var4) + { + boolean var12 = var11 == this.field_104111_p && Minecraft.getSystemTime() - this.field_104110_q < 250L; + this.elementClicked(var11, var12); + this.field_104111_p = var11; + this.field_104110_q = Minecraft.getSystemTime(); + } + else if (par1 >= var8 && par1 <= var9 && var10 < 0) + { + this.func_104089_a(par1 - var8, par2 - this.field_104098_a + (int)this.field_104100_o - 4); + var7 = false; + } + + if (par1 >= var5 && par1 <= var6) + { + this.field_104099_n = -1.0F; + var20 = this.func_104085_d(); + + if (var20 < 1) + { + var20 = 1; + } + + var13 = (int)((float)((this.field_104096_b - this.field_104098_a) * (this.field_104096_b - this.field_104098_a)) / (float)this.func_130003_b()); + + if (var13 < 32) + { + var13 = 32; + } + + if (var13 > this.field_104096_b - this.field_104098_a - 8) + { + var13 = this.field_104096_b - this.field_104098_a - 8; + } + + this.field_104099_n /= (float)(this.field_104096_b - this.field_104098_a - var13) / (float)var20; + } + else + { + this.field_104099_n = 1.0F; + } + + if (var7) + { + this.field_104102_m = (float)par2; + } + else + { + this.field_104102_m = -2.0F; + } + } + else + { + this.field_104102_m = -2.0F; + } + } + else if (this.field_104102_m >= 0.0F) + { + this.field_104100_o -= ((float)par2 - this.field_104102_m) * this.field_104099_n; + this.field_104102_m = (float)par2; + } + } + else + { + while (!this.field_104092_f.gameSettings.touchscreen && Mouse.next()) + { + int var16 = Mouse.getEventDWheel(); + + if (var16 != 0) + { + if (var16 > 0) + { + var16 = -1; + } + else if (var16 < 0) + { + var16 = 1; + } + + this.field_104100_o += (float)(var16 * this.field_104097_c / 2); + } + } + + this.field_104102_m = -1.0F; + } + + this.func_104091_h(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_FOG); + Tessellator var18 = Tessellator.instance; + this.field_104092_f.getTextureManager().bindTexture(Gui.optionsBackground); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var17 = 32.0F; + var18.startDrawingQuads(); + var18.setColorOpaque_I(2105376); + var18.addVertexWithUV((double)this.field_104103_j, (double)this.field_104096_b, 0.0D, (double)((float)this.field_104103_j / var17), (double)((float)(this.field_104096_b + (int)this.field_104100_o) / var17)); + var18.addVertexWithUV((double)this.field_104106_i, (double)this.field_104096_b, 0.0D, (double)((float)this.field_104106_i / var17), (double)((float)(this.field_104096_b + (int)this.field_104100_o) / var17)); + var18.addVertexWithUV((double)this.field_104106_i, (double)this.field_104098_a, 0.0D, (double)((float)this.field_104106_i / var17), (double)((float)(this.field_104098_a + (int)this.field_104100_o) / var17)); + var18.addVertexWithUV((double)this.field_104103_j, (double)this.field_104098_a, 0.0D, (double)((float)this.field_104103_j / var17), (double)((float)(this.field_104098_a + (int)this.field_104100_o) / var17)); + var18.draw(); + var9 = this.field_104093_g / 2 - 92 - 16; + var10 = this.field_104098_a + 4 - (int)this.field_104100_o; + + if (this.field_104108_s) + { + this.func_104088_a(var9, var10, var18); + } + + int var14; + + for (var11 = 0; var11 < var4; ++var11) + { + var20 = var10 + var11 * this.field_104097_c + this.field_104107_t; + var13 = this.field_104097_c - 4; + + if (var20 <= this.field_104096_b && var20 + var13 >= this.field_104098_a) + { + int var15; + + if (this.field_104109_r && this.func_104086_b(var11)) + { + var14 = this.field_104093_g / 2 - 110; + var15 = this.field_104093_g / 2 + 110; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_TEXTURE_2D); + var18.startDrawingQuads(); + var18.setColorOpaque_I(0); + var18.addVertexWithUV((double)var14, (double)(var20 + var13 + 2), 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)var15, (double)(var20 + var13 + 2), 0.0D, 1.0D, 1.0D); + var18.addVertexWithUV((double)var15, (double)(var20 - 2), 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)var14, (double)(var20 - 2), 0.0D, 0.0D, 0.0D); + var18.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + if (this.field_104109_r && this.isSelected(var11)) + { + var14 = this.field_104093_g / 2 - 110; + var15 = this.field_104093_g / 2 + 110; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_TEXTURE_2D); + var18.startDrawingQuads(); + var18.setColorOpaque_I(8421504); + var18.addVertexWithUV((double)var14, (double)(var20 + var13 + 2), 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)var15, (double)(var20 + var13 + 2), 0.0D, 1.0D, 1.0D); + var18.addVertexWithUV((double)var15, (double)(var20 - 2), 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)var14, (double)(var20 - 2), 0.0D, 0.0D, 0.0D); + var18.setColorOpaque_I(0); + var18.addVertexWithUV((double)(var14 + 1), (double)(var20 + var13 + 1), 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)(var15 - 1), (double)(var20 + var13 + 1), 0.0D, 1.0D, 1.0D); + var18.addVertexWithUV((double)(var15 - 1), (double)(var20 - 1), 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)(var14 + 1), (double)(var20 - 1), 0.0D, 0.0D, 0.0D); + var18.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + this.drawSlot(var11, var9, var20, var13, var18); + } + } + + GL11.glDisable(GL11.GL_DEPTH_TEST); + byte var19 = 4; + this.func_104083_b(0, this.field_104098_a, 255, 255); + this.func_104083_b(this.field_104096_b, this.field_104105_h, 255, 255); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glDisable(GL11.GL_TEXTURE_2D); + var18.startDrawingQuads(); + var18.setColorRGBA_I(0, 0); + var18.addVertexWithUV((double)this.field_104103_j, (double)(this.field_104098_a + var19), 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)this.field_104106_i, (double)(this.field_104098_a + var19), 0.0D, 1.0D, 1.0D); + var18.setColorRGBA_I(0, 255); + var18.addVertexWithUV((double)this.field_104106_i, (double)this.field_104098_a, 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)this.field_104103_j, (double)this.field_104098_a, 0.0D, 0.0D, 0.0D); + var18.draw(); + var18.startDrawingQuads(); + var18.setColorRGBA_I(0, 255); + var18.addVertexWithUV((double)this.field_104103_j, (double)this.field_104096_b, 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)this.field_104106_i, (double)this.field_104096_b, 0.0D, 1.0D, 1.0D); + var18.setColorRGBA_I(0, 0); + var18.addVertexWithUV((double)this.field_104106_i, (double)(this.field_104096_b - var19), 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)this.field_104103_j, (double)(this.field_104096_b - var19), 0.0D, 0.0D, 0.0D); + var18.draw(); + var20 = this.func_104085_d(); + + if (var20 > 0) + { + var13 = (this.field_104096_b - this.field_104098_a) * (this.field_104096_b - this.field_104098_a) / this.func_130003_b(); + + if (var13 < 32) + { + var13 = 32; + } + + if (var13 > this.field_104096_b - this.field_104098_a - 8) + { + var13 = this.field_104096_b - this.field_104098_a - 8; + } + + var14 = (int)this.field_104100_o * (this.field_104096_b - this.field_104098_a - var13) / var20 + this.field_104098_a; + + if (var14 < this.field_104098_a) + { + var14 = this.field_104098_a; + } + + var18.startDrawingQuads(); + var18.setColorRGBA_I(0, 255); + var18.addVertexWithUV((double)var5, (double)this.field_104096_b, 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)var6, (double)this.field_104096_b, 0.0D, 1.0D, 1.0D); + var18.addVertexWithUV((double)var6, (double)this.field_104098_a, 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)var5, (double)this.field_104098_a, 0.0D, 0.0D, 0.0D); + var18.draw(); + var18.startDrawingQuads(); + var18.setColorRGBA_I(8421504, 255); + var18.addVertexWithUV((double)var5, (double)(var14 + var13), 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)var6, (double)(var14 + var13), 0.0D, 1.0D, 1.0D); + var18.addVertexWithUV((double)var6, (double)var14, 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)var5, (double)var14, 0.0D, 0.0D, 0.0D); + var18.draw(); + var18.startDrawingQuads(); + var18.setColorRGBA_I(12632256, 255); + var18.addVertexWithUV((double)var5, (double)(var14 + var13 - 1), 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)(var6 - 1), (double)(var14 + var13 - 1), 0.0D, 1.0D, 1.0D); + var18.addVertexWithUV((double)(var6 - 1), (double)var14, 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)var5, (double)var14, 0.0D, 0.0D, 0.0D); + var18.draw(); + } + + this.func_104087_b(par1, par2); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); + } + + protected int func_104090_g() + { + return this.field_104093_g / 2 + 124; + } + + private void func_104083_b(int par1, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + this.field_104092_f.getTextureManager().bindTexture(Gui.optionsBackground); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var6 = 32.0F; + var5.startDrawingQuads(); + var5.setColorRGBA_I(4210752, par4); + var5.addVertexWithUV(0.0D, (double)par2, 0.0D, 0.0D, (double)((float)par2 / var6)); + var5.addVertexWithUV((double)this.field_104093_g, (double)par2, 0.0D, (double)((float)this.field_104093_g / var6), (double)((float)par2 / var6)); + var5.setColorRGBA_I(4210752, par3); + var5.addVertexWithUV((double)this.field_104093_g, (double)par1, 0.0D, (double)((float)this.field_104093_g / var6), (double)((float)par1 / var6)); + var5.addVertexWithUV(0.0D, (double)par1, 0.0D, 0.0D, (double)((float)par1 / var6)); + var5.draw(); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenServerList.java b/src/main/java/net/minecraft/src/GuiScreenServerList.java new file mode 100644 index 0000000..d38cdc1 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenServerList.java @@ -0,0 +1,108 @@ +package net.minecraft.src; + +import org.lwjgl.input.Keyboard; + +public class GuiScreenServerList extends GuiScreen +{ + /** Needed a change as a local variable was conflicting on construct */ + private final GuiScreen guiScreen; + + /** Instance of ServerData. */ + private final ServerData theServerData; + private GuiTextField serverTextField; + + public GuiScreenServerList(GuiScreen par1GuiScreen, ServerData par2ServerData) + { + this.guiScreen = par1GuiScreen; + this.theServerData = par2ServerData; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + this.serverTextField.updateCursorCounter(); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + Keyboard.enableRepeatEvents(true); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + 12, I18n.getString("selectServer.select"))); + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.getString("gui.cancel"))); + this.serverTextField = new GuiTextField(this.fontRenderer, this.width / 2 - 100, 116, 200, 20); + this.serverTextField.setMaxStringLength(128); + this.serverTextField.setFocused(true); + this.serverTextField.setText(this.mc.gameSettings.lastServer); + ((GuiButton)this.buttonList.get(0)).enabled = this.serverTextField.getText().length() > 0 && this.serverTextField.getText().split(":").length > 0; + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + this.mc.gameSettings.lastServer = this.serverTextField.getText(); + this.mc.gameSettings.saveOptions(); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 1) + { + this.guiScreen.confirmClicked(false, 0); + } + else if (par1GuiButton.id == 0) + { + this.theServerData.serverIP = this.serverTextField.getText(); + this.guiScreen.confirmClicked(true, 0); + } + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (this.serverTextField.textboxKeyTyped(par1, par2)) + { + ((GuiButton)this.buttonList.get(0)).enabled = this.serverTextField.getText().length() > 0 && this.serverTextField.getText().split(":").length > 0; + } + else if (par2 == 28 || par2 == 156) + { + this.actionPerformed((GuiButton)this.buttonList.get(0)); + } + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + this.serverTextField.mouseClicked(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, I18n.getString("selectServer.direct"), this.width / 2, 20, 16777215); + this.drawString(this.fontRenderer, I18n.getString("addServer.enterIp"), this.width / 2 - 100, 100, 10526880); + this.serverTextField.drawTextBox(); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenSubscription.java b/src/main/java/net/minecraft/src/GuiScreenSubscription.java new file mode 100644 index 0000000..51e8ca4 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenSubscription.java @@ -0,0 +1,118 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; +import org.lwjgl.input.Keyboard; + +public class GuiScreenSubscription extends GuiScreen +{ + private final GuiScreen field_98067_a; + private final McoServer field_98065_b; + private final int field_98066_c = 0; + private final int field_98064_d = 1; + private int field_98068_n; + private String field_98069_o; + + public GuiScreenSubscription(GuiScreen par1GuiScreen, McoServer par2McoServer) + { + this.field_98067_a = par1GuiScreen; + this.field_98065_b = par2McoServer; + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() {} + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.func_98063_a(this.field_98065_b.field_96408_a); + Keyboard.enableRepeatEvents(true); + this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 120 + 12, I18n.getString("gui.cancel"))); + } + + private void func_98063_a(long par1) + { + McoClient var3 = new McoClient(this.mc.getSession()); + + try + { + ValueObjectSubscription var4 = var3.func_98177_f(par1); + this.field_98068_n = var4.field_98170_b; + this.field_98069_o = this.func_98062_b(var4.field_98171_a); + } + catch (ExceptionMcoService var5) + { + Minecraft.getMinecraft().getLogAgent().logSevere(var5.toString()); + } + catch (IOException var6) + { + Minecraft.getMinecraft().getLogAgent().logWarning("Realms: could not parse response"); + } + } + + private String func_98062_b(long par1) + { + GregorianCalendar var3 = new GregorianCalendar(TimeZone.getDefault()); + var3.setTimeInMillis(par1); + return SimpleDateFormat.getDateTimeInstance().format(var3.getTime()); + } + + /** + * Called when the screen is unloaded. Used to disable keyboard repeat events + */ + public void onGuiClosed() + { + Keyboard.enableRepeatEvents(false); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(this.field_98067_a); + } + else if (par1GuiButton.id == 1) + { + ; + } + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) {} + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, I18n.getString("mco.configure.world.subscription.title"), this.width / 2, 17, 16777215); + this.drawString(this.fontRenderer, I18n.getString("mco.configure.world.subscription.start"), this.width / 2 - 100, 53, 10526880); + this.drawString(this.fontRenderer, this.field_98069_o, this.width / 2 - 100, 66, 16777215); + this.drawString(this.fontRenderer, I18n.getString("mco.configure.world.subscription.daysleft"), this.width / 2 - 100, 85, 10526880); + this.drawString(this.fontRenderer, String.valueOf(this.field_98068_n), this.width / 2 - 100, 98, 16777215); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenTemporaryResourcePackSelect.java b/src/main/java/net/minecraft/src/GuiScreenTemporaryResourcePackSelect.java new file mode 100644 index 0000000..8f02f93 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenTemporaryResourcePackSelect.java @@ -0,0 +1,201 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import org.lwjgl.Sys; + +public class GuiScreenTemporaryResourcePackSelect extends GuiScreen +{ + protected GuiScreen field_110347_a; + private int refreshTimer = -1; + private GuiScreenTemporaryResourcePackSelectSelectionList field_110346_c; + private GameSettings field_96146_n; + + public GuiScreenTemporaryResourcePackSelect(GuiScreen par1GuiScreen, GameSettings par2GameSettings) + { + this.field_110347_a = par1GuiScreen; + this.field_96146_n = par2GameSettings; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.add(new GuiSmallButton(5, this.width / 2 - 154, this.height - 48, I18n.getString("resourcePack.openFolder"))); + this.buttonList.add(new GuiSmallButton(6, this.width / 2 + 4, this.height - 48, I18n.getString("gui.done"))); + this.field_110346_c = new GuiScreenTemporaryResourcePackSelectSelectionList(this, this.mc.getResourcePackRepository()); + this.field_110346_c.registerScrollButtons(7, 8); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 5) + { + File var2 = GuiScreenTemporaryResourcePackSelectSelectionList.func_110510_a(this.field_110346_c).getDirResourcepacks(); + String var3 = var2.getAbsolutePath(); + + if (Util.getOSType() == EnumOS.MACOS) + { + try + { + this.mc.getLogAgent().logInfo(var3); + Runtime.getRuntime().exec(new String[] {"/usr/bin/open", var3}); + return; + } + catch (IOException var9) + { + var9.printStackTrace(); + } + } + else if (Util.getOSType() == EnumOS.WINDOWS) + { + String var4 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {var3}); + + try + { + Runtime.getRuntime().exec(var4); + return; + } + catch (IOException var8) + { + var8.printStackTrace(); + } + } + + boolean var10 = false; + + try + { + Class var5 = Class.forName("java.awt.Desktop"); + Object var6 = var5.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]); + var5.getMethod("browse", new Class[] {URI.class}).invoke(var6, new Object[] {var2.toURI()}); + } + catch (Throwable var7) + { + var7.printStackTrace(); + var10 = true; + } + + if (var10) + { + this.mc.getLogAgent().logInfo("Opening via system class!"); + Sys.openURL("file://" + var3); + } + } + else if (par1GuiButton.id == 6) + { + this.mc.displayGuiScreen(this.field_110347_a); + } + else + { + this.field_110346_c.actionPerformed(par1GuiButton); + } + } + } + + /** + * Called when the mouse is clicked. + */ + protected void mouseClicked(int par1, int par2, int par3) + { + super.mouseClicked(par1, par2, par3); + } + + /** + * Called when the mouse is moved or a mouse button is released. Signature: (mouseX, mouseY, which) which==-1 is + * mouseMove, which==0 or which==1 is mouseUp + */ + protected void mouseMovedOrUp(int par1, int par2, int par3) + { + super.mouseMovedOrUp(par1, par2, par3); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.field_110346_c.drawScreen(par1, par2, par3); + + if (this.refreshTimer <= 0) + { + GuiScreenTemporaryResourcePackSelectSelectionList.func_110510_a(this.field_110346_c).updateRepositoryEntriesAll(); + this.refreshTimer = 20; + } + + this.drawCenteredString(this.fontRenderer, I18n.getString("resourcePack.title"), this.width / 2, 16, 16777215); + this.drawCenteredString(this.fontRenderer, I18n.getString("resourcePack.folderInfo"), this.width / 2 - 77, this.height - 26, 8421504); + super.drawScreen(par1, par2, par3); + } + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + super.updateScreen(); + --this.refreshTimer; + } + + static Minecraft func_110344_a(GuiScreenTemporaryResourcePackSelect par0GuiScreenTemporaryResourcePackSelect) + { + return par0GuiScreenTemporaryResourcePackSelect.mc; + } + + static Minecraft func_110341_b(GuiScreenTemporaryResourcePackSelect par0GuiScreenTemporaryResourcePackSelect) + { + return par0GuiScreenTemporaryResourcePackSelect.mc; + } + + static Minecraft func_110339_c(GuiScreenTemporaryResourcePackSelect par0GuiScreenTemporaryResourcePackSelect) + { + return par0GuiScreenTemporaryResourcePackSelect.mc; + } + + static Minecraft func_110345_d(GuiScreenTemporaryResourcePackSelect par0GuiScreenTemporaryResourcePackSelect) + { + return par0GuiScreenTemporaryResourcePackSelect.mc; + } + + static Minecraft func_110334_e(GuiScreenTemporaryResourcePackSelect par0GuiScreenTemporaryResourcePackSelect) + { + return par0GuiScreenTemporaryResourcePackSelect.mc; + } + + static Minecraft func_110340_f(GuiScreenTemporaryResourcePackSelect par0GuiScreenTemporaryResourcePackSelect) + { + return par0GuiScreenTemporaryResourcePackSelect.mc; + } + + static FontRenderer func_130017_g(GuiScreenTemporaryResourcePackSelect par0GuiScreenTemporaryResourcePackSelect) + { + return par0GuiScreenTemporaryResourcePackSelect.fontRenderer; + } + + static FontRenderer func_130016_h(GuiScreenTemporaryResourcePackSelect par0GuiScreenTemporaryResourcePackSelect) + { + return par0GuiScreenTemporaryResourcePackSelect.fontRenderer; + } + + static FontRenderer func_110337_i(GuiScreenTemporaryResourcePackSelect par0GuiScreenTemporaryResourcePackSelect) + { + return par0GuiScreenTemporaryResourcePackSelect.fontRenderer; + } + + static FontRenderer func_110335_j(GuiScreenTemporaryResourcePackSelect par0GuiScreenTemporaryResourcePackSelect) + { + return par0GuiScreenTemporaryResourcePackSelect.fontRenderer; + } + + static FontRenderer func_110338_k(GuiScreenTemporaryResourcePackSelect par0GuiScreenTemporaryResourcePackSelect) + { + return par0GuiScreenTemporaryResourcePackSelect.fontRenderer; + } +} diff --git a/src/main/java/net/minecraft/src/GuiScreenTemporaryResourcePackSelectSelectionList.java b/src/main/java/net/minecraft/src/GuiScreenTemporaryResourcePackSelectSelectionList.java new file mode 100644 index 0000000..6543fb0 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiScreenTemporaryResourcePackSelectSelectionList.java @@ -0,0 +1,145 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.util.List; +import org.lwjgl.opengl.GL11; + +class GuiScreenTemporaryResourcePackSelectSelectionList extends GuiSlot +{ + private final ResourcePackRepository field_110511_b; + private ResourceLocation field_110513_h; + + final GuiScreenTemporaryResourcePackSelect field_110512_a; + + public GuiScreenTemporaryResourcePackSelectSelectionList(GuiScreenTemporaryResourcePackSelect par1GuiScreenTemporaryResourcePackSelect, ResourcePackRepository par2ResourcePackRepository) + { + super(GuiScreenTemporaryResourcePackSelect.func_110344_a(par1GuiScreenTemporaryResourcePackSelect), par1GuiScreenTemporaryResourcePackSelect.width, par1GuiScreenTemporaryResourcePackSelect.height, 32, par1GuiScreenTemporaryResourcePackSelect.height - 55 + 4, 36); + this.field_110512_a = par1GuiScreenTemporaryResourcePackSelect; + this.field_110511_b = par2ResourcePackRepository; + par2ResourcePackRepository.updateRepositoryEntriesAll(); + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return 1 + this.field_110511_b.getRepositoryEntriesAll().size(); + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) + { + List var3 = this.field_110511_b.getRepositoryEntriesAll(); + + try + { + if (par1 == 0) + { + throw new RuntimeException("This is so horrible ;D"); + } + + this.field_110511_b.setRepositoryEntries(new ResourcePackRepositoryEntry[] {(ResourcePackRepositoryEntry)var3.get(par1 - 1)}); + GuiScreenTemporaryResourcePackSelect.func_110341_b(this.field_110512_a).refreshResources(); + } + catch (Exception var5) + { + this.field_110511_b.setRepositoryEntries(new ResourcePackRepositoryEntry[0]); + GuiScreenTemporaryResourcePackSelect.func_110339_c(this.field_110512_a).refreshResources(); + } + + GuiScreenTemporaryResourcePackSelect.func_110345_d(this.field_110512_a).gameSettings.skin = this.field_110511_b.getResourcePackName(); + GuiScreenTemporaryResourcePackSelect.func_110334_e(this.field_110512_a).gameSettings.saveOptions(); + } + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + List var2 = this.field_110511_b.getRepositoryEntries(); + return par1 == 0 ? var2.isEmpty() : var2.contains(this.field_110511_b.getRepositoryEntriesAll().get(par1 - 1)); + } + + /** + * return the height of the content being scrolled + */ + protected int getContentHeight() + { + return this.getSize() * 36; + } + + protected void drawBackground() + { + this.field_110512_a.drawDefaultBackground(); + } + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + TextureManager var6 = GuiScreenTemporaryResourcePackSelect.func_110340_f(this.field_110512_a).getTextureManager(); + + if (par1 == 0) + { + try + { + ResourcePack var12 = this.field_110511_b.rprDefaultResourcePack; + PackMetadataSection var13 = (PackMetadataSection)var12.getPackMetadata(this.field_110511_b.rprMetadataSerializer, "pack"); + + if (this.field_110513_h == null) + { + this.field_110513_h = var6.getDynamicTextureLocation("texturepackicon", new DynamicTexture(var12.getPackImage())); + } + + var6.bindTexture(this.field_110513_h); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + par5Tessellator.startDrawingQuads(); + par5Tessellator.setColorOpaque_I(16777215); + par5Tessellator.addVertexWithUV((double)par2, (double)(par3 + par4), 0.0D, 0.0D, 1.0D); + par5Tessellator.addVertexWithUV((double)(par2 + 32), (double)(par3 + par4), 0.0D, 1.0D, 1.0D); + par5Tessellator.addVertexWithUV((double)(par2 + 32), (double)par3, 0.0D, 1.0D, 0.0D); + par5Tessellator.addVertexWithUV((double)par2, (double)par3, 0.0D, 0.0D, 0.0D); + par5Tessellator.draw(); + this.field_110512_a.drawString(GuiScreenTemporaryResourcePackSelect.func_130017_g(this.field_110512_a), "Default", par2 + 32 + 2, par3 + 1, 16777215); + this.field_110512_a.drawString(GuiScreenTemporaryResourcePackSelect.func_130016_h(this.field_110512_a), var13.getPackDescription(), par2 + 32 + 2, par3 + 12 + 10, 8421504); + } + catch (IOException var11) + { + ; + } + } + else + { + ResourcePackRepositoryEntry var7 = (ResourcePackRepositoryEntry)this.field_110511_b.getRepositoryEntriesAll().get(par1 - 1); + var7.bindTexturePackIcon(var6); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + par5Tessellator.startDrawingQuads(); + par5Tessellator.setColorOpaque_I(16777215); + par5Tessellator.addVertexWithUV((double)par2, (double)(par3 + par4), 0.0D, 0.0D, 1.0D); + par5Tessellator.addVertexWithUV((double)(par2 + 32), (double)(par3 + par4), 0.0D, 1.0D, 1.0D); + par5Tessellator.addVertexWithUV((double)(par2 + 32), (double)par3, 0.0D, 1.0D, 0.0D); + par5Tessellator.addVertexWithUV((double)par2, (double)par3, 0.0D, 0.0D, 0.0D); + par5Tessellator.draw(); + String var8 = var7.getResourcePackName(); + + if (var8.length() > 32) + { + var8 = var8.substring(0, 32).trim() + "..."; + } + + this.field_110512_a.drawString(GuiScreenTemporaryResourcePackSelect.func_110337_i(this.field_110512_a), var8, par2 + 32 + 2, par3 + 1, 16777215); + List var9 = GuiScreenTemporaryResourcePackSelect.func_110335_j(this.field_110512_a).listFormattedStringToWidth(var7.getTexturePackDescription(), 183); + + for (int var10 = 0; var10 < 2 && var10 < var9.size(); ++var10) + { + this.field_110512_a.drawString(GuiScreenTemporaryResourcePackSelect.func_110338_k(this.field_110512_a), (String)var9.get(var10), par2 + 32 + 2, par3 + 12 + 10 * var10, 8421504); + } + } + } + + static ResourcePackRepository func_110510_a(GuiScreenTemporaryResourcePackSelectSelectionList par0GuiScreenTemporaryResourcePackSelectSelectionList) + { + return par0GuiScreenTemporaryResourcePackSelectSelectionList.field_110511_b; + } +} diff --git a/src/main/java/net/minecraft/src/GuiSelectWorld.java b/src/main/java/net/minecraft/src/GuiSelectWorld.java new file mode 100644 index 0000000..6733927 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSelectWorld.java @@ -0,0 +1,337 @@ +package net.minecraft.src; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Collections; +import java.util.List; + +public class GuiSelectWorld extends GuiScreen +{ + /** simple date formater */ + private final DateFormat dateFormatter = new SimpleDateFormat(); + + /** + * A reference to the screen object that created this. Used for navigating between screens. + */ + protected GuiScreen parentScreen; + + /** The title string that is displayed in the top-center of the screen. */ + protected String screenTitle = "Select world"; + + /** True if a world has been selected. */ + private boolean selected; + + /** the currently selected world */ + private int selectedWorld; + + /** The save list for the world selection screen */ + private List saveList; + private GuiWorldSlot worldSlotContainer; + + /** E.g. World, Welt, Monde, Mundo */ + private String localizedWorldText; + private String localizedMustConvertText; + + /** + * The game mode text that is displayed with each world on the world selection list. + */ + private String[] localizedGameModeText = new String[3]; + + /** set to true if you arein the process of deleteing a world/save */ + private boolean deleting; + + /** The delete button in the world selection GUI */ + private GuiButton buttonDelete; + + /** the select button in the world selection gui */ + private GuiButton buttonSelect; + + /** The rename button in the world selection GUI */ + private GuiButton buttonRename; + private GuiButton buttonRecreate; + + public GuiSelectWorld(GuiScreen par1GuiScreen) + { + this.parentScreen = par1GuiScreen; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.screenTitle = I18n.getString("selectWorld.title"); + + try + { + this.loadSaves(); + } + catch (AnvilConverterException var2) + { + var2.printStackTrace(); + this.mc.displayGuiScreen(new GuiErrorScreen("Unable to load words", var2.getMessage())); + return; + } + + this.localizedWorldText = I18n.getString("selectWorld.world"); + this.localizedMustConvertText = I18n.getString("selectWorld.conversion"); + this.localizedGameModeText[EnumGameType.SURVIVAL.getID()] = I18n.getString("gameMode.survival"); + this.localizedGameModeText[EnumGameType.CREATIVE.getID()] = I18n.getString("gameMode.creative"); + this.localizedGameModeText[EnumGameType.ADVENTURE.getID()] = I18n.getString("gameMode.adventure"); + this.worldSlotContainer = new GuiWorldSlot(this); + this.worldSlotContainer.registerScrollButtons(4, 5); + this.initButtons(); + } + + /** + * loads the saves + */ + private void loadSaves() throws AnvilConverterException + { + ISaveFormat var1 = this.mc.getSaveLoader(); + this.saveList = var1.getSaveList(); + Collections.sort(this.saveList); + this.selectedWorld = -1; + } + + /** + * returns the file name of the specified save number + */ + protected String getSaveFileName(int par1) + { + return ((SaveFormatComparator)this.saveList.get(par1)).getFileName(); + } + + /** + * returns the name of the saved game + */ + protected String getSaveName(int par1) + { + String var2 = ((SaveFormatComparator)this.saveList.get(par1)).getDisplayName(); + + if (var2 == null || MathHelper.stringNullOrLengthZero(var2)) + { + var2 = I18n.getString("selectWorld.world") + " " + (par1 + 1); + } + + return var2; + } + + /** + * intilize the buttons for this GUI + */ + public void initButtons() + { + this.buttonList.add(this.buttonSelect = new GuiButton(1, this.width / 2 - 154, this.height - 52, 150, 20, I18n.getString("selectWorld.select"))); + this.buttonList.add(new GuiButton(3, this.width / 2 + 4, this.height - 52, 150, 20, I18n.getString("selectWorld.create"))); + this.buttonList.add(this.buttonRename = new GuiButton(6, this.width / 2 - 154, this.height - 28, 72, 20, I18n.getString("selectWorld.rename"))); + this.buttonList.add(this.buttonDelete = new GuiButton(2, this.width / 2 - 76, this.height - 28, 72, 20, I18n.getString("selectWorld.delete"))); + this.buttonList.add(this.buttonRecreate = new GuiButton(7, this.width / 2 + 4, this.height - 28, 72, 20, I18n.getString("selectWorld.recreate"))); + this.buttonList.add(new GuiButton(0, this.width / 2 + 82, this.height - 28, 72, 20, I18n.getString("gui.cancel"))); + this.buttonSelect.enabled = false; + this.buttonDelete.enabled = false; + this.buttonRename.enabled = false; + this.buttonRecreate.enabled = false; + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 2) + { + String var2 = this.getSaveName(this.selectedWorld); + + if (var2 != null) + { + this.deleting = true; + GuiYesNo var3 = getDeleteWorldScreen(this, var2, this.selectedWorld); + this.mc.displayGuiScreen(var3); + } + } + else if (par1GuiButton.id == 1) + { + this.selectWorld(this.selectedWorld); + } + else if (par1GuiButton.id == 3) + { + this.mc.displayGuiScreen(new GuiCreateWorld(this)); + } + else if (par1GuiButton.id == 6) + { + this.mc.displayGuiScreen(new GuiRenameWorld(this, this.getSaveFileName(this.selectedWorld))); + } + else if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(this.parentScreen); + } + else if (par1GuiButton.id == 7) + { + GuiCreateWorld var5 = new GuiCreateWorld(this); + ISaveHandler var6 = this.mc.getSaveLoader().getSaveLoader(this.getSaveFileName(this.selectedWorld), false); + WorldInfo var4 = var6.loadWorldInfo(); + var6.flush(); + var5.func_82286_a(var4); + this.mc.displayGuiScreen(var5); + } + else + { + this.worldSlotContainer.actionPerformed(par1GuiButton); + } + } + } + + /** + * Gets the selected world. + */ + public void selectWorld(int par1) + { + this.mc.displayGuiScreen((GuiScreen)null); + + if (!this.selected) + { + this.selected = true; + String var2 = this.getSaveFileName(par1); + + if (var2 == null) + { + var2 = "World" + par1; + } + + String var3 = this.getSaveName(par1); + + if (var3 == null) + { + var3 = "World" + par1; + } + + if (this.mc.getSaveLoader().canLoadWorld(var2)) + { + this.mc.launchIntegratedServer(var2, var3, (WorldSettings)null); + this.mc.statFileWriter.readStat(StatList.loadWorldStat, 1); + } + } + } + + public void confirmClicked(boolean par1, int par2) + { + if (this.deleting) + { + this.deleting = false; + + if (par1) + { + ISaveFormat var3 = this.mc.getSaveLoader(); + var3.flushCache(); + var3.deleteWorldDirectory(this.getSaveFileName(par2)); + + try + { + this.loadSaves(); + } + catch (AnvilConverterException var5) + { + var5.printStackTrace(); + } + } + + this.mc.displayGuiScreen(this); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.worldSlotContainer.drawScreen(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215); + super.drawScreen(par1, par2, par3); + } + + /** + * Gets a GuiYesNo screen with the warning, buttons, etc. + */ + public static GuiYesNo getDeleteWorldScreen(GuiScreen par0GuiScreen, String par1Str, int par2) + { + String var3 = I18n.getString("selectWorld.deleteQuestion"); + String var4 = "\'" + par1Str + "\' " + I18n.getString("selectWorld.deleteWarning"); + String var5 = I18n.getString("selectWorld.deleteButton"); + String var6 = I18n.getString("gui.cancel"); + GuiYesNo var7 = new GuiYesNo(par0GuiScreen, var3, var4, var5, var6, par2); + return var7; + } + + static List getSize(GuiSelectWorld par0GuiSelectWorld) + { + return par0GuiSelectWorld.saveList; + } + + /** + * called whenever an element in this gui is selected + */ + static int onElementSelected(GuiSelectWorld par0GuiSelectWorld, int par1) + { + return par0GuiSelectWorld.selectedWorld = par1; + } + + /** + * returns the world currently selected + */ + static int getSelectedWorld(GuiSelectWorld par0GuiSelectWorld) + { + return par0GuiSelectWorld.selectedWorld; + } + + /** + * returns the select button + */ + static GuiButton getSelectButton(GuiSelectWorld par0GuiSelectWorld) + { + return par0GuiSelectWorld.buttonSelect; + } + + /** + * returns the rename button + */ + static GuiButton getRenameButton(GuiSelectWorld par0GuiSelectWorld) + { + return par0GuiSelectWorld.buttonDelete; + } + + /** + * returns the delete button + */ + static GuiButton getDeleteButton(GuiSelectWorld par0GuiSelectWorld) + { + return par0GuiSelectWorld.buttonRename; + } + + static GuiButton func_82312_f(GuiSelectWorld par0GuiSelectWorld) + { + return par0GuiSelectWorld.buttonRecreate; + } + + static String func_82313_g(GuiSelectWorld par0GuiSelectWorld) + { + return par0GuiSelectWorld.localizedWorldText; + } + + static DateFormat func_82315_h(GuiSelectWorld par0GuiSelectWorld) + { + return par0GuiSelectWorld.dateFormatter; + } + + static String func_82311_i(GuiSelectWorld par0GuiSelectWorld) + { + return par0GuiSelectWorld.localizedMustConvertText; + } + + static String[] func_82314_j(GuiSelectWorld par0GuiSelectWorld) + { + return par0GuiSelectWorld.localizedGameModeText; + } +} diff --git a/src/main/java/net/minecraft/src/GuiShareToLan.java b/src/main/java/net/minecraft/src/GuiShareToLan.java new file mode 100644 index 0000000..1eb84f7 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiShareToLan.java @@ -0,0 +1,113 @@ +package net.minecraft.src; + +public class GuiShareToLan extends GuiScreen +{ + /** + * A reference to the screen object that created this. Used for navigating between screens. + */ + private final GuiScreen parentScreen; + private GuiButton buttonAllowCommandsToggle; + private GuiButton buttonGameMode; + + /** + * The currently selected game mode. One of 'survival', 'creative', or 'adventure' + */ + private String gameMode = "survival"; + + /** True if 'Allow Cheats' is currently enabled */ + private boolean allowCommands; + + public GuiShareToLan(GuiScreen par1GuiScreen) + { + this.parentScreen = par1GuiScreen; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.clear(); + this.buttonList.add(new GuiButton(101, this.width / 2 - 155, this.height - 28, 150, 20, I18n.getString("lanServer.start"))); + this.buttonList.add(new GuiButton(102, this.width / 2 + 5, this.height - 28, 150, 20, I18n.getString("gui.cancel"))); + this.buttonList.add(this.buttonGameMode = new GuiButton(104, this.width / 2 - 155, 100, 150, 20, I18n.getString("selectWorld.gameMode"))); + this.buttonList.add(this.buttonAllowCommandsToggle = new GuiButton(103, this.width / 2 + 5, 100, 150, 20, I18n.getString("selectWorld.allowCommands"))); + this.func_74088_g(); + } + + private void func_74088_g() + { + this.buttonGameMode.displayString = I18n.getString("selectWorld.gameMode") + " " + I18n.getString("selectWorld.gameMode." + this.gameMode); + this.buttonAllowCommandsToggle.displayString = I18n.getString("selectWorld.allowCommands") + " "; + + if (this.allowCommands) + { + this.buttonAllowCommandsToggle.displayString = this.buttonAllowCommandsToggle.displayString + I18n.getString("options.on"); + } + else + { + this.buttonAllowCommandsToggle.displayString = this.buttonAllowCommandsToggle.displayString + I18n.getString("options.off"); + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 102) + { + this.mc.displayGuiScreen(this.parentScreen); + } + else if (par1GuiButton.id == 104) + { + if (this.gameMode.equals("survival")) + { + this.gameMode = "creative"; + } + else if (this.gameMode.equals("creative")) + { + this.gameMode = "adventure"; + } + else + { + this.gameMode = "survival"; + } + + this.func_74088_g(); + } + else if (par1GuiButton.id == 103) + { + this.allowCommands = !this.allowCommands; + this.func_74088_g(); + } + else if (par1GuiButton.id == 101) + { + this.mc.displayGuiScreen((GuiScreen)null); + String var2 = this.mc.getIntegratedServer().shareToLAN(EnumGameType.getByName(this.gameMode), this.allowCommands); + ChatMessageComponent var3; + + if (var2 != null) + { + var3 = ChatMessageComponent.createFromTranslationWithSubstitutions("commands.publish.started", new Object[] {var2}); + } + else + { + var3 = ChatMessageComponent.createFromText("commands.publish.failed"); + } + + this.mc.ingameGUI.getChatGUI().printChatMessage(var3.toStringWithFormatting(true)); + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, I18n.getString("lanServer.title"), this.width / 2, 50, 16777215); + this.drawCenteredString(this.fontRenderer, I18n.getString("lanServer.otherPlayers"), this.width / 2, 82, 16777215); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiSleepMP.java b/src/main/java/net/minecraft/src/GuiSleepMP.java new file mode 100644 index 0000000..04d001b --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSleepMP.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +public class GuiSleepMP extends GuiChat +{ + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + super.initGui(); + this.buttonList.add(new GuiButton(1, this.width / 2 - 100, this.height - 40, I18n.getString("multiplayer.stopSleeping"))); + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (par2 == 1) + { + this.wakeEntity(); + } + else if (par2 != 28 && par2 != 156) + { + super.keyTyped(par1, par2); + } + else + { + String var3 = this.inputField.getText().trim(); + + if (var3.length() > 0) + { + this.mc.thePlayer.sendChatMessage(var3); + } + + this.inputField.setText(""); + this.mc.ingameGUI.getChatGUI().resetScroll(); + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.id == 1) + { + this.wakeEntity(); + } + else + { + super.actionPerformed(par1GuiButton); + } + } + + /** + * Wakes the entity from the bed + */ + private void wakeEntity() + { + NetClientHandler var1 = this.mc.thePlayer.sendQueue; + var1.addToSendQueue(new Packet19EntityAction(this.mc.thePlayer, 3)); + } +} diff --git a/src/main/java/net/minecraft/src/GuiSlider.java b/src/main/java/net/minecraft/src/GuiSlider.java new file mode 100644 index 0000000..a99b030 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSlider.java @@ -0,0 +1,101 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiSlider extends GuiButton +{ + /** The value of this slider control. */ + public float sliderValue = 1.0F; + + /** Is this slider control being dragged. */ + public boolean dragging; + + /** Additional ID for this slider control. */ + private EnumOptions idFloat; + + public GuiSlider(int par1, int par2, int par3, EnumOptions par4EnumOptions, String par5Str, float par6) + { + super(par1, par2, par3, 150, 20, par5Str); + this.idFloat = par4EnumOptions; + this.sliderValue = par6; + } + + /** + * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over this button and 2 if it IS hovering over + * this button. + */ + protected int getHoverState(boolean par1) + { + return 0; + } + + /** + * Fired when the mouse button is dragged. Equivalent of MouseListener.mouseDragged(MouseEvent e). + */ + protected void mouseDragged(Minecraft par1Minecraft, int par2, int par3) + { + if (this.drawButton) + { + if (this.dragging) + { + this.sliderValue = (float)(par2 - (this.xPosition + 4)) / (float)(this.width - 8); + + if (this.sliderValue < 0.0F) + { + this.sliderValue = 0.0F; + } + + if (this.sliderValue > 1.0F) + { + this.sliderValue = 1.0F; + } + + par1Minecraft.gameSettings.setOptionFloatValue(this.idFloat, this.sliderValue); + this.displayString = par1Minecraft.gameSettings.getKeyBinding(this.idFloat); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(this.xPosition + (int)(this.sliderValue * (float)(this.width - 8)), this.yPosition, 0, 66, 4, 20); + this.drawTexturedModalRect(this.xPosition + (int)(this.sliderValue * (float)(this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20); + } + } + + /** + * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent + * e). + */ + public boolean mousePressed(Minecraft par1Minecraft, int par2, int par3) + { + if (super.mousePressed(par1Minecraft, par2, par3)) + { + this.sliderValue = (float)(par2 - (this.xPosition + 4)) / (float)(this.width - 8); + + if (this.sliderValue < 0.0F) + { + this.sliderValue = 0.0F; + } + + if (this.sliderValue > 1.0F) + { + this.sliderValue = 1.0F; + } + + par1Minecraft.gameSettings.setOptionFloatValue(this.idFloat, this.sliderValue); + this.displayString = par1Minecraft.gameSettings.getKeyBinding(this.idFloat); + this.dragging = true; + return true; + } + else + { + return false; + } + } + + /** + * Fired when the mouse button is released. Equivalent of MouseListener.mouseReleased(MouseEvent e). + */ + public void mouseReleased(int par1, int par2) + { + this.dragging = false; + } +} diff --git a/src/main/java/net/minecraft/src/GuiSlot.java b/src/main/java/net/minecraft/src/GuiSlot.java new file mode 100644 index 0000000..df2efe6 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSlot.java @@ -0,0 +1,482 @@ +package net.minecraft.src; + +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +public abstract class GuiSlot +{ + private final Minecraft mc; + + /** + * The width of the GuiScreen. Affects the container rendering, but not the overlays. + */ + private int width; + + /** + * The height of the GuiScreen. Affects the container rendering, but not the overlays or the scrolling. + */ + private int height; + + /** The top of the slot container. Affects the overlays and scrolling. */ + protected int top; + + /** The bottom of the slot container. Affects the overlays and scrolling. */ + protected int bottom; + private int right; + private int left; + + /** The height of a slot. */ + protected final int slotHeight; + + /** button id of the button used to scroll up */ + private int scrollUpButtonID; + + /** the buttonID of the button used to scroll down */ + private int scrollDownButtonID; + + /** X axis position of the mouse */ + protected int mouseX; + + /** Y axis position of the mouse */ + protected int mouseY; + + /** where the mouse was in the window when you first clicked to scroll */ + private float initialClickY = -2.0F; + + /** + * what to multiply the amount you moved your mouse by(used for slowing down scrolling when over the items and no on + * scroll bar) + */ + private float scrollMultiplier; + + /** how far down this slot has been scrolled */ + private float amountScrolled; + + /** the element in the list that was selected */ + private int selectedElement = -1; + + /** the time when this button was last clicked. */ + private long lastClicked; + + /** true if a selected element in this gui will show an outline box */ + private boolean showSelectionBox = true; + private boolean field_77243_s; + private int field_77242_t; + + public GuiSlot(Minecraft par1Minecraft, int par2, int par3, int par4, int par5, int par6) + { + this.mc = par1Minecraft; + this.width = par2; + this.height = par3; + this.top = par4; + this.bottom = par5; + this.slotHeight = par6; + this.left = 0; + this.right = par2; + } + + public void func_77207_a(int par1, int par2, int par3, int par4) + { + this.width = par1; + this.height = par2; + this.top = par3; + this.bottom = par4; + this.left = 0; + this.right = par1; + } + + public void setShowSelectionBox(boolean par1) + { + this.showSelectionBox = par1; + } + + protected void func_77223_a(boolean par1, int par2) + { + this.field_77243_s = par1; + this.field_77242_t = par2; + + if (!par1) + { + this.field_77242_t = 0; + } + } + + /** + * Gets the size of the current slot list. + */ + protected abstract int getSize(); + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected abstract void elementClicked(int var1, boolean var2); + + /** + * returns true if the element passed in is currently selected + */ + protected abstract boolean isSelected(int var1); + + /** + * return the height of the content being scrolled + */ + protected int getContentHeight() + { + return this.getSize() * this.slotHeight + this.field_77242_t; + } + + protected abstract void drawBackground(); + + protected abstract void drawSlot(int var1, int var2, int var3, int var4, Tessellator var5); + + protected void func_77222_a(int par1, int par2, Tessellator par3Tessellator) {} + + protected void func_77224_a(int par1, int par2) {} + + protected void func_77215_b(int par1, int par2) {} + + public int func_77210_c(int par1, int par2) + { + int var3 = this.width / 2 - 110; + int var4 = this.width / 2 + 110; + int var5 = par2 - this.top - this.field_77242_t + (int)this.amountScrolled - 4; + int var6 = var5 / this.slotHeight; + return par1 >= var3 && par1 <= var4 && var6 >= 0 && var5 >= 0 && var6 < this.getSize() ? var6 : -1; + } + + /** + * Registers the IDs that can be used for the scrollbar's buttons. + */ + public void registerScrollButtons(int par1, int par2) + { + this.scrollUpButtonID = par1; + this.scrollDownButtonID = par2; + } + + /** + * stop the thing from scrolling out of bounds + */ + private void bindAmountScrolled() + { + int var1 = this.func_77209_d(); + + if (var1 < 0) + { + var1 /= 2; + } + + if (this.amountScrolled < 0.0F) + { + this.amountScrolled = 0.0F; + } + + if (this.amountScrolled > (float)var1) + { + this.amountScrolled = (float)var1; + } + } + + public int func_77209_d() + { + return this.getContentHeight() - (this.bottom - this.top - 4); + } + + public void func_77208_b(int par1) + { + this.amountScrolled += (float)par1; + this.bindAmountScrolled(); + this.initialClickY = -2.0F; + } + + public void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == this.scrollUpButtonID) + { + this.amountScrolled -= (float)(this.slotHeight * 2 / 3); + this.initialClickY = -2.0F; + this.bindAmountScrolled(); + } + else if (par1GuiButton.id == this.scrollDownButtonID) + { + this.amountScrolled += (float)(this.slotHeight * 2 / 3); + this.initialClickY = -2.0F; + this.bindAmountScrolled(); + } + } + } + + /** + * draws the slot to the screen, pass in mouse's current x and y and partial ticks + */ + public void drawScreen(int par1, int par2, float par3) + { + this.mouseX = par1; + this.mouseY = par2; + this.drawBackground(); + int var4 = this.getSize(); + int var5 = this.getScrollBarX(); + int var6 = var5 + 6; + int var9; + int var10; + int var11; + int var13; + int var20; + + if (Mouse.isButtonDown(0)) + { + if (this.initialClickY == -1.0F) + { + boolean var7 = true; + + if (par2 >= this.top && par2 <= this.bottom) + { + int var8 = this.width / 2 - 110; + var9 = this.width / 2 + 110; + var10 = par2 - this.top - this.field_77242_t + (int)this.amountScrolled - 4; + var11 = var10 / this.slotHeight; + + if (par1 >= var8 && par1 <= var9 && var11 >= 0 && var10 >= 0 && var11 < var4) + { + boolean var12 = var11 == this.selectedElement && Minecraft.getSystemTime() - this.lastClicked < 250L; + this.elementClicked(var11, var12); + this.selectedElement = var11; + this.lastClicked = Minecraft.getSystemTime(); + } + else if (par1 >= var8 && par1 <= var9 && var10 < 0) + { + this.func_77224_a(par1 - var8, par2 - this.top + (int)this.amountScrolled - 4); + var7 = false; + } + + if (par1 >= var5 && par1 <= var6) + { + this.scrollMultiplier = -1.0F; + var20 = this.func_77209_d(); + + if (var20 < 1) + { + var20 = 1; + } + + var13 = (int)((float)((this.bottom - this.top) * (this.bottom - this.top)) / (float)this.getContentHeight()); + + if (var13 < 32) + { + var13 = 32; + } + + if (var13 > this.bottom - this.top - 8) + { + var13 = this.bottom - this.top - 8; + } + + this.scrollMultiplier /= (float)(this.bottom - this.top - var13) / (float)var20; + } + else + { + this.scrollMultiplier = 1.0F; + } + + if (var7) + { + this.initialClickY = (float)par2; + } + else + { + this.initialClickY = -2.0F; + } + } + else + { + this.initialClickY = -2.0F; + } + } + else if (this.initialClickY >= 0.0F) + { + this.amountScrolled -= ((float)par2 - this.initialClickY) * this.scrollMultiplier; + this.initialClickY = (float)par2; + } + } + else + { + while (!this.mc.gameSettings.touchscreen && Mouse.next()) + { + int var16 = Mouse.getEventDWheel(); + + if (var16 != 0) + { + if (var16 > 0) + { + var16 = -1; + } + else if (var16 < 0) + { + var16 = 1; + } + + this.amountScrolled += (float)(var16 * this.slotHeight / 2); + } + } + + this.initialClickY = -1.0F; + } + + this.bindAmountScrolled(); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_FOG); + Tessellator var18 = Tessellator.instance; + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var17 = 32.0F; + var18.startDrawingQuads(); + var18.setColorOpaque_I(2105376); + var18.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / var17), (double)((float)(this.bottom + (int)this.amountScrolled) / var17)); + var18.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / var17), (double)((float)(this.bottom + (int)this.amountScrolled) / var17)); + var18.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / var17), (double)((float)(this.top + (int)this.amountScrolled) / var17)); + var18.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / var17), (double)((float)(this.top + (int)this.amountScrolled) / var17)); + var18.draw(); + var9 = this.width / 2 - 92 - 16; + var10 = this.top + 4 - (int)this.amountScrolled; + + if (this.field_77243_s) + { + this.func_77222_a(var9, var10, var18); + } + + int var14; + + for (var11 = 0; var11 < var4; ++var11) + { + var20 = var10 + var11 * this.slotHeight + this.field_77242_t; + var13 = this.slotHeight - 4; + + if (var20 <= this.bottom && var20 + var13 >= this.top) + { + if (this.showSelectionBox && this.isSelected(var11)) + { + var14 = this.width / 2 - 110; + int var15 = this.width / 2 + 110; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_TEXTURE_2D); + var18.startDrawingQuads(); + var18.setColorOpaque_I(8421504); + var18.addVertexWithUV((double)var14, (double)(var20 + var13 + 2), 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)var15, (double)(var20 + var13 + 2), 0.0D, 1.0D, 1.0D); + var18.addVertexWithUV((double)var15, (double)(var20 - 2), 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)var14, (double)(var20 - 2), 0.0D, 0.0D, 0.0D); + var18.setColorOpaque_I(0); + var18.addVertexWithUV((double)(var14 + 1), (double)(var20 + var13 + 1), 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)(var15 - 1), (double)(var20 + var13 + 1), 0.0D, 1.0D, 1.0D); + var18.addVertexWithUV((double)(var15 - 1), (double)(var20 - 1), 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)(var14 + 1), (double)(var20 - 1), 0.0D, 0.0D, 0.0D); + var18.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + this.drawSlot(var11, var9, var20, var13, var18); + } + } + + GL11.glDisable(GL11.GL_DEPTH_TEST); + byte var19 = 4; + this.overlayBackground(0, this.top, 255, 255); + this.overlayBackground(this.bottom, this.height, 255, 255); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glDisable(GL11.GL_TEXTURE_2D); + var18.startDrawingQuads(); + var18.setColorRGBA_I(0, 0); + var18.addVertexWithUV((double)this.left, (double)(this.top + var19), 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)this.right, (double)(this.top + var19), 0.0D, 1.0D, 1.0D); + var18.setColorRGBA_I(0, 255); + var18.addVertexWithUV((double)this.right, (double)this.top, 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)this.left, (double)this.top, 0.0D, 0.0D, 0.0D); + var18.draw(); + var18.startDrawingQuads(); + var18.setColorRGBA_I(0, 255); + var18.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, 1.0D, 1.0D); + var18.setColorRGBA_I(0, 0); + var18.addVertexWithUV((double)this.right, (double)(this.bottom - var19), 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)this.left, (double)(this.bottom - var19), 0.0D, 0.0D, 0.0D); + var18.draw(); + var20 = this.func_77209_d(); + + if (var20 > 0) + { + var13 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight(); + + if (var13 < 32) + { + var13 = 32; + } + + if (var13 > this.bottom - this.top - 8) + { + var13 = this.bottom - this.top - 8; + } + + var14 = (int)this.amountScrolled * (this.bottom - this.top - var13) / var20 + this.top; + + if (var14 < this.top) + { + var14 = this.top; + } + + var18.startDrawingQuads(); + var18.setColorRGBA_I(0, 255); + var18.addVertexWithUV((double)var5, (double)this.bottom, 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)var6, (double)this.bottom, 0.0D, 1.0D, 1.0D); + var18.addVertexWithUV((double)var6, (double)this.top, 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)var5, (double)this.top, 0.0D, 0.0D, 0.0D); + var18.draw(); + var18.startDrawingQuads(); + var18.setColorRGBA_I(8421504, 255); + var18.addVertexWithUV((double)var5, (double)(var14 + var13), 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)var6, (double)(var14 + var13), 0.0D, 1.0D, 1.0D); + var18.addVertexWithUV((double)var6, (double)var14, 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)var5, (double)var14, 0.0D, 0.0D, 0.0D); + var18.draw(); + var18.startDrawingQuads(); + var18.setColorRGBA_I(12632256, 255); + var18.addVertexWithUV((double)var5, (double)(var14 + var13 - 1), 0.0D, 0.0D, 1.0D); + var18.addVertexWithUV((double)(var6 - 1), (double)(var14 + var13 - 1), 0.0D, 1.0D, 1.0D); + var18.addVertexWithUV((double)(var6 - 1), (double)var14, 0.0D, 1.0D, 0.0D); + var18.addVertexWithUV((double)var5, (double)var14, 0.0D, 0.0D, 0.0D); + var18.draw(); + } + + this.func_77215_b(par1, par2); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); + } + + protected int getScrollBarX() + { + return this.width / 2 + 124; + } + + /** + * Overlays the background to hide scrolled items + */ + private void overlayBackground(int par1, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var6 = 32.0F; + var5.startDrawingQuads(); + var5.setColorRGBA_I(4210752, par4); + var5.addVertexWithUV(0.0D, (double)par2, 0.0D, 0.0D, (double)((float)par2 / var6)); + var5.addVertexWithUV((double)this.width, (double)par2, 0.0D, (double)((float)this.width / var6), (double)((float)par2 / var6)); + var5.setColorRGBA_I(4210752, par3); + var5.addVertexWithUV((double)this.width, (double)par1, 0.0D, (double)((float)this.width / var6), (double)((float)par1 / var6)); + var5.addVertexWithUV(0.0D, (double)par1, 0.0D, 0.0D, (double)((float)par1 / var6)); + var5.draw(); + } +} diff --git a/src/main/java/net/minecraft/src/GuiSlotLanguage.java b/src/main/java/net/minecraft/src/GuiSlotLanguage.java new file mode 100644 index 0000000..ac77ff6 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSlotLanguage.java @@ -0,0 +1,82 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +class GuiSlotLanguage extends GuiSlot +{ + private final List field_77251_g; + private final Map field_77253_h; + + final GuiLanguage languageGui; + + public GuiSlotLanguage(GuiLanguage par1GuiLanguage) + { + super(par1GuiLanguage.mc, par1GuiLanguage.width, par1GuiLanguage.height, 32, par1GuiLanguage.height - 65 + 4, 18); + this.languageGui = par1GuiLanguage; + this.field_77251_g = Lists.newArrayList(); + this.field_77253_h = Maps.newHashMap(); + Iterator var2 = GuiLanguage.func_135011_a(par1GuiLanguage).getLanguages().iterator(); + + while (var2.hasNext()) + { + Language var3 = (Language)var2.next(); + this.field_77253_h.put(var3.getLanguageCode(), var3); + this.field_77251_g.add(var3.getLanguageCode()); + } + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return this.field_77251_g.size(); + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) + { + Language var3 = (Language)this.field_77253_h.get(this.field_77251_g.get(par1)); + GuiLanguage.func_135011_a(this.languageGui).setCurrentLanguage(var3); + GuiLanguage.getGameSettings(this.languageGui).language = var3.getLanguageCode(); + this.languageGui.mc.refreshResources(); + this.languageGui.fontRenderer.setUnicodeFlag(GuiLanguage.func_135011_a(this.languageGui).isCurrentLocaleUnicode()); + this.languageGui.fontRenderer.setBidiFlag(GuiLanguage.func_135011_a(this.languageGui).isCurrentLanguageBidirectional()); + GuiLanguage.getDoneButton(this.languageGui).displayString = I18n.getString("gui.done"); + GuiLanguage.getGameSettings(this.languageGui).saveOptions(); + } + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return ((String)this.field_77251_g.get(par1)).equals(GuiLanguage.func_135011_a(this.languageGui).getCurrentLanguage().getLanguageCode()); + } + + /** + * return the height of the content being scrolled + */ + protected int getContentHeight() + { + return this.getSize() * 18; + } + + protected void drawBackground() + { + this.languageGui.drawDefaultBackground(); + } + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + this.languageGui.fontRenderer.setBidiFlag(true); + this.languageGui.drawCenteredString(this.languageGui.fontRenderer, ((Language)this.field_77253_h.get(this.field_77251_g.get(par1))).toString(), this.languageGui.width / 2, par3 + 1, 16777215); + this.languageGui.fontRenderer.setBidiFlag(GuiLanguage.func_135011_a(this.languageGui).getCurrentLanguage().isBidirectional()); + } +} diff --git a/src/main/java/net/minecraft/src/GuiSlotOnlineServerList.java b/src/main/java/net/minecraft/src/GuiSlotOnlineServerList.java new file mode 100644 index 0000000..168b227 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSlotOnlineServerList.java @@ -0,0 +1,140 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +class GuiSlotOnlineServerList extends GuiScreenSelectLocation +{ + final GuiScreenOnlineServers field_96294_a; + + public GuiSlotOnlineServerList(GuiScreenOnlineServers par1GuiScreenOnlineServers) + { + super(GuiScreenOnlineServers.func_140037_f(par1GuiScreenOnlineServers), par1GuiScreenOnlineServers.width, par1GuiScreenOnlineServers.height, 32, par1GuiScreenOnlineServers.height - 64, 36); + this.field_96294_a = par1GuiScreenOnlineServers; + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return GuiScreenOnlineServers.func_140013_c(this.field_96294_a).size() + 1; + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) + { + if (par1 < GuiScreenOnlineServers.func_140013_c(this.field_96294_a).size()) + { + McoServer var3 = (McoServer)GuiScreenOnlineServers.func_140013_c(this.field_96294_a).get(par1); + GuiScreenOnlineServers.func_140036_b(this.field_96294_a, var3.field_96408_a); + + if (!GuiScreenOnlineServers.func_140015_g(this.field_96294_a).getSession().getUsername().equals(var3.field_96405_e)) + { + GuiScreenOnlineServers.func_140038_h(this.field_96294_a).displayString = I18n.getString("mco.selectServer.leave"); + } + else + { + GuiScreenOnlineServers.func_140038_h(this.field_96294_a).displayString = I18n.getString("mco.selectServer.configure"); + } + + GuiScreenOnlineServers.func_140033_i(this.field_96294_a).enabled = var3.field_96404_d.equals("OPEN") && !var3.field_98166_h; + + if (par2 && GuiScreenOnlineServers.func_140033_i(this.field_96294_a).enabled) + { + GuiScreenOnlineServers.func_140008_c(this.field_96294_a, GuiScreenOnlineServers.func_140041_a(this.field_96294_a)); + } + } + } + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return par1 == GuiScreenOnlineServers.func_140027_d(this.field_96294_a, GuiScreenOnlineServers.func_140041_a(this.field_96294_a)); + } + + protected boolean func_104086_b(int par1) + { + try + { + return par1 >= 0 && par1 < GuiScreenOnlineServers.func_140013_c(this.field_96294_a).size() && ((McoServer)GuiScreenOnlineServers.func_140013_c(this.field_96294_a).get(par1)).field_96405_e.toLowerCase().equals(GuiScreenOnlineServers.func_104032_j(this.field_96294_a).getSession().getUsername()); + } + catch (Exception var3) + { + return false; + } + } + + protected int func_130003_b() + { + return this.getSize() * 36; + } + + protected void func_130004_c() + { + this.field_96294_a.drawDefaultBackground(); + } + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + if (par1 < GuiScreenOnlineServers.func_140013_c(this.field_96294_a).size()) + { + this.func_96292_b(par1, par2, par3, par4, par5Tessellator); + } + } + + private void func_96292_b(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + McoServer var6 = (McoServer)GuiScreenOnlineServers.func_140013_c(this.field_96294_a).get(par1); + this.field_96294_a.drawString(GuiScreenOnlineServers.func_140023_k(this.field_96294_a), var6.func_96398_b(), par2 + 2, par3 + 1, 16777215); + short var7 = 207; + byte var8 = 1; + + if (var6.field_98166_h) + { + GuiScreenOnlineServers.func_104031_c(this.field_96294_a, par2 + var7, par3 + var8, this.field_104094_d, this.field_104095_e); + } + else if (var6.field_96404_d.equals("CLOSED")) + { + GuiScreenOnlineServers.func_140035_b(this.field_96294_a, par2 + var7, par3 + var8, this.field_104094_d, this.field_104095_e); + } + else if (var6.field_96405_e.equals(GuiScreenOnlineServers.func_140014_l(this.field_96294_a).getSession().getUsername()) && var6.field_104063_i < 7) + { + this.func_96293_a(par1, par2 - 14, par3, var6); + GuiScreenOnlineServers.func_140031_a(this.field_96294_a, par2 + var7, par3 + var8, this.field_104094_d, this.field_104095_e, var6.field_104063_i); + } + else if (var6.field_96404_d.equals("OPEN")) + { + GuiScreenOnlineServers.func_140020_c(this.field_96294_a, par2 + var7, par3 + var8, this.field_104094_d, this.field_104095_e); + this.func_96293_a(par1, par2 - 14, par3, var6); + } + + this.field_96294_a.drawString(GuiScreenOnlineServers.func_140039_m(this.field_96294_a), var6.func_96397_a(), par2 + 2, par3 + 12, 7105644); + this.field_96294_a.drawString(GuiScreenOnlineServers.func_98079_k(this.field_96294_a), var6.field_96405_e, par2 + 2, par3 + 12 + 11, 5000268); + } + + private void func_96293_a(int par1, int par2, int par3, McoServer par4McoServer) + { + if (par4McoServer.field_96403_g != null) + { + synchronized (GuiScreenOnlineServers.func_140029_i()) + { + if (GuiScreenOnlineServers.func_140018_j() < 5 && (!par4McoServer.field_96411_l || par4McoServer.field_102022_m)) + { + (new ThreadConnectToOnlineServer(this, par4McoServer)).start(); + } + } + + if (par4McoServer.field_96414_k != null) + { + this.field_96294_a.drawString(GuiScreenOnlineServers.func_110402_q(this.field_96294_a), par4McoServer.field_96414_k, par2 + 215 - GuiScreenOnlineServers.func_140010_p(this.field_96294_a).getStringWidth(par4McoServer.field_96414_k), par3 + 1, 8421504); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiScreenOnlineServers.func_142023_q(this.field_96294_a).getTextureManager().bindTexture(Gui.icons); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiSlotServer.java b/src/main/java/net/minecraft/src/GuiSlotServer.java new file mode 100644 index 0000000..bb754eb --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSlotServer.java @@ -0,0 +1,236 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +class GuiSlotServer extends GuiSlot +{ + /** Instance to the GUI this list is on. */ + final GuiMultiplayer parentGui; + + public GuiSlotServer(GuiMultiplayer par1GuiMultiplayer) + { + super(par1GuiMultiplayer.mc, par1GuiMultiplayer.width, par1GuiMultiplayer.height, 32, par1GuiMultiplayer.height - 64, 36); + this.parentGui = par1GuiMultiplayer; + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return GuiMultiplayer.getInternetServerList(this.parentGui).countServers() + GuiMultiplayer.getListOfLanServers(this.parentGui).size() + 1; + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) + { + if (par1 < GuiMultiplayer.getInternetServerList(this.parentGui).countServers() + GuiMultiplayer.getListOfLanServers(this.parentGui).size()) + { + int var3 = GuiMultiplayer.getSelectedServer(this.parentGui); + GuiMultiplayer.getAndSetSelectedServer(this.parentGui, par1); + ServerData var4 = GuiMultiplayer.getInternetServerList(this.parentGui).countServers() > par1 ? GuiMultiplayer.getInternetServerList(this.parentGui).getServerData(par1) : null; + boolean var5 = GuiMultiplayer.getSelectedServer(this.parentGui) >= 0 && GuiMultiplayer.getSelectedServer(this.parentGui) < this.getSize() && (var4 == null || var4.field_82821_f == 78); + boolean var6 = GuiMultiplayer.getSelectedServer(this.parentGui) < GuiMultiplayer.getInternetServerList(this.parentGui).countServers(); + GuiMultiplayer.getButtonSelect(this.parentGui).enabled = var5; + GuiMultiplayer.getButtonEdit(this.parentGui).enabled = var6; + GuiMultiplayer.getButtonDelete(this.parentGui).enabled = var6; + + if (par2 && var5) + { + GuiMultiplayer.func_74008_b(this.parentGui, par1); + } + else if (var6 && GuiScreen.isShiftKeyDown() && var3 >= 0 && var3 < GuiMultiplayer.getInternetServerList(this.parentGui).countServers()) + { + GuiMultiplayer.getInternetServerList(this.parentGui).swapServers(var3, GuiMultiplayer.getSelectedServer(this.parentGui)); + } + } + } + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return par1 == GuiMultiplayer.getSelectedServer(this.parentGui); + } + + /** + * return the height of the content being scrolled + */ + protected int getContentHeight() + { + return this.getSize() * 36; + } + + protected void drawBackground() + { + this.parentGui.drawDefaultBackground(); + } + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + if (par1 < GuiMultiplayer.getInternetServerList(this.parentGui).countServers()) + { + this.func_77247_d(par1, par2, par3, par4, par5Tessellator); + } + else if (par1 < GuiMultiplayer.getInternetServerList(this.parentGui).countServers() + GuiMultiplayer.getListOfLanServers(this.parentGui).size()) + { + this.func_77248_b(par1, par2, par3, par4, par5Tessellator); + } + else + { + this.func_77249_c(par1, par2, par3, par4, par5Tessellator); + } + } + + private void func_77248_b(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + LanServer var6 = (LanServer)GuiMultiplayer.getListOfLanServers(this.parentGui).get(par1 - GuiMultiplayer.getInternetServerList(this.parentGui).countServers()); + this.parentGui.drawString(this.parentGui.fontRenderer, I18n.getString("lanServer.title"), par2 + 2, par3 + 1, 16777215); + this.parentGui.drawString(this.parentGui.fontRenderer, var6.getServerMotd(), par2 + 2, par3 + 12, 8421504); + + if (this.parentGui.mc.gameSettings.hideServerAddress) + { + this.parentGui.drawString(this.parentGui.fontRenderer, I18n.getString("selectServer.hiddenAddress"), par2 + 2, par3 + 12 + 11, 3158064); + } + else + { + this.parentGui.drawString(this.parentGui.fontRenderer, var6.getServerIpPort(), par2 + 2, par3 + 12 + 11, 3158064); + } + } + + private void func_77249_c(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + this.parentGui.drawCenteredString(this.parentGui.fontRenderer, I18n.getString("lanServer.scanning"), this.parentGui.width / 2, par3 + 1, 16777215); + String var6; + + switch (GuiMultiplayer.getTicksOpened(this.parentGui) / 3 % 4) + { + case 0: + default: + var6 = "O o o"; + break; + + case 1: + case 3: + var6 = "o O o"; + break; + + case 2: + var6 = "o o O"; + } + + this.parentGui.drawCenteredString(this.parentGui.fontRenderer, var6, this.parentGui.width / 2, par3 + 12, 8421504); + } + + private void func_77247_d(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + ServerData var6 = GuiMultiplayer.getInternetServerList(this.parentGui).getServerData(par1); + + synchronized (GuiMultiplayer.getLock()) + { + if (GuiMultiplayer.getThreadsPending() < 5 && !var6.field_78841_f) + { + var6.field_78841_f = true; + var6.pingToServer = -2L; + var6.serverMOTD = ""; + var6.populationInfo = ""; + GuiMultiplayer.increaseThreadsPending(); + (new ThreadPollServers(this, var6)).start(); + } + } + + boolean var7 = var6.field_82821_f > 78; + boolean var8 = var6.field_82821_f < 78; + boolean var9 = var7 || var8; + this.parentGui.drawString(this.parentGui.fontRenderer, var6.serverName, par2 + 2, par3 + 1, 16777215); + this.parentGui.drawString(this.parentGui.fontRenderer, var6.serverMOTD, par2 + 2, par3 + 12, 8421504); + this.parentGui.drawString(this.parentGui.fontRenderer, var6.populationInfo, par2 + 215 - this.parentGui.fontRenderer.getStringWidth(var6.populationInfo), par3 + 12, 8421504); + + if (var9) + { + String var10 = EnumChatFormatting.DARK_RED + var6.gameVersion; + this.parentGui.drawString(this.parentGui.fontRenderer, var10, par2 + 200 - this.parentGui.fontRenderer.getStringWidth(var10), par3 + 1, 8421504); + } + + if (!this.parentGui.mc.gameSettings.hideServerAddress && !var6.isHidingAddress()) + { + this.parentGui.drawString(this.parentGui.fontRenderer, var6.serverIP, par2 + 2, par3 + 12 + 11, 3158064); + } + else + { + this.parentGui.drawString(this.parentGui.fontRenderer, I18n.getString("selectServer.hiddenAddress"), par2 + 2, par3 + 12 + 11, 3158064); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.parentGui.mc.getTextureManager().bindTexture(Gui.icons); + byte var15 = 0; + boolean var11 = false; + String var12 = ""; + int var16; + + if (var9) + { + var12 = var7 ? "Client out of date!" : "Server out of date!"; + var16 = 5; + } + else if (var6.field_78841_f && var6.pingToServer != -2L) + { + if (var6.pingToServer < 0L) + { + var16 = 5; + } + else if (var6.pingToServer < 150L) + { + var16 = 0; + } + else if (var6.pingToServer < 300L) + { + var16 = 1; + } + else if (var6.pingToServer < 600L) + { + var16 = 2; + } + else if (var6.pingToServer < 1000L) + { + var16 = 3; + } + else + { + var16 = 4; + } + + if (var6.pingToServer < 0L) + { + var12 = "(no connection)"; + } + else + { + var12 = var6.pingToServer + "ms"; + } + } + else + { + var15 = 1; + var16 = (int)(Minecraft.getSystemTime() / 100L + (long)(par1 * 2) & 7L); + + if (var16 > 4) + { + var16 = 8 - var16; + } + + var12 = "Polling.."; + } + + this.parentGui.drawTexturedModalRect(par2 + 205, par3, 0 + var15 * 10, 176 + var16 * 8, 10, 8); + byte var13 = 4; + + if (this.mouseX >= par2 + 205 - var13 && this.mouseY >= par3 - var13 && this.mouseX <= par2 + 205 + 10 + var13 && this.mouseY <= par3 + 8 + var13) + { + GuiMultiplayer.getAndSetLagTooltip(this.parentGui, var12); + } + } +} diff --git a/src/main/java/net/minecraft/src/GuiSlotStats.java b/src/main/java/net/minecraft/src/GuiSlotStats.java new file mode 100644 index 0000000..44f885d --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSlotStats.java @@ -0,0 +1,248 @@ +package net.minecraft.src; + +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import org.lwjgl.input.Mouse; + +abstract class GuiSlotStats extends GuiSlot +{ + protected int field_77262_g; + protected List field_77266_h; + protected Comparator field_77267_i; + protected int field_77264_j; + protected int field_77265_k; + + final GuiStats statsGui; + + protected GuiSlotStats(GuiStats par1GuiStats) + { + super(GuiStats.getMinecraft1(par1GuiStats), par1GuiStats.width, par1GuiStats.height, 32, par1GuiStats.height - 64, 20); + this.statsGui = par1GuiStats; + this.field_77262_g = -1; + this.field_77264_j = -1; + this.setShowSelectionBox(false); + this.func_77223_a(true, 20); + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) {} + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return false; + } + + protected void drawBackground() + { + this.statsGui.drawDefaultBackground(); + } + + protected void func_77222_a(int par1, int par2, Tessellator par3Tessellator) + { + if (!Mouse.isButtonDown(0)) + { + this.field_77262_g = -1; + } + + if (this.field_77262_g == 0) + { + GuiStats.drawSprite(this.statsGui, par1 + 115 - 18, par2 + 1, 0, 0); + } + else + { + GuiStats.drawSprite(this.statsGui, par1 + 115 - 18, par2 + 1, 0, 18); + } + + if (this.field_77262_g == 1) + { + GuiStats.drawSprite(this.statsGui, par1 + 165 - 18, par2 + 1, 0, 0); + } + else + { + GuiStats.drawSprite(this.statsGui, par1 + 165 - 18, par2 + 1, 0, 18); + } + + if (this.field_77262_g == 2) + { + GuiStats.drawSprite(this.statsGui, par1 + 215 - 18, par2 + 1, 0, 0); + } + else + { + GuiStats.drawSprite(this.statsGui, par1 + 215 - 18, par2 + 1, 0, 18); + } + + if (this.field_77264_j != -1) + { + short var4 = 79; + byte var5 = 18; + + if (this.field_77264_j == 1) + { + var4 = 129; + } + else if (this.field_77264_j == 2) + { + var4 = 179; + } + + if (this.field_77265_k == 1) + { + var5 = 36; + } + + GuiStats.drawSprite(this.statsGui, par1 + var4, par2 + 1, var5, 0); + } + } + + protected void func_77224_a(int par1, int par2) + { + this.field_77262_g = -1; + + if (par1 >= 79 && par1 < 115) + { + this.field_77262_g = 0; + } + else if (par1 >= 129 && par1 < 165) + { + this.field_77262_g = 1; + } + else if (par1 >= 179 && par1 < 215) + { + this.field_77262_g = 2; + } + + if (this.field_77262_g >= 0) + { + this.func_77261_e(this.field_77262_g); + GuiStats.getMinecraft2(this.statsGui).sndManager.playSoundFX("random.click", 1.0F, 1.0F); + } + } + + /** + * Gets the size of the current slot list. + */ + protected final int getSize() + { + return this.field_77266_h.size(); + } + + protected final StatCrafting func_77257_d(int par1) + { + return (StatCrafting)this.field_77266_h.get(par1); + } + + protected abstract String func_77258_c(int var1); + + protected void func_77260_a(StatCrafting par1StatCrafting, int par2, int par3, boolean par4) + { + String var5; + + if (par1StatCrafting != null) + { + var5 = par1StatCrafting.func_75968_a(GuiStats.getStatsFileWriter(this.statsGui).writeStat(par1StatCrafting)); + this.statsGui.drawString(GuiStats.getFontRenderer4(this.statsGui), var5, par2 - GuiStats.getFontRenderer5(this.statsGui).getStringWidth(var5), par3 + 5, par4 ? 16777215 : 9474192); + } + else + { + var5 = "-"; + this.statsGui.drawString(GuiStats.getFontRenderer6(this.statsGui), var5, par2 - GuiStats.getFontRenderer7(this.statsGui).getStringWidth(var5), par3 + 5, par4 ? 16777215 : 9474192); + } + } + + protected void func_77215_b(int par1, int par2) + { + if (par2 >= this.top && par2 <= this.bottom) + { + int var3 = this.func_77210_c(par1, par2); + int var4 = this.statsGui.width / 2 - 92 - 16; + + if (var3 >= 0) + { + if (par1 < var4 + 40 || par1 > var4 + 40 + 20) + { + return; + } + + StatCrafting var5 = this.func_77257_d(var3); + this.func_77259_a(var5, par1, par2); + } + else + { + String var9 = ""; + + if (par1 >= var4 + 115 - 18 && par1 <= var4 + 115) + { + var9 = this.func_77258_c(0); + } + else if (par1 >= var4 + 165 - 18 && par1 <= var4 + 165) + { + var9 = this.func_77258_c(1); + } + else + { + if (par1 < var4 + 215 - 18 || par1 > var4 + 215) + { + return; + } + + var9 = this.func_77258_c(2); + } + + var9 = ("" + I18n.getString(var9)).trim(); + + if (var9.length() > 0) + { + int var6 = par1 + 12; + int var7 = par2 - 12; + int var8 = GuiStats.getFontRenderer8(this.statsGui).getStringWidth(var9); + GuiStats.drawGradientRect(this.statsGui, var6 - 3, var7 - 3, var6 + var8 + 3, var7 + 8 + 3, -1073741824, -1073741824); + GuiStats.getFontRenderer9(this.statsGui).drawStringWithShadow(var9, var6, var7, -1); + } + } + } + } + + protected void func_77259_a(StatCrafting par1StatCrafting, int par2, int par3) + { + if (par1StatCrafting != null) + { + Item var4 = Item.itemsList[par1StatCrafting.getItemID()]; + String var5 = ("" + I18n.getString(var4.getUnlocalizedName() + ".name")).trim(); + + if (var5.length() > 0) + { + int var6 = par2 + 12; + int var7 = par3 - 12; + int var8 = GuiStats.getFontRenderer10(this.statsGui).getStringWidth(var5); + GuiStats.drawGradientRect1(this.statsGui, var6 - 3, var7 - 3, var6 + var8 + 3, var7 + 8 + 3, -1073741824, -1073741824); + GuiStats.getFontRenderer11(this.statsGui).drawStringWithShadow(var5, var6, var7, -1); + } + } + } + + protected void func_77261_e(int par1) + { + if (par1 != this.field_77264_j) + { + this.field_77264_j = par1; + this.field_77265_k = -1; + } + else if (this.field_77265_k == -1) + { + this.field_77265_k = 1; + } + else + { + this.field_77264_j = -1; + this.field_77265_k = 0; + } + + Collections.sort(this.field_77266_h, this.field_77267_i); + } +} diff --git a/src/main/java/net/minecraft/src/GuiSlotStatsBlock.java b/src/main/java/net/minecraft/src/GuiSlotStatsBlock.java new file mode 100644 index 0000000..10c3cd3 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSlotStatsBlock.java @@ -0,0 +1,92 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; + +class GuiSlotStatsBlock extends GuiSlotStats +{ + /** Instance of GuiStats. */ + final GuiStats theStats; + + public GuiSlotStatsBlock(GuiStats par1GuiStats) + { + super(par1GuiStats); + this.theStats = par1GuiStats; + this.field_77266_h = new ArrayList(); + Iterator var2 = StatList.objectMineStats.iterator(); + + while (var2.hasNext()) + { + StatCrafting var3 = (StatCrafting)var2.next(); + boolean var4 = false; + int var5 = var3.getItemID(); + + if (GuiStats.getStatsFileWriter(par1GuiStats).writeStat(var3) > 0) + { + var4 = true; + } + else if (StatList.objectUseStats[var5] != null && GuiStats.getStatsFileWriter(par1GuiStats).writeStat(StatList.objectUseStats[var5]) > 0) + { + var4 = true; + } + else if (StatList.objectCraftStats[var5] != null && GuiStats.getStatsFileWriter(par1GuiStats).writeStat(StatList.objectCraftStats[var5]) > 0) + { + var4 = true; + } + + if (var4) + { + this.field_77266_h.add(var3); + } + } + + this.field_77267_i = new SorterStatsBlock(this, par1GuiStats); + } + + protected void func_77222_a(int par1, int par2, Tessellator par3Tessellator) + { + super.func_77222_a(par1, par2, par3Tessellator); + + if (this.field_77262_g == 0) + { + GuiStats.drawSprite(this.theStats, par1 + 115 - 18 + 1, par2 + 1 + 1, 18, 18); + } + else + { + GuiStats.drawSprite(this.theStats, par1 + 115 - 18, par2 + 1, 18, 18); + } + + if (this.field_77262_g == 1) + { + GuiStats.drawSprite(this.theStats, par1 + 165 - 18 + 1, par2 + 1 + 1, 36, 18); + } + else + { + GuiStats.drawSprite(this.theStats, par1 + 165 - 18, par2 + 1, 36, 18); + } + + if (this.field_77262_g == 2) + { + GuiStats.drawSprite(this.theStats, par1 + 215 - 18 + 1, par2 + 1 + 1, 54, 18); + } + else + { + GuiStats.drawSprite(this.theStats, par1 + 215 - 18, par2 + 1, 54, 18); + } + } + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + StatCrafting var6 = this.func_77257_d(par1); + int var7 = var6.getItemID(); + GuiStats.drawItemSprite(this.theStats, par2 + 40, par3, var7); + this.func_77260_a((StatCrafting)StatList.objectCraftStats[var7], par2 + 115, par3, par1 % 2 == 0); + this.func_77260_a((StatCrafting)StatList.objectUseStats[var7], par2 + 165, par3, par1 % 2 == 0); + this.func_77260_a(var6, par2 + 215, par3, par1 % 2 == 0); + } + + protected String func_77258_c(int par1) + { + return par1 == 0 ? "stat.crafted" : (par1 == 1 ? "stat.used" : "stat.mined"); + } +} diff --git a/src/main/java/net/minecraft/src/GuiSlotStatsGeneral.java b/src/main/java/net/minecraft/src/GuiSlotStatsGeneral.java new file mode 100644 index 0000000..12eef33 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSlotStatsGeneral.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +class GuiSlotStatsGeneral extends GuiSlot +{ + final GuiStats statsGui; + + public GuiSlotStatsGeneral(GuiStats par1GuiStats) + { + super(GuiStats.getMinecraft(par1GuiStats), par1GuiStats.width, par1GuiStats.height, 32, par1GuiStats.height - 64, 10); + this.statsGui = par1GuiStats; + this.setShowSelectionBox(false); + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return StatList.generalStats.size(); + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) {} + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return false; + } + + /** + * return the height of the content being scrolled + */ + protected int getContentHeight() + { + return this.getSize() * 10; + } + + protected void drawBackground() + { + this.statsGui.drawDefaultBackground(); + } + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + StatBase var6 = (StatBase)StatList.generalStats.get(par1); + this.statsGui.drawString(GuiStats.getFontRenderer1(this.statsGui), I18n.getString(var6.getName()), par2 + 2, par3 + 1, par1 % 2 == 0 ? 16777215 : 9474192); + String var7 = var6.func_75968_a(GuiStats.getStatsFileWriter(this.statsGui).writeStat(var6)); + this.statsGui.drawString(GuiStats.getFontRenderer2(this.statsGui), var7, par2 + 2 + 213 - GuiStats.getFontRenderer3(this.statsGui).getStringWidth(var7), par3 + 1, par1 % 2 == 0 ? 16777215 : 9474192); + } +} diff --git a/src/main/java/net/minecraft/src/GuiSlotStatsItem.java b/src/main/java/net/minecraft/src/GuiSlotStatsItem.java new file mode 100644 index 0000000..b0c4736 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSlotStatsItem.java @@ -0,0 +1,92 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; + +class GuiSlotStatsItem extends GuiSlotStats +{ + /** Instance of GuiStats. */ + final GuiStats slotGuiStats; + + public GuiSlotStatsItem(GuiStats par1GuiStats) + { + super(par1GuiStats); + this.slotGuiStats = par1GuiStats; + this.field_77266_h = new ArrayList(); + Iterator var2 = StatList.itemStats.iterator(); + + while (var2.hasNext()) + { + StatCrafting var3 = (StatCrafting)var2.next(); + boolean var4 = false; + int var5 = var3.getItemID(); + + if (GuiStats.getStatsFileWriter(par1GuiStats).writeStat(var3) > 0) + { + var4 = true; + } + else if (StatList.objectBreakStats[var5] != null && GuiStats.getStatsFileWriter(par1GuiStats).writeStat(StatList.objectBreakStats[var5]) > 0) + { + var4 = true; + } + else if (StatList.objectCraftStats[var5] != null && GuiStats.getStatsFileWriter(par1GuiStats).writeStat(StatList.objectCraftStats[var5]) > 0) + { + var4 = true; + } + + if (var4) + { + this.field_77266_h.add(var3); + } + } + + this.field_77267_i = new SorterStatsItem(this, par1GuiStats); + } + + protected void func_77222_a(int par1, int par2, Tessellator par3Tessellator) + { + super.func_77222_a(par1, par2, par3Tessellator); + + if (this.field_77262_g == 0) + { + GuiStats.drawSprite(this.slotGuiStats, par1 + 115 - 18 + 1, par2 + 1 + 1, 72, 18); + } + else + { + GuiStats.drawSprite(this.slotGuiStats, par1 + 115 - 18, par2 + 1, 72, 18); + } + + if (this.field_77262_g == 1) + { + GuiStats.drawSprite(this.slotGuiStats, par1 + 165 - 18 + 1, par2 + 1 + 1, 18, 18); + } + else + { + GuiStats.drawSprite(this.slotGuiStats, par1 + 165 - 18, par2 + 1, 18, 18); + } + + if (this.field_77262_g == 2) + { + GuiStats.drawSprite(this.slotGuiStats, par1 + 215 - 18 + 1, par2 + 1 + 1, 36, 18); + } + else + { + GuiStats.drawSprite(this.slotGuiStats, par1 + 215 - 18, par2 + 1, 36, 18); + } + } + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + StatCrafting var6 = this.func_77257_d(par1); + int var7 = var6.getItemID(); + GuiStats.drawItemSprite(this.slotGuiStats, par2 + 40, par3, var7); + this.func_77260_a((StatCrafting)StatList.objectBreakStats[var7], par2 + 115, par3, par1 % 2 == 0); + this.func_77260_a((StatCrafting)StatList.objectCraftStats[var7], par2 + 165, par3, par1 % 2 == 0); + this.func_77260_a(var6, par2 + 215, par3, par1 % 2 == 0); + } + + protected String func_77258_c(int par1) + { + return par1 == 1 ? "stat.crafted" : (par1 == 2 ? "stat.used" : "stat.depleted"); + } +} diff --git a/src/main/java/net/minecraft/src/GuiSmallButton.java b/src/main/java/net/minecraft/src/GuiSmallButton.java new file mode 100644 index 0000000..ddfef2c --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSmallButton.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +public class GuiSmallButton extends GuiButton +{ + private final EnumOptions enumOptions; + + public GuiSmallButton(int par1, int par2, int par3, String par4Str) + { + this(par1, par2, par3, (EnumOptions)null, par4Str); + } + + public GuiSmallButton(int par1, int par2, int par3, int par4, int par5, String par6Str) + { + super(par1, par2, par3, par4, par5, par6Str); + this.enumOptions = null; + } + + public GuiSmallButton(int par1, int par2, int par3, EnumOptions par4EnumOptions, String par5Str) + { + super(par1, par2, par3, 150, 20, par5Str); + this.enumOptions = par4EnumOptions; + } + + public EnumOptions returnEnumOptions() + { + return this.enumOptions; + } +} diff --git a/src/main/java/net/minecraft/src/GuiSnooper.java b/src/main/java/net/minecraft/src/GuiSnooper.java new file mode 100644 index 0000000..9b57280 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSnooper.java @@ -0,0 +1,131 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.TreeMap; +import java.util.Map.Entry; + +public class GuiSnooper extends GuiScreen +{ + /** Instance of GuiScreen. */ + private final GuiScreen snooperGuiScreen; + + /** Instance of GameSettings. */ + private final GameSettings snooperGameSettings; + private final List field_74098_c = new ArrayList(); + private final List field_74096_d = new ArrayList(); + + /** The Snooper title. */ + private String snooperTitle; + private String[] field_74101_n; + private GuiSnooperList snooperList; + private GuiButton buttonAllowSnooping; + + public GuiSnooper(GuiScreen par1GuiScreen, GameSettings par2GameSettings) + { + this.snooperGuiScreen = par1GuiScreen; + this.snooperGameSettings = par2GameSettings; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.snooperTitle = I18n.getString("options.snooper.title"); + String var1 = I18n.getString("options.snooper.desc"); + ArrayList var2 = new ArrayList(); + Iterator var3 = this.fontRenderer.listFormattedStringToWidth(var1, this.width - 30).iterator(); + + while (var3.hasNext()) + { + String var4 = (String)var3.next(); + var2.add(var4); + } + + this.field_74101_n = (String[])var2.toArray(new String[0]); + this.field_74098_c.clear(); + this.field_74096_d.clear(); + this.buttonList.add(this.buttonAllowSnooping = new GuiButton(1, this.width / 2 - 152, this.height - 30, 150, 20, this.snooperGameSettings.getKeyBinding(EnumOptions.SNOOPER_ENABLED))); + this.buttonList.add(new GuiButton(2, this.width / 2 + 2, this.height - 30, 150, 20, I18n.getString("gui.done"))); + boolean var6 = this.mc.getIntegratedServer() != null && this.mc.getIntegratedServer().getPlayerUsageSnooper() != null; + Iterator var7 = (new TreeMap(this.mc.getPlayerUsageSnooper().getCurrentStats())).entrySet().iterator(); + Entry var5; + + while (var7.hasNext()) + { + var5 = (Entry)var7.next(); + this.field_74098_c.add((var6 ? "C " : "") + (String)var5.getKey()); + this.field_74096_d.add(this.fontRenderer.trimStringToWidth((String)var5.getValue(), this.width - 220)); + } + + if (var6) + { + var7 = (new TreeMap(this.mc.getIntegratedServer().getPlayerUsageSnooper().getCurrentStats())).entrySet().iterator(); + + while (var7.hasNext()) + { + var5 = (Entry)var7.next(); + this.field_74098_c.add("S " + (String)var5.getKey()); + this.field_74096_d.add(this.fontRenderer.trimStringToWidth((String)var5.getValue(), this.width - 220)); + } + } + + this.snooperList = new GuiSnooperList(this); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 2) + { + this.snooperGameSettings.saveOptions(); + this.snooperGameSettings.saveOptions(); + this.mc.displayGuiScreen(this.snooperGuiScreen); + } + + if (par1GuiButton.id == 1) + { + this.snooperGameSettings.setOptionValue(EnumOptions.SNOOPER_ENABLED, 1); + this.buttonAllowSnooping.displayString = this.snooperGameSettings.getKeyBinding(EnumOptions.SNOOPER_ENABLED); + } + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.snooperList.drawScreen(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, this.snooperTitle, this.width / 2, 8, 16777215); + int var4 = 22; + String[] var5 = this.field_74101_n; + int var6 = var5.length; + + for (int var7 = 0; var7 < var6; ++var7) + { + String var8 = var5[var7]; + this.drawCenteredString(this.fontRenderer, var8, this.width / 2, var4, 8421504); + var4 += this.fontRenderer.FONT_HEIGHT; + } + + super.drawScreen(par1, par2, par3); + } + + static List func_74095_a(GuiSnooper par0GuiSnooper) + { + return par0GuiSnooper.field_74098_c; + } + + static List func_74094_b(GuiSnooper par0GuiSnooper) + { + return par0GuiSnooper.field_74096_d; + } +} diff --git a/src/main/java/net/minecraft/src/GuiSnooperList.java b/src/main/java/net/minecraft/src/GuiSnooperList.java new file mode 100644 index 0000000..1e56472 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiSnooperList.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +class GuiSnooperList extends GuiSlot +{ + final GuiSnooper snooperGui; + + public GuiSnooperList(GuiSnooper par1GuiSnooper) + { + super(par1GuiSnooper.mc, par1GuiSnooper.width, par1GuiSnooper.height, 80, par1GuiSnooper.height - 40, par1GuiSnooper.fontRenderer.FONT_HEIGHT + 1); + this.snooperGui = par1GuiSnooper; + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return GuiSnooper.func_74095_a(this.snooperGui).size(); + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) {} + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return false; + } + + protected void drawBackground() {} + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + this.snooperGui.fontRenderer.drawString((String)GuiSnooper.func_74095_a(this.snooperGui).get(par1), 10, par3, 16777215); + this.snooperGui.fontRenderer.drawString((String)GuiSnooper.func_74094_b(this.snooperGui).get(par1), 230, par3, 16777215); + } + + protected int getScrollBarX() + { + return this.snooperGui.width - 10; + } +} diff --git a/src/main/java/net/minecraft/src/GuiStats.java b/src/main/java/net/minecraft/src/GuiStats.java new file mode 100644 index 0000000..7e029c3 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiStats.java @@ -0,0 +1,295 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class GuiStats extends GuiScreen +{ + private static RenderItem renderItem = new RenderItem(); + protected GuiScreen parentGui; + + /** The title of the stats screen. */ + protected String statsTitle = "Select world"; + + /** The slot for general stats. */ + private GuiSlotStatsGeneral slotGeneral; + + /** The slot for item stats. */ + private GuiSlotStatsItem slotItem; + + /** The slot for block stats. */ + private GuiSlotStatsBlock slotBlock; + private StatFileWriter statFileWriter; + + /** The currently-selected slot. */ + private GuiSlot selectedSlot; + + public GuiStats(GuiScreen par1GuiScreen, StatFileWriter par2StatFileWriter) + { + this.parentGui = par1GuiScreen; + this.statFileWriter = par2StatFileWriter; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.statsTitle = I18n.getString("gui.stats"); + this.slotGeneral = new GuiSlotStatsGeneral(this); + this.slotGeneral.registerScrollButtons(1, 1); + this.slotItem = new GuiSlotStatsItem(this); + this.slotItem.registerScrollButtons(1, 1); + this.slotBlock = new GuiSlotStatsBlock(this); + this.slotBlock.registerScrollButtons(1, 1); + this.selectedSlot = this.slotGeneral; + this.addHeaderButtons(); + } + + /** + * Creates the buttons that appear at the top of the Stats GUI. + */ + public void addHeaderButtons() + { + this.buttonList.add(new GuiButton(0, this.width / 2 + 4, this.height - 28, 150, 20, I18n.getString("gui.done"))); + this.buttonList.add(new GuiButton(1, this.width / 2 - 154, this.height - 52, 100, 20, I18n.getString("stat.generalButton"))); + GuiButton var1; + this.buttonList.add(var1 = new GuiButton(2, this.width / 2 - 46, this.height - 52, 100, 20, I18n.getString("stat.blocksButton"))); + GuiButton var2; + this.buttonList.add(var2 = new GuiButton(3, this.width / 2 + 62, this.height - 52, 100, 20, I18n.getString("stat.itemsButton"))); + + if (this.slotBlock.getSize() == 0) + { + var1.enabled = false; + } + + if (this.slotItem.getSize() == 0) + { + var2.enabled = false; + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + if (par1GuiButton.id == 0) + { + this.mc.displayGuiScreen(this.parentGui); + } + else if (par1GuiButton.id == 1) + { + this.selectedSlot = this.slotGeneral; + } + else if (par1GuiButton.id == 3) + { + this.selectedSlot = this.slotItem; + } + else if (par1GuiButton.id == 2) + { + this.selectedSlot = this.slotBlock; + } + else + { + this.selectedSlot.actionPerformed(par1GuiButton); + } + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.selectedSlot.drawScreen(par1, par2, par3); + this.drawCenteredString(this.fontRenderer, this.statsTitle, this.width / 2, 20, 16777215); + super.drawScreen(par1, par2, par3); + } + + /** + * Draws the item sprite on top of the background sprite. + */ + private void drawItemSprite(int par1, int par2, int par3) + { + this.drawButtonBackground(par1 + 1, par2 + 1); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + RenderHelper.enableGUIStandardItemLighting(); + renderItem.renderItemIntoGUI(this.fontRenderer, this.mc.getTextureManager(), new ItemStack(par3, 1, 0), par1 + 2, par2 + 2); + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } + + /** + * Draws a gray box that serves as a button background. + */ + private void drawButtonBackground(int par1, int par2) + { + this.drawSprite(par1, par2, 0, 0); + } + + /** + * "Draws a sprite from assets/textures/gui/container/stats_icons.png" + */ + private void drawSprite(int par1, int par2, int par3, int par4) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(statIcons); + float var5 = 0.0078125F; + float var6 = 0.0078125F; + boolean var7 = true; + boolean var8 = true; + Tessellator var9 = Tessellator.instance; + var9.startDrawingQuads(); + var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + 18), (double)this.zLevel, (double)((float)(par3 + 0) * 0.0078125F), (double)((float)(par4 + 18) * 0.0078125F)); + var9.addVertexWithUV((double)(par1 + 18), (double)(par2 + 18), (double)this.zLevel, (double)((float)(par3 + 18) * 0.0078125F), (double)((float)(par4 + 18) * 0.0078125F)); + var9.addVertexWithUV((double)(par1 + 18), (double)(par2 + 0), (double)this.zLevel, (double)((float)(par3 + 18) * 0.0078125F), (double)((float)(par4 + 0) * 0.0078125F)); + var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)this.zLevel, (double)((float)(par3 + 0) * 0.0078125F), (double)((float)(par4 + 0) * 0.0078125F)); + var9.draw(); + } + + static Minecraft getMinecraft(GuiStats par0GuiStats) + { + return par0GuiStats.mc; + } + + /** + * there are 11 identical methods like this + */ + static FontRenderer getFontRenderer1(GuiStats par0GuiStats) + { + return par0GuiStats.fontRenderer; + } + + static StatFileWriter getStatsFileWriter(GuiStats par0GuiStats) + { + return par0GuiStats.statFileWriter; + } + + /** + * there are 11 identical methods like this + */ + static FontRenderer getFontRenderer2(GuiStats par0GuiStats) + { + return par0GuiStats.fontRenderer; + } + + /** + * there are 11 identical methods like this + */ + static FontRenderer getFontRenderer3(GuiStats par0GuiStats) + { + return par0GuiStats.fontRenderer; + } + + /** + * exactly the same as 27141 + */ + static Minecraft getMinecraft1(GuiStats par0GuiStats) + { + return par0GuiStats.mc; + } + + /** + * Draws a sprite from /gui/slot.png. + */ + static void drawSprite(GuiStats par0GuiStats, int par1, int par2, int par3, int par4) + { + par0GuiStats.drawSprite(par1, par2, par3, par4); + } + + /** + * exactly the same as 27141 and 27143 + */ + static Minecraft getMinecraft2(GuiStats par0GuiStats) + { + return par0GuiStats.mc; + } + + /** + * there are 11 identical methods like this + */ + static FontRenderer getFontRenderer4(GuiStats par0GuiStats) + { + return par0GuiStats.fontRenderer; + } + + /** + * there are 11 identical methods like this + */ + static FontRenderer getFontRenderer5(GuiStats par0GuiStats) + { + return par0GuiStats.fontRenderer; + } + + /** + * there are 11 identical methods like this + */ + static FontRenderer getFontRenderer6(GuiStats par0GuiStats) + { + return par0GuiStats.fontRenderer; + } + + /** + * there are 11 identical methods like this + */ + static FontRenderer getFontRenderer7(GuiStats par0GuiStats) + { + return par0GuiStats.fontRenderer; + } + + /** + * there are 11 identical methods like this + */ + static FontRenderer getFontRenderer8(GuiStats par0GuiStats) + { + return par0GuiStats.fontRenderer; + } + + static void drawGradientRect(GuiStats par0GuiStats, int par1, int par2, int par3, int par4, int par5, int par6) + { + par0GuiStats.drawGradientRect(par1, par2, par3, par4, par5, par6); + } + + /** + * there are 11 identical methods like this + */ + static FontRenderer getFontRenderer9(GuiStats par0GuiStats) + { + return par0GuiStats.fontRenderer; + } + + /** + * there are 11 identical methods like this + */ + static FontRenderer getFontRenderer10(GuiStats par0GuiStats) + { + return par0GuiStats.fontRenderer; + } + + /** + * exactly the same as 27129 + */ + static void drawGradientRect1(GuiStats par0GuiStats, int par1, int par2, int par3, int par4, int par5, int par6) + { + par0GuiStats.drawGradientRect(par1, par2, par3, par4, par5, par6); + } + + /** + * there are 11 identical methods like this + */ + static FontRenderer getFontRenderer11(GuiStats par0GuiStats) + { + return par0GuiStats.fontRenderer; + } + + /** + * Draws the item sprite on top of the background sprite. + */ + static void drawItemSprite(GuiStats par0GuiStats, int par1, int par2, int par3) + { + par0GuiStats.drawItemSprite(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiTextField.java b/src/main/java/net/minecraft/src/GuiTextField.java new file mode 100644 index 0000000..ecda1f9 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiTextField.java @@ -0,0 +1,757 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class GuiTextField extends Gui +{ + /** + * Have the font renderer from GuiScreen to render the textbox text into the screen. + */ + private final FontRenderer fontRenderer; + private final int xPos; + private final int yPos; + + /** The width of this text field. */ + private final int width; + private final int height; + + /** Have the current text beign edited on the textbox. */ + private String text = ""; + private int maxStringLength = 32; + private int cursorCounter; + private boolean enableBackgroundDrawing = true; + + /** + * if true the textbox can lose focus by clicking elsewhere on the screen + */ + private boolean canLoseFocus = true; + + /** + * If this value is true along isEnabled, keyTyped will process the keys. + */ + private boolean isFocused; + + /** + * If this value is true along isFocused, keyTyped will process the keys. + */ + private boolean isEnabled = true; + + /** + * The current character index that should be used as start of the rendered text. + */ + private int lineScrollOffset; + private int cursorPosition; + + /** other selection position, maybe the same as the cursor */ + private int selectionEnd; + private int enabledColor = 14737632; + private int disabledColor = 7368816; + + /** True if this textbox is visible */ + private boolean visible = true; + + public GuiTextField(FontRenderer par1FontRenderer, int par2, int par3, int par4, int par5) + { + this.fontRenderer = par1FontRenderer; + this.xPos = par2; + this.yPos = par3; + this.width = par4; + this.height = par5; + } + + /** + * Increments the cursor counter + */ + public void updateCursorCounter() + { + ++this.cursorCounter; + } + + /** + * Sets the text of the textbox. + */ + public void setText(String par1Str) + { + if (par1Str.length() > this.maxStringLength) + { + this.text = par1Str.substring(0, this.maxStringLength); + } + else + { + this.text = par1Str; + } + + this.setCursorPositionEnd(); + } + + /** + * Returns the text beign edited on the textbox. + */ + public String getText() + { + return this.text; + } + + /** + * @return returns the text between the cursor and selectionEnd + */ + public String getSelectedtext() + { + int var1 = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd; + int var2 = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition; + return this.text.substring(var1, var2); + } + + /** + * replaces selected text, or inserts text at the position on the cursor + */ + public void writeText(String par1Str) + { + String var2 = ""; + String var3 = ChatAllowedCharacters.filerAllowedCharacters(par1Str); + int var4 = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd; + int var5 = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition; + int var6 = this.maxStringLength - this.text.length() - (var4 - this.selectionEnd); + boolean var7 = false; + + if (this.text.length() > 0) + { + var2 = var2 + this.text.substring(0, var4); + } + + int var8; + + if (var6 < var3.length()) + { + var2 = var2 + var3.substring(0, var6); + var8 = var6; + } + else + { + var2 = var2 + var3; + var8 = var3.length(); + } + + if (this.text.length() > 0 && var5 < this.text.length()) + { + var2 = var2 + this.text.substring(var5); + } + + this.text = var2; + this.moveCursorBy(var4 - this.selectionEnd + var8); + } + + /** + * Deletes the specified number of words starting at the cursor position. Negative numbers will delete words left of + * the cursor. + */ + public void deleteWords(int par1) + { + if (this.text.length() != 0) + { + if (this.selectionEnd != this.cursorPosition) + { + this.writeText(""); + } + else + { + this.deleteFromCursor(this.getNthWordFromCursor(par1) - this.cursorPosition); + } + } + } + + /** + * delete the selected text, otherwsie deletes characters from either side of the cursor. params: delete num + */ + public void deleteFromCursor(int par1) + { + if (this.text.length() != 0) + { + if (this.selectionEnd != this.cursorPosition) + { + this.writeText(""); + } + else + { + boolean var2 = par1 < 0; + int var3 = var2 ? this.cursorPosition + par1 : this.cursorPosition; + int var4 = var2 ? this.cursorPosition : this.cursorPosition + par1; + String var5 = ""; + + if (var3 >= 0) + { + var5 = this.text.substring(0, var3); + } + + if (var4 < this.text.length()) + { + var5 = var5 + this.text.substring(var4); + } + + this.text = var5; + + if (var2) + { + this.moveCursorBy(par1); + } + } + } + } + + /** + * see @getNthNextWordFromPos() params: N, position + */ + public int getNthWordFromCursor(int par1) + { + return this.getNthWordFromPos(par1, this.getCursorPosition()); + } + + /** + * gets the position of the nth word. N may be negative, then it looks backwards. params: N, position + */ + public int getNthWordFromPos(int par1, int par2) + { + return this.func_73798_a(par1, this.getCursorPosition(), true); + } + + public int func_73798_a(int par1, int par2, boolean par3) + { + int var4 = par2; + boolean var5 = par1 < 0; + int var6 = Math.abs(par1); + + for (int var7 = 0; var7 < var6; ++var7) + { + if (var5) + { + while (par3 && var4 > 0 && this.text.charAt(var4 - 1) == 32) + { + --var4; + } + + while (var4 > 0 && this.text.charAt(var4 - 1) != 32) + { + --var4; + } + } + else + { + int var8 = this.text.length(); + var4 = this.text.indexOf(32, var4); + + if (var4 == -1) + { + var4 = var8; + } + else + { + while (par3 && var4 < var8 && this.text.charAt(var4) == 32) + { + ++var4; + } + } + } + } + + return var4; + } + + /** + * Moves the text cursor by a specified number of characters and clears the selection + */ + public void moveCursorBy(int par1) + { + this.setCursorPosition(this.selectionEnd + par1); + } + + /** + * sets the position of the cursor to the provided index + */ + public void setCursorPosition(int par1) + { + this.cursorPosition = par1; + int var2 = this.text.length(); + + if (this.cursorPosition < 0) + { + this.cursorPosition = 0; + } + + if (this.cursorPosition > var2) + { + this.cursorPosition = var2; + } + + this.setSelectionPos(this.cursorPosition); + } + + /** + * sets the cursors position to the beginning + */ + public void setCursorPositionZero() + { + this.setCursorPosition(0); + } + + /** + * sets the cursors position to after the text + */ + public void setCursorPositionEnd() + { + this.setCursorPosition(this.text.length()); + } + + /** + * Call this method from you GuiScreen to process the keys into textbox. + */ + public boolean textboxKeyTyped(char par1, int par2) + { + if (this.isEnabled && this.isFocused) + { + switch (par1) + { + case 1: + this.setCursorPositionEnd(); + this.setSelectionPos(0); + return true; + + case 3: + GuiScreen.setClipboardString(this.getSelectedtext()); + return true; + + case 22: + this.writeText(GuiScreen.getClipboardString()); + return true; + + case 24: + GuiScreen.setClipboardString(this.getSelectedtext()); + this.writeText(""); + return true; + + default: + switch (par2) + { + case 14: + if (GuiScreen.isCtrlKeyDown()) + { + this.deleteWords(-1); + } + else + { + this.deleteFromCursor(-1); + } + + return true; + + case 199: + if (GuiScreen.isShiftKeyDown()) + { + this.setSelectionPos(0); + } + else + { + this.setCursorPositionZero(); + } + + return true; + + case 203: + if (GuiScreen.isShiftKeyDown()) + { + if (GuiScreen.isCtrlKeyDown()) + { + this.setSelectionPos(this.getNthWordFromPos(-1, this.getSelectionEnd())); + } + else + { + this.setSelectionPos(this.getSelectionEnd() - 1); + } + } + else if (GuiScreen.isCtrlKeyDown()) + { + this.setCursorPosition(this.getNthWordFromCursor(-1)); + } + else + { + this.moveCursorBy(-1); + } + + return true; + + case 205: + if (GuiScreen.isShiftKeyDown()) + { + if (GuiScreen.isCtrlKeyDown()) + { + this.setSelectionPos(this.getNthWordFromPos(1, this.getSelectionEnd())); + } + else + { + this.setSelectionPos(this.getSelectionEnd() + 1); + } + } + else if (GuiScreen.isCtrlKeyDown()) + { + this.setCursorPosition(this.getNthWordFromCursor(1)); + } + else + { + this.moveCursorBy(1); + } + + return true; + + case 207: + if (GuiScreen.isShiftKeyDown()) + { + this.setSelectionPos(this.text.length()); + } + else + { + this.setCursorPositionEnd(); + } + + return true; + + case 211: + if (GuiScreen.isCtrlKeyDown()) + { + this.deleteWords(1); + } + else + { + this.deleteFromCursor(1); + } + + return true; + + default: + if (ChatAllowedCharacters.isAllowedCharacter(par1)) + { + this.writeText(Character.toString(par1)); + return true; + } + else + { + return false; + } + } + } + } + else + { + return false; + } + } + + /** + * Args: x, y, buttonClicked + */ + public void mouseClicked(int par1, int par2, int par3) + { + boolean var4 = par1 >= this.xPos && par1 < this.xPos + this.width && par2 >= this.yPos && par2 < this.yPos + this.height; + + if (this.canLoseFocus) + { + this.setFocused(this.isEnabled && var4); + } + + if (this.isFocused && par3 == 0) + { + int var5 = par1 - this.xPos; + + if (this.enableBackgroundDrawing) + { + var5 -= 4; + } + + String var6 = this.fontRenderer.trimStringToWidth(this.text.substring(this.lineScrollOffset), this.getWidth()); + this.setCursorPosition(this.fontRenderer.trimStringToWidth(var6, var5).length() + this.lineScrollOffset); + } + } + + /** + * Draws the textbox + */ + public void drawTextBox() + { + if (this.getVisible()) + { + if (this.getEnableBackgroundDrawing()) + { + drawRect(this.xPos - 1, this.yPos - 1, this.xPos + this.width + 1, this.yPos + this.height + 1, -6250336); + drawRect(this.xPos, this.yPos, this.xPos + this.width, this.yPos + this.height, -16777216); + } + + int var1 = this.isEnabled ? this.enabledColor : this.disabledColor; + int var2 = this.cursorPosition - this.lineScrollOffset; + int var3 = this.selectionEnd - this.lineScrollOffset; + String var4 = this.fontRenderer.trimStringToWidth(this.text.substring(this.lineScrollOffset), this.getWidth()); + boolean var5 = var2 >= 0 && var2 <= var4.length(); + boolean var6 = this.isFocused && this.cursorCounter / 6 % 2 == 0 && var5; + int var7 = this.enableBackgroundDrawing ? this.xPos + 4 : this.xPos; + int var8 = this.enableBackgroundDrawing ? this.yPos + (this.height - 8) / 2 : this.yPos; + int var9 = var7; + + if (var3 > var4.length()) + { + var3 = var4.length(); + } + + if (var4.length() > 0) + { + String var10 = var5 ? var4.substring(0, var2) : var4; + var9 = this.fontRenderer.drawStringWithShadow(var10, var7, var8, var1); + } + + boolean var13 = this.cursorPosition < this.text.length() || this.text.length() >= this.getMaxStringLength(); + int var11 = var9; + + if (!var5) + { + var11 = var2 > 0 ? var7 + this.width : var7; + } + else if (var13) + { + var11 = var9 - 1; + --var9; + } + + if (var4.length() > 0 && var5 && var2 < var4.length()) + { + this.fontRenderer.drawStringWithShadow(var4.substring(var2), var9, var8, var1); + } + + if (var6) + { + if (var13) + { + Gui.drawRect(var11, var8 - 1, var11 + 1, var8 + 1 + this.fontRenderer.FONT_HEIGHT, -3092272); + } + else + { + this.fontRenderer.drawStringWithShadow("_", var11, var8, var1); + } + } + + if (var3 != var2) + { + int var12 = var7 + this.fontRenderer.getStringWidth(var4.substring(0, var3)); + this.drawCursorVertical(var11, var8 - 1, var12 - 1, var8 + 1 + this.fontRenderer.FONT_HEIGHT); + } + } + } + + /** + * draws the vertical line cursor in the textbox + */ + private void drawCursorVertical(int par1, int par2, int par3, int par4) + { + int var5; + + if (par1 < par3) + { + var5 = par1; + par1 = par3; + par3 = var5; + } + + if (par2 < par4) + { + var5 = par2; + par2 = par4; + par4 = var5; + } + + Tessellator var6 = Tessellator.instance; + GL11.glColor4f(0.0F, 0.0F, 255.0F, 255.0F); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_COLOR_LOGIC_OP); + GL11.glLogicOp(GL11.GL_OR_REVERSE); + var6.startDrawingQuads(); + var6.addVertex((double)par1, (double)par4, 0.0D); + var6.addVertex((double)par3, (double)par4, 0.0D); + var6.addVertex((double)par3, (double)par2, 0.0D); + var6.addVertex((double)par1, (double)par2, 0.0D); + var6.draw(); + GL11.glDisable(GL11.GL_COLOR_LOGIC_OP); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + public void setMaxStringLength(int par1) + { + this.maxStringLength = par1; + + if (this.text.length() > par1) + { + this.text = this.text.substring(0, par1); + } + } + + /** + * returns the maximum number of character that can be contained in this textbox + */ + public int getMaxStringLength() + { + return this.maxStringLength; + } + + /** + * returns the current position of the cursor + */ + public int getCursorPosition() + { + return this.cursorPosition; + } + + /** + * get enable drawing background and outline + */ + public boolean getEnableBackgroundDrawing() + { + return this.enableBackgroundDrawing; + } + + /** + * enable drawing background and outline + */ + public void setEnableBackgroundDrawing(boolean par1) + { + this.enableBackgroundDrawing = par1; + } + + /** + * Sets the text colour for this textbox (disabled text will not use this colour) + */ + public void setTextColor(int par1) + { + this.enabledColor = par1; + } + + public void setDisabledTextColour(int par1) + { + this.disabledColor = par1; + } + + /** + * setter for the focused field + */ + public void setFocused(boolean par1) + { + if (par1 && !this.isFocused) + { + this.cursorCounter = 0; + } + + this.isFocused = par1; + } + + /** + * getter for the focused field + */ + public boolean isFocused() + { + return this.isFocused; + } + + public void setEnabled(boolean par1) + { + this.isEnabled = par1; + } + + /** + * the side of the selection that is not the cursor, maye be the same as the cursor + */ + public int getSelectionEnd() + { + return this.selectionEnd; + } + + /** + * returns the width of the textbox depending on if the the box is enabled + */ + public int getWidth() + { + return this.getEnableBackgroundDrawing() ? this.width - 8 : this.width; + } + + /** + * Sets the position of the selection anchor (i.e. position the selection was started at) + */ + public void setSelectionPos(int par1) + { + int var2 = this.text.length(); + + if (par1 > var2) + { + par1 = var2; + } + + if (par1 < 0) + { + par1 = 0; + } + + this.selectionEnd = par1; + + if (this.fontRenderer != null) + { + if (this.lineScrollOffset > var2) + { + this.lineScrollOffset = var2; + } + + int var3 = this.getWidth(); + String var4 = this.fontRenderer.trimStringToWidth(this.text.substring(this.lineScrollOffset), var3); + int var5 = var4.length() + this.lineScrollOffset; + + if (par1 == this.lineScrollOffset) + { + this.lineScrollOffset -= this.fontRenderer.trimStringToWidth(this.text, var3, true).length(); + } + + if (par1 > var5) + { + this.lineScrollOffset += par1 - var5; + } + else if (par1 <= this.lineScrollOffset) + { + this.lineScrollOffset -= this.lineScrollOffset - par1; + } + + if (this.lineScrollOffset < 0) + { + this.lineScrollOffset = 0; + } + + if (this.lineScrollOffset > var2) + { + this.lineScrollOffset = var2; + } + } + } + + /** + * if true the textbox can lose focus by clicking elsewhere on the screen + */ + public void setCanLoseFocus(boolean par1) + { + this.canLoseFocus = par1; + } + + /** + * @return {@code true} if this textbox is visible + */ + public boolean getVisible() + { + return this.visible; + } + + /** + * Sets whether or not this textbox is visible + */ + public void setVisible(boolean par1) + { + this.visible = par1; + } +} diff --git a/src/main/java/net/minecraft/src/GuiVideoSettings.java b/src/main/java/net/minecraft/src/GuiVideoSettings.java new file mode 100644 index 0000000..15ea831 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiVideoSettings.java @@ -0,0 +1,121 @@ +package net.minecraft.src; + +public class GuiVideoSettings extends GuiScreen +{ + private GuiScreen parentGuiScreen; + + /** The title string that is displayed in the top-center of the screen. */ + protected String screenTitle = "Video Settings"; + + /** GUI game settings */ + private GameSettings guiGameSettings; + + /** + * True if the system is 64-bit (using a simple indexOf test on a system property) + */ + private boolean is64bit; + + /** An array of all of EnumOption's video options. */ + private static EnumOptions[] videoOptions = new EnumOptions[] {EnumOptions.GRAPHICS, EnumOptions.RENDER_DISTANCE, EnumOptions.AMBIENT_OCCLUSION, EnumOptions.FRAMERATE_LIMIT, EnumOptions.ANAGLYPH, EnumOptions.VIEW_BOBBING, EnumOptions.GUI_SCALE, EnumOptions.ADVANCED_OPENGL, EnumOptions.GAMMA, EnumOptions.RENDER_CLOUDS, EnumOptions.PARTICLES, EnumOptions.USE_SERVER_TEXTURES, EnumOptions.USE_FULLSCREEN, EnumOptions.ENABLE_VSYNC}; + + public GuiVideoSettings(GuiScreen par1GuiScreen, GameSettings par2GameSettings) + { + this.parentGuiScreen = par1GuiScreen; + this.guiGameSettings = par2GameSettings; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.screenTitle = I18n.getString("options.videoTitle"); + this.buttonList.clear(); + this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.getString("gui.done"))); + this.is64bit = false; + String[] var1 = new String[] {"sun.arch.data.model", "com.ibm.vm.bitmode", "os.arch"}; + String[] var2 = var1; + int var3 = var1.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + String var5 = var2[var4]; + String var6 = System.getProperty(var5); + + if (var6 != null && var6.contains("64")) + { + this.is64bit = true; + break; + } + } + + int var8 = 0; + var3 = this.is64bit ? 0 : -15; + EnumOptions[] var9 = videoOptions; + int var10 = var9.length; + + for (int var11 = 0; var11 < var10; ++var11) + { + EnumOptions var7 = var9[var11]; + + if (var7.getEnumFloat()) + { + this.buttonList.add(new GuiSlider(var7.returnEnumOrdinal(), this.width / 2 - 155 + var8 % 2 * 160, this.height / 7 + var3 + 24 * (var8 >> 1), var7, this.guiGameSettings.getKeyBinding(var7), this.guiGameSettings.getOptionFloatValue(var7))); + } + else + { + this.buttonList.add(new GuiSmallButton(var7.returnEnumOrdinal(), this.width / 2 - 155 + var8 % 2 * 160, this.height / 7 + var3 + 24 * (var8 >> 1), var7, this.guiGameSettings.getKeyBinding(var7))); + } + + ++var8; + } + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + if (par1GuiButton.enabled) + { + int var2 = this.guiGameSettings.guiScale; + + if (par1GuiButton.id < 100 && par1GuiButton instanceof GuiSmallButton) + { + this.guiGameSettings.setOptionValue(((GuiSmallButton)par1GuiButton).returnEnumOptions(), 1); + par1GuiButton.displayString = this.guiGameSettings.getKeyBinding(EnumOptions.getEnumOptions(par1GuiButton.id)); + } + + if (par1GuiButton.id == 200) + { + this.mc.gameSettings.saveOptions(); + this.mc.displayGuiScreen(this.parentGuiScreen); + } + + if (this.guiGameSettings.guiScale != var2) + { + ScaledResolution var3 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + int var4 = var3.getScaledWidth(); + int var5 = var3.getScaledHeight(); + this.setWorldAndResolution(this.mc, var4, var5); + } + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, this.is64bit ? 20 : 5, 16777215); + + if (!this.is64bit && this.guiGameSettings.renderDistance == 0) + { + this.drawCenteredString(this.fontRenderer, I18n.getString("options.farWarning1"), this.width / 2, this.height / 6 + 144 + 1, 11468800); + this.drawCenteredString(this.fontRenderer, I18n.getString("options.farWarning2"), this.width / 2, this.height / 6 + 144 + 13, 11468800); + } + + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiWinGame.java b/src/main/java/net/minecraft/src/GuiWinGame.java new file mode 100644 index 0000000..923b156 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiWinGame.java @@ -0,0 +1,225 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import org.apache.commons.io.Charsets; +import org.lwjgl.opengl.GL11; + +public class GuiWinGame extends GuiScreen +{ + private static final ResourceLocation minecraftLogoTexture = new ResourceLocation("textures/gui/title/minecraft.png"); + private static final ResourceLocation field_110361_b = new ResourceLocation("textures/misc/vignette.png"); + + /** Counts the number of screen updates. */ + private int updateCounter; + + /** List of lines on the ending poem and credits. */ + private List lines; + private int field_73989_c; + private float field_73987_d = 0.5F; + + /** + * Called from the main game loop to update the screen. + */ + public void updateScreen() + { + ++this.updateCounter; + float var1 = (float)(this.field_73989_c + this.height + this.height + 24) / this.field_73987_d; + + if ((float)this.updateCounter > var1) + { + this.respawnPlayer(); + } + } + + /** + * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). + */ + protected void keyTyped(char par1, int par2) + { + if (par2 == 1) + { + this.respawnPlayer(); + } + } + + /** + * Respawns the player. + */ + private void respawnPlayer() + { + this.mc.thePlayer.sendQueue.addToSendQueue(new Packet205ClientCommand(1)); + this.mc.displayGuiScreen((GuiScreen)null); + } + + /** + * Returns true if this GUI should pause the game when it is displayed in single-player + */ + public boolean doesGuiPauseGame() + { + return true; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + if (this.lines == null) + { + this.lines = new ArrayList(); + + try + { + String var1 = ""; + String var2 = "" + EnumChatFormatting.WHITE + EnumChatFormatting.OBFUSCATED + EnumChatFormatting.GREEN + EnumChatFormatting.AQUA; + short var3 = 274; + BufferedReader var4 = new BufferedReader(new InputStreamReader(this.mc.getResourceManager().getResource(new ResourceLocation("texts/end.txt")).getInputStream(), Charsets.UTF_8)); + Random var5 = new Random(8124371L); + int var6; + + while ((var1 = var4.readLine()) != null) + { + String var7; + String var8; + + for (var1 = var1.replaceAll("PLAYERNAME", this.mc.getSession().getUsername()); var1.contains(var2); var1 = var7 + EnumChatFormatting.WHITE + EnumChatFormatting.OBFUSCATED + "XXXXXXXX".substring(0, var5.nextInt(4) + 3) + var8) + { + var6 = var1.indexOf(var2); + var7 = var1.substring(0, var6); + var8 = var1.substring(var6 + var2.length()); + } + + this.lines.addAll(this.mc.fontRenderer.listFormattedStringToWidth(var1, var3)); + this.lines.add(""); + } + + for (var6 = 0; var6 < 8; ++var6) + { + this.lines.add(""); + } + + var4 = new BufferedReader(new InputStreamReader(this.mc.getResourceManager().getResource(new ResourceLocation("texts/credits.txt")).getInputStream(), Charsets.UTF_8)); + + while ((var1 = var4.readLine()) != null) + { + var1 = var1.replaceAll("PLAYERNAME", this.mc.getSession().getUsername()); + var1 = var1.replaceAll("\t", " "); + this.lines.addAll(this.mc.fontRenderer.listFormattedStringToWidth(var1, var3)); + this.lines.add(""); + } + + this.field_73989_c = this.lines.size() * 12; + } + catch (Exception var9) + { + var9.printStackTrace(); + } + } + } + + private void func_73986_b(int par1, int par2, float par3) + { + Tessellator var4 = Tessellator.instance; + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + var4.startDrawingQuads(); + var4.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F); + int var5 = this.width; + float var6 = 0.0F - ((float)this.updateCounter + par3) * 0.5F * this.field_73987_d; + float var7 = (float)this.height - ((float)this.updateCounter + par3) * 0.5F * this.field_73987_d; + float var8 = 0.015625F; + float var9 = ((float)this.updateCounter + par3 - 0.0F) * 0.02F; + float var10 = (float)(this.field_73989_c + this.height + this.height + 24) / this.field_73987_d; + float var11 = (var10 - 20.0F - ((float)this.updateCounter + par3)) * 0.005F; + + if (var11 < var9) + { + var9 = var11; + } + + if (var9 > 1.0F) + { + var9 = 1.0F; + } + + var9 *= var9; + var9 = var9 * 96.0F / 255.0F; + var4.setColorOpaque_F(var9, var9, var9); + var4.addVertexWithUV(0.0D, (double)this.height, (double)this.zLevel, 0.0D, (double)(var6 * var8)); + var4.addVertexWithUV((double)var5, (double)this.height, (double)this.zLevel, (double)((float)var5 * var8), (double)(var6 * var8)); + var4.addVertexWithUV((double)var5, 0.0D, (double)this.zLevel, (double)((float)var5 * var8), (double)(var7 * var8)); + var4.addVertexWithUV(0.0D, 0.0D, (double)this.zLevel, 0.0D, (double)(var7 * var8)); + var4.draw(); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.func_73986_b(par1, par2, par3); + Tessellator var4 = Tessellator.instance; + short var5 = 274; + int var6 = this.width / 2 - var5 / 2; + int var7 = this.height + 50; + float var8 = -((float)this.updateCounter + par3) * this.field_73987_d; + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, var8, 0.0F); + this.mc.getTextureManager().bindTexture(minecraftLogoTexture); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.drawTexturedModalRect(var6, var7, 0, 0, 155, 44); + this.drawTexturedModalRect(var6 + 155, var7, 0, 45, 155, 44); + var4.setColorOpaque_I(16777215); + int var9 = var7 + 200; + int var10; + + for (var10 = 0; var10 < this.lines.size(); ++var10) + { + if (var10 == this.lines.size() - 1) + { + float var11 = (float)var9 + var8 - (float)(this.height / 2 - 6); + + if (var11 < 0.0F) + { + GL11.glTranslatef(0.0F, -var11, 0.0F); + } + } + + if ((float)var9 + var8 + 12.0F + 8.0F > 0.0F && (float)var9 + var8 < (float)this.height) + { + String var12 = (String)this.lines.get(var10); + + if (var12.startsWith("[C]")) + { + this.fontRenderer.drawStringWithShadow(var12.substring(3), var6 + (var5 - this.fontRenderer.getStringWidth(var12.substring(3))) / 2, var9, 16777215); + } + else + { + this.fontRenderer.fontRandom.setSeed((long)var10 * 4238972211L + (long)(this.updateCounter / 4)); + this.fontRenderer.drawStringWithShadow(var12, var6, var9, 16777215); + } + } + + var9 += 12; + } + + GL11.glPopMatrix(); + this.mc.getTextureManager().bindTexture(field_110361_b); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_ZERO, GL11.GL_ONE_MINUS_SRC_COLOR); + var4.startDrawingQuads(); + var4.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F); + var10 = this.width; + int var13 = this.height; + var4.addVertexWithUV(0.0D, (double)var13, (double)this.zLevel, 0.0D, 1.0D); + var4.addVertexWithUV((double)var10, (double)var13, (double)this.zLevel, 1.0D, 1.0D); + var4.addVertexWithUV((double)var10, 0.0D, (double)this.zLevel, 1.0D, 0.0D); + var4.addVertexWithUV(0.0D, 0.0D, (double)this.zLevel, 0.0D, 0.0D); + var4.draw(); + GL11.glDisable(GL11.GL_BLEND); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/GuiWorldSlot.java b/src/main/java/net/minecraft/src/GuiWorldSlot.java new file mode 100644 index 0000000..38828cf --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiWorldSlot.java @@ -0,0 +1,100 @@ +package net.minecraft.src; + +import java.util.Date; + +class GuiWorldSlot extends GuiSlot +{ + final GuiSelectWorld parentWorldGui; + + public GuiWorldSlot(GuiSelectWorld par1GuiSelectWorld) + { + super(par1GuiSelectWorld.mc, par1GuiSelectWorld.width, par1GuiSelectWorld.height, 32, par1GuiSelectWorld.height - 64, 36); + this.parentWorldGui = par1GuiSelectWorld; + } + + /** + * Gets the size of the current slot list. + */ + protected int getSize() + { + return GuiSelectWorld.getSize(this.parentWorldGui).size(); + } + + /** + * the element in the slot that was clicked, boolean for wether it was double clicked or not + */ + protected void elementClicked(int par1, boolean par2) + { + GuiSelectWorld.onElementSelected(this.parentWorldGui, par1); + boolean var3 = GuiSelectWorld.getSelectedWorld(this.parentWorldGui) >= 0 && GuiSelectWorld.getSelectedWorld(this.parentWorldGui) < this.getSize(); + GuiSelectWorld.getSelectButton(this.parentWorldGui).enabled = var3; + GuiSelectWorld.getRenameButton(this.parentWorldGui).enabled = var3; + GuiSelectWorld.getDeleteButton(this.parentWorldGui).enabled = var3; + GuiSelectWorld.func_82312_f(this.parentWorldGui).enabled = var3; + + if (par2 && var3) + { + this.parentWorldGui.selectWorld(par1); + } + } + + /** + * returns true if the element passed in is currently selected + */ + protected boolean isSelected(int par1) + { + return par1 == GuiSelectWorld.getSelectedWorld(this.parentWorldGui); + } + + /** + * return the height of the content being scrolled + */ + protected int getContentHeight() + { + return GuiSelectWorld.getSize(this.parentWorldGui).size() * 36; + } + + protected void drawBackground() + { + this.parentWorldGui.drawDefaultBackground(); + } + + protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator) + { + SaveFormatComparator var6 = (SaveFormatComparator)GuiSelectWorld.getSize(this.parentWorldGui).get(par1); + String var7 = var6.getDisplayName(); + + if (var7 == null || MathHelper.stringNullOrLengthZero(var7)) + { + var7 = GuiSelectWorld.func_82313_g(this.parentWorldGui) + " " + (par1 + 1); + } + + String var8 = var6.getFileName(); + var8 = var8 + " (" + GuiSelectWorld.func_82315_h(this.parentWorldGui).format(new Date(var6.getLastTimePlayed())); + var8 = var8 + ")"; + String var9 = ""; + + if (var6.requiresConversion()) + { + var9 = GuiSelectWorld.func_82311_i(this.parentWorldGui) + " " + var9; + } + else + { + var9 = GuiSelectWorld.func_82314_j(this.parentWorldGui)[var6.getEnumGameType().getID()]; + + if (var6.isHardcoreModeEnabled()) + { + var9 = EnumChatFormatting.DARK_RED + I18n.getString("gameMode.hardcore") + EnumChatFormatting.RESET; + } + + if (var6.getCheatsEnabled()) + { + var9 = var9 + ", " + I18n.getString("selectWorld.cheats"); + } + } + + this.parentWorldGui.drawString(this.parentWorldGui.fontRenderer, var7, par2 + 2, par3 + 1, 16777215); + this.parentWorldGui.drawString(this.parentWorldGui.fontRenderer, var8, par2 + 2, par3 + 12, 8421504); + this.parentWorldGui.drawString(this.parentWorldGui.fontRenderer, var9, par2 + 2, par3 + 12 + 10, 8421504); + } +} diff --git a/src/main/java/net/minecraft/src/GuiYesNo.java b/src/main/java/net/minecraft/src/GuiYesNo.java new file mode 100644 index 0000000..68df496 --- /dev/null +++ b/src/main/java/net/minecraft/src/GuiYesNo.java @@ -0,0 +1,72 @@ +package net.minecraft.src; + +public class GuiYesNo extends GuiScreen +{ + /** + * A reference to the screen object that created this. Used for navigating between screens. + */ + protected GuiScreen parentScreen; + + /** First line of text. */ + protected String message1; + + /** Second line of text. */ + private String message2; + + /** The text shown for the first button in GuiYesNo */ + protected String buttonText1; + + /** The text shown for the second button in GuiYesNo */ + protected String buttonText2; + + /** World number to be deleted. */ + protected int worldNumber; + + public GuiYesNo(GuiScreen par1GuiScreen, String par2Str, String par3Str, int par4) + { + this.parentScreen = par1GuiScreen; + this.message1 = par2Str; + this.message2 = par3Str; + this.worldNumber = par4; + this.buttonText1 = I18n.getString("gui.yes"); + this.buttonText2 = I18n.getString("gui.no"); + } + + public GuiYesNo(GuiScreen par1GuiScreen, String par2Str, String par3Str, String par4Str, String par5Str, int par6) + { + this.parentScreen = par1GuiScreen; + this.message1 = par2Str; + this.message2 = par3Str; + this.buttonText1 = par4Str; + this.buttonText2 = par5Str; + this.worldNumber = par6; + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + this.buttonList.add(new GuiSmallButton(0, this.width / 2 - 155, this.height / 6 + 96, this.buttonText1)); + this.buttonList.add(new GuiSmallButton(1, this.width / 2 - 155 + 160, this.height / 6 + 96, this.buttonText2)); + } + + /** + * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e). + */ + protected void actionPerformed(GuiButton par1GuiButton) + { + this.parentScreen.confirmClicked(par1GuiButton.id == 0, this.worldNumber); + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + this.drawDefaultBackground(); + this.drawCenteredString(this.fontRenderer, this.message1, this.width / 2, 70, 16777215); + this.drawCenteredString(this.fontRenderer, this.message2, this.width / 2, 90, 16777215); + super.drawScreen(par1, par2, par3); + } +} diff --git a/src/main/java/net/minecraft/src/Hopper.java b/src/main/java/net/minecraft/src/Hopper.java new file mode 100644 index 0000000..6c6b3ee --- /dev/null +++ b/src/main/java/net/minecraft/src/Hopper.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +public interface Hopper extends IInventory +{ + /** + * Returns the worldObj for this tileEntity. + */ + World getWorldObj(); + + /** + * Gets the world X position for this hopper entity. + */ + double getXPos(); + + /** + * Gets the world Y position for this hopper entity. + */ + double getYPos(); + + /** + * Gets the world Z position for this hopper entity. + */ + double getZPos(); +} diff --git a/src/main/java/net/minecraft/src/HttpUtil.java b/src/main/java/net/minecraft/src/HttpUtil.java new file mode 100644 index 0000000..da3cb91 --- /dev/null +++ b/src/main/java/net/minecraft/src/HttpUtil.java @@ -0,0 +1,159 @@ +package net.minecraft.src; + +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.Proxy; +import java.net.ServerSocket; +import java.net.URL; +import java.net.URLEncoder; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import java.util.logging.Level; +import java.util.logging.Logger; +import net.minecraft.server.MinecraftServer; + +public class HttpUtil +{ + /** + * Builds an encoded HTTP POST content string from a string map + */ + public static String buildPostString(Map par0Map) + { + StringBuilder var1 = new StringBuilder(); + Iterator var2 = par0Map.entrySet().iterator(); + + while (var2.hasNext()) + { + Entry var3 = (Entry)var2.next(); + + if (var1.length() > 0) + { + var1.append('&'); + } + + try + { + var1.append(URLEncoder.encode((String)var3.getKey(), "UTF-8")); + } + catch (UnsupportedEncodingException var6) + { + var6.printStackTrace(); + } + + if (var3.getValue() != null) + { + var1.append('='); + + try + { + var1.append(URLEncoder.encode(var3.getValue().toString(), "UTF-8")); + } + catch (UnsupportedEncodingException var5) + { + var5.printStackTrace(); + } + } + } + + return var1.toString(); + } + + /** + * Sends a HTTP POST request to the given URL with data from a map + */ + public static String sendPost(ILogAgent par0ILogAgent, URL par1URL, Map par2Map, boolean par3) + { + return sendPost(par0ILogAgent, par1URL, buildPostString(par2Map), par3); + } + + /** + * Sends a HTTP POST request to the given URL with data from a string + */ + private static String sendPost(ILogAgent par0ILogAgent, URL par1URL, String par2Str, boolean par3) + { + try + { + Proxy var4 = MinecraftServer.getServer() == null ? null : MinecraftServer.getServer().getServerProxy(); + + if (var4 == null) + { + var4 = Proxy.NO_PROXY; + } + + HttpURLConnection var5 = (HttpURLConnection)par1URL.openConnection(var4); + var5.setRequestMethod("POST"); + var5.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + var5.setRequestProperty("Content-Length", "" + par2Str.getBytes().length); + var5.setRequestProperty("Content-Language", "en-US"); + var5.setUseCaches(false); + var5.setDoInput(true); + var5.setDoOutput(true); + DataOutputStream var6 = new DataOutputStream(var5.getOutputStream()); + var6.writeBytes(par2Str); + var6.flush(); + var6.close(); + BufferedReader var7 = new BufferedReader(new InputStreamReader(var5.getInputStream())); + StringBuffer var9 = new StringBuffer(); + String var8; + + while ((var8 = var7.readLine()) != null) + { + var9.append(var8); + var9.append('\r'); + } + + var7.close(); + return var9.toString(); + } + catch (Exception var10) + { + if (!par3) + { + if (par0ILogAgent != null) + { + par0ILogAgent.logSevereException("Could not post to " + par1URL, var10); + } + else + { + Logger.getAnonymousLogger().log(Level.SEVERE, "Could not post to " + par1URL, var10); + } + } + + return ""; + } + } + + public static int func_76181_a() throws IOException + { + ServerSocket var0 = null; + boolean var1 = true; + int var10; + + try + { + var0 = new ServerSocket(0); + var10 = var0.getLocalPort(); + } + finally + { + try + { + if (var0 != null) + { + var0.close(); + } + } + catch (IOException var8) + { + ; + } + } + + return var10; + } +} diff --git a/src/main/java/net/minecraft/src/I18n.java b/src/main/java/net/minecraft/src/I18n.java new file mode 100644 index 0000000..0329c43 --- /dev/null +++ b/src/main/java/net/minecraft/src/I18n.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public class I18n +{ + private static Locale i18nLocale; + + static void setLocale(Locale par0Locale) + { + i18nLocale = par0Locale; + } + + public static String getString(String par0Str) + { + return i18nLocale.translateKey(par0Str); + } + + public static String getStringParams(String par0Str, Object ... par1ArrayOfObj) + { + return i18nLocale.formatMessage(par0Str, par1ArrayOfObj); + } +} diff --git a/src/main/java/net/minecraft/src/IAdminCommand.java b/src/main/java/net/minecraft/src/IAdminCommand.java new file mode 100644 index 0000000..844347d --- /dev/null +++ b/src/main/java/net/minecraft/src/IAdminCommand.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public interface IAdminCommand +{ + /** + * Sends a message to the admins of the server from a given CommandSender with the given resource string and given + * extra srings. If the int par2 is even or zero, the original sender is also notified. + */ + void notifyAdmins(ICommandSender var1, int var2, String var3, Object ... var4); +} diff --git a/src/main/java/net/minecraft/src/IAnimals.java b/src/main/java/net/minecraft/src/IAnimals.java new file mode 100644 index 0000000..53a3719 --- /dev/null +++ b/src/main/java/net/minecraft/src/IAnimals.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public interface IAnimals +{ +} diff --git a/src/main/java/net/minecraft/src/IBehaviorDispenseItem.java b/src/main/java/net/minecraft/src/IBehaviorDispenseItem.java new file mode 100644 index 0000000..32c6c7c --- /dev/null +++ b/src/main/java/net/minecraft/src/IBehaviorDispenseItem.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public interface IBehaviorDispenseItem +{ + IBehaviorDispenseItem itemDispenseBehaviorProvider = new BehaviorDispenseItemProvider(); + + /** + * Dispenses the specified ItemStack from a dispenser. + */ + ItemStack dispense(IBlockSource var1, ItemStack var2); +} diff --git a/src/main/java/net/minecraft/src/IBlockAccess.java b/src/main/java/net/minecraft/src/IBlockAccess.java new file mode 100644 index 0000000..c705049 --- /dev/null +++ b/src/main/java/net/minecraft/src/IBlockAccess.java @@ -0,0 +1,82 @@ +package net.minecraft.src; + +public interface IBlockAccess +{ + /** + * Returns the block ID at coords x,y,z + */ + int getBlockId(int var1, int var2, int var3); + + /** + * Returns the TileEntity associated with a given block in X,Y,Z coordinates, or null if no TileEntity exists + */ + TileEntity getBlockTileEntity(int var1, int var2, int var3); + + /** + * Any Light rendered on a 1.8 Block goes through here + */ + int getLightBrightnessForSkyBlocks(int var1, int var2, int var3, int var4); + + float getBrightness(int var1, int var2, int var3, int var4); + + /** + * Returns how bright the block is shown as which is the block's light value looked up in a lookup table (light + * values aren't linear for brightness). Args: x, y, z + */ + float getLightBrightness(int var1, int var2, int var3); + + /** + * Returns the block metadata at coords x,y,z + */ + int getBlockMetadata(int var1, int var2, int var3); + + /** + * Returns the block's material. + */ + Material getBlockMaterial(int var1, int var2, int var3); + + /** + * Returns true if the block at the specified coordinates is an opaque cube. Args: x, y, z + */ + boolean isBlockOpaqueCube(int var1, int var2, int var3); + + /** + * Indicate if a material is a normal solid opaque cube. + */ + boolean isBlockNormalCube(int var1, int var2, int var3); + + /** + * Returns true if the block at the specified coordinates is empty + */ + boolean isAirBlock(int var1, int var2, int var3); + + /** + * Gets the biome for a given set of x/z coordinates + */ + BiomeGenBase getBiomeGenForCoords(int var1, int var2); + + /** + * Returns current world height. + */ + int getHeight(); + + /** + * set by !chunk.getAreLevelsEmpty + */ + boolean extendedLevelsInChunkCache(); + + /** + * Returns true if the block at the given coordinate has a solid (buildable) top surface. + */ + boolean doesBlockHaveSolidTopSurface(int var1, int var2, int var3); + + /** + * Return the Vec3Pool object for this world. + */ + Vec3Pool getWorldVec3Pool(); + + /** + * Is this block powering in the specified direction Args: x, y, z, direction + */ + int isBlockProvidingPowerTo(int var1, int var2, int var3, int var4); +} diff --git a/src/main/java/net/minecraft/src/IBlockSource.java b/src/main/java/net/minecraft/src/IBlockSource.java new file mode 100644 index 0000000..c4d37bc --- /dev/null +++ b/src/main/java/net/minecraft/src/IBlockSource.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +public interface IBlockSource extends ILocatableSource +{ + double getX(); + + double getY(); + + double getZ(); + + int getXInt(); + + int getYInt(); + + int getZInt(); + + int getBlockMetadata(); + + TileEntity getBlockTileEntity(); +} diff --git a/src/main/java/net/minecraft/src/IBossDisplayData.java b/src/main/java/net/minecraft/src/IBossDisplayData.java new file mode 100644 index 0000000..1b70849 --- /dev/null +++ b/src/main/java/net/minecraft/src/IBossDisplayData.java @@ -0,0 +1,13 @@ +package net.minecraft.src; + +public interface IBossDisplayData +{ + float getMaxHealth(); + + float getHealth(); + + /** + * Gets the username of the entity. + */ + String getEntityName(); +} diff --git a/src/main/java/net/minecraft/src/ICamera.java b/src/main/java/net/minecraft/src/ICamera.java new file mode 100644 index 0000000..edc2f73 --- /dev/null +++ b/src/main/java/net/minecraft/src/ICamera.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public interface ICamera +{ + /** + * Returns true if the bounding box is inside all 6 clipping planes, otherwise returns false. + */ + boolean isBoundingBoxInFrustum(AxisAlignedBB var1); + + void setPosition(double var1, double var3, double var5); +} diff --git a/src/main/java/net/minecraft/src/IChunkLoader.java b/src/main/java/net/minecraft/src/IChunkLoader.java new file mode 100644 index 0000000..55cccf2 --- /dev/null +++ b/src/main/java/net/minecraft/src/IChunkLoader.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +import java.io.IOException; + +public interface IChunkLoader +{ + /** + * Loads the specified(XZ) chunk into the specified world. + */ + Chunk loadChunk(World var1, int var2, int var3) throws IOException; + + void saveChunk(World var1, Chunk var2) throws MinecraftException, IOException; + + /** + * Save extra data associated with this Chunk not normally saved during autosave, only during chunk unload. + * Currently unused. + */ + void saveExtraChunkData(World var1, Chunk var2); + + /** + * Called every World.tick() + */ + void chunkTick(); + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unused. + */ + void saveExtraData(); +} diff --git a/src/main/java/net/minecraft/src/IChunkProvider.java b/src/main/java/net/minecraft/src/IChunkProvider.java new file mode 100644 index 0000000..ffbcf7a --- /dev/null +++ b/src/main/java/net/minecraft/src/IChunkProvider.java @@ -0,0 +1,68 @@ +package net.minecraft.src; + +import java.util.List; + +public interface IChunkProvider +{ + /** + * Checks to see if a chunk exists at x, y + */ + boolean chunkExists(int var1, int var2); + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the + * specified chunk from the map seed and chunk seed + */ + Chunk provideChunk(int var1, int var2); + + /** + * loads or generates the chunk at the chunk location specified + */ + Chunk loadChunk(int var1, int var2); + + /** + * Populates chunk with ores etc etc + */ + void populate(IChunkProvider var1, int var2, int var3); + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. + * Return true if all chunks have been saved. + */ + boolean saveChunks(boolean var1, IProgressUpdate var2); + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. + */ + boolean unloadQueuedChunks(); + + /** + * Returns if the IChunkProvider supports saving. + */ + boolean canSave(); + + /** + * Converts the instance data to a readable string. + */ + String makeString(); + + /** + * Returns a list of creatures of the specified type that can spawn at the given location. + */ + List getPossibleCreatures(EnumCreatureType var1, int var2, int var3, int var4); + + /** + * Returns the location of the closest structure of the specified type. If not found returns null. + */ + ChunkPosition findClosestStructure(World var1, String var2, int var3, int var4, int var5); + + int getLoadedChunkCount(); + + void recreateStructures(int var1, int var2); + + /** + * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently + * unimplemented. + */ + void saveExtraData(); +} diff --git a/src/main/java/net/minecraft/src/ICommand.java b/src/main/java/net/minecraft/src/ICommand.java new file mode 100644 index 0000000..d25c953 --- /dev/null +++ b/src/main/java/net/minecraft/src/ICommand.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import java.util.List; + +public interface ICommand extends Comparable +{ + String getCommandName(); + + String getCommandUsage(ICommandSender var1); + + List getCommandAliases(); + + void processCommand(ICommandSender var1, String[] var2); + + /** + * Returns true if the given command sender is allowed to use this command. + */ + boolean canCommandSenderUseCommand(ICommandSender var1); + + /** + * Adds the strings available in this command to the given list of tab completion options. + */ + List addTabCompletionOptions(ICommandSender var1, String[] var2); + + /** + * Return whether the specified command parameter index is a username parameter. + */ + boolean isUsernameIndex(String[] var1, int var2); +} diff --git a/src/main/java/net/minecraft/src/ICommandManager.java b/src/main/java/net/minecraft/src/ICommandManager.java new file mode 100644 index 0000000..feb4555 --- /dev/null +++ b/src/main/java/net/minecraft/src/ICommandManager.java @@ -0,0 +1,24 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Map; + +public interface ICommandManager +{ + int executeCommand(ICommandSender var1, String var2); + + /** + * Performs a "begins with" string match on each token in par2. Only returns commands that par1 can use. + */ + List getPossibleCommands(ICommandSender var1, String var2); + + /** + * returns all commands that the commandSender can use + */ + List getPossibleCommands(ICommandSender var1); + + /** + * returns a map of string to commads. All commands are returned, not just ones which someone has permission to use. + */ + Map getCommands(); +} diff --git a/src/main/java/net/minecraft/src/ICommandSender.java b/src/main/java/net/minecraft/src/ICommandSender.java new file mode 100644 index 0000000..c9f422d --- /dev/null +++ b/src/main/java/net/minecraft/src/ICommandSender.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +public interface ICommandSender +{ + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + String getCommandSenderName(); + + void sendChatToPlayer(ChatMessageComponent var1); + + /** + * Returns true if the command sender is allowed to use the given command. + */ + boolean canCommandSenderUseCommand(int var1, String var2); + + /** + * Return the position for this command sender. + */ + ChunkCoordinates getPlayerCoordinates(); + + World getEntityWorld(); +} diff --git a/src/main/java/net/minecraft/src/ICrafting.java b/src/main/java/net/minecraft/src/ICrafting.java new file mode 100644 index 0000000..1cde741 --- /dev/null +++ b/src/main/java/net/minecraft/src/ICrafting.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +import java.util.List; + +public interface ICrafting +{ + void sendContainerAndContentsToPlayer(Container var1, List var2); + + /** + * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual + * contents of that slot. Args: Container, slot number, slot contents + */ + void sendSlotContents(Container var1, int var2, ItemStack var3); + + /** + * Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress, + * and enchanting level. Normally the first int identifies which variable to update, and the second contains the new + * value. Both are truncated to shorts in non-local SMP. + */ + void sendProgressBarUpdate(Container var1, int var2, int var3); +} diff --git a/src/main/java/net/minecraft/src/IEnchantmentModifier.java b/src/main/java/net/minecraft/src/IEnchantmentModifier.java new file mode 100644 index 0000000..4887eb1 --- /dev/null +++ b/src/main/java/net/minecraft/src/IEnchantmentModifier.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +interface IEnchantmentModifier +{ + /** + * Generic method use to calculate modifiers of offensive or defensive enchantment values. + */ + void calculateModifier(Enchantment var1, int var2); +} diff --git a/src/main/java/net/minecraft/src/IEntityMultiPart.java b/src/main/java/net/minecraft/src/IEntityMultiPart.java new file mode 100644 index 0000000..041a300 --- /dev/null +++ b/src/main/java/net/minecraft/src/IEntityMultiPart.java @@ -0,0 +1,8 @@ +package net.minecraft.src; + +public interface IEntityMultiPart +{ + World func_82194_d(); + + boolean attackEntityFromPart(EntityDragonPart var1, DamageSource var2, float var3); +} diff --git a/src/main/java/net/minecraft/src/IEntitySelector.java b/src/main/java/net/minecraft/src/IEntitySelector.java new file mode 100644 index 0000000..78fad82 --- /dev/null +++ b/src/main/java/net/minecraft/src/IEntitySelector.java @@ -0,0 +1,12 @@ +package net.minecraft.src; + +public interface IEntitySelector +{ + IEntitySelector selectAnything = new EntitySelectorAlive(); + IEntitySelector selectInventories = new EntitySelectorInventory(); + + /** + * Return whether the specified entity is applicable to this filter. + */ + boolean isEntityApplicable(Entity var1); +} diff --git a/src/main/java/net/minecraft/src/IImageBuffer.java b/src/main/java/net/minecraft/src/IImageBuffer.java new file mode 100644 index 0000000..741e003 --- /dev/null +++ b/src/main/java/net/minecraft/src/IImageBuffer.java @@ -0,0 +1,8 @@ +package net.minecraft.src; + +import java.awt.image.BufferedImage; + +public interface IImageBuffer +{ + BufferedImage parseUserSkin(BufferedImage var1); +} diff --git a/src/main/java/net/minecraft/src/IInvBasic.java b/src/main/java/net/minecraft/src/IInvBasic.java new file mode 100644 index 0000000..d86e7a9 --- /dev/null +++ b/src/main/java/net/minecraft/src/IInvBasic.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public interface IInvBasic +{ + /** + * Called by InventoryBasic.onInventoryChanged() on a array that is never filled. + */ + void onInventoryChanged(InventoryBasic var1); +} diff --git a/src/main/java/net/minecraft/src/IInventory.java b/src/main/java/net/minecraft/src/IInventory.java new file mode 100644 index 0000000..6ee69c1 --- /dev/null +++ b/src/main/java/net/minecraft/src/IInventory.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +public interface IInventory +{ + /** + * Returns the number of slots in the inventory. + */ + int getSizeInventory(); + + /** + * Returns the stack in slot i + */ + ItemStack getStackInSlot(int var1); + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + ItemStack decrStackSize(int var1, int var2); + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + ItemStack getStackInSlotOnClosing(int var1); + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + void setInventorySlotContents(int var1, ItemStack var2); + + /** + * Returns the name of the inventory. + */ + String getInvName(); + + /** + * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's + * language. Otherwise it will be used directly. + */ + boolean isInvNameLocalized(); + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't + * this more of a set than a get?* + */ + int getInventoryStackLimit(); + + /** + * Called when an the contents of an Inventory change, usually + */ + void onInventoryChanged(); + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + boolean isUseableByPlayer(EntityPlayer var1); + + void openChest(); + + void closeChest(); + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + boolean isItemValidForSlot(int var1, ItemStack var2); +} diff --git a/src/main/java/net/minecraft/src/ILocatableSource.java b/src/main/java/net/minecraft/src/ILocatableSource.java new file mode 100644 index 0000000..1b78a09 --- /dev/null +++ b/src/main/java/net/minecraft/src/ILocatableSource.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public interface ILocatableSource extends ILocation +{ +} diff --git a/src/main/java/net/minecraft/src/ILocation.java b/src/main/java/net/minecraft/src/ILocation.java new file mode 100644 index 0000000..d9761fe --- /dev/null +++ b/src/main/java/net/minecraft/src/ILocation.java @@ -0,0 +1,6 @@ +package net.minecraft.src; + +public interface ILocation extends IPosition +{ + World getWorld(); +} diff --git a/src/main/java/net/minecraft/src/ILogAgent.java b/src/main/java/net/minecraft/src/ILogAgent.java new file mode 100644 index 0000000..9adbb2a --- /dev/null +++ b/src/main/java/net/minecraft/src/ILogAgent.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +public interface ILogAgent +{ + void logInfo(String var1); + + void logWarning(String var1); + + void logWarningFormatted(String var1, Object ... var2); + + void logWarningException(String var1, Throwable var2); + + void logSevere(String var1); + + void logSevereException(String var1, Throwable var2); + + void logFine(String var1); +} diff --git a/src/main/java/net/minecraft/src/IMerchant.java b/src/main/java/net/minecraft/src/IMerchant.java new file mode 100644 index 0000000..42cc220 --- /dev/null +++ b/src/main/java/net/minecraft/src/IMerchant.java @@ -0,0 +1,16 @@ +package net.minecraft.src; + +public interface IMerchant +{ + void setCustomer(EntityPlayer var1); + + EntityPlayer getCustomer(); + + MerchantRecipeList getRecipes(EntityPlayer var1); + + void setRecipes(MerchantRecipeList var1); + + void useRecipe(MerchantRecipe var1); + + void func_110297_a_(ItemStack var1); +} diff --git a/src/main/java/net/minecraft/src/IMob.java b/src/main/java/net/minecraft/src/IMob.java new file mode 100644 index 0000000..4782d69 --- /dev/null +++ b/src/main/java/net/minecraft/src/IMob.java @@ -0,0 +1,7 @@ +package net.minecraft.src; + +public interface IMob extends IAnimals +{ + /** Entity selector for IMob types. */ + IEntitySelector mobSelector = new FilterIMob(); +} diff --git a/src/main/java/net/minecraft/src/INetworkManager.java b/src/main/java/net/minecraft/src/INetworkManager.java new file mode 100644 index 0000000..371e9b9 --- /dev/null +++ b/src/main/java/net/minecraft/src/INetworkManager.java @@ -0,0 +1,49 @@ +package net.minecraft.src; + +import java.net.SocketAddress; + +public interface INetworkManager +{ + /** + * Sets the NetHandler for this NetworkManager. Server-only. + */ + void setNetHandler(NetHandler var1); + + /** + * Adds the packet to the correct send queue (chunk data packets go to a separate queue). + */ + void addToSendQueue(Packet var1); + + /** + * Wakes reader and writer threads + */ + void wakeThreads(); + + /** + * Checks timeouts and processes all pending read packets. + */ + void processReadPackets(); + + /** + * Return the InetSocketAddress of the remote endpoint + */ + SocketAddress getSocketAddress(); + + /** + * Shuts down the server. (Only actually used on the server) + */ + void serverShutdown(); + + /** + * returns 0 for memoryConnections + */ + int packetSize(); + + /** + * Shuts down the network with the specified reason. Closes all streams and sockets, spawns NetworkMasterThread to + * stop reading and writing threads. + */ + void networkShutdown(String var1, Object ... var2); + + void closeConnections(); +} diff --git a/src/main/java/net/minecraft/src/INpc.java b/src/main/java/net/minecraft/src/INpc.java new file mode 100644 index 0000000..081c277 --- /dev/null +++ b/src/main/java/net/minecraft/src/INpc.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public interface INpc extends IAnimals +{ +} diff --git a/src/main/java/net/minecraft/src/IPlayerFileData.java b/src/main/java/net/minecraft/src/IPlayerFileData.java new file mode 100644 index 0000000..760479a --- /dev/null +++ b/src/main/java/net/minecraft/src/IPlayerFileData.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public interface IPlayerFileData +{ + /** + * Writes the player data to disk from the specified PlayerEntityMP. + */ + void writePlayerData(EntityPlayer var1); + + /** + * Reads the player data from disk into the specified PlayerEntityMP. + */ + NBTTagCompound readPlayerData(EntityPlayer var1); + + /** + * Returns an array of usernames for which player.dat exists for. + */ + String[] getAvailablePlayerDat(); +} diff --git a/src/main/java/net/minecraft/src/IPlayerUsage.java b/src/main/java/net/minecraft/src/IPlayerUsage.java new file mode 100644 index 0000000..238405f --- /dev/null +++ b/src/main/java/net/minecraft/src/IPlayerUsage.java @@ -0,0 +1,15 @@ +package net.minecraft.src; + +public interface IPlayerUsage +{ + void addServerStatsToSnooper(PlayerUsageSnooper var1); + + void addServerTypeToSnooper(PlayerUsageSnooper var1); + + /** + * Returns whether snooping is enabled or not. + */ + boolean isSnooperEnabled(); + + ILogAgent getLogAgent(); +} diff --git a/src/main/java/net/minecraft/src/IPosition.java b/src/main/java/net/minecraft/src/IPosition.java new file mode 100644 index 0000000..a1f4a90 --- /dev/null +++ b/src/main/java/net/minecraft/src/IPosition.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +public interface IPosition +{ + double getX(); + + double getY(); + + double getZ(); +} diff --git a/src/main/java/net/minecraft/src/IProgressUpdate.java b/src/main/java/net/minecraft/src/IProgressUpdate.java new file mode 100644 index 0000000..f7fa04f --- /dev/null +++ b/src/main/java/net/minecraft/src/IProgressUpdate.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public interface IProgressUpdate +{ + /** + * "Saving level", or the loading,or downloading equivelent + */ + void displayProgressMessage(String var1); + + /** + * This is called with "Working..." by resetProgressAndMessage + */ + void resetProgresAndWorkingMessage(String var1); + + /** + * Updates the progress bar on the loading screen to the specified amount. Args: loadProgress + */ + void setLoadingProgress(int var1); +} diff --git a/src/main/java/net/minecraft/src/IProjectile.java b/src/main/java/net/minecraft/src/IProjectile.java new file mode 100644 index 0000000..da4ad7f --- /dev/null +++ b/src/main/java/net/minecraft/src/IProjectile.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public interface IProjectile +{ + /** + * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction. + */ + void setThrowableHeading(double var1, double var3, double var5, float var7, float var8); +} diff --git a/src/main/java/net/minecraft/src/IRangedAttackMob.java b/src/main/java/net/minecraft/src/IRangedAttackMob.java new file mode 100644 index 0000000..528f7b0 --- /dev/null +++ b/src/main/java/net/minecraft/src/IRangedAttackMob.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public interface IRangedAttackMob +{ + /** + * Attack the specified entity using a ranged attack. + */ + void attackEntityWithRangedAttack(EntityLivingBase var1, float var2); +} diff --git a/src/main/java/net/minecraft/src/IRecipe.java b/src/main/java/net/minecraft/src/IRecipe.java new file mode 100644 index 0000000..0dc59af --- /dev/null +++ b/src/main/java/net/minecraft/src/IRecipe.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public interface IRecipe +{ + /** + * Used to check if a recipe matches current crafting inventory + */ + boolean matches(InventoryCrafting var1, World var2); + + /** + * Returns an Item that is the result of this recipe + */ + ItemStack getCraftingResult(InventoryCrafting var1); + + /** + * Returns the size of the recipe area + */ + int getRecipeSize(); + + ItemStack getRecipeOutput(); +} diff --git a/src/main/java/net/minecraft/src/IRegistry.java b/src/main/java/net/minecraft/src/IRegistry.java new file mode 100644 index 0000000..48cb0c9 --- /dev/null +++ b/src/main/java/net/minecraft/src/IRegistry.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +public interface IRegistry +{ + Object getObject(Object var1); + + /** + * Register an object on this registry. + */ + void putObject(Object var1, Object var2); +} diff --git a/src/main/java/net/minecraft/src/ISaveFormat.java b/src/main/java/net/minecraft/src/ISaveFormat.java new file mode 100644 index 0000000..153ff5c --- /dev/null +++ b/src/main/java/net/minecraft/src/ISaveFormat.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +import java.util.List; + +public interface ISaveFormat +{ + /** + * Returns back a loader for the specified save directory + */ + ISaveHandler getSaveLoader(String var1, boolean var2); + + List getSaveList() throws AnvilConverterException; + + void flushCache(); + + /** + * gets the world info + */ + WorldInfo getWorldInfo(String var1); + + /** + * @args: Takes one argument - the name of the directory of the world to delete. @desc: Delete the world by deleting + * the associated directory recursively. + */ + boolean deleteWorldDirectory(String var1); + + /** + * @args: Takes two arguments - first the name of the directory containing the world and second the new name for + * that world. @desc: Renames the world by storing the new name in level.dat. It does *not* rename the directory + * containing the world data. + */ + void renameWorld(String var1, String var2); + + /** + * Checks if the save directory uses the old map format + */ + boolean isOldMapFormat(String var1); + + /** + * Converts the specified map to the new map format. Args: worldName, loadingScreen + */ + boolean convertMapFormat(String var1, IProgressUpdate var2); + + /** + * Return whether the given world can be loaded. + */ + boolean canLoadWorld(String var1); +} diff --git a/src/main/java/net/minecraft/src/ISaveHandler.java b/src/main/java/net/minecraft/src/ISaveHandler.java new file mode 100644 index 0000000..8cf0b80 --- /dev/null +++ b/src/main/java/net/minecraft/src/ISaveHandler.java @@ -0,0 +1,51 @@ +package net.minecraft.src; + +import java.io.File; + +public interface ISaveHandler +{ + /** + * Loads and returns the world info + */ + WorldInfo loadWorldInfo(); + + /** + * Checks the session lock to prevent save collisions + */ + void checkSessionLock() throws MinecraftException; + + /** + * Returns the chunk loader with the provided world provider + */ + IChunkLoader getChunkLoader(WorldProvider var1); + + /** + * Saves the given World Info with the given NBTTagCompound as the Player. + */ + void saveWorldInfoWithPlayer(WorldInfo var1, NBTTagCompound var2); + + /** + * Saves the passed in world info. + */ + void saveWorldInfo(WorldInfo var1); + + /** + * returns null if no saveHandler is relevent (eg. SMP) + */ + IPlayerFileData getSaveHandler(); + + /** + * Called to flush all changes to disk, waiting for them to complete. + */ + void flush(); + + /** + * Gets the file location of the given map + */ + File getMapFileFromName(String var1); + + /** + * Returns the name of the directory where world information is saved. + */ + String getWorldDirectoryName(); +} diff --git a/src/main/java/net/minecraft/src/IServer.java b/src/main/java/net/minecraft/src/IServer.java new file mode 100644 index 0000000..0f1a2ce --- /dev/null +++ b/src/main/java/net/minecraft/src/IServer.java @@ -0,0 +1,98 @@ +package net.minecraft.src; + +public interface IServer +{ + /** + * Gets an integer property. If it does not exist, set it to the specified value. + */ + int getIntProperty(String var1, int var2); + + /** + * Gets a string property. If it does not exist, set it to the specified value. + */ + String getStringProperty(String var1, String var2); + + /** + * Saves an Object with the given property name. + */ + void setProperty(String var1, Object var2); + + /** + * Saves all of the server properties to the properties file. + */ + void saveProperties(); + + /** + * Returns the filename where server properties are stored + */ + String getSettingsFilename(); + + /** + * Returns the server's hostname. + */ + String getHostname(); + + /** + * Never used, but "getServerPort" is already taken. + */ + int getPort(); + + /** + * Returns the server message of the day + */ + String getServerMOTD(); + + /** + * Returns the server's Minecraft version as string. + */ + String getMinecraftVersion(); + + /** + * Returns the number of players currently on the server. + */ + int getCurrentPlayerCount(); + + /** + * Returns the maximum number of players allowed on the server. + */ + int getMaxPlayers(); + + /** + * Returns an array of the usernames of all the connected players. + */ + String[] getAllUsernames(); + + String getFolderName(); + + /** + * Used by RCon's Query in the form of "MajorServerMod 1.2.3: MyPlugin 1.3; AnotherPlugin 2.1; AndSoForth 1.0". + */ + String getPlugins(); + + String executeCommand(String var1); + + /** + * Returns true if debugging is enabled, false otherwise. + */ + boolean isDebuggingEnabled(); + + /** + * Logs the message with a level of INFO. + */ + void logInfo(String var1); + + /** + * Logs the message with a level of WARN. + */ + void logWarning(String var1); + + /** + * Logs the error message with a level of SEVERE. + */ + void logSevere(String var1); + + /** + * If isDebuggingEnabled(), logs the message with a level of INFO. + */ + void logDebug(String var1); +} diff --git a/src/main/java/net/minecraft/src/ISidedInventory.java b/src/main/java/net/minecraft/src/ISidedInventory.java new file mode 100644 index 0000000..4dd3aba --- /dev/null +++ b/src/main/java/net/minecraft/src/ISidedInventory.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +public interface ISidedInventory extends IInventory +{ + /** + * Returns an array containing the indices of the slots that can be accessed by automation on the given side of this + * block. + */ + int[] getAccessibleSlotsFromSide(int var1); + + /** + * Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, + * side + */ + boolean canInsertItem(int var1, ItemStack var2, int var3); + + /** + * Returns true if automation can extract the given item in the given slot from the given side. Args: Slot, item, + * side + */ + boolean canExtractItem(int var1, ItemStack var2, int var3); +} diff --git a/src/main/java/net/minecraft/src/IStatStringFormat.java b/src/main/java/net/minecraft/src/IStatStringFormat.java new file mode 100644 index 0000000..fab59ef --- /dev/null +++ b/src/main/java/net/minecraft/src/IStatStringFormat.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public interface IStatStringFormat +{ + /** + * Formats the strings based on 'IStatStringFormat' interface. + */ + String formatString(String var1); +} diff --git a/src/main/java/net/minecraft/src/IStatType.java b/src/main/java/net/minecraft/src/IStatType.java new file mode 100644 index 0000000..cab0b5f --- /dev/null +++ b/src/main/java/net/minecraft/src/IStatType.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public interface IStatType +{ + /** + * Formats a given stat for human consumption. + */ + String format(int var1); +} diff --git a/src/main/java/net/minecraft/src/IThreadedFileIO.java b/src/main/java/net/minecraft/src/IThreadedFileIO.java new file mode 100644 index 0000000..b815f77 --- /dev/null +++ b/src/main/java/net/minecraft/src/IThreadedFileIO.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public interface IThreadedFileIO +{ + /** + * Returns a boolean stating if the write was unsuccessful. + */ + boolean writeNextIO(); +} diff --git a/src/main/java/net/minecraft/src/ITileEntityProvider.java b/src/main/java/net/minecraft/src/ITileEntityProvider.java new file mode 100644 index 0000000..9402387 --- /dev/null +++ b/src/main/java/net/minecraft/src/ITileEntityProvider.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public interface ITileEntityProvider +{ + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + TileEntity createNewTileEntity(World var1); +} diff --git a/src/main/java/net/minecraft/src/IUpdatePlayerListBox.java b/src/main/java/net/minecraft/src/IUpdatePlayerListBox.java new file mode 100644 index 0000000..4200f1c --- /dev/null +++ b/src/main/java/net/minecraft/src/IUpdatePlayerListBox.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public interface IUpdatePlayerListBox +{ + /** + * Updates the JList with a new model. + */ + void update(); +} diff --git a/src/main/java/net/minecraft/src/IWorldAccess.java b/src/main/java/net/minecraft/src/IWorldAccess.java new file mode 100644 index 0000000..1c8c237 --- /dev/null +++ b/src/main/java/net/minecraft/src/IWorldAccess.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +public interface IWorldAccess +{ + /** + * On the client, re-renders the block. On the server, sends the block to the client (which will re-render it), + * including the tile entity description packet if applicable. Args: x, y, z + */ + void markBlockForUpdate(int var1, int var2, int var3); + + /** + * On the client, re-renders this block. On the server, does nothing. Used for lighting updates. + */ + void markBlockForRenderUpdate(int var1, int var2, int var3); + + /** + * On the client, re-renders all blocks in this range, inclusive. On the server, does nothing. Args: min x, min y, + * min z, max x, max y, max z + */ + void markBlockRangeForRenderUpdate(int var1, int var2, int var3, int var4, int var5, int var6); + + /** + * Plays the specified sound. Arg: soundName, x, y, z, volume, pitch + */ + void playSound(String var1, double var2, double var4, double var6, float var8, float var9); + + /** + * Plays sound to all near players except the player reference given + */ + void playSoundToNearExcept(EntityPlayer var1, String var2, double var3, double var5, double var7, float var9, float var10); + + /** + * Spawns a particle. Arg: particleType, x, y, z, velX, velY, velZ + */ + void spawnParticle(String var1, double var2, double var4, double var6, double var8, double var10, double var12); + + /** + * Called on all IWorldAccesses when an entity is created or loaded. On client worlds, starts downloading any + * necessary textures. On server worlds, adds the entity to the entity tracker. + */ + void onEntityCreate(Entity var1); + + /** + * Called on all IWorldAccesses when an entity is unloaded or destroyed. On client worlds, releases any downloaded + * textures. On server worlds, removes the entity from the entity tracker. + */ + void onEntityDestroy(Entity var1); + + /** + * Plays the specified record. Arg: recordName, x, y, z + */ + void playRecord(String var1, int var2, int var3, int var4); + + void broadcastSound(int var1, int var2, int var3, int var4, int var5); + + /** + * Plays a pre-canned sound effect along with potentially auxiliary data-driven one-shot behaviour (particles, etc). + */ + void playAuxSFX(EntityPlayer var1, int var2, int var3, int var4, int var5, int var6); + + /** + * Starts (or continues) destroying a block with given ID at the given coordinates for the given partially destroyed + * value + */ + void destroyBlockPartially(int var1, int var2, int var3, int var4, int var5); +} diff --git a/src/main/java/net/minecraft/src/Icon.java b/src/main/java/net/minecraft/src/Icon.java new file mode 100644 index 0000000..1bb2d55 --- /dev/null +++ b/src/main/java/net/minecraft/src/Icon.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +public interface Icon +{ + /** + * Returns the width of the icon, in pixels. + */ + int getIconWidth(); + + /** + * Returns the height of the icon, in pixels. + */ + int getIconHeight(); + + /** + * Returns the minimum U coordinate to use when rendering with this icon. + */ + float getMinU(); + + /** + * Returns the maximum U coordinate to use when rendering with this icon. + */ + float getMaxU(); + + /** + * Gets a U coordinate on the icon. 0 returns uMin and 16 returns uMax. Other arguments return in-between values. + */ + float getInterpolatedU(double var1); + + /** + * Returns the minimum V coordinate to use when rendering with this icon. + */ + float getMinV(); + + /** + * Returns the maximum V coordinate to use when rendering with this icon. + */ + float getMaxV(); + + /** + * Gets a V coordinate on the icon. 0 returns vMin and 16 returns vMax. Other arguments return in-between values. + */ + float getInterpolatedV(double var1); + + String getIconName(); +} diff --git a/src/main/java/net/minecraft/src/IconFlipped.java b/src/main/java/net/minecraft/src/IconFlipped.java new file mode 100644 index 0000000..14403dd --- /dev/null +++ b/src/main/java/net/minecraft/src/IconFlipped.java @@ -0,0 +1,86 @@ +package net.minecraft.src; + +public class IconFlipped implements Icon +{ + private final Icon baseIcon; + private final boolean flipU; + private final boolean flipV; + + public IconFlipped(Icon par1Icon, boolean par2, boolean par3) + { + this.baseIcon = par1Icon; + this.flipU = par2; + this.flipV = par3; + } + + /** + * Returns the width of the icon, in pixels. + */ + public int getIconWidth() + { + return this.baseIcon.getIconWidth(); + } + + /** + * Returns the height of the icon, in pixels. + */ + public int getIconHeight() + { + return this.baseIcon.getIconHeight(); + } + + /** + * Returns the minimum U coordinate to use when rendering with this icon. + */ + public float getMinU() + { + return this.flipU ? this.baseIcon.getMaxU() : this.baseIcon.getMinU(); + } + + /** + * Returns the maximum U coordinate to use when rendering with this icon. + */ + public float getMaxU() + { + return this.flipU ? this.baseIcon.getMinU() : this.baseIcon.getMaxU(); + } + + /** + * Gets a U coordinate on the icon. 0 returns uMin and 16 returns uMax. Other arguments return in-between values. + */ + public float getInterpolatedU(double par1) + { + float var3 = this.getMaxU() - this.getMinU(); + return this.getMinU() + var3 * ((float)par1 / 16.0F); + } + + /** + * Returns the minimum V coordinate to use when rendering with this icon. + */ + public float getMinV() + { + return this.flipV ? this.baseIcon.getMinV() : this.baseIcon.getMinV(); + } + + /** + * Returns the maximum V coordinate to use when rendering with this icon. + */ + public float getMaxV() + { + return this.flipV ? this.baseIcon.getMinV() : this.baseIcon.getMaxV(); + } + + /** + * Gets a V coordinate on the icon. 0 returns vMin and 16 returns vMax. Other arguments return in-between values. + */ + public float getInterpolatedV(double par1) + { + float var3 = this.getMaxV() - this.getMinV(); + return this.getMinV() + var3 * ((float)par1 / 16.0F); + } + + public String getIconName() + { + return this.baseIcon.getIconName(); + } +} diff --git a/src/main/java/net/minecraft/src/IconRegister.java b/src/main/java/net/minecraft/src/IconRegister.java new file mode 100644 index 0000000..cbca42c --- /dev/null +++ b/src/main/java/net/minecraft/src/IconRegister.java @@ -0,0 +1,6 @@ +package net.minecraft.src; + +public interface IconRegister +{ + Icon registerIcon(String var1); +} diff --git a/src/main/java/net/minecraft/src/ImageBufferDownload.java b/src/main/java/net/minecraft/src/ImageBufferDownload.java new file mode 100644 index 0000000..ae0ecc9 --- /dev/null +++ b/src/main/java/net/minecraft/src/ImageBufferDownload.java @@ -0,0 +1,89 @@ +package net.minecraft.src; + +import java.awt.Graphics; +import java.awt.image.BufferedImage; +import java.awt.image.DataBufferInt; +import java.awt.image.ImageObserver; + +public class ImageBufferDownload implements IImageBuffer +{ + private int[] imageData; + private int imageWidth; + private int imageHeight; + + public BufferedImage parseUserSkin(BufferedImage par1BufferedImage) + { + if (par1BufferedImage == null) + { + return null; + } + else + { + this.imageWidth = 64; + this.imageHeight = 32; + BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2); + Graphics var3 = var2.getGraphics(); + var3.drawImage(par1BufferedImage, 0, 0, (ImageObserver)null); + var3.dispose(); + this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData(); + this.setAreaOpaque(0, 0, 32, 16); + this.setAreaTransparent(32, 0, 64, 32); + this.setAreaOpaque(0, 16, 64, 32); + return var2; + } + } + + /** + * Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer + * layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin + * maker is just using an image editor without an alpha channel) + */ + private void setAreaTransparent(int par1, int par2, int par3, int par4) + { + if (!this.hasTransparency(par1, par2, par3, par4)) + { + for (int var5 = par1; var5 < par3; ++var5) + { + for (int var6 = par2; var6 < par4; ++var6) + { + this.imageData[var5 + var6 * this.imageWidth] &= 16777215; + } + } + } + } + + /** + * Makes the given area of the image opaque + */ + private void setAreaOpaque(int par1, int par2, int par3, int par4) + { + for (int var5 = par1; var5 < par3; ++var5) + { + for (int var6 = par2; var6 < par4; ++var6) + { + this.imageData[var5 + var6 * this.imageWidth] |= -16777216; + } + } + } + + /** + * Returns true if the given area of the image contains transparent pixels + */ + private boolean hasTransparency(int par1, int par2, int par3, int par4) + { + for (int var5 = par1; var5 < par3; ++var5) + { + for (int var6 = par2; var6 < par4; ++var6) + { + int var7 = this.imageData[var5 + var6 * this.imageWidth]; + + if ((var7 >> 24 & 255) < 128) + { + return true; + } + } + } + + return false; + } +} diff --git a/src/main/java/net/minecraft/src/IntCache.java b/src/main/java/net/minecraft/src/IntCache.java new file mode 100644 index 0000000..c9cd58e --- /dev/null +++ b/src/main/java/net/minecraft/src/IntCache.java @@ -0,0 +1,99 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class IntCache +{ + private static int intCacheSize = 256; + + /** + * A list of pre-allocated int[256] arrays that are currently unused and can be returned by getIntCache() + */ + private static List freeSmallArrays = new ArrayList(); + + /** + * A list of pre-allocated int[256] arrays that were previously returned by getIntCache() and which will not be re- + * used again until resetIntCache() is called. + */ + private static List inUseSmallArrays = new ArrayList(); + + /** + * A list of pre-allocated int[cacheSize] arrays that are currently unused and can be returned by getIntCache() + */ + private static List freeLargeArrays = new ArrayList(); + + /** + * A list of pre-allocated int[cacheSize] arrays that were previously returned by getIntCache() and which will not + * be re-used again until resetIntCache() is called. + */ + private static List inUseLargeArrays = new ArrayList(); + + public static synchronized int[] getIntCache(int par0) + { + int[] var1; + + if (par0 <= 256) + { + if (freeSmallArrays.isEmpty()) + { + var1 = new int[256]; + inUseSmallArrays.add(var1); + return var1; + } + else + { + var1 = (int[])freeSmallArrays.remove(freeSmallArrays.size() - 1); + inUseSmallArrays.add(var1); + return var1; + } + } + else if (par0 > intCacheSize) + { + intCacheSize = par0; + freeLargeArrays.clear(); + inUseLargeArrays.clear(); + var1 = new int[intCacheSize]; + inUseLargeArrays.add(var1); + return var1; + } + else if (freeLargeArrays.isEmpty()) + { + var1 = new int[intCacheSize]; + inUseLargeArrays.add(var1); + return var1; + } + else + { + var1 = (int[])freeLargeArrays.remove(freeLargeArrays.size() - 1); + inUseLargeArrays.add(var1); + return var1; + } + } + + /** + * Mark all pre-allocated arrays as available for re-use by moving them to the appropriate free lists. + */ + public static synchronized void resetIntCache() + { + if (!freeLargeArrays.isEmpty()) + { + freeLargeArrays.remove(freeLargeArrays.size() - 1); + } + + if (!freeSmallArrays.isEmpty()) + { + freeSmallArrays.remove(freeSmallArrays.size() - 1); + } + + freeLargeArrays.addAll(inUseLargeArrays); + freeSmallArrays.addAll(inUseSmallArrays); + inUseLargeArrays.clear(); + inUseSmallArrays.clear(); + } + + public static synchronized String func_85144_b() + { + return "cache: " + freeLargeArrays.size() + ", tcache: " + freeSmallArrays.size() + ", allocated: " + inUseLargeArrays.size() + ", tallocated: " + inUseSmallArrays.size(); + } +} diff --git a/src/main/java/net/minecraft/src/IntHashMap.java b/src/main/java/net/minecraft/src/IntHashMap.java new file mode 100644 index 0000000..648bbd0 --- /dev/null +++ b/src/main/java/net/minecraft/src/IntHashMap.java @@ -0,0 +1,245 @@ +package net.minecraft.src; + +import java.util.HashSet; +import java.util.Set; + +public class IntHashMap +{ + /** An array of HashEntries representing the heads of hash slot lists */ + private transient IntHashMapEntry[] slots = new IntHashMapEntry[16]; + + /** The number of items stored in this map */ + private transient int count; + + /** The grow threshold */ + private int threshold = 12; + + /** The scale factor used to determine when to grow the table */ + private final float growFactor = 0.75F; + + /** A serial stamp used to mark changes */ + private transient volatile int versionStamp; + + /** The set of all the keys stored in this MCHash object */ + private Set keySet = new HashSet(); + + /** + * Makes the passed in integer suitable for hashing by a number of shifts + */ + private static int computeHash(int par0) + { + par0 ^= par0 >>> 20 ^ par0 >>> 12; + return par0 ^ par0 >>> 7 ^ par0 >>> 4; + } + + /** + * Computes the index of the slot for the hash and slot count passed in. + */ + private static int getSlotIndex(int par0, int par1) + { + return par0 & par1 - 1; + } + + /** + * Returns the object associated to a key + */ + public Object lookup(int par1) + { + int var2 = computeHash(par1); + + for (IntHashMapEntry var3 = this.slots[getSlotIndex(var2, this.slots.length)]; var3 != null; var3 = var3.nextEntry) + { + if (var3.hashEntry == par1) + { + return var3.valueEntry; + } + } + + return null; + } + + /** + * Return true if an object is associated with the given key + */ + public boolean containsItem(int par1) + { + return this.lookupEntry(par1) != null; + } + + /** + * Returns the key/object mapping for a given key as a MCHashEntry + */ + final IntHashMapEntry lookupEntry(int par1) + { + int var2 = computeHash(par1); + + for (IntHashMapEntry var3 = this.slots[getSlotIndex(var2, this.slots.length)]; var3 != null; var3 = var3.nextEntry) + { + if (var3.hashEntry == par1) + { + return var3; + } + } + + return null; + } + + /** + * Adds a key and associated value to this map + */ + public void addKey(int par1, Object par2Obj) + { + this.keySet.add(Integer.valueOf(par1)); + int var3 = computeHash(par1); + int var4 = getSlotIndex(var3, this.slots.length); + + for (IntHashMapEntry var5 = this.slots[var4]; var5 != null; var5 = var5.nextEntry) + { + if (var5.hashEntry == par1) + { + var5.valueEntry = par2Obj; + return; + } + } + + ++this.versionStamp; + this.insert(var3, par1, par2Obj, var4); + } + + /** + * Increases the number of hash slots + */ + private void grow(int par1) + { + IntHashMapEntry[] var2 = this.slots; + int var3 = var2.length; + + if (var3 == 1073741824) + { + this.threshold = Integer.MAX_VALUE; + } + else + { + IntHashMapEntry[] var4 = new IntHashMapEntry[par1]; + this.copyTo(var4); + this.slots = var4; + this.threshold = (int)((float)par1 * this.growFactor); + } + } + + /** + * Copies the hash slots to a new array + */ + private void copyTo(IntHashMapEntry[] par1ArrayOfIntHashMapEntry) + { + IntHashMapEntry[] var2 = this.slots; + int var3 = par1ArrayOfIntHashMapEntry.length; + + for (int var4 = 0; var4 < var2.length; ++var4) + { + IntHashMapEntry var5 = var2[var4]; + + if (var5 != null) + { + var2[var4] = null; + IntHashMapEntry var6; + + do + { + var6 = var5.nextEntry; + int var7 = getSlotIndex(var5.slotHash, var3); + var5.nextEntry = par1ArrayOfIntHashMapEntry[var7]; + par1ArrayOfIntHashMapEntry[var7] = var5; + var5 = var6; + } + while (var6 != null); + } + } + } + + /** + * Removes the specified object from the map and returns it + */ + public Object removeObject(int par1) + { + this.keySet.remove(Integer.valueOf(par1)); + IntHashMapEntry var2 = this.removeEntry(par1); + return var2 == null ? null : var2.valueEntry; + } + + /** + * Removes the specified entry from the map and returns it + */ + final IntHashMapEntry removeEntry(int par1) + { + int var2 = computeHash(par1); + int var3 = getSlotIndex(var2, this.slots.length); + IntHashMapEntry var4 = this.slots[var3]; + IntHashMapEntry var5; + IntHashMapEntry var6; + + for (var5 = var4; var5 != null; var5 = var6) + { + var6 = var5.nextEntry; + + if (var5.hashEntry == par1) + { + ++this.versionStamp; + --this.count; + + if (var4 == var5) + { + this.slots[var3] = var6; + } + else + { + var4.nextEntry = var6; + } + + return var5; + } + + var4 = var5; + } + + return var5; + } + + /** + * Removes all entries from the map + */ + public void clearMap() + { + ++this.versionStamp; + IntHashMapEntry[] var1 = this.slots; + + for (int var2 = 0; var2 < var1.length; ++var2) + { + var1[var2] = null; + } + + this.count = 0; + } + + /** + * Adds an object to a slot + */ + private void insert(int par1, int par2, Object par3Obj, int par4) + { + IntHashMapEntry var5 = this.slots[par4]; + this.slots[par4] = new IntHashMapEntry(par1, par2, par3Obj, var5); + + if (this.count++ >= this.threshold) + { + this.grow(2 * this.slots.length); + } + } + + /** + * Returns the hash code for a key + */ + static int getHash(int par0) + { + return computeHash(par0); + } +} diff --git a/src/main/java/net/minecraft/src/IntHashMapEntry.java b/src/main/java/net/minecraft/src/IntHashMapEntry.java new file mode 100644 index 0000000..30c75f6 --- /dev/null +++ b/src/main/java/net/minecraft/src/IntHashMapEntry.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +class IntHashMapEntry +{ + /** The hash code of this entry */ + final int hashEntry; + + /** The object stored in this entry */ + Object valueEntry; + + /** The next entry in this slot */ + IntHashMapEntry nextEntry; + + /** The id of the hash slot computed from the hash */ + final int slotHash; + + IntHashMapEntry(int par1, int par2, Object par3Obj, IntHashMapEntry par4IntHashMapEntry) + { + this.valueEntry = par3Obj; + this.nextEntry = par4IntHashMapEntry; + this.hashEntry = par2; + this.slotHash = par1; + } + + /** + * Returns the hash code for this entry + */ + public final int getHash() + { + return this.hashEntry; + } + + /** + * Returns the object stored in this entry + */ + public final Object getValue() + { + return this.valueEntry; + } + + public final boolean equals(Object par1Obj) + { + if (!(par1Obj instanceof IntHashMapEntry)) + { + return false; + } + else + { + IntHashMapEntry var2 = (IntHashMapEntry)par1Obj; + Integer var3 = Integer.valueOf(this.getHash()); + Integer var4 = Integer.valueOf(var2.getHash()); + + if (var3 == var4 || var3 != null && var3.equals(var4)) + { + Object var5 = this.getValue(); + Object var6 = var2.getValue(); + + if (var5 == var6 || var5 != null && var5.equals(var6)) + { + return true; + } + } + + return false; + } + } + + public final int hashCode() + { + return IntHashMap.getHash(this.hashEntry); + } + + public final String toString() + { + return this.getHash() + "=" + this.getValue(); + } +} diff --git a/src/main/java/net/minecraft/src/IntegratedPlayerList.java b/src/main/java/net/minecraft/src/IntegratedPlayerList.java new file mode 100644 index 0000000..6c51c5a --- /dev/null +++ b/src/main/java/net/minecraft/src/IntegratedPlayerList.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +import java.net.SocketAddress; +import net.minecraft.server.MinecraftServer; + +public class IntegratedPlayerList extends ServerConfigurationManager +{ + /** + * Holds the NBT data for the host player's save file, so this can be written to level.dat. + */ + private NBTTagCompound hostPlayerData; + + public IntegratedPlayerList(IntegratedServer par1IntegratedServer) + { + super(par1IntegratedServer); + this.viewDistance = 10; + } + + /** + * also stores the NBTTags if this is an intergratedPlayerList + */ + protected void writePlayerData(EntityPlayerMP par1EntityPlayerMP) + { + if (par1EntityPlayerMP.getCommandSenderName().equals(this.getIntegratedServer().getServerOwner())) + { + this.hostPlayerData = new NBTTagCompound(); + par1EntityPlayerMP.writeToNBT(this.hostPlayerData); + } + + super.writePlayerData(par1EntityPlayerMP); + } + + /** + * checks ban-lists, then white-lists, then space for the server. Returns null on success, or an error message + */ + public String allowUserToConnect(SocketAddress par1SocketAddress, String par2Str) + { + return par2Str.equalsIgnoreCase(this.getIntegratedServer().getServerOwner()) ? "That name is already taken." : super.allowUserToConnect(par1SocketAddress, par2Str); + } + + /** + * get the associated Integrated Server + */ + public IntegratedServer getIntegratedServer() + { + return (IntegratedServer)super.getServerInstance(); + } + + /** + * On integrated servers, returns the host's player data to be written to level.dat. + */ + public NBTTagCompound getHostPlayerData() + { + return this.hostPlayerData; + } + + public MinecraftServer getServerInstance() + { + return this.getIntegratedServer(); + } +} diff --git a/src/main/java/net/minecraft/src/IntegratedServer.java b/src/main/java/net/minecraft/src/IntegratedServer.java new file mode 100644 index 0000000..4f9e342 --- /dev/null +++ b/src/main/java/net/minecraft/src/IntegratedServer.java @@ -0,0 +1,294 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.IOException; +import net.minecraft.server.MinecraftServer; + +public class IntegratedServer extends MinecraftServer +{ + /** The Minecraft instance. */ + private final Minecraft mc; + private final WorldSettings theWorldSettings; + private final ILogAgent serverLogAgent; + + /** Instance of IntegratedServerListenThread. */ + private IntegratedServerListenThread theServerListeningThread; + private boolean isGamePaused; + private boolean isPublic; + private ThreadLanServerPing lanServerPing; + + public IntegratedServer(Minecraft par1Minecraft, String par2Str, String par3Str, WorldSettings par4WorldSettings) + { + super(new File(par1Minecraft.mcDataDir, "saves")); + this.serverLogAgent = new LogAgent("Minecraft-Server", " [SERVER]", (new File(par1Minecraft.mcDataDir, "output-server.log")).getAbsolutePath()); + this.setServerOwner(par1Minecraft.getSession().getUsername()); + this.setFolderName(par2Str); + this.setWorldName(par3Str); + this.setDemo(par1Minecraft.isDemo()); + this.canCreateBonusChest(par4WorldSettings.isBonusChestEnabled()); + this.setBuildLimit(256); + this.setConfigurationManager(new IntegratedPlayerList(this)); + this.mc = par1Minecraft; + this.serverProxy = par1Minecraft.getProxy(); + this.theWorldSettings = par4WorldSettings; + + try + { + this.theServerListeningThread = new IntegratedServerListenThread(this); + } + catch (IOException var6) + { + throw new Error(); + } + } + + protected void loadAllWorlds(String par1Str, String par2Str, long par3, WorldType par5WorldType, String par6Str) + { + this.convertMapIfNeeded(par1Str); + this.worldServers = new WorldServer[3]; + this.timeOfLastDimensionTick = new long[this.worldServers.length][100]; + ISaveHandler var7 = this.getActiveAnvilConverter().getSaveLoader(par1Str, true); + + for (int var8 = 0; var8 < this.worldServers.length; ++var8) + { + byte var9 = 0; + + if (var8 == 1) + { + var9 = -1; + } + + if (var8 == 2) + { + var9 = 1; + } + + if (var8 == 0) + { + if (this.isDemo()) + { + this.worldServers[var8] = new DemoWorldServer(this, var7, par2Str, var9, this.theProfiler, this.getLogAgent()); + } + else + { + this.worldServers[var8] = new WorldServer(this, var7, par2Str, var9, this.theWorldSettings, this.theProfiler, this.getLogAgent()); + } + } + else + { + this.worldServers[var8] = new WorldServerMulti(this, var7, par2Str, var9, this.theWorldSettings, this.worldServers[0], this.theProfiler, this.getLogAgent()); + } + + this.worldServers[var8].addWorldAccess(new WorldManager(this, this.worldServers[var8])); + this.getConfigurationManager().setPlayerManager(this.worldServers); + } + + this.setDifficultyForAllWorlds(this.getDifficulty()); + this.initialWorldChunkLoad(); + } + + /** + * Initialises the server and starts it. + */ + protected boolean startServer() throws IOException + { + this.serverLogAgent.logInfo("Starting integrated minecraft server version 1.6.4"); + this.setOnlineMode(false); + this.setCanSpawnAnimals(true); + this.setCanSpawnNPCs(true); + this.setAllowPvp(true); + this.setAllowFlight(true); + this.serverLogAgent.logInfo("Generating keypair"); + this.setKeyPair(CryptManager.createNewKeyPair()); + this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.theWorldSettings.getSeed(), this.theWorldSettings.getTerrainType(), this.theWorldSettings.func_82749_j()); + this.setMOTD(this.getServerOwner() + " - " + this.worldServers[0].getWorldInfo().getWorldName()); + return true; + } + + /** + * Main function called by run() every loop. + */ + public void tick() + { + boolean var1 = this.isGamePaused; + this.isGamePaused = this.theServerListeningThread.isGamePaused(); + + if (!var1 && this.isGamePaused) + { + this.serverLogAgent.logInfo("Saving and pausing game..."); + this.getConfigurationManager().saveAllPlayerData(); + this.saveAllWorlds(false); + } + + if (!this.isGamePaused) + { + super.tick(); + } + } + + public boolean canStructuresSpawn() + { + return false; + } + + public EnumGameType getGameType() + { + return this.theWorldSettings.getGameType(); + } + + /** + * Defaults to "1" (Easy) for the dedicated server, defaults to "2" (Normal) on the client. + */ + public int getDifficulty() + { + return this.mc.gameSettings.difficulty; + } + + /** + * Defaults to false. + */ + public boolean isHardcore() + { + return this.theWorldSettings.getHardcoreEnabled(); + } + + protected File getDataDirectory() + { + return this.mc.mcDataDir; + } + + public boolean isDedicatedServer() + { + return false; + } + + /** + * Gets the IntergratedServerListenThread. + */ + public IntegratedServerListenThread getServerListeningThread() + { + return this.theServerListeningThread; + } + + /** + * Called on exit from the main run() loop. + */ + protected void finalTick(CrashReport par1CrashReport) + { + this.mc.crashed(par1CrashReport); + } + + /** + * Adds the server info, including from theWorldServer, to the crash report. + */ + public CrashReport addServerInfoToCrashReport(CrashReport par1CrashReport) + { + par1CrashReport = super.addServerInfoToCrashReport(par1CrashReport); + par1CrashReport.getCategory().addCrashSectionCallable("Type", new CallableType3(this)); + par1CrashReport.getCategory().addCrashSectionCallable("Is Modded", new CallableIsModded(this)); + return par1CrashReport; + } + + public void addServerStatsToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper) + { + super.addServerStatsToSnooper(par1PlayerUsageSnooper); + par1PlayerUsageSnooper.addData("snooper_partner", this.mc.getPlayerUsageSnooper().getUniqueID()); + } + + /** + * Returns whether snooping is enabled or not. + */ + public boolean isSnooperEnabled() + { + return Minecraft.getMinecraft().isSnooperEnabled(); + } + + /** + * On dedicated does nothing. On integrated, sets commandsAllowedForAll, gameType and allows external connections. + */ + public String shareToLAN(EnumGameType par1EnumGameType, boolean par2) + { + try + { + String var3 = this.theServerListeningThread.func_71755_c(); + this.getLogAgent().logInfo("Started on " + var3); + this.isPublic = true; + this.lanServerPing = new ThreadLanServerPing(this.getMOTD(), var3); + this.lanServerPing.start(); + this.getConfigurationManager().setGameType(par1EnumGameType); + this.getConfigurationManager().setCommandsAllowedForAll(par2); + return var3; + } + catch (IOException var4) + { + return null; + } + } + + public ILogAgent getLogAgent() + { + return this.serverLogAgent; + } + + /** + * Saves all necessary data as preparation for stopping the server. + */ + public void stopServer() + { + super.stopServer(); + + if (this.lanServerPing != null) + { + this.lanServerPing.interrupt(); + this.lanServerPing = null; + } + } + + /** + * Sets the serverRunning variable to false, in order to get the server to shut down. + */ + public void initiateShutdown() + { + super.initiateShutdown(); + + if (this.lanServerPing != null) + { + this.lanServerPing.interrupt(); + this.lanServerPing = null; + } + } + + /** + * Returns true if this integrated server is open to LAN + */ + public boolean getPublic() + { + return this.isPublic; + } + + /** + * Sets the game type for all worlds. + */ + public void setGameType(EnumGameType par1EnumGameType) + { + this.getConfigurationManager().setGameType(par1EnumGameType); + } + + /** + * Return whether command blocks are enabled. + */ + public boolean isCommandBlockEnabled() + { + return true; + } + + public int func_110455_j() + { + return 4; + } + + public NetworkListenThread getNetworkThread() + { + return this.getServerListeningThread(); + } +} diff --git a/src/main/java/net/minecraft/src/IntegratedServerListenThread.java b/src/main/java/net/minecraft/src/IntegratedServerListenThread.java new file mode 100644 index 0000000..f5a8abe --- /dev/null +++ b/src/main/java/net/minecraft/src/IntegratedServerListenThread.java @@ -0,0 +1,119 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.net.InetAddress; +import net.minecraft.server.MinecraftServer; + +public class IntegratedServerListenThread extends NetworkListenThread +{ + private final MemoryConnection netMemoryConnection; + private MemoryConnection theMemoryConnection; + private String field_71759_e; + private boolean field_71756_f; + private ServerListenThread myServerListenThread; + + public IntegratedServerListenThread(IntegratedServer par1IntegratedServer) throws IOException + { + super(par1IntegratedServer); + this.netMemoryConnection = new MemoryConnection(par1IntegratedServer.getLogAgent(), (NetHandler)null); + } + + public void func_71754_a(MemoryConnection par1MemoryConnection, String par2Str) + { + this.theMemoryConnection = par1MemoryConnection; + this.field_71759_e = par2Str; + } + + public String func_71755_c() throws IOException + { + if (this.myServerListenThread == null) + { + int var1 = -1; + + try + { + var1 = HttpUtil.func_76181_a(); + } + catch (IOException var4) + { + ; + } + + if (var1 <= 0) + { + var1 = 25564; + } + + try + { + this.myServerListenThread = new ServerListenThread(this, (InetAddress)null, var1); + this.myServerListenThread.start(); + } + catch (IOException var3) + { + throw var3; + } + } + + return String.valueOf(this.myServerListenThread.getMyPort()); + } + + public void stopListening() + { + super.stopListening(); + + if (this.myServerListenThread != null) + { + this.getIntegratedServer().getLogAgent().logInfo("Stopping server connection"); + this.myServerListenThread.func_71768_b(); + this.myServerListenThread.interrupt(); + this.myServerListenThread = null; + } + } + + /** + * processes packets and pending connections + */ + public void networkTick() + { + if (this.theMemoryConnection != null) + { + EntityPlayerMP var1 = this.getIntegratedServer().getConfigurationManager().createPlayerForUser(this.field_71759_e); + + if (var1 != null) + { + this.netMemoryConnection.pairWith(this.theMemoryConnection); + this.field_71756_f = true; + this.getIntegratedServer().getConfigurationManager().initializeConnectionToPlayer(this.netMemoryConnection, var1); + } + + this.theMemoryConnection = null; + this.field_71759_e = null; + } + + if (this.myServerListenThread != null) + { + this.myServerListenThread.processPendingConnections(); + } + + super.networkTick(); + } + + /** + * Gets MinecraftServer instance. + */ + public IntegratedServer getIntegratedServer() + { + return (IntegratedServer)super.getServer(); + } + + public boolean isGamePaused() + { + return this.field_71756_f && this.netMemoryConnection.getPairedConnection().isConnectionActive() && this.netMemoryConnection.getPairedConnection().isGamePaused(); + } + + public MinecraftServer getServer() + { + return this.getIntegratedServer(); + } +} diff --git a/src/main/java/net/minecraft/src/InventoryBasic.java b/src/main/java/net/minecraft/src/InventoryBasic.java new file mode 100644 index 0000000..f6900cf --- /dev/null +++ b/src/main/java/net/minecraft/src/InventoryBasic.java @@ -0,0 +1,187 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class InventoryBasic implements IInventory +{ + private String inventoryTitle; + private int slotsCount; + private ItemStack[] inventoryContents; + private List field_70480_d; + private boolean field_94051_e; + + public InventoryBasic(String par1Str, boolean par2, int par3) + { + this.inventoryTitle = par1Str; + this.field_94051_e = par2; + this.slotsCount = par3; + this.inventoryContents = new ItemStack[par3]; + } + + public void func_110134_a(IInvBasic par1IInvBasic) + { + if (this.field_70480_d == null) + { + this.field_70480_d = new ArrayList(); + } + + this.field_70480_d.add(par1IInvBasic); + } + + public void func_110132_b(IInvBasic par1IInvBasic) + { + this.field_70480_d.remove(par1IInvBasic); + } + + /** + * Returns the stack in slot i + */ + public ItemStack getStackInSlot(int par1) + { + return this.inventoryContents[par1]; + } + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + public ItemStack decrStackSize(int par1, int par2) + { + if (this.inventoryContents[par1] != null) + { + ItemStack var3; + + if (this.inventoryContents[par1].stackSize <= par2) + { + var3 = this.inventoryContents[par1]; + this.inventoryContents[par1] = null; + this.onInventoryChanged(); + return var3; + } + else + { + var3 = this.inventoryContents[par1].splitStack(par2); + + if (this.inventoryContents[par1].stackSize == 0) + { + this.inventoryContents[par1] = null; + } + + this.onInventoryChanged(); + return var3; + } + } + else + { + return null; + } + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + public ItemStack getStackInSlotOnClosing(int par1) + { + if (this.inventoryContents[par1] != null) + { + ItemStack var2 = this.inventoryContents[par1]; + this.inventoryContents[par1] = null; + return var2; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) + { + this.inventoryContents[par1] = par2ItemStack; + + if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) + { + par2ItemStack.stackSize = this.getInventoryStackLimit(); + } + + this.onInventoryChanged(); + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.slotsCount; + } + + /** + * Returns the name of the inventory. + */ + public String getInvName() + { + return this.inventoryTitle; + } + + /** + * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's + * language. Otherwise it will be used directly. + */ + public boolean isInvNameLocalized() + { + return this.field_94051_e; + } + + public void func_110133_a(String par1Str) + { + this.field_94051_e = true; + this.inventoryTitle = par1Str; + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't + * this more of a set than a get?* + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Called when an the contents of an Inventory change, usually + */ + public void onInventoryChanged() + { + if (this.field_70480_d != null) + { + for (int var1 = 0; var1 < this.field_70480_d.size(); ++var1) + { + ((IInvBasic)this.field_70480_d.get(var1)).onInventoryChanged(this); + } + } + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + { + return true; + } + + public void openChest() {} + + public void closeChest() {} + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/InventoryCraftResult.java b/src/main/java/net/minecraft/src/InventoryCraftResult.java new file mode 100644 index 0000000..2ef405a --- /dev/null +++ b/src/main/java/net/minecraft/src/InventoryCraftResult.java @@ -0,0 +1,118 @@ +package net.minecraft.src; + +public class InventoryCraftResult implements IInventory +{ + /** A list of one item containing the result of the crafting formula */ + private ItemStack[] stackResult = new ItemStack[1]; + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return 1; + } + + /** + * Returns the stack in slot i + */ + public ItemStack getStackInSlot(int par1) + { + return this.stackResult[0]; + } + + /** + * Returns the name of the inventory. + */ + public String getInvName() + { + return "Result"; + } + + /** + * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's + * language. Otherwise it will be used directly. + */ + public boolean isInvNameLocalized() + { + return false; + } + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + public ItemStack decrStackSize(int par1, int par2) + { + if (this.stackResult[0] != null) + { + ItemStack var3 = this.stackResult[0]; + this.stackResult[0] = null; + return var3; + } + else + { + return null; + } + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + public ItemStack getStackInSlotOnClosing(int par1) + { + if (this.stackResult[0] != null) + { + ItemStack var2 = this.stackResult[0]; + this.stackResult[0] = null; + return var2; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) + { + this.stackResult[0] = par2ItemStack; + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't + * this more of a set than a get?* + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Called when an the contents of an Inventory change, usually + */ + public void onInventoryChanged() {} + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + { + return true; + } + + public void openChest() {} + + public void closeChest() {} + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/InventoryCrafting.java b/src/main/java/net/minecraft/src/InventoryCrafting.java new file mode 100644 index 0000000..020d041 --- /dev/null +++ b/src/main/java/net/minecraft/src/InventoryCrafting.java @@ -0,0 +1,169 @@ +package net.minecraft.src; + +public class InventoryCrafting implements IInventory +{ + /** List of the stacks in the crafting matrix. */ + private ItemStack[] stackList; + + /** the width of the crafting inventory */ + private int inventoryWidth; + + /** + * Class containing the callbacks for the events on_GUIClosed and on_CraftMaxtrixChanged. + */ + private Container eventHandler; + + public InventoryCrafting(Container par1Container, int par2, int par3) + { + int var4 = par2 * par3; + this.stackList = new ItemStack[var4]; + this.eventHandler = par1Container; + this.inventoryWidth = par2; + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.stackList.length; + } + + /** + * Returns the stack in slot i + */ + public ItemStack getStackInSlot(int par1) + { + return par1 >= this.getSizeInventory() ? null : this.stackList[par1]; + } + + /** + * Returns the itemstack in the slot specified (Top left is 0, 0). Args: row, column + */ + public ItemStack getStackInRowAndColumn(int par1, int par2) + { + if (par1 >= 0 && par1 < this.inventoryWidth) + { + int var3 = par1 + par2 * this.inventoryWidth; + return this.getStackInSlot(var3); + } + else + { + return null; + } + } + + /** + * Returns the name of the inventory. + */ + public String getInvName() + { + return "container.crafting"; + } + + /** + * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's + * language. Otherwise it will be used directly. + */ + public boolean isInvNameLocalized() + { + return false; + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + public ItemStack getStackInSlotOnClosing(int par1) + { + if (this.stackList[par1] != null) + { + ItemStack var2 = this.stackList[par1]; + this.stackList[par1] = null; + return var2; + } + else + { + return null; + } + } + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + public ItemStack decrStackSize(int par1, int par2) + { + if (this.stackList[par1] != null) + { + ItemStack var3; + + if (this.stackList[par1].stackSize <= par2) + { + var3 = this.stackList[par1]; + this.stackList[par1] = null; + this.eventHandler.onCraftMatrixChanged(this); + return var3; + } + else + { + var3 = this.stackList[par1].splitStack(par2); + + if (this.stackList[par1].stackSize == 0) + { + this.stackList[par1] = null; + } + + this.eventHandler.onCraftMatrixChanged(this); + return var3; + } + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) + { + this.stackList[par1] = par2ItemStack; + this.eventHandler.onCraftMatrixChanged(this); + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't + * this more of a set than a get?* + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Called when an the contents of an Inventory change, usually + */ + public void onInventoryChanged() {} + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + { + return true; + } + + public void openChest() {} + + public void closeChest() {} + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/InventoryEffectRenderer.java b/src/main/java/net/minecraft/src/InventoryEffectRenderer.java new file mode 100644 index 0000000..283ff3d --- /dev/null +++ b/src/main/java/net/minecraft/src/InventoryEffectRenderer.java @@ -0,0 +1,99 @@ +package net.minecraft.src; + +import java.util.Collection; +import java.util.Iterator; +import org.lwjgl.opengl.GL11; + +public abstract class InventoryEffectRenderer extends GuiContainer +{ + private boolean field_74222_o; + + public InventoryEffectRenderer(Container par1Container) + { + super(par1Container); + } + + /** + * Adds the buttons (and other controls) to the screen in question. + */ + public void initGui() + { + super.initGui(); + + if (!this.mc.thePlayer.getActivePotionEffects().isEmpty()) + { + this.guiLeft = 160 + (this.width - this.xSize - 200) / 2; + this.field_74222_o = true; + } + } + + /** + * Draws the screen and all the components in it. + */ + public void drawScreen(int par1, int par2, float par3) + { + super.drawScreen(par1, par2, par3); + + if (this.field_74222_o) + { + this.displayDebuffEffects(); + } + } + + /** + * Displays debuff/potion effects that are currently being applied to the player + */ + private void displayDebuffEffects() + { + int var1 = this.guiLeft - 124; + int var2 = this.guiTop; + boolean var3 = true; + Collection var4 = this.mc.thePlayer.getActivePotionEffects(); + + if (!var4.isEmpty()) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + int var5 = 33; + + if (var4.size() > 5) + { + var5 = 132 / (var4.size() - 1); + } + + for (Iterator var6 = this.mc.thePlayer.getActivePotionEffects().iterator(); var6.hasNext(); var2 += var5) + { + PotionEffect var7 = (PotionEffect)var6.next(); + Potion var8 = Potion.potionTypes[var7.getPotionID()]; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(field_110408_a); + this.drawTexturedModalRect(var1, var2, 0, 166, 140, 32); + + if (var8.hasStatusIcon()) + { + int var9 = var8.getStatusIconIndex(); + this.drawTexturedModalRect(var1 + 6, var2 + 7, 0 + var9 % 8 * 18, 198 + var9 / 8 * 18, 18, 18); + } + + String var11 = I18n.getString(var8.getName()); + + if (var7.getAmplifier() == 1) + { + var11 = var11 + " II"; + } + else if (var7.getAmplifier() == 2) + { + var11 = var11 + " III"; + } + else if (var7.getAmplifier() == 3) + { + var11 = var11 + " IV"; + } + + this.fontRenderer.drawStringWithShadow(var11, var1 + 10 + 18, var2 + 6, 16777215); + String var10 = Potion.getDurationString(var7); + this.fontRenderer.drawStringWithShadow(var10, var1 + 10 + 18, var2 + 6 + 10, 8355711); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/InventoryEnderChest.java b/src/main/java/net/minecraft/src/InventoryEnderChest.java new file mode 100644 index 0000000..9d2c2f2 --- /dev/null +++ b/src/main/java/net/minecraft/src/InventoryEnderChest.java @@ -0,0 +1,94 @@ +package net.minecraft.src; + +public class InventoryEnderChest extends InventoryBasic +{ + private TileEntityEnderChest associatedChest; + + public InventoryEnderChest() + { + super("container.enderchest", false, 27); + } + + public void setAssociatedChest(TileEntityEnderChest par1TileEntityEnderChest) + { + this.associatedChest = par1TileEntityEnderChest; + } + + public void loadInventoryFromNBT(NBTTagList par1NBTTagList) + { + int var2; + + for (var2 = 0; var2 < this.getSizeInventory(); ++var2) + { + this.setInventorySlotContents(var2, (ItemStack)null); + } + + for (var2 = 0; var2 < par1NBTTagList.tagCount(); ++var2) + { + NBTTagCompound var3 = (NBTTagCompound)par1NBTTagList.tagAt(var2); + int var4 = var3.getByte("Slot") & 255; + + if (var4 >= 0 && var4 < this.getSizeInventory()) + { + this.setInventorySlotContents(var4, ItemStack.loadItemStackFromNBT(var3)); + } + } + } + + public NBTTagList saveInventoryToNBT() + { + NBTTagList var1 = new NBTTagList("EnderItems"); + + for (int var2 = 0; var2 < this.getSizeInventory(); ++var2) + { + ItemStack var3 = this.getStackInSlot(var2); + + if (var3 != null) + { + NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("Slot", (byte)var2); + var3.writeToNBT(var4); + var1.appendTag(var4); + } + } + + return var1; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + { + return this.associatedChest != null && !this.associatedChest.isUseableByPlayer(par1EntityPlayer) ? false : super.isUseableByPlayer(par1EntityPlayer); + } + + public void openChest() + { + if (this.associatedChest != null) + { + this.associatedChest.openChest(); + } + + super.openChest(); + } + + public void closeChest() + { + if (this.associatedChest != null) + { + this.associatedChest.closeChest(); + } + + super.closeChest(); + this.associatedChest = null; + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/InventoryLargeChest.java b/src/main/java/net/minecraft/src/InventoryLargeChest.java new file mode 100644 index 0000000..c7033a8 --- /dev/null +++ b/src/main/java/net/minecraft/src/InventoryLargeChest.java @@ -0,0 +1,151 @@ +package net.minecraft.src; + +public class InventoryLargeChest implements IInventory +{ + /** Name of the chest. */ + private String name; + + /** Inventory object corresponding to double chest upper part */ + private IInventory upperChest; + + /** Inventory object corresponding to double chest lower part */ + private IInventory lowerChest; + + public InventoryLargeChest(String par1Str, IInventory par2IInventory, IInventory par3IInventory) + { + this.name = par1Str; + + if (par2IInventory == null) + { + par2IInventory = par3IInventory; + } + + if (par3IInventory == null) + { + par3IInventory = par2IInventory; + } + + this.upperChest = par2IInventory; + this.lowerChest = par3IInventory; + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.upperChest.getSizeInventory() + this.lowerChest.getSizeInventory(); + } + + /** + * Return whether the given inventory is part of this large chest. + */ + public boolean isPartOfLargeChest(IInventory par1IInventory) + { + return this.upperChest == par1IInventory || this.lowerChest == par1IInventory; + } + + /** + * Returns the name of the inventory. + */ + public String getInvName() + { + return this.upperChest.isInvNameLocalized() ? this.upperChest.getInvName() : (this.lowerChest.isInvNameLocalized() ? this.lowerChest.getInvName() : this.name); + } + + /** + * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's + * language. Otherwise it will be used directly. + */ + public boolean isInvNameLocalized() + { + return this.upperChest.isInvNameLocalized() || this.lowerChest.isInvNameLocalized(); + } + + /** + * Returns the stack in slot i + */ + public ItemStack getStackInSlot(int par1) + { + return par1 >= this.upperChest.getSizeInventory() ? this.lowerChest.getStackInSlot(par1 - this.upperChest.getSizeInventory()) : this.upperChest.getStackInSlot(par1); + } + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + public ItemStack decrStackSize(int par1, int par2) + { + return par1 >= this.upperChest.getSizeInventory() ? this.lowerChest.decrStackSize(par1 - this.upperChest.getSizeInventory(), par2) : this.upperChest.decrStackSize(par1, par2); + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + public ItemStack getStackInSlotOnClosing(int par1) + { + return par1 >= this.upperChest.getSizeInventory() ? this.lowerChest.getStackInSlotOnClosing(par1 - this.upperChest.getSizeInventory()) : this.upperChest.getStackInSlotOnClosing(par1); + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) + { + if (par1 >= this.upperChest.getSizeInventory()) + { + this.lowerChest.setInventorySlotContents(par1 - this.upperChest.getSizeInventory(), par2ItemStack); + } + else + { + this.upperChest.setInventorySlotContents(par1, par2ItemStack); + } + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't + * this more of a set than a get?* + */ + public int getInventoryStackLimit() + { + return this.upperChest.getInventoryStackLimit(); + } + + /** + * Called when an the contents of an Inventory change, usually + */ + public void onInventoryChanged() + { + this.upperChest.onInventoryChanged(); + this.lowerChest.onInventoryChanged(); + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + { + return this.upperChest.isUseableByPlayer(par1EntityPlayer) && this.lowerChest.isUseableByPlayer(par1EntityPlayer); + } + + public void openChest() + { + this.upperChest.openChest(); + this.lowerChest.openChest(); + } + + public void closeChest() + { + this.upperChest.closeChest(); + this.lowerChest.closeChest(); + } + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/InventoryMerchant.java b/src/main/java/net/minecraft/src/InventoryMerchant.java new file mode 100644 index 0000000..2f1dd51 --- /dev/null +++ b/src/main/java/net/minecraft/src/InventoryMerchant.java @@ -0,0 +1,245 @@ +package net.minecraft.src; + +public class InventoryMerchant implements IInventory +{ + private final IMerchant theMerchant; + private ItemStack[] theInventory = new ItemStack[3]; + private final EntityPlayer thePlayer; + private MerchantRecipe currentRecipe; + private int currentRecipeIndex; + + public InventoryMerchant(EntityPlayer par1EntityPlayer, IMerchant par2IMerchant) + { + this.thePlayer = par1EntityPlayer; + this.theMerchant = par2IMerchant; + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.theInventory.length; + } + + /** + * Returns the stack in slot i + */ + public ItemStack getStackInSlot(int par1) + { + return this.theInventory[par1]; + } + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + public ItemStack decrStackSize(int par1, int par2) + { + if (this.theInventory[par1] != null) + { + ItemStack var3; + + if (par1 == 2) + { + var3 = this.theInventory[par1]; + this.theInventory[par1] = null; + return var3; + } + else if (this.theInventory[par1].stackSize <= par2) + { + var3 = this.theInventory[par1]; + this.theInventory[par1] = null; + + if (this.inventoryResetNeededOnSlotChange(par1)) + { + this.resetRecipeAndSlots(); + } + + return var3; + } + else + { + var3 = this.theInventory[par1].splitStack(par2); + + if (this.theInventory[par1].stackSize == 0) + { + this.theInventory[par1] = null; + } + + if (this.inventoryResetNeededOnSlotChange(par1)) + { + this.resetRecipeAndSlots(); + } + + return var3; + } + } + else + { + return null; + } + } + + /** + * if par1 slot has changed, does resetRecipeAndSlots need to be called? + */ + private boolean inventoryResetNeededOnSlotChange(int par1) + { + return par1 == 0 || par1 == 1; + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + public ItemStack getStackInSlotOnClosing(int par1) + { + if (this.theInventory[par1] != null) + { + ItemStack var2 = this.theInventory[par1]; + this.theInventory[par1] = null; + return var2; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) + { + this.theInventory[par1] = par2ItemStack; + + if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) + { + par2ItemStack.stackSize = this.getInventoryStackLimit(); + } + + if (this.inventoryResetNeededOnSlotChange(par1)) + { + this.resetRecipeAndSlots(); + } + } + + /** + * Returns the name of the inventory. + */ + public String getInvName() + { + return "mob.villager"; + } + + /** + * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's + * language. Otherwise it will be used directly. + */ + public boolean isInvNameLocalized() + { + return false; + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't + * this more of a set than a get?* + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + { + return this.theMerchant.getCustomer() == par1EntityPlayer; + } + + public void openChest() {} + + public void closeChest() {} + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) + { + return true; + } + + /** + * Called when an the contents of an Inventory change, usually + */ + public void onInventoryChanged() + { + this.resetRecipeAndSlots(); + } + + public void resetRecipeAndSlots() + { + this.currentRecipe = null; + ItemStack var1 = this.theInventory[0]; + ItemStack var2 = this.theInventory[1]; + + if (var1 == null) + { + var1 = var2; + var2 = null; + } + + if (var1 == null) + { + this.setInventorySlotContents(2, (ItemStack)null); + } + else + { + MerchantRecipeList var3 = this.theMerchant.getRecipes(this.thePlayer); + + if (var3 != null) + { + MerchantRecipe var4 = var3.canRecipeBeUsed(var1, var2, this.currentRecipeIndex); + + if (var4 != null && !var4.func_82784_g()) + { + this.currentRecipe = var4; + this.setInventorySlotContents(2, var4.getItemToSell().copy()); + } + else if (var2 != null) + { + var4 = var3.canRecipeBeUsed(var2, var1, this.currentRecipeIndex); + + if (var4 != null && !var4.func_82784_g()) + { + this.currentRecipe = var4; + this.setInventorySlotContents(2, var4.getItemToSell().copy()); + } + else + { + this.setInventorySlotContents(2, (ItemStack)null); + } + } + else + { + this.setInventorySlotContents(2, (ItemStack)null); + } + } + } + + this.theMerchant.func_110297_a_(this.getStackInSlot(2)); + } + + public MerchantRecipe getCurrentRecipe() + { + return this.currentRecipe; + } + + public void setCurrentRecipeIndex(int par1) + { + this.currentRecipeIndex = par1; + this.resetRecipeAndSlots(); + } +} diff --git a/src/main/java/net/minecraft/src/InventoryPlayer.java b/src/main/java/net/minecraft/src/InventoryPlayer.java new file mode 100644 index 0000000..b0bda69 --- /dev/null +++ b/src/main/java/net/minecraft/src/InventoryPlayer.java @@ -0,0 +1,837 @@ +package net.minecraft.src; + +public class InventoryPlayer implements IInventory +{ + /** + * An array of 36 item stacks indicating the main player inventory (including the visible bar). + */ + public ItemStack[] mainInventory = new ItemStack[36]; + + /** An array of 4 item stacks containing the currently worn armor pieces. */ + public ItemStack[] armorInventory = new ItemStack[4]; + + /** The index of the currently held item (0-8). */ + public int currentItem; + + /** The current ItemStack. */ + private ItemStack currentItemStack; + + /** The player whose inventory this is. */ + public EntityPlayer player; + private ItemStack itemStack; + + /** + * Set true whenever the inventory changes. Nothing sets it false so you will have to write your own code to check + * it and reset the value. + */ + public boolean inventoryChanged; + + public InventoryPlayer(EntityPlayer par1EntityPlayer) + { + this.player = par1EntityPlayer; + } + + /** + * Returns the item stack currently held by the player. + */ + public ItemStack getCurrentItem() + { + return this.currentItem < 9 && this.currentItem >= 0 ? this.mainInventory[this.currentItem] : null; + } + + /** + * Get the size of the player hotbar inventory + */ + public static int getHotbarSize() + { + return 9; + } + + /** + * Returns a slot index in main inventory containing a specific itemID + */ + private int getInventorySlotContainItem(int par1) + { + for (int var2 = 0; var2 < this.mainInventory.length; ++var2) + { + if (this.mainInventory[var2] != null && this.mainInventory[var2].itemID == par1) + { + return var2; + } + } + + return -1; + } + + private int getInventorySlotContainItemAndDamage(int par1, int par2) + { + for (int var3 = 0; var3 < this.mainInventory.length; ++var3) + { + if (this.mainInventory[var3] != null && this.mainInventory[var3].itemID == par1 && this.mainInventory[var3].getItemDamage() == par2) + { + return var3; + } + } + + return -1; + } + + /** + * stores an itemstack in the users inventory + */ + private int storeItemStack(ItemStack par1ItemStack) + { + for (int var2 = 0; var2 < this.mainInventory.length; ++var2) + { + if (this.mainInventory[var2] != null && this.mainInventory[var2].itemID == par1ItemStack.itemID && this.mainInventory[var2].isStackable() && this.mainInventory[var2].stackSize < this.mainInventory[var2].getMaxStackSize() && this.mainInventory[var2].stackSize < this.getInventoryStackLimit() && (!this.mainInventory[var2].getHasSubtypes() || this.mainInventory[var2].getItemDamage() == par1ItemStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(this.mainInventory[var2], par1ItemStack)) + { + return var2; + } + } + + return -1; + } + + /** + * Returns the first item stack that is empty. + */ + public int getFirstEmptyStack() + { + for (int var1 = 0; var1 < this.mainInventory.length; ++var1) + { + if (this.mainInventory[var1] == null) + { + return var1; + } + } + + return -1; + } + + /** + * Sets a specific itemID as the current item being held (only if it exists on the hotbar) + */ + public void setCurrentItem(int par1, int par2, boolean par3, boolean par4) + { + boolean var5 = true; + this.currentItemStack = this.getCurrentItem(); + int var7; + + if (par3) + { + var7 = this.getInventorySlotContainItemAndDamage(par1, par2); + } + else + { + var7 = this.getInventorySlotContainItem(par1); + } + + if (var7 >= 0 && var7 < 9) + { + this.currentItem = var7; + } + else + { + if (par4 && par1 > 0) + { + int var6 = this.getFirstEmptyStack(); + + if (var6 >= 0 && var6 < 9) + { + this.currentItem = var6; + } + + this.func_70439_a(Item.itemsList[par1], par2); + } + } + } + + /** + * Switch the current item to the next one or the previous one + */ + public void changeCurrentItem(int par1) + { + if (par1 > 0) + { + par1 = 1; + } + + if (par1 < 0) + { + par1 = -1; + } + + for (this.currentItem -= par1; this.currentItem < 0; this.currentItem += 9) + { + ; + } + + while (this.currentItem >= 9) + { + this.currentItem -= 9; + } + } + + /** + * Clear this player's inventory, using the specified ID and metadata as filters or -1 for no filter. + */ + public int clearInventory(int par1, int par2) + { + int var3 = 0; + int var4; + ItemStack var5; + + for (var4 = 0; var4 < this.mainInventory.length; ++var4) + { + var5 = this.mainInventory[var4]; + + if (var5 != null && (par1 <= -1 || var5.itemID == par1) && (par2 <= -1 || var5.getItemDamage() == par2)) + { + var3 += var5.stackSize; + this.mainInventory[var4] = null; + } + } + + for (var4 = 0; var4 < this.armorInventory.length; ++var4) + { + var5 = this.armorInventory[var4]; + + if (var5 != null && (par1 <= -1 || var5.itemID == par1) && (par2 <= -1 || var5.getItemDamage() == par2)) + { + var3 += var5.stackSize; + this.armorInventory[var4] = null; + } + } + + if (this.itemStack != null) + { + if (par1 > -1 && this.itemStack.itemID != par1) + { + return var3; + } + + if (par2 > -1 && this.itemStack.getItemDamage() != par2) + { + return var3; + } + + var3 += this.itemStack.stackSize; + this.setItemStack((ItemStack)null); + } + + return var3; + } + + public void func_70439_a(Item par1Item, int par2) + { + if (par1Item != null) + { + if (this.currentItemStack != null && this.currentItemStack.isItemEnchantable() && this.getInventorySlotContainItemAndDamage(this.currentItemStack.itemID, this.currentItemStack.getItemDamageForDisplay()) == this.currentItem) + { + return; + } + + int var3 = this.getInventorySlotContainItemAndDamage(par1Item.itemID, par2); + + if (var3 >= 0) + { + int var4 = this.mainInventory[var3].stackSize; + this.mainInventory[var3] = this.mainInventory[this.currentItem]; + this.mainInventory[this.currentItem] = new ItemStack(Item.itemsList[par1Item.itemID], var4, par2); + } + else + { + this.mainInventory[this.currentItem] = new ItemStack(Item.itemsList[par1Item.itemID], 1, par2); + } + } + } + + /** + * This function stores as many items of an ItemStack as possible in a matching slot and returns the quantity of + * left over items. + */ + private int storePartialItemStack(ItemStack par1ItemStack) + { + int var2 = par1ItemStack.itemID; + int var3 = par1ItemStack.stackSize; + int var4; + + if (par1ItemStack.getMaxStackSize() == 1) + { + var4 = this.getFirstEmptyStack(); + + if (var4 < 0) + { + return var3; + } + else + { + if (this.mainInventory[var4] == null) + { + this.mainInventory[var4] = ItemStack.copyItemStack(par1ItemStack); + } + + return 0; + } + } + else + { + var4 = this.storeItemStack(par1ItemStack); + + if (var4 < 0) + { + var4 = this.getFirstEmptyStack(); + } + + if (var4 < 0) + { + return var3; + } + else + { + if (this.mainInventory[var4] == null) + { + this.mainInventory[var4] = new ItemStack(var2, 0, par1ItemStack.getItemDamage()); + + if (par1ItemStack.hasTagCompound()) + { + this.mainInventory[var4].setTagCompound((NBTTagCompound)par1ItemStack.getTagCompound().copy()); + } + } + + int var5 = var3; + + if (var3 > this.mainInventory[var4].getMaxStackSize() - this.mainInventory[var4].stackSize) + { + var5 = this.mainInventory[var4].getMaxStackSize() - this.mainInventory[var4].stackSize; + } + + if (var5 > this.getInventoryStackLimit() - this.mainInventory[var4].stackSize) + { + var5 = this.getInventoryStackLimit() - this.mainInventory[var4].stackSize; + } + + if (var5 == 0) + { + return var3; + } + else + { + var3 -= var5; + this.mainInventory[var4].stackSize += var5; + this.mainInventory[var4].animationsToGo = 5; + return var3; + } + } + } + } + + /** + * Decrement the number of animations remaining. Only called on client side. This is used to handle the animation of + * receiving a block. + */ + public void decrementAnimations() + { + for (int var1 = 0; var1 < this.mainInventory.length; ++var1) + { + if (this.mainInventory[var1] != null) + { + this.mainInventory[var1].updateAnimation(this.player.worldObj, this.player, var1, this.currentItem == var1); + } + } + } + + /** + * removed one item of specified itemID from inventory (if it is in a stack, the stack size will reduce with 1) + */ + public boolean consumeInventoryItem(int par1) + { + int var2 = this.getInventorySlotContainItem(par1); + + if (var2 < 0) + { + return false; + } + else + { + if (--this.mainInventory[var2].stackSize <= 0) + { + this.mainInventory[var2] = null; + } + + return true; + } + } + + /** + * Get if a specifiied item id is inside the inventory. + */ + public boolean hasItem(int par1) + { + int var2 = this.getInventorySlotContainItem(par1); + return var2 >= 0; + } + + /** + * Adds the item stack to the inventory, returns false if it is impossible. + */ + public boolean addItemStackToInventory(ItemStack par1ItemStack) + { + if (par1ItemStack == null) + { + return false; + } + else if (par1ItemStack.stackSize == 0) + { + return false; + } + else + { + try + { + int var2; + + if (par1ItemStack.isItemDamaged()) + { + var2 = this.getFirstEmptyStack(); + + if (var2 >= 0) + { + this.mainInventory[var2] = ItemStack.copyItemStack(par1ItemStack); + this.mainInventory[var2].animationsToGo = 5; + par1ItemStack.stackSize = 0; + return true; + } + else if (this.player.capabilities.isCreativeMode) + { + par1ItemStack.stackSize = 0; + return true; + } + else + { + return false; + } + } + else + { + do + { + var2 = par1ItemStack.stackSize; + par1ItemStack.stackSize = this.storePartialItemStack(par1ItemStack); + } + while (par1ItemStack.stackSize > 0 && par1ItemStack.stackSize < var2); + + if (par1ItemStack.stackSize == var2 && this.player.capabilities.isCreativeMode) + { + par1ItemStack.stackSize = 0; + return true; + } + else + { + return par1ItemStack.stackSize < var2; + } + } + } + catch (Throwable var5) + { + CrashReport var3 = CrashReport.makeCrashReport(var5, "Adding item to inventory"); + CrashReportCategory var4 = var3.makeCategory("Item being added"); + var4.addCrashSection("Item ID", Integer.valueOf(par1ItemStack.itemID)); + var4.addCrashSection("Item data", Integer.valueOf(par1ItemStack.getItemDamage())); + var4.addCrashSectionCallable("Item name", new CallableItemName(this, par1ItemStack)); + throw new ReportedException(var3); + } + } + } + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + public ItemStack decrStackSize(int par1, int par2) + { + ItemStack[] var3 = this.mainInventory; + + if (par1 >= this.mainInventory.length) + { + var3 = this.armorInventory; + par1 -= this.mainInventory.length; + } + + if (var3[par1] != null) + { + ItemStack var4; + + if (var3[par1].stackSize <= par2) + { + var4 = var3[par1]; + var3[par1] = null; + return var4; + } + else + { + var4 = var3[par1].splitStack(par2); + + if (var3[par1].stackSize == 0) + { + var3[par1] = null; + } + + return var4; + } + } + else + { + return null; + } + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + public ItemStack getStackInSlotOnClosing(int par1) + { + ItemStack[] var2 = this.mainInventory; + + if (par1 >= this.mainInventory.length) + { + var2 = this.armorInventory; + par1 -= this.mainInventory.length; + } + + if (var2[par1] != null) + { + ItemStack var3 = var2[par1]; + var2[par1] = null; + return var3; + } + else + { + return null; + } + } + + /** + * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + */ + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) + { + ItemStack[] var3 = this.mainInventory; + + if (par1 >= var3.length) + { + par1 -= var3.length; + var3 = this.armorInventory; + } + + var3[par1] = par2ItemStack; + } + + /** + * Gets the strength of the current item (tool) against the specified block, 1.0f if not holding anything. + */ + public float getStrVsBlock(Block par1Block) + { + float var2 = 1.0F; + + if (this.mainInventory[this.currentItem] != null) + { + var2 *= this.mainInventory[this.currentItem].getStrVsBlock(par1Block); + } + + return var2; + } + + /** + * Writes the inventory out as a list of compound tags. This is where the slot indices are used (+100 for armor, +80 + * for crafting). + */ + public NBTTagList writeToNBT(NBTTagList par1NBTTagList) + { + int var2; + NBTTagCompound var3; + + for (var2 = 0; var2 < this.mainInventory.length; ++var2) + { + if (this.mainInventory[var2] != null) + { + var3 = new NBTTagCompound(); + var3.setByte("Slot", (byte)var2); + this.mainInventory[var2].writeToNBT(var3); + par1NBTTagList.appendTag(var3); + } + } + + for (var2 = 0; var2 < this.armorInventory.length; ++var2) + { + if (this.armorInventory[var2] != null) + { + var3 = new NBTTagCompound(); + var3.setByte("Slot", (byte)(var2 + 100)); + this.armorInventory[var2].writeToNBT(var3); + par1NBTTagList.appendTag(var3); + } + } + + return par1NBTTagList; + } + + /** + * Reads from the given tag list and fills the slots in the inventory with the correct items. + */ + public void readFromNBT(NBTTagList par1NBTTagList) + { + this.mainInventory = new ItemStack[36]; + this.armorInventory = new ItemStack[4]; + + for (int var2 = 0; var2 < par1NBTTagList.tagCount(); ++var2) + { + NBTTagCompound var3 = (NBTTagCompound)par1NBTTagList.tagAt(var2); + int var4 = var3.getByte("Slot") & 255; + ItemStack var5 = ItemStack.loadItemStackFromNBT(var3); + + if (var5 != null) + { + if (var4 >= 0 && var4 < this.mainInventory.length) + { + this.mainInventory[var4] = var5; + } + + if (var4 >= 100 && var4 < this.armorInventory.length + 100) + { + this.armorInventory[var4 - 100] = var5; + } + } + } + } + + /** + * Returns the number of slots in the inventory. + */ + public int getSizeInventory() + { + return this.mainInventory.length + 4; + } + + /** + * Returns the stack in slot i + */ + public ItemStack getStackInSlot(int par1) + { + ItemStack[] var2 = this.mainInventory; + + if (par1 >= var2.length) + { + par1 -= var2.length; + var2 = this.armorInventory; + } + + return var2[par1]; + } + + /** + * Returns the name of the inventory. + */ + public String getInvName() + { + return "container.inventory"; + } + + /** + * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's + * language. Otherwise it will be used directly. + */ + public boolean isInvNameLocalized() + { + return false; + } + + /** + * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't + * this more of a set than a get?* + */ + public int getInventoryStackLimit() + { + return 64; + } + + /** + * Returns whether the current item (tool) can harvest from the specified block (actually get a result). + */ + public boolean canHarvestBlock(Block par1Block) + { + if (par1Block.blockMaterial.isToolNotRequired()) + { + return true; + } + else + { + ItemStack var2 = this.getStackInSlot(this.currentItem); + return var2 != null ? var2.canHarvestBlock(par1Block) : false; + } + } + + /** + * returns a player armor item (as itemstack) contained in specified armor slot. + */ + public ItemStack armorItemInSlot(int par1) + { + return this.armorInventory[par1]; + } + + /** + * Based on the damage values and maximum damage values of each armor item, returns the current armor value. + */ + public int getTotalArmorValue() + { + int var1 = 0; + + for (int var2 = 0; var2 < this.armorInventory.length; ++var2) + { + if (this.armorInventory[var2] != null && this.armorInventory[var2].getItem() instanceof ItemArmor) + { + int var3 = ((ItemArmor)this.armorInventory[var2].getItem()).damageReduceAmount; + var1 += var3; + } + } + + return var1; + } + + /** + * Damages armor in each slot by the specified amount. + */ + public void damageArmor(float par1) + { + par1 /= 4.0F; + + if (par1 < 1.0F) + { + par1 = 1.0F; + } + + for (int var2 = 0; var2 < this.armorInventory.length; ++var2) + { + if (this.armorInventory[var2] != null && this.armorInventory[var2].getItem() instanceof ItemArmor) + { + this.armorInventory[var2].damageItem((int)par1, this.player); + + if (this.armorInventory[var2].stackSize == 0) + { + this.armorInventory[var2] = null; + } + } + } + } + + /** + * Drop all armor and main inventory items. + */ + public void dropAllItems() + { + int var1; + + for (var1 = 0; var1 < this.mainInventory.length; ++var1) + { + if (this.mainInventory[var1] != null) + { + this.player.dropPlayerItemWithRandomChoice(this.mainInventory[var1], true); + this.mainInventory[var1] = null; + } + } + + for (var1 = 0; var1 < this.armorInventory.length; ++var1) + { + if (this.armorInventory[var1] != null) + { + this.player.dropPlayerItemWithRandomChoice(this.armorInventory[var1], true); + this.armorInventory[var1] = null; + } + } + } + + /** + * Called when an the contents of an Inventory change, usually + */ + public void onInventoryChanged() + { + this.inventoryChanged = true; + } + + public void setItemStack(ItemStack par1ItemStack) + { + this.itemStack = par1ItemStack; + } + + public ItemStack getItemStack() + { + return this.itemStack; + } + + /** + * Do not make give this method the name canInteractWith because it clashes with Container + */ + public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + { + return this.player.isDead ? false : par1EntityPlayer.getDistanceSqToEntity(this.player) <= 64.0D; + } + + /** + * Returns true if the specified ItemStack exists in the inventory. + */ + public boolean hasItemStack(ItemStack par1ItemStack) + { + int var2; + + for (var2 = 0; var2 < this.armorInventory.length; ++var2) + { + if (this.armorInventory[var2] != null && this.armorInventory[var2].isItemEqual(par1ItemStack)) + { + return true; + } + } + + for (var2 = 0; var2 < this.mainInventory.length; ++var2) + { + if (this.mainInventory[var2] != null && this.mainInventory[var2].isItemEqual(par1ItemStack)) + { + return true; + } + } + + return false; + } + + public void openChest() {} + + public void closeChest() {} + + /** + * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. + */ + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) + { + return true; + } + + /** + * Copy the ItemStack contents from another InventoryPlayer instance + */ + public void copyInventory(InventoryPlayer par1InventoryPlayer) + { + int var2; + + for (var2 = 0; var2 < this.mainInventory.length; ++var2) + { + this.mainInventory[var2] = ItemStack.copyItemStack(par1InventoryPlayer.mainInventory[var2]); + } + + for (var2 = 0; var2 < this.armorInventory.length; ++var2) + { + this.armorInventory[var2] = ItemStack.copyItemStack(par1InventoryPlayer.armorInventory[var2]); + } + + this.currentItem = par1InventoryPlayer.currentItem; + } +} diff --git a/src/main/java/net/minecraft/src/Item.java b/src/main/java/net/minecraft/src/Item.java new file mode 100644 index 0000000..12a66d4 --- /dev/null +++ b/src/main/java/net/minecraft/src/Item.java @@ -0,0 +1,705 @@ +package net.minecraft.src; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import java.util.List; +import java.util.Random; +import java.util.UUID; + +public class Item +{ + protected static final UUID field_111210_e = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); + private CreativeTabs tabToDisplayOn; + + /** The RNG used by the Item subclasses. */ + protected static Random itemRand = new Random(); + + /** A 32000 elements Item array. */ + public static Item[] itemsList = new Item[32000]; + public static Item shovelIron = (new ItemSpade(0, EnumToolMaterial.IRON)).setUnlocalizedName("shovelIron").setTextureName("iron_shovel"); + public static Item pickaxeIron = (new ItemPickaxe(1, EnumToolMaterial.IRON)).setUnlocalizedName("pickaxeIron").setTextureName("iron_pickaxe"); + public static Item axeIron = (new ItemAxe(2, EnumToolMaterial.IRON)).setUnlocalizedName("hatchetIron").setTextureName("iron_axe"); + public static Item flintAndSteel = (new ItemFlintAndSteel(3)).setUnlocalizedName("flintAndSteel").setTextureName("flint_and_steel"); + public static Item appleRed = (new ItemFood(4, 4, 0.3F, false)).setUnlocalizedName("apple").setTextureName("apple"); + public static ItemBow bow = (ItemBow)(new ItemBow(5)).setUnlocalizedName("bow").setTextureName("bow"); + public static Item arrow = (new Item(6)).setUnlocalizedName("arrow").setCreativeTab(CreativeTabs.tabCombat).setTextureName("arrow"); + public static Item coal = (new ItemCoal(7)).setUnlocalizedName("coal").setTextureName("coal"); + public static Item diamond = (new Item(8)).setUnlocalizedName("diamond").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("diamond"); + public static Item ingotIron = (new Item(9)).setUnlocalizedName("ingotIron").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("iron_ingot"); + public static Item ingotGold = (new Item(10)).setUnlocalizedName("ingotGold").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("gold_ingot"); + public static Item swordIron = (new ItemSword(11, EnumToolMaterial.IRON)).setUnlocalizedName("swordIron").setTextureName("iron_sword"); + public static Item swordWood = (new ItemSword(12, EnumToolMaterial.WOOD)).setUnlocalizedName("swordWood").setTextureName("wood_sword"); + public static Item shovelWood = (new ItemSpade(13, EnumToolMaterial.WOOD)).setUnlocalizedName("shovelWood").setTextureName("wood_shovel"); + public static Item pickaxeWood = (new ItemPickaxe(14, EnumToolMaterial.WOOD)).setUnlocalizedName("pickaxeWood").setTextureName("wood_pickaxe"); + public static Item axeWood = (new ItemAxe(15, EnumToolMaterial.WOOD)).setUnlocalizedName("hatchetWood").setTextureName("wood_axe"); + public static Item swordStone = (new ItemSword(16, EnumToolMaterial.STONE)).setUnlocalizedName("swordStone").setTextureName("stone_sword"); + public static Item shovelStone = (new ItemSpade(17, EnumToolMaterial.STONE)).setUnlocalizedName("shovelStone").setTextureName("stone_shovel"); + public static Item pickaxeStone = (new ItemPickaxe(18, EnumToolMaterial.STONE)).setUnlocalizedName("pickaxeStone").setTextureName("stone_pickaxe"); + public static Item axeStone = (new ItemAxe(19, EnumToolMaterial.STONE)).setUnlocalizedName("hatchetStone").setTextureName("stone_axe"); + public static Item swordDiamond = (new ItemSword(20, EnumToolMaterial.EMERALD)).setUnlocalizedName("swordDiamond").setTextureName("diamond_sword"); + public static Item shovelDiamond = (new ItemSpade(21, EnumToolMaterial.EMERALD)).setUnlocalizedName("shovelDiamond").setTextureName("diamond_shovel"); + public static Item pickaxeDiamond = (new ItemPickaxe(22, EnumToolMaterial.EMERALD)).setUnlocalizedName("pickaxeDiamond").setTextureName("diamond_pickaxe"); + public static Item axeDiamond = (new ItemAxe(23, EnumToolMaterial.EMERALD)).setUnlocalizedName("hatchetDiamond").setTextureName("diamond_axe"); + public static Item stick = (new Item(24)).setFull3D().setUnlocalizedName("stick").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("stick"); + public static Item bowlEmpty = (new Item(25)).setUnlocalizedName("bowl").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("bowl"); + public static Item bowlSoup = (new ItemSoup(26, 6)).setUnlocalizedName("mushroomStew").setTextureName("mushroom_stew"); + public static Item swordGold = (new ItemSword(27, EnumToolMaterial.GOLD)).setUnlocalizedName("swordGold").setTextureName("gold_sword"); + public static Item shovelGold = (new ItemSpade(28, EnumToolMaterial.GOLD)).setUnlocalizedName("shovelGold").setTextureName("gold_shovel"); + public static Item pickaxeGold = (new ItemPickaxe(29, EnumToolMaterial.GOLD)).setUnlocalizedName("pickaxeGold").setTextureName("gold_pickaxe"); + public static Item axeGold = (new ItemAxe(30, EnumToolMaterial.GOLD)).setUnlocalizedName("hatchetGold").setTextureName("gold_axe"); + public static Item silk = (new ItemReed(31, Block.tripWire)).setUnlocalizedName("string").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("string"); + public static Item feather = (new Item(32)).setUnlocalizedName("feather").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("feather"); + public static Item gunpowder = (new Item(33)).setUnlocalizedName("sulphur").setPotionEffect(PotionHelper.gunpowderEffect).setCreativeTab(CreativeTabs.tabMaterials).setTextureName("gunpowder"); + public static Item hoeWood = (new ItemHoe(34, EnumToolMaterial.WOOD)).setUnlocalizedName("hoeWood").setTextureName("wood_hoe"); + public static Item hoeStone = (new ItemHoe(35, EnumToolMaterial.STONE)).setUnlocalizedName("hoeStone").setTextureName("stone_hoe"); + public static Item hoeIron = (new ItemHoe(36, EnumToolMaterial.IRON)).setUnlocalizedName("hoeIron").setTextureName("iron_hoe"); + public static Item hoeDiamond = (new ItemHoe(37, EnumToolMaterial.EMERALD)).setUnlocalizedName("hoeDiamond").setTextureName("diamond_hoe"); + public static Item hoeGold = (new ItemHoe(38, EnumToolMaterial.GOLD)).setUnlocalizedName("hoeGold").setTextureName("gold_hoe"); + public static Item seeds = (new ItemSeeds(39, Block.crops.blockID, Block.tilledField.blockID)).setUnlocalizedName("seeds").setTextureName("seeds_wheat"); + public static Item wheat = (new Item(40)).setUnlocalizedName("wheat").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("wheat"); + public static Item bread = (new ItemFood(41, 5, 0.6F, false)).setUnlocalizedName("bread").setTextureName("bread"); + public static ItemArmor helmetLeather = (ItemArmor)(new ItemArmor(42, EnumArmorMaterial.CLOTH, 0, 0)).setUnlocalizedName("helmetCloth").setTextureName("leather_helmet"); + public static ItemArmor plateLeather = (ItemArmor)(new ItemArmor(43, EnumArmorMaterial.CLOTH, 0, 1)).setUnlocalizedName("chestplateCloth").setTextureName("leather_chestplate"); + public static ItemArmor legsLeather = (ItemArmor)(new ItemArmor(44, EnumArmorMaterial.CLOTH, 0, 2)).setUnlocalizedName("leggingsCloth").setTextureName("leather_leggings"); + public static ItemArmor bootsLeather = (ItemArmor)(new ItemArmor(45, EnumArmorMaterial.CLOTH, 0, 3)).setUnlocalizedName("bootsCloth").setTextureName("leather_boots"); + public static ItemArmor helmetChain = (ItemArmor)(new ItemArmor(46, EnumArmorMaterial.CHAIN, 1, 0)).setUnlocalizedName("helmetChain").setTextureName("chainmail_helmet"); + public static ItemArmor plateChain = (ItemArmor)(new ItemArmor(47, EnumArmorMaterial.CHAIN, 1, 1)).setUnlocalizedName("chestplateChain").setTextureName("chainmail_chestplate"); + public static ItemArmor legsChain = (ItemArmor)(new ItemArmor(48, EnumArmorMaterial.CHAIN, 1, 2)).setUnlocalizedName("leggingsChain").setTextureName("chainmail_leggings"); + public static ItemArmor bootsChain = (ItemArmor)(new ItemArmor(49, EnumArmorMaterial.CHAIN, 1, 3)).setUnlocalizedName("bootsChain").setTextureName("chainmail_boots"); + public static ItemArmor helmetIron = (ItemArmor)(new ItemArmor(50, EnumArmorMaterial.IRON, 2, 0)).setUnlocalizedName("helmetIron").setTextureName("iron_helmet"); + public static ItemArmor plateIron = (ItemArmor)(new ItemArmor(51, EnumArmorMaterial.IRON, 2, 1)).setUnlocalizedName("chestplateIron").setTextureName("iron_chestplate"); + public static ItemArmor legsIron = (ItemArmor)(new ItemArmor(52, EnumArmorMaterial.IRON, 2, 2)).setUnlocalizedName("leggingsIron").setTextureName("iron_leggings"); + public static ItemArmor bootsIron = (ItemArmor)(new ItemArmor(53, EnumArmorMaterial.IRON, 2, 3)).setUnlocalizedName("bootsIron").setTextureName("iron_boots"); + public static ItemArmor helmetDiamond = (ItemArmor)(new ItemArmor(54, EnumArmorMaterial.DIAMOND, 3, 0)).setUnlocalizedName("helmetDiamond").setTextureName("diamond_helmet"); + public static ItemArmor plateDiamond = (ItemArmor)(new ItemArmor(55, EnumArmorMaterial.DIAMOND, 3, 1)).setUnlocalizedName("chestplateDiamond").setTextureName("diamond_chestplate"); + public static ItemArmor legsDiamond = (ItemArmor)(new ItemArmor(56, EnumArmorMaterial.DIAMOND, 3, 2)).setUnlocalizedName("leggingsDiamond").setTextureName("diamond_leggings"); + public static ItemArmor bootsDiamond = (ItemArmor)(new ItemArmor(57, EnumArmorMaterial.DIAMOND, 3, 3)).setUnlocalizedName("bootsDiamond").setTextureName("diamond_boots"); + public static ItemArmor helmetGold = (ItemArmor)(new ItemArmor(58, EnumArmorMaterial.GOLD, 4, 0)).setUnlocalizedName("helmetGold").setTextureName("gold_helmet"); + public static ItemArmor plateGold = (ItemArmor)(new ItemArmor(59, EnumArmorMaterial.GOLD, 4, 1)).setUnlocalizedName("chestplateGold").setTextureName("gold_chestplate"); + public static ItemArmor legsGold = (ItemArmor)(new ItemArmor(60, EnumArmorMaterial.GOLD, 4, 2)).setUnlocalizedName("leggingsGold").setTextureName("gold_leggings"); + public static ItemArmor bootsGold = (ItemArmor)(new ItemArmor(61, EnumArmorMaterial.GOLD, 4, 3)).setUnlocalizedName("bootsGold").setTextureName("gold_boots"); + public static Item flint = (new Item(62)).setUnlocalizedName("flint").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("flint"); + public static Item porkRaw = (new ItemFood(63, 3, 0.3F, true)).setUnlocalizedName("porkchopRaw").setTextureName("porkchop_raw"); + public static Item porkCooked = (new ItemFood(64, 8, 0.8F, true)).setUnlocalizedName("porkchopCooked").setTextureName("porkchop_cooked"); + public static Item painting = (new ItemHangingEntity(65, EntityPainting.class)).setUnlocalizedName("painting").setTextureName("painting"); + public static Item appleGold = (new ItemAppleGold(66, 4, 1.2F, false)).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 5, 1, 1.0F).setUnlocalizedName("appleGold").setTextureName("apple_golden"); + public static Item sign = (new ItemSign(67)).setUnlocalizedName("sign").setTextureName("sign"); + public static Item doorWood = (new ItemDoor(68, Material.wood)).setUnlocalizedName("doorWood").setTextureName("door_wood"); + public static Item bucketEmpty = (new ItemBucket(69, 0)).setUnlocalizedName("bucket").setMaxStackSize(16).setTextureName("bucket_empty"); + public static Item bucketWater = (new ItemBucket(70, Block.waterMoving.blockID)).setUnlocalizedName("bucketWater").setContainerItem(bucketEmpty).setTextureName("bucket_water"); + public static Item bucketLava = (new ItemBucket(71, Block.lavaMoving.blockID)).setUnlocalizedName("bucketLava").setContainerItem(bucketEmpty).setTextureName("bucket_lava"); + public static Item minecartEmpty = (new ItemMinecart(72, 0)).setUnlocalizedName("minecart").setTextureName("minecart_normal"); + public static Item saddle = (new ItemSaddle(73)).setUnlocalizedName("saddle").setTextureName("saddle"); + public static Item doorIron = (new ItemDoor(74, Material.iron)).setUnlocalizedName("doorIron").setTextureName("door_iron"); + public static Item redstone = (new ItemRedstone(75)).setUnlocalizedName("redstone").setPotionEffect(PotionHelper.redstoneEffect).setTextureName("redstone_dust"); + public static Item snowball = (new ItemSnowball(76)).setUnlocalizedName("snowball").setTextureName("snowball"); + public static Item boat = (new ItemBoat(77)).setUnlocalizedName("boat").setTextureName("boat"); + public static Item leather = (new Item(78)).setUnlocalizedName("leather").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("leather"); + public static Item bucketMilk = (new ItemBucketMilk(79)).setUnlocalizedName("milk").setContainerItem(bucketEmpty).setTextureName("bucket_milk"); + public static Item brick = (new Item(80)).setUnlocalizedName("brick").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("brick"); + public static Item clay = (new Item(81)).setUnlocalizedName("clay").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("clay_ball"); + public static Item reed = (new ItemReed(82, Block.reed)).setUnlocalizedName("reeds").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("reeds"); + public static Item paper = (new Item(83)).setUnlocalizedName("paper").setCreativeTab(CreativeTabs.tabMisc).setTextureName("paper"); + public static Item book = (new ItemBook(84)).setUnlocalizedName("book").setCreativeTab(CreativeTabs.tabMisc).setTextureName("book_normal"); + public static Item slimeBall = (new Item(85)).setUnlocalizedName("slimeball").setCreativeTab(CreativeTabs.tabMisc).setTextureName("slimeball"); + public static Item minecartCrate = (new ItemMinecart(86, 1)).setUnlocalizedName("minecartChest").setTextureName("minecart_chest"); + public static Item minecartPowered = (new ItemMinecart(87, 2)).setUnlocalizedName("minecartFurnace").setTextureName("minecart_furnace"); + public static Item egg = (new ItemEgg(88)).setUnlocalizedName("egg").setTextureName("egg"); + public static Item compass = (new Item(89)).setUnlocalizedName("compass").setCreativeTab(CreativeTabs.tabTools).setTextureName("compass"); + public static ItemFishingRod fishingRod = (ItemFishingRod)(new ItemFishingRod(90)).setUnlocalizedName("fishingRod").setTextureName("fishing_rod"); + public static Item pocketSundial = (new Item(91)).setUnlocalizedName("clock").setCreativeTab(CreativeTabs.tabTools).setTextureName("clock"); + public static Item glowstone = (new Item(92)).setUnlocalizedName("yellowDust").setPotionEffect(PotionHelper.glowstoneEffect).setCreativeTab(CreativeTabs.tabMaterials).setTextureName("glowstone_dust"); + public static Item fishRaw = (new ItemFood(93, 2, 0.3F, false)).setUnlocalizedName("fishRaw").setTextureName("fish_raw"); + public static Item fishCooked = (new ItemFood(94, 5, 0.6F, false)).setUnlocalizedName("fishCooked").setTextureName("fish_cooked"); + public static Item dyePowder = (new ItemDye(95)).setUnlocalizedName("dyePowder").setTextureName("dye_powder"); + public static Item bone = (new Item(96)).setUnlocalizedName("bone").setFull3D().setCreativeTab(CreativeTabs.tabMisc).setTextureName("bone"); + public static Item sugar = (new Item(97)).setUnlocalizedName("sugar").setPotionEffect(PotionHelper.sugarEffect).setCreativeTab(CreativeTabs.tabMaterials).setTextureName("sugar"); + public static Item cake = (new ItemReed(98, Block.cake)).setMaxStackSize(1).setUnlocalizedName("cake").setCreativeTab(CreativeTabs.tabFood).setTextureName("cake"); + public static Item bed = (new ItemBed(99)).setMaxStackSize(1).setUnlocalizedName("bed").setTextureName("bed"); + public static Item redstoneRepeater = (new ItemReed(100, Block.redstoneRepeaterIdle)).setUnlocalizedName("diode").setCreativeTab(CreativeTabs.tabRedstone).setTextureName("repeater"); + public static Item cookie = (new ItemFood(101, 2, 0.1F, false)).setUnlocalizedName("cookie").setTextureName("cookie"); + public static ItemMap map = (ItemMap)(new ItemMap(102)).setUnlocalizedName("map").setTextureName("map_filled"); + + /** + * Item introduced on 1.7 version, is a shear to cut leaves (you can keep the block) or get wool from sheeps. + */ + public static ItemShears shears = (ItemShears)(new ItemShears(103)).setUnlocalizedName("shears").setTextureName("shears"); + public static Item melon = (new ItemFood(104, 2, 0.3F, false)).setUnlocalizedName("melon").setTextureName("melon"); + public static Item pumpkinSeeds = (new ItemSeeds(105, Block.pumpkinStem.blockID, Block.tilledField.blockID)).setUnlocalizedName("seeds_pumpkin").setTextureName("seeds_pumpkin"); + public static Item melonSeeds = (new ItemSeeds(106, Block.melonStem.blockID, Block.tilledField.blockID)).setUnlocalizedName("seeds_melon").setTextureName("seeds_melon"); + public static Item beefRaw = (new ItemFood(107, 3, 0.3F, true)).setUnlocalizedName("beefRaw").setTextureName("beef_raw"); + public static Item beefCooked = (new ItemFood(108, 8, 0.8F, true)).setUnlocalizedName("beefCooked").setTextureName("beef_cooked"); + public static Item chickenRaw = (new ItemFood(109, 2, 0.3F, true)).setPotionEffect(Potion.hunger.id, 30, 0, 0.3F).setUnlocalizedName("chickenRaw").setTextureName("chicken_raw"); + public static Item chickenCooked = (new ItemFood(110, 6, 0.6F, true)).setUnlocalizedName("chickenCooked").setTextureName("chicken_cooked"); + public static Item rottenFlesh = (new ItemFood(111, 4, 0.1F, true)).setPotionEffect(Potion.hunger.id, 30, 0, 0.8F).setUnlocalizedName("rottenFlesh").setTextureName("rotten_flesh"); + public static Item enderPearl = (new ItemEnderPearl(112)).setUnlocalizedName("enderPearl").setTextureName("ender_pearl"); + public static Item blazeRod = (new Item(113)).setUnlocalizedName("blazeRod").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("blaze_rod"); + public static Item ghastTear = (new Item(114)).setUnlocalizedName("ghastTear").setPotionEffect(PotionHelper.ghastTearEffect).setCreativeTab(CreativeTabs.tabBrewing).setTextureName("ghast_tear"); + public static Item goldNugget = (new Item(115)).setUnlocalizedName("goldNugget").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("gold_nugget"); + public static Item netherStalkSeeds = (new ItemSeeds(116, Block.netherStalk.blockID, Block.slowSand.blockID)).setUnlocalizedName("netherStalkSeeds").setPotionEffect("+4").setTextureName("nether_wart"); + public static ItemPotion potion = (ItemPotion)(new ItemPotion(117)).setUnlocalizedName("potion").setTextureName("potion"); + public static Item glassBottle = (new ItemGlassBottle(118)).setUnlocalizedName("glassBottle").setTextureName("potion_bottle_empty"); + public static Item spiderEye = (new ItemFood(119, 2, 0.8F, false)).setPotionEffect(Potion.poison.id, 5, 0, 1.0F).setUnlocalizedName("spiderEye").setPotionEffect(PotionHelper.spiderEyeEffect).setTextureName("spider_eye"); + public static Item fermentedSpiderEye = (new Item(120)).setUnlocalizedName("fermentedSpiderEye").setPotionEffect(PotionHelper.fermentedSpiderEyeEffect).setCreativeTab(CreativeTabs.tabBrewing).setTextureName("spider_eye_fermented"); + public static Item blazePowder = (new Item(121)).setUnlocalizedName("blazePowder").setPotionEffect(PotionHelper.blazePowderEffect).setCreativeTab(CreativeTabs.tabBrewing).setTextureName("blaze_powder"); + public static Item magmaCream = (new Item(122)).setUnlocalizedName("magmaCream").setPotionEffect(PotionHelper.magmaCreamEffect).setCreativeTab(CreativeTabs.tabBrewing).setTextureName("magma_cream"); + public static Item brewingStand = (new ItemReed(123, Block.brewingStand)).setUnlocalizedName("brewingStand").setCreativeTab(CreativeTabs.tabBrewing).setTextureName("brewing_stand"); + public static Item cauldron = (new ItemReed(124, Block.cauldron)).setUnlocalizedName("cauldron").setCreativeTab(CreativeTabs.tabBrewing).setTextureName("cauldron"); + public static Item eyeOfEnder = (new ItemEnderEye(125)).setUnlocalizedName("eyeOfEnder").setTextureName("ender_eye"); + public static Item speckledMelon = (new Item(126)).setUnlocalizedName("speckledMelon").setPotionEffect(PotionHelper.speckledMelonEffect).setCreativeTab(CreativeTabs.tabBrewing).setTextureName("melon_speckled"); + public static Item monsterPlacer = (new ItemMonsterPlacer(127)).setUnlocalizedName("monsterPlacer").setTextureName("spawn_egg"); + + /** + * Bottle o' Enchanting. Drops between 1 and 3 experience orbs when thrown. + */ + public static Item expBottle = (new ItemExpBottle(128)).setUnlocalizedName("expBottle").setTextureName("experience_bottle"); + + /** + * Fire Charge. When used in a dispenser it fires a fireball similiar to a Ghast's. + */ + public static Item fireballCharge = (new ItemFireball(129)).setUnlocalizedName("fireball").setTextureName("fireball"); + public static Item writableBook = (new ItemWritableBook(130)).setUnlocalizedName("writingBook").setCreativeTab(CreativeTabs.tabMisc).setTextureName("book_writable"); + public static Item writtenBook = (new ItemEditableBook(131)).setUnlocalizedName("writtenBook").setTextureName("book_written"); + public static Item emerald = (new Item(132)).setUnlocalizedName("emerald").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("emerald"); + public static Item itemFrame = (new ItemHangingEntity(133, EntityItemFrame.class)).setUnlocalizedName("frame").setTextureName("item_frame"); + public static Item flowerPot = (new ItemReed(134, Block.flowerPot)).setUnlocalizedName("flowerPot").setCreativeTab(CreativeTabs.tabDecorations).setTextureName("flower_pot"); + public static Item carrot = (new ItemSeedFood(135, 4, 0.6F, Block.carrot.blockID, Block.tilledField.blockID)).setUnlocalizedName("carrots").setTextureName("carrot"); + public static Item potato = (new ItemSeedFood(136, 1, 0.3F, Block.potato.blockID, Block.tilledField.blockID)).setUnlocalizedName("potato").setTextureName("potato"); + public static Item bakedPotato = (new ItemFood(137, 6, 0.6F, false)).setUnlocalizedName("potatoBaked").setTextureName("potato_baked"); + public static Item poisonousPotato = (new ItemFood(138, 2, 0.3F, false)).setPotionEffect(Potion.poison.id, 5, 0, 0.6F).setUnlocalizedName("potatoPoisonous").setTextureName("potato_poisonous"); + public static ItemEmptyMap emptyMap = (ItemEmptyMap)(new ItemEmptyMap(139)).setUnlocalizedName("emptyMap").setTextureName("map_empty"); + public static Item goldenCarrot = (new ItemFood(140, 6, 1.2F, false)).setUnlocalizedName("carrotGolden").setPotionEffect(PotionHelper.goldenCarrotEffect).setTextureName("carrot_golden"); + public static Item skull = (new ItemSkull(141)).setUnlocalizedName("skull").setTextureName("skull"); + public static Item carrotOnAStick = (new ItemCarrotOnAStick(142)).setUnlocalizedName("carrotOnAStick").setTextureName("carrot_on_a_stick"); + public static Item netherStar = (new ItemSimpleFoiled(143)).setUnlocalizedName("netherStar").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("nether_star"); + public static Item pumpkinPie = (new ItemFood(144, 8, 0.3F, false)).setUnlocalizedName("pumpkinPie").setCreativeTab(CreativeTabs.tabFood).setTextureName("pumpkin_pie"); + public static Item firework = (new ItemFirework(145)).setUnlocalizedName("fireworks").setTextureName("fireworks"); + public static Item fireworkCharge = (new ItemFireworkCharge(146)).setUnlocalizedName("fireworksCharge").setCreativeTab(CreativeTabs.tabMisc).setTextureName("fireworks_charge"); + public static ItemEnchantedBook enchantedBook = (ItemEnchantedBook)(new ItemEnchantedBook(147)).setMaxStackSize(1).setUnlocalizedName("enchantedBook").setTextureName("book_enchanted"); + public static Item comparator = (new ItemReed(148, Block.redstoneComparatorIdle)).setUnlocalizedName("comparator").setCreativeTab(CreativeTabs.tabRedstone).setTextureName("comparator"); + public static Item netherrackBrick = (new Item(149)).setUnlocalizedName("netherbrick").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("netherbrick"); + public static Item netherQuartz = (new Item(150)).setUnlocalizedName("netherquartz").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("quartz"); + public static Item minecartTnt = (new ItemMinecart(151, 3)).setUnlocalizedName("minecartTnt").setTextureName("minecart_tnt"); + public static Item minecartHopper = (new ItemMinecart(152, 5)).setUnlocalizedName("minecartHopper").setTextureName("minecart_hopper"); + public static Item horseArmorIron = (new Item(161)).setUnlocalizedName("horsearmormetal").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabMisc).setTextureName("iron_horse_armor"); + public static Item horseArmorGold = (new Item(162)).setUnlocalizedName("horsearmorgold").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabMisc).setTextureName("gold_horse_armor"); + public static Item horseArmorDiamond = (new Item(163)).setUnlocalizedName("horsearmordiamond").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabMisc).setTextureName("diamond_horse_armor"); + public static Item leash = (new ItemLeash(164)).setUnlocalizedName("leash").setTextureName("lead"); + public static Item nameTag = (new ItemNameTag(165)).setUnlocalizedName("nameTag").setTextureName("name_tag"); + public static Item record13 = (new ItemRecord(2000, "13")).setUnlocalizedName("record").setTextureName("record_13"); + public static Item recordCat = (new ItemRecord(2001, "cat")).setUnlocalizedName("record").setTextureName("record_cat"); + public static Item recordBlocks = (new ItemRecord(2002, "blocks")).setUnlocalizedName("record").setTextureName("record_blocks"); + public static Item recordChirp = (new ItemRecord(2003, "chirp")).setUnlocalizedName("record").setTextureName("record_chirp"); + public static Item recordFar = (new ItemRecord(2004, "far")).setUnlocalizedName("record").setTextureName("record_far"); + public static Item recordMall = (new ItemRecord(2005, "mall")).setUnlocalizedName("record").setTextureName("record_mall"); + public static Item recordMellohi = (new ItemRecord(2006, "mellohi")).setUnlocalizedName("record").setTextureName("record_mellohi"); + public static Item recordStal = (new ItemRecord(2007, "stal")).setUnlocalizedName("record").setTextureName("record_stal"); + public static Item recordStrad = (new ItemRecord(2008, "strad")).setUnlocalizedName("record").setTextureName("record_strad"); + public static Item recordWard = (new ItemRecord(2009, "ward")).setUnlocalizedName("record").setTextureName("record_ward"); + public static Item record11 = (new ItemRecord(2010, "11")).setUnlocalizedName("record").setTextureName("record_11"); + public static Item recordWait = (new ItemRecord(2011, "wait")).setUnlocalizedName("record").setTextureName("record_wait"); + + /** The ID of this item. */ + public final int itemID; + + /** Maximum size of the stack. */ + protected int maxStackSize = 64; + + /** Maximum damage an item can handle. */ + private int maxDamage; + + /** If true, render the object in full 3D, like weapons and tools. */ + protected boolean bFull3D; + + /** + * Some items (like dyes) have multiple subtypes on same item, this is field define this behavior + */ + protected boolean hasSubtypes; + private Item containerItem; + private String potionEffect; + + /** The unlocalized name of this item. */ + private String unlocalizedName; + + /** Icon index in the icons table. */ + protected Icon itemIcon; + + /** The string associated with this Item's Icon. */ + protected String iconString; + + protected Item(int par1) + { + this.itemID = 256 + par1; + + if (itemsList[256 + par1] != null) + { + System.out.println("CONFLICT @ " + par1); + } + + itemsList[256 + par1] = this; + } + + public Item setMaxStackSize(int par1) + { + this.maxStackSize = par1; + return this; + } + + /** + * Returns 0 for /terrain.png, 1 for /gui/items.png + */ + public int getSpriteNumber() + { + return 1; + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return this.itemIcon; + } + + /** + * Returns the icon index of the stack given as argument. + */ + public final Icon getIconIndex(ItemStack par1ItemStack) + { + return this.getIconFromDamage(par1ItemStack.getItemDamage()); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + return false; + } + + /** + * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if + * sword + */ + public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) + { + return 1.0F; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + return par1ItemStack; + } + + public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + return par1ItemStack; + } + + /** + * Returns the maximum size of the stack for a specific item. *Isn't this more a Set than a Get?* + */ + public int getItemStackLimit() + { + return this.maxStackSize; + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + public int getMetadata(int par1) + { + return 0; + } + + public boolean getHasSubtypes() + { + return this.hasSubtypes; + } + + protected Item setHasSubtypes(boolean par1) + { + this.hasSubtypes = par1; + return this; + } + + /** + * Returns the maximum damage an item can take. + */ + public int getMaxDamage() + { + return this.maxDamage; + } + + /** + * set max damage of an Item + */ + protected Item setMaxDamage(int par1) + { + this.maxDamage = par1; + return this; + } + + public boolean isDamageable() + { + return this.maxDamage > 0 && !this.hasSubtypes; + } + + /** + * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise + * the damage on the stack. + */ + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) + { + return false; + } + + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) + { + return false; + } + + /** + * Returns if the item (tool) can harvest results from the block type. + */ + public boolean canHarvestBlock(Block par1Block) + { + return false; + } + + /** + * Returns true if the item can be used on the given entity, e.g. shears on sheep. + */ + public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase) + { + return false; + } + + /** + * Sets bFull3D to True and return the object. + */ + public Item setFull3D() + { + this.bFull3D = true; + return this; + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return this.bFull3D; + } + + /** + * Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities + * hands. + */ + public boolean shouldRotateAroundWhenRendering() + { + return false; + } + + /** + * Sets the unlocalized name of this item to the string passed as the parameter, prefixed by "item." + */ + public Item setUnlocalizedName(String par1Str) + { + this.unlocalizedName = par1Str; + return this; + } + + /** + * Translates the unlocalized name of this item, but without the .name suffix, so the translation fails and the + * unlocalized name itself is returned. + */ + public String getUnlocalizedNameInefficiently(ItemStack par1ItemStack) + { + String var2 = this.getUnlocalizedName(par1ItemStack); + return var2 == null ? "" : StatCollector.translateToLocal(var2); + } + + /** + * Returns the unlocalized name of this item. + */ + public String getUnlocalizedName() + { + return "item." + this.unlocalizedName; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack par1ItemStack) + { + return "item." + this.unlocalizedName; + } + + public Item setContainerItem(Item par1Item) + { + this.containerItem = par1Item; + return this; + } + + /** + * If this returns true, after a recipe involving this item is crafted the container item will be added to the + * player's inventory instead of remaining in the crafting grid. + */ + public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack) + { + return true; + } + + /** + * If this function returns true (or the item is damageable), the ItemStack's NBT tag will be sent to the client. + */ + public boolean getShareTag() + { + return true; + } + + public Item getContainerItem() + { + return this.containerItem; + } + + /** + * True if this Item has a container item (a.k.a. crafting result) + */ + public boolean hasContainerItem() + { + return this.containerItem != null; + } + + public String getStatName() + { + return StatCollector.translateToLocal(this.getUnlocalizedName() + ".name"); + } + + public String getItemStackDisplayName(ItemStack par1ItemStack) + { + return StatCollector.translateToLocal(this.getUnlocalizedName(par1ItemStack) + ".name"); + } + + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) + { + return 16777215; + } + + /** + * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and + * update it's contents. + */ + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {} + + /** + * Called when item is crafted/smelted. Used only by maps so far. + */ + public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {} + + /** + * false for all Items except sub-classes of ItemMapBase + */ + public boolean isMap() + { + return false; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.none; + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 0; + } + + /** + * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount + */ + public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) {} + + /** + * Sets the string representing this item's effect on a potion when used as an ingredient. + */ + protected Item setPotionEffect(String par1Str) + { + this.potionEffect = par1Str; + return this; + } + + /** + * Returns a string representing what this item does to a potion. + */ + public String getPotionEffect() + { + return this.potionEffect; + } + + /** + * Returns true if this item serves as a potion ingredient (its ingredient information is not null). + */ + public boolean isPotionIngredient() + { + return this.potionEffect != null; + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {} + + public String getItemDisplayName(ItemStack par1ItemStack) + { + return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(par1ItemStack) + ".name")).trim(); + } + + public boolean hasEffect(ItemStack par1ItemStack) + { + return par1ItemStack.isItemEnchanted(); + } + + /** + * Return an item rarity from EnumRarity + */ + public EnumRarity getRarity(ItemStack par1ItemStack) + { + return par1ItemStack.isItemEnchanted() ? EnumRarity.rare : EnumRarity.common; + } + + /** + * Checks isDamagable and if it cannot be stacked + */ + public boolean isItemTool(ItemStack par1ItemStack) + { + return this.getItemStackLimit() == 1 && this.isDamageable(); + } + + protected MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3) + { + float var4 = 1.0F; + float var5 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4; + float var6 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4; + double var7 = par2EntityPlayer.prevPosX + (par2EntityPlayer.posX - par2EntityPlayer.prevPosX) * (double)var4; + double var9 = par2EntityPlayer.prevPosY + (par2EntityPlayer.posY - par2EntityPlayer.prevPosY) * (double)var4 + 1.62D - (double)par2EntityPlayer.yOffset; + double var11 = par2EntityPlayer.prevPosZ + (par2EntityPlayer.posZ - par2EntityPlayer.prevPosZ) * (double)var4; + Vec3 var13 = par1World.getWorldVec3Pool().getVecFromPool(var7, var9, var11); + float var14 = MathHelper.cos(-var6 * 0.017453292F - (float)Math.PI); + float var15 = MathHelper.sin(-var6 * 0.017453292F - (float)Math.PI); + float var16 = -MathHelper.cos(-var5 * 0.017453292F); + float var17 = MathHelper.sin(-var5 * 0.017453292F); + float var18 = var15 * var16; + float var20 = var14 * var16; + double var21 = 5.0D; + Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21); + return par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3); + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return 0; + } + + public boolean requiresMultipleRenderPasses() + { + return false; + } + + /** + * Gets an icon index based on an item's damage value and the given render pass + */ + public Icon getIconFromDamageForRenderPass(int par1, int par2) + { + return this.getIconFromDamage(par1); + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + } + + /** + * gets the CreativeTab this item is displayed on + */ + public CreativeTabs getCreativeTab() + { + return this.tabToDisplayOn; + } + + /** + * returns this; + */ + public Item setCreativeTab(CreativeTabs par1CreativeTabs) + { + this.tabToDisplayOn = par1CreativeTabs; + return this; + } + + /** + * Returns true if players can use this item to affect the world (e.g. placing blocks, placing ender eyes in portal) + * when not in creative + */ + public boolean canItemEditBlocks() + { + return true; + } + + /** + * Return whether this item is repairable in an anvil. + */ + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) + { + return false; + } + + public void registerIcons(IconRegister par1IconRegister) + { + this.itemIcon = par1IconRegister.registerIcon(this.getIconString()); + } + + /** + * Gets a map of item attribute modifiers, used by ItemSword to increase hit damage. + */ + public Multimap getItemAttributeModifiers() + { + return HashMultimap.create(); + } + + protected Item setTextureName(String par1Str) + { + this.iconString = par1Str; + return this; + } + + /** + * Returns the string associated with this Item's Icon. + */ + protected String getIconString() + { + return this.iconString == null ? "MISSING_ICON_ITEM_" + this.itemID + "_" + this.unlocalizedName : this.iconString; + } + + static + { + StatList.initStats(); + } +} diff --git a/src/main/java/net/minecraft/src/ItemAnvilBlock.java b/src/main/java/net/minecraft/src/ItemAnvilBlock.java new file mode 100644 index 0000000..1b95d09 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemAnvilBlock.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class ItemAnvilBlock extends ItemMultiTextureTile +{ + public ItemAnvilBlock(Block par1Block) + { + super(par1Block.blockID - 256, par1Block, BlockAnvil.statuses); + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + public int getMetadata(int par1) + { + return par1 << 2; + } +} diff --git a/src/main/java/net/minecraft/src/ItemAppleGold.java b/src/main/java/net/minecraft/src/ItemAppleGold.java new file mode 100644 index 0000000..ae4b66f --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemAppleGold.java @@ -0,0 +1,56 @@ +package net.minecraft.src; + +import java.util.List; + +public class ItemAppleGold extends ItemFood +{ + public ItemAppleGold(int par1, int par2, float par3, boolean par4) + { + super(par1, par2, par3, par4); + this.setHasSubtypes(true); + } + + public boolean hasEffect(ItemStack par1ItemStack) + { + return par1ItemStack.getItemDamage() > 0; + } + + /** + * Return an item rarity from EnumRarity + */ + public EnumRarity getRarity(ItemStack par1ItemStack) + { + return par1ItemStack.getItemDamage() == 0 ? EnumRarity.rare : EnumRarity.epic; + } + + protected void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (!par2World.isRemote) + { + par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, 2400, 0)); + } + + if (par1ItemStack.getItemDamage() > 0) + { + if (!par2World.isRemote) + { + par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, 4)); + par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.resistance.id, 6000, 0)); + par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0)); + } + } + else + { + super.onFoodEaten(par1ItemStack, par2World, par3EntityPlayer); + } + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + } +} diff --git a/src/main/java/net/minecraft/src/ItemArmor.java b/src/main/java/net/minecraft/src/ItemArmor.java new file mode 100644 index 0000000..98c2392 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemArmor.java @@ -0,0 +1,238 @@ +package net.minecraft.src; + +public class ItemArmor extends Item +{ + /** Holds the 'base' maxDamage that each armorType have. */ + private static final int[] maxDamageArray = new int[] {11, 16, 15, 13}; + private static final String[] field_94606_cu = new String[] {"leather_helmet_overlay", "leather_chestplate_overlay", "leather_leggings_overlay", "leather_boots_overlay"}; + public static final String[] field_94603_a = new String[] {"empty_armor_slot_helmet", "empty_armor_slot_chestplate", "empty_armor_slot_leggings", "empty_armor_slot_boots"}; + private static final IBehaviorDispenseItem field_96605_cw = new BehaviorDispenseArmor(); + + /** + * Stores the armor type: 0 is helmet, 1 is plate, 2 is legs and 3 is boots + */ + public final int armorType; + + /** Holds the amount of damage that the armor reduces at full durability. */ + public final int damageReduceAmount; + + /** + * Used on RenderPlayer to select the correspondent armor to be rendered on the player: 0 is cloth, 1 is chain, 2 is + * iron, 3 is diamond and 4 is gold. + */ + public final int renderIndex; + + /** The EnumArmorMaterial used for this ItemArmor */ + private final EnumArmorMaterial material; + private Icon field_94605_cw; + private Icon field_94604_cx; + + public ItemArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) + { + super(par1); + this.material = par2EnumArmorMaterial; + this.armorType = par4; + this.renderIndex = par3; + this.damageReduceAmount = par2EnumArmorMaterial.getDamageReductionAmount(par4); + this.setMaxDamage(par2EnumArmorMaterial.getDurability(par4)); + this.maxStackSize = 1; + this.setCreativeTab(CreativeTabs.tabCombat); + BlockDispenser.dispenseBehaviorRegistry.putObject(this, field_96605_cw); + } + + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) + { + if (par2 > 0) + { + return 16777215; + } + else + { + int var3 = this.getColor(par1ItemStack); + + if (var3 < 0) + { + var3 = 16777215; + } + + return var3; + } + } + + public boolean requiresMultipleRenderPasses() + { + return this.material == EnumArmorMaterial.CLOTH; + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return this.material.getEnchantability(); + } + + /** + * Return the armor material for this armor item. + */ + public EnumArmorMaterial getArmorMaterial() + { + return this.material; + } + + /** + * Return whether the specified armor ItemStack has a color. + */ + public boolean hasColor(ItemStack par1ItemStack) + { + return this.material != EnumArmorMaterial.CLOTH ? false : (!par1ItemStack.hasTagCompound() ? false : (!par1ItemStack.getTagCompound().hasKey("display") ? false : par1ItemStack.getTagCompound().getCompoundTag("display").hasKey("color"))); + } + + /** + * Return the color for the specified armor ItemStack. + */ + public int getColor(ItemStack par1ItemStack) + { + if (this.material != EnumArmorMaterial.CLOTH) + { + return -1; + } + else + { + NBTTagCompound var2 = par1ItemStack.getTagCompound(); + + if (var2 == null) + { + return 10511680; + } + else + { + NBTTagCompound var3 = var2.getCompoundTag("display"); + return var3 == null ? 10511680 : (var3.hasKey("color") ? var3.getInteger("color") : 10511680); + } + } + } + + /** + * Gets an icon index based on an item's damage value and the given render pass + */ + public Icon getIconFromDamageForRenderPass(int par1, int par2) + { + return par2 == 1 ? this.field_94605_cw : super.getIconFromDamageForRenderPass(par1, par2); + } + + /** + * Remove the color from the specified armor ItemStack. + */ + public void removeColor(ItemStack par1ItemStack) + { + if (this.material == EnumArmorMaterial.CLOTH) + { + NBTTagCompound var2 = par1ItemStack.getTagCompound(); + + if (var2 != null) + { + NBTTagCompound var3 = var2.getCompoundTag("display"); + + if (var3.hasKey("color")) + { + var3.removeTag("color"); + } + } + } + } + + public void func_82813_b(ItemStack par1ItemStack, int par2) + { + if (this.material != EnumArmorMaterial.CLOTH) + { + throw new UnsupportedOperationException("Can\'t dye non-leather!"); + } + else + { + NBTTagCompound var3 = par1ItemStack.getTagCompound(); + + if (var3 == null) + { + var3 = new NBTTagCompound(); + par1ItemStack.setTagCompound(var3); + } + + NBTTagCompound var4 = var3.getCompoundTag("display"); + + if (!var3.hasKey("display")) + { + var3.setCompoundTag("display", var4); + } + + var4.setInteger("color", par2); + } + } + + /** + * Return whether this item is repairable in an anvil. + */ + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) + { + return this.material.getArmorCraftingMaterial() == par2ItemStack.itemID ? true : super.getIsRepairable(par1ItemStack, par2ItemStack); + } + + public void registerIcons(IconRegister par1IconRegister) + { + super.registerIcons(par1IconRegister); + + if (this.material == EnumArmorMaterial.CLOTH) + { + this.field_94605_cw = par1IconRegister.registerIcon(field_94606_cu[this.armorType]); + } + + this.field_94604_cx = par1IconRegister.registerIcon(field_94603_a[this.armorType]); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + int var4 = EntityLiving.getArmorPosition(par1ItemStack) - 1; + ItemStack var5 = par3EntityPlayer.getCurrentArmor(var4); + + if (var5 == null) + { + par3EntityPlayer.setCurrentItemOrArmor(var4, par1ItemStack.copy()); + par1ItemStack.stackSize = 0; + } + + return par1ItemStack; + } + + public static Icon func_94602_b(int par0) + { + switch (par0) + { + case 0: + return Item.helmetDiamond.field_94604_cx; + + case 1: + return Item.plateDiamond.field_94604_cx; + + case 2: + return Item.legsDiamond.field_94604_cx; + + case 3: + return Item.bootsDiamond.field_94604_cx; + + default: + return null; + } + } + + /** + * Returns the 'max damage' factor array for the armor, each piece of armor have a durability factor (that gets + * multiplied by armor material factor) + */ + static int[] getMaxDamageArray() + { + return maxDamageArray; + } +} diff --git a/src/main/java/net/minecraft/src/ItemAxe.java b/src/main/java/net/minecraft/src/ItemAxe.java new file mode 100644 index 0000000..e49523a --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemAxe.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public class ItemAxe extends ItemTool +{ + /** an array of the blocks this axe is effective against */ + private static Block[] blocksEffectiveAgainst = new Block[] {Block.planks, Block.bookShelf, Block.wood, Block.chest, Block.stoneDoubleSlab, Block.stoneSingleSlab, Block.pumpkin, Block.pumpkinLantern}; + + protected ItemAxe(int par1, EnumToolMaterial par2EnumToolMaterial) + { + super(par1, 3.0F, par2EnumToolMaterial, blocksEffectiveAgainst); + } + + /** + * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if + * sword + */ + public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) + { + return par2Block != null && (par2Block.blockMaterial == Material.wood || par2Block.blockMaterial == Material.plants || par2Block.blockMaterial == Material.vine) ? this.efficiencyOnProperMaterial : super.getStrVsBlock(par1ItemStack, par2Block); + } +} diff --git a/src/main/java/net/minecraft/src/ItemBed.java b/src/main/java/net/minecraft/src/ItemBed.java new file mode 100644 index 0000000..1a37d13 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemBed.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +public class ItemBed extends Item +{ + public ItemBed(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par3World.isRemote) + { + return true; + } + else if (par7 != 1) + { + return false; + } + else + { + ++par5; + BlockBed var11 = (BlockBed)Block.bed; + int var12 = MathHelper.floor_double((double)(par2EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + byte var13 = 0; + byte var14 = 0; + + if (var12 == 0) + { + var14 = 1; + } + + if (var12 == 1) + { + var13 = -1; + } + + if (var12 == 2) + { + var14 = -1; + } + + if (var12 == 3) + { + var13 = 1; + } + + if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4 + var13, par5, par6 + var14, par7, par1ItemStack)) + { + if (par3World.isAirBlock(par4, par5, par6) && par3World.isAirBlock(par4 + var13, par5, par6 + var14) && par3World.doesBlockHaveSolidTopSurface(par4, par5 - 1, par6) && par3World.doesBlockHaveSolidTopSurface(par4 + var13, par5 - 1, par6 + var14)) + { + par3World.setBlock(par4, par5, par6, var11.blockID, var12, 3); + + if (par3World.getBlockId(par4, par5, par6) == var11.blockID) + { + par3World.setBlock(par4 + var13, par5, par6 + var14, var11.blockID, var12 + 8, 3); + } + + --par1ItemStack.stackSize; + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemBlock.java b/src/main/java/net/minecraft/src/ItemBlock.java new file mode 100644 index 0000000..8f64000 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemBlock.java @@ -0,0 +1,213 @@ +package net.minecraft.src; + +import java.util.List; + +public class ItemBlock extends Item +{ + /** The block ID of the Block associated with this ItemBlock */ + private int blockID; + private Icon field_94588_b; + + public ItemBlock(int par1) + { + super(par1); + this.blockID = par1 + 256; + } + + /** + * Returns the blockID for this Item + */ + public int getBlockID() + { + return this.blockID; + } + + /** + * Returns 0 for /terrain.png, 1 for /gui/items.png + */ + public int getSpriteNumber() + { + return Block.blocksList[this.blockID].getItemIconName() != null ? 1 : 0; + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return this.field_94588_b != null ? this.field_94588_b : Block.blocksList[this.blockID].getBlockTextureFromSide(1); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + int var11 = par3World.getBlockId(par4, par5, par6); + + if (var11 == Block.snow.blockID && (par3World.getBlockMetadata(par4, par5, par6) & 7) < 1) + { + par7 = 1; + } + else if (var11 != Block.vine.blockID && var11 != Block.tallGrass.blockID && var11 != Block.deadBush.blockID) + { + if (par7 == 0) + { + --par5; + } + + if (par7 == 1) + { + ++par5; + } + + if (par7 == 2) + { + --par6; + } + + if (par7 == 3) + { + ++par6; + } + + if (par7 == 4) + { + --par4; + } + + if (par7 == 5) + { + ++par4; + } + } + + if (par1ItemStack.stackSize == 0) + { + return false; + } + else if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else if (par5 == 255 && Block.blocksList[this.blockID].blockMaterial.isSolid()) + { + return false; + } + else if (par3World.canPlaceEntityOnSide(this.blockID, par4, par5, par6, false, par7, par2EntityPlayer, par1ItemStack)) + { + Block var12 = Block.blocksList[this.blockID]; + int var13 = this.getMetadata(par1ItemStack.getItemDamage()); + int var14 = Block.blocksList[this.blockID].onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10, var13); + + if (par3World.setBlock(par4, par5, par6, this.blockID, var14, 3)) + { + if (par3World.getBlockId(par4, par5, par6) == this.blockID) + { + Block.blocksList[this.blockID].onBlockPlacedBy(par3World, par4, par5, par6, par2EntityPlayer, par1ItemStack); + Block.blocksList[this.blockID].onPostBlockPlaced(par3World, par4, par5, par6, var14); + } + + par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), var12.stepSound.getPlaceSound(), (var12.stepSound.getVolume() + 1.0F) / 2.0F, var12.stepSound.getPitch() * 0.8F); + --par1ItemStack.stackSize; + } + + return true; + } + else + { + return false; + } + } + + /** + * Returns true if the given ItemBlock can be placed on the given side of the given block position. + */ + public boolean canPlaceItemBlockOnSide(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer, ItemStack par7ItemStack) + { + int var8 = par1World.getBlockId(par2, par3, par4); + + if (var8 == Block.snow.blockID) + { + par5 = 1; + } + else if (var8 != Block.vine.blockID && var8 != Block.tallGrass.blockID && var8 != Block.deadBush.blockID) + { + if (par5 == 0) + { + --par3; + } + + if (par5 == 1) + { + ++par3; + } + + if (par5 == 2) + { + --par4; + } + + if (par5 == 3) + { + ++par4; + } + + if (par5 == 4) + { + --par2; + } + + if (par5 == 5) + { + ++par2; + } + } + + return par1World.canPlaceEntityOnSide(this.getBlockID(), par2, par3, par4, false, par5, (Entity)null, par7ItemStack); + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack par1ItemStack) + { + return Block.blocksList[this.blockID].getUnlocalizedName(); + } + + /** + * Returns the unlocalized name of this item. + */ + public String getUnlocalizedName() + { + return Block.blocksList[this.blockID].getUnlocalizedName(); + } + + /** + * gets the CreativeTab this item is displayed on + */ + public CreativeTabs getCreativeTab() + { + return Block.blocksList[this.blockID].getCreativeTabToDisplayOn(); + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + Block.blocksList[this.blockID].getSubBlocks(par1, par2CreativeTabs, par3List); + } + + public void registerIcons(IconRegister par1IconRegister) + { + String var2 = Block.blocksList[this.blockID].getItemIconName(); + + if (var2 != null) + { + this.field_94588_b = par1IconRegister.registerIcon(var2); + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemBlockWithMetadata.java b/src/main/java/net/minecraft/src/ItemBlockWithMetadata.java new file mode 100644 index 0000000..bd90221 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemBlockWithMetadata.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +public class ItemBlockWithMetadata extends ItemBlock +{ + private Block theBlock; + + public ItemBlockWithMetadata(int par1, Block par2Block) + { + super(par1); + this.theBlock = par2Block; + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return this.theBlock.getIcon(2, par1); + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + public int getMetadata(int par1) + { + return par1; + } +} diff --git a/src/main/java/net/minecraft/src/ItemBoat.java b/src/main/java/net/minecraft/src/ItemBoat.java new file mode 100644 index 0000000..2ebc76b --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemBoat.java @@ -0,0 +1,104 @@ +package net.minecraft.src; + +import java.util.List; + +public class ItemBoat extends Item +{ + public ItemBoat(int par1) + { + super(par1); + this.maxStackSize = 1; + this.setCreativeTab(CreativeTabs.tabTransport); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + float var4 = 1.0F; + float var5 = par3EntityPlayer.prevRotationPitch + (par3EntityPlayer.rotationPitch - par3EntityPlayer.prevRotationPitch) * var4; + float var6 = par3EntityPlayer.prevRotationYaw + (par3EntityPlayer.rotationYaw - par3EntityPlayer.prevRotationYaw) * var4; + double var7 = par3EntityPlayer.prevPosX + (par3EntityPlayer.posX - par3EntityPlayer.prevPosX) * (double)var4; + double var9 = par3EntityPlayer.prevPosY + (par3EntityPlayer.posY - par3EntityPlayer.prevPosY) * (double)var4 + 1.62D - (double)par3EntityPlayer.yOffset; + double var11 = par3EntityPlayer.prevPosZ + (par3EntityPlayer.posZ - par3EntityPlayer.prevPosZ) * (double)var4; + Vec3 var13 = par2World.getWorldVec3Pool().getVecFromPool(var7, var9, var11); + float var14 = MathHelper.cos(-var6 * 0.017453292F - (float)Math.PI); + float var15 = MathHelper.sin(-var6 * 0.017453292F - (float)Math.PI); + float var16 = -MathHelper.cos(-var5 * 0.017453292F); + float var17 = MathHelper.sin(-var5 * 0.017453292F); + float var18 = var15 * var16; + float var20 = var14 * var16; + double var21 = 5.0D; + Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21); + MovingObjectPosition var24 = par2World.clip(var13, var23, true); + + if (var24 == null) + { + return par1ItemStack; + } + else + { + Vec3 var25 = par3EntityPlayer.getLook(var4); + boolean var26 = false; + float var27 = 1.0F; + List var28 = par2World.getEntitiesWithinAABBExcludingEntity(par3EntityPlayer, par3EntityPlayer.boundingBox.addCoord(var25.xCoord * var21, var25.yCoord * var21, var25.zCoord * var21).expand((double)var27, (double)var27, (double)var27)); + int var29; + + for (var29 = 0; var29 < var28.size(); ++var29) + { + Entity var30 = (Entity)var28.get(var29); + + if (var30.canBeCollidedWith()) + { + float var31 = var30.getCollisionBorderSize(); + AxisAlignedBB var32 = var30.boundingBox.expand((double)var31, (double)var31, (double)var31); + + if (var32.isVecInside(var13)) + { + var26 = true; + } + } + } + + if (var26) + { + return par1ItemStack; + } + else + { + if (var24.typeOfHit == EnumMovingObjectType.TILE) + { + var29 = var24.blockX; + int var33 = var24.blockY; + int var34 = var24.blockZ; + + if (par2World.getBlockId(var29, var33, var34) == Block.snow.blockID) + { + --var33; + } + + EntityBoat var35 = new EntityBoat(par2World, (double)((float)var29 + 0.5F), (double)((float)var33 + 1.0F), (double)((float)var34 + 0.5F)); + var35.rotationYaw = (float)(((MathHelper.floor_double((double)(par3EntityPlayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) - 1) * 90); + + if (!par2World.getCollidingBoundingBoxes(var35, var35.boundingBox.expand(-0.1D, -0.1D, -0.1D)).isEmpty()) + { + return par1ItemStack; + } + + if (!par2World.isRemote) + { + par2World.spawnEntityInWorld(var35); + } + + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + } + + return par1ItemStack; + } + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemBook.java b/src/main/java/net/minecraft/src/ItemBook.java new file mode 100644 index 0000000..1c33352 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemBook.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public class ItemBook extends Item +{ + public ItemBook(int par1) + { + super(par1); + } + + /** + * Checks isDamagable and if it cannot be stacked + */ + public boolean isItemTool(ItemStack par1ItemStack) + { + return par1ItemStack.stackSize == 1; + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return 1; + } +} diff --git a/src/main/java/net/minecraft/src/ItemBow.java b/src/main/java/net/minecraft/src/ItemBow.java new file mode 100644 index 0000000..0b7421e --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemBow.java @@ -0,0 +1,144 @@ +package net.minecraft.src; + +public class ItemBow extends Item +{ + public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"}; + private Icon[] iconArray; + + public ItemBow(int par1) + { + super(par1); + this.maxStackSize = 1; + this.setMaxDamage(384); + this.setCreativeTab(CreativeTabs.tabCombat); + } + + /** + * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount + */ + public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) + { + boolean var5 = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; + + if (var5 || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID)) + { + int var6 = this.getMaxItemUseDuration(par1ItemStack) - par4; + float var7 = (float)var6 / 20.0F; + var7 = (var7 * var7 + var7 * 2.0F) / 3.0F; + + if ((double)var7 < 0.1D) + { + return; + } + + if (var7 > 1.0F) + { + var7 = 1.0F; + } + + EntityArrow var8 = new EntityArrow(par2World, par3EntityPlayer, var7 * 2.0F); + + if (var7 == 1.0F) + { + var8.setIsCritical(true); + } + + int var9 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack); + + if (var9 > 0) + { + var8.setDamage(var8.getDamage() + (double)var9 * 0.5D + 0.5D); + } + + int var10 = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack); + + if (var10 > 0) + { + var8.setKnockbackStrength(var10); + } + + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0) + { + var8.setFire(100); + } + + par1ItemStack.damageItem(1, par3EntityPlayer); + par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + var7 * 0.5F); + + if (var5) + { + var8.canBePickedUp = 2; + } + else + { + par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID); + } + + if (!par2World.isRemote) + { + par2World.spawnEntityInWorld(var8); + } + } + } + + public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + return par1ItemStack; + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.bow; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID)) + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + } + + return par1ItemStack; + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return 1; + } + + public void registerIcons(IconRegister par1IconRegister) + { + this.itemIcon = par1IconRegister.registerIcon(this.getIconString() + "_standby"); + this.iconArray = new Icon[bowPullIconNameArray.length]; + + for (int var2 = 0; var2 < this.iconArray.length; ++var2) + { + this.iconArray[var2] = par1IconRegister.registerIcon(this.getIconString() + "_" + bowPullIconNameArray[var2]); + } + } + + /** + * used to cycle through icons based on their used duration, i.e. for the bow + */ + public Icon getItemIconForUseDuration(int par1) + { + return this.iconArray[par1]; + } +} diff --git a/src/main/java/net/minecraft/src/ItemBucket.java b/src/main/java/net/minecraft/src/ItemBucket.java new file mode 100644 index 0000000..54930a1 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemBucket.java @@ -0,0 +1,188 @@ +package net.minecraft.src; + +public class ItemBucket extends Item +{ + /** field for checking if the bucket has been filled. */ + private int isFull; + + public ItemBucket(int par1, int par2) + { + super(par1); + this.maxStackSize = 1; + this.isFull = par2; + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + boolean var4 = this.isFull == 0; + MovingObjectPosition var5 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, var4); + + if (var5 == null) + { + return par1ItemStack; + } + else + { + if (var5.typeOfHit == EnumMovingObjectType.TILE) + { + int var6 = var5.blockX; + int var7 = var5.blockY; + int var8 = var5.blockZ; + + if (!par2World.canMineBlock(par3EntityPlayer, var6, var7, var8)) + { + return par1ItemStack; + } + + if (this.isFull == 0) + { + if (!par3EntityPlayer.canPlayerEdit(var6, var7, var8, var5.sideHit, par1ItemStack)) + { + return par1ItemStack; + } + + if (par2World.getBlockMaterial(var6, var7, var8) == Material.water && par2World.getBlockMetadata(var6, var7, var8) == 0) + { + par2World.setBlockToAir(var6, var7, var8); + + if (par3EntityPlayer.capabilities.isCreativeMode) + { + return par1ItemStack; + } + + if (--par1ItemStack.stackSize <= 0) + { + return new ItemStack(Item.bucketWater); + } + + if (!par3EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.bucketWater))) + { + par3EntityPlayer.dropPlayerItem(new ItemStack(Item.bucketWater.itemID, 1, 0)); + } + + return par1ItemStack; + } + + if (par2World.getBlockMaterial(var6, var7, var8) == Material.lava && par2World.getBlockMetadata(var6, var7, var8) == 0) + { + par2World.setBlockToAir(var6, var7, var8); + + if (par3EntityPlayer.capabilities.isCreativeMode) + { + return par1ItemStack; + } + + if (--par1ItemStack.stackSize <= 0) + { + return new ItemStack(Item.bucketLava); + } + + if (!par3EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.bucketLava))) + { + par3EntityPlayer.dropPlayerItem(new ItemStack(Item.bucketLava.itemID, 1, 0)); + } + + return par1ItemStack; + } + } + else + { + if (this.isFull < 0) + { + return new ItemStack(Item.bucketEmpty); + } + + if (var5.sideHit == 0) + { + --var7; + } + + if (var5.sideHit == 1) + { + ++var7; + } + + if (var5.sideHit == 2) + { + --var8; + } + + if (var5.sideHit == 3) + { + ++var8; + } + + if (var5.sideHit == 4) + { + --var6; + } + + if (var5.sideHit == 5) + { + ++var6; + } + + if (!par3EntityPlayer.canPlayerEdit(var6, var7, var8, var5.sideHit, par1ItemStack)) + { + return par1ItemStack; + } + + if (this.tryPlaceContainedLiquid(par2World, var6, var7, var8) && !par3EntityPlayer.capabilities.isCreativeMode) + { + return new ItemStack(Item.bucketEmpty); + } + } + } + + return par1ItemStack; + } + } + + /** + * Attempts to place the liquid contained inside the bucket. + */ + public boolean tryPlaceContainedLiquid(World par1World, int par2, int par3, int par4) + { + if (this.isFull <= 0) + { + return false; + } + else + { + Material var5 = par1World.getBlockMaterial(par2, par3, par4); + boolean var6 = !var5.isSolid(); + + if (!par1World.isAirBlock(par2, par3, par4) && !var6) + { + return false; + } + else + { + if (par1World.provider.isHellWorld && this.isFull == Block.waterMoving.blockID) + { + par1World.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), "random.fizz", 0.5F, 2.6F + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8F); + + for (int var7 = 0; var7 < 8; ++var7) + { + par1World.spawnParticle("largesmoke", (double)par2 + Math.random(), (double)par3 + Math.random(), (double)par4 + Math.random(), 0.0D, 0.0D, 0.0D); + } + } + else + { + if (!par1World.isRemote && var6 && !var5.isLiquid()) + { + par1World.destroyBlock(par2, par3, par4, true); + } + + par1World.setBlock(par2, par3, par4, this.isFull, 0, 3); + } + + return true; + } + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemBucketMilk.java b/src/main/java/net/minecraft/src/ItemBucketMilk.java new file mode 100644 index 0000000..4a3ac5f --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemBucketMilk.java @@ -0,0 +1,51 @@ +package net.minecraft.src; + +public class ItemBucketMilk extends Item +{ + public ItemBucketMilk(int par1) + { + super(par1); + this.setMaxStackSize(1); + this.setCreativeTab(CreativeTabs.tabMisc); + } + + public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + + if (!par2World.isRemote) + { + par3EntityPlayer.clearActivePotions(); + } + + return par1ItemStack.stackSize <= 0 ? new ItemStack(Item.bucketEmpty) : par1ItemStack; + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 32; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.drink; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } +} diff --git a/src/main/java/net/minecraft/src/ItemCarrotOnAStick.java b/src/main/java/net/minecraft/src/ItemCarrotOnAStick.java new file mode 100644 index 0000000..de8c29d --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemCarrotOnAStick.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +public class ItemCarrotOnAStick extends Item +{ + public ItemCarrotOnAStick(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabTransport); + this.setMaxStackSize(1); + this.setMaxDamage(25); + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return true; + } + + /** + * Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities + * hands. + */ + public boolean shouldRotateAroundWhenRendering() + { + return true; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (par3EntityPlayer.isRiding() && par3EntityPlayer.ridingEntity instanceof EntityPig) + { + EntityPig var4 = (EntityPig)par3EntityPlayer.ridingEntity; + + if (var4.getAIControlledByPlayer().isControlledByPlayer() && par1ItemStack.getMaxDamage() - par1ItemStack.getItemDamage() >= 7) + { + var4.getAIControlledByPlayer().boostSpeed(); + par1ItemStack.damageItem(7, par3EntityPlayer); + + if (par1ItemStack.stackSize == 0) + { + ItemStack var5 = new ItemStack(Item.fishingRod); + var5.setTagCompound(par1ItemStack.stackTagCompound); + return var5; + } + } + } + + return par1ItemStack; + } +} diff --git a/src/main/java/net/minecraft/src/ItemCloth.java b/src/main/java/net/minecraft/src/ItemCloth.java new file mode 100644 index 0000000..318343a --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemCloth.java @@ -0,0 +1,36 @@ +package net.minecraft.src; + +public class ItemCloth extends ItemBlock +{ + public ItemCloth(int par1) + { + super(par1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return Block.cloth.getIcon(2, BlockColored.getBlockFromDye(par1)); + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + public int getMetadata(int par1) + { + return par1; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack par1ItemStack) + { + return super.getUnlocalizedName() + "." + ItemDye.dyeColorNames[BlockColored.getBlockFromDye(par1ItemStack.getItemDamage())]; + } +} diff --git a/src/main/java/net/minecraft/src/ItemCoal.java b/src/main/java/net/minecraft/src/ItemCoal.java new file mode 100644 index 0000000..6b14435 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemCoal.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +import java.util.List; + +public class ItemCoal extends Item +{ + private Icon field_111220_a; + + public ItemCoal(int par1) + { + super(par1); + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setCreativeTab(CreativeTabs.tabMaterials); + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack par1ItemStack) + { + return par1ItemStack.getItemDamage() == 1 ? "item.charcoal" : "item.coal"; + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + par3List.add(new ItemStack(par1, 1, 0)); + par3List.add(new ItemStack(par1, 1, 1)); + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return par1 == 1 ? this.field_111220_a : super.getIconFromDamage(par1); + } + + public void registerIcons(IconRegister par1IconRegister) + { + super.registerIcons(par1IconRegister); + this.field_111220_a = par1IconRegister.registerIcon("charcoal"); + } +} diff --git a/src/main/java/net/minecraft/src/ItemColored.java b/src/main/java/net/minecraft/src/ItemColored.java new file mode 100644 index 0000000..4b7c8fb --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemColored.java @@ -0,0 +1,66 @@ +package net.minecraft.src; + +public class ItemColored extends ItemBlock +{ + private final Block blockRef; + private String[] blockNames; + + public ItemColored(int par1, boolean par2) + { + super(par1); + this.blockRef = Block.blocksList[this.getBlockID()]; + + if (par2) + { + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + } + + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) + { + return this.blockRef.getRenderColor(par1ItemStack.getItemDamage()); + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return this.blockRef.getIcon(0, par1); + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + public int getMetadata(int par1) + { + return par1; + } + + /** + * Sets the array of strings to be used for name lookups from item damage to metadata + */ + public ItemColored setBlockNames(String[] par1ArrayOfStr) + { + this.blockNames = par1ArrayOfStr; + return this; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack par1ItemStack) + { + if (this.blockNames == null) + { + return super.getUnlocalizedName(par1ItemStack); + } + else + { + int var2 = par1ItemStack.getItemDamage(); + return var2 >= 0 && var2 < this.blockNames.length ? super.getUnlocalizedName(par1ItemStack) + "." + this.blockNames[var2] : super.getUnlocalizedName(par1ItemStack); + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemDoor.java b/src/main/java/net/minecraft/src/ItemDoor.java new file mode 100644 index 0000000..2d41ed3 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemDoor.java @@ -0,0 +1,105 @@ +package net.minecraft.src; + +public class ItemDoor extends Item +{ + private Material doorMaterial; + + public ItemDoor(int par1, Material par2Material) + { + super(par1); + this.doorMaterial = par2Material; + this.maxStackSize = 1; + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par7 != 1) + { + return false; + } + else + { + ++par5; + Block var11; + + if (this.doorMaterial == Material.wood) + { + var11 = Block.doorWood; + } + else + { + var11 = Block.doorIron; + } + + if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) + { + if (!var11.canPlaceBlockAt(par3World, par4, par5, par6)) + { + return false; + } + else + { + int var12 = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; + placeDoorBlock(par3World, par4, par5, par6, var12, var11); + --par1ItemStack.stackSize; + return true; + } + } + else + { + return false; + } + } + } + + public static void placeDoorBlock(World par0World, int par1, int par2, int par3, int par4, Block par5Block) + { + byte var6 = 0; + byte var7 = 0; + + if (par4 == 0) + { + var7 = 1; + } + + if (par4 == 1) + { + var6 = -1; + } + + if (par4 == 2) + { + var7 = -1; + } + + if (par4 == 3) + { + var6 = 1; + } + + int var8 = (par0World.isBlockNormalCube(par1 - var6, par2, par3 - var7) ? 1 : 0) + (par0World.isBlockNormalCube(par1 - var6, par2 + 1, par3 - var7) ? 1 : 0); + int var9 = (par0World.isBlockNormalCube(par1 + var6, par2, par3 + var7) ? 1 : 0) + (par0World.isBlockNormalCube(par1 + var6, par2 + 1, par3 + var7) ? 1 : 0); + boolean var10 = par0World.getBlockId(par1 - var6, par2, par3 - var7) == par5Block.blockID || par0World.getBlockId(par1 - var6, par2 + 1, par3 - var7) == par5Block.blockID; + boolean var11 = par0World.getBlockId(par1 + var6, par2, par3 + var7) == par5Block.blockID || par0World.getBlockId(par1 + var6, par2 + 1, par3 + var7) == par5Block.blockID; + boolean var12 = false; + + if (var10 && !var11) + { + var12 = true; + } + else if (var9 > var8) + { + var12 = true; + } + + par0World.setBlock(par1, par2, par3, par5Block.blockID, par4, 2); + par0World.setBlock(par1, par2 + 1, par3, par5Block.blockID, 8 | (var12 ? 1 : 0), 2); + par0World.notifyBlocksOfNeighborChange(par1, par2, par3, par5Block.blockID); + par0World.notifyBlocksOfNeighborChange(par1, par2 + 1, par3, par5Block.blockID); + } +} diff --git a/src/main/java/net/minecraft/src/ItemDye.java b/src/main/java/net/minecraft/src/ItemDye.java new file mode 100644 index 0000000..c8cf71c --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemDye.java @@ -0,0 +1,344 @@ +package net.minecraft.src; + +import java.util.List; + +public class ItemDye extends Item +{ + /** List of dye color names */ + public static final String[] dyeColorNames = new String[] {"black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "gray", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"}; + public static final String[] dyeItemNames = new String[] {"black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "gray", "pink", "lime", "yellow", "light_blue", "magenta", "orange", "white"}; + public static final int[] dyeColors = new int[] {1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320}; + private Icon[] dyeIcons; + + public ItemDye(int par1) + { + super(par1); + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setCreativeTab(CreativeTabs.tabMaterials); + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + int var2 = MathHelper.clamp_int(par1, 0, 15); + return this.dyeIcons[var2]; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack par1ItemStack) + { + int var2 = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 15); + return super.getUnlocalizedName() + "." + dyeColorNames[var2]; + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else + { + if (par1ItemStack.getItemDamage() == 15) + { + if (func_96604_a(par1ItemStack, par3World, par4, par5, par6)) + { + if (!par3World.isRemote) + { + par3World.playAuxSFX(2005, par4, par5, par6, 0); + } + + return true; + } + } + else if (par1ItemStack.getItemDamage() == 3) + { + int var11 = par3World.getBlockId(par4, par5, par6); + int var12 = par3World.getBlockMetadata(par4, par5, par6); + + if (var11 == Block.wood.blockID && BlockLog.limitToValidMetadata(var12) == 3) + { + if (par7 == 0) + { + return false; + } + + if (par7 == 1) + { + return false; + } + + if (par7 == 2) + { + --par6; + } + + if (par7 == 3) + { + ++par6; + } + + if (par7 == 4) + { + --par4; + } + + if (par7 == 5) + { + ++par4; + } + + if (par3World.isAirBlock(par4, par5, par6)) + { + int var13 = Block.blocksList[Block.cocoaPlant.blockID].onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10, 0); + par3World.setBlock(par4, par5, par6, Block.cocoaPlant.blockID, var13, 2); + + if (!par2EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + } + + return true; + } + } + + return false; + } + } + + public static boolean func_96604_a(ItemStack par0ItemStack, World par1World, int par2, int par3, int par4) + { + int var5 = par1World.getBlockId(par2, par3, par4); + + if (var5 == Block.sapling.blockID) + { + if (!par1World.isRemote) + { + if ((double)par1World.rand.nextFloat() < 0.45D) + { + ((BlockSapling)Block.sapling).markOrGrowMarked(par1World, par2, par3, par4, par1World.rand); + } + + --par0ItemStack.stackSize; + } + + return true; + } + else if (var5 != Block.mushroomBrown.blockID && var5 != Block.mushroomRed.blockID) + { + if (var5 != Block.melonStem.blockID && var5 != Block.pumpkinStem.blockID) + { + if (var5 > 0 && Block.blocksList[var5] instanceof BlockCrops) + { + if (par1World.getBlockMetadata(par2, par3, par4) == 7) + { + return false; + } + else + { + if (!par1World.isRemote) + { + ((BlockCrops)Block.blocksList[var5]).fertilize(par1World, par2, par3, par4); + --par0ItemStack.stackSize; + } + + return true; + } + } + else + { + int var6; + int var7; + int var8; + + if (var5 == Block.cocoaPlant.blockID) + { + var6 = par1World.getBlockMetadata(par2, par3, par4); + var7 = BlockDirectional.getDirection(var6); + var8 = BlockCocoa.func_72219_c(var6); + + if (var8 >= 2) + { + return false; + } + else + { + if (!par1World.isRemote) + { + ++var8; + par1World.setBlockMetadataWithNotify(par2, par3, par4, var8 << 2 | var7, 2); + --par0ItemStack.stackSize; + } + + return true; + } + } + else if (var5 != Block.grass.blockID) + { + return false; + } + else + { + if (!par1World.isRemote) + { + --par0ItemStack.stackSize; + label102: + + for (var6 = 0; var6 < 128; ++var6) + { + var7 = par2; + var8 = par3 + 1; + int var9 = par4; + + for (int var10 = 0; var10 < var6 / 16; ++var10) + { + var7 += itemRand.nextInt(3) - 1; + var8 += (itemRand.nextInt(3) - 1) * itemRand.nextInt(3) / 2; + var9 += itemRand.nextInt(3) - 1; + + if (par1World.getBlockId(var7, var8 - 1, var9) != Block.grass.blockID || par1World.isBlockNormalCube(var7, var8, var9)) + { + continue label102; + } + } + + if (par1World.getBlockId(var7, var8, var9) == 0) + { + if (itemRand.nextInt(10) != 0) + { + if (Block.tallGrass.canBlockStay(par1World, var7, var8, var9)) + { + par1World.setBlock(var7, var8, var9, Block.tallGrass.blockID, 1, 3); + } + } + else if (itemRand.nextInt(3) != 0) + { + if (Block.plantYellow.canBlockStay(par1World, var7, var8, var9)) + { + par1World.setBlock(var7, var8, var9, Block.plantYellow.blockID); + } + } + else if (Block.plantRed.canBlockStay(par1World, var7, var8, var9)) + { + par1World.setBlock(var7, var8, var9, Block.plantRed.blockID); + } + } + } + } + + return true; + } + } + } + else if (par1World.getBlockMetadata(par2, par3, par4) == 7) + { + return false; + } + else + { + if (!par1World.isRemote) + { + ((BlockStem)Block.blocksList[var5]).fertilizeStem(par1World, par2, par3, par4); + --par0ItemStack.stackSize; + } + + return true; + } + } + else + { + if (!par1World.isRemote) + { + if ((double)par1World.rand.nextFloat() < 0.4D) + { + ((BlockMushroom)Block.blocksList[var5]).fertilizeMushroom(par1World, par2, par3, par4, par1World.rand); + } + + --par0ItemStack.stackSize; + } + + return true; + } + } + + public static void func_96603_a(World par0World, int par1, int par2, int par3, int par4) + { + int var5 = par0World.getBlockId(par1, par2, par3); + + if (par4 == 0) + { + par4 = 15; + } + + Block var6 = var5 > 0 && var5 < Block.blocksList.length ? Block.blocksList[var5] : null; + + if (var6 != null) + { + var6.setBlockBoundsBasedOnState(par0World, par1, par2, par3); + + for (int var7 = 0; var7 < par4; ++var7) + { + double var8 = itemRand.nextGaussian() * 0.02D; + double var10 = itemRand.nextGaussian() * 0.02D; + double var12 = itemRand.nextGaussian() * 0.02D; + par0World.spawnParticle("happyVillager", (double)((float)par1 + itemRand.nextFloat()), (double)par2 + (double)itemRand.nextFloat() * var6.getBlockBoundsMaxY(), (double)((float)par3 + itemRand.nextFloat()), var8, var10, var12); + } + } + } + + /** + * Returns true if the item can be used on the given entity, e.g. shears on sheep. + */ + public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase) + { + if (par3EntityLivingBase instanceof EntitySheep) + { + EntitySheep var4 = (EntitySheep)par3EntityLivingBase; + int var5 = BlockColored.getBlockFromDye(par1ItemStack.getItemDamage()); + + if (!var4.getSheared() && var4.getFleeceColor() != var5) + { + var4.setFleeceColor(var5); + --par1ItemStack.stackSize; + } + + return true; + } + else + { + return false; + } + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + for (int var4 = 0; var4 < 16; ++var4) + { + par3List.add(new ItemStack(par1, 1, var4)); + } + } + + public void registerIcons(IconRegister par1IconRegister) + { + this.dyeIcons = new Icon[dyeItemNames.length]; + + for (int var2 = 0; var2 < dyeItemNames.length; ++var2) + { + this.dyeIcons[var2] = par1IconRegister.registerIcon(this.getIconString() + "_" + dyeItemNames[var2]); + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemEditableBook.java b/src/main/java/net/minecraft/src/ItemEditableBook.java new file mode 100644 index 0000000..14f667b --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemEditableBook.java @@ -0,0 +1,84 @@ +package net.minecraft.src; + +import java.util.List; + +public class ItemEditableBook extends Item +{ + public ItemEditableBook(int par1) + { + super(par1); + this.setMaxStackSize(1); + } + + public static boolean validBookTagContents(NBTTagCompound par0NBTTagCompound) + { + if (!ItemWritableBook.validBookTagPages(par0NBTTagCompound)) + { + return false; + } + else if (!par0NBTTagCompound.hasKey("title")) + { + return false; + } + else + { + String var1 = par0NBTTagCompound.getString("title"); + return var1 != null && var1.length() <= 16 ? par0NBTTagCompound.hasKey("author") : false; + } + } + + public String getItemDisplayName(ItemStack par1ItemStack) + { + if (par1ItemStack.hasTagCompound()) + { + NBTTagCompound var2 = par1ItemStack.getTagCompound(); + NBTTagString var3 = (NBTTagString)var2.getTag("title"); + + if (var3 != null) + { + return var3.toString(); + } + } + + return super.getItemDisplayName(par1ItemStack); + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) + { + if (par1ItemStack.hasTagCompound()) + { + NBTTagCompound var5 = par1ItemStack.getTagCompound(); + NBTTagString var6 = (NBTTagString)var5.getTag("author"); + + if (var6 != null) + { + par3List.add(EnumChatFormatting.GRAY + String.format(StatCollector.translateToLocalFormatted("book.byAuthor", new Object[] {var6.data}), new Object[0])); + } + } + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + par3EntityPlayer.displayGUIBook(par1ItemStack); + return par1ItemStack; + } + + /** + * If this function returns true (or the item is damageable), the ItemStack's NBT tag will be sent to the client. + */ + public boolean getShareTag() + { + return true; + } + + public boolean hasEffect(ItemStack par1ItemStack) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ItemEgg.java b/src/main/java/net/minecraft/src/ItemEgg.java new file mode 100644 index 0000000..e0e18ae --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemEgg.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +public class ItemEgg extends Item +{ + public ItemEgg(int par1) + { + super(par1); + this.maxStackSize = 16; + this.setCreativeTab(CreativeTabs.tabMaterials); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + + par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!par2World.isRemote) + { + par2World.spawnEntityInWorld(new EntityEgg(par2World, par3EntityPlayer)); + } + + return par1ItemStack; + } +} diff --git a/src/main/java/net/minecraft/src/ItemEmptyMap.java b/src/main/java/net/minecraft/src/ItemEmptyMap.java new file mode 100644 index 0000000..eee4413 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemEmptyMap.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +public class ItemEmptyMap extends ItemMapBase +{ + protected ItemEmptyMap(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + ItemStack var4 = new ItemStack(Item.map, 1, par2World.getUniqueDataId("map")); + String var5 = "map_" + var4.getItemDamage(); + MapData var6 = new MapData(var5); + par2World.setItemData(var5, var6); + var6.scale = 0; + int var7 = 128 * (1 << var6.scale); + var6.xCenter = (int)(Math.round(par3EntityPlayer.posX / (double)var7) * (long)var7); + var6.zCenter = (int)(Math.round(par3EntityPlayer.posZ / (double)var7) * (long)var7); + var6.dimension = (byte)par2World.provider.dimensionId; + var6.markDirty(); + --par1ItemStack.stackSize; + + if (par1ItemStack.stackSize <= 0) + { + return var4; + } + else + { + if (!par3EntityPlayer.inventory.addItemStackToInventory(var4.copy())) + { + par3EntityPlayer.dropPlayerItem(var4); + } + + return par1ItemStack; + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemEnchantedBook.java b/src/main/java/net/minecraft/src/ItemEnchantedBook.java new file mode 100644 index 0000000..ff88f62 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemEnchantedBook.java @@ -0,0 +1,133 @@ +package net.minecraft.src; + +import java.util.List; +import java.util.Random; + +public class ItemEnchantedBook extends Item +{ + public ItemEnchantedBook(int par1) + { + super(par1); + } + + public boolean hasEffect(ItemStack par1ItemStack) + { + return true; + } + + /** + * Checks isDamagable and if it cannot be stacked + */ + public boolean isItemTool(ItemStack par1ItemStack) + { + return false; + } + + /** + * Return an item rarity from EnumRarity + */ + public EnumRarity getRarity(ItemStack par1ItemStack) + { + return this.func_92110_g(par1ItemStack).tagCount() > 0 ? EnumRarity.uncommon : super.getRarity(par1ItemStack); + } + + public NBTTagList func_92110_g(ItemStack par1ItemStack) + { + return par1ItemStack.stackTagCompound != null && par1ItemStack.stackTagCompound.hasKey("StoredEnchantments") ? (NBTTagList)par1ItemStack.stackTagCompound.getTag("StoredEnchantments") : new NBTTagList(); + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) + { + super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4); + NBTTagList var5 = this.func_92110_g(par1ItemStack); + + if (var5 != null) + { + for (int var6 = 0; var6 < var5.tagCount(); ++var6) + { + short var7 = ((NBTTagCompound)var5.tagAt(var6)).getShort("id"); + short var8 = ((NBTTagCompound)var5.tagAt(var6)).getShort("lvl"); + + if (Enchantment.enchantmentsList[var7] != null) + { + par3List.add(Enchantment.enchantmentsList[var7].getTranslatedName(var8)); + } + } + } + } + + /** + * Adds an stored enchantment to an enchanted book ItemStack + */ + public void addEnchantment(ItemStack par1ItemStack, EnchantmentData par2EnchantmentData) + { + NBTTagList var3 = this.func_92110_g(par1ItemStack); + boolean var4 = true; + + for (int var5 = 0; var5 < var3.tagCount(); ++var5) + { + NBTTagCompound var6 = (NBTTagCompound)var3.tagAt(var5); + + if (var6.getShort("id") == par2EnchantmentData.enchantmentobj.effectId) + { + if (var6.getShort("lvl") < par2EnchantmentData.enchantmentLevel) + { + var6.setShort("lvl", (short)par2EnchantmentData.enchantmentLevel); + } + + var4 = false; + break; + } + } + + if (var4) + { + NBTTagCompound var7 = new NBTTagCompound(); + var7.setShort("id", (short)par2EnchantmentData.enchantmentobj.effectId); + var7.setShort("lvl", (short)par2EnchantmentData.enchantmentLevel); + var3.appendTag(var7); + } + + if (!par1ItemStack.hasTagCompound()) + { + par1ItemStack.setTagCompound(new NBTTagCompound()); + } + + par1ItemStack.getTagCompound().setTag("StoredEnchantments", var3); + } + + /** + * Returns the ItemStack of an enchanted version of this item. + */ + public ItemStack getEnchantedItemStack(EnchantmentData par1EnchantmentData) + { + ItemStack var2 = new ItemStack(this); + this.addEnchantment(var2, par1EnchantmentData); + return var2; + } + + public void func_92113_a(Enchantment par1Enchantment, List par2List) + { + for (int var3 = par1Enchantment.getMinLevel(); var3 <= par1Enchantment.getMaxLevel(); ++var3) + { + par2List.add(this.getEnchantedItemStack(new EnchantmentData(par1Enchantment, var3))); + } + } + + public WeightedRandomChestContent func_92114_b(Random par1Random) + { + return this.func_92112_a(par1Random, 1, 1, 1); + } + + public WeightedRandomChestContent func_92112_a(Random par1Random, int par2, int par3, int par4) + { + Enchantment var5 = Enchantment.enchantmentsBookList[par1Random.nextInt(Enchantment.enchantmentsBookList.length)]; + ItemStack var6 = new ItemStack(this.itemID, 1, 0); + int var7 = MathHelper.getRandomIntegerInRange(par1Random, var5.getMinLevel(), var5.getMaxLevel()); + this.addEnchantment(var6, new EnchantmentData(var5, var7)); + return new WeightedRandomChestContent(var6, par2, par3, par4); + } +} diff --git a/src/main/java/net/minecraft/src/ItemEnderEye.java b/src/main/java/net/minecraft/src/ItemEnderEye.java new file mode 100644 index 0000000..cf44fd8 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemEnderEye.java @@ -0,0 +1,182 @@ +package net.minecraft.src; + +public class ItemEnderEye extends Item +{ + public ItemEnderEye(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + int var11 = par3World.getBlockId(par4, par5, par6); + int var12 = par3World.getBlockMetadata(par4, par5, par6); + + if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && var11 == Block.endPortalFrame.blockID && !BlockEndPortalFrame.isEnderEyeInserted(var12)) + { + if (par3World.isRemote) + { + return true; + } + else + { + par3World.setBlockMetadataWithNotify(par4, par5, par6, var12 + 4, 2); + par3World.func_96440_m(par4, par5, par6, Block.endPortalFrame.blockID); + --par1ItemStack.stackSize; + int var13; + + for (var13 = 0; var13 < 16; ++var13) + { + double var14 = (double)((float)par4 + (5.0F + itemRand.nextFloat() * 6.0F) / 16.0F); + double var16 = (double)((float)par5 + 0.8125F); + double var18 = (double)((float)par6 + (5.0F + itemRand.nextFloat() * 6.0F) / 16.0F); + double var20 = 0.0D; + double var22 = 0.0D; + double var24 = 0.0D; + par3World.spawnParticle("smoke", var14, var16, var18, var20, var22, var24); + } + + var13 = var12 & 3; + int var26 = 0; + int var15 = 0; + boolean var27 = false; + boolean var17 = true; + int var28 = Direction.rotateRight[var13]; + int var19; + int var21; + int var23; + int var29; + int var30; + + for (var19 = -2; var19 <= 2; ++var19) + { + var29 = par4 + Direction.offsetX[var28] * var19; + var21 = par6 + Direction.offsetZ[var28] * var19; + var30 = par3World.getBlockId(var29, par5, var21); + + if (var30 == Block.endPortalFrame.blockID) + { + var23 = par3World.getBlockMetadata(var29, par5, var21); + + if (!BlockEndPortalFrame.isEnderEyeInserted(var23)) + { + var17 = false; + break; + } + + var15 = var19; + + if (!var27) + { + var26 = var19; + var27 = true; + } + } + } + + if (var17 && var15 == var26 + 2) + { + for (var19 = var26; var19 <= var15; ++var19) + { + var29 = par4 + Direction.offsetX[var28] * var19; + var21 = par6 + Direction.offsetZ[var28] * var19; + var29 += Direction.offsetX[var13] * 4; + var21 += Direction.offsetZ[var13] * 4; + var30 = par3World.getBlockId(var29, par5, var21); + var23 = par3World.getBlockMetadata(var29, par5, var21); + + if (var30 != Block.endPortalFrame.blockID || !BlockEndPortalFrame.isEnderEyeInserted(var23)) + { + var17 = false; + break; + } + } + + for (var19 = var26 - 1; var19 <= var15 + 1; var19 += 4) + { + for (var29 = 1; var29 <= 3; ++var29) + { + var21 = par4 + Direction.offsetX[var28] * var19; + var30 = par6 + Direction.offsetZ[var28] * var19; + var21 += Direction.offsetX[var13] * var29; + var30 += Direction.offsetZ[var13] * var29; + var23 = par3World.getBlockId(var21, par5, var30); + int var31 = par3World.getBlockMetadata(var21, par5, var30); + + if (var23 != Block.endPortalFrame.blockID || !BlockEndPortalFrame.isEnderEyeInserted(var31)) + { + var17 = false; + break; + } + } + } + + if (var17) + { + for (var19 = var26; var19 <= var15; ++var19) + { + for (var29 = 1; var29 <= 3; ++var29) + { + var21 = par4 + Direction.offsetX[var28] * var19; + var30 = par6 + Direction.offsetZ[var28] * var19; + var21 += Direction.offsetX[var13] * var29; + var30 += Direction.offsetZ[var13] * var29; + par3World.setBlock(var21, par5, var30, Block.endPortal.blockID, 0, 2); + } + } + } + } + + return true; + } + } + else + { + return false; + } + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + MovingObjectPosition var4 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false); + + if (var4 != null && var4.typeOfHit == EnumMovingObjectType.TILE) + { + int var5 = par2World.getBlockId(var4.blockX, var4.blockY, var4.blockZ); + + if (var5 == Block.endPortalFrame.blockID) + { + return par1ItemStack; + } + } + + if (!par2World.isRemote) + { + ChunkPosition var7 = par2World.findClosestStructure("Stronghold", (int)par3EntityPlayer.posX, (int)par3EntityPlayer.posY, (int)par3EntityPlayer.posZ); + + if (var7 != null) + { + EntityEnderEye var6 = new EntityEnderEye(par2World, par3EntityPlayer.posX, par3EntityPlayer.posY + 1.62D - (double)par3EntityPlayer.yOffset, par3EntityPlayer.posZ); + var6.moveTowards((double)var7.x, var7.y, (double)var7.z); + par2World.spawnEntityInWorld(var6); + par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + par2World.playAuxSFXAtEntity((EntityPlayer)null, 1002, (int)par3EntityPlayer.posX, (int)par3EntityPlayer.posY, (int)par3EntityPlayer.posZ, 0); + + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + } + } + + return par1ItemStack; + } +} diff --git a/src/main/java/net/minecraft/src/ItemEnderPearl.java b/src/main/java/net/minecraft/src/ItemEnderPearl.java new file mode 100644 index 0000000..1f0d484 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemEnderPearl.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +public class ItemEnderPearl extends Item +{ + public ItemEnderPearl(int par1) + { + super(par1); + this.maxStackSize = 16; + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (par3EntityPlayer.capabilities.isCreativeMode) + { + return par1ItemStack; + } + else + { + --par1ItemStack.stackSize; + par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!par2World.isRemote) + { + par2World.spawnEntityInWorld(new EntityEnderPearl(par2World, par3EntityPlayer)); + } + + return par1ItemStack; + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemExpBottle.java b/src/main/java/net/minecraft/src/ItemExpBottle.java new file mode 100644 index 0000000..f071f0c --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemExpBottle.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +public class ItemExpBottle extends Item +{ + public ItemExpBottle(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabMisc); + } + + public boolean hasEffect(ItemStack par1ItemStack) + { + return true; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + + par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!par2World.isRemote) + { + par2World.spawnEntityInWorld(new EntityExpBottle(par2World, par3EntityPlayer)); + } + + return par1ItemStack; + } +} diff --git a/src/main/java/net/minecraft/src/ItemFireball.java b/src/main/java/net/minecraft/src/ItemFireball.java new file mode 100644 index 0000000..1c44411 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemFireball.java @@ -0,0 +1,76 @@ +package net.minecraft.src; + +public class ItemFireball extends Item +{ + public ItemFireball(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par3World.isRemote) + { + return true; + } + else + { + if (par7 == 0) + { + --par5; + } + + if (par7 == 1) + { + ++par5; + } + + if (par7 == 2) + { + --par6; + } + + if (par7 == 3) + { + ++par6; + } + + if (par7 == 4) + { + --par4; + } + + if (par7 == 5) + { + ++par4; + } + + if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else + { + int var11 = par3World.getBlockId(par4, par5, par6); + + if (var11 == 0) + { + par3World.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + par3World.setBlock(par4, par5, par6, Block.fire.blockID); + } + + if (!par2EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + + return true; + } + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemFirework.java b/src/main/java/net/minecraft/src/ItemFirework.java new file mode 100644 index 0000000..17cfa1f --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemFirework.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class ItemFirework extends Item +{ + public ItemFirework(int par1) + { + super(par1); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (!par3World.isRemote) + { + EntityFireworkRocket var11 = new EntityFireworkRocket(par3World, (double)((float)par4 + par8), (double)((float)par5 + par9), (double)((float)par6 + par10), par1ItemStack); + par3World.spawnEntityInWorld(var11); + + if (!par2EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + + return true; + } + else + { + return false; + } + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) + { + if (par1ItemStack.hasTagCompound()) + { + NBTTagCompound var5 = par1ItemStack.getTagCompound().getCompoundTag("Fireworks"); + + if (var5 != null) + { + if (var5.hasKey("Flight")) + { + par3List.add(StatCollector.translateToLocal("item.fireworks.flight") + " " + var5.getByte("Flight")); + } + + NBTTagList var6 = var5.getTagList("Explosions"); + + if (var6 != null && var6.tagCount() > 0) + { + for (int var7 = 0; var7 < var6.tagCount(); ++var7) + { + NBTTagCompound var8 = (NBTTagCompound)var6.tagAt(var7); + ArrayList var9 = new ArrayList(); + ItemFireworkCharge.func_92107_a(var8, var9); + + if (var9.size() > 0) + { + for (int var10 = 1; var10 < var9.size(); ++var10) + { + var9.set(var10, " " + (String)var9.get(var10)); + } + + par3List.addAll(var9); + } + } + } + } + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemFireworkCharge.java b/src/main/java/net/minecraft/src/ItemFireworkCharge.java new file mode 100644 index 0000000..f178c99 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemFireworkCharge.java @@ -0,0 +1,221 @@ +package net.minecraft.src; + +import java.util.List; + +public class ItemFireworkCharge extends Item +{ + private Icon theIcon; + + public ItemFireworkCharge(int par1) + { + super(par1); + } + + /** + * Gets an icon index based on an item's damage value and the given render pass + */ + public Icon getIconFromDamageForRenderPass(int par1, int par2) + { + return par2 > 0 ? this.theIcon : super.getIconFromDamageForRenderPass(par1, par2); + } + + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) + { + if (par2 != 1) + { + return super.getColorFromItemStack(par1ItemStack, par2); + } + else + { + NBTBase var3 = func_92108_a(par1ItemStack, "Colors"); + + if (var3 == null) + { + return 9079434; + } + else + { + NBTTagIntArray var4 = (NBTTagIntArray)var3; + + if (var4.intArray.length == 1) + { + return var4.intArray[0]; + } + else + { + int var5 = 0; + int var6 = 0; + int var7 = 0; + int[] var8 = var4.intArray; + int var9 = var8.length; + + for (int var10 = 0; var10 < var9; ++var10) + { + int var11 = var8[var10]; + var5 += (var11 & 16711680) >> 16; + var6 += (var11 & 65280) >> 8; + var7 += (var11 & 255) >> 0; + } + + var5 /= var4.intArray.length; + var6 /= var4.intArray.length; + var7 /= var4.intArray.length; + return var5 << 16 | var6 << 8 | var7; + } + } + } + } + + public boolean requiresMultipleRenderPasses() + { + return true; + } + + public static NBTBase func_92108_a(ItemStack par0ItemStack, String par1Str) + { + if (par0ItemStack.hasTagCompound()) + { + NBTTagCompound var2 = par0ItemStack.getTagCompound().getCompoundTag("Explosion"); + + if (var2 != null) + { + return var2.getTag(par1Str); + } + } + + return null; + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) + { + if (par1ItemStack.hasTagCompound()) + { + NBTTagCompound var5 = par1ItemStack.getTagCompound().getCompoundTag("Explosion"); + + if (var5 != null) + { + func_92107_a(var5, par3List); + } + } + } + + public static void func_92107_a(NBTTagCompound par0NBTTagCompound, List par1List) + { + byte var2 = par0NBTTagCompound.getByte("Type"); + + if (var2 >= 0 && var2 <= 4) + { + par1List.add(StatCollector.translateToLocal("item.fireworksCharge.type." + var2).trim()); + } + else + { + par1List.add(StatCollector.translateToLocal("item.fireworksCharge.type").trim()); + } + + int[] var3 = par0NBTTagCompound.getIntArray("Colors"); + int var8; + int var9; + + if (var3.length > 0) + { + boolean var4 = true; + String var5 = ""; + int[] var6 = var3; + int var7 = var3.length; + + for (var8 = 0; var8 < var7; ++var8) + { + var9 = var6[var8]; + + if (!var4) + { + var5 = var5 + ", "; + } + + var4 = false; + boolean var10 = false; + + for (int var11 = 0; var11 < 16; ++var11) + { + if (var9 == ItemDye.dyeColors[var11]) + { + var10 = true; + var5 = var5 + StatCollector.translateToLocal("item.fireworksCharge." + ItemDye.dyeColorNames[var11]); + break; + } + } + + if (!var10) + { + var5 = var5 + StatCollector.translateToLocal("item.fireworksCharge.customColor"); + } + } + + par1List.add(var5); + } + + int[] var13 = par0NBTTagCompound.getIntArray("FadeColors"); + boolean var15; + + if (var13.length > 0) + { + var15 = true; + String var14 = StatCollector.translateToLocal("item.fireworksCharge.fadeTo") + " "; + int[] var16 = var13; + var8 = var13.length; + + for (var9 = 0; var9 < var8; ++var9) + { + int var18 = var16[var9]; + + if (!var15) + { + var14 = var14 + ", "; + } + + var15 = false; + boolean var19 = false; + + for (int var12 = 0; var12 < 16; ++var12) + { + if (var18 == ItemDye.dyeColors[var12]) + { + var19 = true; + var14 = var14 + StatCollector.translateToLocal("item.fireworksCharge." + ItemDye.dyeColorNames[var12]); + break; + } + } + + if (!var19) + { + var14 = var14 + StatCollector.translateToLocal("item.fireworksCharge.customColor"); + } + } + + par1List.add(var14); + } + + var15 = par0NBTTagCompound.getBoolean("Trail"); + + if (var15) + { + par1List.add(StatCollector.translateToLocal("item.fireworksCharge.trail")); + } + + boolean var17 = par0NBTTagCompound.getBoolean("Flicker"); + + if (var17) + { + par1List.add(StatCollector.translateToLocal("item.fireworksCharge.flicker")); + } + } + + public void registerIcons(IconRegister par1IconRegister) + { + super.registerIcons(par1IconRegister); + this.theIcon = par1IconRegister.registerIcon(this.getIconString() + "_overlay"); + } +} diff --git a/src/main/java/net/minecraft/src/ItemFishingRod.java b/src/main/java/net/minecraft/src/ItemFishingRod.java new file mode 100644 index 0000000..a4f538f --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemFishingRod.java @@ -0,0 +1,68 @@ +package net.minecraft.src; + +public class ItemFishingRod extends Item +{ + private Icon theIcon; + + public ItemFishingRod(int par1) + { + super(par1); + this.setMaxDamage(64); + this.setMaxStackSize(1); + this.setCreativeTab(CreativeTabs.tabTools); + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return true; + } + + /** + * Returns true if this item should be rotated by 180 degrees around the Y axis when being held in an entities + * hands. + */ + public boolean shouldRotateAroundWhenRendering() + { + return true; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (par3EntityPlayer.fishEntity != null) + { + int var4 = par3EntityPlayer.fishEntity.catchFish(); + par1ItemStack.damageItem(var4, par3EntityPlayer); + par3EntityPlayer.swingItem(); + } + else + { + par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!par2World.isRemote) + { + par2World.spawnEntityInWorld(new EntityFishHook(par2World, par3EntityPlayer)); + } + + par3EntityPlayer.swingItem(); + } + + return par1ItemStack; + } + + public void registerIcons(IconRegister par1IconRegister) + { + this.itemIcon = par1IconRegister.registerIcon(this.getIconString() + "_uncast"); + this.theIcon = par1IconRegister.registerIcon(this.getIconString() + "_cast"); + } + + public Icon func_94597_g() + { + return this.theIcon; + } +} diff --git a/src/main/java/net/minecraft/src/ItemFlintAndSteel.java b/src/main/java/net/minecraft/src/ItemFlintAndSteel.java new file mode 100644 index 0000000..a6363db --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemFlintAndSteel.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +public class ItemFlintAndSteel extends Item +{ + public ItemFlintAndSteel(int par1) + { + super(par1); + this.maxStackSize = 1; + this.setMaxDamage(64); + this.setCreativeTab(CreativeTabs.tabTools); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par7 == 0) + { + --par5; + } + + if (par7 == 1) + { + ++par5; + } + + if (par7 == 2) + { + --par6; + } + + if (par7 == 3) + { + ++par6; + } + + if (par7 == 4) + { + --par4; + } + + if (par7 == 5) + { + ++par4; + } + + if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else + { + int var11 = par3World.getBlockId(par4, par5, par6); + + if (var11 == 0) + { + par3World.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + par3World.setBlock(par4, par5, par6, Block.fire.blockID); + } + + par1ItemStack.damageItem(1, par2EntityPlayer); + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemFood.java b/src/main/java/net/minecraft/src/ItemFood.java new file mode 100644 index 0000000..65029eb --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemFood.java @@ -0,0 +1,137 @@ +package net.minecraft.src; + +public class ItemFood extends Item +{ + /** Number of ticks to run while 'EnumAction'ing until result. */ + public final int itemUseDuration; + + /** The amount this food item heals the player. */ + private final int healAmount; + private final float saturationModifier; + + /** Whether wolves like this food (true for raw and cooked porkchop). */ + private final boolean isWolfsFavoriteMeat; + + /** + * If this field is true, the food can be consumed even if the player don't need to eat. + */ + private boolean alwaysEdible; + + /** + * represents the potion effect that will occurr upon eating this food. Set by setPotionEffect + */ + private int potionId; + + /** set by setPotionEffect */ + private int potionDuration; + + /** set by setPotionEffect */ + private int potionAmplifier; + + /** probably of the set potion effect occurring */ + private float potionEffectProbability; + + public ItemFood(int par1, int par2, float par3, boolean par4) + { + super(par1); + this.itemUseDuration = 32; + this.healAmount = par2; + this.isWolfsFavoriteMeat = par4; + this.saturationModifier = par3; + this.setCreativeTab(CreativeTabs.tabFood); + } + + public ItemFood(int par1, int par2, boolean par3) + { + this(par1, par2, 0.6F, par3); + } + + public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + --par1ItemStack.stackSize; + par3EntityPlayer.getFoodStats().addStats(this); + par2World.playSoundAtEntity(par3EntityPlayer, "random.burp", 0.5F, par2World.rand.nextFloat() * 0.1F + 0.9F); + this.onFoodEaten(par1ItemStack, par2World, par3EntityPlayer); + return par1ItemStack; + } + + protected void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (!par2World.isRemote && this.potionId > 0 && par2World.rand.nextFloat() < this.potionEffectProbability) + { + par3EntityPlayer.addPotionEffect(new PotionEffect(this.potionId, this.potionDuration * 20, this.potionAmplifier)); + } + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 32; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.eat; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (par3EntityPlayer.canEat(this.alwaysEdible)) + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + } + + return par1ItemStack; + } + + public int getHealAmount() + { + return this.healAmount; + } + + /** + * gets the saturationModifier of the ItemFood + */ + public float getSaturationModifier() + { + return this.saturationModifier; + } + + /** + * Whether wolves like this food (true for raw and cooked porkchop). + */ + public boolean isWolfsFavoriteMeat() + { + return this.isWolfsFavoriteMeat; + } + + /** + * sets a potion effect on the item. Args: int potionId, int duration (will be multiplied by 20), int amplifier, + * float probability of effect happening + */ + public ItemFood setPotionEffect(int par1, int par2, int par3, float par4) + { + this.potionId = par1; + this.potionDuration = par2; + this.potionAmplifier = par3; + this.potionEffectProbability = par4; + return this; + } + + /** + * Set the field 'alwaysEdible' to true, and make the food edible even if the player don't need to eat. + */ + public ItemFood setAlwaysEdible() + { + this.alwaysEdible = true; + return this; + } +} diff --git a/src/main/java/net/minecraft/src/ItemGlassBottle.java b/src/main/java/net/minecraft/src/ItemGlassBottle.java new file mode 100644 index 0000000..0fe07e7 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemGlassBottle.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +public class ItemGlassBottle extends Item +{ + public ItemGlassBottle(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabBrewing); + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return Item.potion.getIconFromDamage(0); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + MovingObjectPosition var4 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); + + if (var4 == null) + { + return par1ItemStack; + } + else + { + if (var4.typeOfHit == EnumMovingObjectType.TILE) + { + int var5 = var4.blockX; + int var6 = var4.blockY; + int var7 = var4.blockZ; + + if (!par2World.canMineBlock(par3EntityPlayer, var5, var6, var7)) + { + return par1ItemStack; + } + + if (!par3EntityPlayer.canPlayerEdit(var5, var6, var7, var4.sideHit, par1ItemStack)) + { + return par1ItemStack; + } + + if (par2World.getBlockMaterial(var5, var6, var7) == Material.water) + { + --par1ItemStack.stackSize; + + if (par1ItemStack.stackSize <= 0) + { + return new ItemStack(Item.potion); + } + + if (!par3EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.potion))) + { + par3EntityPlayer.dropPlayerItem(new ItemStack(Item.potion.itemID, 1, 0)); + } + } + } + + return par1ItemStack; + } + } + + public void registerIcons(IconRegister par1IconRegister) {} +} diff --git a/src/main/java/net/minecraft/src/ItemHangingEntity.java b/src/main/java/net/minecraft/src/ItemHangingEntity.java new file mode 100644 index 0000000..761f593 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemHangingEntity.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +public class ItemHangingEntity extends Item +{ + private final Class hangingEntityClass; + + public ItemHangingEntity(int par1, Class par2Class) + { + super(par1); + this.hangingEntityClass = par2Class; + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par7 == 0) + { + return false; + } + else if (par7 == 1) + { + return false; + } + else + { + int var11 = Direction.facingToDirection[par7]; + EntityHanging var12 = this.createHangingEntity(par3World, par4, par5, par6, var11); + + if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else + { + if (var12 != null && var12.onValidSurface()) + { + if (!par3World.isRemote) + { + par3World.spawnEntityInWorld(var12); + } + + --par1ItemStack.stackSize; + } + + return true; + } + } + } + + /** + * Create the hanging entity associated to this item. + */ + private EntityHanging createHangingEntity(World par1World, int par2, int par3, int par4, int par5) + { + return (EntityHanging)(this.hangingEntityClass == EntityPainting.class ? new EntityPainting(par1World, par2, par3, par4, par5) : (this.hangingEntityClass == EntityItemFrame.class ? new EntityItemFrame(par1World, par2, par3, par4, par5) : null)); + } +} diff --git a/src/main/java/net/minecraft/src/ItemHoe.java b/src/main/java/net/minecraft/src/ItemHoe.java new file mode 100644 index 0000000..aafa0c6 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemHoe.java @@ -0,0 +1,70 @@ +package net.minecraft.src; + +public class ItemHoe extends Item +{ + protected EnumToolMaterial theToolMaterial; + + public ItemHoe(int par1, EnumToolMaterial par2EnumToolMaterial) + { + super(par1); + this.theToolMaterial = par2EnumToolMaterial; + this.maxStackSize = 1; + this.setMaxDamage(par2EnumToolMaterial.getMaxUses()); + this.setCreativeTab(CreativeTabs.tabTools); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else + { + int var11 = par3World.getBlockId(par4, par5, par6); + int var12 = par3World.getBlockId(par4, par5 + 1, par6); + + if (par7 != 0 && var12 == 0 && (var11 == Block.grass.blockID || var11 == Block.dirt.blockID)) + { + Block var13 = Block.tilledField; + par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), var13.stepSound.getStepSound(), (var13.stepSound.getVolume() + 1.0F) / 2.0F, var13.stepSound.getPitch() * 0.8F); + + if (par3World.isRemote) + { + return true; + } + else + { + par3World.setBlock(par4, par5, par6, var13.blockID); + par1ItemStack.damageItem(1, par2EntityPlayer); + return true; + } + } + else + { + return false; + } + } + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return true; + } + + /** + * Returns the name of the material this tool is made from as it is declared in EnumToolMaterial (meaning diamond + * would return "EMERALD") + */ + public String getMaterialName() + { + return this.theToolMaterial.toString(); + } +} diff --git a/src/main/java/net/minecraft/src/ItemInWorldManager.java b/src/main/java/net/minecraft/src/ItemInWorldManager.java new file mode 100644 index 0000000..7b74daf --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemInWorldManager.java @@ -0,0 +1,375 @@ +package net.minecraft.src; + +public class ItemInWorldManager +{ + /** The world object that this object is connected to. */ + public World theWorld; + + /** The EntityPlayerMP object that this object is connected to. */ + public EntityPlayerMP thisPlayerMP; + private EnumGameType gameType; + + /** True if the player is destroying a block */ + private boolean isDestroyingBlock; + private int initialDamage; + private int partiallyDestroyedBlockX; + private int partiallyDestroyedBlockY; + private int partiallyDestroyedBlockZ; + private int curblockDamage; + + /** + * Set to true when the "finished destroying block" packet is received but the block wasn't fully damaged yet. The + * block will not be destroyed while this is false. + */ + private boolean receivedFinishDiggingPacket; + private int posX; + private int posY; + private int posZ; + private int field_73093_n; + private int durabilityRemainingOnBlock; + + public ItemInWorldManager(World par1World) + { + this.gameType = EnumGameType.NOT_SET; + this.durabilityRemainingOnBlock = -1; + this.theWorld = par1World; + } + + public void setGameType(EnumGameType par1EnumGameType) + { + this.gameType = par1EnumGameType; + par1EnumGameType.configurePlayerCapabilities(this.thisPlayerMP.capabilities); + this.thisPlayerMP.sendPlayerAbilities(); + } + + public EnumGameType getGameType() + { + return this.gameType; + } + + /** + * Get if we are in creative game mode. + */ + public boolean isCreative() + { + return this.gameType.isCreative(); + } + + /** + * if the gameType is currently NOT_SET then change it to par1 + */ + public void initializeGameType(EnumGameType par1EnumGameType) + { + if (this.gameType == EnumGameType.NOT_SET) + { + this.gameType = par1EnumGameType; + } + + this.setGameType(this.gameType); + } + + public void updateBlockRemoving() + { + ++this.curblockDamage; + int var1; + float var4; + int var5; + + if (this.receivedFinishDiggingPacket) + { + var1 = this.curblockDamage - this.field_73093_n; + int var2 = this.theWorld.getBlockId(this.posX, this.posY, this.posZ); + + if (var2 == 0) + { + this.receivedFinishDiggingPacket = false; + } + else + { + Block var3 = Block.blocksList[var2]; + var4 = var3.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.posX, this.posY, this.posZ) * (float)(var1 + 1); + var5 = (int)(var4 * 10.0F); + + if (var5 != this.durabilityRemainingOnBlock) + { + this.theWorld.destroyBlockInWorldPartially(this.thisPlayerMP.entityId, this.posX, this.posY, this.posZ, var5); + this.durabilityRemainingOnBlock = var5; + } + + if (var4 >= 1.0F) + { + this.receivedFinishDiggingPacket = false; + this.tryHarvestBlock(this.posX, this.posY, this.posZ); + } + } + } + else if (this.isDestroyingBlock) + { + var1 = this.theWorld.getBlockId(this.partiallyDestroyedBlockX, this.partiallyDestroyedBlockY, this.partiallyDestroyedBlockZ); + Block var6 = Block.blocksList[var1]; + + if (var6 == null) + { + this.theWorld.destroyBlockInWorldPartially(this.thisPlayerMP.entityId, this.partiallyDestroyedBlockX, this.partiallyDestroyedBlockY, this.partiallyDestroyedBlockZ, -1); + this.durabilityRemainingOnBlock = -1; + this.isDestroyingBlock = false; + } + else + { + int var7 = this.curblockDamage - this.initialDamage; + var4 = var6.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, this.partiallyDestroyedBlockX, this.partiallyDestroyedBlockY, this.partiallyDestroyedBlockZ) * (float)(var7 + 1); + var5 = (int)(var4 * 10.0F); + + if (var5 != this.durabilityRemainingOnBlock) + { + this.theWorld.destroyBlockInWorldPartially(this.thisPlayerMP.entityId, this.partiallyDestroyedBlockX, this.partiallyDestroyedBlockY, this.partiallyDestroyedBlockZ, var5); + this.durabilityRemainingOnBlock = var5; + } + } + } + } + + /** + * if not creative, it calls destroyBlockInWorldPartially untill the block is broken first. par4 is the specific + * side. tryHarvestBlock can also be the result of this call + */ + public void onBlockClicked(int par1, int par2, int par3, int par4) + { + if (!this.gameType.isAdventure() || this.thisPlayerMP.isCurrentToolAdventureModeExempt(par1, par2, par3)) + { + if (this.isCreative()) + { + if (!this.theWorld.extinguishFire((EntityPlayer)null, par1, par2, par3, par4)) + { + this.tryHarvestBlock(par1, par2, par3); + } + } + else + { + this.theWorld.extinguishFire((EntityPlayer)null, par1, par2, par3, par4); + this.initialDamage = this.curblockDamage; + float var5 = 1.0F; + int var6 = this.theWorld.getBlockId(par1, par2, par3); + + if (var6 > 0) + { + Block.blocksList[var6].onBlockClicked(this.theWorld, par1, par2, par3, this.thisPlayerMP); + var5 = Block.blocksList[var6].getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, par1, par2, par3); + } + + if (var6 > 0 && var5 >= 1.0F) + { + this.tryHarvestBlock(par1, par2, par3); + } + else + { + this.isDestroyingBlock = true; + this.partiallyDestroyedBlockX = par1; + this.partiallyDestroyedBlockY = par2; + this.partiallyDestroyedBlockZ = par3; + int var7 = (int)(var5 * 10.0F); + this.theWorld.destroyBlockInWorldPartially(this.thisPlayerMP.entityId, par1, par2, par3, var7); + this.durabilityRemainingOnBlock = var7; + } + } + } + } + + public void uncheckedTryHarvestBlock(int par1, int par2, int par3) + { + if (par1 == this.partiallyDestroyedBlockX && par2 == this.partiallyDestroyedBlockY && par3 == this.partiallyDestroyedBlockZ) + { + int var4 = this.curblockDamage - this.initialDamage; + int var5 = this.theWorld.getBlockId(par1, par2, par3); + + if (var5 != 0) + { + Block var6 = Block.blocksList[var5]; + float var7 = var6.getPlayerRelativeBlockHardness(this.thisPlayerMP, this.thisPlayerMP.worldObj, par1, par2, par3) * (float)(var4 + 1); + + if (var7 >= 0.7F) + { + this.isDestroyingBlock = false; + this.theWorld.destroyBlockInWorldPartially(this.thisPlayerMP.entityId, par1, par2, par3, -1); + this.tryHarvestBlock(par1, par2, par3); + } + else if (!this.receivedFinishDiggingPacket) + { + this.isDestroyingBlock = false; + this.receivedFinishDiggingPacket = true; + this.posX = par1; + this.posY = par2; + this.posZ = par3; + this.field_73093_n = this.initialDamage; + } + } + } + } + + /** + * note: this ignores the pars passed in and continues to destroy the onClickedBlock + */ + public void cancelDestroyingBlock(int par1, int par2, int par3) + { + this.isDestroyingBlock = false; + this.theWorld.destroyBlockInWorldPartially(this.thisPlayerMP.entityId, this.partiallyDestroyedBlockX, this.partiallyDestroyedBlockY, this.partiallyDestroyedBlockZ, -1); + } + + /** + * Removes a block and triggers the appropriate events + */ + private boolean removeBlock(int par1, int par2, int par3) + { + Block var4 = Block.blocksList[this.theWorld.getBlockId(par1, par2, par3)]; + int var5 = this.theWorld.getBlockMetadata(par1, par2, par3); + + if (var4 != null) + { + var4.onBlockHarvested(this.theWorld, par1, par2, par3, var5, this.thisPlayerMP); + } + + boolean var6 = this.theWorld.setBlockToAir(par1, par2, par3); + + if (var4 != null && var6) + { + var4.onBlockDestroyedByPlayer(this.theWorld, par1, par2, par3, var5); + } + + return var6; + } + + /** + * Attempts to harvest a block at the given coordinate + */ + public boolean tryHarvestBlock(int par1, int par2, int par3) + { + if (this.gameType.isAdventure() && !this.thisPlayerMP.isCurrentToolAdventureModeExempt(par1, par2, par3)) + { + return false; + } + else if (this.gameType.isCreative() && this.thisPlayerMP.getHeldItem() != null && this.thisPlayerMP.getHeldItem().getItem() instanceof ItemSword) + { + return false; + } + else + { + int var4 = this.theWorld.getBlockId(par1, par2, par3); + int var5 = this.theWorld.getBlockMetadata(par1, par2, par3); + this.theWorld.playAuxSFXAtEntity(this.thisPlayerMP, 2001, par1, par2, par3, var4 + (this.theWorld.getBlockMetadata(par1, par2, par3) << 12)); + boolean var6 = this.removeBlock(par1, par2, par3); + + if (this.isCreative()) + { + this.thisPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(par1, par2, par3, this.theWorld)); + } + else + { + ItemStack var7 = this.thisPlayerMP.getCurrentEquippedItem(); + boolean var8 = this.thisPlayerMP.canHarvestBlock(Block.blocksList[var4]); + + if (var7 != null) + { + var7.onBlockDestroyed(this.theWorld, var4, par1, par2, par3, this.thisPlayerMP); + + if (var7.stackSize == 0) + { + this.thisPlayerMP.destroyCurrentEquippedItem(); + } + } + + if (var6 && var8) + { + Block.blocksList[var4].harvestBlock(this.theWorld, this.thisPlayerMP, par1, par2, par3, var5); + } + } + + return var6; + } + } + + /** + * Attempts to right-click use an item by the given EntityPlayer in the given World + */ + public boolean tryUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack) + { + int var4 = par3ItemStack.stackSize; + int var5 = par3ItemStack.getItemDamage(); + ItemStack var6 = par3ItemStack.useItemRightClick(par2World, par1EntityPlayer); + + if (var6 == par3ItemStack && (var6 == null || var6.stackSize == var4 && var6.getMaxItemUseDuration() <= 0 && var6.getItemDamage() == var5)) + { + return false; + } + else + { + par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = var6; + + if (this.isCreative()) + { + var6.stackSize = var4; + + if (var6.isItemStackDamageable()) + { + var6.setItemDamage(var5); + } + } + + if (var6.stackSize == 0) + { + par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null; + } + + if (!par1EntityPlayer.isUsingItem()) + { + ((EntityPlayerMP)par1EntityPlayer).sendContainerToPlayer(par1EntityPlayer.inventoryContainer); + } + + return true; + } + } + + /** + * Activate the clicked on block, otherwise use the held item. Args: player, world, itemStack, x, y, z, side, + * xOffset, yOffset, zOffset + */ + public boolean activateBlockOrUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + int var11; + + if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) + { + var11 = par2World.getBlockId(par4, par5, par6); + + if (var11 > 0 && Block.blocksList[var11].onBlockActivated(par2World, par4, par5, par6, par1EntityPlayer, par7, par8, par9, par10)) + { + return true; + } + } + + if (par3ItemStack == null) + { + return false; + } + else if (this.isCreative()) + { + var11 = par3ItemStack.getItemDamage(); + int var12 = par3ItemStack.stackSize; + boolean var13 = par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, par8, par9, par10); + par3ItemStack.setItemDamage(var11); + par3ItemStack.stackSize = var12; + return var13; + } + else + { + return par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, par8, par9, par10); + } + } + + /** + * Sets the world instance. + */ + public void setWorld(WorldServer par1WorldServer) + { + this.theWorld = par1WorldServer; + } +} diff --git a/src/main/java/net/minecraft/src/ItemLeash.java b/src/main/java/net/minecraft/src/ItemLeash.java new file mode 100644 index 0000000..dc6ad38 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemLeash.java @@ -0,0 +1,70 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class ItemLeash extends Item +{ + public ItemLeash(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabTools); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + int var11 = par3World.getBlockId(par4, par5, par6); + + if (Block.blocksList[var11] != null && Block.blocksList[var11].getRenderType() == 11) + { + if (par3World.isRemote) + { + return true; + } + else + { + func_135066_a(par2EntityPlayer, par3World, par4, par5, par6); + return true; + } + } + else + { + return false; + } + } + + public static boolean func_135066_a(EntityPlayer par0EntityPlayer, World par1World, int par2, int par3, int par4) + { + EntityLeashKnot var5 = EntityLeashKnot.getKnotForBlock(par1World, par2, par3, par4); + boolean var6 = false; + double var7 = 7.0D; + List var9 = par1World.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getAABBPool().getAABB((double)par2 - var7, (double)par3 - var7, (double)par4 - var7, (double)par2 + var7, (double)par3 + var7, (double)par4 + var7)); + + if (var9 != null) + { + Iterator var10 = var9.iterator(); + + while (var10.hasNext()) + { + EntityLiving var11 = (EntityLiving)var10.next(); + + if (var11.getLeashed() && var11.getLeashedToEntity() == par0EntityPlayer) + { + if (var5 == null) + { + var5 = EntityLeashKnot.func_110129_a(par1World, par2, par3, par4); + } + + var11.setLeashedToEntity(var5, true); + var6 = true; + } + } + } + + return var6; + } +} diff --git a/src/main/java/net/minecraft/src/ItemLeaves.java b/src/main/java/net/minecraft/src/ItemLeaves.java new file mode 100644 index 0000000..04b4063 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemLeaves.java @@ -0,0 +1,49 @@ +package net.minecraft.src; + +public class ItemLeaves extends ItemBlock +{ + public ItemLeaves(int par1) + { + super(par1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + public int getMetadata(int par1) + { + return par1 | 4; + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return Block.leaves.getIcon(0, par1); + } + + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) + { + int var3 = par1ItemStack.getItemDamage(); + return (var3 & 1) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((var3 & 2) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack par1ItemStack) + { + int var2 = par1ItemStack.getItemDamage(); + + if (var2 < 0 || var2 >= BlockLeaves.LEAF_TYPES.length) + { + var2 = 0; + } + + return super.getUnlocalizedName() + "." + BlockLeaves.LEAF_TYPES[var2]; + } +} diff --git a/src/main/java/net/minecraft/src/ItemLilyPad.java b/src/main/java/net/minecraft/src/ItemLilyPad.java new file mode 100644 index 0000000..4e6744d --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemLilyPad.java @@ -0,0 +1,58 @@ +package net.minecraft.src; + +public class ItemLilyPad extends ItemColored +{ + public ItemLilyPad(int par1) + { + super(par1, false); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + MovingObjectPosition var4 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); + + if (var4 == null) + { + return par1ItemStack; + } + else + { + if (var4.typeOfHit == EnumMovingObjectType.TILE) + { + int var5 = var4.blockX; + int var6 = var4.blockY; + int var7 = var4.blockZ; + + if (!par2World.canMineBlock(par3EntityPlayer, var5, var6, var7)) + { + return par1ItemStack; + } + + if (!par3EntityPlayer.canPlayerEdit(var5, var6, var7, var4.sideHit, par1ItemStack)) + { + return par1ItemStack; + } + + if (par2World.getBlockMaterial(var5, var6, var7) == Material.water && par2World.getBlockMetadata(var5, var6, var7) == 0 && par2World.isAirBlock(var5, var6 + 1, var7)) + { + par2World.setBlock(var5, var6 + 1, var7, Block.waterlily.blockID); + + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + } + } + + return par1ItemStack; + } + } + + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) + { + return Block.waterlily.getRenderColor(par1ItemStack.getItemDamage()); + } +} diff --git a/src/main/java/net/minecraft/src/ItemMap.java b/src/main/java/net/minecraft/src/ItemMap.java new file mode 100644 index 0000000..6f2cd3d --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemMap.java @@ -0,0 +1,342 @@ +package net.minecraft.src; + +import java.util.List; + +public class ItemMap extends ItemMapBase +{ + protected ItemMap(int par1) + { + super(par1); + this.setHasSubtypes(true); + } + + public static MapData getMPMapData(short par0, World par1World) + { + String var2 = "map_" + par0; + MapData var3 = (MapData)par1World.loadItemData(MapData.class, var2); + + if (var3 == null) + { + var3 = new MapData(var2); + par1World.setItemData(var2, var3); + } + + return var3; + } + + public MapData getMapData(ItemStack par1ItemStack, World par2World) + { + String var3 = "map_" + par1ItemStack.getItemDamage(); + MapData var4 = (MapData)par2World.loadItemData(MapData.class, var3); + + if (var4 == null && !par2World.isRemote) + { + par1ItemStack.setItemDamage(par2World.getUniqueDataId("map")); + var3 = "map_" + par1ItemStack.getItemDamage(); + var4 = new MapData(var3); + var4.scale = 3; + int var5 = 128 * (1 << var4.scale); + var4.xCenter = Math.round((float)par2World.getWorldInfo().getSpawnX() / (float)var5) * var5; + var4.zCenter = Math.round((float)(par2World.getWorldInfo().getSpawnZ() / var5)) * var5; + var4.dimension = (byte)par2World.provider.dimensionId; + var4.markDirty(); + par2World.setItemData(var3, var4); + } + + return var4; + } + + public void updateMapData(World par1World, Entity par2Entity, MapData par3MapData) + { + if (par1World.provider.dimensionId == par3MapData.dimension && par2Entity instanceof EntityPlayer) + { + short var4 = 128; + short var5 = 128; + int var6 = 1 << par3MapData.scale; + int var7 = par3MapData.xCenter; + int var8 = par3MapData.zCenter; + int var9 = MathHelper.floor_double(par2Entity.posX - (double)var7) / var6 + var4 / 2; + int var10 = MathHelper.floor_double(par2Entity.posZ - (double)var8) / var6 + var5 / 2; + int var11 = 128 / var6; + + if (par1World.provider.hasNoSky) + { + var11 /= 2; + } + + MapInfo var12 = par3MapData.func_82568_a((EntityPlayer)par2Entity); + ++var12.field_82569_d; + + for (int var13 = var9 - var11 + 1; var13 < var9 + var11; ++var13) + { + if ((var13 & 15) == (var12.field_82569_d & 15)) + { + int var14 = 255; + int var15 = 0; + double var16 = 0.0D; + + for (int var18 = var10 - var11 - 1; var18 < var10 + var11; ++var18) + { + if (var13 >= 0 && var18 >= -1 && var13 < var4 && var18 < var5) + { + int var19 = var13 - var9; + int var20 = var18 - var10; + boolean var21 = var19 * var19 + var20 * var20 > (var11 - 2) * (var11 - 2); + int var22 = (var7 / var6 + var13 - var4 / 2) * var6; + int var23 = (var8 / var6 + var18 - var5 / 2) * var6; + int[] var24 = new int[256]; + Chunk var25 = par1World.getChunkFromBlockCoords(var22, var23); + + if (!var25.isEmpty()) + { + int var26 = var22 & 15; + int var27 = var23 & 15; + int var28 = 0; + double var29 = 0.0D; + int var31; + int var32; + int var33; + int var36; + + if (par1World.provider.hasNoSky) + { + var31 = var22 + var23 * 231871; + var31 = var31 * var31 * 31287121 + var31 * 11; + + if ((var31 >> 20 & 1) == 0) + { + var24[Block.dirt.blockID] += 10; + } + else + { + var24[Block.stone.blockID] += 10; + } + + var29 = 100.0D; + } + else + { + for (var31 = 0; var31 < var6; ++var31) + { + for (var32 = 0; var32 < var6; ++var32) + { + var33 = var25.getHeightValue(var31 + var26, var32 + var27) + 1; + int var34 = 0; + + if (var33 > 1) + { + boolean var35; + + do + { + var35 = true; + var34 = var25.getBlockID(var31 + var26, var33 - 1, var32 + var27); + + if (var34 == 0) + { + var35 = false; + } + else if (var33 > 0 && var34 > 0 && Block.blocksList[var34].blockMaterial.materialMapColor == MapColor.airColor) + { + var35 = false; + } + + if (!var35) + { + --var33; + + if (var33 <= 0) + { + break; + } + + var34 = var25.getBlockID(var31 + var26, var33 - 1, var32 + var27); + } + } + while (var33 > 0 && !var35); + + if (var33 > 0 && var34 != 0 && Block.blocksList[var34].blockMaterial.isLiquid()) + { + var36 = var33 - 1; + boolean var37 = false; + int var41; + + do + { + var41 = var25.getBlockID(var31 + var26, var36--, var32 + var27); + ++var28; + } + while (var36 > 0 && var41 != 0 && Block.blocksList[var41].blockMaterial.isLiquid()); + } + } + + var29 += (double)var33 / (double)(var6 * var6); + ++var24[var34]; + } + } + } + + var28 /= var6 * var6; + var31 = 0; + var32 = 0; + + for (var33 = 0; var33 < 256; ++var33) + { + if (var24[var33] > var31) + { + var32 = var33; + var31 = var24[var33]; + } + } + + double var39 = (var29 - var16) * 4.0D / (double)(var6 + 4) + ((double)(var13 + var18 & 1) - 0.5D) * 0.4D; + byte var40 = 1; + + if (var39 > 0.6D) + { + var40 = 2; + } + + if (var39 < -0.6D) + { + var40 = 0; + } + + var36 = 0; + + if (var32 > 0) + { + MapColor var42 = Block.blocksList[var32].blockMaterial.materialMapColor; + + if (var42 == MapColor.waterColor) + { + var39 = (double)var28 * 0.1D + (double)(var13 + var18 & 1) * 0.2D; + var40 = 1; + + if (var39 < 0.5D) + { + var40 = 2; + } + + if (var39 > 0.9D) + { + var40 = 0; + } + } + + var36 = var42.colorIndex; + } + + var16 = var29; + + if (var18 >= 0 && var19 * var19 + var20 * var20 < var11 * var11 && (!var21 || (var13 + var18 & 1) != 0)) + { + byte var43 = par3MapData.colors[var13 + var18 * var4]; + byte var38 = (byte)(var36 * 4 + var40); + + if (var43 != var38) + { + if (var14 > var18) + { + var14 = var18; + } + + if (var15 < var18) + { + var15 = var18; + } + + par3MapData.colors[var13 + var18 * var4] = var38; + } + } + } + } + } + + if (var14 <= var15) + { + par3MapData.setColumnDirty(var13, var14, var15); + } + } + } + } + } + + /** + * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and + * update it's contents. + */ + public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) + { + if (!par2World.isRemote) + { + MapData var6 = this.getMapData(par1ItemStack, par2World); + + if (par3Entity instanceof EntityPlayer) + { + EntityPlayer var7 = (EntityPlayer)par3Entity; + var6.updateVisiblePlayers(var7, par1ItemStack); + } + + if (par5) + { + this.updateMapData(par2World, par3Entity, var6); + } + } + } + + /** + * returns null if no update is to be sent + */ + public Packet createMapDataPacket(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + byte[] var4 = this.getMapData(par1ItemStack, par2World).getUpdatePacketData(par1ItemStack, par2World, par3EntityPlayer); + return var4 == null ? null : new Packet131MapData((short)Item.map.itemID, (short)par1ItemStack.getItemDamage(), var4); + } + + /** + * Called when item is crafted/smelted. Used only by maps so far. + */ + public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().getBoolean("map_is_scaling")) + { + MapData var4 = Item.map.getMapData(par1ItemStack, par2World); + par1ItemStack.setItemDamage(par2World.getUniqueDataId("map")); + MapData var5 = new MapData("map_" + par1ItemStack.getItemDamage()); + var5.scale = (byte)(var4.scale + 1); + + if (var5.scale > 4) + { + var5.scale = 4; + } + + var5.xCenter = var4.xCenter; + var5.zCenter = var4.zCenter; + var5.dimension = var4.dimension; + var5.markDirty(); + par2World.setItemData("map_" + par1ItemStack.getItemDamage(), var5); + } + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) + { + MapData var5 = this.getMapData(par1ItemStack, par2EntityPlayer.worldObj); + + if (par4) + { + if (var5 == null) + { + par3List.add("Unknown map"); + } + else + { + par3List.add("Scaling at 1:" + (1 << var5.scale)); + par3List.add("(Level " + var5.scale + "/" + 4 + ")"); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemMapBase.java b/src/main/java/net/minecraft/src/ItemMapBase.java new file mode 100644 index 0000000..92c7352 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemMapBase.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public class ItemMapBase extends Item +{ + protected ItemMapBase(int par1) + { + super(par1); + } + + /** + * false for all Items except sub-classes of ItemMapBase + */ + public boolean isMap() + { + return true; + } + + /** + * returns null if no update is to be sent + */ + public Packet createMapDataPacket(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + return null; + } +} diff --git a/src/main/java/net/minecraft/src/ItemMinecart.java b/src/main/java/net/minecraft/src/ItemMinecart.java new file mode 100644 index 0000000..0548fe5 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemMinecart.java @@ -0,0 +1,47 @@ +package net.minecraft.src; + +public class ItemMinecart extends Item +{ + private static final IBehaviorDispenseItem dispenserMinecartBehavior = new BehaviorDispenseMinecart(); + public int minecartType; + + public ItemMinecart(int par1, int par2) + { + super(par1); + this.maxStackSize = 1; + this.minecartType = par2; + this.setCreativeTab(CreativeTabs.tabTransport); + BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserMinecartBehavior); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + int var11 = par3World.getBlockId(par4, par5, par6); + + if (BlockRailBase.isRailBlock(var11)) + { + if (!par3World.isRemote) + { + EntityMinecart var12 = EntityMinecart.createMinecart(par3World, (double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), this.minecartType); + + if (par1ItemStack.hasDisplayName()) + { + var12.setMinecartName(par1ItemStack.getDisplayName()); + } + + par3World.spawnEntityInWorld(var12); + } + + --par1ItemStack.stackSize; + return true; + } + else + { + return false; + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemMonsterPlacer.java b/src/main/java/net/minecraft/src/ItemMonsterPlacer.java new file mode 100644 index 0000000..91538d7 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemMonsterPlacer.java @@ -0,0 +1,203 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.List; + +public class ItemMonsterPlacer extends Item +{ + private Icon theIcon; + + public ItemMonsterPlacer(int par1) + { + super(par1); + this.setHasSubtypes(true); + this.setCreativeTab(CreativeTabs.tabMisc); + } + + public String getItemDisplayName(ItemStack par1ItemStack) + { + String var2 = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); + String var3 = EntityList.getStringFromID(par1ItemStack.getItemDamage()); + + if (var3 != null) + { + var2 = var2 + " " + StatCollector.translateToLocal("entity." + var3 + ".name"); + } + + return var2; + } + + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) + { + EntityEggInfo var3 = (EntityEggInfo)EntityList.entityEggs.get(Integer.valueOf(par1ItemStack.getItemDamage())); + return var3 != null ? (par2 == 0 ? var3.primaryColor : var3.secondaryColor) : 16777215; + } + + public boolean requiresMultipleRenderPasses() + { + return true; + } + + /** + * Gets an icon index based on an item's damage value and the given render pass + */ + public Icon getIconFromDamageForRenderPass(int par1, int par2) + { + return par2 > 0 ? this.theIcon : super.getIconFromDamageForRenderPass(par1, par2); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par3World.isRemote) + { + return true; + } + else + { + int var11 = par3World.getBlockId(par4, par5, par6); + par4 += Facing.offsetsXForSide[par7]; + par5 += Facing.offsetsYForSide[par7]; + par6 += Facing.offsetsZForSide[par7]; + double var12 = 0.0D; + + if (par7 == 1 && Block.blocksList[var11] != null && Block.blocksList[var11].getRenderType() == 11) + { + var12 = 0.5D; + } + + Entity var14 = spawnCreature(par3World, par1ItemStack.getItemDamage(), (double)par4 + 0.5D, (double)par5 + var12, (double)par6 + 0.5D); + + if (var14 != null) + { + if (var14 instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) + { + ((EntityLiving)var14).setCustomNameTag(par1ItemStack.getDisplayName()); + } + + if (!par2EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + } + + return true; + } + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (par2World.isRemote) + { + return par1ItemStack; + } + else + { + MovingObjectPosition var4 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); + + if (var4 == null) + { + return par1ItemStack; + } + else + { + if (var4.typeOfHit == EnumMovingObjectType.TILE) + { + int var5 = var4.blockX; + int var6 = var4.blockY; + int var7 = var4.blockZ; + + if (!par2World.canMineBlock(par3EntityPlayer, var5, var6, var7)) + { + return par1ItemStack; + } + + if (!par3EntityPlayer.canPlayerEdit(var5, var6, var7, var4.sideHit, par1ItemStack)) + { + return par1ItemStack; + } + + if (par2World.getBlockMaterial(var5, var6, var7) == Material.water) + { + Entity var8 = spawnCreature(par2World, par1ItemStack.getItemDamage(), (double)var5, (double)var6, (double)var7); + + if (var8 != null) + { + if (var8 instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) + { + ((EntityLiving)var8).setCustomNameTag(par1ItemStack.getDisplayName()); + } + + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + } + } + } + + return par1ItemStack; + } + } + } + + /** + * Spawns the creature specified by the egg's type in the location specified by the last three parameters. + * Parameters: world, entityID, x, y, z. + */ + public static Entity spawnCreature(World par0World, int par1, double par2, double par4, double par6) + { + if (!EntityList.entityEggs.containsKey(Integer.valueOf(par1))) + { + return null; + } + else + { + Entity var8 = null; + + for (int var9 = 0; var9 < 1; ++var9) + { + var8 = EntityList.createEntityByID(par1, par0World); + + if (var8 != null && var8 instanceof EntityLivingBase) + { + EntityLiving var10 = (EntityLiving)var8; + var8.setLocationAndAngles(par2, par4, par6, MathHelper.wrapAngleTo180_float(par0World.rand.nextFloat() * 360.0F), 0.0F); + var10.rotationYawHead = var10.rotationYaw; + var10.renderYawOffset = var10.rotationYaw; + var10.onSpawnWithEgg((EntityLivingData)null); + par0World.spawnEntityInWorld(var8); + var10.playLivingSound(); + } + } + + return var8; + } + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + Iterator var4 = EntityList.entityEggs.values().iterator(); + + while (var4.hasNext()) + { + EntityEggInfo var5 = (EntityEggInfo)var4.next(); + par3List.add(new ItemStack(par1, 1, var5.spawnedID)); + } + } + + public void registerIcons(IconRegister par1IconRegister) + { + super.registerIcons(par1IconRegister); + this.theIcon = par1IconRegister.registerIcon(this.getIconString() + "_overlay"); + } +} diff --git a/src/main/java/net/minecraft/src/ItemMultiTextureTile.java b/src/main/java/net/minecraft/src/ItemMultiTextureTile.java new file mode 100644 index 0000000..7049fee --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemMultiTextureTile.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +public class ItemMultiTextureTile extends ItemBlock +{ + private final Block theBlock; + private final String[] field_82804_b; + + public ItemMultiTextureTile(int par1, Block par2Block, String[] par3ArrayOfStr) + { + super(par1); + this.theBlock = par2Block; + this.field_82804_b = par3ArrayOfStr; + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return this.theBlock.getIcon(2, par1); + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + public int getMetadata(int par1) + { + return par1; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack par1ItemStack) + { + int var2 = par1ItemStack.getItemDamage(); + + if (var2 < 0 || var2 >= this.field_82804_b.length) + { + var2 = 0; + } + + return super.getUnlocalizedName() + "." + this.field_82804_b[var2]; + } +} diff --git a/src/main/java/net/minecraft/src/ItemNameTag.java b/src/main/java/net/minecraft/src/ItemNameTag.java new file mode 100644 index 0000000..ebff1c5 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemNameTag.java @@ -0,0 +1,33 @@ +package net.minecraft.src; + +public class ItemNameTag extends Item +{ + public ItemNameTag(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabTools); + } + + /** + * Returns true if the item can be used on the given entity, e.g. shears on sheep. + */ + public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase) + { + if (!par1ItemStack.hasDisplayName()) + { + return false; + } + else if (par3EntityLivingBase instanceof EntityLiving) + { + EntityLiving var4 = (EntityLiving)par3EntityLivingBase; + var4.setCustomNameTag(par1ItemStack.getDisplayName()); + var4.func_110163_bv(); + --par1ItemStack.stackSize; + return true; + } + else + { + return super.itemInteractionForEntity(par1ItemStack, par2EntityPlayer, par3EntityLivingBase); + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemPickaxe.java b/src/main/java/net/minecraft/src/ItemPickaxe.java new file mode 100644 index 0000000..a542904 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemPickaxe.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +public class ItemPickaxe extends ItemTool +{ + /** an array of the blocks this pickaxe is effective against */ + private static Block[] blocksEffectiveAgainst = new Block[] {Block.cobblestone, Block.stoneDoubleSlab, Block.stoneSingleSlab, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockIron, Block.oreCoal, Block.blockGold, Block.oreGold, Block.oreDiamond, Block.blockDiamond, Block.ice, Block.netherrack, Block.oreLapis, Block.blockLapis, Block.oreRedstone, Block.oreRedstoneGlowing, Block.rail, Block.railDetector, Block.railPowered, Block.railActivator}; + + protected ItemPickaxe(int par1, EnumToolMaterial par2EnumToolMaterial) + { + super(par1, 2.0F, par2EnumToolMaterial, blocksEffectiveAgainst); + } + + /** + * Returns if the item (tool) can harvest results from the block type. + */ + public boolean canHarvestBlock(Block par1Block) + { + return par1Block == Block.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (par1Block != Block.blockDiamond && par1Block != Block.oreDiamond ? (par1Block != Block.oreEmerald && par1Block != Block.blockEmerald ? (par1Block != Block.blockGold && par1Block != Block.oreGold ? (par1Block != Block.blockIron && par1Block != Block.oreIron ? (par1Block != Block.blockLapis && par1Block != Block.oreLapis ? (par1Block != Block.oreRedstone && par1Block != Block.oreRedstoneGlowing ? (par1Block.blockMaterial == Material.rock ? true : (par1Block.blockMaterial == Material.iron ? true : par1Block.blockMaterial == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2); + } + + /** + * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if + * sword + */ + public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) + { + return par2Block != null && (par2Block.blockMaterial == Material.iron || par2Block.blockMaterial == Material.anvil || par2Block.blockMaterial == Material.rock) ? this.efficiencyOnProperMaterial : super.getStrVsBlock(par1ItemStack, par2Block); + } +} diff --git a/src/main/java/net/minecraft/src/ItemPiston.java b/src/main/java/net/minecraft/src/ItemPiston.java new file mode 100644 index 0000000..abdd91e --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemPiston.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class ItemPiston extends ItemBlock +{ + public ItemPiston(int par1) + { + super(par1); + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + public int getMetadata(int par1) + { + return 7; + } +} diff --git a/src/main/java/net/minecraft/src/ItemPotion.java b/src/main/java/net/minecraft/src/ItemPotion.java new file mode 100644 index 0000000..dad25ba --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemPotion.java @@ -0,0 +1,441 @@ +package net.minecraft.src; + +import com.google.common.collect.HashMultimap; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +public class ItemPotion extends Item +{ + /** maps potion damage values to lists of effect names */ + private HashMap effectCache = new HashMap(); + private static final Map field_77835_b = new LinkedHashMap(); + private Icon field_94591_c; + private Icon field_94590_d; + private Icon field_94592_ct; + + public ItemPotion(int par1) + { + super(par1); + this.setMaxStackSize(1); + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setCreativeTab(CreativeTabs.tabBrewing); + } + + /** + * Returns a list of potion effects for the specified itemstack. + */ + public List getEffects(ItemStack par1ItemStack) + { + if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("CustomPotionEffects")) + { + ArrayList var6 = new ArrayList(); + NBTTagList var3 = par1ItemStack.getTagCompound().getTagList("CustomPotionEffects"); + + for (int var4 = 0; var4 < var3.tagCount(); ++var4) + { + NBTTagCompound var5 = (NBTTagCompound)var3.tagAt(var4); + var6.add(PotionEffect.readCustomPotionEffectFromNBT(var5)); + } + + return var6; + } + else + { + List var2 = (List)this.effectCache.get(Integer.valueOf(par1ItemStack.getItemDamage())); + + if (var2 == null) + { + var2 = PotionHelper.getPotionEffects(par1ItemStack.getItemDamage(), false); + this.effectCache.put(Integer.valueOf(par1ItemStack.getItemDamage()), var2); + } + + return var2; + } + } + + /** + * Returns a list of effects for the specified potion damage value. + */ + public List getEffects(int par1) + { + List var2 = (List)this.effectCache.get(Integer.valueOf(par1)); + + if (var2 == null) + { + var2 = PotionHelper.getPotionEffects(par1, false); + this.effectCache.put(Integer.valueOf(par1), var2); + } + + return var2; + } + + public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + + if (!par2World.isRemote) + { + List var4 = this.getEffects(par1ItemStack); + + if (var4 != null) + { + Iterator var5 = var4.iterator(); + + while (var5.hasNext()) + { + PotionEffect var6 = (PotionEffect)var5.next(); + par3EntityPlayer.addPotionEffect(new PotionEffect(var6)); + } + } + } + + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + if (par1ItemStack.stackSize <= 0) + { + return new ItemStack(Item.glassBottle); + } + + par3EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Item.glassBottle)); + } + + return par1ItemStack; + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 32; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.drink; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (isSplash(par1ItemStack.getItemDamage())) + { + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + + par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!par2World.isRemote) + { + par2World.spawnEntityInWorld(new EntityPotion(par2World, par3EntityPlayer, par1ItemStack)); + } + + return par1ItemStack; + } + else + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + return false; + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return isSplash(par1) ? this.field_94591_c : this.field_94590_d; + } + + /** + * Gets an icon index based on an item's damage value and the given render pass + */ + public Icon getIconFromDamageForRenderPass(int par1, int par2) + { + return par2 == 0 ? this.field_94592_ct : super.getIconFromDamageForRenderPass(par1, par2); + } + + /** + * returns wether or not a potion is a throwable splash potion based on damage value + */ + public static boolean isSplash(int par0) + { + return (par0 & 16384) != 0; + } + + public int getColorFromDamage(int par1) + { + return PotionHelper.func_77915_a(par1, false); + } + + public int getColorFromItemStack(ItemStack par1ItemStack, int par2) + { + return par2 > 0 ? 16777215 : this.getColorFromDamage(par1ItemStack.getItemDamage()); + } + + public boolean requiresMultipleRenderPasses() + { + return true; + } + + public boolean isEffectInstant(int par1) + { + List var2 = this.getEffects(par1); + + if (var2 != null && !var2.isEmpty()) + { + Iterator var3 = var2.iterator(); + PotionEffect var4; + + do + { + if (!var3.hasNext()) + { + return false; + } + + var4 = (PotionEffect)var3.next(); + } + while (!Potion.potionTypes[var4.getPotionID()].isInstant()); + + return true; + } + else + { + return false; + } + } + + public String getItemDisplayName(ItemStack par1ItemStack) + { + if (par1ItemStack.getItemDamage() == 0) + { + return StatCollector.translateToLocal("item.emptyPotion.name").trim(); + } + else + { + String var2 = ""; + + if (isSplash(par1ItemStack.getItemDamage())) + { + var2 = StatCollector.translateToLocal("potion.prefix.grenade").trim() + " "; + } + + List var3 = Item.potion.getEffects(par1ItemStack); + String var4; + + if (var3 != null && !var3.isEmpty()) + { + var4 = ((PotionEffect)var3.get(0)).getEffectName(); + var4 = var4 + ".postfix"; + return var2 + StatCollector.translateToLocal(var4).trim(); + } + else + { + var4 = PotionHelper.func_77905_c(par1ItemStack.getItemDamage()); + return StatCollector.translateToLocal(var4).trim() + " " + super.getItemDisplayName(par1ItemStack); + } + } + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) + { + if (par1ItemStack.getItemDamage() != 0) + { + List var5 = Item.potion.getEffects(par1ItemStack); + HashMultimap var6 = HashMultimap.create(); + Iterator var16; + + if (var5 != null && !var5.isEmpty()) + { + var16 = var5.iterator(); + + while (var16.hasNext()) + { + PotionEffect var8 = (PotionEffect)var16.next(); + String var9 = StatCollector.translateToLocal(var8.getEffectName()).trim(); + Potion var10 = Potion.potionTypes[var8.getPotionID()]; + Map var11 = var10.func_111186_k(); + + if (var11 != null && var11.size() > 0) + { + Iterator var12 = var11.entrySet().iterator(); + + while (var12.hasNext()) + { + Entry var13 = (Entry)var12.next(); + AttributeModifier var14 = (AttributeModifier)var13.getValue(); + AttributeModifier var15 = new AttributeModifier(var14.getName(), var10.func_111183_a(var8.getAmplifier(), var14), var14.getOperation()); + var6.put(((Attribute)var13.getKey()).getAttributeUnlocalizedName(), var15); + } + } + + if (var8.getAmplifier() > 0) + { + var9 = var9 + " " + StatCollector.translateToLocal("potion.potency." + var8.getAmplifier()).trim(); + } + + if (var8.getDuration() > 20) + { + var9 = var9 + " (" + Potion.getDurationString(var8) + ")"; + } + + if (var10.isBadEffect()) + { + par3List.add(EnumChatFormatting.RED + var9); + } + else + { + par3List.add(EnumChatFormatting.GRAY + var9); + } + } + } + else + { + String var7 = StatCollector.translateToLocal("potion.empty").trim(); + par3List.add(EnumChatFormatting.GRAY + var7); + } + + if (!var6.isEmpty()) + { + par3List.add(""); + par3List.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("potion.effects.whenDrank")); + var16 = var6.entries().iterator(); + + while (var16.hasNext()) + { + Entry var17 = (Entry)var16.next(); + AttributeModifier var19 = (AttributeModifier)var17.getValue(); + double var18 = var19.getAmount(); + double var20; + + if (var19.getOperation() != 1 && var19.getOperation() != 2) + { + var20 = var19.getAmount(); + } + else + { + var20 = var19.getAmount() * 100.0D; + } + + if (var18 > 0.0D) + { + par3List.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + var19.getOperation(), new Object[] {ItemStack.field_111284_a.format(var20), StatCollector.translateToLocal("attribute.name." + (String)var17.getKey())})); + } + else if (var18 < 0.0D) + { + var20 *= -1.0D; + par3List.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted("attribute.modifier.take." + var19.getOperation(), new Object[] {ItemStack.field_111284_a.format(var20), StatCollector.translateToLocal("attribute.name." + (String)var17.getKey())})); + } + } + } + } + } + + public boolean hasEffect(ItemStack par1ItemStack) + { + List var2 = this.getEffects(par1ItemStack); + return var2 != null && !var2.isEmpty(); + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + super.getSubItems(par1, par2CreativeTabs, par3List); + int var5; + + if (field_77835_b.isEmpty()) + { + for (int var4 = 0; var4 <= 15; ++var4) + { + for (var5 = 0; var5 <= 1; ++var5) + { + int var6; + + if (var5 == 0) + { + var6 = var4 | 8192; + } + else + { + var6 = var4 | 16384; + } + + for (int var7 = 0; var7 <= 2; ++var7) + { + int var8 = var6; + + if (var7 != 0) + { + if (var7 == 1) + { + var8 = var6 | 32; + } + else if (var7 == 2) + { + var8 = var6 | 64; + } + } + + List var9 = PotionHelper.getPotionEffects(var8, false); + + if (var9 != null && !var9.isEmpty()) + { + field_77835_b.put(var9, Integer.valueOf(var8)); + } + } + } + } + } + + Iterator var10 = field_77835_b.values().iterator(); + + while (var10.hasNext()) + { + var5 = ((Integer)var10.next()).intValue(); + par3List.add(new ItemStack(par1, 1, var5)); + } + } + + public void registerIcons(IconRegister par1IconRegister) + { + this.field_94590_d = par1IconRegister.registerIcon(this.getIconString() + "_" + "bottle_drinkable"); + this.field_94591_c = par1IconRegister.registerIcon(this.getIconString() + "_" + "bottle_splash"); + this.field_94592_ct = par1IconRegister.registerIcon(this.getIconString() + "_" + "overlay"); + } + + public static Icon func_94589_d(String par0Str) + { + return par0Str.equals("bottle_drinkable") ? Item.potion.field_94590_d : (par0Str.equals("bottle_splash") ? Item.potion.field_94591_c : (par0Str.equals("overlay") ? Item.potion.field_94592_ct : null)); + } +} diff --git a/src/main/java/net/minecraft/src/ItemRecord.java b/src/main/java/net/minecraft/src/ItemRecord.java new file mode 100644 index 0000000..20bd6a1 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemRecord.java @@ -0,0 +1,89 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ItemRecord extends Item +{ + /** List of all record items and their names. */ + private static final Map records = new HashMap(); + + /** The name of the record. */ + public final String recordName; + + protected ItemRecord(int par1, String par2Str) + { + super(par1); + this.recordName = par2Str; + this.maxStackSize = 1; + this.setCreativeTab(CreativeTabs.tabMisc); + records.put(par2Str, this); + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return this.itemIcon; + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par3World.getBlockId(par4, par5, par6) == Block.jukebox.blockID && par3World.getBlockMetadata(par4, par5, par6) == 0) + { + if (par3World.isRemote) + { + return true; + } + else + { + ((BlockJukeBox)Block.jukebox).insertRecord(par3World, par4, par5, par6, par1ItemStack); + par3World.playAuxSFXAtEntity((EntityPlayer)null, 1005, par4, par5, par6, this.itemID); + --par1ItemStack.stackSize; + return true; + } + } + else + { + return false; + } + } + + /** + * allows items to add custom lines of information to the mouseover description + */ + public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) + { + par3List.add(this.getRecordTitle()); + } + + /** + * Return the title for this record. + */ + public String getRecordTitle() + { + return "C418 - " + this.recordName; + } + + /** + * Return an item rarity from EnumRarity + */ + public EnumRarity getRarity(ItemStack par1ItemStack) + { + return EnumRarity.rare; + } + + /** + * Return the record item corresponding to the given name. + */ + public static ItemRecord getRecord(String par0Str) + { + return (ItemRecord)records.get(par0Str); + } +} diff --git a/src/main/java/net/minecraft/src/ItemRedstone.java b/src/main/java/net/minecraft/src/ItemRedstone.java new file mode 100644 index 0000000..d4c8ed6 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemRedstone.java @@ -0,0 +1,70 @@ +package net.minecraft.src; + +public class ItemRedstone extends Item +{ + public ItemRedstone(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabRedstone); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par3World.getBlockId(par4, par5, par6) != Block.snow.blockID) + { + if (par7 == 0) + { + --par5; + } + + if (par7 == 1) + { + ++par5; + } + + if (par7 == 2) + { + --par6; + } + + if (par7 == 3) + { + ++par6; + } + + if (par7 == 4) + { + --par4; + } + + if (par7 == 5) + { + ++par4; + } + + if (!par3World.isAirBlock(par4, par5, par6)) + { + return false; + } + } + + if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else + { + if (Block.redstoneWire.canPlaceBlockAt(par3World, par4, par5, par6)) + { + --par1ItemStack.stackSize; + par3World.setBlock(par4, par5, par6, Block.redstoneWire.blockID); + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemReed.java b/src/main/java/net/minecraft/src/ItemReed.java new file mode 100644 index 0000000..895a470 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemReed.java @@ -0,0 +1,90 @@ +package net.minecraft.src; + +public class ItemReed extends Item +{ + /** The ID of the block the reed will spawn when used from inventory bar. */ + private int spawnID; + + public ItemReed(int par1, Block par2Block) + { + super(par1); + this.spawnID = par2Block.blockID; + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + int var11 = par3World.getBlockId(par4, par5, par6); + + if (var11 == Block.snow.blockID && (par3World.getBlockMetadata(par4, par5, par6) & 7) < 1) + { + par7 = 1; + } + else if (var11 != Block.vine.blockID && var11 != Block.tallGrass.blockID && var11 != Block.deadBush.blockID) + { + if (par7 == 0) + { + --par5; + } + + if (par7 == 1) + { + ++par5; + } + + if (par7 == 2) + { + --par6; + } + + if (par7 == 3) + { + ++par6; + } + + if (par7 == 4) + { + --par4; + } + + if (par7 == 5) + { + ++par4; + } + } + + if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else if (par1ItemStack.stackSize == 0) + { + return false; + } + else + { + if (par3World.canPlaceEntityOnSide(this.spawnID, par4, par5, par6, false, par7, (Entity)null, par1ItemStack)) + { + Block var12 = Block.blocksList[this.spawnID]; + int var13 = var12.onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10, 0); + + if (par3World.setBlock(par4, par5, par6, this.spawnID, var13, 3)) + { + if (par3World.getBlockId(par4, par5, par6) == this.spawnID) + { + Block.blocksList[this.spawnID].onBlockPlacedBy(par3World, par4, par5, par6, par2EntityPlayer, par1ItemStack); + Block.blocksList[this.spawnID].onPostBlockPlaced(par3World, par4, par5, par6, var13); + } + + par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), var12.stepSound.getPlaceSound(), (var12.stepSound.getVolume() + 1.0F) / 2.0F, var12.stepSound.getPitch() * 0.8F); + --par1ItemStack.stackSize; + } + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemRenderer.java b/src/main/java/net/minecraft/src/ItemRenderer.java new file mode 100644 index 0000000..0874c4b --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemRenderer.java @@ -0,0 +1,682 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class ItemRenderer +{ + private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png"); + private static final ResourceLocation RES_MAP_BACKGROUND = new ResourceLocation("textures/map/map_background.png"); + private static final ResourceLocation RES_UNDERWATER_OVERLAY = new ResourceLocation("textures/misc/underwater.png"); + + /** A reference to the Minecraft object. */ + private Minecraft mc; + private ItemStack itemToRender; + + /** + * How far the current item has been equipped (0 disequipped and 1 fully up) + */ + private float equippedProgress; + private float prevEquippedProgress; + + /** Instance of RenderBlocks. */ + private RenderBlocks renderBlocksInstance = new RenderBlocks(); + public final MapItemRenderer mapItemRenderer; + + /** The index of the currently held item (0-8, or -1 if not yet updated) */ + private int equippedItemSlot = -1; + + public ItemRenderer(Minecraft par1Minecraft) + { + this.mc = par1Minecraft; + this.mapItemRenderer = new MapItemRenderer(par1Minecraft.gameSettings, par1Minecraft.getTextureManager()); + } + + /** + * Renders the item stack for being in an entity's hand Args: itemStack + */ + public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3) + { + GL11.glPushMatrix(); + TextureManager var4 = this.mc.getTextureManager(); + + if (par2ItemStack.getItemSpriteNumber() == 0 && par2ItemStack.itemID < Block.blocksList.length && Block.blocksList[par2ItemStack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType())) + { + var4.bindTexture(var4.getResourceLocation(0)); + this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F); + } + else + { + Icon var5 = par1EntityLivingBase.getItemIcon(par2ItemStack, par3); + + if (var5 == null) + { + GL11.glPopMatrix(); + return; + } + + var4.bindTexture(var4.getResourceLocation(par2ItemStack.getItemSpriteNumber())); + Tessellator var6 = Tessellator.instance; + float var7 = var5.getMinU(); + float var8 = var5.getMaxU(); + float var9 = var5.getMinV(); + float var10 = var5.getMaxV(); + float var11 = 0.0F; + float var12 = 0.3F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glTranslatef(-var11, -var12, 0.0F); + float var13 = 1.5F; + GL11.glScalef(var13, var13, var13); + GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); + renderItemIn2D(var6, var8, var9, var7, var10, var5.getIconWidth(), var5.getIconHeight(), 0.0625F); + + if (par2ItemStack.hasEffect() && par3 == 0) + { + GL11.glDepthFunc(GL11.GL_EQUAL); + GL11.glDisable(GL11.GL_LIGHTING); + var4.bindTexture(RES_ITEM_GLINT); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); + float var14 = 0.76F; + GL11.glColor4f(0.5F * var14, 0.25F * var14, 0.8F * var14, 1.0F); + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glPushMatrix(); + float var15 = 0.125F; + GL11.glScalef(var15, var15, var15); + float var16 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; + GL11.glTranslatef(var16, 0.0F, 0.0F); + GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); + renderItemIn2D(var6, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glScalef(var15, var15, var15); + var16 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; + GL11.glTranslatef(-var16, 0.0F, 0.0F); + GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); + renderItemIn2D(var6, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDepthFunc(GL11.GL_LEQUAL); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } + + GL11.glPopMatrix(); + } + + /** + * Renders an item held in hand as a 2D texture with thickness + */ + public static void renderItemIn2D(Tessellator par0Tessellator, float par1, float par2, float par3, float par4, int par5, int par6, float par7) + { + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(0.0F, 0.0F, 1.0F); + par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (double)par1, (double)par4); + par0Tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, (double)par3, (double)par4); + par0Tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, (double)par3, (double)par2); + par0Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, (double)par1, (double)par2); + par0Tessellator.draw(); + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(0.0F, 0.0F, -1.0F); + par0Tessellator.addVertexWithUV(0.0D, 1.0D, (double)(0.0F - par7), (double)par1, (double)par2); + par0Tessellator.addVertexWithUV(1.0D, 1.0D, (double)(0.0F - par7), (double)par3, (double)par2); + par0Tessellator.addVertexWithUV(1.0D, 0.0D, (double)(0.0F - par7), (double)par3, (double)par4); + par0Tessellator.addVertexWithUV(0.0D, 0.0D, (double)(0.0F - par7), (double)par1, (double)par4); + par0Tessellator.draw(); + float var8 = 0.5F * (par1 - par3) / (float)par5; + float var9 = 0.5F * (par4 - par2) / (float)par6; + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(-1.0F, 0.0F, 0.0F); + int var10; + float var11; + float var12; + + for (var10 = 0; var10 < par5; ++var10) + { + var11 = (float)var10 / (float)par5; + var12 = par1 + (par3 - par1) * var11 - var8; + par0Tessellator.addVertexWithUV((double)var11, 0.0D, (double)(0.0F - par7), (double)var12, (double)par4); + par0Tessellator.addVertexWithUV((double)var11, 0.0D, 0.0D, (double)var12, (double)par4); + par0Tessellator.addVertexWithUV((double)var11, 1.0D, 0.0D, (double)var12, (double)par2); + par0Tessellator.addVertexWithUV((double)var11, 1.0D, (double)(0.0F - par7), (double)var12, (double)par2); + } + + par0Tessellator.draw(); + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(1.0F, 0.0F, 0.0F); + float var13; + + for (var10 = 0; var10 < par5; ++var10) + { + var11 = (float)var10 / (float)par5; + var12 = par1 + (par3 - par1) * var11 - var8; + var13 = var11 + 1.0F / (float)par5; + par0Tessellator.addVertexWithUV((double)var13, 1.0D, (double)(0.0F - par7), (double)var12, (double)par2); + par0Tessellator.addVertexWithUV((double)var13, 1.0D, 0.0D, (double)var12, (double)par2); + par0Tessellator.addVertexWithUV((double)var13, 0.0D, 0.0D, (double)var12, (double)par4); + par0Tessellator.addVertexWithUV((double)var13, 0.0D, (double)(0.0F - par7), (double)var12, (double)par4); + } + + par0Tessellator.draw(); + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(0.0F, 1.0F, 0.0F); + + for (var10 = 0; var10 < par6; ++var10) + { + var11 = (float)var10 / (float)par6; + var12 = par4 + (par2 - par4) * var11 - var9; + var13 = var11 + 1.0F / (float)par6; + par0Tessellator.addVertexWithUV(0.0D, (double)var13, 0.0D, (double)par1, (double)var12); + par0Tessellator.addVertexWithUV(1.0D, (double)var13, 0.0D, (double)par3, (double)var12); + par0Tessellator.addVertexWithUV(1.0D, (double)var13, (double)(0.0F - par7), (double)par3, (double)var12); + par0Tessellator.addVertexWithUV(0.0D, (double)var13, (double)(0.0F - par7), (double)par1, (double)var12); + } + + par0Tessellator.draw(); + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(0.0F, -1.0F, 0.0F); + + for (var10 = 0; var10 < par6; ++var10) + { + var11 = (float)var10 / (float)par6; + var12 = par4 + (par2 - par4) * var11 - var9; + par0Tessellator.addVertexWithUV(1.0D, (double)var11, 0.0D, (double)par3, (double)var12); + par0Tessellator.addVertexWithUV(0.0D, (double)var11, 0.0D, (double)par1, (double)var12); + par0Tessellator.addVertexWithUV(0.0D, (double)var11, (double)(0.0F - par7), (double)par1, (double)var12); + par0Tessellator.addVertexWithUV(1.0D, (double)var11, (double)(0.0F - par7), (double)par3, (double)var12); + } + + par0Tessellator.draw(); + } + + /** + * Renders the active item in the player's hand when in first person mode. Args: partialTickTime + */ + public void renderItemInFirstPerson(float par1) + { + float var2 = this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * par1; + EntityClientPlayerMP var3 = this.mc.thePlayer; + float var4 = var3.prevRotationPitch + (var3.rotationPitch - var3.prevRotationPitch) * par1; + GL11.glPushMatrix(); + GL11.glRotatef(var4, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var3.prevRotationYaw + (var3.rotationYaw - var3.prevRotationYaw) * par1, 0.0F, 1.0F, 0.0F); + RenderHelper.enableStandardItemLighting(); + GL11.glPopMatrix(); + EntityPlayerSP var5 = (EntityPlayerSP)var3; + float var6 = var5.prevRenderArmPitch + (var5.renderArmPitch - var5.prevRenderArmPitch) * par1; + float var7 = var5.prevRenderArmYaw + (var5.renderArmYaw - var5.prevRenderArmYaw) * par1; + GL11.glRotatef((var3.rotationPitch - var6) * 0.1F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef((var3.rotationYaw - var7) * 0.1F, 0.0F, 1.0F, 0.0F); + ItemStack var8 = this.itemToRender; + float var9 = this.mc.theWorld.getLightBrightness(MathHelper.floor_double(var3.posX), MathHelper.floor_double(var3.posY), MathHelper.floor_double(var3.posZ)); + var9 = 1.0F; + int var10 = this.mc.theWorld.getLightBrightnessForSkyBlocks(MathHelper.floor_double(var3.posX), MathHelper.floor_double(var3.posY), MathHelper.floor_double(var3.posZ), 0); + int var11 = var10 % 65536; + int var12 = var10 / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)var11 / 1.0F, (float)var12 / 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + float var13; + float var21; + float var23; + + if (var8 != null) + { + var10 = Item.itemsList[var8.itemID].getColorFromItemStack(var8, 0); + var21 = (float)(var10 >> 16 & 255) / 255.0F; + var23 = (float)(var10 >> 8 & 255) / 255.0F; + var13 = (float)(var10 & 255) / 255.0F; + GL11.glColor4f(var9 * var21, var9 * var23, var9 * var13, 1.0F); + } + else + { + GL11.glColor4f(var9, var9, var9, 1.0F); + } + + float var14; + float var15; + float var16; + float var20; + Render var26; + RenderPlayer var28; + + if (var8 != null && var8.itemID == Item.map.itemID) + { + GL11.glPushMatrix(); + var20 = 0.8F; + var21 = var3.getSwingProgress(par1); + var23 = MathHelper.sin(var21 * (float)Math.PI); + var13 = MathHelper.sin(MathHelper.sqrt_float(var21) * (float)Math.PI); + GL11.glTranslatef(-var13 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(var21) * (float)Math.PI * 2.0F) * 0.2F, -var23 * 0.2F); + var21 = 1.0F - var4 / 45.0F + 0.1F; + + if (var21 < 0.0F) + { + var21 = 0.0F; + } + + if (var21 > 1.0F) + { + var21 = 1.0F; + } + + var21 = -MathHelper.cos(var21 * (float)Math.PI) * 0.5F + 0.5F; + GL11.glTranslatef(0.0F, 0.0F * var20 - (1.0F - var2) * 1.2F - var21 * 0.5F + 0.04F, -0.9F * var20); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(var21 * -85.0F, 0.0F, 0.0F, 1.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + this.mc.getTextureManager().bindTexture(var3.getLocationSkin()); + + for (var12 = 0; var12 < 2; ++var12) + { + int var24 = var12 * 2 - 1; + GL11.glPushMatrix(); + GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float)var24); + GL11.glRotatef((float)(-45 * var24), 1.0F, 0.0F, 0.0F); + GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef((float)(-65 * var24), 0.0F, 1.0F, 0.0F); + var26 = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer); + var28 = (RenderPlayer)var26; + var16 = 1.0F; + GL11.glScalef(var16, var16, var16); + var28.renderFirstPersonArm(this.mc.thePlayer); + GL11.glPopMatrix(); + } + + var23 = var3.getSwingProgress(par1); + var13 = MathHelper.sin(var23 * var23 * (float)Math.PI); + var14 = MathHelper.sin(MathHelper.sqrt_float(var23) * (float)Math.PI); + GL11.glRotatef(-var13 * 20.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-var14 * 20.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-var14 * 80.0F, 1.0F, 0.0F, 0.0F); + var15 = 0.38F; + GL11.glScalef(var15, var15, var15); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-1.0F, -1.0F, 0.0F); + var16 = 0.015625F; + GL11.glScalef(var16, var16, var16); + this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND); + Tessellator var29 = Tessellator.instance; + GL11.glNormal3f(0.0F, 0.0F, -1.0F); + var29.startDrawingQuads(); + byte var30 = 7; + var29.addVertexWithUV((double)(0 - var30), (double)(128 + var30), 0.0D, 0.0D, 1.0D); + var29.addVertexWithUV((double)(128 + var30), (double)(128 + var30), 0.0D, 1.0D, 1.0D); + var29.addVertexWithUV((double)(128 + var30), (double)(0 - var30), 0.0D, 1.0D, 0.0D); + var29.addVertexWithUV((double)(0 - var30), (double)(0 - var30), 0.0D, 0.0D, 0.0D); + var29.draw(); + MapData var19 = Item.map.getMapData(var8, this.mc.theWorld); + + if (var19 != null) + { + this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.getTextureManager(), var19); + } + + GL11.glPopMatrix(); + } + else if (var8 != null) + { + GL11.glPushMatrix(); + var20 = 0.8F; + + if (var3.getItemInUseCount() > 0) + { + EnumAction var22 = var8.getItemUseAction(); + + if (var22 == EnumAction.eat || var22 == EnumAction.drink) + { + var23 = (float)var3.getItemInUseCount() - par1 + 1.0F; + var13 = 1.0F - var23 / (float)var8.getMaxItemUseDuration(); + var14 = 1.0F - var13; + var14 = var14 * var14 * var14; + var14 = var14 * var14 * var14; + var14 = var14 * var14 * var14; + var15 = 1.0F - var14; + GL11.glTranslatef(0.0F, MathHelper.abs(MathHelper.cos(var23 / 4.0F * (float)Math.PI) * 0.1F) * (float)((double)var13 > 0.2D ? 1 : 0), 0.0F); + GL11.glTranslatef(var15 * 0.6F, -var15 * 0.5F, 0.0F); + GL11.glRotatef(var15 * 90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(var15 * 10.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var15 * 30.0F, 0.0F, 0.0F, 1.0F); + } + } + else + { + var21 = var3.getSwingProgress(par1); + var23 = MathHelper.sin(var21 * (float)Math.PI); + var13 = MathHelper.sin(MathHelper.sqrt_float(var21) * (float)Math.PI); + GL11.glTranslatef(-var13 * 0.4F, MathHelper.sin(MathHelper.sqrt_float(var21) * (float)Math.PI * 2.0F) * 0.2F, -var23 * 0.2F); + } + + GL11.glTranslatef(0.7F * var20, -0.65F * var20 - (1.0F - var2) * 0.6F, -0.9F * var20); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + var21 = var3.getSwingProgress(par1); + var23 = MathHelper.sin(var21 * var21 * (float)Math.PI); + var13 = MathHelper.sin(MathHelper.sqrt_float(var21) * (float)Math.PI); + GL11.glRotatef(-var23 * 20.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-var13 * 20.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-var13 * 80.0F, 1.0F, 0.0F, 0.0F); + var14 = 0.4F; + GL11.glScalef(var14, var14, var14); + float var17; + float var18; + + if (var3.getItemInUseCount() > 0) + { + EnumAction var25 = var8.getItemUseAction(); + + if (var25 == EnumAction.block) + { + GL11.glTranslatef(-0.5F, 0.2F, 0.0F); + GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); + } + else if (var25 == EnumAction.bow) + { + GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F); + GL11.glTranslatef(-0.9F, 0.2F, 0.0F); + var16 = (float)var8.getMaxItemUseDuration() - ((float)var3.getItemInUseCount() - par1 + 1.0F); + var17 = var16 / 20.0F; + var17 = (var17 * var17 + var17 * 2.0F) / 3.0F; + + if (var17 > 1.0F) + { + var17 = 1.0F; + } + + if (var17 > 0.1F) + { + GL11.glTranslatef(0.0F, MathHelper.sin((var16 - 0.1F) * 1.3F) * 0.01F * (var17 - 0.1F), 0.0F); + } + + GL11.glTranslatef(0.0F, 0.0F, var17 * 0.1F); + GL11.glRotatef(-335.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, 0.5F, 0.0F); + var18 = 1.0F + var17 * 0.2F; + GL11.glScalef(1.0F, 1.0F, var18); + GL11.glTranslatef(0.0F, -0.5F, 0.0F); + GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); + } + } + + if (var8.getItem().shouldRotateAroundWhenRendering()) + { + GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + } + + if (var8.getItem().requiresMultipleRenderPasses()) + { + this.renderItem(var3, var8, 0); + int var27 = Item.itemsList[var8.itemID].getColorFromItemStack(var8, 1); + var16 = (float)(var27 >> 16 & 255) / 255.0F; + var17 = (float)(var27 >> 8 & 255) / 255.0F; + var18 = (float)(var27 & 255) / 255.0F; + GL11.glColor4f(var9 * var16, var9 * var17, var9 * var18, 1.0F); + this.renderItem(var3, var8, 1); + } + else + { + this.renderItem(var3, var8, 0); + } + + GL11.glPopMatrix(); + } + else if (!var3.isInvisible()) + { + GL11.glPushMatrix(); + var20 = 0.8F; + var21 = var3.getSwingProgress(par1); + var23 = MathHelper.sin(var21 * (float)Math.PI); + var13 = MathHelper.sin(MathHelper.sqrt_float(var21) * (float)Math.PI); + GL11.glTranslatef(-var13 * 0.3F, MathHelper.sin(MathHelper.sqrt_float(var21) * (float)Math.PI * 2.0F) * 0.4F, -var23 * 0.4F); + GL11.glTranslatef(0.8F * var20, -0.75F * var20 - (1.0F - var2) * 0.6F, -0.9F * var20); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + var21 = var3.getSwingProgress(par1); + var23 = MathHelper.sin(var21 * var21 * (float)Math.PI); + var13 = MathHelper.sin(MathHelper.sqrt_float(var21) * (float)Math.PI); + GL11.glRotatef(var13 * 70.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-var23 * 20.0F, 0.0F, 0.0F, 1.0F); + this.mc.getTextureManager().bindTexture(var3.getLocationSkin()); + GL11.glTranslatef(-1.0F, 3.6F, 3.5F); + GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(1.0F, 1.0F, 1.0F); + GL11.glTranslatef(5.6F, 0.0F, 0.0F); + var26 = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer); + var28 = (RenderPlayer)var26; + var16 = 1.0F; + GL11.glScalef(var16, var16, var16); + var28.renderFirstPersonArm(this.mc.thePlayer); + GL11.glPopMatrix(); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + RenderHelper.disableStandardItemLighting(); + } + + /** + * Renders all the overlays that are in first person mode. Args: partialTickTime + */ + public void renderOverlays(float par1) + { + GL11.glDisable(GL11.GL_ALPHA_TEST); + + if (this.mc.thePlayer.isBurning()) + { + this.renderFireInFirstPerson(par1); + } + + if (this.mc.thePlayer.isEntityInsideOpaqueBlock()) + { + int var2 = MathHelper.floor_double(this.mc.thePlayer.posX); + int var3 = MathHelper.floor_double(this.mc.thePlayer.posY); + int var4 = MathHelper.floor_double(this.mc.thePlayer.posZ); + int var5 = this.mc.theWorld.getBlockId(var2, var3, var4); + + if (this.mc.theWorld.isBlockNormalCube(var2, var3, var4)) + { + this.renderInsideOfBlock(par1, Block.blocksList[var5].getBlockTextureFromSide(2)); + } + else + { + for (int var6 = 0; var6 < 8; ++var6) + { + float var7 = ((float)((var6 >> 0) % 2) - 0.5F) * this.mc.thePlayer.width * 0.9F; + float var8 = ((float)((var6 >> 1) % 2) - 0.5F) * this.mc.thePlayer.height * 0.2F; + float var9 = ((float)((var6 >> 2) % 2) - 0.5F) * this.mc.thePlayer.width * 0.9F; + int var10 = MathHelper.floor_float((float)var2 + var7); + int var11 = MathHelper.floor_float((float)var3 + var8); + int var12 = MathHelper.floor_float((float)var4 + var9); + + if (this.mc.theWorld.isBlockNormalCube(var10, var11, var12)) + { + var5 = this.mc.theWorld.getBlockId(var10, var11, var12); + } + } + } + + if (Block.blocksList[var5] != null) + { + this.renderInsideOfBlock(par1, Block.blocksList[var5].getBlockTextureFromSide(2)); + } + } + + if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) + { + this.renderWarpedTextureOverlay(par1); + } + + GL11.glEnable(GL11.GL_ALPHA_TEST); + } + + /** + * Renders the texture of the block the player is inside as an overlay. Args: partialTickTime, blockTextureIndex + */ + private void renderInsideOfBlock(float par1, Icon par2Icon) + { + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + Tessellator var3 = Tessellator.instance; + float var4 = 0.1F; + GL11.glColor4f(var4, var4, var4, 0.5F); + GL11.glPushMatrix(); + float var5 = -1.0F; + float var6 = 1.0F; + float var7 = -1.0F; + float var8 = 1.0F; + float var9 = -0.5F; + float var10 = par2Icon.getMinU(); + float var11 = par2Icon.getMaxU(); + float var12 = par2Icon.getMinV(); + float var13 = par2Icon.getMaxV(); + var3.startDrawingQuads(); + var3.addVertexWithUV((double)var5, (double)var7, (double)var9, (double)var11, (double)var13); + var3.addVertexWithUV((double)var6, (double)var7, (double)var9, (double)var10, (double)var13); + var3.addVertexWithUV((double)var6, (double)var8, (double)var9, (double)var10, (double)var12); + var3.addVertexWithUV((double)var5, (double)var8, (double)var9, (double)var11, (double)var12); + var3.draw(); + GL11.glPopMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + + /** + * Renders a texture that warps around based on the direction the player is looking. Texture needs to be bound + * before being called. Used for the water overlay. Args: parialTickTime + */ + private void renderWarpedTextureOverlay(float par1) + { + this.mc.getTextureManager().bindTexture(RES_UNDERWATER_OVERLAY); + Tessellator var2 = Tessellator.instance; + float var3 = this.mc.thePlayer.getBrightness(par1); + GL11.glColor4f(var3, var3, var3, 0.5F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glPushMatrix(); + float var4 = 4.0F; + float var5 = -1.0F; + float var6 = 1.0F; + float var7 = -1.0F; + float var8 = 1.0F; + float var9 = -0.5F; + float var10 = -this.mc.thePlayer.rotationYaw / 64.0F; + float var11 = this.mc.thePlayer.rotationPitch / 64.0F; + var2.startDrawingQuads(); + var2.addVertexWithUV((double)var5, (double)var7, (double)var9, (double)(var4 + var10), (double)(var4 + var11)); + var2.addVertexWithUV((double)var6, (double)var7, (double)var9, (double)(0.0F + var10), (double)(var4 + var11)); + var2.addVertexWithUV((double)var6, (double)var8, (double)var9, (double)(0.0F + var10), (double)(0.0F + var11)); + var2.addVertexWithUV((double)var5, (double)var8, (double)var9, (double)(var4 + var10), (double)(0.0F + var11)); + var2.draw(); + GL11.glPopMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + } + + /** + * Renders the fire on the screen for first person mode. Arg: partialTickTime + */ + private void renderFireInFirstPerson(float par1) + { + Tessellator var2 = Tessellator.instance; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + float var3 = 1.0F; + + for (int var4 = 0; var4 < 2; ++var4) + { + GL11.glPushMatrix(); + Icon var5 = Block.fire.getFireIcon(1); + this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); + float var6 = var5.getMinU(); + float var7 = var5.getMaxU(); + float var8 = var5.getMinV(); + float var9 = var5.getMaxV(); + float var10 = (0.0F - var3) / 2.0F; + float var11 = var10 + var3; + float var12 = 0.0F - var3 / 2.0F; + float var13 = var12 + var3; + float var14 = -0.5F; + GL11.glTranslatef((float)(-(var4 * 2 - 1)) * 0.24F, -0.3F, 0.0F); + GL11.glRotatef((float)(var4 * 2 - 1) * 10.0F, 0.0F, 1.0F, 0.0F); + var2.startDrawingQuads(); + var2.addVertexWithUV((double)var10, (double)var12, (double)var14, (double)var7, (double)var9); + var2.addVertexWithUV((double)var11, (double)var12, (double)var14, (double)var6, (double)var9); + var2.addVertexWithUV((double)var11, (double)var13, (double)var14, (double)var6, (double)var8); + var2.addVertexWithUV((double)var10, (double)var13, (double)var14, (double)var7, (double)var8); + var2.draw(); + GL11.glPopMatrix(); + } + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + } + + public void updateEquippedItem() + { + this.prevEquippedProgress = this.equippedProgress; + EntityClientPlayerMP var1 = this.mc.thePlayer; + ItemStack var2 = var1.inventory.getCurrentItem(); + boolean var3 = this.equippedItemSlot == var1.inventory.currentItem && var2 == this.itemToRender; + + if (this.itemToRender == null && var2 == null) + { + var3 = true; + } + + if (var2 != null && this.itemToRender != null && var2 != this.itemToRender && var2.itemID == this.itemToRender.itemID && var2.getItemDamage() == this.itemToRender.getItemDamage()) + { + this.itemToRender = var2; + var3 = true; + } + + float var4 = 0.4F; + float var5 = var3 ? 1.0F : 0.0F; + float var6 = var5 - this.equippedProgress; + + if (var6 < -var4) + { + var6 = -var4; + } + + if (var6 > var4) + { + var6 = var4; + } + + this.equippedProgress += var6; + + if (this.equippedProgress < 0.1F) + { + this.itemToRender = var2; + this.equippedItemSlot = var1.inventory.currentItem; + } + } + + /** + * Resets equippedProgress + */ + public void resetEquippedProgress() + { + this.equippedProgress = 0.0F; + } + + /** + * Resets equippedProgress + */ + public void resetEquippedProgress2() + { + this.equippedProgress = 0.0F; + } +} diff --git a/src/main/java/net/minecraft/src/ItemSaddle.java b/src/main/java/net/minecraft/src/ItemSaddle.java new file mode 100644 index 0000000..f523d9a --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSaddle.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +public class ItemSaddle extends Item +{ + public ItemSaddle(int par1) + { + super(par1); + this.maxStackSize = 1; + this.setCreativeTab(CreativeTabs.tabTransport); + } + + /** + * Returns true if the item can be used on the given entity, e.g. shears on sheep. + */ + public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase) + { + if (par3EntityLivingBase instanceof EntityPig) + { + EntityPig var4 = (EntityPig)par3EntityLivingBase; + + if (!var4.getSaddled() && !var4.isChild()) + { + var4.setSaddled(true); + --par1ItemStack.stackSize; + } + + return true; + } + else + { + return false; + } + } + + /** + * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise + * the damage on the stack. + */ + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) + { + this.itemInteractionForEntity(par1ItemStack, (EntityPlayer)null, par2EntityLivingBase); + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ItemSeedFood.java b/src/main/java/net/minecraft/src/ItemSeedFood.java new file mode 100644 index 0000000..80d9f08 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSeedFood.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +public class ItemSeedFood extends ItemFood +{ + /** Block ID of the crop this seed food should place. */ + private int cropId; + + /** Block ID of the soil this seed food should be planted on. */ + private int soilId; + + public ItemSeedFood(int par1, int par2, float par3, int par4, int par5) + { + super(par1, par2, par3, false); + this.cropId = par4; + this.soilId = par5; + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par7 != 1) + { + return false; + } + else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) + { + int var11 = par3World.getBlockId(par4, par5, par6); + + if (var11 == this.soilId && par3World.isAirBlock(par4, par5 + 1, par6)) + { + par3World.setBlock(par4, par5 + 1, par6, this.cropId); + --par1ItemStack.stackSize; + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemSeeds.java b/src/main/java/net/minecraft/src/ItemSeeds.java new file mode 100644 index 0000000..e7a89a8 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSeeds.java @@ -0,0 +1,51 @@ +package net.minecraft.src; + +public class ItemSeeds extends Item +{ + /** + * The type of block this seed turns into (wheat or pumpkin stems for instance) + */ + private int blockType; + + /** BlockID of the block the seeds can be planted on. */ + private int soilBlockID; + + public ItemSeeds(int par1, int par2, int par3) + { + super(par1); + this.blockType = par2; + this.soilBlockID = par3; + this.setCreativeTab(CreativeTabs.tabMaterials); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par7 != 1) + { + return false; + } + else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) + { + int var11 = par3World.getBlockId(par4, par5, par6); + + if (var11 == this.soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6)) + { + par3World.setBlock(par4, par5 + 1, par6, this.blockType); + --par1ItemStack.stackSize; + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemShears.java b/src/main/java/net/minecraft/src/ItemShears.java new file mode 100644 index 0000000..510bb7d --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemShears.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +public class ItemShears extends Item +{ + public ItemShears(int par1) + { + super(par1); + this.setMaxStackSize(1); + this.setMaxDamage(238); + this.setCreativeTab(CreativeTabs.tabTools); + } + + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) + { + if (par3 != Block.leaves.blockID && par3 != Block.web.blockID && par3 != Block.tallGrass.blockID && par3 != Block.vine.blockID && par3 != Block.tripWire.blockID) + { + return super.onBlockDestroyed(par1ItemStack, par2World, par3, par4, par5, par6, par7EntityLivingBase); + } + else + { + par1ItemStack.damageItem(1, par7EntityLivingBase); + return true; + } + } + + /** + * Returns if the item (tool) can harvest results from the block type. + */ + public boolean canHarvestBlock(Block par1Block) + { + return par1Block.blockID == Block.web.blockID || par1Block.blockID == Block.redstoneWire.blockID || par1Block.blockID == Block.tripWire.blockID; + } + + /** + * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if + * sword + */ + public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) + { + return par2Block.blockID != Block.web.blockID && par2Block.blockID != Block.leaves.blockID ? (par2Block.blockID == Block.cloth.blockID ? 5.0F : super.getStrVsBlock(par1ItemStack, par2Block)) : 15.0F; + } +} diff --git a/src/main/java/net/minecraft/src/ItemSign.java b/src/main/java/net/minecraft/src/ItemSign.java new file mode 100644 index 0000000..9c317e0 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSign.java @@ -0,0 +1,89 @@ +package net.minecraft.src; + +public class ItemSign extends Item +{ + public ItemSign(int par1) + { + super(par1); + this.maxStackSize = 16; + this.setCreativeTab(CreativeTabs.tabDecorations); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par7 == 0) + { + return false; + } + else if (!par3World.getBlockMaterial(par4, par5, par6).isSolid()) + { + return false; + } + else + { + if (par7 == 1) + { + ++par5; + } + + if (par7 == 2) + { + --par6; + } + + if (par7 == 3) + { + ++par6; + } + + if (par7 == 4) + { + --par4; + } + + if (par7 == 5) + { + ++par4; + } + + if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else if (!Block.signPost.canPlaceBlockAt(par3World, par4, par5, par6)) + { + return false; + } + else if (par3World.isRemote) + { + return true; + } + else + { + if (par7 == 1) + { + int var11 = MathHelper.floor_double((double)((par2EntityPlayer.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15; + par3World.setBlock(par4, par5, par6, Block.signPost.blockID, var11, 3); + } + else + { + par3World.setBlock(par4, par5, par6, Block.signWall.blockID, par7, 3); + } + + --par1ItemStack.stackSize; + TileEntitySign var12 = (TileEntitySign)par3World.getBlockTileEntity(par4, par5, par6); + + if (var12 != null) + { + par2EntityPlayer.displayGUIEditSign(var12); + } + + return true; + } + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemSimpleFoiled.java b/src/main/java/net/minecraft/src/ItemSimpleFoiled.java new file mode 100644 index 0000000..94e6a29 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSimpleFoiled.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +public class ItemSimpleFoiled extends Item +{ + public ItemSimpleFoiled(int par1) + { + super(par1); + } + + public boolean hasEffect(ItemStack par1ItemStack) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/ItemSkull.java b/src/main/java/net/minecraft/src/ItemSkull.java new file mode 100644 index 0000000..8945cec --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSkull.java @@ -0,0 +1,162 @@ +package net.minecraft.src; + +import java.util.List; + +public class ItemSkull extends Item +{ + private static final String[] skullTypes = new String[] {"skeleton", "wither", "zombie", "char", "creeper"}; + public static final String[] field_94587_a = new String[] {"skeleton", "wither", "zombie", "steve", "creeper"}; + private Icon[] field_94586_c; + + public ItemSkull(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabDecorations); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par7 == 0) + { + return false; + } + else if (!par3World.getBlockMaterial(par4, par5, par6).isSolid()) + { + return false; + } + else + { + if (par7 == 1) + { + ++par5; + } + + if (par7 == 2) + { + --par6; + } + + if (par7 == 3) + { + ++par6; + } + + if (par7 == 4) + { + --par4; + } + + if (par7 == 5) + { + ++par4; + } + + if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else if (!Block.skull.canPlaceBlockAt(par3World, par4, par5, par6)) + { + return false; + } + else + { + par3World.setBlock(par4, par5, par6, Block.skull.blockID, par7, 2); + int var11 = 0; + + if (par7 == 1) + { + var11 = MathHelper.floor_double((double)(par2EntityPlayer.rotationYaw * 16.0F / 360.0F) + 0.5D) & 15; + } + + TileEntity var12 = par3World.getBlockTileEntity(par4, par5, par6); + + if (var12 != null && var12 instanceof TileEntitySkull) + { + String var13 = ""; + + if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("SkullOwner")) + { + var13 = par1ItemStack.getTagCompound().getString("SkullOwner"); + } + + ((TileEntitySkull)var12).setSkullType(par1ItemStack.getItemDamage(), var13); + ((TileEntitySkull)var12).setSkullRotation(var11); + ((BlockSkull)Block.skull).makeWither(par3World, par4, par5, par6, (TileEntitySkull)var12); + } + + --par1ItemStack.stackSize; + return true; + } + } + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) + { + for (int var4 = 0; var4 < skullTypes.length; ++var4) + { + par3List.add(new ItemStack(par1, 1, var4)); + } + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + if (par1 < 0 || par1 >= skullTypes.length) + { + par1 = 0; + } + + return this.field_94586_c[par1]; + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + public int getMetadata(int par1) + { + return par1; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack par1ItemStack) + { + int var2 = par1ItemStack.getItemDamage(); + + if (var2 < 0 || var2 >= skullTypes.length) + { + var2 = 0; + } + + return super.getUnlocalizedName() + "." + skullTypes[var2]; + } + + public String getItemDisplayName(ItemStack par1ItemStack) + { + return par1ItemStack.getItemDamage() == 3 && par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("SkullOwner") ? StatCollector.translateToLocalFormatted("item.skull.player.name", new Object[] {par1ItemStack.getTagCompound().getString("SkullOwner")}): super.getItemDisplayName(par1ItemStack); + } + + public void registerIcons(IconRegister par1IconRegister) + { + this.field_94586_c = new Icon[field_94587_a.length]; + + for (int var2 = 0; var2 < field_94587_a.length; ++var2) + { + this.field_94586_c[var2] = par1IconRegister.registerIcon(this.getIconString() + "_" + field_94587_a[var2]); + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemSlab.java b/src/main/java/net/minecraft/src/ItemSlab.java new file mode 100644 index 0000000..54daa23 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSlab.java @@ -0,0 +1,198 @@ +package net.minecraft.src; + +public class ItemSlab extends ItemBlock +{ + private final boolean isFullBlock; + + /** Instance of BlockHalfSlab. */ + private final BlockHalfSlab theHalfSlab; + + /** The double-slab block corresponding to this item. */ + private final BlockHalfSlab doubleSlab; + + public ItemSlab(int par1, BlockHalfSlab par2BlockHalfSlab, BlockHalfSlab par3BlockHalfSlab, boolean par4) + { + super(par1); + this.theHalfSlab = par2BlockHalfSlab; + this.doubleSlab = par3BlockHalfSlab; + this.isFullBlock = par4; + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + /** + * Gets an icon index based on an item's damage value + */ + public Icon getIconFromDamage(int par1) + { + return Block.blocksList[this.itemID].getIcon(2, par1); + } + + /** + * Returns the metadata of the block which this Item (ItemBlock) can place + */ + public int getMetadata(int par1) + { + return par1; + } + + /** + * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have + * different names based on their damage or NBT. + */ + public String getUnlocalizedName(ItemStack par1ItemStack) + { + return this.theHalfSlab.getFullSlabName(par1ItemStack.getItemDamage()); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (this.isFullBlock) + { + return super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); + } + else if (par1ItemStack.stackSize == 0) + { + return false; + } + else if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else + { + int var11 = par3World.getBlockId(par4, par5, par6); + int var12 = par3World.getBlockMetadata(par4, par5, par6); + int var13 = var12 & 7; + boolean var14 = (var12 & 8) != 0; + + if ((par7 == 1 && !var14 || par7 == 0 && var14) && var11 == this.theHalfSlab.blockID && var13 == par1ItemStack.getItemDamage()) + { + if (par3World.checkNoEntityCollision(this.doubleSlab.getCollisionBoundingBoxFromPool(par3World, par4, par5, par6)) && par3World.setBlock(par4, par5, par6, this.doubleSlab.blockID, var13, 3)) + { + par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), this.doubleSlab.stepSound.getPlaceSound(), (this.doubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, this.doubleSlab.stepSound.getPitch() * 0.8F); + --par1ItemStack.stackSize; + } + + return true; + } + else + { + return this.func_77888_a(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7) ? true : super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); + } + } + } + + /** + * Returns true if the given ItemBlock can be placed on the given side of the given block position. + */ + public boolean canPlaceItemBlockOnSide(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer, ItemStack par7ItemStack) + { + int var8 = par2; + int var9 = par3; + int var10 = par4; + int var11 = par1World.getBlockId(par2, par3, par4); + int var12 = par1World.getBlockMetadata(par2, par3, par4); + int var13 = var12 & 7; + boolean var14 = (var12 & 8) != 0; + + if ((par5 == 1 && !var14 || par5 == 0 && var14) && var11 == this.theHalfSlab.blockID && var13 == par7ItemStack.getItemDamage()) + { + return true; + } + else + { + if (par5 == 0) + { + --par3; + } + + if (par5 == 1) + { + ++par3; + } + + if (par5 == 2) + { + --par4; + } + + if (par5 == 3) + { + ++par4; + } + + if (par5 == 4) + { + --par2; + } + + if (par5 == 5) + { + ++par2; + } + + var11 = par1World.getBlockId(par2, par3, par4); + var12 = par1World.getBlockMetadata(par2, par3, par4); + var13 = var12 & 7; + var14 = (var12 & 8) != 0; + return var11 == this.theHalfSlab.blockID && var13 == par7ItemStack.getItemDamage() ? true : super.canPlaceItemBlockOnSide(par1World, var8, var9, var10, par5, par6EntityPlayer, par7ItemStack); + } + } + + private boolean func_77888_a(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7) + { + if (par7 == 0) + { + --par5; + } + + if (par7 == 1) + { + ++par5; + } + + if (par7 == 2) + { + --par6; + } + + if (par7 == 3) + { + ++par6; + } + + if (par7 == 4) + { + --par4; + } + + if (par7 == 5) + { + ++par4; + } + + int var8 = par3World.getBlockId(par4, par5, par6); + int var9 = par3World.getBlockMetadata(par4, par5, par6); + int var10 = var9 & 7; + + if (var8 == this.theHalfSlab.blockID && var10 == par1ItemStack.getItemDamage()) + { + if (par3World.checkNoEntityCollision(this.doubleSlab.getCollisionBoundingBoxFromPool(par3World, par4, par5, par6)) && par3World.setBlock(par4, par5, par6, this.doubleSlab.blockID, var10, 3)) + { + par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), this.doubleSlab.stepSound.getPlaceSound(), (this.doubleSlab.stepSound.getVolume() + 1.0F) / 2.0F, this.doubleSlab.stepSound.getPitch() * 0.8F); + --par1ItemStack.stackSize; + } + + return true; + } + else + { + return false; + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemSnow.java b/src/main/java/net/minecraft/src/ItemSnow.java new file mode 100644 index 0000000..b99c655 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSnow.java @@ -0,0 +1,45 @@ +package net.minecraft.src; + +public class ItemSnow extends ItemBlockWithMetadata +{ + public ItemSnow(int par1, Block par2Block) + { + super(par1, par2Block); + } + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) + { + if (par1ItemStack.stackSize == 0) + { + return false; + } + else if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) + { + return false; + } + else + { + int var11 = par3World.getBlockId(par4, par5, par6); + + if (var11 == Block.snow.blockID) + { + Block var12 = Block.blocksList[this.getBlockID()]; + int var13 = par3World.getBlockMetadata(par4, par5, par6); + int var14 = var13 & 7; + + if (var14 <= 6 && par3World.checkNoEntityCollision(var12.getCollisionBoundingBoxFromPool(par3World, par4, par5, par6)) && par3World.setBlockMetadataWithNotify(par4, par5, par6, var14 + 1 | var13 & -8, 2)) + { + par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), var12.stepSound.getPlaceSound(), (var12.stepSound.getVolume() + 1.0F) / 2.0F, var12.stepSound.getPitch() * 0.8F); + --par1ItemStack.stackSize; + return true; + } + } + + return super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); + } + } +} diff --git a/src/main/java/net/minecraft/src/ItemSnowball.java b/src/main/java/net/minecraft/src/ItemSnowball.java new file mode 100644 index 0000000..87fefea --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSnowball.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +public class ItemSnowball extends Item +{ + public ItemSnowball(int par1) + { + super(par1); + this.maxStackSize = 16; + this.setCreativeTab(CreativeTabs.tabMisc); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + if (!par3EntityPlayer.capabilities.isCreativeMode) + { + --par1ItemStack.stackSize; + } + + par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); + + if (!par2World.isRemote) + { + par2World.spawnEntityInWorld(new EntitySnowball(par2World, par3EntityPlayer)); + } + + return par1ItemStack; + } +} diff --git a/src/main/java/net/minecraft/src/ItemSoup.java b/src/main/java/net/minecraft/src/ItemSoup.java new file mode 100644 index 0000000..cb0a069 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSoup.java @@ -0,0 +1,16 @@ +package net.minecraft.src; + +public class ItemSoup extends ItemFood +{ + public ItemSoup(int par1, int par2) + { + super(par1, par2, false); + this.setMaxStackSize(1); + } + + public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + super.onEaten(par1ItemStack, par2World, par3EntityPlayer); + return new ItemStack(Item.bowlEmpty); + } +} diff --git a/src/main/java/net/minecraft/src/ItemSpade.java b/src/main/java/net/minecraft/src/ItemSpade.java new file mode 100644 index 0000000..5cd68b6 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSpade.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +public class ItemSpade extends ItemTool +{ + /** an array of the blocks this spade is effective against */ + private static Block[] blocksEffectiveAgainst = new Block[] {Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium}; + + public ItemSpade(int par1, EnumToolMaterial par2EnumToolMaterial) + { + super(par1, 1.0F, par2EnumToolMaterial, blocksEffectiveAgainst); + } + + /** + * Returns if the item (tool) can harvest results from the block type. + */ + public boolean canHarvestBlock(Block par1Block) + { + return par1Block == Block.snow ? true : par1Block == Block.blockSnow; + } +} diff --git a/src/main/java/net/minecraft/src/ItemStack.java b/src/main/java/net/minecraft/src/ItemStack.java new file mode 100644 index 0000000..7f995e0 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemStack.java @@ -0,0 +1,853 @@ +package net.minecraft.src; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import java.util.Map.Entry; + +public final class ItemStack +{ + public static final DecimalFormat field_111284_a = new DecimalFormat("#.###"); + + /** Size of the stack. */ + public int stackSize; + + /** + * Number of animation frames to go when receiving an item (by walking into it, for example). + */ + public int animationsToGo; + + /** ID of the item. */ + public int itemID; + + /** + * A NBTTagMap containing data about an ItemStack. Can only be used for non stackable items + */ + public NBTTagCompound stackTagCompound; + + /** Damage dealt to the item or number of use. Raise when using items. */ + private int itemDamage; + + /** Item frame this stack is on, or null if not on an item frame. */ + private EntityItemFrame itemFrame; + + public ItemStack(Block par1Block) + { + this(par1Block, 1); + } + + public ItemStack(Block par1Block, int par2) + { + this(par1Block.blockID, par2, 0); + } + + public ItemStack(Block par1Block, int par2, int par3) + { + this(par1Block.blockID, par2, par3); + } + + public ItemStack(Item par1Item) + { + this(par1Item.itemID, 1, 0); + } + + public ItemStack(Item par1Item, int par2) + { + this(par1Item.itemID, par2, 0); + } + + public ItemStack(Item par1Item, int par2, int par3) + { + this(par1Item.itemID, par2, par3); + } + + public ItemStack(int par1, int par2, int par3) + { + this.itemID = par1; + this.stackSize = par2; + this.itemDamage = par3; + + if (this.itemDamage < 0) + { + this.itemDamage = 0; + } + } + + public static ItemStack loadItemStackFromNBT(NBTTagCompound par0NBTTagCompound) + { + ItemStack var1 = new ItemStack(); + var1.readFromNBT(par0NBTTagCompound); + return var1.getItem() != null ? var1 : null; + } + + private ItemStack() {} + + /** + * Remove the argument from the stack size. Return a new stack object with argument size. + */ + public ItemStack splitStack(int par1) + { + ItemStack var2 = new ItemStack(this.itemID, par1, this.itemDamage); + + if (this.stackTagCompound != null) + { + var2.stackTagCompound = (NBTTagCompound)this.stackTagCompound.copy(); + } + + this.stackSize -= par1; + return var2; + } + + /** + * Returns the object corresponding to the stack. + */ + public Item getItem() + { + return Item.itemsList[this.itemID]; + } + + /** + * Returns the icon index of the current stack. + */ + public Icon getIconIndex() + { + return this.getItem().getIconIndex(this); + } + + public int getItemSpriteNumber() + { + return this.getItem().getSpriteNumber(); + } + + public boolean tryPlaceItemIntoWorld(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5, int par6, float par7, float par8, float par9) + { + boolean var10 = this.getItem().onItemUse(this, par1EntityPlayer, par2World, par3, par4, par5, par6, par7, par8, par9); + + if (var10) + { + par1EntityPlayer.addStat(StatList.objectUseStats[this.itemID], 1); + } + + return var10; + } + + /** + * Returns the strength of the stack against a given block. + */ + public float getStrVsBlock(Block par1Block) + { + return this.getItem().getStrVsBlock(this, par1Block); + } + + /** + * Called whenever this item stack is equipped and right clicked. Returns the new item stack to put in the position + * where this item is. Args: world, player + */ + public ItemStack useItemRightClick(World par1World, EntityPlayer par2EntityPlayer) + { + return this.getItem().onItemRightClick(this, par1World, par2EntityPlayer); + } + + public ItemStack onFoodEaten(World par1World, EntityPlayer par2EntityPlayer) + { + return this.getItem().onEaten(this, par1World, par2EntityPlayer); + } + + /** + * Write the stack fields to a NBT object. Return the new NBT object. + */ + public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setShort("id", (short)this.itemID); + par1NBTTagCompound.setByte("Count", (byte)this.stackSize); + par1NBTTagCompound.setShort("Damage", (short)this.itemDamage); + + if (this.stackTagCompound != null) + { + par1NBTTagCompound.setTag("tag", this.stackTagCompound); + } + + return par1NBTTagCompound; + } + + /** + * Read the stack fields from a NBT object. + */ + public void readFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.itemID = par1NBTTagCompound.getShort("id"); + this.stackSize = par1NBTTagCompound.getByte("Count"); + this.itemDamage = par1NBTTagCompound.getShort("Damage"); + + if (this.itemDamage < 0) + { + this.itemDamage = 0; + } + + if (par1NBTTagCompound.hasKey("tag")) + { + this.stackTagCompound = par1NBTTagCompound.getCompoundTag("tag"); + } + } + + /** + * Returns maximum size of the stack. + */ + public int getMaxStackSize() + { + return this.getItem().getItemStackLimit(); + } + + /** + * Returns true if the ItemStack can hold 2 or more units of the item. + */ + public boolean isStackable() + { + return this.getMaxStackSize() > 1 && (!this.isItemStackDamageable() || !this.isItemDamaged()); + } + + /** + * true if this itemStack is damageable + */ + public boolean isItemStackDamageable() + { + return Item.itemsList[this.itemID].getMaxDamage() > 0; + } + + public boolean getHasSubtypes() + { + return Item.itemsList[this.itemID].getHasSubtypes(); + } + + /** + * returns true when a damageable item is damaged + */ + public boolean isItemDamaged() + { + return this.isItemStackDamageable() && this.itemDamage > 0; + } + + /** + * gets the damage of an itemstack, for displaying purposes + */ + public int getItemDamageForDisplay() + { + return this.itemDamage; + } + + /** + * gets the damage of an itemstack + */ + public int getItemDamage() + { + return this.itemDamage; + } + + /** + * Sets the item damage of the ItemStack. + */ + public void setItemDamage(int par1) + { + this.itemDamage = par1; + + if (this.itemDamage < 0) + { + this.itemDamage = 0; + } + } + + /** + * Returns the max damage an item in the stack can take. + */ + public int getMaxDamage() + { + return Item.itemsList[this.itemID].getMaxDamage(); + } + + /** + * Attempts to damage the ItemStack with par1 amount of damage, If the ItemStack has the Unbreaking enchantment + * there is a chance for each point of damage to be negated. Returns true if it takes more damage than + * getMaxDamage(). Returns false otherwise or if the ItemStack can't be damaged or if all points of damage are + * negated. + */ + public boolean attemptDamageItem(int par1, Random par2Random) + { + if (!this.isItemStackDamageable()) + { + return false; + } + else + { + if (par1 > 0) + { + int var3 = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, this); + int var4 = 0; + + for (int var5 = 0; var3 > 0 && var5 < par1; ++var5) + { + if (EnchantmentDurability.negateDamage(this, var3, par2Random)) + { + ++var4; + } + } + + par1 -= var4; + + if (par1 <= 0) + { + return false; + } + } + + this.itemDamage += par1; + return this.itemDamage > this.getMaxDamage(); + } + } + + /** + * Damages the item in the ItemStack + */ + public void damageItem(int par1, EntityLivingBase par2EntityLivingBase) + { + if (!(par2EntityLivingBase instanceof EntityPlayer) || !((EntityPlayer)par2EntityLivingBase).capabilities.isCreativeMode) + { + if (this.isItemStackDamageable()) + { + if (this.attemptDamageItem(par1, par2EntityLivingBase.getRNG())) + { + par2EntityLivingBase.renderBrokenItemStack(this); + --this.stackSize; + + if (par2EntityLivingBase instanceof EntityPlayer) + { + EntityPlayer var3 = (EntityPlayer)par2EntityLivingBase; + var3.addStat(StatList.objectBreakStats[this.itemID], 1); + + if (this.stackSize == 0 && this.getItem() instanceof ItemBow) + { + var3.destroyCurrentEquippedItem(); + } + } + + if (this.stackSize < 0) + { + this.stackSize = 0; + } + + this.itemDamage = 0; + } + } + } + } + + /** + * Calls the corresponding fct in di + */ + public void hitEntity(EntityLivingBase par1EntityLivingBase, EntityPlayer par2EntityPlayer) + { + boolean var3 = Item.itemsList[this.itemID].hitEntity(this, par1EntityLivingBase, par2EntityPlayer); + + if (var3) + { + par2EntityPlayer.addStat(StatList.objectUseStats[this.itemID], 1); + } + } + + public void onBlockDestroyed(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) + { + boolean var7 = Item.itemsList[this.itemID].onBlockDestroyed(this, par1World, par2, par3, par4, par5, par6EntityPlayer); + + if (var7) + { + par6EntityPlayer.addStat(StatList.objectUseStats[this.itemID], 1); + } + } + + /** + * Checks if the itemStack object can harvest a specified block + */ + public boolean canHarvestBlock(Block par1Block) + { + return Item.itemsList[this.itemID].canHarvestBlock(par1Block); + } + + public boolean func_111282_a(EntityPlayer par1EntityPlayer, EntityLivingBase par2EntityLivingBase) + { + return Item.itemsList[this.itemID].itemInteractionForEntity(this, par1EntityPlayer, par2EntityLivingBase); + } + + /** + * Returns a new stack with the same properties. + */ + public ItemStack copy() + { + ItemStack var1 = new ItemStack(this.itemID, this.stackSize, this.itemDamage); + + if (this.stackTagCompound != null) + { + var1.stackTagCompound = (NBTTagCompound)this.stackTagCompound.copy(); + } + + return var1; + } + + public static boolean areItemStackTagsEqual(ItemStack par0ItemStack, ItemStack par1ItemStack) + { + return par0ItemStack == null && par1ItemStack == null ? true : (par0ItemStack != null && par1ItemStack != null ? (par0ItemStack.stackTagCompound == null && par1ItemStack.stackTagCompound != null ? false : par0ItemStack.stackTagCompound == null || par0ItemStack.stackTagCompound.equals(par1ItemStack.stackTagCompound)) : false); + } + + /** + * compares ItemStack argument1 with ItemStack argument2; returns true if both ItemStacks are equal + */ + public static boolean areItemStacksEqual(ItemStack par0ItemStack, ItemStack par1ItemStack) + { + return par0ItemStack == null && par1ItemStack == null ? true : (par0ItemStack != null && par1ItemStack != null ? par0ItemStack.isItemStackEqual(par1ItemStack) : false); + } + + /** + * compares ItemStack argument to the instance ItemStack; returns true if both ItemStacks are equal + */ + private boolean isItemStackEqual(ItemStack par1ItemStack) + { + return this.stackSize != par1ItemStack.stackSize ? false : (this.itemID != par1ItemStack.itemID ? false : (this.itemDamage != par1ItemStack.itemDamage ? false : (this.stackTagCompound == null && par1ItemStack.stackTagCompound != null ? false : this.stackTagCompound == null || this.stackTagCompound.equals(par1ItemStack.stackTagCompound)))); + } + + /** + * compares ItemStack argument to the instance ItemStack; returns true if the Items contained in both ItemStacks are + * equal + */ + public boolean isItemEqual(ItemStack par1ItemStack) + { + return this.itemID == par1ItemStack.itemID && this.itemDamage == par1ItemStack.itemDamage; + } + + public String getUnlocalizedName() + { + return Item.itemsList[this.itemID].getUnlocalizedName(this); + } + + /** + * Creates a copy of a ItemStack, a null parameters will return a null. + */ + public static ItemStack copyItemStack(ItemStack par0ItemStack) + { + return par0ItemStack == null ? null : par0ItemStack.copy(); + } + + public String toString() + { + return this.stackSize + "x" + Item.itemsList[this.itemID].getUnlocalizedName() + "@" + this.itemDamage; + } + + /** + * Called each tick as long the ItemStack in on player inventory. Used to progress the pickup animation and update + * maps. + */ + public void updateAnimation(World par1World, Entity par2Entity, int par3, boolean par4) + { + if (this.animationsToGo > 0) + { + --this.animationsToGo; + } + + Item.itemsList[this.itemID].onUpdate(this, par1World, par2Entity, par3, par4); + } + + public void onCrafting(World par1World, EntityPlayer par2EntityPlayer, int par3) + { + par2EntityPlayer.addStat(StatList.objectCraftStats[this.itemID], par3); + Item.itemsList[this.itemID].onCreated(this, par1World, par2EntityPlayer); + } + + public int getMaxItemUseDuration() + { + return this.getItem().getMaxItemUseDuration(this); + } + + public EnumAction getItemUseAction() + { + return this.getItem().getItemUseAction(this); + } + + /** + * Called when the player releases the use item button. Args: world, entityplayer, itemInUseCount + */ + public void onPlayerStoppedUsing(World par1World, EntityPlayer par2EntityPlayer, int par3) + { + this.getItem().onPlayerStoppedUsing(this, par1World, par2EntityPlayer, par3); + } + + /** + * Returns true if the ItemStack has an NBTTagCompound. Currently used to store enchantments. + */ + public boolean hasTagCompound() + { + return this.stackTagCompound != null; + } + + /** + * Returns the NBTTagCompound of the ItemStack. + */ + public NBTTagCompound getTagCompound() + { + return this.stackTagCompound; + } + + public NBTTagList getEnchantmentTagList() + { + return this.stackTagCompound == null ? null : (NBTTagList)this.stackTagCompound.getTag("ench"); + } + + /** + * Assigns a NBTTagCompound to the ItemStack, minecraft validates that only non-stackable items can have it. + */ + public void setTagCompound(NBTTagCompound par1NBTTagCompound) + { + this.stackTagCompound = par1NBTTagCompound; + } + + /** + * returns the display name of the itemstack + */ + public String getDisplayName() + { + String var1 = this.getItem().getItemDisplayName(this); + + if (this.stackTagCompound != null && this.stackTagCompound.hasKey("display")) + { + NBTTagCompound var2 = this.stackTagCompound.getCompoundTag("display"); + + if (var2.hasKey("Name")) + { + var1 = var2.getString("Name"); + } + } + + return var1; + } + + /** + * Sets the item's name (used by anvil to rename the items). + */ + public void setItemName(String par1Str) + { + if (this.stackTagCompound == null) + { + this.stackTagCompound = new NBTTagCompound("tag"); + } + + if (!this.stackTagCompound.hasKey("display")) + { + this.stackTagCompound.setCompoundTag("display", new NBTTagCompound()); + } + + this.stackTagCompound.getCompoundTag("display").setString("Name", par1Str); + } + + public void func_135074_t() + { + if (this.stackTagCompound != null) + { + if (this.stackTagCompound.hasKey("display")) + { + NBTTagCompound var1 = this.stackTagCompound.getCompoundTag("display"); + var1.removeTag("Name"); + + if (var1.hasNoTags()) + { + this.stackTagCompound.removeTag("display"); + + if (this.stackTagCompound.hasNoTags()) + { + this.setTagCompound((NBTTagCompound)null); + } + } + } + } + } + + /** + * Returns true if the itemstack has a display name + */ + public boolean hasDisplayName() + { + return this.stackTagCompound == null ? false : (!this.stackTagCompound.hasKey("display") ? false : this.stackTagCompound.getCompoundTag("display").hasKey("Name")); + } + + /** + * Return a list of strings containing information about the item + */ + public List getTooltip(EntityPlayer par1EntityPlayer, boolean par2) + { + ArrayList var3 = new ArrayList(); + Item var4 = Item.itemsList[this.itemID]; + String var5 = this.getDisplayName(); + + if (this.hasDisplayName()) + { + var5 = EnumChatFormatting.ITALIC + var5 + EnumChatFormatting.RESET; + } + + if (par2) + { + String var6 = ""; + + if (var5.length() > 0) + { + var5 = var5 + " ("; + var6 = ")"; + } + + if (this.getHasSubtypes()) + { + var5 = var5 + String.format("#%04d/%d%s", new Object[] {Integer.valueOf(this.itemID), Integer.valueOf(this.itemDamage), var6}); + } + else + { + var5 = var5 + String.format("#%04d%s", new Object[] {Integer.valueOf(this.itemID), var6}); + } + } + else if (!this.hasDisplayName() && this.itemID == Item.map.itemID) + { + var5 = var5 + " #" + this.itemDamage; + } + + var3.add(var5); + var4.addInformation(this, par1EntityPlayer, var3, par2); + + if (this.hasTagCompound()) + { + NBTTagList var14 = this.getEnchantmentTagList(); + + if (var14 != null) + { + for (int var7 = 0; var7 < var14.tagCount(); ++var7) + { + short var8 = ((NBTTagCompound)var14.tagAt(var7)).getShort("id"); + short var9 = ((NBTTagCompound)var14.tagAt(var7)).getShort("lvl"); + + if (Enchantment.enchantmentsList[var8] != null) + { + var3.add(Enchantment.enchantmentsList[var8].getTranslatedName(var9)); + } + } + } + + if (this.stackTagCompound.hasKey("display")) + { + NBTTagCompound var16 = this.stackTagCompound.getCompoundTag("display"); + + if (var16.hasKey("color")) + { + if (par2) + { + var3.add("Color: #" + Integer.toHexString(var16.getInteger("color")).toUpperCase()); + } + else + { + var3.add(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("item.dyed")); + } + } + + if (var16.hasKey("Lore")) + { + NBTTagList var18 = var16.getTagList("Lore"); + + if (var18.tagCount() > 0) + { + for (int var20 = 0; var20 < var18.tagCount(); ++var20) + { + var3.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + ((NBTTagString)var18.tagAt(var20)).data); + } + } + } + } + } + + Multimap var15 = this.getAttributeModifiers(); + + if (!var15.isEmpty()) + { + var3.add(""); + Iterator var17 = var15.entries().iterator(); + + while (var17.hasNext()) + { + Entry var19 = (Entry)var17.next(); + AttributeModifier var21 = (AttributeModifier)var19.getValue(); + double var10 = var21.getAmount(); + double var12; + + if (var21.getOperation() != 1 && var21.getOperation() != 2) + { + var12 = var21.getAmount(); + } + else + { + var12 = var21.getAmount() * 100.0D; + } + + if (var10 > 0.0D) + { + var3.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + var21.getOperation(), new Object[] {field_111284_a.format(var12), StatCollector.translateToLocal("attribute.name." + (String)var19.getKey())})); + } + else if (var10 < 0.0D) + { + var12 *= -1.0D; + var3.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted("attribute.modifier.take." + var21.getOperation(), new Object[] {field_111284_a.format(var12), StatCollector.translateToLocal("attribute.name." + (String)var19.getKey())})); + } + } + } + + if (par2 && this.isItemDamaged()) + { + var3.add("Durability: " + (this.getMaxDamage() - this.getItemDamageForDisplay()) + " / " + this.getMaxDamage()); + } + + return var3; + } + + public boolean hasEffect() + { + return this.getItem().hasEffect(this); + } + + public EnumRarity getRarity() + { + return this.getItem().getRarity(this); + } + + /** + * True if it is a tool and has no enchantments to begin with + */ + public boolean isItemEnchantable() + { + return !this.getItem().isItemTool(this) ? false : !this.isItemEnchanted(); + } + + /** + * Adds an enchantment with a desired level on the ItemStack. + */ + public void addEnchantment(Enchantment par1Enchantment, int par2) + { + if (this.stackTagCompound == null) + { + this.setTagCompound(new NBTTagCompound()); + } + + if (!this.stackTagCompound.hasKey("ench")) + { + this.stackTagCompound.setTag("ench", new NBTTagList("ench")); + } + + NBTTagList var3 = (NBTTagList)this.stackTagCompound.getTag("ench"); + NBTTagCompound var4 = new NBTTagCompound(); + var4.setShort("id", (short)par1Enchantment.effectId); + var4.setShort("lvl", (short)((byte)par2)); + var3.appendTag(var4); + } + + /** + * True if the item has enchantment data + */ + public boolean isItemEnchanted() + { + return this.stackTagCompound != null && this.stackTagCompound.hasKey("ench"); + } + + public void setTagInfo(String par1Str, NBTBase par2NBTBase) + { + if (this.stackTagCompound == null) + { + this.setTagCompound(new NBTTagCompound()); + } + + this.stackTagCompound.setTag(par1Str, par2NBTBase); + } + + public boolean canEditBlocks() + { + return this.getItem().canItemEditBlocks(); + } + + /** + * Return whether this stack is on an item frame. + */ + public boolean isOnItemFrame() + { + return this.itemFrame != null; + } + + /** + * Set the item frame this stack is on. + */ + public void setItemFrame(EntityItemFrame par1EntityItemFrame) + { + this.itemFrame = par1EntityItemFrame; + } + + /** + * Return the item frame this stack is on. Returns null if not on an item frame. + */ + public EntityItemFrame getItemFrame() + { + return this.itemFrame; + } + + /** + * Get this stack's repair cost, or 0 if no repair cost is defined. + */ + public int getRepairCost() + { + return this.hasTagCompound() && this.stackTagCompound.hasKey("RepairCost") ? this.stackTagCompound.getInteger("RepairCost") : 0; + } + + /** + * Set this stack's repair cost. + */ + public void setRepairCost(int par1) + { + if (!this.hasTagCompound()) + { + this.stackTagCompound = new NBTTagCompound("tag"); + } + + this.stackTagCompound.setInteger("RepairCost", par1); + } + + /** + * Gets the attribute modifiers for this ItemStack.\nWill check for an NBT tag list containing modifiers for the + * stack. + */ + public Multimap getAttributeModifiers() + { + Object var1; + + if (this.hasTagCompound() && this.stackTagCompound.hasKey("AttributeModifiers")) + { + var1 = HashMultimap.create(); + NBTTagList var2 = this.stackTagCompound.getTagList("AttributeModifiers"); + + for (int var3 = 0; var3 < var2.tagCount(); ++var3) + { + NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + AttributeModifier var5 = SharedMonsterAttributes.func_111259_a(var4); + + if (var5.getID().getLeastSignificantBits() != 0L && var5.getID().getMostSignificantBits() != 0L) + { + ((Multimap)var1).put(var4.getString("AttributeName"), var5); + } + } + } + else + { + var1 = this.getItem().getItemAttributeModifiers(); + } + + return (Multimap)var1; + } +} diff --git a/src/main/java/net/minecraft/src/ItemSword.java b/src/main/java/net/minecraft/src/ItemSword.java new file mode 100644 index 0000000..8b9e320 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemSword.java @@ -0,0 +1,136 @@ +package net.minecraft.src; + +import com.google.common.collect.Multimap; + +public class ItemSword extends Item +{ + private float weaponDamage; + private final EnumToolMaterial toolMaterial; + + public ItemSword(int par1, EnumToolMaterial par2EnumToolMaterial) + { + super(par1); + this.toolMaterial = par2EnumToolMaterial; + this.maxStackSize = 1; + this.setMaxDamage(par2EnumToolMaterial.getMaxUses()); + this.setCreativeTab(CreativeTabs.tabCombat); + this.weaponDamage = 4.0F + par2EnumToolMaterial.getDamageVsEntity(); + } + + public float func_82803_g() + { + return this.toolMaterial.getDamageVsEntity(); + } + + /** + * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if + * sword + */ + public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) + { + if (par2Block.blockID == Block.web.blockID) + { + return 15.0F; + } + else + { + Material var3 = par2Block.blockMaterial; + return var3 != Material.plants && var3 != Material.vine && var3 != Material.coral && var3 != Material.leaves && var3 != Material.pumpkin ? 1.0F : 1.5F; + } + } + + /** + * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise + * the damage on the stack. + */ + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) + { + par1ItemStack.damageItem(1, par3EntityLivingBase); + return true; + } + + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) + { + if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D) + { + par1ItemStack.damageItem(2, par7EntityLivingBase); + } + + return true; + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return true; + } + + /** + * returns the action that specifies what animation to play when the items is being used + */ + public EnumAction getItemUseAction(ItemStack par1ItemStack) + { + return EnumAction.block; + } + + /** + * How long it takes to use or consume an item + */ + public int getMaxItemUseDuration(ItemStack par1ItemStack) + { + return 72000; + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + return par1ItemStack; + } + + /** + * Returns if the item (tool) can harvest results from the block type. + */ + public boolean canHarvestBlock(Block par1Block) + { + return par1Block.blockID == Block.web.blockID; + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return this.toolMaterial.getEnchantability(); + } + + /** + * Return the name for this tool's material. + */ + public String getToolMaterialName() + { + return this.toolMaterial.toString(); + } + + /** + * Return whether this item is repairable in an anvil. + */ + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) + { + return this.toolMaterial.getToolCraftingMaterial() == par2ItemStack.itemID ? true : super.getIsRepairable(par1ItemStack, par2ItemStack); + } + + /** + * Gets a map of item attribute modifiers, used by ItemSword to increase hit damage. + */ + public Multimap getItemAttributeModifiers() + { + Multimap var1 = super.getItemAttributeModifiers(); + var1.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)this.weaponDamage, 0)); + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/ItemTool.java b/src/main/java/net/minecraft/src/ItemTool.java new file mode 100644 index 0000000..4234b6c --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemTool.java @@ -0,0 +1,107 @@ +package net.minecraft.src; + +import com.google.common.collect.Multimap; + +public class ItemTool extends Item +{ + /** Array of blocks the tool has extra effect against. */ + private Block[] blocksEffectiveAgainst; + protected float efficiencyOnProperMaterial = 4.0F; + + /** Damage versus entities. */ + private float damageVsEntity; + + /** The material this tool is made from. */ + protected EnumToolMaterial toolMaterial; + + protected ItemTool(int par1, float par2, EnumToolMaterial par3EnumToolMaterial, Block[] par4ArrayOfBlock) + { + super(par1); + this.toolMaterial = par3EnumToolMaterial; + this.blocksEffectiveAgainst = par4ArrayOfBlock; + this.maxStackSize = 1; + this.setMaxDamage(par3EnumToolMaterial.getMaxUses()); + this.efficiencyOnProperMaterial = par3EnumToolMaterial.getEfficiencyOnProperMaterial(); + this.damageVsEntity = par2 + par3EnumToolMaterial.getDamageVsEntity(); + this.setCreativeTab(CreativeTabs.tabTools); + } + + /** + * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if + * sword + */ + public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) + { + for (int var3 = 0; var3 < this.blocksEffectiveAgainst.length; ++var3) + { + if (this.blocksEffectiveAgainst[var3] == par2Block) + { + return this.efficiencyOnProperMaterial; + } + } + + return 1.0F; + } + + /** + * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise + * the damage on the stack. + */ + public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) + { + par1ItemStack.damageItem(2, par3EntityLivingBase); + return true; + } + + public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase) + { + if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D) + { + par1ItemStack.damageItem(1, par7EntityLivingBase); + } + + return true; + } + + /** + * Returns True is the item is renderer in full 3D when hold. + */ + public boolean isFull3D() + { + return true; + } + + /** + * Return the enchantability factor of the item, most of the time is based on material. + */ + public int getItemEnchantability() + { + return this.toolMaterial.getEnchantability(); + } + + /** + * Return the name for this tool's material. + */ + public String getToolMaterialName() + { + return this.toolMaterial.toString(); + } + + /** + * Return whether this item is repairable in an anvil. + */ + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) + { + return this.toolMaterial.getToolCraftingMaterial() == par2ItemStack.itemID ? true : super.getIsRepairable(par1ItemStack, par2ItemStack); + } + + /** + * Gets a map of item attribute modifiers, used by ItemSword to increase hit damage. + */ + public Multimap getItemAttributeModifiers() + { + Multimap var1 = super.getItemAttributeModifiers(); + var1.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", (double)this.damageVsEntity, 0)); + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/ItemWritableBook.java b/src/main/java/net/minecraft/src/ItemWritableBook.java new file mode 100644 index 0000000..ed65c06 --- /dev/null +++ b/src/main/java/net/minecraft/src/ItemWritableBook.java @@ -0,0 +1,60 @@ +package net.minecraft.src; + +public class ItemWritableBook extends Item +{ + public ItemWritableBook(int par1) + { + super(par1); + this.setMaxStackSize(1); + } + + /** + * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer + */ + public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + par3EntityPlayer.displayGUIBook(par1ItemStack); + return par1ItemStack; + } + + /** + * If this function returns true (or the item is damageable), the ItemStack's NBT tag will be sent to the client. + */ + public boolean getShareTag() + { + return true; + } + + public static boolean validBookTagPages(NBTTagCompound par0NBTTagCompound) + { + if (par0NBTTagCompound == null) + { + return false; + } + else if (!par0NBTTagCompound.hasKey("pages")) + { + return false; + } + else + { + NBTTagList var1 = (NBTTagList)par0NBTTagCompound.getTag("pages"); + + for (int var2 = 0; var2 < var1.tagCount(); ++var2) + { + NBTTagString var3 = (NBTTagString)var1.tagAt(var2); + + if (var3.data == null) + { + return false; + } + + if (var3.data.length() > 256) + { + return false; + } + } + + return true; + } + } +} diff --git a/src/main/java/net/minecraft/src/KeyBinding.java b/src/main/java/net/minecraft/src/KeyBinding.java new file mode 100644 index 0000000..7e2830b --- /dev/null +++ b/src/main/java/net/minecraft/src/KeyBinding.java @@ -0,0 +1,87 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class KeyBinding +{ + public static List keybindArray = new ArrayList(); + public static IntHashMap hash = new IntHashMap(); + public String keyDescription; + public int keyCode; + + /** because _303 wanted me to call it that(Caironater) */ + public boolean pressed; + public int pressTime; + + public static void onTick(int par0) + { + KeyBinding var1 = (KeyBinding)hash.lookup(par0); + + if (var1 != null) + { + ++var1.pressTime; + } + } + + public static void setKeyBindState(int par0, boolean par1) + { + KeyBinding var2 = (KeyBinding)hash.lookup(par0); + + if (var2 != null) + { + var2.pressed = par1; + } + } + + public static void unPressAllKeys() + { + Iterator var0 = keybindArray.iterator(); + + while (var0.hasNext()) + { + KeyBinding var1 = (KeyBinding)var0.next(); + var1.unpressKey(); + } + } + + public static void resetKeyBindingArrayAndHash() + { + hash.clearMap(); + Iterator var0 = keybindArray.iterator(); + + while (var0.hasNext()) + { + KeyBinding var1 = (KeyBinding)var0.next(); + hash.addKey(var1.keyCode, var1); + } + } + + public KeyBinding(String par1Str, int par2) + { + this.keyDescription = par1Str; + this.keyCode = par2; + keybindArray.add(this); + hash.addKey(par2, this); + } + + public boolean isPressed() + { + if (this.pressTime == 0) + { + return false; + } + else + { + --this.pressTime; + return true; + } + } + + private void unpressKey() + { + this.pressTime = 0; + this.pressed = false; + } +} diff --git a/src/main/java/net/minecraft/src/LanServer.java b/src/main/java/net/minecraft/src/LanServer.java new file mode 100644 index 0000000..d84bbe8 --- /dev/null +++ b/src/main/java/net/minecraft/src/LanServer.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +public class LanServer +{ + private String lanServerMotd; + private String lanServerIpPort; + + /** Last time this LanServer was seen. */ + private long timeLastSeen; + + public LanServer(String par1Str, String par2Str) + { + this.lanServerMotd = par1Str; + this.lanServerIpPort = par2Str; + this.timeLastSeen = Minecraft.getSystemTime(); + } + + public String getServerMotd() + { + return this.lanServerMotd; + } + + public String getServerIpPort() + { + return this.lanServerIpPort; + } + + /** + * Updates the time this LanServer was last seen. + */ + public void updateLastSeen() + { + this.timeLastSeen = Minecraft.getSystemTime(); + } +} diff --git a/src/main/java/net/minecraft/src/LanServerList.java b/src/main/java/net/minecraft/src/LanServerList.java new file mode 100644 index 0000000..ee970b4 --- /dev/null +++ b/src/main/java/net/minecraft/src/LanServerList.java @@ -0,0 +1,59 @@ +package net.minecraft.src; + +import java.net.InetAddress; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +public class LanServerList +{ + private ArrayList listOfLanServers = new ArrayList(); + boolean wasUpdated; + + public synchronized boolean getWasUpdated() + { + return this.wasUpdated; + } + + public synchronized void setWasNotUpdated() + { + this.wasUpdated = false; + } + + public synchronized List getLanServers() + { + return Collections.unmodifiableList(this.listOfLanServers); + } + + public synchronized void func_77551_a(String par1Str, InetAddress par2InetAddress) + { + String var3 = ThreadLanServerPing.getMotdFromPingResponse(par1Str); + String var4 = ThreadLanServerPing.getAdFromPingResponse(par1Str); + + if (var4 != null) + { + var4 = par2InetAddress.getHostAddress() + ":" + var4; + boolean var5 = false; + Iterator var6 = this.listOfLanServers.iterator(); + + while (var6.hasNext()) + { + LanServer var7 = (LanServer)var6.next(); + + if (var7.getServerIpPort().equals(var4)) + { + var7.updateLastSeen(); + var5 = true; + break; + } + } + + if (!var5) + { + this.listOfLanServers.add(new LanServer(var3, var4)); + this.wasUpdated = true; + } + } + } +} diff --git a/src/main/java/net/minecraft/src/Language.java b/src/main/java/net/minecraft/src/Language.java new file mode 100644 index 0000000..ef1b872 --- /dev/null +++ b/src/main/java/net/minecraft/src/Language.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +public class Language implements Comparable +{ + private final String languageCode; + private final String region; + private final String name; + private final boolean bidirectional; + + public Language(String par1Str, String par2Str, String par3Str, boolean par4) + { + this.languageCode = par1Str; + this.region = par2Str; + this.name = par3Str; + this.bidirectional = par4; + } + + public String getLanguageCode() + { + return this.languageCode; + } + + public boolean isBidirectional() + { + return this.bidirectional; + } + + public String toString() + { + return String.format("%s (%s)", new Object[] {this.name, this.region}); + } + + public boolean equals(Object par1Obj) + { + return this == par1Obj ? true : (!(par1Obj instanceof Language) ? false : this.languageCode.equals(((Language)par1Obj).languageCode)); + } + + public int hashCode() + { + return this.languageCode.hashCode(); + } + + public int func_135033_a(Language par1Language) + { + return this.languageCode.compareTo(par1Language.languageCode); + } + + public int compareTo(Object par1Obj) + { + return this.func_135033_a((Language)par1Obj); + } +} diff --git a/src/main/java/net/minecraft/src/LanguageManager.java b/src/main/java/net/minecraft/src/LanguageManager.java new file mode 100644 index 0000000..2b342cf --- /dev/null +++ b/src/main/java/net/minecraft/src/LanguageManager.java @@ -0,0 +1,103 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.SortedSet; + +public class LanguageManager implements ResourceManagerReloadListener +{ + private final MetadataSerializer field_135047_b; + private String currentLanguage; + protected static final Locale currentLocale = new Locale(); + private Map languageMap = Maps.newHashMap(); + + public LanguageManager(MetadataSerializer par1MetadataSerializer, String par2Str) + { + this.field_135047_b = par1MetadataSerializer; + this.currentLanguage = par2Str; + I18n.setLocale(currentLocale); + } + + public void parseLanguageMetadata(List par1List) + { + this.languageMap.clear(); + Iterator var2 = par1List.iterator(); + + while (var2.hasNext()) + { + ResourcePack var3 = (ResourcePack)var2.next(); + + try + { + LanguageMetadataSection var4 = (LanguageMetadataSection)var3.getPackMetadata(this.field_135047_b, "language"); + + if (var4 != null) + { + Iterator var5 = var4.getLanguages().iterator(); + + while (var5.hasNext()) + { + Language var6 = (Language)var5.next(); + + if (!this.languageMap.containsKey(var6.getLanguageCode())) + { + this.languageMap.put(var6.getLanguageCode(), var6); + } + } + } + } + catch (RuntimeException var7) + { + Minecraft.getMinecraft().getLogAgent().logWarningException("Unable to parse metadata section of resourcepack: " + var3.getPackName(), var7); + } + catch (IOException var8) + { + Minecraft.getMinecraft().getLogAgent().logWarningException("Unable to parse metadata section of resourcepack: " + var3.getPackName(), var8); + } + } + } + + public void onResourceManagerReload(ResourceManager par1ResourceManager) + { + ArrayList var2 = Lists.newArrayList(new String[] {"en_US"}); + + if (!"en_US".equals(this.currentLanguage)) + { + var2.add(this.currentLanguage); + } + + currentLocale.loadLocaleDataFiles(par1ResourceManager, var2); + StringTranslate.func_135063_a(currentLocale.field_135032_a); + } + + public boolean isCurrentLocaleUnicode() + { + return currentLocale.isUnicode(); + } + + public boolean isCurrentLanguageBidirectional() + { + return this.getCurrentLanguage().isBidirectional(); + } + + public void setCurrentLanguage(Language par1Language) + { + this.currentLanguage = par1Language.getLanguageCode(); + } + + public Language getCurrentLanguage() + { + return this.languageMap.containsKey(this.currentLanguage) ? (Language)this.languageMap.get(this.currentLanguage) : (Language)this.languageMap.get("en_US"); + } + + public SortedSet getLanguages() + { + return Sets.newTreeSet(this.languageMap.values()); + } +} diff --git a/src/main/java/net/minecraft/src/LanguageMetadataSection.java b/src/main/java/net/minecraft/src/LanguageMetadataSection.java new file mode 100644 index 0000000..1d37df7 --- /dev/null +++ b/src/main/java/net/minecraft/src/LanguageMetadataSection.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +import java.util.Collection; + +public class LanguageMetadataSection implements MetadataSection +{ + private final Collection languages; + + public LanguageMetadataSection(Collection par1Collection) + { + this.languages = par1Collection; + } + + public Collection getLanguages() + { + return this.languages; + } +} diff --git a/src/main/java/net/minecraft/src/LanguageMetadataSectionSerializer.java b/src/main/java/net/minecraft/src/LanguageMetadataSectionSerializer.java new file mode 100644 index 0000000..c852706 --- /dev/null +++ b/src/main/java/net/minecraft/src/LanguageMetadataSectionSerializer.java @@ -0,0 +1,73 @@ +package net.minecraft.src; + +import com.google.common.collect.Sets; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import java.lang.reflect.Type; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map.Entry; + +public class LanguageMetadataSectionSerializer extends BaseMetadataSectionSerializer +{ + public LanguageMetadataSection func_135020_a(JsonElement par1JsonElement, Type par2Type, JsonDeserializationContext par3JsonDeserializationContext) + { + JsonObject var4 = par1JsonElement.getAsJsonObject(); + HashSet var5 = Sets.newHashSet(); + Iterator var6 = var4.entrySet().iterator(); + String var8; + String var11; + String var12; + boolean var13; + + do + { + if (!var6.hasNext()) + { + return new LanguageMetadataSection(var5); + } + + Entry var7 = (Entry)var6.next(); + var8 = (String)var7.getKey(); + JsonElement var9 = (JsonElement)var7.getValue(); + + if (!var9.isJsonObject()) + { + throw new JsonParseException("Invalid language->\'" + var8 + "\': expected object, was " + var9); + } + + JsonObject var10 = var9.getAsJsonObject(); + var11 = this.func_110486_a(var10.get("region"), "region", "", 0, Integer.MAX_VALUE); + var12 = this.func_110486_a(var10.get("name"), "name", "", 0, Integer.MAX_VALUE); + var13 = this.func_110484_a(var10.get("bidirectional"), "bidirectional", Boolean.valueOf(false)); + + if (var11.isEmpty()) + { + throw new JsonParseException("Invalid language->\'" + var8 + "\'->region: empty value"); + } + + if (var12.isEmpty()) + { + throw new JsonParseException("Invalid language->\'" + var8 + "\'->name: empty value"); + } + } + while (var5.add(new Language(var8, var11, var12, var13))); + + throw new JsonParseException("Duplicate language->\'" + var8 + "\' defined"); + } + + /** + * The name of this section type as it appears in JSON. + */ + public String getSectionName() + { + return "language"; + } + + public Object deserialize(JsonElement par1JsonElement, Type par2Type, JsonDeserializationContext par3JsonDeserializationContext) + { + return this.func_135020_a(par1JsonElement, par2Type, par3JsonDeserializationContext); + } +} diff --git a/src/main/java/net/minecraft/src/LayeredTexture.java b/src/main/java/net/minecraft/src/LayeredTexture.java new file mode 100644 index 0000000..02d5dce --- /dev/null +++ b/src/main/java/net/minecraft/src/LayeredTexture.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import java.awt.image.BufferedImage; +import java.awt.image.ImageObserver; +import java.io.IOException; +import java.io.InputStream; +import java.util.Iterator; +import java.util.List; +import javax.imageio.ImageIO; + +public class LayeredTexture extends AbstractTexture +{ + public final List layeredTextureNames; + + public LayeredTexture(String ... par1ArrayOfStr) + { + this.layeredTextureNames = Lists.newArrayList(par1ArrayOfStr); + } + + public void loadTexture(ResourceManager par1ResourceManager) throws IOException + { + BufferedImage var2 = null; + + try + { + Iterator var3 = this.layeredTextureNames.iterator(); + + while (var3.hasNext()) + { + String var4 = (String)var3.next(); + + if (var4 != null) + { + InputStream var5 = par1ResourceManager.getResource(new ResourceLocation(var4)).getInputStream(); + BufferedImage var6 = ImageIO.read(var5); + + if (var2 == null) + { + var2 = new BufferedImage(var6.getWidth(), var6.getHeight(), 2); + } + + var2.getGraphics().drawImage(var6, 0, 0, (ImageObserver)null); + } + } + } + catch (IOException var7) + { + var7.printStackTrace(); + return; + } + + TextureUtil.uploadTextureImage(this.getGlTextureId(), var2); + } +} diff --git a/src/main/java/net/minecraft/src/LoadingScreenRenderer.java b/src/main/java/net/minecraft/src/LoadingScreenRenderer.java new file mode 100644 index 0000000..2a80981 --- /dev/null +++ b/src/main/java/net/minecraft/src/LoadingScreenRenderer.java @@ -0,0 +1,167 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; + +public class LoadingScreenRenderer implements IProgressUpdate +{ + private String field_73727_a = ""; + + /** A reference to the Minecraft object. */ + private Minecraft mc; + + /** + * The text currently displayed (i.e. the argument to the last call to printText or func_73722_d) + */ + private String currentlyDisplayedText = ""; + private long field_73723_d = Minecraft.getSystemTime(); + private boolean field_73724_e; + + public LoadingScreenRenderer(Minecraft par1Minecraft) + { + this.mc = par1Minecraft; + } + + /** + * this string, followed by "working..." and then the "% complete" are the 3 lines shown. This resets progress to 0, + * and the WorkingString to "working...". + */ + public void resetProgressAndMessage(String par1Str) + { + this.field_73724_e = false; + this.func_73722_d(par1Str); + } + + /** + * "Saving level", or the loading,or downloading equivelent + */ + public void displayProgressMessage(String par1Str) + { + this.field_73724_e = true; + this.func_73722_d(par1Str); + } + + public void func_73722_d(String par1Str) + { + this.currentlyDisplayedText = par1Str; + + if (!this.mc.running) + { + if (!this.field_73724_e) + { + throw new MinecraftError(); + } + } + else + { + ScaledResolution var2 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, var2.getScaledWidth_double(), var2.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -200.0F); + } + } + + /** + * This is called with "Working..." by resetProgressAndMessage + */ + public void resetProgresAndWorkingMessage(String par1Str) + { + if (!this.mc.running) + { + if (!this.field_73724_e) + { + throw new MinecraftError(); + } + } + else + { + this.field_73723_d = 0L; + this.field_73727_a = par1Str; + this.setLoadingProgress(-1); + this.field_73723_d = 0L; + } + } + + /** + * Updates the progress bar on the loading screen to the specified amount. Args: loadProgress + */ + public void setLoadingProgress(int par1) + { + if (!this.mc.running) + { + if (!this.field_73724_e) + { + throw new MinecraftError(); + } + } + else + { + long var2 = Minecraft.getSystemTime(); + + if (var2 - this.field_73723_d >= 100L) + { + this.field_73723_d = var2; + ScaledResolution var4 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + int var5 = var4.getScaledWidth(); + int var6 = var4.getScaledHeight(); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, var4.getScaledWidth_double(), var4.getScaledHeight_double(), 0.0D, 100.0D, 300.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -200.0F); + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); + Tessellator var7 = Tessellator.instance; + this.mc.getTextureManager().bindTexture(Gui.optionsBackground); + float var8 = 32.0F; + var7.startDrawingQuads(); + var7.setColorOpaque_I(4210752); + var7.addVertexWithUV(0.0D, (double)var6, 0.0D, 0.0D, (double)((float)var6 / var8)); + var7.addVertexWithUV((double)var5, (double)var6, 0.0D, (double)((float)var5 / var8), (double)((float)var6 / var8)); + var7.addVertexWithUV((double)var5, 0.0D, 0.0D, (double)((float)var5 / var8), 0.0D); + var7.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + var7.draw(); + + if (par1 >= 0) + { + byte var9 = 100; + byte var10 = 2; + int var11 = var5 / 2 - var9 / 2; + int var12 = var6 / 2 + 16; + GL11.glDisable(GL11.GL_TEXTURE_2D); + var7.startDrawingQuads(); + var7.setColorOpaque_I(8421504); + var7.addVertex((double)var11, (double)var12, 0.0D); + var7.addVertex((double)var11, (double)(var12 + var10), 0.0D); + var7.addVertex((double)(var11 + var9), (double)(var12 + var10), 0.0D); + var7.addVertex((double)(var11 + var9), (double)var12, 0.0D); + var7.setColorOpaque_I(8454016); + var7.addVertex((double)var11, (double)var12, 0.0D); + var7.addVertex((double)var11, (double)(var12 + var10), 0.0D); + var7.addVertex((double)(var11 + par1), (double)(var12 + var10), 0.0D); + var7.addVertex((double)(var11 + par1), (double)var12, 0.0D); + var7.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + this.mc.fontRenderer.drawStringWithShadow(this.currentlyDisplayedText, (var5 - this.mc.fontRenderer.getStringWidth(this.currentlyDisplayedText)) / 2, var6 / 2 - 4 - 16, 16777215); + this.mc.fontRenderer.drawStringWithShadow(this.field_73727_a, (var5 - this.mc.fontRenderer.getStringWidth(this.field_73727_a)) / 2, var6 / 2 - 4 + 8, 16777215); + Display.update(); + + try + { + Thread.yield(); + } + catch (Exception var13) + { + ; + } + } + } + } +} diff --git a/src/main/java/net/minecraft/src/Locale.java b/src/main/java/net/minecraft/src/Locale.java new file mode 100644 index 0000000..0e37231 --- /dev/null +++ b/src/main/java/net/minecraft/src/Locale.java @@ -0,0 +1,150 @@ +package net.minecraft.src; + +import com.google.common.base.Splitter; +import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; +import java.io.IOException; +import java.io.InputStream; +import java.util.IllegalFormatException; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; +import org.apache.commons.io.Charsets; +import org.apache.commons.io.IOUtils; + +public class Locale +{ + /** Splits on "=" */ + private static final Splitter splitter = Splitter.on('=').limit(2); + private static final Pattern field_135031_c = Pattern.compile("%(\\d+\\$)?[\\d\\.]*[df]"); + Map field_135032_a = Maps.newHashMap(); + private boolean field_135029_d; + + /** + * par2 is a list of languages. For each language $L and domain $D, attempts to load the resource $D:lang/$L.lang + */ + public synchronized void loadLocaleDataFiles(ResourceManager par1ResourceManager, List par2List) + { + this.field_135032_a.clear(); + Iterator var3 = par2List.iterator(); + + while (var3.hasNext()) + { + String var4 = (String)var3.next(); + String var5 = String.format("lang/%s.lang", new Object[] {var4}); + Iterator var6 = par1ResourceManager.getResourceDomains().iterator(); + + while (var6.hasNext()) + { + String var7 = (String)var6.next(); + + try + { + this.loadLocaleData(par1ResourceManager.getAllResources(new ResourceLocation(var7, var5))); + } + catch (IOException var9) + { + ; + } + } + } + + this.checkUnicode(); + } + + public boolean isUnicode() + { + return this.field_135029_d; + } + + private void checkUnicode() + { + this.field_135029_d = false; + Iterator var1 = this.field_135032_a.values().iterator(); + + while (var1.hasNext()) + { + String var2 = (String)var1.next(); + + for (int var3 = 0; var3 < var2.length(); ++var3) + { + if (var2.charAt(var3) >= 256) + { + this.field_135029_d = true; + break; + } + } + } + } + + /** + * par1 is a list of Resources + */ + private void loadLocaleData(List par1List) throws IOException + { + Iterator var2 = par1List.iterator(); + + while (var2.hasNext()) + { + Resource var3 = (Resource)var2.next(); + this.loadLocaleData(var3.getInputStream()); + } + } + + private void loadLocaleData(InputStream par1InputStream) throws IOException + { + Iterator var2 = IOUtils.readLines(par1InputStream, Charsets.UTF_8).iterator(); + + while (var2.hasNext()) + { + String var3 = (String)var2.next(); + + if (!var3.isEmpty() && var3.charAt(0) != 35) + { + String[] var4 = (String[])Iterables.toArray(splitter.split(var3), String.class); + + if (var4 != null && var4.length == 2) + { + String var5 = var4[0]; + String var6 = field_135031_c.matcher(var4[1]).replaceAll("%$1s"); + this.field_135032_a.put(var5, var6); + } + } + } + } + + /** + * Returns the translation, or the key itself if the key could not be translated. + */ + private String translateKeyPrivate(String par1Str) + { + String var2 = (String)this.field_135032_a.get(par1Str); + return var2 == null ? par1Str : var2; + } + + /** + * Returns the translation, or the key itself if the key could not be translated. + */ + public String translateKey(String par1Str) + { + return this.translateKeyPrivate(par1Str); + } + + /** + * Calls String.format(translateKey(key), params) + */ + public String formatMessage(String par1Str, Object[] par2ArrayOfObj) + { + String var3 = this.translateKeyPrivate(par1Str); + + try + { + return String.format(var3, par2ArrayOfObj); + } + catch (IllegalFormatException var5) + { + return "Format error: " + var3; + } + } +} diff --git a/src/main/java/net/minecraft/src/LogAgent.java b/src/main/java/net/minecraft/src/LogAgent.java new file mode 100644 index 0000000..c03270d --- /dev/null +++ b/src/main/java/net/minecraft/src/LogAgent.java @@ -0,0 +1,96 @@ +package net.minecraft.src; + +import java.util.logging.ConsoleHandler; +import java.util.logging.FileHandler; +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class LogAgent implements ILogAgent +{ + private final Logger serverLogger; + private final String logFile; + private final String loggerName; + private final String loggerPrefix; + + public LogAgent(String par1Str, String par2Str, String par3Str) + { + this.serverLogger = Logger.getLogger(par1Str); + this.loggerName = par1Str; + this.loggerPrefix = par2Str; + this.logFile = par3Str; + this.setupLogger(); + } + + /** + * Sets up the logger for usage. + */ + private void setupLogger() + { + this.serverLogger.setUseParentHandlers(false); + Handler[] var1 = this.serverLogger.getHandlers(); + int var2 = var1.length; + + for (int var3 = 0; var3 < var2; ++var3) + { + Handler var4 = var1[var3]; + this.serverLogger.removeHandler(var4); + } + + LogFormatter var6 = new LogFormatter(this, (LogAgentEmptyAnon)null); + ConsoleHandler var7 = new ConsoleHandler(); + var7.setFormatter(var6); + this.serverLogger.addHandler(var7); + + try + { + FileHandler var8 = new FileHandler(this.logFile, true); + var8.setFormatter(var6); + this.serverLogger.addHandler(var8); + } + catch (Exception var5) + { + this.serverLogger.log(Level.WARNING, "Failed to log " + this.loggerName + " to " + this.logFile, var5); + } + } + + public void logInfo(String par1Str) + { + this.serverLogger.log(Level.INFO, par1Str); + } + + public void logWarning(String par1Str) + { + this.serverLogger.log(Level.WARNING, par1Str); + } + + public void logWarningFormatted(String par1Str, Object ... par2ArrayOfObj) + { + this.serverLogger.log(Level.WARNING, par1Str, par2ArrayOfObj); + } + + public void logWarningException(String par1Str, Throwable par2Throwable) + { + this.serverLogger.log(Level.WARNING, par1Str, par2Throwable); + } + + public void logSevere(String par1Str) + { + this.serverLogger.log(Level.SEVERE, par1Str); + } + + public void logSevereException(String par1Str, Throwable par2Throwable) + { + this.serverLogger.log(Level.SEVERE, par1Str, par2Throwable); + } + + public void logFine(String par1Str) + { + this.serverLogger.log(Level.FINE, par1Str); + } + + static String func_98237_a(LogAgent par0LogAgent) + { + return par0LogAgent.loggerPrefix; + } +} diff --git a/src/main/java/net/minecraft/src/LogAgentEmptyAnon.java b/src/main/java/net/minecraft/src/LogAgentEmptyAnon.java new file mode 100644 index 0000000..7fcef7b --- /dev/null +++ b/src/main/java/net/minecraft/src/LogAgentEmptyAnon.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +class LogAgentEmptyAnon +{ +} diff --git a/src/main/java/net/minecraft/src/LogFormatter.java b/src/main/java/net/minecraft/src/LogFormatter.java new file mode 100644 index 0000000..40abd9c --- /dev/null +++ b/src/main/java/net/minecraft/src/LogFormatter.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.SimpleDateFormat; +import java.util.logging.Formatter; +import java.util.logging.LogRecord; + +class LogFormatter extends Formatter +{ + private SimpleDateFormat field_98228_b; + + final LogAgent field_98229_a; + + private LogFormatter(LogAgent par1LogAgent) + { + this.field_98229_a = par1LogAgent; + this.field_98228_b = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + } + + public String format(LogRecord par1LogRecord) + { + StringBuilder var2 = new StringBuilder(); + var2.append(this.field_98228_b.format(Long.valueOf(par1LogRecord.getMillis()))); + + if (LogAgent.func_98237_a(this.field_98229_a) != null) + { + var2.append(LogAgent.func_98237_a(this.field_98229_a)); + } + + var2.append(" [").append(par1LogRecord.getLevel().getName()).append("] "); + var2.append(this.formatMessage(par1LogRecord)); + var2.append('\n'); + Throwable var3 = par1LogRecord.getThrown(); + + if (var3 != null) + { + StringWriter var4 = new StringWriter(); + var3.printStackTrace(new PrintWriter(var4)); + var2.append(var4.toString()); + } + + return var2.toString(); + } + + LogFormatter(LogAgent par1LogAgent, LogAgentEmptyAnon par2LogAgentEmptyAnon) + { + this(par1LogAgent); + } +} diff --git a/src/main/java/net/minecraft/src/LongHashMap.java b/src/main/java/net/minecraft/src/LongHashMap.java new file mode 100644 index 0000000..3d02476 --- /dev/null +++ b/src/main/java/net/minecraft/src/LongHashMap.java @@ -0,0 +1,232 @@ +package net.minecraft.src; + +public class LongHashMap +{ + /** the array of all elements in the hash */ + private transient LongHashMapEntry[] hashArray = new LongHashMapEntry[16]; + + /** the number of elements in the hash array */ + private transient int numHashElements; + + /** + * the maximum amount of elements in the hash (probably 3/4 the size due to meh hashing function) + */ + private int capacity = 12; + + /** + * percent of the hasharray that can be used without hash colliding probably + */ + private final float percentUseable = 0.75F; + + /** count of times elements have been added/removed */ + private transient volatile int modCount; + + /** + * returns the hashed key given the original key + */ + private static int getHashedKey(long par0) + { + return hash((int)(par0 ^ par0 >>> 32)); + } + + /** + * the hash function + */ + private static int hash(int par0) + { + par0 ^= par0 >>> 20 ^ par0 >>> 12; + return par0 ^ par0 >>> 7 ^ par0 >>> 4; + } + + /** + * gets the index in the hash given the array length and the hashed key + */ + private static int getHashIndex(int par0, int par1) + { + return par0 & par1 - 1; + } + + public int getNumHashElements() + { + return this.numHashElements; + } + + /** + * get the value from the map given the key + */ + public Object getValueByKey(long par1) + { + int var3 = getHashedKey(par1); + + for (LongHashMapEntry var4 = this.hashArray[getHashIndex(var3, this.hashArray.length)]; var4 != null; var4 = var4.nextEntry) + { + if (var4.key == par1) + { + return var4.value; + } + } + + return null; + } + + public boolean containsItem(long par1) + { + return this.getEntry(par1) != null; + } + + final LongHashMapEntry getEntry(long par1) + { + int var3 = getHashedKey(par1); + + for (LongHashMapEntry var4 = this.hashArray[getHashIndex(var3, this.hashArray.length)]; var4 != null; var4 = var4.nextEntry) + { + if (var4.key == par1) + { + return var4; + } + } + + return null; + } + + /** + * Add a key-value pair. + */ + public void add(long par1, Object par3Obj) + { + int var4 = getHashedKey(par1); + int var5 = getHashIndex(var4, this.hashArray.length); + + for (LongHashMapEntry var6 = this.hashArray[var5]; var6 != null; var6 = var6.nextEntry) + { + if (var6.key == par1) + { + var6.value = par3Obj; + return; + } + } + + ++this.modCount; + this.createKey(var4, par1, par3Obj, var5); + } + + /** + * resizes the table + */ + private void resizeTable(int par1) + { + LongHashMapEntry[] var2 = this.hashArray; + int var3 = var2.length; + + if (var3 == 1073741824) + { + this.capacity = Integer.MAX_VALUE; + } + else + { + LongHashMapEntry[] var4 = new LongHashMapEntry[par1]; + this.copyHashTableTo(var4); + this.hashArray = var4; + this.capacity = (int)((float)par1 * this.percentUseable); + } + } + + /** + * copies the hash table to the specified array + */ + private void copyHashTableTo(LongHashMapEntry[] par1ArrayOfLongHashMapEntry) + { + LongHashMapEntry[] var2 = this.hashArray; + int var3 = par1ArrayOfLongHashMapEntry.length; + + for (int var4 = 0; var4 < var2.length; ++var4) + { + LongHashMapEntry var5 = var2[var4]; + + if (var5 != null) + { + var2[var4] = null; + LongHashMapEntry var6; + + do + { + var6 = var5.nextEntry; + int var7 = getHashIndex(var5.hash, var3); + var5.nextEntry = par1ArrayOfLongHashMapEntry[var7]; + par1ArrayOfLongHashMapEntry[var7] = var5; + var5 = var6; + } + while (var6 != null); + } + } + } + + /** + * calls the removeKey method and returns removed object + */ + public Object remove(long par1) + { + LongHashMapEntry var3 = this.removeKey(par1); + return var3 == null ? null : var3.value; + } + + /** + * removes the key from the hash linked list + */ + final LongHashMapEntry removeKey(long par1) + { + int var3 = getHashedKey(par1); + int var4 = getHashIndex(var3, this.hashArray.length); + LongHashMapEntry var5 = this.hashArray[var4]; + LongHashMapEntry var6; + LongHashMapEntry var7; + + for (var6 = var5; var6 != null; var6 = var7) + { + var7 = var6.nextEntry; + + if (var6.key == par1) + { + ++this.modCount; + --this.numHashElements; + + if (var5 == var6) + { + this.hashArray[var4] = var7; + } + else + { + var5.nextEntry = var7; + } + + return var6; + } + + var5 = var6; + } + + return var6; + } + + /** + * creates the key in the hash table + */ + private void createKey(int par1, long par2, Object par4Obj, int par5) + { + LongHashMapEntry var6 = this.hashArray[par5]; + this.hashArray[par5] = new LongHashMapEntry(par1, par2, par4Obj, var6); + + if (this.numHashElements++ >= this.capacity) + { + this.resizeTable(2 * this.hashArray.length); + } + } + + /** + * public method to get the hashed key(hashCode) + */ + static int getHashCode(long par0) + { + return getHashedKey(par0); + } +} diff --git a/src/main/java/net/minecraft/src/LongHashMapEntry.java b/src/main/java/net/minecraft/src/LongHashMapEntry.java new file mode 100644 index 0000000..5c09b7f --- /dev/null +++ b/src/main/java/net/minecraft/src/LongHashMapEntry.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +class LongHashMapEntry +{ + /** + * the key as a long (for playerInstances it is the x in the most significant 32 bits and then y) + */ + final long key; + + /** the value held by the hash at the specified key */ + Object value; + + /** the next hashentry in the table */ + LongHashMapEntry nextEntry; + final int hash; + + LongHashMapEntry(int par1, long par2, Object par4Obj, LongHashMapEntry par5LongHashMapEntry) + { + this.value = par4Obj; + this.nextEntry = par5LongHashMapEntry; + this.key = par2; + this.hash = par1; + } + + public final long getKey() + { + return this.key; + } + + public final Object getValue() + { + return this.value; + } + + public final boolean equals(Object par1Obj) + { + if (!(par1Obj instanceof LongHashMapEntry)) + { + return false; + } + else + { + LongHashMapEntry var2 = (LongHashMapEntry)par1Obj; + Long var3 = Long.valueOf(this.getKey()); + Long var4 = Long.valueOf(var2.getKey()); + + if (var3 == var4 || var3 != null && var3.equals(var4)) + { + Object var5 = this.getValue(); + Object var6 = var2.getValue(); + + if (var5 == var6 || var5 != null && var5.equals(var6)) + { + return true; + } + } + + return false; + } + } + + public final int hashCode() + { + return LongHashMap.getHashCode(this.key); + } + + public final String toString() + { + return this.getKey() + "=" + this.getValue(); + } +} diff --git a/src/main/java/net/minecraft/src/LowerStringMap.java b/src/main/java/net/minecraft/src/LowerStringMap.java new file mode 100644 index 0000000..02a1292 --- /dev/null +++ b/src/main/java/net/minecraft/src/LowerStringMap.java @@ -0,0 +1,87 @@ +package net.minecraft.src; + +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; + +public class LowerStringMap implements Map +{ + private final Map internalMap = new LinkedHashMap(); + + public int size() + { + return this.internalMap.size(); + } + + public boolean isEmpty() + { + return this.internalMap.isEmpty(); + } + + public boolean containsKey(Object par1Obj) + { + return this.internalMap.containsKey(par1Obj.toString().toLowerCase()); + } + + public boolean containsValue(Object par1Obj) + { + return this.internalMap.containsKey(par1Obj); + } + + public Object get(Object par1Obj) + { + return this.internalMap.get(par1Obj.toString().toLowerCase()); + } + + /** + * a map already defines a general put + */ + public Object putLower(String par1Str, Object par2Obj) + { + return this.internalMap.put(par1Str.toLowerCase(), par2Obj); + } + + public Object remove(Object par1Obj) + { + return this.internalMap.remove(par1Obj.toString().toLowerCase()); + } + + public void putAll(Map par1Map) + { + Iterator var2 = par1Map.entrySet().iterator(); + + while (var2.hasNext()) + { + Entry var3 = (Entry)var2.next(); + this.putLower((String)var3.getKey(), var3.getValue()); + } + } + + public void clear() + { + this.internalMap.clear(); + } + + public Set keySet() + { + return this.internalMap.keySet(); + } + + public Collection values() + { + return this.internalMap.values(); + } + + public Set entrySet() + { + return this.internalMap.entrySet(); + } + + public Object put(Object par1Obj, Object par2Obj) + { + return this.putLower((String)par1Obj, par2Obj); + } +} diff --git a/src/main/java/net/minecraft/src/MD5String.java b/src/main/java/net/minecraft/src/MD5String.java new file mode 100644 index 0000000..0281f64 --- /dev/null +++ b/src/main/java/net/minecraft/src/MD5String.java @@ -0,0 +1,34 @@ +package net.minecraft.src; + +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class MD5String +{ + /** The salt prepended to the string to be hashed */ + private String salt; + + public MD5String(String par1Str) + { + this.salt = par1Str; + } + + /** + * Gets the MD5 string + */ + public String getMD5String(String par1Str) + { + try + { + String var2 = this.salt + par1Str; + MessageDigest var3 = MessageDigest.getInstance("MD5"); + var3.update(var2.getBytes(), 0, var2.length()); + return (new BigInteger(1, var3.digest())).toString(16); + } + catch (NoSuchAlgorithmException var4) + { + throw new RuntimeException(var4); + } + } +} diff --git a/src/main/java/net/minecraft/src/MainProxyAuthenticator.java b/src/main/java/net/minecraft/src/MainProxyAuthenticator.java new file mode 100644 index 0000000..cbb1efe --- /dev/null +++ b/src/main/java/net/minecraft/src/MainProxyAuthenticator.java @@ -0,0 +1,22 @@ +package net.minecraft.src; + +import java.net.Authenticator; +import java.net.PasswordAuthentication; + +public final class MainProxyAuthenticator extends Authenticator +{ + final String field_111237_a; + + final String field_111236_b; + + public MainProxyAuthenticator(String par1Str, String par2Str) + { + this.field_111237_a = par1Str; + this.field_111236_b = par2Str; + } + + protected PasswordAuthentication getPasswordAuthentication() + { + return new PasswordAuthentication(this.field_111237_a, this.field_111236_b.toCharArray()); + } +} diff --git a/src/main/java/net/minecraft/src/MainShutdownHook.java b/src/main/java/net/minecraft/src/MainShutdownHook.java new file mode 100644 index 0000000..95251f4 --- /dev/null +++ b/src/main/java/net/minecraft/src/MainShutdownHook.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public final class MainShutdownHook extends Thread +{ + public void run() + { + Minecraft.stopIntegratedServer(); + } +} diff --git a/src/main/java/net/minecraft/src/MapColor.java b/src/main/java/net/minecraft/src/MapColor.java new file mode 100644 index 0000000..9618d52 --- /dev/null +++ b/src/main/java/net/minecraft/src/MapColor.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +public class MapColor +{ + /** + * Holds all the 16 colors used on maps, very similar of a pallete system. + */ + public static final MapColor[] mapColorArray = new MapColor[16]; + + /** The map color for Air blocks */ + public static final MapColor airColor = new MapColor(0, 0); + + /** this is the grass color in html format */ + public static final MapColor grassColor = new MapColor(1, 8368696); + + /** This is the color of the sand */ + public static final MapColor sandColor = new MapColor(2, 16247203); + + /** The map color for Cloth and Sponge blocks */ + public static final MapColor clothColor = new MapColor(3, 10987431); + + /** The map color for TNT blocks */ + public static final MapColor tntColor = new MapColor(4, 16711680); + + /** The map color for Ice blocks */ + public static final MapColor iceColor = new MapColor(5, 10526975); + + /** The map color for Iron blocks */ + public static final MapColor ironColor = new MapColor(6, 10987431); + + /** The map color for Leaf, Plant, Cactus, and Pumpkin blocks. */ + public static final MapColor foliageColor = new MapColor(7, 31744); + + /** The map color for Snow Cover and Snow blocks */ + public static final MapColor snowColor = new MapColor(8, 16777215); + + /** The map color for Clay blocks */ + public static final MapColor clayColor = new MapColor(9, 10791096); + + /** The map color for Dirt blocks */ + public static final MapColor dirtColor = new MapColor(10, 12020271); + + /** The map color for Stone blocks */ + public static final MapColor stoneColor = new MapColor(11, 7368816); + + /** The map color for Water blocks */ + public static final MapColor waterColor = new MapColor(12, 4210943); + + /** The map color for Wood blocks */ + public static final MapColor woodColor = new MapColor(13, 6837042); + + /** Holds the color in RGB value that will be rendered on maps. */ + public final int colorValue; + + /** Holds the index of the color used on map. */ + public final int colorIndex; + + private MapColor(int par1, int par2) + { + this.colorIndex = par1; + this.colorValue = par2; + mapColorArray[par1] = this; + } +} diff --git a/src/main/java/net/minecraft/src/MapCoord.java b/src/main/java/net/minecraft/src/MapCoord.java new file mode 100644 index 0000000..5a519b7 --- /dev/null +++ b/src/main/java/net/minecraft/src/MapCoord.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +public class MapCoord +{ + public byte iconSize; + public byte centerX; + public byte centerZ; + public byte iconRotation; + + final MapData data; + + public MapCoord(MapData par1MapData, byte par2, byte par3, byte par4, byte par5) + { + this.data = par1MapData; + this.iconSize = par2; + this.centerX = par3; + this.centerZ = par4; + this.iconRotation = par5; + } +} diff --git a/src/main/java/net/minecraft/src/MapData.java b/src/main/java/net/minecraft/src/MapData.java new file mode 100644 index 0000000..953ca30 --- /dev/null +++ b/src/main/java/net/minecraft/src/MapData.java @@ -0,0 +1,284 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class MapData extends WorldSavedData +{ + public int xCenter; + public int zCenter; + public byte dimension; + public byte scale; + + /** colours */ + public byte[] colors = new byte[16384]; + + /** + * Holds a reference to the MapInfo of the players who own a copy of the map + */ + public List playersArrayList = new ArrayList(); + + /** + * Holds a reference to the players who own a copy of the map and a reference to their MapInfo + */ + private Map playersHashMap = new HashMap(); + public Map playersVisibleOnMap = new LinkedHashMap(); + + public MapData(String par1Str) + { + super(par1Str); + } + + /** + * reads in data from the NBTTagCompound into this MapDataBase + */ + public void readFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.dimension = par1NBTTagCompound.getByte("dimension"); + this.xCenter = par1NBTTagCompound.getInteger("xCenter"); + this.zCenter = par1NBTTagCompound.getInteger("zCenter"); + this.scale = par1NBTTagCompound.getByte("scale"); + + if (this.scale < 0) + { + this.scale = 0; + } + + if (this.scale > 4) + { + this.scale = 4; + } + + short var2 = par1NBTTagCompound.getShort("width"); + short var3 = par1NBTTagCompound.getShort("height"); + + if (var2 == 128 && var3 == 128) + { + this.colors = par1NBTTagCompound.getByteArray("colors"); + } + else + { + byte[] var4 = par1NBTTagCompound.getByteArray("colors"); + this.colors = new byte[16384]; + int var5 = (128 - var2) / 2; + int var6 = (128 - var3) / 2; + + for (int var7 = 0; var7 < var3; ++var7) + { + int var8 = var7 + var6; + + if (var8 >= 0 || var8 < 128) + { + for (int var9 = 0; var9 < var2; ++var9) + { + int var10 = var9 + var5; + + if (var10 >= 0 || var10 < 128) + { + this.colors[var10 + var8 * 128] = var4[var9 + var7 * var2]; + } + } + } + } + } + } + + /** + * write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities + */ + public void writeToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setByte("dimension", this.dimension); + par1NBTTagCompound.setInteger("xCenter", this.xCenter); + par1NBTTagCompound.setInteger("zCenter", this.zCenter); + par1NBTTagCompound.setByte("scale", this.scale); + par1NBTTagCompound.setShort("width", (short)128); + par1NBTTagCompound.setShort("height", (short)128); + par1NBTTagCompound.setByteArray("colors", this.colors); + } + + /** + * Adds the player passed to the list of visible players and checks to see which players are visible + */ + public void updateVisiblePlayers(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) + { + if (!this.playersHashMap.containsKey(par1EntityPlayer)) + { + MapInfo var3 = new MapInfo(this, par1EntityPlayer); + this.playersHashMap.put(par1EntityPlayer, var3); + this.playersArrayList.add(var3); + } + + if (!par1EntityPlayer.inventory.hasItemStack(par2ItemStack)) + { + this.playersVisibleOnMap.remove(par1EntityPlayer.getCommandSenderName()); + } + + for (int var5 = 0; var5 < this.playersArrayList.size(); ++var5) + { + MapInfo var4 = (MapInfo)this.playersArrayList.get(var5); + + if (!var4.entityplayerObj.isDead && (var4.entityplayerObj.inventory.hasItemStack(par2ItemStack) || par2ItemStack.isOnItemFrame())) + { + if (!par2ItemStack.isOnItemFrame() && var4.entityplayerObj.dimension == this.dimension) + { + this.func_82567_a(0, var4.entityplayerObj.worldObj, var4.entityplayerObj.getCommandSenderName(), var4.entityplayerObj.posX, var4.entityplayerObj.posZ, (double)var4.entityplayerObj.rotationYaw); + } + } + else + { + this.playersHashMap.remove(var4.entityplayerObj); + this.playersArrayList.remove(var4); + } + } + + if (par2ItemStack.isOnItemFrame()) + { + this.func_82567_a(1, par1EntityPlayer.worldObj, "frame-" + par2ItemStack.getItemFrame().entityId, (double)par2ItemStack.getItemFrame().xPosition, (double)par2ItemStack.getItemFrame().zPosition, (double)(par2ItemStack.getItemFrame().hangingDirection * 90)); + } + } + + private void func_82567_a(int par1, World par2World, String par3Str, double par4, double par6, double par8) + { + int var10 = 1 << this.scale; + float var11 = (float)(par4 - (double)this.xCenter) / (float)var10; + float var12 = (float)(par6 - (double)this.zCenter) / (float)var10; + byte var13 = (byte)((int)((double)(var11 * 2.0F) + 0.5D)); + byte var14 = (byte)((int)((double)(var12 * 2.0F) + 0.5D)); + byte var16 = 63; + byte var15; + + if (var11 >= (float)(-var16) && var12 >= (float)(-var16) && var11 <= (float)var16 && var12 <= (float)var16) + { + par8 += par8 < 0.0D ? -8.0D : 8.0D; + var15 = (byte)((int)(par8 * 16.0D / 360.0D)); + + if (this.dimension < 0) + { + int var17 = (int)(par2World.getWorldInfo().getWorldTime() / 10L); + var15 = (byte)(var17 * var17 * 34187121 + var17 * 121 >> 15 & 15); + } + } + else + { + if (Math.abs(var11) >= 320.0F || Math.abs(var12) >= 320.0F) + { + this.playersVisibleOnMap.remove(par3Str); + return; + } + + par1 = 6; + var15 = 0; + + if (var11 <= (float)(-var16)) + { + var13 = (byte)((int)((double)(var16 * 2) + 2.5D)); + } + + if (var12 <= (float)(-var16)) + { + var14 = (byte)((int)((double)(var16 * 2) + 2.5D)); + } + + if (var11 >= (float)var16) + { + var13 = (byte)(var16 * 2 + 1); + } + + if (var12 >= (float)var16) + { + var14 = (byte)(var16 * 2 + 1); + } + } + + this.playersVisibleOnMap.put(par3Str, new MapCoord(this, (byte)par1, var13, var14, var15)); + } + + /** + * Get byte array of packet data to send to players on map for updating map data + */ + public byte[] getUpdatePacketData(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + MapInfo var4 = (MapInfo)this.playersHashMap.get(par3EntityPlayer); + return var4 == null ? null : var4.getPlayersOnMap(par1ItemStack); + } + + /** + * Marks a vertical range of pixels as being modified so they will be resent to clients. Parameters: X, lowest Y, + * highest Y + */ + public void setColumnDirty(int par1, int par2, int par3) + { + super.markDirty(); + + for (int var4 = 0; var4 < this.playersArrayList.size(); ++var4) + { + MapInfo var5 = (MapInfo)this.playersArrayList.get(var4); + + if (var5.field_76209_b[par1] < 0 || var5.field_76209_b[par1] > par2) + { + var5.field_76209_b[par1] = par2; + } + + if (var5.field_76210_c[par1] < 0 || var5.field_76210_c[par1] < par3) + { + var5.field_76210_c[par1] = par3; + } + } + } + + /** + * Updates the client's map with information from other players in MP + */ + public void updateMPMapData(byte[] par1ArrayOfByte) + { + int var2; + + if (par1ArrayOfByte[0] == 0) + { + var2 = par1ArrayOfByte[1] & 255; + int var3 = par1ArrayOfByte[2] & 255; + + for (int var4 = 0; var4 < par1ArrayOfByte.length - 3; ++var4) + { + this.colors[(var4 + var3) * 128 + var2] = par1ArrayOfByte[var4 + 3]; + } + + this.markDirty(); + } + else if (par1ArrayOfByte[0] == 1) + { + this.playersVisibleOnMap.clear(); + + for (var2 = 0; var2 < (par1ArrayOfByte.length - 1) / 3; ++var2) + { + byte var7 = (byte)(par1ArrayOfByte[var2 * 3 + 1] >> 4); + byte var8 = par1ArrayOfByte[var2 * 3 + 2]; + byte var5 = par1ArrayOfByte[var2 * 3 + 3]; + byte var6 = (byte)(par1ArrayOfByte[var2 * 3 + 1] & 15); + this.playersVisibleOnMap.put("icon-" + var2, new MapCoord(this, var7, var8, var5, var6)); + } + } + else if (par1ArrayOfByte[0] == 2) + { + this.scale = par1ArrayOfByte[1]; + } + } + + public MapInfo func_82568_a(EntityPlayer par1EntityPlayer) + { + MapInfo var2 = (MapInfo)this.playersHashMap.get(par1EntityPlayer); + + if (var2 == null) + { + var2 = new MapInfo(this, par1EntityPlayer); + this.playersHashMap.put(par1EntityPlayer, var2); + this.playersArrayList.add(var2); + } + + return var2; + } +} diff --git a/src/main/java/net/minecraft/src/MapGenBase.java b/src/main/java/net/minecraft/src/MapGenBase.java new file mode 100644 index 0000000..5bc543e --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenBase.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +import java.util.Random; + +public class MapGenBase +{ + /** The number of Chunks to gen-check in any given direction. */ + protected int range = 8; + + /** The RNG used by the MapGen classes. */ + protected Random rand = new Random(); + + /** This world object. */ + protected World worldObj; + + public void generate(IChunkProvider par1IChunkProvider, World par2World, int par3, int par4, byte[] par5ArrayOfByte) + { + int var6 = this.range; + this.worldObj = par2World; + this.rand.setSeed(par2World.getSeed()); + long var7 = this.rand.nextLong(); + long var9 = this.rand.nextLong(); + + for (int var11 = par3 - var6; var11 <= par3 + var6; ++var11) + { + for (int var12 = par4 - var6; var12 <= par4 + var6; ++var12) + { + long var13 = (long)var11 * var7; + long var15 = (long)var12 * var9; + this.rand.setSeed(var13 ^ var15 ^ par2World.getSeed()); + this.recursiveGenerate(par2World, var11, var12, par3, par4, par5ArrayOfByte); + } + } + } + + /** + * Recursively called by generate() (generate) and optionally by itself. + */ + protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, byte[] par6ArrayOfByte) {} +} diff --git a/src/main/java/net/minecraft/src/MapGenCaves.java b/src/main/java/net/minecraft/src/MapGenCaves.java new file mode 100644 index 0000000..4ff0dd4 --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenCaves.java @@ -0,0 +1,255 @@ +package net.minecraft.src; + +import java.util.Random; + +public class MapGenCaves extends MapGenBase +{ + /** + * Generates a larger initial cave node than usual. Called 25% of the time. + */ + protected void generateLargeCaveNode(long par1, int par3, int par4, byte[] par5ArrayOfByte, double par6, double par8, double par10) + { + this.generateCaveNode(par1, par3, par4, par5ArrayOfByte, par6, par8, par10, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); + } + + /** + * Generates a node in the current cave system recursion tree. + */ + protected void generateCaveNode(long par1, int par3, int par4, byte[] par5ArrayOfByte, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17) + { + double var19 = (double)(par3 * 16 + 8); + double var21 = (double)(par4 * 16 + 8); + float var23 = 0.0F; + float var24 = 0.0F; + Random var25 = new Random(par1); + + if (par16 <= 0) + { + int var26 = this.range * 16 - 16; + par16 = var26 - var25.nextInt(var26 / 4); + } + + boolean var54 = false; + + if (par15 == -1) + { + par15 = par16 / 2; + var54 = true; + } + + int var27 = var25.nextInt(par16 / 2) + par16 / 4; + + for (boolean var28 = var25.nextInt(6) == 0; par15 < par16; ++par15) + { + double var29 = 1.5D + (double)(MathHelper.sin((float)par15 * (float)Math.PI / (float)par16) * par12 * 1.0F); + double var31 = var29 * par17; + float var33 = MathHelper.cos(par14); + float var34 = MathHelper.sin(par14); + par6 += (double)(MathHelper.cos(par13) * var33); + par8 += (double)var34; + par10 += (double)(MathHelper.sin(par13) * var33); + + if (var28) + { + par14 *= 0.92F; + } + else + { + par14 *= 0.7F; + } + + par14 += var24 * 0.1F; + par13 += var23 * 0.1F; + var24 *= 0.9F; + var23 *= 0.75F; + var24 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 2.0F; + var23 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 4.0F; + + if (!var54 && par15 == var27 && par12 > 1.0F && par16 > 0) + { + this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 - ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); + this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 + ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); + return; + } + + if (var54 || var25.nextInt(4) != 0) + { + double var35 = par6 - var19; + double var37 = par10 - var21; + double var39 = (double)(par16 - par15); + double var41 = (double)(par12 + 2.0F + 16.0F); + + if (var35 * var35 + var37 * var37 - var39 * var39 > var41 * var41) + { + return; + } + + if (par6 >= var19 - 16.0D - var29 * 2.0D && par10 >= var21 - 16.0D - var29 * 2.0D && par6 <= var19 + 16.0D + var29 * 2.0D && par10 <= var21 + 16.0D + var29 * 2.0D) + { + int var55 = MathHelper.floor_double(par6 - var29) - par3 * 16 - 1; + int var36 = MathHelper.floor_double(par6 + var29) - par3 * 16 + 1; + int var56 = MathHelper.floor_double(par8 - var31) - 1; + int var38 = MathHelper.floor_double(par8 + var31) + 1; + int var57 = MathHelper.floor_double(par10 - var29) - par4 * 16 - 1; + int var40 = MathHelper.floor_double(par10 + var29) - par4 * 16 + 1; + + if (var55 < 0) + { + var55 = 0; + } + + if (var36 > 16) + { + var36 = 16; + } + + if (var56 < 1) + { + var56 = 1; + } + + if (var38 > 120) + { + var38 = 120; + } + + if (var57 < 0) + { + var57 = 0; + } + + if (var40 > 16) + { + var40 = 16; + } + + boolean var58 = false; + int var42; + int var45; + + for (var42 = var55; !var58 && var42 < var36; ++var42) + { + for (int var43 = var57; !var58 && var43 < var40; ++var43) + { + for (int var44 = var38 + 1; !var58 && var44 >= var56 - 1; --var44) + { + var45 = (var42 * 16 + var43) * 128 + var44; + + if (var44 >= 0 && var44 < 128) + { + if (par5ArrayOfByte[var45] == Block.waterMoving.blockID || par5ArrayOfByte[var45] == Block.waterStill.blockID) + { + var58 = true; + } + + if (var44 != var56 - 1 && var42 != var55 && var42 != var36 - 1 && var43 != var57 && var43 != var40 - 1) + { + var44 = var56; + } + } + } + } + } + + if (!var58) + { + for (var42 = var55; var42 < var36; ++var42) + { + double var59 = ((double)(var42 + par3 * 16) + 0.5D - par6) / var29; + + for (var45 = var57; var45 < var40; ++var45) + { + double var46 = ((double)(var45 + par4 * 16) + 0.5D - par10) / var29; + int var48 = (var42 * 16 + var45) * 128 + var38; + boolean var49 = false; + + if (var59 * var59 + var46 * var46 < 1.0D) + { + for (int var50 = var38 - 1; var50 >= var56; --var50) + { + double var51 = ((double)var50 + 0.5D - par8) / var31; + + if (var51 > -0.7D && var59 * var59 + var51 * var51 + var46 * var46 < 1.0D) + { + byte var53 = par5ArrayOfByte[var48]; + + if (var53 == Block.grass.blockID) + { + var49 = true; + } + + if (var53 == Block.stone.blockID || var53 == Block.dirt.blockID || var53 == Block.grass.blockID) + { + if (var50 < 10) + { + par5ArrayOfByte[var48] = (byte)Block.lavaMoving.blockID; + } + else + { + par5ArrayOfByte[var48] = 0; + + if (var49 && par5ArrayOfByte[var48 - 1] == Block.dirt.blockID) + { + par5ArrayOfByte[var48 - 1] = this.worldObj.getBiomeGenForCoords(var42 + par3 * 16, var45 + par4 * 16).topBlock; + } + } + } + } + + --var48; + } + } + } + } + + if (var54) + { + break; + } + } + } + } + } + } + + /** + * Recursively called by generate() (generate) and optionally by itself. + */ + protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, byte[] par6ArrayOfByte) + { + int var7 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(40) + 1) + 1); + + if (this.rand.nextInt(15) != 0) + { + var7 = 0; + } + + for (int var8 = 0; var8 < var7; ++var8) + { + double var9 = (double)(par2 * 16 + this.rand.nextInt(16)); + double var11 = (double)this.rand.nextInt(this.rand.nextInt(120) + 8); + double var13 = (double)(par3 * 16 + this.rand.nextInt(16)); + int var15 = 1; + + if (this.rand.nextInt(4) == 0) + { + this.generateLargeCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13); + var15 += this.rand.nextInt(4); + } + + for (int var16 = 0; var16 < var15; ++var16) + { + float var17 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float var18 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; + float var19 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat(); + + if (this.rand.nextInt(10) == 0) + { + var19 *= this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F; + } + + this.generateCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13, var19, var17, var18, 0, 0, 1.0D); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/MapGenCavesHell.java b/src/main/java/net/minecraft/src/MapGenCavesHell.java new file mode 100644 index 0000000..2ccd278 --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenCavesHell.java @@ -0,0 +1,228 @@ +package net.minecraft.src; + +import java.util.Random; + +public class MapGenCavesHell extends MapGenBase +{ + /** + * Generates a larger initial cave node than usual. Called 25% of the time. + */ + protected void generateLargeCaveNode(long par1, int par3, int par4, byte[] par5ArrayOfByte, double par6, double par8, double par10) + { + this.generateCaveNode(par1, par3, par4, par5ArrayOfByte, par6, par8, par10, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); + } + + /** + * Generates a node in the current cave system recursion tree. + */ + protected void generateCaveNode(long par1, int par3, int par4, byte[] par5ArrayOfByte, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17) + { + double var19 = (double)(par3 * 16 + 8); + double var21 = (double)(par4 * 16 + 8); + float var23 = 0.0F; + float var24 = 0.0F; + Random var25 = new Random(par1); + + if (par16 <= 0) + { + int var26 = this.range * 16 - 16; + par16 = var26 - var25.nextInt(var26 / 4); + } + + boolean var53 = false; + + if (par15 == -1) + { + par15 = par16 / 2; + var53 = true; + } + + int var27 = var25.nextInt(par16 / 2) + par16 / 4; + + for (boolean var28 = var25.nextInt(6) == 0; par15 < par16; ++par15) + { + double var29 = 1.5D + (double)(MathHelper.sin((float)par15 * (float)Math.PI / (float)par16) * par12 * 1.0F); + double var31 = var29 * par17; + float var33 = MathHelper.cos(par14); + float var34 = MathHelper.sin(par14); + par6 += (double)(MathHelper.cos(par13) * var33); + par8 += (double)var34; + par10 += (double)(MathHelper.sin(par13) * var33); + + if (var28) + { + par14 *= 0.92F; + } + else + { + par14 *= 0.7F; + } + + par14 += var24 * 0.1F; + par13 += var23 * 0.1F; + var24 *= 0.9F; + var23 *= 0.75F; + var24 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 2.0F; + var23 += (var25.nextFloat() - var25.nextFloat()) * var25.nextFloat() * 4.0F; + + if (!var53 && par15 == var27 && par12 > 1.0F) + { + this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 - ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); + this.generateCaveNode(var25.nextLong(), par3, par4, par5ArrayOfByte, par6, par8, par10, var25.nextFloat() * 0.5F + 0.5F, par13 + ((float)Math.PI / 2F), par14 / 3.0F, par15, par16, 1.0D); + return; + } + + if (var53 || var25.nextInt(4) != 0) + { + double var35 = par6 - var19; + double var37 = par10 - var21; + double var39 = (double)(par16 - par15); + double var41 = (double)(par12 + 2.0F + 16.0F); + + if (var35 * var35 + var37 * var37 - var39 * var39 > var41 * var41) + { + return; + } + + if (par6 >= var19 - 16.0D - var29 * 2.0D && par10 >= var21 - 16.0D - var29 * 2.0D && par6 <= var19 + 16.0D + var29 * 2.0D && par10 <= var21 + 16.0D + var29 * 2.0D) + { + int var54 = MathHelper.floor_double(par6 - var29) - par3 * 16 - 1; + int var36 = MathHelper.floor_double(par6 + var29) - par3 * 16 + 1; + int var55 = MathHelper.floor_double(par8 - var31) - 1; + int var38 = MathHelper.floor_double(par8 + var31) + 1; + int var56 = MathHelper.floor_double(par10 - var29) - par4 * 16 - 1; + int var40 = MathHelper.floor_double(par10 + var29) - par4 * 16 + 1; + + if (var54 < 0) + { + var54 = 0; + } + + if (var36 > 16) + { + var36 = 16; + } + + if (var55 < 1) + { + var55 = 1; + } + + if (var38 > 120) + { + var38 = 120; + } + + if (var56 < 0) + { + var56 = 0; + } + + if (var40 > 16) + { + var40 = 16; + } + + boolean var57 = false; + int var42; + int var45; + + for (var42 = var54; !var57 && var42 < var36; ++var42) + { + for (int var43 = var56; !var57 && var43 < var40; ++var43) + { + for (int var44 = var38 + 1; !var57 && var44 >= var55 - 1; --var44) + { + var45 = (var42 * 16 + var43) * 128 + var44; + + if (var44 >= 0 && var44 < 128) + { + if (par5ArrayOfByte[var45] == Block.lavaMoving.blockID || par5ArrayOfByte[var45] == Block.lavaStill.blockID) + { + var57 = true; + } + + if (var44 != var55 - 1 && var42 != var54 && var42 != var36 - 1 && var43 != var56 && var43 != var40 - 1) + { + var44 = var55; + } + } + } + } + } + + if (!var57) + { + for (var42 = var54; var42 < var36; ++var42) + { + double var58 = ((double)(var42 + par3 * 16) + 0.5D - par6) / var29; + + for (var45 = var56; var45 < var40; ++var45) + { + double var46 = ((double)(var45 + par4 * 16) + 0.5D - par10) / var29; + int var48 = (var42 * 16 + var45) * 128 + var38; + + for (int var49 = var38 - 1; var49 >= var55; --var49) + { + double var50 = ((double)var49 + 0.5D - par8) / var31; + + if (var50 > -0.7D && var58 * var58 + var50 * var50 + var46 * var46 < 1.0D) + { + byte var52 = par5ArrayOfByte[var48]; + + if (var52 == Block.netherrack.blockID || var52 == Block.dirt.blockID || var52 == Block.grass.blockID) + { + par5ArrayOfByte[var48] = 0; + } + } + + --var48; + } + } + } + + if (var53) + { + break; + } + } + } + } + } + } + + /** + * Recursively called by generate() (generate) and optionally by itself. + */ + protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, byte[] par6ArrayOfByte) + { + int var7 = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(10) + 1) + 1); + + if (this.rand.nextInt(5) != 0) + { + var7 = 0; + } + + for (int var8 = 0; var8 < var7; ++var8) + { + double var9 = (double)(par2 * 16 + this.rand.nextInt(16)); + double var11 = (double)this.rand.nextInt(128); + double var13 = (double)(par3 * 16 + this.rand.nextInt(16)); + int var15 = 1; + + if (this.rand.nextInt(4) == 0) + { + this.generateLargeCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13); + var15 += this.rand.nextInt(4); + } + + for (int var16 = 0; var16 < var15; ++var16) + { + float var17 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float var18 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; + float var19 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat(); + this.generateCaveNode(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var9, var11, var13, var19 * 2.0F, var17, var18, 0, 0, 0.5D); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/MapGenMineshaft.java b/src/main/java/net/minecraft/src/MapGenMineshaft.java new file mode 100644 index 0000000..4480be9 --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenMineshaft.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + +public class MapGenMineshaft extends MapGenStructure +{ + private double field_82673_e = 0.01D; + + public MapGenMineshaft() {} + + public String func_143025_a() + { + return "Mineshaft"; + } + + public MapGenMineshaft(Map par1Map) + { + Iterator var2 = par1Map.entrySet().iterator(); + + while (var2.hasNext()) + { + Entry var3 = (Entry)var2.next(); + + if (((String)var3.getKey()).equals("chance")) + { + this.field_82673_e = MathHelper.parseDoubleWithDefault((String)var3.getValue(), this.field_82673_e); + } + } + } + + protected boolean canSpawnStructureAtCoords(int par1, int par2) + { + return this.rand.nextDouble() < this.field_82673_e && this.rand.nextInt(80) < Math.max(Math.abs(par1), Math.abs(par2)); + } + + protected StructureStart getStructureStart(int par1, int par2) + { + return new StructureMineshaftStart(this.worldObj, this.rand, par1, par2); + } +} diff --git a/src/main/java/net/minecraft/src/MapGenNetherBridge.java b/src/main/java/net/minecraft/src/MapGenNetherBridge.java new file mode 100644 index 0000000..2c2f99c --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenNetherBridge.java @@ -0,0 +1,41 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class MapGenNetherBridge extends MapGenStructure +{ + private List spawnList = new ArrayList(); + + public MapGenNetherBridge() + { + this.spawnList.add(new SpawnListEntry(EntityBlaze.class, 10, 2, 3)); + this.spawnList.add(new SpawnListEntry(EntityPigZombie.class, 5, 4, 4)); + this.spawnList.add(new SpawnListEntry(EntitySkeleton.class, 10, 4, 4)); + this.spawnList.add(new SpawnListEntry(EntityMagmaCube.class, 3, 4, 4)); + } + + public String func_143025_a() + { + return "Fortress"; + } + + public List getSpawnList() + { + return this.spawnList; + } + + protected boolean canSpawnStructureAtCoords(int par1, int par2) + { + int var3 = par1 >> 4; + int var4 = par2 >> 4; + this.rand.setSeed((long)(var3 ^ var4 << 4) ^ this.worldObj.getSeed()); + this.rand.nextInt(); + return this.rand.nextInt(3) != 0 ? false : (par1 != (var3 << 4) + 4 + this.rand.nextInt(8) ? false : par2 == (var4 << 4) + 4 + this.rand.nextInt(8)); + } + + protected StructureStart getStructureStart(int par1, int par2) + { + return new StructureNetherBridgeStart(this.worldObj, this.rand, par1, par2); + } +} diff --git a/src/main/java/net/minecraft/src/MapGenRavine.java b/src/main/java/net/minecraft/src/MapGenRavine.java new file mode 100644 index 0000000..dea5773 --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenRavine.java @@ -0,0 +1,223 @@ +package net.minecraft.src; + +import java.util.Random; + +public class MapGenRavine extends MapGenBase +{ + private float[] field_75046_d = new float[1024]; + + protected void generateRavine(long par1, int par3, int par4, byte[] par5ArrayOfByte, double par6, double par8, double par10, float par12, float par13, float par14, int par15, int par16, double par17) + { + Random var19 = new Random(par1); + double var20 = (double)(par3 * 16 + 8); + double var22 = (double)(par4 * 16 + 8); + float var24 = 0.0F; + float var25 = 0.0F; + + if (par16 <= 0) + { + int var26 = this.range * 16 - 16; + par16 = var26 - var19.nextInt(var26 / 4); + } + + boolean var53 = false; + + if (par15 == -1) + { + par15 = par16 / 2; + var53 = true; + } + + float var27 = 1.0F; + + for (int var28 = 0; var28 < 128; ++var28) + { + if (var28 == 0 || var19.nextInt(3) == 0) + { + var27 = 1.0F + var19.nextFloat() * var19.nextFloat() * 1.0F; + } + + this.field_75046_d[var28] = var27 * var27; + } + + for (; par15 < par16; ++par15) + { + double var54 = 1.5D + (double)(MathHelper.sin((float)par15 * (float)Math.PI / (float)par16) * par12 * 1.0F); + double var30 = var54 * par17; + var54 *= (double)var19.nextFloat() * 0.25D + 0.75D; + var30 *= (double)var19.nextFloat() * 0.25D + 0.75D; + float var32 = MathHelper.cos(par14); + float var33 = MathHelper.sin(par14); + par6 += (double)(MathHelper.cos(par13) * var32); + par8 += (double)var33; + par10 += (double)(MathHelper.sin(par13) * var32); + par14 *= 0.7F; + par14 += var25 * 0.05F; + par13 += var24 * 0.05F; + var25 *= 0.8F; + var24 *= 0.5F; + var25 += (var19.nextFloat() - var19.nextFloat()) * var19.nextFloat() * 2.0F; + var24 += (var19.nextFloat() - var19.nextFloat()) * var19.nextFloat() * 4.0F; + + if (var53 || var19.nextInt(4) != 0) + { + double var34 = par6 - var20; + double var36 = par10 - var22; + double var38 = (double)(par16 - par15); + double var40 = (double)(par12 + 2.0F + 16.0F); + + if (var34 * var34 + var36 * var36 - var38 * var38 > var40 * var40) + { + return; + } + + if (par6 >= var20 - 16.0D - var54 * 2.0D && par10 >= var22 - 16.0D - var54 * 2.0D && par6 <= var20 + 16.0D + var54 * 2.0D && par10 <= var22 + 16.0D + var54 * 2.0D) + { + int var55 = MathHelper.floor_double(par6 - var54) - par3 * 16 - 1; + int var35 = MathHelper.floor_double(par6 + var54) - par3 * 16 + 1; + int var56 = MathHelper.floor_double(par8 - var30) - 1; + int var37 = MathHelper.floor_double(par8 + var30) + 1; + int var57 = MathHelper.floor_double(par10 - var54) - par4 * 16 - 1; + int var39 = MathHelper.floor_double(par10 + var54) - par4 * 16 + 1; + + if (var55 < 0) + { + var55 = 0; + } + + if (var35 > 16) + { + var35 = 16; + } + + if (var56 < 1) + { + var56 = 1; + } + + if (var37 > 120) + { + var37 = 120; + } + + if (var57 < 0) + { + var57 = 0; + } + + if (var39 > 16) + { + var39 = 16; + } + + boolean var58 = false; + int var41; + int var44; + + for (var41 = var55; !var58 && var41 < var35; ++var41) + { + for (int var42 = var57; !var58 && var42 < var39; ++var42) + { + for (int var43 = var37 + 1; !var58 && var43 >= var56 - 1; --var43) + { + var44 = (var41 * 16 + var42) * 128 + var43; + + if (var43 >= 0 && var43 < 128) + { + if (par5ArrayOfByte[var44] == Block.waterMoving.blockID || par5ArrayOfByte[var44] == Block.waterStill.blockID) + { + var58 = true; + } + + if (var43 != var56 - 1 && var41 != var55 && var41 != var35 - 1 && var42 != var57 && var42 != var39 - 1) + { + var43 = var56; + } + } + } + } + } + + if (!var58) + { + for (var41 = var55; var41 < var35; ++var41) + { + double var59 = ((double)(var41 + par3 * 16) + 0.5D - par6) / var54; + + for (var44 = var57; var44 < var39; ++var44) + { + double var45 = ((double)(var44 + par4 * 16) + 0.5D - par10) / var54; + int var47 = (var41 * 16 + var44) * 128 + var37; + boolean var48 = false; + + if (var59 * var59 + var45 * var45 < 1.0D) + { + for (int var49 = var37 - 1; var49 >= var56; --var49) + { + double var50 = ((double)var49 + 0.5D - par8) / var30; + + if ((var59 * var59 + var45 * var45) * (double)this.field_75046_d[var49] + var50 * var50 / 6.0D < 1.0D) + { + byte var52 = par5ArrayOfByte[var47]; + + if (var52 == Block.grass.blockID) + { + var48 = true; + } + + if (var52 == Block.stone.blockID || var52 == Block.dirt.blockID || var52 == Block.grass.blockID) + { + if (var49 < 10) + { + par5ArrayOfByte[var47] = (byte)Block.lavaMoving.blockID; + } + else + { + par5ArrayOfByte[var47] = 0; + + if (var48 && par5ArrayOfByte[var47 - 1] == Block.dirt.blockID) + { + par5ArrayOfByte[var47 - 1] = this.worldObj.getBiomeGenForCoords(var41 + par3 * 16, var44 + par4 * 16).topBlock; + } + } + } + } + + --var47; + } + } + } + } + + if (var53) + { + break; + } + } + } + } + } + } + + /** + * Recursively called by generate() (generate) and optionally by itself. + */ + protected void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, byte[] par6ArrayOfByte) + { + if (this.rand.nextInt(50) == 0) + { + double var7 = (double)(par2 * 16 + this.rand.nextInt(16)); + double var9 = (double)(this.rand.nextInt(this.rand.nextInt(40) + 8) + 20); + double var11 = (double)(par3 * 16 + this.rand.nextInt(16)); + byte var13 = 1; + + for (int var14 = 0; var14 < var13; ++var14) + { + float var15 = this.rand.nextFloat() * (float)Math.PI * 2.0F; + float var16 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; + float var17 = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * 2.0F; + this.generateRavine(this.rand.nextLong(), par4, par5, par6ArrayOfByte, var7, var9, var11, var17, var15, var16, 0, 0, 3.0D); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/MapGenScatteredFeature.java b/src/main/java/net/minecraft/src/MapGenScatteredFeature.java new file mode 100644 index 0000000..5bd7ff5 --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenScatteredFeature.java @@ -0,0 +1,122 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Map.Entry; + +public class MapGenScatteredFeature extends MapGenStructure +{ + private static List biomelist = Arrays.asList(new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.desertHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills, BiomeGenBase.swampland}); + + /** contains possible spawns for scattered features */ + private List scatteredFeatureSpawnList; + + /** the maximum distance between scattered features */ + private int maxDistanceBetweenScatteredFeatures; + + /** the minimum distance between scattered features */ + private int minDistanceBetweenScatteredFeatures; + + public MapGenScatteredFeature() + { + this.scatteredFeatureSpawnList = new ArrayList(); + this.maxDistanceBetweenScatteredFeatures = 32; + this.minDistanceBetweenScatteredFeatures = 8; + this.scatteredFeatureSpawnList.add(new SpawnListEntry(EntityWitch.class, 1, 1, 1)); + } + + public MapGenScatteredFeature(Map par1Map) + { + this(); + Iterator var2 = par1Map.entrySet().iterator(); + + while (var2.hasNext()) + { + Entry var3 = (Entry)var2.next(); + + if (((String)var3.getKey()).equals("distance")) + { + this.maxDistanceBetweenScatteredFeatures = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.maxDistanceBetweenScatteredFeatures, this.minDistanceBetweenScatteredFeatures + 1); + } + } + } + + public String func_143025_a() + { + return "Temple"; + } + + protected boolean canSpawnStructureAtCoords(int par1, int par2) + { + int var3 = par1; + int var4 = par2; + + if (par1 < 0) + { + par1 -= this.maxDistanceBetweenScatteredFeatures - 1; + } + + if (par2 < 0) + { + par2 -= this.maxDistanceBetweenScatteredFeatures - 1; + } + + int var5 = par1 / this.maxDistanceBetweenScatteredFeatures; + int var6 = par2 / this.maxDistanceBetweenScatteredFeatures; + Random var7 = this.worldObj.setRandomSeed(var5, var6, 14357617); + var5 *= this.maxDistanceBetweenScatteredFeatures; + var6 *= this.maxDistanceBetweenScatteredFeatures; + var5 += var7.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures); + var6 += var7.nextInt(this.maxDistanceBetweenScatteredFeatures - this.minDistanceBetweenScatteredFeatures); + + if (var3 == var5 && var4 == var6) + { + BiomeGenBase var8 = this.worldObj.getWorldChunkManager().getBiomeGenAt(var3 * 16 + 8, var4 * 16 + 8); + Iterator var9 = biomelist.iterator(); + + while (var9.hasNext()) + { + BiomeGenBase var10 = (BiomeGenBase)var9.next(); + + if (var8 == var10) + { + return true; + } + } + } + + return false; + } + + protected StructureStart getStructureStart(int par1, int par2) + { + return new StructureScatteredFeatureStart(this.worldObj, this.rand, par1, par2); + } + + public boolean func_143030_a(int par1, int par2, int par3) + { + StructureStart var4 = this.func_143028_c(par1, par2, par3); + + if (var4 != null && var4 instanceof StructureScatteredFeatureStart && !var4.components.isEmpty()) + { + StructureComponent var5 = (StructureComponent)var4.components.getFirst(); + return var5 instanceof ComponentScatteredFeatureSwampHut; + } + else + { + return false; + } + } + + /** + * returns possible spawns for scattered features + */ + public List getScatteredFeatureSpawnList() + { + return this.scatteredFeatureSpawnList; + } +} diff --git a/src/main/java/net/minecraft/src/MapGenStronghold.java b/src/main/java/net/minecraft/src/MapGenStronghold.java new file mode 100644 index 0000000..198d9eb --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenStronghold.java @@ -0,0 +1,150 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Map.Entry; + +public class MapGenStronghold extends MapGenStructure +{ + private BiomeGenBase[] allowedBiomeGenBases; + + /** + * is spawned false and set true once the defined BiomeGenBases were compared with the present ones + */ + private boolean ranBiomeCheck; + private ChunkCoordIntPair[] structureCoords; + private double field_82671_h; + private int field_82672_i; + + public MapGenStronghold() + { + this.allowedBiomeGenBases = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.taiga, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills}; + this.structureCoords = new ChunkCoordIntPair[3]; + this.field_82671_h = 32.0D; + this.field_82672_i = 3; + } + + public MapGenStronghold(Map par1Map) + { + this.allowedBiomeGenBases = new BiomeGenBase[] {BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.extremeHills, BiomeGenBase.swampland, BiomeGenBase.taiga, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills}; + this.structureCoords = new ChunkCoordIntPair[3]; + this.field_82671_h = 32.0D; + this.field_82672_i = 3; + Iterator var2 = par1Map.entrySet().iterator(); + + while (var2.hasNext()) + { + Entry var3 = (Entry)var2.next(); + + if (((String)var3.getKey()).equals("distance")) + { + this.field_82671_h = MathHelper.func_82713_a((String)var3.getValue(), this.field_82671_h, 1.0D); + } + else if (((String)var3.getKey()).equals("count")) + { + this.structureCoords = new ChunkCoordIntPair[MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.structureCoords.length, 1)]; + } + else if (((String)var3.getKey()).equals("spread")) + { + this.field_82672_i = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.field_82672_i, 1); + } + } + } + + public String func_143025_a() + { + return "Stronghold"; + } + + protected boolean canSpawnStructureAtCoords(int par1, int par2) + { + if (!this.ranBiomeCheck) + { + Random var3 = new Random(); + var3.setSeed(this.worldObj.getSeed()); + double var4 = var3.nextDouble() * Math.PI * 2.0D; + int var6 = 1; + + for (int var7 = 0; var7 < this.structureCoords.length; ++var7) + { + double var8 = (1.25D * (double)var6 + var3.nextDouble()) * this.field_82671_h * (double)var6; + int var10 = (int)Math.round(Math.cos(var4) * var8); + int var11 = (int)Math.round(Math.sin(var4) * var8); + ArrayList var12 = new ArrayList(); + Collections.addAll(var12, this.allowedBiomeGenBases); + ChunkPosition var13 = this.worldObj.getWorldChunkManager().findBiomePosition((var10 << 4) + 8, (var11 << 4) + 8, 112, var12, var3); + + if (var13 != null) + { + var10 = var13.x >> 4; + var11 = var13.z >> 4; + } + + this.structureCoords[var7] = new ChunkCoordIntPair(var10, var11); + var4 += (Math.PI * 2D) * (double)var6 / (double)this.field_82672_i; + + if (var7 == this.field_82672_i) + { + var6 += 2 + var3.nextInt(5); + this.field_82672_i += 1 + var3.nextInt(2); + } + } + + this.ranBiomeCheck = true; + } + + ChunkCoordIntPair[] var14 = this.structureCoords; + int var15 = var14.length; + + for (int var5 = 0; var5 < var15; ++var5) + { + ChunkCoordIntPair var16 = var14[var5]; + + if (par1 == var16.chunkXPos && par2 == var16.chunkZPos) + { + return true; + } + } + + return false; + } + + /** + * Returns a list of other locations at which the structure generation has been run, or null if not relevant to this + * structure generator. + */ + protected List getCoordList() + { + ArrayList var1 = new ArrayList(); + ChunkCoordIntPair[] var2 = this.structureCoords; + int var3 = var2.length; + + for (int var4 = 0; var4 < var3; ++var4) + { + ChunkCoordIntPair var5 = var2[var4]; + + if (var5 != null) + { + var1.add(var5.getChunkPosition(64)); + } + } + + return var1; + } + + protected StructureStart getStructureStart(int par1, int par2) + { + StructureStrongholdStart var3; + + for (var3 = new StructureStrongholdStart(this.worldObj, this.rand, par1, par2); var3.getComponents().isEmpty() || ((ComponentStrongholdStairs2)var3.getComponents().get(0)).strongholdPortalRoom == null; var3 = new StructureStrongholdStart(this.worldObj, this.rand, par1, par2)) + { + ; + } + + return var3; + } +} diff --git a/src/main/java/net/minecraft/src/MapGenStructure.java b/src/main/java/net/minecraft/src/MapGenStructure.java new file mode 100644 index 0000000..06e24c6 --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenStructure.java @@ -0,0 +1,270 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public abstract class MapGenStructure extends MapGenBase +{ + private MapGenStructureData field_143029_e; + + /** + * Used to store a list of all structures that have been recursively generated. Used so that during recursive + * generation, the structure generator can avoid generating structures that intersect ones that have already been + * placed. + */ + protected Map structureMap = new HashMap(); + + public abstract String func_143025_a(); + + /** + * Recursively called by generate() (generate) and optionally by itself. + */ + protected final void recursiveGenerate(World par1World, int par2, int par3, int par4, int par5, byte[] par6ArrayOfByte) + { + this.func_143027_a(par1World); + + if (!this.structureMap.containsKey(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par2, par3)))) + { + this.rand.nextInt(); + + try + { + if (this.canSpawnStructureAtCoords(par2, par3)) + { + StructureStart var7 = this.getStructureStart(par2, par3); + this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(par2, par3)), var7); + this.func_143026_a(par2, par3, var7); + } + } + catch (Throwable var10) + { + CrashReport var8 = CrashReport.makeCrashReport(var10, "Exception preparing structure feature"); + CrashReportCategory var9 = var8.makeCategory("Feature being prepared"); + var9.addCrashSectionCallable("Is feature chunk", new CallableIsFeatureChunk(this, par2, par3)); + var9.addCrashSection("Chunk location", String.format("%d,%d", new Object[] {Integer.valueOf(par2), Integer.valueOf(par3)})); + var9.addCrashSectionCallable("Chunk pos hash", new CallableChunkPosHash(this, par2, par3)); + var9.addCrashSectionCallable("Structure type", new CallableStructureType(this)); + throw new ReportedException(var8); + } + } + } + + /** + * Generates structures in specified chunk next to existing structures. Does *not* generate StructureStarts. + */ + public boolean generateStructuresInChunk(World par1World, Random par2Random, int par3, int par4) + { + this.func_143027_a(par1World); + int var5 = (par3 << 4) + 8; + int var6 = (par4 << 4) + 8; + boolean var7 = false; + Iterator var8 = this.structureMap.values().iterator(); + + while (var8.hasNext()) + { + StructureStart var9 = (StructureStart)var8.next(); + + if (var9.isSizeableStructure() && var9.getBoundingBox().intersectsWith(var5, var6, var5 + 15, var6 + 15)) + { + var9.generateStructure(par1World, par2Random, new StructureBoundingBox(var5, var6, var5 + 15, var6 + 15)); + var7 = true; + this.func_143026_a(var9.func_143019_e(), var9.func_143018_f(), var9); + } + } + + return var7; + } + + /** + * Returns true if the structure generator has generated a structure located at the given position tuple. + */ + public boolean hasStructureAt(int par1, int par2, int par3) + { + this.func_143027_a(this.worldObj); + return this.func_143028_c(par1, par2, par3) != null; + } + + protected StructureStart func_143028_c(int par1, int par2, int par3) + { + Iterator var4 = this.structureMap.values().iterator(); + + while (var4.hasNext()) + { + StructureStart var5 = (StructureStart)var4.next(); + + if (var5.isSizeableStructure() && var5.getBoundingBox().intersectsWith(par1, par3, par1, par3)) + { + Iterator var6 = var5.getComponents().iterator(); + + while (var6.hasNext()) + { + StructureComponent var7 = (StructureComponent)var6.next(); + + if (var7.getBoundingBox().isVecInside(par1, par2, par3)) + { + return var5; + } + } + } + } + + return null; + } + + public boolean func_142038_b(int par1, int par2, int par3) + { + this.func_143027_a(this.worldObj); + Iterator var4 = this.structureMap.values().iterator(); + StructureStart var5; + + do + { + if (!var4.hasNext()) + { + return false; + } + + var5 = (StructureStart)var4.next(); + } + while (!var5.isSizeableStructure()); + + return var5.getBoundingBox().intersectsWith(par1, par3, par1, par3); + } + + public ChunkPosition getNearestInstance(World par1World, int par2, int par3, int par4) + { + this.worldObj = par1World; + this.func_143027_a(par1World); + this.rand.setSeed(par1World.getSeed()); + long var5 = this.rand.nextLong(); + long var7 = this.rand.nextLong(); + long var9 = (long)(par2 >> 4) * var5; + long var11 = (long)(par4 >> 4) * var7; + this.rand.setSeed(var9 ^ var11 ^ par1World.getSeed()); + this.recursiveGenerate(par1World, par2 >> 4, par4 >> 4, 0, 0, (byte[])null); + double var13 = Double.MAX_VALUE; + ChunkPosition var15 = null; + Iterator var16 = this.structureMap.values().iterator(); + ChunkPosition var19; + int var20; + int var21; + int var22; + double var23; + + while (var16.hasNext()) + { + StructureStart var17 = (StructureStart)var16.next(); + + if (var17.isSizeableStructure()) + { + StructureComponent var18 = (StructureComponent)var17.getComponents().get(0); + var19 = var18.getCenter(); + var20 = var19.x - par2; + var21 = var19.y - par3; + var22 = var19.z - par4; + var23 = (double)(var20 * var20 + var21 * var21 + var22 * var22); + + if (var23 < var13) + { + var13 = var23; + var15 = var19; + } + } + } + + if (var15 != null) + { + return var15; + } + else + { + List var25 = this.getCoordList(); + + if (var25 != null) + { + ChunkPosition var26 = null; + Iterator var27 = var25.iterator(); + + while (var27.hasNext()) + { + var19 = (ChunkPosition)var27.next(); + var20 = var19.x - par2; + var21 = var19.y - par3; + var22 = var19.z - par4; + var23 = (double)(var20 * var20 + var21 * var21 + var22 * var22); + + if (var23 < var13) + { + var13 = var23; + var26 = var19; + } + } + + return var26; + } + else + { + return null; + } + } + } + + /** + * Returns a list of other locations at which the structure generation has been run, or null if not relevant to this + * structure generator. + */ + protected List getCoordList() + { + return null; + } + + private void func_143027_a(World par1World) + { + if (this.field_143029_e == null) + { + this.field_143029_e = (MapGenStructureData)par1World.loadItemData(MapGenStructureData.class, this.func_143025_a()); + + if (this.field_143029_e == null) + { + this.field_143029_e = new MapGenStructureData(this.func_143025_a()); + par1World.setItemData(this.func_143025_a(), this.field_143029_e); + } + else + { + NBTTagCompound var2 = this.field_143029_e.func_143041_a(); + Iterator var3 = var2.getTags().iterator(); + + while (var3.hasNext()) + { + NBTBase var4 = (NBTBase)var3.next(); + + if (var4.getId() == 10) + { + NBTTagCompound var5 = (NBTTagCompound)var4; + + if (var5.hasKey("ChunkX") && var5.hasKey("ChunkZ")) + { + int var6 = var5.getInteger("ChunkX"); + int var7 = var5.getInteger("ChunkZ"); + StructureStart var8 = MapGenStructureIO.func_143035_a(var5, par1World); + this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(var6, var7)), var8); + } + } + } + } + } + } + + private void func_143026_a(int par1, int par2, StructureStart par3StructureStart) + { + this.field_143029_e.func_143043_a(par3StructureStart.func_143021_a(par1, par2), par1, par2); + this.field_143029_e.markDirty(); + } + + protected abstract boolean canSpawnStructureAtCoords(int var1, int var2); + + protected abstract StructureStart getStructureStart(int var1, int var2); +} diff --git a/src/main/java/net/minecraft/src/MapGenStructureData.java b/src/main/java/net/minecraft/src/MapGenStructureData.java new file mode 100644 index 0000000..9e3ea0f --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenStructureData.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +public class MapGenStructureData extends WorldSavedData +{ + private NBTTagCompound field_143044_a = new NBTTagCompound("Features"); + + public MapGenStructureData(String par1Str) + { + super(par1Str); + } + + /** + * reads in data from the NBTTagCompound into this MapDataBase + */ + public void readFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.field_143044_a = par1NBTTagCompound.getCompoundTag("Features"); + } + + /** + * write data to NBTTagCompound from this MapDataBase, similar to Entities and TileEntities + */ + public void writeToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setTag("Features", this.field_143044_a); + } + + public void func_143043_a(NBTTagCompound par1NBTTagCompound, int par2, int par3) + { + String var4 = this.func_143042_b(par2, par3); + par1NBTTagCompound.setName(var4); + this.field_143044_a.setTag(var4, par1NBTTagCompound); + } + + public String func_143042_b(int par1, int par2) + { + return "[" + par1 + "," + par2 + "]"; + } + + public NBTTagCompound func_143041_a() + { + return this.field_143044_a; + } +} diff --git a/src/main/java/net/minecraft/src/MapGenStructureIO.java b/src/main/java/net/minecraft/src/MapGenStructureIO.java new file mode 100644 index 0000000..cf6eebc --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenStructureIO.java @@ -0,0 +1,110 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.Map; + +public class MapGenStructureIO +{ + private static Map field_143040_a = new HashMap(); + private static Map field_143038_b = new HashMap(); + private static Map field_143039_c = new HashMap(); + private static Map field_143037_d = new HashMap(); + + private static void func_143034_b(Class par0Class, String par1Str) + { + field_143040_a.put(par1Str, par0Class); + field_143038_b.put(par0Class, par1Str); + } + + static void func_143031_a(Class par0Class, String par1Str) + { + field_143039_c.put(par1Str, par0Class); + field_143037_d.put(par0Class, par1Str); + } + + public static String func_143033_a(StructureStart par0StructureStart) + { + return (String)field_143038_b.get(par0StructureStart.getClass()); + } + + public static String func_143036_a(StructureComponent par0StructureComponent) + { + return (String)field_143037_d.get(par0StructureComponent.getClass()); + } + + public static StructureStart func_143035_a(NBTTagCompound par0NBTTagCompound, World par1World) + { + StructureStart var2 = null; + + try + { + Class var3 = (Class)field_143040_a.get(par0NBTTagCompound.getString("id")); + + if (var3 != null) + { + var2 = (StructureStart)var3.newInstance(); + } + } + catch (Exception var4) + { + par1World.getWorldLogAgent().logWarning("Failed Start with id " + par0NBTTagCompound.getString("id")); + var4.printStackTrace(); + } + + if (var2 != null) + { + var2.func_143020_a(par1World, par0NBTTagCompound); + } + else + { + par1World.getWorldLogAgent().logWarning("Skipping Structure with id " + par0NBTTagCompound.getString("id")); + } + + return var2; + } + + public static StructureComponent func_143032_b(NBTTagCompound par0NBTTagCompound, World par1World) + { + StructureComponent var2 = null; + + try + { + Class var3 = (Class)field_143039_c.get(par0NBTTagCompound.getString("id")); + + if (var3 != null) + { + var2 = (StructureComponent)var3.newInstance(); + } + } + catch (Exception var4) + { + par1World.getWorldLogAgent().logWarning("Failed Piece with id " + par0NBTTagCompound.getString("id")); + var4.printStackTrace(); + } + + if (var2 != null) + { + var2.func_143009_a(par1World, par0NBTTagCompound); + } + else + { + par1World.getWorldLogAgent().logWarning("Skipping Piece with id " + par0NBTTagCompound.getString("id")); + } + + return var2; + } + + static + { + func_143034_b(StructureMineshaftStart.class, "Mineshaft"); + func_143034_b(StructureVillageStart.class, "Village"); + func_143034_b(StructureNetherBridgeStart.class, "Fortress"); + func_143034_b(StructureStrongholdStart.class, "Stronghold"); + func_143034_b(StructureScatteredFeatureStart.class, "Temple"); + StructureMineshaftPieces.func_143048_a(); + StructureVillagePieces.func_143016_a(); + StructureNetherBridgePieces.func_143049_a(); + StructureStrongholdPieces.func_143046_a(); + ComponentScatteredFeaturePieces.func_143045_a(); + } +} diff --git a/src/main/java/net/minecraft/src/MapGenVillage.java b/src/main/java/net/minecraft/src/MapGenVillage.java new file mode 100644 index 0000000..3a58376 --- /dev/null +++ b/src/main/java/net/minecraft/src/MapGenVillage.java @@ -0,0 +1,91 @@ +package net.minecraft.src; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Map.Entry; + +public class MapGenVillage extends MapGenStructure +{ + /** A list of all the biomes villages can spawn in. */ + public static final List villageSpawnBiomes = Arrays.asList(new BiomeGenBase[] {BiomeGenBase.plains, BiomeGenBase.desert}); + + /** World terrain type, 0 for normal, 1 for flat map */ + private int terrainType; + private int field_82665_g; + private int field_82666_h; + + public MapGenVillage() + { + this.field_82665_g = 32; + this.field_82666_h = 8; + } + + public MapGenVillage(Map par1Map) + { + this(); + Iterator var2 = par1Map.entrySet().iterator(); + + while (var2.hasNext()) + { + Entry var3 = (Entry)var2.next(); + + if (((String)var3.getKey()).equals("size")) + { + this.terrainType = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.terrainType, 0); + } + else if (((String)var3.getKey()).equals("distance")) + { + this.field_82665_g = MathHelper.parseIntWithDefaultAndMax((String)var3.getValue(), this.field_82665_g, this.field_82666_h + 1); + } + } + } + + public String func_143025_a() + { + return "Village"; + } + + protected boolean canSpawnStructureAtCoords(int par1, int par2) + { + int var3 = par1; + int var4 = par2; + + if (par1 < 0) + { + par1 -= this.field_82665_g - 1; + } + + if (par2 < 0) + { + par2 -= this.field_82665_g - 1; + } + + int var5 = par1 / this.field_82665_g; + int var6 = par2 / this.field_82665_g; + Random var7 = this.worldObj.setRandomSeed(var5, var6, 10387312); + var5 *= this.field_82665_g; + var6 *= this.field_82665_g; + var5 += var7.nextInt(this.field_82665_g - this.field_82666_h); + var6 += var7.nextInt(this.field_82665_g - this.field_82666_h); + + if (var3 == var5 && var4 == var6) + { + boolean var8 = this.worldObj.getWorldChunkManager().areBiomesViable(var3 * 16 + 8, var4 * 16 + 8, 0, villageSpawnBiomes); + + if (var8) + { + return true; + } + } + + return false; + } + + protected StructureStart getStructureStart(int par1, int par2) + { + return new StructureVillageStart(this.worldObj, this.rand, par1, par2, this.terrainType); + } +} diff --git a/src/main/java/net/minecraft/src/MapInfo.java b/src/main/java/net/minecraft/src/MapInfo.java new file mode 100644 index 0000000..fcfcf3c --- /dev/null +++ b/src/main/java/net/minecraft/src/MapInfo.java @@ -0,0 +1,128 @@ +package net.minecraft.src; + +import java.util.Iterator; + +public class MapInfo +{ + /** Reference for EntityPlayer object in MapInfo */ + public final EntityPlayer entityplayerObj; + public int[] field_76209_b; + public int[] field_76210_c; + + /** + * updated by x = mod(x*11,128) +1 x-1 is used to index field_76209_b and field_76210_c + */ + private int currentRandomNumber; + private int ticksUntilPlayerLocationMapUpdate; + + /** + * a cache of the result from getPlayersOnMap so that it is not resent when nothing changes + */ + private byte[] lastPlayerLocationOnMap; + public int field_82569_d; + private boolean field_82570_i; + + /** reference in MapInfo to MapData object */ + final MapData mapDataObj; + + public MapInfo(MapData par1MapData, EntityPlayer par2EntityPlayer) + { + this.mapDataObj = par1MapData; + this.field_76209_b = new int[128]; + this.field_76210_c = new int[128]; + this.entityplayerObj = par2EntityPlayer; + + for (int var3 = 0; var3 < this.field_76209_b.length; ++var3) + { + this.field_76209_b[var3] = 0; + this.field_76210_c[var3] = 127; + } + } + + /** + * returns a 1+players*3 array, of x,y, and color . the name of this function may be partially wrong, as there is a + * second branch to the code here + */ + public byte[] getPlayersOnMap(ItemStack par1ItemStack) + { + byte[] var2; + + if (!this.field_82570_i) + { + var2 = new byte[] {(byte)2, this.mapDataObj.scale}; + this.field_82570_i = true; + return var2; + } + else + { + int var3; + int var10; + + if (--this.ticksUntilPlayerLocationMapUpdate < 0) + { + this.ticksUntilPlayerLocationMapUpdate = 4; + var2 = new byte[this.mapDataObj.playersVisibleOnMap.size() * 3 + 1]; + var2[0] = 1; + var3 = 0; + + for (Iterator var4 = this.mapDataObj.playersVisibleOnMap.values().iterator(); var4.hasNext(); ++var3) + { + MapCoord var5 = (MapCoord)var4.next(); + var2[var3 * 3 + 1] = (byte)(var5.iconSize << 4 | var5.iconRotation & 15); + var2[var3 * 3 + 2] = var5.centerX; + var2[var3 * 3 + 3] = var5.centerZ; + } + + boolean var9 = !par1ItemStack.isOnItemFrame(); + + if (this.lastPlayerLocationOnMap != null && this.lastPlayerLocationOnMap.length == var2.length) + { + for (var10 = 0; var10 < var2.length; ++var10) + { + if (var2[var10] != this.lastPlayerLocationOnMap[var10]) + { + var9 = false; + break; + } + } + } + else + { + var9 = false; + } + + if (!var9) + { + this.lastPlayerLocationOnMap = var2; + return var2; + } + } + + for (int var8 = 0; var8 < 1; ++var8) + { + var3 = this.currentRandomNumber++ * 11 % 128; + + if (this.field_76209_b[var3] >= 0) + { + int var11 = this.field_76210_c[var3] - this.field_76209_b[var3] + 1; + var10 = this.field_76209_b[var3]; + byte[] var6 = new byte[var11 + 3]; + var6[0] = 0; + var6[1] = (byte)var3; + var6[2] = (byte)var10; + + for (int var7 = 0; var7 < var6.length - 3; ++var7) + { + var6[var7 + 3] = this.mapDataObj.colors[(var7 + var10) * 128 + var3]; + } + + this.field_76210_c[var3] = -1; + this.field_76209_b[var3] = -1; + return var6; + } + } + + return null; + } + } +} diff --git a/src/main/java/net/minecraft/src/MapItemRenderer.java b/src/main/java/net/minecraft/src/MapItemRenderer.java new file mode 100644 index 0000000..fe395a5 --- /dev/null +++ b/src/main/java/net/minecraft/src/MapItemRenderer.java @@ -0,0 +1,106 @@ +package net.minecraft.src; + +import java.util.Iterator; +import org.lwjgl.opengl.GL11; + +public class MapItemRenderer +{ + private static final ResourceLocation field_111277_a = new ResourceLocation("textures/map/map_icons.png"); + private final DynamicTexture bufferedImage; + private int[] intArray = new int[16384]; + private GameSettings gameSettings; + private final ResourceLocation field_111276_e; + + public MapItemRenderer(GameSettings par1GameSettings, TextureManager par2TextureManager) + { + this.gameSettings = par1GameSettings; + this.bufferedImage = new DynamicTexture(128, 128); + this.field_111276_e = par2TextureManager.getDynamicTextureLocation("map", this.bufferedImage); + this.intArray = this.bufferedImage.getTextureData(); + + for (int var4 = 0; var4 < this.intArray.length; ++var4) + { + this.intArray[var4] = 0; + } + } + + public void renderMap(EntityPlayer par1EntityPlayer, TextureManager par2TextureManager, MapData par3MapData) + { + for (int var4 = 0; var4 < 16384; ++var4) + { + byte var5 = par3MapData.colors[var4]; + + if (var5 / 4 == 0) + { + this.intArray[var4] = (var4 + var4 / 128 & 1) * 8 + 16 << 24; + } + else + { + int var6 = MapColor.mapColorArray[var5 / 4].colorValue; + int var7 = var5 & 3; + short var8 = 220; + + if (var7 == 2) + { + var8 = 255; + } + + if (var7 == 0) + { + var8 = 180; + } + + int var9 = (var6 >> 16 & 255) * var8 / 255; + int var10 = (var6 >> 8 & 255) * var8 / 255; + int var11 = (var6 & 255) * var8 / 255; + this.intArray[var4] = -16777216 | var9 << 16 | var10 << 8 | var11; + } + } + + this.bufferedImage.updateDynamicTexture(); + byte var15 = 0; + byte var16 = 0; + Tessellator var17 = Tessellator.instance; + float var18 = 0.0F; + par2TextureManager.bindTexture(this.field_111276_e); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glDisable(GL11.GL_ALPHA_TEST); + var17.startDrawingQuads(); + var17.addVertexWithUV((double)((float)(var15 + 0) + var18), (double)((float)(var16 + 128) - var18), -0.009999999776482582D, 0.0D, 1.0D); + var17.addVertexWithUV((double)((float)(var15 + 128) - var18), (double)((float)(var16 + 128) - var18), -0.009999999776482582D, 1.0D, 1.0D); + var17.addVertexWithUV((double)((float)(var15 + 128) - var18), (double)((float)(var16 + 0) + var18), -0.009999999776482582D, 1.0D, 0.0D); + var17.addVertexWithUV((double)((float)(var15 + 0) + var18), (double)((float)(var16 + 0) + var18), -0.009999999776482582D, 0.0D, 0.0D); + var17.draw(); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_BLEND); + par2TextureManager.bindTexture(field_111277_a); + int var19 = 0; + + for (Iterator var20 = par3MapData.playersVisibleOnMap.values().iterator(); var20.hasNext(); ++var19) + { + MapCoord var21 = (MapCoord)var20.next(); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var15 + (float)var21.centerX / 2.0F + 64.0F, (float)var16 + (float)var21.centerZ / 2.0F + 64.0F, -0.02F); + GL11.glRotatef((float)(var21.iconRotation * 360) / 16.0F, 0.0F, 0.0F, 1.0F); + GL11.glScalef(4.0F, 4.0F, 3.0F); + GL11.glTranslatef(-0.125F, 0.125F, 0.0F); + float var22 = (float)(var21.iconSize % 4 + 0) / 4.0F; + float var12 = (float)(var21.iconSize / 4 + 0) / 4.0F; + float var13 = (float)(var21.iconSize % 4 + 1) / 4.0F; + float var14 = (float)(var21.iconSize / 4 + 1) / 4.0F; + var17.startDrawingQuads(); + var17.addVertexWithUV(-1.0D, 1.0D, (double)((float)var19 * 0.001F), (double)var22, (double)var12); + var17.addVertexWithUV(1.0D, 1.0D, (double)((float)var19 * 0.001F), (double)var13, (double)var12); + var17.addVertexWithUV(1.0D, -1.0D, (double)((float)var19 * 0.001F), (double)var13, (double)var14); + var17.addVertexWithUV(-1.0D, -1.0D, (double)((float)var19 * 0.001F), (double)var22, (double)var14); + var17.draw(); + GL11.glPopMatrix(); + } + + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.0F, -0.04F); + GL11.glScalef(1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } +} diff --git a/src/main/java/net/minecraft/src/MapStorage.java b/src/main/java/net/minecraft/src/MapStorage.java new file mode 100644 index 0000000..2d4f1ca --- /dev/null +++ b/src/main/java/net/minecraft/src/MapStorage.java @@ -0,0 +1,251 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class MapStorage +{ + private ISaveHandler saveHandler; + + /** Map of item data String id to loaded MapDataBases */ + private Map loadedDataMap = new HashMap(); + + /** List of loaded MapDataBases. */ + private List loadedDataList = new ArrayList(); + + /** + * Map of MapDataBase id String prefixes ('map' etc) to max known unique Short id (the 0 part etc) for that prefix + */ + private Map idCounts = new HashMap(); + + public MapStorage(ISaveHandler par1ISaveHandler) + { + this.saveHandler = par1ISaveHandler; + this.loadIdCounts(); + } + + /** + * Loads an existing MapDataBase corresponding to the given String id from disk, instantiating the given Class, or + * returns null if none such file exists. args: Class to instantiate, String dataid + */ + public WorldSavedData loadData(Class par1Class, String par2Str) + { + WorldSavedData var3 = (WorldSavedData)this.loadedDataMap.get(par2Str); + + if (var3 != null) + { + return var3; + } + else + { + if (this.saveHandler != null) + { + try + { + File var4 = this.saveHandler.getMapFileFromName(par2Str); + + if (var4 != null && var4.exists()) + { + try + { + var3 = (WorldSavedData)par1Class.getConstructor(new Class[] {String.class}).newInstance(new Object[] {par2Str}); + } + catch (Exception var7) + { + throw new RuntimeException("Failed to instantiate " + par1Class.toString(), var7); + } + + FileInputStream var5 = new FileInputStream(var4); + NBTTagCompound var6 = CompressedStreamTools.readCompressed(var5); + var5.close(); + var3.readFromNBT(var6.getCompoundTag("data")); + } + } + catch (Exception var8) + { + var8.printStackTrace(); + } + } + + if (var3 != null) + { + this.loadedDataMap.put(par2Str, var3); + this.loadedDataList.add(var3); + } + + return var3; + } + } + + /** + * Assigns the given String id to the given MapDataBase, removing any existing ones of the same id. + */ + public void setData(String par1Str, WorldSavedData par2WorldSavedData) + { + if (par2WorldSavedData == null) + { + throw new RuntimeException("Can\'t set null data"); + } + else + { + if (this.loadedDataMap.containsKey(par1Str)) + { + this.loadedDataList.remove(this.loadedDataMap.remove(par1Str)); + } + + this.loadedDataMap.put(par1Str, par2WorldSavedData); + this.loadedDataList.add(par2WorldSavedData); + } + } + + /** + * Saves all dirty loaded MapDataBases to disk. + */ + public void saveAllData() + { + for (int var1 = 0; var1 < this.loadedDataList.size(); ++var1) + { + WorldSavedData var2 = (WorldSavedData)this.loadedDataList.get(var1); + + if (var2.isDirty()) + { + this.saveData(var2); + var2.setDirty(false); + } + } + } + + /** + * Saves the given MapDataBase to disk. + */ + private void saveData(WorldSavedData par1WorldSavedData) + { + if (this.saveHandler != null) + { + try + { + File var2 = this.saveHandler.getMapFileFromName(par1WorldSavedData.mapName); + + if (var2 != null) + { + NBTTagCompound var3 = new NBTTagCompound(); + par1WorldSavedData.writeToNBT(var3); + NBTTagCompound var4 = new NBTTagCompound(); + var4.setCompoundTag("data", var3); + FileOutputStream var5 = new FileOutputStream(var2); + CompressedStreamTools.writeCompressed(var4, var5); + var5.close(); + } + } + catch (Exception var6) + { + var6.printStackTrace(); + } + } + } + + /** + * Loads the idCounts Map from the 'idcounts' file. + */ + private void loadIdCounts() + { + try + { + this.idCounts.clear(); + + if (this.saveHandler == null) + { + return; + } + + File var1 = this.saveHandler.getMapFileFromName("idcounts"); + + if (var1 != null && var1.exists()) + { + DataInputStream var2 = new DataInputStream(new FileInputStream(var1)); + NBTTagCompound var3 = CompressedStreamTools.read(var2); + var2.close(); + Iterator var4 = var3.getTags().iterator(); + + while (var4.hasNext()) + { + NBTBase var5 = (NBTBase)var4.next(); + + if (var5 instanceof NBTTagShort) + { + NBTTagShort var6 = (NBTTagShort)var5; + String var7 = var6.getName(); + short var8 = var6.data; + this.idCounts.put(var7, Short.valueOf(var8)); + } + } + } + } + catch (Exception var9) + { + var9.printStackTrace(); + } + } + + /** + * Returns an unique new data id for the given prefix and saves the idCounts map to the 'idcounts' file. + */ + public int getUniqueDataId(String par1Str) + { + Short var2 = (Short)this.idCounts.get(par1Str); + + if (var2 == null) + { + var2 = Short.valueOf((short)0); + } + else + { + var2 = Short.valueOf((short)(var2.shortValue() + 1)); + } + + this.idCounts.put(par1Str, var2); + + if (this.saveHandler == null) + { + return var2.shortValue(); + } + else + { + try + { + File var3 = this.saveHandler.getMapFileFromName("idcounts"); + + if (var3 != null) + { + NBTTagCompound var4 = new NBTTagCompound(); + Iterator var5 = this.idCounts.keySet().iterator(); + + while (var5.hasNext()) + { + String var6 = (String)var5.next(); + short var7 = ((Short)this.idCounts.get(var6)).shortValue(); + var4.setShort(var6, var7); + } + + DataOutputStream var9 = new DataOutputStream(new FileOutputStream(var3)); + CompressedStreamTools.write(var4, var9); + var9.close(); + } + } + catch (Exception var8) + { + var8.printStackTrace(); + } + + return var2.shortValue(); + } + } +} diff --git a/src/main/java/net/minecraft/src/Material.java b/src/main/java/net/minecraft/src/Material.java new file mode 100644 index 0000000..6276c08 --- /dev/null +++ b/src/main/java/net/minecraft/src/Material.java @@ -0,0 +1,225 @@ +package net.minecraft.src; + +public class Material +{ + public static final Material air = new MaterialTransparent(MapColor.airColor); + + /** The material used by BlockGrass. */ + public static final Material grass = new Material(MapColor.grassColor); + public static final Material ground = new Material(MapColor.dirtColor); + public static final Material wood = (new Material(MapColor.woodColor)).setBurning(); + public static final Material rock = (new Material(MapColor.stoneColor)).setRequiresTool(); + public static final Material iron = (new Material(MapColor.ironColor)).setRequiresTool(); + public static final Material anvil = (new Material(MapColor.ironColor)).setRequiresTool().setImmovableMobility(); + public static final Material water = (new MaterialLiquid(MapColor.waterColor)).setNoPushMobility(); + public static final Material lava = (new MaterialLiquid(MapColor.tntColor)).setNoPushMobility(); + public static final Material leaves = (new Material(MapColor.foliageColor)).setBurning().setTranslucent().setNoPushMobility(); + public static final Material plants = (new MaterialLogic(MapColor.foliageColor)).setNoPushMobility(); + public static final Material vine = (new MaterialLogic(MapColor.foliageColor)).setBurning().setNoPushMobility().setReplaceable(); + public static final Material sponge = new Material(MapColor.clothColor); + public static final Material cloth = (new Material(MapColor.clothColor)).setBurning(); + public static final Material fire = (new MaterialTransparent(MapColor.airColor)).setNoPushMobility(); + public static final Material sand = new Material(MapColor.sandColor); + public static final Material circuits = (new MaterialLogic(MapColor.airColor)).setNoPushMobility(); + public static final Material materialCarpet = (new MaterialLogic(MapColor.clothColor)).setBurning(); + public static final Material glass = (new Material(MapColor.airColor)).setTranslucent().setAdventureModeExempt(); + public static final Material redstoneLight = (new Material(MapColor.airColor)).setAdventureModeExempt(); + public static final Material tnt = (new Material(MapColor.tntColor)).setBurning().setTranslucent(); + public static final Material coral = (new Material(MapColor.foliageColor)).setNoPushMobility(); + public static final Material ice = (new Material(MapColor.iceColor)).setTranslucent().setAdventureModeExempt(); + public static final Material snow = (new MaterialLogic(MapColor.snowColor)).setReplaceable().setTranslucent().setRequiresTool().setNoPushMobility(); + + /** The material for crafted snow. */ + public static final Material craftedSnow = (new Material(MapColor.snowColor)).setRequiresTool(); + public static final Material cactus = (new Material(MapColor.foliageColor)).setTranslucent().setNoPushMobility(); + public static final Material clay = new Material(MapColor.clayColor); + + /** pumpkin */ + public static final Material pumpkin = (new Material(MapColor.foliageColor)).setNoPushMobility(); + public static final Material dragonEgg = (new Material(MapColor.foliageColor)).setNoPushMobility(); + + /** Material used for portals */ + public static final Material portal = (new MaterialPortal(MapColor.airColor)).setImmovableMobility(); + + /** Cake's material, see BlockCake */ + public static final Material cake = (new Material(MapColor.airColor)).setNoPushMobility(); + + /** Web's material. */ + public static final Material web = (new MaterialWeb(MapColor.clothColor)).setRequiresTool().setNoPushMobility(); + + /** Pistons' material. */ + public static final Material piston = (new Material(MapColor.stoneColor)).setImmovableMobility(); + + /** Bool defining if the block can burn or not. */ + private boolean canBurn; + + /** + * Determines whether blocks with this material can be "overwritten" by other blocks when placed - eg snow, vines + * and tall grass. + */ + private boolean replaceable; + + /** Indicates if the material is translucent */ + private boolean isTranslucent; + + /** The color index used to draw the blocks of this material on maps. */ + public final MapColor materialMapColor; + + /** + * Determines if the material can be harvested without a tool (or with the wrong tool) + */ + private boolean requiresNoTool = true; + + /** + * Mobility information flag. 0 indicates that this block is normal, 1 indicates that it can't push other blocks, 2 + * indicates that it can't be pushed. + */ + private int mobilityFlag; + private boolean isAdventureModeExempt; + + public Material(MapColor par1MapColor) + { + this.materialMapColor = par1MapColor; + } + + /** + * Returns if blocks of these materials are liquids. + */ + public boolean isLiquid() + { + return false; + } + + public boolean isSolid() + { + return true; + } + + /** + * Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true + */ + public boolean getCanBlockGrass() + { + return true; + } + + /** + * Returns if this material is considered solid or not + */ + public boolean blocksMovement() + { + return true; + } + + /** + * Marks the material as translucent + */ + private Material setTranslucent() + { + this.isTranslucent = true; + return this; + } + + /** + * Makes blocks with this material require the correct tool to be harvested. + */ + protected Material setRequiresTool() + { + this.requiresNoTool = false; + return this; + } + + /** + * Set the canBurn bool to True and return the current object. + */ + protected Material setBurning() + { + this.canBurn = true; + return this; + } + + /** + * Returns if the block can burn or not. + */ + public boolean getCanBurn() + { + return this.canBurn; + } + + /** + * Sets {@link #replaceable} to true. + */ + public Material setReplaceable() + { + this.replaceable = true; + return this; + } + + /** + * Returns whether the material can be replaced by other blocks when placed - eg snow, vines and tall grass. + */ + public boolean isReplaceable() + { + return this.replaceable; + } + + /** + * Indicate if the material is opaque + */ + public boolean isOpaque() + { + return this.isTranslucent ? false : this.blocksMovement(); + } + + /** + * Returns true if the material can be harvested without a tool (or with the wrong tool) + */ + public boolean isToolNotRequired() + { + return this.requiresNoTool; + } + + /** + * Returns the mobility information of the material, 0 = free, 1 = can't push but can move over, 2 = total + * immobility and stop pistons. + */ + public int getMaterialMobility() + { + return this.mobilityFlag; + } + + /** + * This type of material can't be pushed, but pistons can move over it. + */ + protected Material setNoPushMobility() + { + this.mobilityFlag = 1; + return this; + } + + /** + * This type of material can't be pushed, and pistons are blocked to move. + */ + protected Material setImmovableMobility() + { + this.mobilityFlag = 2; + return this; + } + + /** + * @see #isAdventureModeExempt() + */ + protected Material setAdventureModeExempt() + { + this.isAdventureModeExempt = true; + return this; + } + + /** + * Returns true if blocks with this material can always be mined in adventure mode. + */ + public boolean isAdventureModeExempt() + { + return this.isAdventureModeExempt; + } +} diff --git a/src/main/java/net/minecraft/src/MaterialLiquid.java b/src/main/java/net/minecraft/src/MaterialLiquid.java new file mode 100644 index 0000000..759c27b --- /dev/null +++ b/src/main/java/net/minecraft/src/MaterialLiquid.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +public class MaterialLiquid extends Material +{ + public MaterialLiquid(MapColor par1MapColor) + { + super(par1MapColor); + this.setReplaceable(); + this.setNoPushMobility(); + } + + /** + * Returns if blocks of these materials are liquids. + */ + public boolean isLiquid() + { + return true; + } + + /** + * Returns if this material is considered solid or not + */ + public boolean blocksMovement() + { + return false; + } + + public boolean isSolid() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/MaterialLogic.java b/src/main/java/net/minecraft/src/MaterialLogic.java new file mode 100644 index 0000000..78aee29 --- /dev/null +++ b/src/main/java/net/minecraft/src/MaterialLogic.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +public class MaterialLogic extends Material +{ + public MaterialLogic(MapColor par1MapColor) + { + super(par1MapColor); + this.setAdventureModeExempt(); + } + + public boolean isSolid() + { + return false; + } + + /** + * Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true + */ + public boolean getCanBlockGrass() + { + return false; + } + + /** + * Returns if this material is considered solid or not + */ + public boolean blocksMovement() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/MaterialPortal.java b/src/main/java/net/minecraft/src/MaterialPortal.java new file mode 100644 index 0000000..8907e4e --- /dev/null +++ b/src/main/java/net/minecraft/src/MaterialPortal.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +public class MaterialPortal extends Material +{ + public MaterialPortal(MapColor par1MapColor) + { + super(par1MapColor); + } + + public boolean isSolid() + { + return false; + } + + /** + * Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true + */ + public boolean getCanBlockGrass() + { + return false; + } + + /** + * Returns if this material is considered solid or not + */ + public boolean blocksMovement() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/MaterialTransparent.java b/src/main/java/net/minecraft/src/MaterialTransparent.java new file mode 100644 index 0000000..c42ac2b --- /dev/null +++ b/src/main/java/net/minecraft/src/MaterialTransparent.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +public class MaterialTransparent extends Material +{ + public MaterialTransparent(MapColor par1MapColor) + { + super(par1MapColor); + this.setReplaceable(); + } + + public boolean isSolid() + { + return false; + } + + /** + * Will prevent grass from growing on dirt underneath and kill any grass below it if it returns true + */ + public boolean getCanBlockGrass() + { + return false; + } + + /** + * Returns if this material is considered solid or not + */ + public boolean blocksMovement() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/MaterialWeb.java b/src/main/java/net/minecraft/src/MaterialWeb.java new file mode 100644 index 0000000..ba7be79 --- /dev/null +++ b/src/main/java/net/minecraft/src/MaterialWeb.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +final class MaterialWeb extends Material +{ + MaterialWeb(MapColor par1MapColor) + { + super(par1MapColor); + } + + /** + * Returns if this material is considered solid or not + */ + public boolean blocksMovement() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/MathHelper.java b/src/main/java/net/minecraft/src/MathHelper.java new file mode 100644 index 0000000..1ff3217 --- /dev/null +++ b/src/main/java/net/minecraft/src/MathHelper.java @@ -0,0 +1,305 @@ +package net.minecraft.src; + +import java.util.Random; + +public class MathHelper +{ + /** + * A table of sin values computed from 0 (inclusive) to 2*pi (exclusive), with steps of 2*PI / 65536. + */ + private static float[] SIN_TABLE = new float[65536]; + + /** + * sin looked up in a table + */ + public static final float sin(float par0) + { + return SIN_TABLE[(int)(par0 * 10430.378F) & 65535]; + } + + /** + * cos looked up in the sin table with the appropriate offset + */ + public static final float cos(float par0) + { + return SIN_TABLE[(int)(par0 * 10430.378F + 16384.0F) & 65535]; + } + + public static final float sqrt_float(float par0) + { + return (float)Math.sqrt((double)par0); + } + + public static final float sqrt_double(double par0) + { + return (float)Math.sqrt(par0); + } + + /** + * Returns the greatest integer less than or equal to the float argument + */ + public static int floor_float(float par0) + { + int var1 = (int)par0; + return par0 < (float)var1 ? var1 - 1 : var1; + } + + /** + * returns par0 cast as an int, and no greater than Integer.MAX_VALUE-1024 + */ + public static int truncateDoubleToInt(double par0) + { + return (int)(par0 + 1024.0D) - 1024; + } + + /** + * Returns the greatest integer less than or equal to the double argument + */ + public static int floor_double(double par0) + { + int var2 = (int)par0; + return par0 < (double)var2 ? var2 - 1 : var2; + } + + /** + * Long version of floor_double + */ + public static long floor_double_long(double par0) + { + long var2 = (long)par0; + return par0 < (double)var2 ? var2 - 1L : var2; + } + + public static float abs(float par0) + { + return par0 >= 0.0F ? par0 : -par0; + } + + /** + * Returns the unsigned value of an int. + */ + public static int abs_int(int par0) + { + return par0 >= 0 ? par0 : -par0; + } + + public static int ceiling_float_int(float par0) + { + int var1 = (int)par0; + return par0 > (float)var1 ? var1 + 1 : var1; + } + + public static int ceiling_double_int(double par0) + { + int var2 = (int)par0; + return par0 > (double)var2 ? var2 + 1 : var2; + } + + /** + * Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and + * third parameters. + */ + public static int clamp_int(int par0, int par1, int par2) + { + return par0 < par1 ? par1 : (par0 > par2 ? par2 : par0); + } + + /** + * Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and + * third parameters + */ + public static float clamp_float(float par0, float par1, float par2) + { + return par0 < par1 ? par1 : (par0 > par2 ? par2 : par0); + } + + /** + * Maximum of the absolute value of two numbers. + */ + public static double abs_max(double par0, double par2) + { + if (par0 < 0.0D) + { + par0 = -par0; + } + + if (par2 < 0.0D) + { + par2 = -par2; + } + + return par0 > par2 ? par0 : par2; + } + + /** + * Buckets an integer with specifed bucket sizes. Args: i, bucketSize + */ + public static int bucketInt(int par0, int par1) + { + return par0 < 0 ? -((-par0 - 1) / par1) - 1 : par0 / par1; + } + + /** + * Tests if a string is null or of length zero + */ + public static boolean stringNullOrLengthZero(String par0Str) + { + return par0Str == null || par0Str.length() == 0; + } + + public static int getRandomIntegerInRange(Random par0Random, int par1, int par2) + { + return par1 >= par2 ? par1 : par0Random.nextInt(par2 - par1 + 1) + par1; + } + + public static double getRandomDoubleInRange(Random par0Random, double par1, double par3) + { + return par1 >= par3 ? par1 : par0Random.nextDouble() * (par3 - par1) + par1; + } + + public static double average(long[] par0ArrayOfLong) + { + long var1 = 0L; + long[] var3 = par0ArrayOfLong; + int var4 = par0ArrayOfLong.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + long var6 = var3[var5]; + var1 += var6; + } + + return (double)var1 / (double)par0ArrayOfLong.length; + } + + /** + * the angle is reduced to an angle between -180 and +180 by mod, and a 360 check + */ + public static float wrapAngleTo180_float(float par0) + { + par0 %= 360.0F; + + if (par0 >= 180.0F) + { + par0 -= 360.0F; + } + + if (par0 < -180.0F) + { + par0 += 360.0F; + } + + return par0; + } + + /** + * the angle is reduced to an angle between -180 and +180 by mod, and a 360 check + */ + public static double wrapAngleTo180_double(double par0) + { + par0 %= 360.0D; + + if (par0 >= 180.0D) + { + par0 -= 360.0D; + } + + if (par0 < -180.0D) + { + par0 += 360.0D; + } + + return par0; + } + + /** + * parses the string as integer or returns the second parameter if it fails + */ + public static int parseIntWithDefault(String par0Str, int par1) + { + int var2 = par1; + + try + { + var2 = Integer.parseInt(par0Str); + } + catch (Throwable var4) + { + ; + } + + return var2; + } + + /** + * parses the string as integer or returns the second parameter if it fails. this value is capped to par2 + */ + public static int parseIntWithDefaultAndMax(String par0Str, int par1, int par2) + { + int var3 = par1; + + try + { + var3 = Integer.parseInt(par0Str); + } + catch (Throwable var5) + { + ; + } + + if (var3 < par2) + { + var3 = par2; + } + + return var3; + } + + /** + * parses the string as double or returns the second parameter if it fails. + */ + public static double parseDoubleWithDefault(String par0Str, double par1) + { + double var3 = par1; + + try + { + var3 = Double.parseDouble(par0Str); + } + catch (Throwable var6) + { + ; + } + + return var3; + } + + public static double func_82713_a(String par0Str, double par1, double par3) + { + double var5 = par1; + + try + { + var5 = Double.parseDouble(par0Str); + } + catch (Throwable var8) + { + ; + } + + if (var5 < par3) + { + var5 = par3; + } + + return var5; + } + + static + { + for (int var0 = 0; var0 < 65536; ++var0) + { + SIN_TABLE[var0] = (float)Math.sin((double)var0 * Math.PI * 2.0D / 65536.0D); + } + } +} diff --git a/src/main/java/net/minecraft/src/McoClient.java b/src/main/java/net/minecraft/src/McoClient.java new file mode 100644 index 0000000..7350002 --- /dev/null +++ b/src/main/java/net/minecraft/src/McoClient.java @@ -0,0 +1,265 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; + +public class McoClient +{ + private final String field_96390_a; + private final String field_100007_c; + private static String field_96388_b = "https://mcoapi.minecraft.net/"; + + public McoClient(Session par1Session) + { + this.field_96390_a = par1Session.getSessionID(); + this.field_100007_c = par1Session.getUsername(); + } + + public ValueObjectList func_96382_a() throws ExceptionMcoService, IOException + { + String var1 = this.func_96377_a(Request.func_96358_a(field_96388_b + "worlds")); + return ValueObjectList.func_98161_a(var1); + } + + public McoServer func_98176_a(long par1) throws ExceptionMcoService, IOException + { + String var3 = this.func_96377_a(Request.func_96358_a(field_96388_b + "worlds" + "/$ID".replace("$ID", String.valueOf(par1)))); + return McoServer.func_98165_c(var3); + } + + public McoServerAddress func_96374_a(long par1) throws ExceptionMcoService, IOException + { + String var3 = field_96388_b + "worlds" + "/$ID/join".replace("$ID", "" + par1); + String var4 = this.func_96377_a(Request.func_96358_a(var3)); + return McoServerAddress.func_98162_a(var4); + } + + public void func_96386_a(String par1Str, String par2Str, String par3Str, String par4Str) throws ExceptionMcoService, UnsupportedEncodingException + { + StringBuilder var5 = new StringBuilder(); + var5.append(field_96388_b).append("worlds").append("/$NAME/$LOCATION_ID".replace("$NAME", this.func_96380_a(par1Str))); + HashMap var6 = new HashMap(); + + if (par2Str != null && !par2Str.trim().equals("")) + { + var6.put("motd", par2Str); + } + + if (par3Str != null && !par3Str.equals("")) + { + var6.put("seed", par3Str); + } + + var6.put("template", par4Str); + + if (!var6.isEmpty()) + { + boolean var7 = true; + Entry var9; + + for (Iterator var8 = var6.entrySet().iterator(); var8.hasNext(); var5.append((String)var9.getKey()).append("=").append(this.func_96380_a((String)var9.getValue()))) + { + var9 = (Entry)var8.next(); + + if (var7) + { + var5.append("?"); + var7 = false; + } + else + { + var5.append("&"); + } + } + } + + this.func_96377_a(Request.func_104064_a(var5.toString(), "", 5000, 30000)); + } + + public Boolean func_96375_b() throws ExceptionMcoService, IOException + { + String var1 = field_96388_b + "mco" + "/available"; + String var2 = this.func_96377_a(Request.func_96358_a(var1)); + return Boolean.valueOf(var2); + } + + public Boolean func_140054_c() throws ExceptionMcoService, IOException + { + String var1 = field_96388_b + "mco" + "/client/outdated"; + String var2 = this.func_96377_a(Request.func_96358_a(var1)); + return Boolean.valueOf(var2); + } + + public int func_96379_c() throws ExceptionMcoService + { + String var1 = field_96388_b + "payments" + "/unused"; + String var2 = this.func_96377_a(Request.func_96358_a(var1)); + return Integer.valueOf(var2).intValue(); + } + + public void func_96381_a(long par1, String par3Str) throws ExceptionMcoService + { + String var4 = field_96388_b + "invites" + "/$WORLD_ID/invite/$USER_NAME".replace("$WORLD_ID", String.valueOf(par1)).replace("$USER_NAME", par3Str); + this.func_96377_a(Request.func_96355_b(var4)); + } + + public void func_140055_c(long par1) throws ExceptionMcoService + { + String var3 = field_96388_b + "invites" + "/$WORLD_ID".replace("$WORLD_ID", String.valueOf(par1)); + this.func_96377_a(Request.func_96355_b(var3)); + } + + public McoServer func_96387_b(long par1, String par3Str) throws ExceptionMcoService, IOException + { + String var4 = field_96388_b + "invites" + "/$WORLD_ID/invite/$USER_NAME".replace("$WORLD_ID", String.valueOf(par1)).replace("$USER_NAME", par3Str); + String var5 = this.func_96377_a(Request.func_96361_b(var4, "")); + return McoServer.func_98165_c(var5); + } + + public BackupList func_111232_c(long par1) throws ExceptionMcoService + { + String var3 = field_96388_b + "worlds" + "/$WORLD_ID/backups".replace("$WORLD_ID", String.valueOf(par1)); + String var4 = this.func_96377_a(Request.func_96358_a(var3)); + return BackupList.func_111222_a(var4); + } + + public void func_96384_a(long par1, String par3Str, String par4Str, int par5, int par6) throws ExceptionMcoService, UnsupportedEncodingException + { + StringBuilder var7 = new StringBuilder(); + var7.append(field_96388_b).append("worlds").append("/$WORLD_ID/$NAME".replace("$WORLD_ID", String.valueOf(par1)).replace("$NAME", this.func_96380_a(par3Str))); + + if (par4Str != null && !par4Str.trim().equals("")) + { + var7.append("?motd=").append(this.func_96380_a(par4Str)); + } + else + { + var7.append("?motd="); + } + + var7.append("&difficulty=").append(par5).append("&gameMode=").append(par6); + this.func_96377_a(Request.func_96363_c(var7.toString(), "")); + } + + public void func_111235_c(long par1, String par3Str) throws ExceptionMcoService + { + String var4 = field_96388_b + "worlds" + "/$WORLD_ID/backups".replace("$WORLD_ID", String.valueOf(par1)) + "?backupId=" + par3Str; + this.func_96377_a(Request.func_96363_c(var4, "")); + } + + public WorldTemplateList func_111231_d() throws ExceptionMcoService + { + String var1 = field_96388_b + "worlds" + "/templates"; + String var2 = this.func_96377_a(Request.func_96358_a(var1)); + return WorldTemplateList.func_110735_a(var2); + } + + public Boolean func_96383_b(long par1) throws ExceptionMcoService, IOException + { + String var3 = field_96388_b + "worlds" + "/$WORLD_ID/open".replace("$WORLD_ID", String.valueOf(par1)); + String var4 = this.func_96377_a(Request.func_96363_c(var3, "")); + return Boolean.valueOf(var4); + } + + public Boolean func_96378_c(long par1) throws ExceptionMcoService, IOException + { + String var3 = field_96388_b + "worlds" + "/$WORLD_ID/close".replace("$WORLD_ID", String.valueOf(par1)); + String var4 = this.func_96377_a(Request.func_96363_c(var3, "")); + return Boolean.valueOf(var4); + } + + public Boolean func_96376_d(long par1, String par3Str) throws ExceptionMcoService, UnsupportedEncodingException + { + StringBuilder var4 = new StringBuilder(); + var4.append(field_96388_b).append("worlds").append("/$WORLD_ID/reset".replace("$WORLD_ID", String.valueOf(par1))); + + if (par3Str != null && par3Str.length() > 0) + { + var4.append("?seed=").append(this.func_96380_a(par3Str)); + } + + String var5 = this.func_96377_a(Request.func_96353_a(var4.toString(), "", 30000, 80000)); + return Boolean.valueOf(var5); + } + + public Boolean func_111233_e(long par1, String par3Str) throws ExceptionMcoService + { + StringBuilder var4 = new StringBuilder(); + var4.append(field_96388_b).append("worlds").append("/$WORLD_ID/reset".replace("$WORLD_ID", String.valueOf(par1))); + + if (par3Str != null) + { + var4.append("?template=").append(par3Str); + } + + String var5 = this.func_96377_a(Request.func_96353_a(var4.toString(), "", 30000, 80000)); + return Boolean.valueOf(var5); + } + + public ValueObjectSubscription func_98177_f(long par1) throws ExceptionMcoService, IOException + { + String var3 = this.func_96377_a(Request.func_96358_a(field_96388_b + "subscriptions" + "/$WORLD_ID".replace("$WORLD_ID", String.valueOf(par1)))); + return ValueObjectSubscription.func_98169_a(var3); + } + + public int func_130106_e() throws ExceptionMcoService + { + String var1 = this.func_96377_a(Request.func_96358_a(field_96388_b + "invites" + "/count/pending")); + return Integer.parseInt(var1); + } + + public PendingInvitesList func_130108_f() throws ExceptionMcoService + { + String var1 = this.func_96377_a(Request.func_96358_a(field_96388_b + "invites" + "/pending")); + return PendingInvitesList.func_130095_a(var1); + } + + public void func_130107_a(String par1Str) throws ExceptionMcoService + { + this.func_96377_a(Request.func_96363_c(field_96388_b + "invites" + "/accept/$INVITATION_ID".replace("$INVITATION_ID", par1Str), "")); + } + + public void func_130109_b(String par1Str) throws ExceptionMcoService + { + this.func_96377_a(Request.func_96363_c(field_96388_b + "invites" + "/reject/$INVITATION_ID".replace("$INVITATION_ID", par1Str), "")); + } + + private String func_96380_a(String par1Str) throws UnsupportedEncodingException + { + return URLEncoder.encode(par1Str, "UTF-8"); + } + + private String func_96377_a(Request par1Request) throws ExceptionMcoService + { + par1Request.func_100006_a("sid", this.field_96390_a); + par1Request.func_100006_a("user", this.field_100007_c); + par1Request.func_100006_a("version", "1.6.4"); + + try + { + int var2 = par1Request.func_96362_a(); + + if (var2 == 503) + { + int var3 = par1Request.func_111221_b(); + throw new ExceptionRetryCall(var3); + } + else if (var2 >= 200 && var2 < 300) + { + return par1Request.func_96364_c(); + } + else + { + throw new ExceptionMcoService(par1Request.func_96362_a(), par1Request.func_96364_c(), par1Request.func_130110_g()); + } + } + catch (ExceptionMcoHttp var4) + { + throw new ExceptionMcoService(500, "Server not available!", -1); + } + } +} diff --git a/src/main/java/net/minecraft/src/McoServer.java b/src/main/java/net/minecraft/src/McoServer.java new file mode 100644 index 0000000..96ef116 --- /dev/null +++ b/src/main/java/net/minecraft/src/McoServer.java @@ -0,0 +1,180 @@ +package net.minecraft.src; + +import argo.jdom.JdomParser; +import argo.jdom.JsonNode; +import argo.saj.InvalidSyntaxException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +public class McoServer +{ + public long field_96408_a; + public String field_96406_b; + public String field_96407_c; + public String field_96404_d; + public String field_96405_e; + public List field_96402_f; + public String field_96403_g; + public boolean field_98166_h; + public int field_110729_i; + public int field_110728_j; + public int field_104063_i; + public int field_96415_h; + public String field_96414_k = ""; + public boolean field_96411_l; + public boolean field_102022_m; + public long field_96412_m; + private String field_96409_n; + private String field_96410_o; + + public String func_96397_a() + { + if (this.field_96409_n == null) + { + try + { + this.field_96409_n = URLDecoder.decode(this.field_96407_c, "UTF-8"); + } + catch (UnsupportedEncodingException var2) + { + this.field_96409_n = this.field_96407_c; + } + } + + return this.field_96409_n; + } + + public String func_96398_b() + { + if (this.field_96410_o == null) + { + try + { + this.field_96410_o = URLDecoder.decode(this.field_96406_b, "UTF-8"); + } + catch (UnsupportedEncodingException var2) + { + this.field_96410_o = this.field_96406_b; + } + } + + return this.field_96410_o; + } + + public void func_96399_a(String par1Str) + { + this.field_96406_b = par1Str; + this.field_96410_o = null; + } + + public void func_96400_b(String par1Str) + { + this.field_96407_c = par1Str; + this.field_96409_n = null; + } + + public void func_96401_a(McoServer par1McoServer) + { + this.field_96414_k = par1McoServer.field_96414_k; + this.field_96412_m = par1McoServer.field_96412_m; + this.field_96411_l = par1McoServer.field_96411_l; + this.field_96415_h = par1McoServer.field_96415_h; + this.field_102022_m = true; + } + + public static McoServer func_98163_a(JsonNode par0JsonNode) + { + McoServer var1 = new McoServer(); + + try + { + var1.field_96408_a = Long.parseLong(par0JsonNode.getNumberValue(new Object[] {"id"})); + var1.field_96406_b = par0JsonNode.getStringValue(new Object[] {"name"}); + var1.field_96407_c = par0JsonNode.getStringValue(new Object[] {"motd"}); + var1.field_96404_d = par0JsonNode.getStringValue(new Object[] {"state"}); + var1.field_96405_e = par0JsonNode.getStringValue(new Object[] {"owner"}); + + if (par0JsonNode.isArrayNode(new Object[] {"invited"})) + { + var1.field_96402_f = func_98164_a(par0JsonNode.getArrayNode(new Object[] {"invited"})); + } + else + { + var1.field_96402_f = new ArrayList(); + } + + var1.field_104063_i = Integer.parseInt(par0JsonNode.getNumberValue(new Object[] {"daysLeft"})); + var1.field_96403_g = par0JsonNode.getStringValue(new Object[] {"ip"}); + var1.field_98166_h = par0JsonNode.getBooleanValue(new Object[] {"expired"}).booleanValue(); + var1.field_110729_i = Integer.parseInt(par0JsonNode.getNumberValue(new Object[] {"difficulty"})); + var1.field_110728_j = Integer.parseInt(par0JsonNode.getNumberValue(new Object[] {"gameMode"})); + } + catch (IllegalArgumentException var3) + { + ; + } + + return var1; + } + + private static List func_98164_a(List par0List) + { + ArrayList var1 = new ArrayList(); + Iterator var2 = par0List.iterator(); + + while (var2.hasNext()) + { + JsonNode var3 = (JsonNode)var2.next(); + var1.add(var3.getStringValue(new Object[0])); + } + + return var1; + } + + public static McoServer func_98165_c(String par0Str) + { + McoServer var1 = new McoServer(); + + try + { + var1 = func_98163_a((new JdomParser()).parse(par0Str)); + } + catch (InvalidSyntaxException var3) + { + ; + } + + return var1; + } + + public int hashCode() + { + return (new HashCodeBuilder(17, 37)).append(this.field_96408_a).append(this.field_96406_b).append(this.field_96407_c).append(this.field_96404_d).append(this.field_96405_e).append(this.field_98166_h).toHashCode(); + } + + public boolean equals(Object par1Obj) + { + if (par1Obj == null) + { + return false; + } + else if (par1Obj == this) + { + return true; + } + else if (par1Obj.getClass() != this.getClass()) + { + return false; + } + else + { + McoServer var2 = (McoServer)par1Obj; + return (new EqualsBuilder()).append(this.field_96408_a, var2.field_96408_a).append(this.field_96406_b, var2.field_96406_b).append(this.field_96407_c, var2.field_96407_c).append(this.field_96404_d, var2.field_96404_d).append(this.field_96405_e, var2.field_96405_e).append(this.field_98166_h, var2.field_98166_h).isEquals(); + } + } +} diff --git a/src/main/java/net/minecraft/src/McoServerAddress.java b/src/main/java/net/minecraft/src/McoServerAddress.java new file mode 100644 index 0000000..9038703 --- /dev/null +++ b/src/main/java/net/minecraft/src/McoServerAddress.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +import argo.jdom.JdomParser; +import argo.jdom.JsonRootNode; +import argo.saj.InvalidSyntaxException; + +public class McoServerAddress extends ValueObject +{ + public String field_96417_a; + + public static McoServerAddress func_98162_a(String par0Str) + { + McoServerAddress var1 = new McoServerAddress(); + + try + { + JsonRootNode var2 = (new JdomParser()).parse(par0Str); + var1.field_96417_a = var2.getStringValue(new Object[] {"address"}); + } + catch (InvalidSyntaxException var3) + { + ; + } + catch (IllegalArgumentException var4) + { + ; + } + + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/McoServerList.java b/src/main/java/net/minecraft/src/McoServerList.java new file mode 100644 index 0000000..301e125 --- /dev/null +++ b/src/main/java/net/minecraft/src/McoServerList.java @@ -0,0 +1,131 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +public class McoServerList +{ + private volatile boolean field_98259_a; + private McoServerListUpdateTask field_98257_b = new McoServerListUpdateTask(this, (McoServerListEmptyAnon)null); + private java.util.Timer field_98258_c = new java.util.Timer(); + private Set field_140060_d = Sets.newHashSet(); + private List field_98255_d = Lists.newArrayList(); + private int field_130130_e; + private boolean field_140059_g; + private Session field_98254_f; + private int field_140061_i; + + public McoServerList() + { + this.field_98258_c.schedule(this.field_98257_b, 0L, 10000L); + this.field_98254_f = Minecraft.getMinecraft().getSession(); + } + + public synchronized void func_130129_a(Session par1Session) + { + this.field_98254_f = par1Session; + + if (this.field_98259_a) + { + this.field_98259_a = false; + this.field_98257_b = new McoServerListUpdateTask(this, (McoServerListEmptyAnon)null); + this.field_98258_c = new java.util.Timer(); + this.field_98258_c.schedule(this.field_98257_b, 0L, 10000L); + } + } + + public synchronized boolean func_130127_a() + { + return this.field_140059_g; + } + + public synchronized void func_98250_b() + { + this.field_140059_g = false; + } + + public synchronized List func_98252_c() + { + return Lists.newArrayList(this.field_98255_d); + } + + public int func_130124_d() + { + return this.field_130130_e; + } + + public int func_140056_e() + { + return this.field_140061_i; + } + + public synchronized void func_98248_d() + { + this.field_98259_a = true; + this.field_98257_b.cancel(); + this.field_98258_c.cancel(); + } + + private synchronized void func_96426_a(List par1List) + { + int var2 = 0; + Iterator var3 = this.field_140060_d.iterator(); + + while (var3.hasNext()) + { + McoServer var4 = (McoServer)var3.next(); + + if (par1List.remove(var4)) + { + ++var2; + } + } + + if (var2 == 0) + { + this.field_140060_d.clear(); + } + + this.field_98255_d = par1List; + this.field_140059_g = true; + } + + public synchronized void func_140058_a(McoServer par1McoServer) + { + this.field_98255_d.remove(par1McoServer); + this.field_140060_d.add(par1McoServer); + } + + private void func_130123_a(int par1) + { + this.field_130130_e = par1; + } + + static boolean func_98249_b(McoServerList par0McoServerList) + { + return par0McoServerList.field_98259_a; + } + + static Session func_100014_a(McoServerList par0McoServerList) + { + return par0McoServerList.field_98254_f; + } + + static void func_98247_a(McoServerList par0McoServerList, List par1List) + { + par0McoServerList.func_96426_a(par1List); + } + + static void func_130122_a(McoServerList par0McoServerList, int par1) + { + par0McoServerList.func_130123_a(par1); + } + + static int func_140057_b(McoServerList par0McoServerList, int par1) + { + return par0McoServerList.field_140061_i = par1; + } +} diff --git a/src/main/java/net/minecraft/src/McoServerListEmptyAnon.java b/src/main/java/net/minecraft/src/McoServerListEmptyAnon.java new file mode 100644 index 0000000..8ecceff --- /dev/null +++ b/src/main/java/net/minecraft/src/McoServerListEmptyAnon.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +class McoServerListEmptyAnon +{ +} diff --git a/src/main/java/net/minecraft/src/McoServerListUpdateTask.java b/src/main/java/net/minecraft/src/McoServerListUpdateTask.java new file mode 100644 index 0000000..603abed --- /dev/null +++ b/src/main/java/net/minecraft/src/McoServerListUpdateTask.java @@ -0,0 +1,97 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; +import java.util.TimerTask; + +class McoServerListUpdateTask extends TimerTask +{ + private McoClient field_140066_b; + + final McoServerList field_140067_a; + + private McoServerListUpdateTask(McoServerList par1McoServerList) + { + this.field_140067_a = par1McoServerList; + } + + public void run() + { + if (!McoServerList.func_98249_b(this.field_140067_a)) + { + this.func_140064_c(); + this.func_140062_a(); + this.func_140063_b(); + } + } + + private void func_140062_a() + { + try + { + if (McoServerList.func_100014_a(this.field_140067_a) != null) + { + this.field_140066_b = new McoClient(McoServerList.func_100014_a(this.field_140067_a)); + List var1 = this.field_140066_b.func_96382_a().field_96430_d; + + if (var1 != null) + { + this.func_140065_a(var1); + McoServerList.func_98247_a(this.field_140067_a, var1); + } + } + } + catch (ExceptionMcoService var2) + { + Minecraft.getMinecraft().getLogAgent().logSevere(var2.toString()); + } + catch (IOException var3) + { + Minecraft.getMinecraft().getLogAgent().logWarning("Realms: could not parse response from server"); + } + } + + private void func_140063_b() + { + try + { + if (McoServerList.func_100014_a(this.field_140067_a) != null) + { + int var1 = this.field_140066_b.func_130106_e(); + McoServerList.func_130122_a(this.field_140067_a, var1); + } + } + catch (ExceptionMcoService var2) + { + Minecraft.getMinecraft().getLogAgent().logSevere(var2.toString()); + } + } + + private void func_140064_c() + { + try + { + if (McoServerList.func_100014_a(this.field_140067_a) != null) + { + McoClient var1 = new McoClient(McoServerList.func_100014_a(this.field_140067_a)); + McoServerList.func_140057_b(this.field_140067_a, var1.func_96379_c()); + } + } + catch (ExceptionMcoService var2) + { + Minecraft.getMinecraft().getLogAgent().logSevere(var2.toString()); + McoServerList.func_140057_b(this.field_140067_a, 0); + } + } + + private void func_140065_a(List par1List) + { + Collections.sort(par1List, new McoServerListUpdateTaskComparator(this, McoServerList.func_100014_a(this.field_140067_a).getUsername(), (McoServerListEmptyAnon)null)); + } + + McoServerListUpdateTask(McoServerList par1McoServerList, McoServerListEmptyAnon par2McoServerListEmptyAnon) + { + this(par1McoServerList); + } +} diff --git a/src/main/java/net/minecraft/src/McoServerListUpdateTaskComparator.java b/src/main/java/net/minecraft/src/McoServerListUpdateTaskComparator.java new file mode 100644 index 0000000..89f9985 --- /dev/null +++ b/src/main/java/net/minecraft/src/McoServerListUpdateTaskComparator.java @@ -0,0 +1,59 @@ +package net.minecraft.src; + +import java.util.Comparator; + +class McoServerListUpdateTaskComparator implements Comparator +{ + private final String field_140069_b; + + final McoServerListUpdateTask field_140070_a; + + private McoServerListUpdateTaskComparator(McoServerListUpdateTask par1McoServerListUpdateTask, String par2Str) + { + this.field_140070_a = par1McoServerListUpdateTask; + this.field_140069_b = par2Str; + } + + public int func_140068_a(McoServer par1McoServer, McoServer par2McoServer) + { + if (par1McoServer.field_96405_e.equals(par2McoServer.field_96405_e)) + { + return par1McoServer.field_96408_a < par2McoServer.field_96408_a ? 1 : (par1McoServer.field_96408_a > par2McoServer.field_96408_a ? -1 : 0); + } + else if (par1McoServer.field_96405_e.equals(this.field_140069_b)) + { + return -1; + } + else if (par2McoServer.field_96405_e.equals(this.field_140069_b)) + { + return 1; + } + else + { + if (par1McoServer.field_96404_d.equals("CLOSED") || par2McoServer.field_96404_d.equals("CLOSED")) + { + if (par1McoServer.field_96404_d.equals("CLOSED")) + { + return 1; + } + + if (par2McoServer.field_96404_d.equals("CLOSED")) + { + return 0; + } + } + + return par1McoServer.field_96408_a < par2McoServer.field_96408_a ? 1 : (par1McoServer.field_96408_a > par2McoServer.field_96408_a ? -1 : 0); + } + } + + public int compare(Object par1Obj, Object par2Obj) + { + return this.func_140068_a((McoServer)par1Obj, (McoServer)par2Obj); + } + + McoServerListUpdateTaskComparator(McoServerListUpdateTask par1McoServerListUpdateTask, String par2Str, McoServerListEmptyAnon par3McoServerListEmptyAnon) + { + this(par1McoServerListUpdateTask, par2Str); + } +} diff --git a/src/main/java/net/minecraft/src/MemoryConnection.java b/src/main/java/net/minecraft/src/MemoryConnection.java new file mode 100644 index 0000000..e67442d --- /dev/null +++ b/src/main/java/net/minecraft/src/MemoryConnection.java @@ -0,0 +1,158 @@ +package net.minecraft.src; + +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class MemoryConnection implements INetworkManager +{ + private static final SocketAddress mySocketAddress = new InetSocketAddress("127.0.0.1", 0); + private final List readPacketCache = Collections.synchronizedList(new ArrayList()); + private final ILogAgent field_98214_c; + private MemoryConnection pairedConnection; + private NetHandler myNetHandler; + + /** set to true by {server,network}Shutdown */ + private boolean shuttingDown; + private String shutdownReason = ""; + private Object[] field_74439_g; + private boolean gamePaused; + + public MemoryConnection(ILogAgent par1ILogAgent, NetHandler par2NetHandler) + { + this.myNetHandler = par2NetHandler; + this.field_98214_c = par1ILogAgent; + } + + /** + * Sets the NetHandler for this NetworkManager. Server-only. + */ + public void setNetHandler(NetHandler par1NetHandler) + { + this.myNetHandler = par1NetHandler; + } + + /** + * Adds the packet to the correct send queue (chunk data packets go to a separate queue). + */ + public void addToSendQueue(Packet par1Packet) + { + if (!this.shuttingDown) + { + this.pairedConnection.processOrCachePacket(par1Packet); + } + } + + public void closeConnections() + { + this.pairedConnection = null; + this.myNetHandler = null; + } + + public boolean isConnectionActive() + { + return !this.shuttingDown && this.pairedConnection != null; + } + + /** + * Wakes reader and writer threads + */ + public void wakeThreads() {} + + /** + * Checks timeouts and processes all pending read packets. + */ + public void processReadPackets() + { + int var1 = 2500; + + while (var1-- >= 0 && !this.readPacketCache.isEmpty()) + { + Packet var2 = (Packet)this.readPacketCache.remove(0); + var2.processPacket(this.myNetHandler); + } + + if (this.readPacketCache.size() > var1) + { + this.field_98214_c.logWarning("Memory connection overburdened; after processing 2500 packets, we still have " + this.readPacketCache.size() + " to go!"); + } + + if (this.shuttingDown && this.readPacketCache.isEmpty()) + { + this.myNetHandler.handleErrorMessage(this.shutdownReason, this.field_74439_g); + } + } + + /** + * Return the InetSocketAddress of the remote endpoint + */ + public SocketAddress getSocketAddress() + { + return mySocketAddress; + } + + /** + * Shuts down the server. (Only actually used on the server) + */ + public void serverShutdown() + { + this.shuttingDown = true; + } + + /** + * Shuts down the network with the specified reason. Closes all streams and sockets, spawns NetworkMasterThread to + * stop reading and writing threads. + */ + public void networkShutdown(String par1Str, Object ... par2ArrayOfObj) + { + this.shuttingDown = true; + this.shutdownReason = par1Str; + this.field_74439_g = par2ArrayOfObj; + } + + /** + * returns 0 for memoryConnections + */ + public int packetSize() + { + return 0; + } + + public void pairWith(MemoryConnection par1MemoryConnection) + { + this.pairedConnection = par1MemoryConnection; + par1MemoryConnection.pairedConnection = this; + } + + public boolean isGamePaused() + { + return this.gamePaused; + } + + public void setGamePaused(boolean par1) + { + this.gamePaused = par1; + } + + public MemoryConnection getPairedConnection() + { + return this.pairedConnection; + } + + /** + * acts immiditally if isWritePacket, otherwise adds it to the readCache to be processed next tick + */ + public void processOrCachePacket(Packet par1Packet) + { + if (par1Packet.canProcessAsync() && this.myNetHandler.canProcessPacketsAsync()) + { + par1Packet.processPacket(this.myNetHandler); + } + else + { + this.readPacketCache.add(par1Packet); + } + } +} diff --git a/src/main/java/net/minecraft/src/MerchantRecipe.java b/src/main/java/net/minecraft/src/MerchantRecipe.java new file mode 100644 index 0000000..a86b871 --- /dev/null +++ b/src/main/java/net/minecraft/src/MerchantRecipe.java @@ -0,0 +1,155 @@ +package net.minecraft.src; + +public class MerchantRecipe +{ + /** Item the Villager buys. */ + private ItemStack itemToBuy; + + /** Second Item the Villager buys. */ + private ItemStack secondItemToBuy; + + /** Item the Villager sells. */ + private ItemStack itemToSell; + + /** + * Saves how much has been tool used when put into to slot to be enchanted. + */ + private int toolUses; + + /** Maximum times this trade can be used. */ + private int maxTradeUses; + + public MerchantRecipe(NBTTagCompound par1NBTTagCompound) + { + this.readFromTags(par1NBTTagCompound); + } + + public MerchantRecipe(ItemStack par1ItemStack, ItemStack par2ItemStack, ItemStack par3ItemStack) + { + this.itemToBuy = par1ItemStack; + this.secondItemToBuy = par2ItemStack; + this.itemToSell = par3ItemStack; + this.maxTradeUses = 7; + } + + public MerchantRecipe(ItemStack par1ItemStack, ItemStack par2ItemStack) + { + this(par1ItemStack, (ItemStack)null, par2ItemStack); + } + + public MerchantRecipe(ItemStack par1ItemStack, Item par2Item) + { + this(par1ItemStack, new ItemStack(par2Item)); + } + + /** + * Gets the itemToBuy. + */ + public ItemStack getItemToBuy() + { + return this.itemToBuy; + } + + /** + * Gets secondItemToBuy. + */ + public ItemStack getSecondItemToBuy() + { + return this.secondItemToBuy; + } + + /** + * Gets if Villager has secondItemToBuy. + */ + public boolean hasSecondItemToBuy() + { + return this.secondItemToBuy != null; + } + + /** + * Gets itemToSell. + */ + public ItemStack getItemToSell() + { + return this.itemToSell; + } + + /** + * checks if both the first and second ItemToBuy IDs are the same + */ + public boolean hasSameIDsAs(MerchantRecipe par1MerchantRecipe) + { + return this.itemToBuy.itemID == par1MerchantRecipe.itemToBuy.itemID && this.itemToSell.itemID == par1MerchantRecipe.itemToSell.itemID ? this.secondItemToBuy == null && par1MerchantRecipe.secondItemToBuy == null || this.secondItemToBuy != null && par1MerchantRecipe.secondItemToBuy != null && this.secondItemToBuy.itemID == par1MerchantRecipe.secondItemToBuy.itemID : false; + } + + /** + * checks first and second ItemToBuy ID's and count. Calls hasSameIDs + */ + public boolean hasSameItemsAs(MerchantRecipe par1MerchantRecipe) + { + return this.hasSameIDsAs(par1MerchantRecipe) && (this.itemToBuy.stackSize < par1MerchantRecipe.itemToBuy.stackSize || this.secondItemToBuy != null && this.secondItemToBuy.stackSize < par1MerchantRecipe.secondItemToBuy.stackSize); + } + + public void incrementToolUses() + { + ++this.toolUses; + } + + public void func_82783_a(int par1) + { + this.maxTradeUses += par1; + } + + public boolean func_82784_g() + { + return this.toolUses >= this.maxTradeUses; + } + + public void func_82785_h() + { + this.toolUses = this.maxTradeUses; + } + + public void readFromTags(NBTTagCompound par1NBTTagCompound) + { + NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("buy"); + this.itemToBuy = ItemStack.loadItemStackFromNBT(var2); + NBTTagCompound var3 = par1NBTTagCompound.getCompoundTag("sell"); + this.itemToSell = ItemStack.loadItemStackFromNBT(var3); + + if (par1NBTTagCompound.hasKey("buyB")) + { + this.secondItemToBuy = ItemStack.loadItemStackFromNBT(par1NBTTagCompound.getCompoundTag("buyB")); + } + + if (par1NBTTagCompound.hasKey("uses")) + { + this.toolUses = par1NBTTagCompound.getInteger("uses"); + } + + if (par1NBTTagCompound.hasKey("maxUses")) + { + this.maxTradeUses = par1NBTTagCompound.getInteger("maxUses"); + } + else + { + this.maxTradeUses = 7; + } + } + + public NBTTagCompound writeToTags() + { + NBTTagCompound var1 = new NBTTagCompound(); + var1.setCompoundTag("buy", this.itemToBuy.writeToNBT(new NBTTagCompound("buy"))); + var1.setCompoundTag("sell", this.itemToSell.writeToNBT(new NBTTagCompound("sell"))); + + if (this.secondItemToBuy != null) + { + var1.setCompoundTag("buyB", this.secondItemToBuy.writeToNBT(new NBTTagCompound("buyB"))); + } + + var1.setInteger("uses", this.toolUses); + var1.setInteger("maxUses", this.maxTradeUses); + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/MerchantRecipeList.java b/src/main/java/net/minecraft/src/MerchantRecipeList.java new file mode 100644 index 0000000..5c1e6e0 --- /dev/null +++ b/src/main/java/net/minecraft/src/MerchantRecipeList.java @@ -0,0 +1,142 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; + +public class MerchantRecipeList extends ArrayList +{ + public MerchantRecipeList() {} + + public MerchantRecipeList(NBTTagCompound par1NBTTagCompound) + { + this.readRecipiesFromTags(par1NBTTagCompound); + } + + /** + * can par1,par2 be used to in crafting recipe par3 + */ + public MerchantRecipe canRecipeBeUsed(ItemStack par1ItemStack, ItemStack par2ItemStack, int par3) + { + if (par3 > 0 && par3 < this.size()) + { + MerchantRecipe var6 = (MerchantRecipe)this.get(par3); + return par1ItemStack.itemID == var6.getItemToBuy().itemID && (par2ItemStack == null && !var6.hasSecondItemToBuy() || var6.hasSecondItemToBuy() && par2ItemStack != null && var6.getSecondItemToBuy().itemID == par2ItemStack.itemID) && par1ItemStack.stackSize >= var6.getItemToBuy().stackSize && (!var6.hasSecondItemToBuy() || par2ItemStack.stackSize >= var6.getSecondItemToBuy().stackSize) ? var6 : null; + } + else + { + for (int var4 = 0; var4 < this.size(); ++var4) + { + MerchantRecipe var5 = (MerchantRecipe)this.get(var4); + + if (par1ItemStack.itemID == var5.getItemToBuy().itemID && par1ItemStack.stackSize >= var5.getItemToBuy().stackSize && (!var5.hasSecondItemToBuy() && par2ItemStack == null || var5.hasSecondItemToBuy() && par2ItemStack != null && var5.getSecondItemToBuy().itemID == par2ItemStack.itemID && par2ItemStack.stackSize >= var5.getSecondItemToBuy().stackSize)) + { + return var5; + } + } + + return null; + } + } + + /** + * checks if there is a recipie for the same ingredients already on the list, and replaces it. otherwise, adds it + */ + public void addToListWithCheck(MerchantRecipe par1MerchantRecipe) + { + for (int var2 = 0; var2 < this.size(); ++var2) + { + MerchantRecipe var3 = (MerchantRecipe)this.get(var2); + + if (par1MerchantRecipe.hasSameIDsAs(var3)) + { + if (par1MerchantRecipe.hasSameItemsAs(var3)) + { + this.set(var2, par1MerchantRecipe); + } + + return; + } + } + + this.add(par1MerchantRecipe); + } + + public void writeRecipiesToStream(DataOutputStream par1DataOutputStream) throws IOException + { + par1DataOutputStream.writeByte((byte)(this.size() & 255)); + + for (int var2 = 0; var2 < this.size(); ++var2) + { + MerchantRecipe var3 = (MerchantRecipe)this.get(var2); + Packet.writeItemStack(var3.getItemToBuy(), par1DataOutputStream); + Packet.writeItemStack(var3.getItemToSell(), par1DataOutputStream); + ItemStack var4 = var3.getSecondItemToBuy(); + par1DataOutputStream.writeBoolean(var4 != null); + + if (var4 != null) + { + Packet.writeItemStack(var4, par1DataOutputStream); + } + + par1DataOutputStream.writeBoolean(var3.func_82784_g()); + } + } + + public static MerchantRecipeList readRecipiesFromStream(DataInputStream par0DataInputStream) throws IOException + { + MerchantRecipeList var1 = new MerchantRecipeList(); + int var2 = par0DataInputStream.readByte() & 255; + + for (int var3 = 0; var3 < var2; ++var3) + { + ItemStack var4 = Packet.readItemStack(par0DataInputStream); + ItemStack var5 = Packet.readItemStack(par0DataInputStream); + ItemStack var6 = null; + + if (par0DataInputStream.readBoolean()) + { + var6 = Packet.readItemStack(par0DataInputStream); + } + + boolean var7 = par0DataInputStream.readBoolean(); + MerchantRecipe var8 = new MerchantRecipe(var4, var6, var5); + + if (var7) + { + var8.func_82785_h(); + } + + var1.add(var8); + } + + return var1; + } + + public void readRecipiesFromTags(NBTTagCompound par1NBTTagCompound) + { + NBTTagList var2 = par1NBTTagCompound.getTagList("Recipes"); + + for (int var3 = 0; var3 < var2.tagCount(); ++var3) + { + NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3); + this.add(new MerchantRecipe(var4)); + } + } + + public NBTTagCompound getRecipiesAsTags() + { + NBTTagCompound var1 = new NBTTagCompound(); + NBTTagList var2 = new NBTTagList("Recipes"); + + for (int var3 = 0; var3 < this.size(); ++var3) + { + MerchantRecipe var4 = (MerchantRecipe)this.get(var3); + var2.appendTag(var4.writeToTags()); + } + + var1.setTag("Recipes", var2); + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/MessageComponentSerializer.java b/src/main/java/net/minecraft/src/MessageComponentSerializer.java new file mode 100644 index 0000000..f94adf5 --- /dev/null +++ b/src/main/java/net/minecraft/src/MessageComponentSerializer.java @@ -0,0 +1,211 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Iterator; + +public class MessageComponentSerializer implements JsonDeserializer, JsonSerializer +{ + public ChatMessageComponent deserializeComponent(JsonElement par1JsonElement, Type par2Type, JsonDeserializationContext par3JsonDeserializationContext) + { + ChatMessageComponent var4 = new ChatMessageComponent(); + JsonObject var5 = (JsonObject)par1JsonElement; + JsonElement var6 = var5.get("text"); + JsonElement var7 = var5.get("translate"); + JsonElement var8 = var5.get("color"); + JsonElement var9 = var5.get("bold"); + JsonElement var10 = var5.get("italic"); + JsonElement var11 = var5.get("underlined"); + JsonElement var12 = var5.get("obfuscated"); + + if (var8 != null && var8.isJsonPrimitive()) + { + EnumChatFormatting var13 = EnumChatFormatting.func_96300_b(var8.getAsString()); + + if (var13 == null || !var13.isColor()) + { + throw new JsonParseException("Given color (" + var8.getAsString() + ") is not a valid selection"); + } + + var4.setColor(var13); + } + + if (var9 != null && var9.isJsonPrimitive()) + { + var4.setBold(Boolean.valueOf(var9.getAsBoolean())); + } + + if (var10 != null && var10.isJsonPrimitive()) + { + var4.setItalic(Boolean.valueOf(var10.getAsBoolean())); + } + + if (var11 != null && var11.isJsonPrimitive()) + { + var4.setUnderline(Boolean.valueOf(var11.getAsBoolean())); + } + + if (var12 != null && var12.isJsonPrimitive()) + { + var4.setObfuscated(Boolean.valueOf(var12.getAsBoolean())); + } + + if (var6 != null) + { + if (var6.isJsonArray()) + { + JsonArray var17 = var6.getAsJsonArray(); + Iterator var14 = var17.iterator(); + + while (var14.hasNext()) + { + JsonElement var15 = (JsonElement)var14.next(); + + if (var15.isJsonPrimitive()) + { + var4.addText(var15.getAsString()); + } + else if (var15.isJsonObject()) + { + var4.appendComponent(this.deserializeComponent(var15, par2Type, par3JsonDeserializationContext)); + } + } + } + else if (var6.isJsonPrimitive()) + { + var4.addText(var6.getAsString()); + } + } + else if (var7 != null && var7.isJsonPrimitive()) + { + JsonElement var18 = var5.get("using"); + + if (var18 != null) + { + if (var18.isJsonArray()) + { + ArrayList var19 = Lists.newArrayList(); + Iterator var20 = var18.getAsJsonArray().iterator(); + + while (var20.hasNext()) + { + JsonElement var16 = (JsonElement)var20.next(); + + if (var16.isJsonPrimitive()) + { + var19.add(var16.getAsString()); + } + else if (var16.isJsonObject()) + { + var19.add(this.deserializeComponent(var16, par2Type, par3JsonDeserializationContext)); + } + } + + var4.addFormatted(var7.getAsString(), var19.toArray()); + } + else if (var18.isJsonPrimitive()) + { + var4.addFormatted(var7.getAsString(), new Object[] {var18.getAsString()}); + } + } + else + { + var4.addKey(var7.getAsString()); + } + } + + return var4; + } + + public JsonElement serializeComponent(ChatMessageComponent par1ChatMessageComponent, Type par2Type, JsonSerializationContext par3JsonSerializationContext) + { + JsonObject var4 = new JsonObject(); + + if (par1ChatMessageComponent.getColor() != null) + { + var4.addProperty("color", par1ChatMessageComponent.getColor().func_96297_d()); + } + + if (par1ChatMessageComponent.isBold() != null) + { + var4.addProperty("bold", par1ChatMessageComponent.isBold()); + } + + if (par1ChatMessageComponent.isItalic() != null) + { + var4.addProperty("italic", par1ChatMessageComponent.isItalic()); + } + + if (par1ChatMessageComponent.isUnderline() != null) + { + var4.addProperty("underlined", par1ChatMessageComponent.isUnderline()); + } + + if (par1ChatMessageComponent.isObfuscated() != null) + { + var4.addProperty("obfuscated", par1ChatMessageComponent.isObfuscated()); + } + + if (par1ChatMessageComponent.getText() != null) + { + var4.addProperty("text", par1ChatMessageComponent.getText()); + } + else if (par1ChatMessageComponent.getTranslationKey() != null) + { + var4.addProperty("translate", par1ChatMessageComponent.getTranslationKey()); + + if (par1ChatMessageComponent.getSubComponents() != null && !par1ChatMessageComponent.getSubComponents().isEmpty()) + { + var4.add("using", this.serializeComponentChildren(par1ChatMessageComponent, par2Type, par3JsonSerializationContext)); + } + } + else if (par1ChatMessageComponent.getSubComponents() != null && !par1ChatMessageComponent.getSubComponents().isEmpty()) + { + var4.add("text", this.serializeComponentChildren(par1ChatMessageComponent, par2Type, par3JsonSerializationContext)); + } + + return var4; + } + + private JsonArray serializeComponentChildren(ChatMessageComponent par1ChatMessageComponent, Type par2Type, JsonSerializationContext par3JsonSerializationContext) + { + JsonArray var4 = new JsonArray(); + Iterator var5 = par1ChatMessageComponent.getSubComponents().iterator(); + + while (var5.hasNext()) + { + ChatMessageComponent var6 = (ChatMessageComponent)var5.next(); + + if (var6.getText() != null) + { + var4.add(new JsonPrimitive(var6.getText())); + } + else + { + var4.add(this.serializeComponent(var6, par2Type, par3JsonSerializationContext)); + } + } + + return var4; + } + + public Object deserialize(JsonElement par1JsonElement, Type par2Type, JsonDeserializationContext par3JsonDeserializationContext) + { + return this.deserializeComponent(par1JsonElement, par2Type, par3JsonDeserializationContext); + } + + public JsonElement serialize(Object par1Obj, Type par2Type, JsonSerializationContext par3JsonSerializationContext) + { + return this.serializeComponent((ChatMessageComponent)par1Obj, par2Type, par3JsonSerializationContext); + } +} diff --git a/src/main/java/net/minecraft/src/MetadataSection.java b/src/main/java/net/minecraft/src/MetadataSection.java new file mode 100644 index 0000000..4246481 --- /dev/null +++ b/src/main/java/net/minecraft/src/MetadataSection.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public interface MetadataSection +{ +} diff --git a/src/main/java/net/minecraft/src/MetadataSectionSerializer.java b/src/main/java/net/minecraft/src/MetadataSectionSerializer.java new file mode 100644 index 0000000..10569ff --- /dev/null +++ b/src/main/java/net/minecraft/src/MetadataSectionSerializer.java @@ -0,0 +1,11 @@ +package net.minecraft.src; + +import com.google.gson.JsonDeserializer; + +public interface MetadataSectionSerializer extends JsonDeserializer +{ + /** + * The name of this section type as it appears in JSON. + */ + String getSectionName(); +} diff --git a/src/main/java/net/minecraft/src/MetadataSerializer.java b/src/main/java/net/minecraft/src/MetadataSerializer.java new file mode 100644 index 0000000..abfcd1d --- /dev/null +++ b/src/main/java/net/minecraft/src/MetadataSerializer.java @@ -0,0 +1,65 @@ +package net.minecraft.src; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; + +public class MetadataSerializer +{ + private final IRegistry metadataSectionSerializerRegistry = new RegistrySimple(); + private final GsonBuilder gsonBuilder = new GsonBuilder(); + + /** + * Cached Gson instance. Set to null when more sections are registered, and then re-created from the builder. + */ + private Gson gson; + + public void registerMetadataSectionType(MetadataSectionSerializer par1MetadataSectionSerializer, Class par2Class) + { + this.metadataSectionSerializerRegistry.putObject(par1MetadataSectionSerializer.getSectionName(), new MetadataSerializerRegistration(this, par1MetadataSectionSerializer, par2Class, (MetadataSerializerEmptyAnon)null)); + this.gsonBuilder.registerTypeAdapter(par2Class, par1MetadataSectionSerializer); + this.gson = null; + } + + public MetadataSection parseMetadataSection(String par1Str, JsonObject par2JsonObject) + { + if (par1Str == null) + { + throw new IllegalArgumentException("Metadata section name cannot be null"); + } + else if (!par2JsonObject.has(par1Str)) + { + return null; + } + else if (!par2JsonObject.get(par1Str).isJsonObject()) + { + throw new IllegalArgumentException("Invalid metadata for \'" + par1Str + "\' - expected object, found " + par2JsonObject.get(par1Str)); + } + else + { + MetadataSerializerRegistration var3 = (MetadataSerializerRegistration)this.metadataSectionSerializerRegistry.getObject(par1Str); + + if (var3 == null) + { + throw new IllegalArgumentException("Don\'t know how to handle metadata section \'" + par1Str + "\'"); + } + else + { + return (MetadataSection)this.getGson().fromJson(par2JsonObject.getAsJsonObject(par1Str), var3.field_110500_b); + } + } + } + + /** + * Returns a Gson instance with type adapters registered for metadata sections. + */ + private Gson getGson() + { + if (this.gson == null) + { + this.gson = this.gsonBuilder.create(); + } + + return this.gson; + } +} diff --git a/src/main/java/net/minecraft/src/MetadataSerializerEmptyAnon.java b/src/main/java/net/minecraft/src/MetadataSerializerEmptyAnon.java new file mode 100644 index 0000000..5f8966c --- /dev/null +++ b/src/main/java/net/minecraft/src/MetadataSerializerEmptyAnon.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +class MetadataSerializerEmptyAnon +{ +} diff --git a/src/main/java/net/minecraft/src/MetadataSerializerRegistration.java b/src/main/java/net/minecraft/src/MetadataSerializerRegistration.java new file mode 100644 index 0000000..a8fd20c --- /dev/null +++ b/src/main/java/net/minecraft/src/MetadataSerializerRegistration.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +class MetadataSerializerRegistration +{ + final MetadataSectionSerializer field_110502_a; + final Class field_110500_b; + + final MetadataSerializer field_110501_c; + + private MetadataSerializerRegistration(MetadataSerializer par1MetadataSerializer, MetadataSectionSerializer par2MetadataSectionSerializer, Class par3Class) + { + this.field_110501_c = par1MetadataSerializer; + this.field_110502_a = par2MetadataSectionSerializer; + this.field_110500_b = par3Class; + } + + MetadataSerializerRegistration(MetadataSerializer par1MetadataSerializer, MetadataSectionSerializer par2MetadataSectionSerializer, Class par3Class, MetadataSerializerEmptyAnon par4MetadataSerializerEmptyAnon) + { + this(par1MetadataSerializer, par2MetadataSectionSerializer, par3Class); + } +} diff --git a/src/main/java/net/minecraft/src/Minecraft.java b/src/main/java/net/minecraft/src/Minecraft.java new file mode 100644 index 0000000..48b3dc0 --- /dev/null +++ b/src/main/java/net/minecraft/src/Minecraft.java @@ -0,0 +1,2419 @@ +package net.minecraft.src; + +import com.google.common.collect.Lists; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.net.Proxy; +import java.nio.ByteBuffer; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import javax.imageio.ImageIO; +import net.minecraft.client.ClientBrandRetriever; +import net.minecraft.server.MinecraftServer; +import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.ContextCapabilities; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.DisplayMode; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL20; +import org.lwjgl.opengl.GLContext; +import org.lwjgl.opengl.PixelFormat; +import org.lwjgl.util.glu.GLU; + +public class Minecraft implements IPlayerUsage +{ + private static final ResourceLocation locationMojangPng = new ResourceLocation("textures/gui/title/mojang.png"); + public static final boolean isRunningOnMac = Util.getOSType() == EnumOS.MACOS; + + /** A 10MiB preallocation to ensure the heap is reasonably sized. */ + public static byte[] memoryReserve = new byte[10485760]; + private static final List macDisplayModes = Lists.newArrayList(new DisplayMode[] {new DisplayMode(2560, 1600), new DisplayMode(2880, 1800)}); + private final ILogAgent mcLogAgent; + private final File fileResourcepacks; + private ServerData currentServerData; + + /** The RenderEngine instance used by Minecraft */ + private TextureManager renderEngine; + + /** + * Set to 'this' in Minecraft constructor; used by some settings get methods + */ + private static Minecraft theMinecraft; + public PlayerControllerMP playerController; + private boolean fullscreen; + private boolean hasCrashed; + + /** Instance of CrashReport. */ + private CrashReport crashReporter; + public int displayWidth; + public int displayHeight; + private Timer timer = new Timer(20.0F); + + /** Instance of PlayerUsageSnooper. */ + private PlayerUsageSnooper usageSnooper = new PlayerUsageSnooper("client", this, MinecraftServer.getSystemTimeMillis()); + public WorldClient theWorld; + public RenderGlobal renderGlobal; + public EntityClientPlayerMP thePlayer; + + /** + * The Entity from which the renderer determines the render viewpoint. Currently is always the parent Minecraft + * class's 'thePlayer' instance. Modification of its location, rotation, or other settings at render time will + * modify the camera likewise, with the caveat of triggering chunk rebuilds as it moves, making it unsuitable for + * changing the viewpoint mid-render. + */ + public EntityLivingBase renderViewEntity; + public EntityLivingBase pointedEntityLiving; + public EffectRenderer effectRenderer; + private final Session session; + private boolean isGamePaused; + + /** The font renderer used for displaying and measuring text. */ + public FontRenderer fontRenderer; + public FontRenderer standardGalacticFontRenderer; + + /** The GuiScreen that's being displayed at the moment. */ + public GuiScreen currentScreen; + public LoadingScreenRenderer loadingScreen; + public EntityRenderer entityRenderer; + + /** Mouse left click counter */ + private int leftClickCounter; + + /** Display width */ + private int tempDisplayWidth; + + /** Display height */ + private int tempDisplayHeight; + + /** Instance of IntegratedServer. */ + private IntegratedServer theIntegratedServer; + + /** Gui achievement */ + public GuiAchievement guiAchievement; + public GuiIngame ingameGUI; + + /** Skip render world */ + public boolean skipRenderWorld; + + /** The ray trace hit that the mouse is over. */ + public MovingObjectPosition objectMouseOver; + + /** The game settings that currently hold effect. */ + public GameSettings gameSettings; + public SoundManager sndManager; + + /** Mouse helper instance. */ + public MouseHelper mouseHelper; + public final File mcDataDir; + private final File fileAssets; + private final String launchedVersion; + private final Proxy proxy; + private ISaveFormat saveLoader; + + /** + * This is set to fpsCounter every debug screen update, and is shown on the debug screen. It's also sent as part of + * the usage snooping. + */ + private static int debugFPS; + + /** + * When you place a block, it's set to 6, decremented once per tick, when it's 0, you can place another block. + */ + private int rightClickDelayTimer; + + /** + * Checked in Minecraft's while(running) loop, if true it's set to false and the textures refreshed. + */ + private boolean refreshTexturePacksScheduled; + + /** Stat file writer */ + public StatFileWriter statFileWriter; + private String serverName; + private int serverPort; + + /** + * Makes sure it doesn't keep taking screenshots when both buttons are down. + */ + boolean isTakingScreenshot; + + /** + * Does the actual gameplay have focus. If so then mouse and keys will effect the player instead of menus. + */ + public boolean inGameHasFocus; + long systemTime = getSystemTime(); + + /** Join player counter */ + private int joinPlayerCounter; + private final boolean isDemo; + private INetworkManager myNetworkManager; + private boolean integratedServerIsRunning; + + /** The profiler instance */ + public final Profiler mcProfiler = new Profiler(); + private long field_83002_am = -1L; + private ReloadableResourceManager mcResourceManager; + private final MetadataSerializer metadataSerializer_ = new MetadataSerializer(); + private List defaultResourcePacks = Lists.newArrayList(); + private DefaultResourcePack mcDefaultResourcePack; + private ResourcePackRepository mcResourcePackRepository; + private LanguageManager mcLanguageManager; + + /** + * Set to true to keep the game loop running. Set to false by shutdown() to allow the game loop to exit cleanly. + */ + volatile boolean running = true; + + /** String that shows the debug information */ + public String debug = ""; + + /** Approximate time (in ms) of last update to debug string */ + long debugUpdateTime = getSystemTime(); + + /** holds the current fps */ + int fpsCounter; + long prevFrameTime = -1L; + + /** Profiler currently displayed in the debug screen pie chart */ + private String debugProfilerName = "root"; + + public Minecraft(Session par1Session, int par2, int par3, boolean par4, boolean par5, File par6File, File par7File, File par8File, Proxy par9Proxy, String par10Str) + { + theMinecraft = this; + this.mcLogAgent = new LogAgent("Minecraft-Client", " [CLIENT]", (new File(par6File, "output-client.log")).getAbsolutePath()); + this.mcDataDir = par6File; + this.fileAssets = par7File; + this.fileResourcepacks = par8File; + this.launchedVersion = par10Str; + this.mcDefaultResourcePack = new DefaultResourcePack(this.fileAssets); + this.addDefaultResourcePack(); + this.proxy = par9Proxy; + this.startTimerHackThread(); + this.session = par1Session; + this.mcLogAgent.logInfo("Setting user: " + par1Session.getUsername()); + this.mcLogAgent.logInfo("(Session ID is " + par1Session.getSessionID() + ")"); + this.isDemo = par5; + this.displayWidth = par2; + this.displayHeight = par3; + this.tempDisplayWidth = par2; + this.tempDisplayHeight = par3; + this.fullscreen = par4; + ImageIO.setUseCache(false); + //StatList.nopInit(); + } + + private void startTimerHackThread() + { + ThreadClientSleep var1 = new ThreadClientSleep(this, "Timer hack thread"); + var1.setDaemon(true); + var1.start(); + } + + public void crashed(CrashReport par1CrashReport) + { + this.hasCrashed = true; + this.crashReporter = par1CrashReport; + } + + /** + * Wrapper around displayCrashReportInternal + */ + public void displayCrashReport(CrashReport par1CrashReport) + { + File var2 = new File(getMinecraft().mcDataDir, "crash-reports"); + File var3 = new File(var2, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt"); + System.out.println(par1CrashReport.getCompleteReport()); + + if (par1CrashReport.getFile() != null) + { + System.out.println("#@!@# Game crashed! Crash report saved to: #@!@# " + par1CrashReport.getFile()); + System.exit(-1); + } + else if (par1CrashReport.saveToFile(var3, this.getLogAgent())) + { + System.out.println("#@!@# Game crashed! Crash report saved to: #@!@# " + var3.getAbsolutePath()); + System.exit(-1); + } + else + { + System.out.println("#@?@# Game crashed! Crash report could not be saved. #@?@#"); + System.exit(-2); + } + } + + public void setServer(String par1Str, int par2) + { + this.serverName = par1Str; + this.serverPort = par2; + } + + /** + * Starts the game: initializes the canvas, the title, the settings, etcetera. + */ + private void startGame() throws LWJGLException + { + this.gameSettings = new GameSettings(this, this.mcDataDir); + + if (this.gameSettings.overrideHeight > 0 && this.gameSettings.overrideWidth > 0) + { + this.displayWidth = this.gameSettings.overrideWidth; + this.displayHeight = this.gameSettings.overrideHeight; + } + + if (this.fullscreen) + { + Display.setFullscreen(true); + this.displayWidth = Display.getDisplayMode().getWidth(); + this.displayHeight = Display.getDisplayMode().getHeight(); + + if (this.displayWidth <= 0) + { + this.displayWidth = 1; + } + + if (this.displayHeight <= 0) + { + this.displayHeight = 1; + } + } + else + { + Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight)); + } + + Display.setResizable(true); + Display.setTitle("Minecraft 1.6.4"); + this.getLogAgent().logInfo("LWJGL Version: " + Sys.getVersion()); + + if (Util.getOSType() != EnumOS.MACOS) + { + try + { + Display.setIcon(new ByteBuffer[] {this.readImage(new File(this.fileAssets, "/icons/icon_16x16.png")), this.readImage(new File(this.fileAssets, "/icons/icon_32x32.png"))}); + } + catch (IOException var5) + { + var5.printStackTrace(); + } + } + + try + { + Display.create((new PixelFormat()).withDepthBits(24)); + } + catch (LWJGLException var4) + { + var4.printStackTrace(); + + try + { + Thread.sleep(1000L); + } + catch (InterruptedException var3) + { + ; + } + + if (this.fullscreen) + { + this.updateDisplayMode(); + } + + Display.create(); + } + + OpenGlHelper.initializeTextures(); + this.guiAchievement = new GuiAchievement(this); + this.metadataSerializer_.registerMetadataSectionType(new TextureMetadataSectionSerializer(), TextureMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new FontMetadataSectionSerializer(), FontMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new AnimationMetadataSectionSerializer(), AnimationMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new PackMetadataSectionSerializer(), PackMetadataSection.class); + this.metadataSerializer_.registerMetadataSectionType(new LanguageMetadataSectionSerializer(), LanguageMetadataSection.class); + this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves")); + this.mcResourcePackRepository = new ResourcePackRepository(this.fileResourcepacks, this.mcDefaultResourcePack, this.metadataSerializer_, this.gameSettings); + this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_); + this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language); + this.mcResourceManager.registerReloadListener(this.mcLanguageManager); + this.refreshResources(); + this.renderEngine = new TextureManager(this.mcResourceManager); + this.mcResourceManager.registerReloadListener(this.renderEngine); + this.sndManager = new SoundManager(this.mcResourceManager, this.gameSettings, this.fileAssets); + this.mcResourceManager.registerReloadListener(this.sndManager); + this.loadScreen(); + this.fontRenderer = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii.png"), this.renderEngine, false); + + if (this.gameSettings.language != null) + { + this.fontRenderer.setUnicodeFlag(this.mcLanguageManager.isCurrentLocaleUnicode()); + this.fontRenderer.setBidiFlag(this.mcLanguageManager.isCurrentLanguageBidirectional()); + } + + this.standardGalacticFontRenderer = new FontRenderer(this.gameSettings, new ResourceLocation("textures/font/ascii_sga.png"), this.renderEngine, false); + this.mcResourceManager.registerReloadListener(this.fontRenderer); + this.mcResourceManager.registerReloadListener(this.standardGalacticFontRenderer); + this.mcResourceManager.registerReloadListener(new GrassColorReloadListener()); + this.mcResourceManager.registerReloadListener(new FoliageColorReloadListener()); + RenderManager.instance.itemRenderer = new ItemRenderer(this); + this.entityRenderer = new EntityRenderer(this); + this.statFileWriter = new StatFileWriter(this.session, this.mcDataDir); + AchievementList.openInventory.setStatStringFormatter(new StatStringFormatKeyInv(this)); + this.mouseHelper = new MouseHelper(); + this.checkGLError("Pre startup"); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glClearDepth(1.0D); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthFunc(GL11.GL_LEQUAL); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + GL11.glCullFace(GL11.GL_BACK); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + this.checkGLError("Startup"); + this.renderGlobal = new RenderGlobal(this); + this.renderEngine.loadTextureMap(TextureMap.locationBlocksTexture, new TextureMap(0, "textures/blocks")); + this.renderEngine.loadTextureMap(TextureMap.locationItemsTexture, new TextureMap(1, "textures/items")); + GL11.glViewport(0, 0, this.displayWidth, this.displayHeight); + this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); + this.checkGLError("Post startup"); + this.ingameGUI = new GuiIngame(this); + + if (this.serverName != null) + { + this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort)); + } + else + { + this.displayGuiScreen(new GuiMainMenu()); + } + + this.loadingScreen = new LoadingScreenRenderer(this); + + if (this.gameSettings.fullScreen && !this.fullscreen) + { + this.toggleFullscreen(); + } + } + + public void refreshResources() + { + ArrayList var1 = Lists.newArrayList(this.defaultResourcePacks); + Iterator var2 = this.mcResourcePackRepository.getRepositoryEntries().iterator(); + + while (var2.hasNext()) + { + ResourcePackRepositoryEntry var3 = (ResourcePackRepositoryEntry)var2.next(); + var1.add(var3.getResourcePack()); + } + + this.mcLanguageManager.parseLanguageMetadata(var1); + this.mcResourceManager.reloadResources(var1); + + if (this.renderGlobal != null) + { + this.renderGlobal.loadRenderers(); + } + } + + private void addDefaultResourcePack() + { + this.defaultResourcePacks.add(this.mcDefaultResourcePack); + } + + private ByteBuffer readImage(File par1File) throws IOException + { + BufferedImage var2 = ImageIO.read(par1File); + int[] var3 = var2.getRGB(0, 0, var2.getWidth(), var2.getHeight(), (int[])null, 0, var2.getWidth()); + ByteBuffer var4 = ByteBuffer.allocate(4 * var3.length); + int[] var5 = var3; + int var6 = var3.length; + + for (int var7 = 0; var7 < var6; ++var7) + { + int var8 = var5[var7]; + var4.putInt(var8 << 8 | var8 >> 24 & 255); + } + + var4.flip(); + return var4; + } + + private void updateDisplayMode() throws LWJGLException + { + HashSet var1 = new HashSet(); + Collections.addAll(var1, Display.getAvailableDisplayModes()); + DisplayMode var2 = Display.getDesktopDisplayMode(); + + if (!var1.contains(var2) && Util.getOSType() == EnumOS.MACOS) + { + Iterator var3 = macDisplayModes.iterator(); + + while (var3.hasNext()) + { + DisplayMode var4 = (DisplayMode)var3.next(); + boolean var5 = true; + Iterator var6 = var1.iterator(); + DisplayMode var7; + + while (var6.hasNext()) + { + var7 = (DisplayMode)var6.next(); + + if (var7.getBitsPerPixel() == 32 && var7.getWidth() == var4.getWidth() && var7.getHeight() == var4.getHeight()) + { + var5 = false; + break; + } + } + + if (!var5) + { + var6 = var1.iterator(); + + while (var6.hasNext()) + { + var7 = (DisplayMode)var6.next(); + + if (var7.getBitsPerPixel() == 32 && var7.getWidth() == var4.getWidth() / 2 && var7.getHeight() == var4.getHeight() / 2) + { + var2 = var7; + break; + } + } + } + } + } + + Display.setDisplayMode(var2); + this.displayWidth = var2.getWidth(); + this.displayHeight = var2.getHeight(); + } + + /** + * Displays a new screen. + */ + private void loadScreen() throws LWJGLException + { + ScaledResolution var1 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight); + GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, var1.getScaledWidth_double(), var1.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -2000.0F); + GL11.glViewport(0, 0, this.displayWidth, this.displayHeight); + GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_FOG); + this.renderEngine.bindTexture(locationMojangPng); + Tessellator var2 = Tessellator.instance; + var2.startDrawingQuads(); + var2.setColorOpaque_I(16777215); + var2.addVertexWithUV(0.0D, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); + var2.addVertexWithUV((double)this.displayWidth, (double)this.displayHeight, 0.0D, 0.0D, 0.0D); + var2.addVertexWithUV((double)this.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); + var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + var2.draw(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + var2.setColorOpaque_I(16777215); + short var3 = 256; + short var4 = 256; + this.scaledTessellator((var1.getScaledWidth() - var3) / 2, (var1.getScaledHeight() - var4) / 2, 0, 0, var3, var4); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_FOG); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + Display.update(); + } + + /** + * Loads Tessellator with a scaled resolution + */ + public void scaledTessellator(int par1, int par2, int par3, int par4, int par5, int par6) + { + float var7 = 0.00390625F; + float var8 = 0.00390625F; + Tessellator var9 = Tessellator.instance; + var9.startDrawingQuads(); + var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + par6), 0.0D, (double)((float)(par3 + 0) * var7), (double)((float)(par4 + par6) * var8)); + var9.addVertexWithUV((double)(par1 + par5), (double)(par2 + par6), 0.0D, (double)((float)(par3 + par5) * var7), (double)((float)(par4 + par6) * var8)); + var9.addVertexWithUV((double)(par1 + par5), (double)(par2 + 0), 0.0D, (double)((float)(par3 + par5) * var7), (double)((float)(par4 + 0) * var8)); + var9.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), 0.0D, (double)((float)(par3 + 0) * var7), (double)((float)(par4 + 0) * var8)); + var9.draw(); + } + + /** + * Returns the save loader that is currently being used + */ + public ISaveFormat getSaveLoader() + { + return this.saveLoader; + } + + /** + * Sets the argument GuiScreen as the main (topmost visible) screen. + */ + public void displayGuiScreen(GuiScreen par1GuiScreen) + { + if (this.currentScreen != null) + { + this.currentScreen.onGuiClosed(); + } + + this.statFileWriter.syncStats(); + + if (par1GuiScreen == null && this.theWorld == null) + { + par1GuiScreen = new GuiMainMenu(); + } + else if (par1GuiScreen == null && this.thePlayer.getHealth() <= 0.0F) + { + par1GuiScreen = new GuiGameOver(); + } + + if (par1GuiScreen instanceof GuiMainMenu) + { + this.gameSettings.showDebugInfo = false; + this.ingameGUI.getChatGUI().clearChatMessages(); + } + + this.currentScreen = (GuiScreen)par1GuiScreen; + + if (par1GuiScreen != null) + { + this.setIngameNotInFocus(); + ScaledResolution var2 = new ScaledResolution(this.gameSettings, this.displayWidth, this.displayHeight); + int var3 = var2.getScaledWidth(); + int var4 = var2.getScaledHeight(); + ((GuiScreen)par1GuiScreen).setWorldAndResolution(this, var3, var4); + this.skipRenderWorld = false; + } + else + { + this.setIngameFocus(); + } + } + + /** + * Checks for an OpenGL error. If there is one, prints the error ID and error string. + */ + private void checkGLError(String par1Str) + { + int var2 = GL11.glGetError(); + + if (var2 != 0) + { + String var3 = GLU.gluErrorString(var2); + this.getLogAgent().logSevere("########## GL ERROR ##########"); + this.getLogAgent().logSevere("@ " + par1Str); + this.getLogAgent().logSevere(var2 + ": " + var3); + } + } + + /** + * Shuts down the minecraft applet by stopping the resource downloads, and clearing up GL stuff; called when the + * application (or web page) is exited. + */ + public void shutdownMinecraftApplet() + { + try + { + this.statFileWriter.syncStats(); + this.getLogAgent().logInfo("Stopping!"); + + try + { + this.loadWorld((WorldClient)null); + } + catch (Throwable var7) + { + ; + } + + try + { + GLAllocation.deleteTexturesAndDisplayLists(); + } + catch (Throwable var6) + { + ; + } + + this.sndManager.cleanup(); + } + finally + { + Display.destroy(); + + if (!this.hasCrashed) + { + System.exit(0); + } + } + + System.gc(); + } + + public void run() + { + this.running = true; + CrashReport var2; + + try + { + this.startGame(); + } + catch (Throwable var11) + { + var2 = CrashReport.makeCrashReport(var11, "Initializing game"); + var2.makeCategory("Initialization"); + this.displayCrashReport(this.addGraphicsAndWorldToCrashReport(var2)); + return; + } + + try + { + while (this.running) + { + if (this.running) + { + if (this.hasCrashed && this.crashReporter != null) + { + this.displayCrashReport(this.crashReporter); + return; + } + + if (this.refreshTexturePacksScheduled) + { + this.refreshTexturePacksScheduled = false; + this.refreshResources(); + } + + try + { + this.runGameLoop(); + } + catch (OutOfMemoryError var10) + { + this.freeMemory(); + this.displayGuiScreen(new GuiMemoryErrorScreen()); + System.gc(); + } + + continue; + } + } + } + catch (MinecraftError var12) + { + } + catch (ReportedException var13) + { + this.addGraphicsAndWorldToCrashReport(var13.getCrashReport()); + this.freeMemory(); + var13.printStackTrace(); + this.displayCrashReport(var13.getCrashReport()); + } + catch (Throwable var14) + { + var2 = this.addGraphicsAndWorldToCrashReport(new CrashReport("Unexpected error", var14)); + this.freeMemory(); + var14.printStackTrace(); + this.displayCrashReport(var2); + } + finally + { + this.shutdownMinecraftApplet(); + } + } + + /** + * Called repeatedly from run() + */ + private void runGameLoop() + { + AxisAlignedBB.getAABBPool().cleanPool(); + + if (this.theWorld != null) + { + this.theWorld.getWorldVec3Pool().clear(); + } + + this.mcProfiler.startSection("root"); + + if (Display.isCloseRequested()) + { + this.shutdown(); + } + + if (this.isGamePaused && this.theWorld != null) + { + float var1 = this.timer.renderPartialTicks; + this.timer.updateTimer(); + this.timer.renderPartialTicks = var1; + } + else + { + this.timer.updateTimer(); + } + + long var6 = System.nanoTime(); + this.mcProfiler.startSection("tick"); + + for (int var3 = 0; var3 < this.timer.elapsedTicks; ++var3) + { + this.runTick(); + } + + this.mcProfiler.endStartSection("preRenderErrors"); + long var7 = System.nanoTime() - var6; + this.checkGLError("Pre render"); + RenderBlocks.fancyGrass = this.gameSettings.fancyGraphics; + this.mcProfiler.endStartSection("sound"); + this.sndManager.setListener(this.thePlayer, this.timer.renderPartialTicks); + + if (!this.isGamePaused) + { + this.sndManager.func_92071_g(); + } + + this.mcProfiler.endSection(); + this.mcProfiler.startSection("render"); + this.mcProfiler.startSection("display"); + GL11.glEnable(GL11.GL_TEXTURE_2D); + + if (!Keyboard.isKeyDown(65)) + { + Display.update(); + } + + if (this.thePlayer != null && this.thePlayer.isEntityInsideOpaqueBlock()) + { + this.gameSettings.thirdPersonView = 0; + } + + this.mcProfiler.endSection(); + + if (!this.skipRenderWorld) + { + this.mcProfiler.endStartSection("gameRenderer"); + this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks); + this.mcProfiler.endSection(); + } + + GL11.glFlush(); + this.mcProfiler.endSection(); + + if (!Display.isActive() && this.fullscreen) + { + this.toggleFullscreen(); + } + + if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart) + { + if (!this.mcProfiler.profilingEnabled) + { + this.mcProfiler.clearProfiling(); + } + + this.mcProfiler.profilingEnabled = true; + this.displayDebugInfo(var7); + } + else + { + this.mcProfiler.profilingEnabled = false; + this.prevFrameTime = System.nanoTime(); + } + + this.guiAchievement.updateAchievementWindow(); + this.mcProfiler.startSection("root"); + Thread.yield(); + + if (Keyboard.isKeyDown(65)) + { + Display.update(); + } + + this.screenshotListener(); + + if (!this.fullscreen && Display.wasResized()) + { + this.displayWidth = Display.getWidth(); + this.displayHeight = Display.getHeight(); + + if (this.displayWidth <= 0) + { + this.displayWidth = 1; + } + + if (this.displayHeight <= 0) + { + this.displayHeight = 1; + } + + this.resize(this.displayWidth, this.displayHeight); + } + + this.checkGLError("Post render"); + ++this.fpsCounter; + boolean var5 = this.isGamePaused; + this.isGamePaused = this.isSingleplayer() && this.currentScreen != null && this.currentScreen.doesGuiPauseGame() && !this.theIntegratedServer.getPublic(); + + if (this.isIntegratedServerRunning() && this.thePlayer != null && this.thePlayer.sendQueue != null && this.isGamePaused != var5) + { + ((MemoryConnection)this.thePlayer.sendQueue.getNetManager()).setGamePaused(this.isGamePaused); + } + + while (getSystemTime() >= this.debugUpdateTime + 1000L) + { + debugFPS = this.fpsCounter; + this.debug = debugFPS + " fps, " + WorldRenderer.chunksUpdated + " chunk updates"; + WorldRenderer.chunksUpdated = 0; + this.debugUpdateTime += 1000L; + this.fpsCounter = 0; + this.usageSnooper.addMemoryStatsToSnooper(); + + if (!this.usageSnooper.isSnooperRunning()) + { + this.usageSnooper.startSnooper(); + } + } + + this.mcProfiler.endSection(); + + if (this.getLimitFramerate() > 0) + { + Display.sync(EntityRenderer.performanceToFps(this.getLimitFramerate())); + } + } + + private int getLimitFramerate() + { + return this.currentScreen != null && this.currentScreen instanceof GuiMainMenu ? 2 : this.gameSettings.limitFramerate; + } + + public void freeMemory() + { + try + { + memoryReserve = new byte[0]; + this.renderGlobal.deleteAllDisplayLists(); + } + catch (Throwable var4) + { + ; + } + + try + { + System.gc(); + AxisAlignedBB.getAABBPool().clearPool(); + this.theWorld.getWorldVec3Pool().clearAndFreeCache(); + } + catch (Throwable var3) + { + ; + } + + try + { + System.gc(); + this.loadWorld((WorldClient)null); + } + catch (Throwable var2) + { + ; + } + + System.gc(); + } + + /** + * checks if keys are down + */ + private void screenshotListener() + { + if (Keyboard.isKeyDown(60)) + { + if (!this.isTakingScreenshot) + { + this.isTakingScreenshot = true; + this.ingameGUI.getChatGUI().printChatMessage(ScreenShotHelper.saveScreenshot(this.mcDataDir, this.displayWidth, this.displayHeight)); + } + } + else + { + this.isTakingScreenshot = false; + } + } + + /** + * Update debugProfilerName in response to number keys in debug screen + */ + private void updateDebugProfilerName(int par1) + { + List var2 = this.mcProfiler.getProfilingData(this.debugProfilerName); + + if (var2 != null && !var2.isEmpty()) + { + ProfilerResult var3 = (ProfilerResult)var2.remove(0); + + if (par1 == 0) + { + if (var3.field_76331_c.length() > 0) + { + int var4 = this.debugProfilerName.lastIndexOf("."); + + if (var4 >= 0) + { + this.debugProfilerName = this.debugProfilerName.substring(0, var4); + } + } + } + else + { + --par1; + + if (par1 < var2.size() && !((ProfilerResult)var2.get(par1)).field_76331_c.equals("unspecified")) + { + if (this.debugProfilerName.length() > 0) + { + this.debugProfilerName = this.debugProfilerName + "."; + } + + this.debugProfilerName = this.debugProfilerName + ((ProfilerResult)var2.get(par1)).field_76331_c; + } + } + } + } + + private void displayDebugInfo(long par1) + { + if (this.mcProfiler.profilingEnabled) + { + List var3 = this.mcProfiler.getProfilingData(this.debugProfilerName); + ProfilerResult var4 = (ProfilerResult)var3.remove(0); + GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); + GL11.glMatrixMode(GL11.GL_PROJECTION); + GL11.glEnable(GL11.GL_COLOR_MATERIAL); + GL11.glLoadIdentity(); + GL11.glOrtho(0.0D, (double)this.displayWidth, (double)this.displayHeight, 0.0D, 1000.0D, 3000.0D); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, 0.0F, -2000.0F); + GL11.glLineWidth(1.0F); + GL11.glDisable(GL11.GL_TEXTURE_2D); + Tessellator var5 = Tessellator.instance; + short var6 = 160; + int var7 = this.displayWidth - var6 - 10; + int var8 = this.displayHeight - var6 * 2; + GL11.glEnable(GL11.GL_BLEND); + var5.startDrawingQuads(); + var5.setColorRGBA_I(0, 200); + var5.addVertex((double)((float)var7 - (float)var6 * 1.1F), (double)((float)var8 - (float)var6 * 0.6F - 16.0F), 0.0D); + var5.addVertex((double)((float)var7 - (float)var6 * 1.1F), (double)(var8 + var6 * 2), 0.0D); + var5.addVertex((double)((float)var7 + (float)var6 * 1.1F), (double)(var8 + var6 * 2), 0.0D); + var5.addVertex((double)((float)var7 + (float)var6 * 1.1F), (double)((float)var8 - (float)var6 * 0.6F - 16.0F), 0.0D); + var5.draw(); + GL11.glDisable(GL11.GL_BLEND); + double var9 = 0.0D; + int var13; + + for (int var11 = 0; var11 < var3.size(); ++var11) + { + ProfilerResult var12 = (ProfilerResult)var3.get(var11); + var13 = MathHelper.floor_double(var12.field_76332_a / 4.0D) + 1; + var5.startDrawing(6); + var5.setColorOpaque_I(var12.func_76329_a()); + var5.addVertex((double)var7, (double)var8, 0.0D); + int var14; + float var15; + float var16; + float var17; + + for (var14 = var13; var14 >= 0; --var14) + { + var15 = (float)((var9 + var12.field_76332_a * (double)var14 / (double)var13) * Math.PI * 2.0D / 100.0D); + var16 = MathHelper.sin(var15) * (float)var6; + var17 = MathHelper.cos(var15) * (float)var6 * 0.5F; + var5.addVertex((double)((float)var7 + var16), (double)((float)var8 - var17), 0.0D); + } + + var5.draw(); + var5.startDrawing(5); + var5.setColorOpaque_I((var12.func_76329_a() & 16711422) >> 1); + + for (var14 = var13; var14 >= 0; --var14) + { + var15 = (float)((var9 + var12.field_76332_a * (double)var14 / (double)var13) * Math.PI * 2.0D / 100.0D); + var16 = MathHelper.sin(var15) * (float)var6; + var17 = MathHelper.cos(var15) * (float)var6 * 0.5F; + var5.addVertex((double)((float)var7 + var16), (double)((float)var8 - var17), 0.0D); + var5.addVertex((double)((float)var7 + var16), (double)((float)var8 - var17 + 10.0F), 0.0D); + } + + var5.draw(); + var9 += var12.field_76332_a; + } + + DecimalFormat var18 = new DecimalFormat("##0.00"); + GL11.glEnable(GL11.GL_TEXTURE_2D); + String var19 = ""; + + if (!var4.field_76331_c.equals("unspecified")) + { + var19 = var19 + "[0] "; + } + + if (var4.field_76331_c.length() == 0) + { + var19 = var19 + "ROOT "; + } + else + { + var19 = var19 + var4.field_76331_c + " "; + } + + var13 = 16777215; + this.fontRenderer.drawStringWithShadow(var19, var7 - var6, var8 - var6 / 2 - 16, var13); + this.fontRenderer.drawStringWithShadow(var19 = var18.format(var4.field_76330_b) + "%", var7 + var6 - this.fontRenderer.getStringWidth(var19), var8 - var6 / 2 - 16, var13); + + for (int var21 = 0; var21 < var3.size(); ++var21) + { + ProfilerResult var20 = (ProfilerResult)var3.get(var21); + String var22 = ""; + + if (var20.field_76331_c.equals("unspecified")) + { + var22 = var22 + "[?] "; + } + else + { + var22 = var22 + "[" + (var21 + 1) + "] "; + } + + var22 = var22 + var20.field_76331_c; + this.fontRenderer.drawStringWithShadow(var22, var7 - var6, var8 + var6 / 2 + var21 * 8 + 20, var20.func_76329_a()); + this.fontRenderer.drawStringWithShadow(var22 = var18.format(var20.field_76332_a) + "%", var7 + var6 - 50 - this.fontRenderer.getStringWidth(var22), var8 + var6 / 2 + var21 * 8 + 20, var20.func_76329_a()); + this.fontRenderer.drawStringWithShadow(var22 = var18.format(var20.field_76330_b) + "%", var7 + var6 - this.fontRenderer.getStringWidth(var22), var8 + var6 / 2 + var21 * 8 + 20, var20.func_76329_a()); + } + } + } + + /** + * Called when the window is closing. Sets 'running' to false which allows the game loop to exit cleanly. + */ + public void shutdown() + { + this.running = false; + } + + /** + * Will set the focus to ingame if the Minecraft window is the active with focus. Also clears any GUI screen + * currently displayed + */ + public void setIngameFocus() + { + if (Display.isActive()) + { + if (!this.inGameHasFocus) + { + this.inGameHasFocus = true; + this.mouseHelper.grabMouseCursor(); + this.displayGuiScreen((GuiScreen)null); + this.leftClickCounter = 10000; + } + } + } + + /** + * Resets the player keystate, disables the ingame focus, and ungrabs the mouse cursor. + */ + public void setIngameNotInFocus() + { + if (this.inGameHasFocus) + { + KeyBinding.unPressAllKeys(); + this.inGameHasFocus = false; + this.mouseHelper.ungrabMouseCursor(); + } + } + + /** + * Displays the ingame menu + */ + public void displayInGameMenu() + { + if (this.currentScreen == null) + { + this.displayGuiScreen(new GuiIngameMenu()); + + if (this.isSingleplayer() && !this.theIntegratedServer.getPublic()) + { + this.sndManager.pauseAllSounds(); + } + } + } + + private void sendClickBlockToController(int par1, boolean par2) + { + if (!par2) + { + this.leftClickCounter = 0; + } + + if (par1 != 0 || this.leftClickCounter <= 0) + { + if (par2 && this.objectMouseOver != null && this.objectMouseOver.typeOfHit == EnumMovingObjectType.TILE && par1 == 0) + { + int var3 = this.objectMouseOver.blockX; + int var4 = this.objectMouseOver.blockY; + int var5 = this.objectMouseOver.blockZ; + this.playerController.onPlayerDamageBlock(var3, var4, var5, this.objectMouseOver.sideHit); + + if (this.thePlayer.isCurrentToolAdventureModeExempt(var3, var4, var5)) + { + this.effectRenderer.addBlockHitEffects(var3, var4, var5, this.objectMouseOver.sideHit); + this.thePlayer.swingItem(); + } + } + else + { + this.playerController.resetBlockRemoving(); + } + } + } + + /** + * Called whenever the mouse is clicked. Button clicked is 0 for left clicking and 1 for right clicking. Args: + * buttonClicked + */ + private void clickMouse(int par1) + { + if (par1 != 0 || this.leftClickCounter <= 0) + { + if (par1 == 0) + { + this.thePlayer.swingItem(); + } + + if (par1 == 1) + { + this.rightClickDelayTimer = 4; + } + + boolean var2 = true; + ItemStack var3 = this.thePlayer.inventory.getCurrentItem(); + + if (this.objectMouseOver == null) + { + if (par1 == 0 && this.playerController.isNotCreative()) + { + this.leftClickCounter = 10; + } + } + else if (this.objectMouseOver.typeOfHit == EnumMovingObjectType.ENTITY) + { + if (par1 == 0) + { + this.playerController.attackEntity(this.thePlayer, this.objectMouseOver.entityHit); + } + + if (par1 == 1 && this.playerController.func_78768_b(this.thePlayer, this.objectMouseOver.entityHit)) + { + var2 = false; + } + } + else if (this.objectMouseOver.typeOfHit == EnumMovingObjectType.TILE) + { + int var4 = this.objectMouseOver.blockX; + int var5 = this.objectMouseOver.blockY; + int var6 = this.objectMouseOver.blockZ; + int var7 = this.objectMouseOver.sideHit; + + if (par1 == 0) + { + this.playerController.clickBlock(var4, var5, var6, this.objectMouseOver.sideHit); + } + else + { + int var8 = var3 != null ? var3.stackSize : 0; + + if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var3, var4, var5, var6, var7, this.objectMouseOver.hitVec)) + { + var2 = false; + this.thePlayer.swingItem(); + } + + if (var3 == null) + { + return; + } + + if (var3.stackSize == 0) + { + this.thePlayer.inventory.mainInventory[this.thePlayer.inventory.currentItem] = null; + } + else if (var3.stackSize != var8 || this.playerController.isInCreativeMode()) + { + this.entityRenderer.itemRenderer.resetEquippedProgress(); + } + } + } + + if (var2 && par1 == 1) + { + ItemStack var9 = this.thePlayer.inventory.getCurrentItem(); + + if (var9 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var9)) + { + this.entityRenderer.itemRenderer.resetEquippedProgress2(); + } + } + } + } + + /** + * Toggles fullscreen mode. + */ + public void toggleFullscreen() + { + try + { + this.fullscreen = !this.fullscreen; + + if (this.fullscreen) + { + this.updateDisplayMode(); + this.displayWidth = Display.getDisplayMode().getWidth(); + this.displayHeight = Display.getDisplayMode().getHeight(); + + if (this.displayWidth <= 0) + { + this.displayWidth = 1; + } + + if (this.displayHeight <= 0) + { + this.displayHeight = 1; + } + } + else + { + Display.setDisplayMode(new DisplayMode(this.tempDisplayWidth, this.tempDisplayHeight)); + this.displayWidth = this.tempDisplayWidth; + this.displayHeight = this.tempDisplayHeight; + + if (this.displayWidth <= 0) + { + this.displayWidth = 1; + } + + if (this.displayHeight <= 0) + { + this.displayHeight = 1; + } + } + + if (this.currentScreen != null) + { + this.resize(this.displayWidth, this.displayHeight); + } + + Display.setFullscreen(this.fullscreen); + Display.setVSyncEnabled(this.gameSettings.enableVsync); + Display.update(); + } + catch (Exception var2) + { + var2.printStackTrace(); + } + } + + /** + * Called to resize the current screen. + */ + private void resize(int par1, int par2) + { + this.displayWidth = par1 <= 0 ? 1 : par1; + this.displayHeight = par2 <= 0 ? 1 : par2; + + if (this.currentScreen != null) + { + ScaledResolution var3 = new ScaledResolution(this.gameSettings, par1, par2); + int var4 = var3.getScaledWidth(); + int var5 = var3.getScaledHeight(); + this.currentScreen.setWorldAndResolution(this, var4, var5); + } + } + + /** + * Runs the current tick. + */ + public void runTick() + { + if (this.rightClickDelayTimer > 0) + { + --this.rightClickDelayTimer; + } + + this.mcProfiler.startSection("stats"); + this.statFileWriter.func_77449_e(); + this.mcProfiler.endStartSection("gui"); + + if (!this.isGamePaused) + { + this.ingameGUI.updateTick(); + } + + this.mcProfiler.endStartSection("pick"); + this.entityRenderer.getMouseOver(1.0F); + this.mcProfiler.endStartSection("gameMode"); + + if (!this.isGamePaused && this.theWorld != null) + { + this.playerController.updateController(); + } + + this.mcProfiler.endStartSection("textures"); + + if (!this.isGamePaused) + { + this.renderEngine.tick(); + } + + if (this.currentScreen == null && this.thePlayer != null) + { + if (this.thePlayer.getHealth() <= 0.0F) + { + this.displayGuiScreen((GuiScreen)null); + } + else if (this.thePlayer.isPlayerSleeping() && this.theWorld != null) + { + this.displayGuiScreen(new GuiSleepMP()); + } + } + else if (this.currentScreen != null && this.currentScreen instanceof GuiSleepMP && !this.thePlayer.isPlayerSleeping()) + { + this.displayGuiScreen((GuiScreen)null); + } + + if (this.currentScreen != null) + { + this.leftClickCounter = 10000; + } + + CrashReport var2; + CrashReportCategory var3; + + if (this.currentScreen != null) + { + try + { + this.currentScreen.handleInput(); + } + catch (Throwable var6) + { + var2 = CrashReport.makeCrashReport(var6, "Updating screen events"); + var3 = var2.makeCategory("Affected screen"); + var3.addCrashSectionCallable("Screen name", new CallableUpdatingScreenName(this)); + throw new ReportedException(var2); + } + + if (this.currentScreen != null) + { + try + { + this.currentScreen.updateScreen(); + } + catch (Throwable var5) + { + var2 = CrashReport.makeCrashReport(var5, "Ticking screen"); + var3 = var2.makeCategory("Affected screen"); + var3.addCrashSectionCallable("Screen name", new CallableParticleScreenName(this)); + throw new ReportedException(var2); + } + } + } + + if (this.currentScreen == null || this.currentScreen.allowUserInput) + { + this.mcProfiler.endStartSection("mouse"); + int var1; + + while (Mouse.next()) + { + var1 = Mouse.getEventButton(); + + if (isRunningOnMac && var1 == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157))) + { + var1 = 1; + } + + KeyBinding.setKeyBindState(var1 - 100, Mouse.getEventButtonState()); + + if (Mouse.getEventButtonState()) + { + KeyBinding.onTick(var1 - 100); + } + + long var9 = getSystemTime() - this.systemTime; + + if (var9 <= 200L) + { + int var4 = Mouse.getEventDWheel(); + + if (var4 != 0) + { + this.thePlayer.inventory.changeCurrentItem(var4); + + if (this.gameSettings.noclip) + { + if (var4 > 0) + { + var4 = 1; + } + + if (var4 < 0) + { + var4 = -1; + } + + this.gameSettings.noclipRate += (float)var4 * 0.25F; + } + } + + if (this.currentScreen == null) + { + if (!this.inGameHasFocus && Mouse.getEventButtonState()) + { + this.setIngameFocus(); + } + } + else if (this.currentScreen != null) + { + this.currentScreen.handleMouseInput(); + } + } + } + + if (this.leftClickCounter > 0) + { + --this.leftClickCounter; + } + + this.mcProfiler.endStartSection("keyboard"); + boolean var8; + + while (Keyboard.next()) + { + KeyBinding.setKeyBindState(Keyboard.getEventKey(), Keyboard.getEventKeyState()); + + if (Keyboard.getEventKeyState()) + { + KeyBinding.onTick(Keyboard.getEventKey()); + } + + if (this.field_83002_am > 0L) + { + if (getSystemTime() - this.field_83002_am >= 6000L) + { + throw new ReportedException(new CrashReport("Manually triggered debug crash", new Throwable())); + } + + if (!Keyboard.isKeyDown(46) || !Keyboard.isKeyDown(61)) + { + this.field_83002_am = -1L; + } + } + else if (Keyboard.isKeyDown(46) && Keyboard.isKeyDown(61)) + { + this.field_83002_am = getSystemTime(); + } + + if (Keyboard.getEventKeyState()) + { + if (Keyboard.getEventKey() == 87) + { + this.toggleFullscreen(); + } + else + { + if (this.currentScreen != null) + { + this.currentScreen.handleKeyboardInput(); + } + else + { + if (Keyboard.getEventKey() == 1) + { + this.displayInGameMenu(); + } + + if (Keyboard.getEventKey() == 31 && Keyboard.isKeyDown(61)) + { + this.refreshResources(); + } + + if (Keyboard.getEventKey() == 20 && Keyboard.isKeyDown(61)) + { + this.refreshResources(); + } + + if (Keyboard.getEventKey() == 33 && Keyboard.isKeyDown(61)) + { + var8 = Keyboard.isKeyDown(42) | Keyboard.isKeyDown(54); + this.gameSettings.setOptionValue(EnumOptions.RENDER_DISTANCE, var8 ? -1 : 1); + } + + if (Keyboard.getEventKey() == 30 && Keyboard.isKeyDown(61)) + { + this.renderGlobal.loadRenderers(); + } + + if (Keyboard.getEventKey() == 35 && Keyboard.isKeyDown(61)) + { + this.gameSettings.advancedItemTooltips = !this.gameSettings.advancedItemTooltips; + this.gameSettings.saveOptions(); + } + + if (Keyboard.getEventKey() == 48 && Keyboard.isKeyDown(61)) + { + RenderManager.field_85095_o = !RenderManager.field_85095_o; + } + + if (Keyboard.getEventKey() == 25 && Keyboard.isKeyDown(61)) + { + this.gameSettings.pauseOnLostFocus = !this.gameSettings.pauseOnLostFocus; + this.gameSettings.saveOptions(); + } + + if (Keyboard.getEventKey() == 59) + { + this.gameSettings.hideGUI = !this.gameSettings.hideGUI; + } + + if (Keyboard.getEventKey() == 61) + { + this.gameSettings.showDebugInfo = !this.gameSettings.showDebugInfo; + this.gameSettings.showDebugProfilerChart = GuiScreen.isShiftKeyDown(); + } + + if (Keyboard.getEventKey() == 63) + { + ++this.gameSettings.thirdPersonView; + + if (this.gameSettings.thirdPersonView > 2) + { + this.gameSettings.thirdPersonView = 0; + } + } + + if (Keyboard.getEventKey() == 66) + { + this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera; + } + } + + for (var1 = 0; var1 < 9; ++var1) + { + if (Keyboard.getEventKey() == 2 + var1) + { + this.thePlayer.inventory.currentItem = var1; + } + } + + if (this.gameSettings.showDebugInfo && this.gameSettings.showDebugProfilerChart) + { + if (Keyboard.getEventKey() == 11) + { + this.updateDebugProfilerName(0); + } + + for (var1 = 0; var1 < 9; ++var1) + { + if (Keyboard.getEventKey() == 2 + var1) + { + this.updateDebugProfilerName(var1 + 1); + } + } + } + } + } + } + + var8 = this.gameSettings.chatVisibility != 2; + + while (this.gameSettings.keyBindInventory.isPressed()) + { + if (this.playerController.func_110738_j()) + { + this.thePlayer.func_110322_i(); + } + else + { + this.displayGuiScreen(new GuiInventory(this.thePlayer)); + } + } + + while (this.gameSettings.keyBindDrop.isPressed()) + { + this.thePlayer.dropOneItem(GuiScreen.isCtrlKeyDown()); + } + + while (this.gameSettings.keyBindChat.isPressed() && var8) + { + this.displayGuiScreen(new GuiChat()); + } + + if (this.currentScreen == null && this.gameSettings.keyBindCommand.isPressed() && var8) + { + this.displayGuiScreen(new GuiChat("/")); + } + + if (this.thePlayer.isUsingItem()) + { + if (!this.gameSettings.keyBindUseItem.pressed) + { + this.playerController.onStoppedUsingItem(this.thePlayer); + } + + label381: + + while (true) + { + if (!this.gameSettings.keyBindAttack.isPressed()) + { + while (this.gameSettings.keyBindUseItem.isPressed()) + { + ; + } + + while (true) + { + if (this.gameSettings.keyBindPickBlock.isPressed()) + { + continue; + } + + break label381; + } + } + } + } + else + { + while (this.gameSettings.keyBindAttack.isPressed()) + { + this.clickMouse(0); + } + + while (this.gameSettings.keyBindUseItem.isPressed()) + { + this.clickMouse(1); + } + + while (this.gameSettings.keyBindPickBlock.isPressed()) + { + this.clickMiddleMouseButton(); + } + } + + if (this.gameSettings.keyBindUseItem.pressed && this.rightClickDelayTimer == 0 && !this.thePlayer.isUsingItem()) + { + this.clickMouse(1); + } + + this.sendClickBlockToController(0, this.currentScreen == null && this.gameSettings.keyBindAttack.pressed && this.inGameHasFocus); + } + + if (this.theWorld != null) + { + if (this.thePlayer != null) + { + ++this.joinPlayerCounter; + + if (this.joinPlayerCounter == 30) + { + this.joinPlayerCounter = 0; + this.theWorld.joinEntityInSurroundings(this.thePlayer); + } + } + + this.mcProfiler.endStartSection("gameRenderer"); + + if (!this.isGamePaused) + { + this.entityRenderer.updateRenderer(); + } + + this.mcProfiler.endStartSection("levelRenderer"); + + if (!this.isGamePaused) + { + this.renderGlobal.updateClouds(); + } + + this.mcProfiler.endStartSection("level"); + + if (!this.isGamePaused) + { + if (this.theWorld.lastLightningBolt > 0) + { + --this.theWorld.lastLightningBolt; + } + + this.theWorld.updateEntities(); + } + + if (!this.isGamePaused) + { + this.theWorld.setAllowedSpawnTypes(this.theWorld.difficultySetting > 0, true); + + try + { + this.theWorld.tick(); + } + catch (Throwable var7) + { + var2 = CrashReport.makeCrashReport(var7, "Exception in world tick"); + + if (this.theWorld == null) + { + var3 = var2.makeCategory("Affected level"); + var3.addCrashSection("Problem", "Level is null!"); + } + else + { + this.theWorld.addWorldInfoToCrashReport(var2); + } + + throw new ReportedException(var2); + } + } + + this.mcProfiler.endStartSection("animateTick"); + + if (!this.isGamePaused && this.theWorld != null) + { + this.theWorld.doVoidFogParticles(MathHelper.floor_double(this.thePlayer.posX), MathHelper.floor_double(this.thePlayer.posY), MathHelper.floor_double(this.thePlayer.posZ)); + } + + this.mcProfiler.endStartSection("particles"); + + if (!this.isGamePaused) + { + this.effectRenderer.updateEffects(); + } + } + else if (this.myNetworkManager != null) + { + this.mcProfiler.endStartSection("pendingConnection"); + this.myNetworkManager.processReadPackets(); + } + + this.mcProfiler.endSection(); + this.systemTime = getSystemTime(); + } + + /** + * Arguments: World foldername, World ingame name, WorldSettings + */ + public void launchIntegratedServer(String par1Str, String par2Str, WorldSettings par3WorldSettings) + { + this.loadWorld((WorldClient)null); + System.gc(); + ISaveHandler var4 = this.saveLoader.getSaveLoader(par1Str, false); + WorldInfo var5 = var4.loadWorldInfo(); + + if (var5 == null && par3WorldSettings != null) + { + var5 = new WorldInfo(par3WorldSettings, par1Str); + var4.saveWorldInfo(var5); + } + + if (par3WorldSettings == null) + { + par3WorldSettings = new WorldSettings(var5); + } + + this.statFileWriter.readStat(StatList.startGameStat, 1); + this.theIntegratedServer = new IntegratedServer(this, par1Str, par2Str, par3WorldSettings); + this.theIntegratedServer.startServerThread(); + this.integratedServerIsRunning = true; + this.loadingScreen.displayProgressMessage(I18n.getString("menu.loadingLevel")); + + while (!this.theIntegratedServer.serverIsInRunLoop()) + { + String var6 = this.theIntegratedServer.getUserMessage(); + + if (var6 != null) + { + this.loadingScreen.resetProgresAndWorkingMessage(I18n.getString(var6)); + } + else + { + this.loadingScreen.resetProgresAndWorkingMessage(""); + } + + try + { + Thread.sleep(200L); + } + catch (InterruptedException var9) + { + ; + } + } + + this.displayGuiScreen((GuiScreen)null); + + try + { + NetClientHandler var10 = new NetClientHandler(this, this.theIntegratedServer); + this.myNetworkManager = var10.getNetManager(); + } + catch (IOException var8) + { + this.displayCrashReport(this.addGraphicsAndWorldToCrashReport(new CrashReport("Connecting to integrated server", var8))); + } + } + + /** + * unloads the current world first + */ + public void loadWorld(WorldClient par1WorldClient) + { + this.loadWorld(par1WorldClient, ""); + } + + /** + * par2Str is displayed on the loading screen to the user unloads the current world first + */ + public void loadWorld(WorldClient par1WorldClient, String par2Str) + { + this.statFileWriter.syncStats(); + + if (par1WorldClient == null) + { + NetClientHandler var3 = this.getNetHandler(); + + if (var3 != null) + { + var3.cleanup(); + } + + if (this.myNetworkManager != null) + { + this.myNetworkManager.closeConnections(); + } + + if (this.theIntegratedServer != null) + { + this.theIntegratedServer.initiateShutdown(); + } + + this.theIntegratedServer = null; + } + + this.renderViewEntity = null; + this.myNetworkManager = null; + + if (this.loadingScreen != null) + { + this.loadingScreen.resetProgressAndMessage(par2Str); + this.loadingScreen.resetProgresAndWorkingMessage(""); + } + + if (par1WorldClient == null && this.theWorld != null) + { + this.setServerData((ServerData)null); + this.integratedServerIsRunning = false; + } + + this.sndManager.playStreaming((String)null, 0.0F, 0.0F, 0.0F); + this.sndManager.stopAllSounds(); + this.theWorld = par1WorldClient; + + if (par1WorldClient != null) + { + if (this.renderGlobal != null) + { + this.renderGlobal.setWorldAndLoadRenderers(par1WorldClient); + } + + if (this.effectRenderer != null) + { + this.effectRenderer.clearEffects(par1WorldClient); + } + + if (this.thePlayer == null) + { + this.thePlayer = this.playerController.func_78754_a(par1WorldClient); + this.playerController.flipPlayer(this.thePlayer); + } + + this.thePlayer.preparePlayerToSpawn(); + par1WorldClient.spawnEntityInWorld(this.thePlayer); + this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); + this.playerController.setPlayerCapabilities(this.thePlayer); + this.renderViewEntity = this.thePlayer; + } + else + { + this.saveLoader.flushCache(); + this.thePlayer = null; + } + + System.gc(); + this.systemTime = 0L; + } + + /** + * A String of renderGlobal.getDebugInfoRenders + */ + public String debugInfoRenders() + { + return this.renderGlobal.getDebugInfoRenders(); + } + + /** + * Gets the information in the F3 menu about how many entities are infront/around you + */ + public String getEntityDebug() + { + return this.renderGlobal.getDebugInfoEntities(); + } + + /** + * Gets the name of the world's current chunk provider + */ + public String getWorldProviderName() + { + return this.theWorld.getProviderName(); + } + + /** + * A String of how many entities are in the world + */ + public String debugInfoEntities() + { + return "P: " + this.effectRenderer.getStatistics() + ". T: " + this.theWorld.getDebugLoadedEntities(); + } + + public void setDimensionAndSpawnPlayer(int par1) + { + this.theWorld.setSpawnLocation(); + this.theWorld.removeAllEntities(); + int var2 = 0; + String var3 = null; + + if (this.thePlayer != null) + { + var2 = this.thePlayer.entityId; + this.theWorld.removeEntity(this.thePlayer); + var3 = this.thePlayer.func_142021_k(); + } + + this.renderViewEntity = null; + this.thePlayer = this.playerController.func_78754_a(this.theWorld); + this.thePlayer.dimension = par1; + this.renderViewEntity = this.thePlayer; + this.thePlayer.preparePlayerToSpawn(); + this.thePlayer.func_142020_c(var3); + this.theWorld.spawnEntityInWorld(this.thePlayer); + this.playerController.flipPlayer(this.thePlayer); + this.thePlayer.movementInput = new MovementInputFromOptions(this.gameSettings); + this.thePlayer.entityId = var2; + this.playerController.setPlayerCapabilities(this.thePlayer); + + if (this.currentScreen instanceof GuiGameOver) + { + this.displayGuiScreen((GuiScreen)null); + } + } + + /** + * Gets whether this is a demo or not. + */ + public final boolean isDemo() + { + return this.isDemo; + } + + /** + * Returns the NetClientHandler. + */ + public NetClientHandler getNetHandler() + { + return this.thePlayer != null ? this.thePlayer.sendQueue : null; + } + + public static boolean isGuiEnabled() + { + return theMinecraft == null || !theMinecraft.gameSettings.hideGUI; + } + + public static boolean isFancyGraphicsEnabled() + { + return theMinecraft != null && theMinecraft.gameSettings.fancyGraphics; + } + + /** + * Returns if ambient occlusion is enabled + */ + public static boolean isAmbientOcclusionEnabled() + { + return theMinecraft != null && theMinecraft.gameSettings.ambientOcclusion != 0; + } + + /** + * Returns true if the message is a client command and should not be sent to the server. However there are no such + * commands at this point in time. + */ + public boolean handleClientCommand(String par1Str) + { + return false; + } + + /** + * Called when the middle mouse button gets clicked + */ + private void clickMiddleMouseButton() + { + if (this.objectMouseOver != null) + { + boolean var1 = this.thePlayer.capabilities.isCreativeMode; + int var3 = 0; + boolean var4 = false; + int var2; + int var5; + + if (this.objectMouseOver.typeOfHit == EnumMovingObjectType.TILE) + { + var5 = this.objectMouseOver.blockX; + int var6 = this.objectMouseOver.blockY; + int var7 = this.objectMouseOver.blockZ; + Block var8 = Block.blocksList[this.theWorld.getBlockId(var5, var6, var7)]; + + if (var8 == null) + { + return; + } + + var2 = var8.idPicked(this.theWorld, var5, var6, var7); + + if (var2 == 0) + { + return; + } + + var4 = Item.itemsList[var2].getHasSubtypes(); + int var9 = var2 < 256 && !Block.blocksList[var8.blockID].isFlowerPot() ? var2 : var8.blockID; + var3 = Block.blocksList[var9].getDamageValue(this.theWorld, var5, var6, var7); + } + else + { + if (this.objectMouseOver.typeOfHit != EnumMovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !var1) + { + return; + } + + if (this.objectMouseOver.entityHit instanceof EntityPainting) + { + var2 = Item.painting.itemID; + } + else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot) + { + var2 = Item.leash.itemID; + } + else if (this.objectMouseOver.entityHit instanceof EntityItemFrame) + { + EntityItemFrame var10 = (EntityItemFrame)this.objectMouseOver.entityHit; + + if (var10.getDisplayedItem() == null) + { + var2 = Item.itemFrame.itemID; + } + else + { + var2 = var10.getDisplayedItem().itemID; + var3 = var10.getDisplayedItem().getItemDamage(); + var4 = true; + } + } + else if (this.objectMouseOver.entityHit instanceof EntityMinecart) + { + EntityMinecart var11 = (EntityMinecart)this.objectMouseOver.entityHit; + + if (var11.getMinecartType() == 2) + { + var2 = Item.minecartPowered.itemID; + } + else if (var11.getMinecartType() == 1) + { + var2 = Item.minecartCrate.itemID; + } + else if (var11.getMinecartType() == 3) + { + var2 = Item.minecartTnt.itemID; + } + else if (var11.getMinecartType() == 5) + { + var2 = Item.minecartHopper.itemID; + } + else + { + var2 = Item.minecartEmpty.itemID; + } + } + else if (this.objectMouseOver.entityHit instanceof EntityBoat) + { + var2 = Item.boat.itemID; + } + else + { + var2 = Item.monsterPlacer.itemID; + var3 = EntityList.getEntityID(this.objectMouseOver.entityHit); + var4 = true; + + if (var3 <= 0 || !EntityList.entityEggs.containsKey(Integer.valueOf(var3))) + { + return; + } + } + } + + this.thePlayer.inventory.setCurrentItem(var2, var3, var4, var1); + + if (var1) + { + var5 = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + this.thePlayer.inventory.currentItem; + this.playerController.sendSlotPacket(this.thePlayer.inventory.getStackInSlot(this.thePlayer.inventory.currentItem), var5); + } + } + } + + /** + * adds core server Info (GL version , Texture pack, isModded, type), and the worldInfo to the crash report + */ + public CrashReport addGraphicsAndWorldToCrashReport(CrashReport par1CrashReport) + { + par1CrashReport.getCategory().addCrashSectionCallable("Launched Version", new CallableLaunchedVersion(this)); + par1CrashReport.getCategory().addCrashSectionCallable("LWJGL", new CallableLWJGLVersion(this)); + par1CrashReport.getCategory().addCrashSectionCallable("OpenGL", new CallableGLInfo(this)); + par1CrashReport.getCategory().addCrashSectionCallable("Is Modded", new CallableModded(this)); + par1CrashReport.getCategory().addCrashSectionCallable("Type", new CallableType2(this)); + par1CrashReport.getCategory().addCrashSectionCallable("Resource Pack", new CallableTexturePack(this)); + par1CrashReport.getCategory().addCrashSectionCallable("Current Language", new CallableClientProfiler(this)); + par1CrashReport.getCategory().addCrashSectionCallable("Profiler Position", new CallableClientMemoryStats(this)); + par1CrashReport.getCategory().addCrashSectionCallable("Vec3 Pool Size", new MinecraftINNER13(this)); + + if (this.theWorld != null) + { + this.theWorld.addWorldInfoToCrashReport(par1CrashReport); + } + + return par1CrashReport; + } + + /** + * Return the singleton Minecraft instance for the game + */ + public static Minecraft getMinecraft() + { + return theMinecraft; + } + + public void addServerStatsToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper) + { + par1PlayerUsageSnooper.addData("fps", Integer.valueOf(debugFPS)); + par1PlayerUsageSnooper.addData("texpack_name", this.mcResourcePackRepository.getResourcePackName()); + par1PlayerUsageSnooper.addData("vsync_enabled", Boolean.valueOf(this.gameSettings.enableVsync)); + par1PlayerUsageSnooper.addData("display_frequency", Integer.valueOf(Display.getDisplayMode().getFrequency())); + par1PlayerUsageSnooper.addData("display_type", this.fullscreen ? "fullscreen" : "windowed"); + par1PlayerUsageSnooper.addData("run_time", Long.valueOf((MinecraftServer.getSystemTimeMillis() - par1PlayerUsageSnooper.func_130105_g()) / 60L * 1000L)); + + if (this.theIntegratedServer != null && this.theIntegratedServer.getPlayerUsageSnooper() != null) + { + par1PlayerUsageSnooper.addData("snooper_partner", this.theIntegratedServer.getPlayerUsageSnooper().getUniqueID()); + } + } + + public void addServerTypeToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper) + { + par1PlayerUsageSnooper.addData("opengl_version", GL11.glGetString(GL11.GL_VERSION)); + par1PlayerUsageSnooper.addData("opengl_vendor", GL11.glGetString(GL11.GL_VENDOR)); + par1PlayerUsageSnooper.addData("client_brand", ClientBrandRetriever.getClientModName()); + par1PlayerUsageSnooper.addData("launched_version", this.launchedVersion); + ContextCapabilities var2 = GLContext.getCapabilities(); + par1PlayerUsageSnooper.addData("gl_caps[ARB_multitexture]", Boolean.valueOf(var2.GL_ARB_multitexture)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_multisample]", Boolean.valueOf(var2.GL_ARB_multisample)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_texture_cube_map]", Boolean.valueOf(var2.GL_ARB_texture_cube_map)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_blend]", Boolean.valueOf(var2.GL_ARB_vertex_blend)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_matrix_palette]", Boolean.valueOf(var2.GL_ARB_matrix_palette)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_program]", Boolean.valueOf(var2.GL_ARB_vertex_program)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_shader]", Boolean.valueOf(var2.GL_ARB_vertex_shader)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_fragment_program]", Boolean.valueOf(var2.GL_ARB_fragment_program)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_fragment_shader]", Boolean.valueOf(var2.GL_ARB_fragment_shader)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_shader_objects]", Boolean.valueOf(var2.GL_ARB_shader_objects)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_buffer_object]", Boolean.valueOf(var2.GL_ARB_vertex_buffer_object)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_framebuffer_object]", Boolean.valueOf(var2.GL_ARB_framebuffer_object)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_pixel_buffer_object]", Boolean.valueOf(var2.GL_ARB_pixel_buffer_object)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_uniform_buffer_object]", Boolean.valueOf(var2.GL_ARB_uniform_buffer_object)); + par1PlayerUsageSnooper.addData("gl_caps[ARB_texture_non_power_of_two]", Boolean.valueOf(var2.GL_ARB_texture_non_power_of_two)); + par1PlayerUsageSnooper.addData("gl_caps[gl_max_vertex_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_UNIFORM_COMPONENTS))); + par1PlayerUsageSnooper.addData("gl_caps[gl_max_fragment_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS))); + par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); + } + + /** + * Used in the usage snooper. + */ + public static int getGLMaximumTextureSize() + { + for (int var0 = 16384; var0 > 0; var0 >>= 1) + { + GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, var0, var0, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); + int var1 = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH); + + if (var1 != 0) + { + return var0; + } + } + + return -1; + } + + /** + * Returns whether snooping is enabled or not. + */ + public boolean isSnooperEnabled() + { + return this.gameSettings.snooperEnabled; + } + + /** + * Set the current ServerData instance. + */ + public void setServerData(ServerData par1ServerData) + { + this.currentServerData = par1ServerData; + } + + public boolean isIntegratedServerRunning() + { + return this.integratedServerIsRunning; + } + + /** + * Returns true if there is only one player playing, and the current server is the integrated one. + */ + public boolean isSingleplayer() + { + return this.integratedServerIsRunning && this.theIntegratedServer != null; + } + + /** + * Returns the currently running integrated server + */ + public IntegratedServer getIntegratedServer() + { + return this.theIntegratedServer; + } + + public static void stopIntegratedServer() + { + if (theMinecraft != null) + { + IntegratedServer var0 = theMinecraft.getIntegratedServer(); + + if (var0 != null) + { + var0.stopServer(); + } + } + } + + /** + * Returns the PlayerUsageSnooper instance. + */ + public PlayerUsageSnooper getPlayerUsageSnooper() + { + return this.usageSnooper; + } + + /** + * Gets the system time in milliseconds. + */ + public static long getSystemTime() + { + return Sys.getTime() * 1000L / Sys.getTimerResolution(); + } + + /** + * Returns whether we're in full screen or not. + */ + public boolean isFullScreen() + { + return this.fullscreen; + } + + public ILogAgent getLogAgent() + { + return this.mcLogAgent; + } + + public Session getSession() + { + return this.session; + } + + public Proxy getProxy() + { + return this.proxy; + } + + public TextureManager getTextureManager() + { + return this.renderEngine; + } + + public ResourceManager getResourceManager() + { + return this.mcResourceManager; + } + + public ResourcePackRepository getResourcePackRepository() + { + return this.mcResourcePackRepository; + } + + public LanguageManager getLanguageManager() + { + return this.mcLanguageManager; + } + + static String getLaunchedVersion(Minecraft par0Minecraft) + { + return par0Minecraft.launchedVersion; + } + + static LanguageManager func_142024_b(Minecraft par0Minecraft) + { + return par0Minecraft.mcLanguageManager; + } +} diff --git a/src/main/java/net/minecraft/src/MinecraftError.java b/src/main/java/net/minecraft/src/MinecraftError.java new file mode 100644 index 0000000..21e2ce0 --- /dev/null +++ b/src/main/java/net/minecraft/src/MinecraftError.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public class MinecraftError extends Error +{ +} diff --git a/src/main/java/net/minecraft/src/MinecraftException.java b/src/main/java/net/minecraft/src/MinecraftException.java new file mode 100644 index 0000000..7e30d97 --- /dev/null +++ b/src/main/java/net/minecraft/src/MinecraftException.java @@ -0,0 +1,9 @@ +package net.minecraft.src; + +public class MinecraftException extends Exception +{ + public MinecraftException(String par1Str) + { + super(par1Str); + } +} diff --git a/src/main/java/net/minecraft/src/MinecraftINNER13.java b/src/main/java/net/minecraft/src/MinecraftINNER13.java new file mode 100644 index 0000000..a28a4ac --- /dev/null +++ b/src/main/java/net/minecraft/src/MinecraftINNER13.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import java.util.concurrent.Callable; + +class MinecraftINNER13 implements Callable +{ + final Minecraft field_142056_a; + + MinecraftINNER13(Minecraft par1Minecraft) + { + this.field_142056_a = par1Minecraft; + } + + public String func_142055_a() + { + int var1 = this.field_142056_a.theWorld.getWorldVec3Pool().getPoolSize(); + int var2 = 56 * var1; + int var3 = var2 / 1024 / 1024; + int var4 = this.field_142056_a.theWorld.getWorldVec3Pool().func_82590_d(); + int var5 = 56 * var4; + int var6 = var5 / 1024 / 1024; + return var1 + " (" + var2 + " bytes; " + var3 + " MB) allocated, " + var4 + " (" + var5 + " bytes; " + var6 + " MB) used"; + } + + public Object call() + { + return this.func_142055_a(); + } +} diff --git a/src/main/java/net/minecraft/src/MobSpawnerBaseLogic.java b/src/main/java/net/minecraft/src/MobSpawnerBaseLogic.java new file mode 100644 index 0000000..dc962e9 --- /dev/null +++ b/src/main/java/net/minecraft/src/MobSpawnerBaseLogic.java @@ -0,0 +1,369 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public abstract class MobSpawnerBaseLogic +{ + /** The delay to spawn. */ + public int spawnDelay = 20; + private String mobID = "Pig"; + + /** List of minecart to spawn. */ + private List minecartToSpawn; + private WeightedRandomMinecart randomMinecart; + public double field_98287_c; + public double field_98284_d; + private int minSpawnDelay = 200; + private int maxSpawnDelay = 800; + + /** A counter for spawn tries. */ + private int spawnCount = 4; + private Entity field_98291_j; + private int maxNearbyEntities = 6; + + /** The distance from which a player activates the spawner. */ + private int activatingRangeFromPlayer = 16; + + /** The range coefficient for spawning entities around. */ + private int spawnRange = 4; + + /** + * Gets the entity name that should be spawned. + */ + public String getEntityNameToSpawn() + { + if (this.getRandomMinecart() == null) + { + if (this.mobID.equals("Minecart")) + { + this.mobID = "MinecartRideable"; + } + + return this.mobID; + } + else + { + return this.getRandomMinecart().minecartName; + } + } + + public void setMobID(String par1Str) + { + this.mobID = par1Str; + } + + /** + * Returns true if there's a player close enough to this mob spawner to activate it. + */ + public boolean canRun() + { + return this.getSpawnerWorld().getClosestPlayer((double)this.getSpawnerX() + 0.5D, (double)this.getSpawnerY() + 0.5D, (double)this.getSpawnerZ() + 0.5D, (double)this.activatingRangeFromPlayer) != null; + } + + public void updateSpawner() + { + if (this.canRun()) + { + double var5; + + if (this.getSpawnerWorld().isRemote) + { + double var1 = (double)((float)this.getSpawnerX() + this.getSpawnerWorld().rand.nextFloat()); + double var3 = (double)((float)this.getSpawnerY() + this.getSpawnerWorld().rand.nextFloat()); + var5 = (double)((float)this.getSpawnerZ() + this.getSpawnerWorld().rand.nextFloat()); + this.getSpawnerWorld().spawnParticle("smoke", var1, var3, var5, 0.0D, 0.0D, 0.0D); + this.getSpawnerWorld().spawnParticle("flame", var1, var3, var5, 0.0D, 0.0D, 0.0D); + + if (this.spawnDelay > 0) + { + --this.spawnDelay; + } + + this.field_98284_d = this.field_98287_c; + this.field_98287_c = (this.field_98287_c + (double)(1000.0F / ((float)this.spawnDelay + 200.0F))) % 360.0D; + } + else + { + if (this.spawnDelay == -1) + { + this.func_98273_j(); + } + + if (this.spawnDelay > 0) + { + --this.spawnDelay; + return; + } + + boolean var12 = false; + + for (int var2 = 0; var2 < this.spawnCount; ++var2) + { + Entity var13 = EntityList.createEntityByName(this.getEntityNameToSpawn(), this.getSpawnerWorld()); + + if (var13 == null) + { + return; + } + + int var4 = this.getSpawnerWorld().getEntitiesWithinAABB(var13.getClass(), AxisAlignedBB.getAABBPool().getAABB((double)this.getSpawnerX(), (double)this.getSpawnerY(), (double)this.getSpawnerZ(), (double)(this.getSpawnerX() + 1), (double)(this.getSpawnerY() + 1), (double)(this.getSpawnerZ() + 1)).expand((double)(this.spawnRange * 2), 4.0D, (double)(this.spawnRange * 2))).size(); + + if (var4 >= this.maxNearbyEntities) + { + this.func_98273_j(); + return; + } + + var5 = (double)this.getSpawnerX() + (this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double)this.spawnRange; + double var7 = (double)(this.getSpawnerY() + this.getSpawnerWorld().rand.nextInt(3) - 1); + double var9 = (double)this.getSpawnerZ() + (this.getSpawnerWorld().rand.nextDouble() - this.getSpawnerWorld().rand.nextDouble()) * (double)this.spawnRange; + EntityLiving var11 = var13 instanceof EntityLiving ? (EntityLiving)var13 : null; + var13.setLocationAndAngles(var5, var7, var9, this.getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F); + + if (var11 == null || var11.getCanSpawnHere()) + { + this.func_98265_a(var13); + this.getSpawnerWorld().playAuxSFX(2004, this.getSpawnerX(), this.getSpawnerY(), this.getSpawnerZ(), 0); + + if (var11 != null) + { + var11.spawnExplosionParticle(); + } + + var12 = true; + } + } + + if (var12) + { + this.func_98273_j(); + } + } + } + } + + public Entity func_98265_a(Entity par1Entity) + { + if (this.getRandomMinecart() != null) + { + NBTTagCompound var2 = new NBTTagCompound(); + par1Entity.writeToNBTOptional(var2); + Iterator var3 = this.getRandomMinecart().field_98222_b.getTags().iterator(); + + while (var3.hasNext()) + { + NBTBase var4 = (NBTBase)var3.next(); + var2.setTag(var4.getName(), var4.copy()); + } + + par1Entity.readFromNBT(var2); + + if (par1Entity.worldObj != null) + { + par1Entity.worldObj.spawnEntityInWorld(par1Entity); + } + + NBTTagCompound var10; + + for (Entity var9 = par1Entity; var2.hasKey("Riding"); var2 = var10) + { + var10 = var2.getCompoundTag("Riding"); + Entity var5 = EntityList.createEntityByName(var10.getString("id"), par1Entity.worldObj); + + if (var5 != null) + { + NBTTagCompound var6 = new NBTTagCompound(); + var5.writeToNBTOptional(var6); + Iterator var7 = var10.getTags().iterator(); + + while (var7.hasNext()) + { + NBTBase var8 = (NBTBase)var7.next(); + var6.setTag(var8.getName(), var8.copy()); + } + + var5.readFromNBT(var6); + var5.setLocationAndAngles(var9.posX, var9.posY, var9.posZ, var9.rotationYaw, var9.rotationPitch); + + if (par1Entity.worldObj != null) + { + par1Entity.worldObj.spawnEntityInWorld(var5); + } + + var9.mountEntity(var5); + } + + var9 = var5; + } + } + else if (par1Entity instanceof EntityLivingBase && par1Entity.worldObj != null) + { + ((EntityLiving)par1Entity).onSpawnWithEgg((EntityLivingData)null); + this.getSpawnerWorld().spawnEntityInWorld(par1Entity); + } + + return par1Entity; + } + + private void func_98273_j() + { + if (this.maxSpawnDelay <= this.minSpawnDelay) + { + this.spawnDelay = this.minSpawnDelay; + } + else + { + int var10003 = this.maxSpawnDelay - this.minSpawnDelay; + this.spawnDelay = this.minSpawnDelay + this.getSpawnerWorld().rand.nextInt(var10003); + } + + if (this.minecartToSpawn != null && this.minecartToSpawn.size() > 0) + { + this.setRandomMinecart((WeightedRandomMinecart)WeightedRandom.getRandomItem(this.getSpawnerWorld().rand, this.minecartToSpawn)); + } + + this.func_98267_a(1); + } + + public void readFromNBT(NBTTagCompound par1NBTTagCompound) + { + this.mobID = par1NBTTagCompound.getString("EntityId"); + this.spawnDelay = par1NBTTagCompound.getShort("Delay"); + + if (par1NBTTagCompound.hasKey("SpawnPotentials")) + { + this.minecartToSpawn = new ArrayList(); + NBTTagList var2 = par1NBTTagCompound.getTagList("SpawnPotentials"); + + for (int var3 = 0; var3 < var2.tagCount(); ++var3) + { + this.minecartToSpawn.add(new WeightedRandomMinecart(this, (NBTTagCompound)var2.tagAt(var3))); + } + } + else + { + this.minecartToSpawn = null; + } + + if (par1NBTTagCompound.hasKey("SpawnData")) + { + this.setRandomMinecart(new WeightedRandomMinecart(this, par1NBTTagCompound.getCompoundTag("SpawnData"), this.mobID)); + } + else + { + this.setRandomMinecart((WeightedRandomMinecart)null); + } + + if (par1NBTTagCompound.hasKey("MinSpawnDelay")) + { + this.minSpawnDelay = par1NBTTagCompound.getShort("MinSpawnDelay"); + this.maxSpawnDelay = par1NBTTagCompound.getShort("MaxSpawnDelay"); + this.spawnCount = par1NBTTagCompound.getShort("SpawnCount"); + } + + if (par1NBTTagCompound.hasKey("MaxNearbyEntities")) + { + this.maxNearbyEntities = par1NBTTagCompound.getShort("MaxNearbyEntities"); + this.activatingRangeFromPlayer = par1NBTTagCompound.getShort("RequiredPlayerRange"); + } + + if (par1NBTTagCompound.hasKey("SpawnRange")) + { + this.spawnRange = par1NBTTagCompound.getShort("SpawnRange"); + } + + if (this.getSpawnerWorld() != null && this.getSpawnerWorld().isRemote) + { + this.field_98291_j = null; + } + } + + public void writeToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setString("EntityId", this.getEntityNameToSpawn()); + par1NBTTagCompound.setShort("Delay", (short)this.spawnDelay); + par1NBTTagCompound.setShort("MinSpawnDelay", (short)this.minSpawnDelay); + par1NBTTagCompound.setShort("MaxSpawnDelay", (short)this.maxSpawnDelay); + par1NBTTagCompound.setShort("SpawnCount", (short)this.spawnCount); + par1NBTTagCompound.setShort("MaxNearbyEntities", (short)this.maxNearbyEntities); + par1NBTTagCompound.setShort("RequiredPlayerRange", (short)this.activatingRangeFromPlayer); + par1NBTTagCompound.setShort("SpawnRange", (short)this.spawnRange); + + if (this.getRandomMinecart() != null) + { + par1NBTTagCompound.setCompoundTag("SpawnData", (NBTTagCompound)this.getRandomMinecart().field_98222_b.copy()); + } + + if (this.getRandomMinecart() != null || this.minecartToSpawn != null && this.minecartToSpawn.size() > 0) + { + NBTTagList var2 = new NBTTagList(); + + if (this.minecartToSpawn != null && this.minecartToSpawn.size() > 0) + { + Iterator var3 = this.minecartToSpawn.iterator(); + + while (var3.hasNext()) + { + WeightedRandomMinecart var4 = (WeightedRandomMinecart)var3.next(); + var2.appendTag(var4.func_98220_a()); + } + } + else + { + var2.appendTag(this.getRandomMinecart().func_98220_a()); + } + + par1NBTTagCompound.setTag("SpawnPotentials", var2); + } + } + + public Entity func_98281_h() + { + if (this.field_98291_j == null) + { + Entity var1 = EntityList.createEntityByName(this.getEntityNameToSpawn(), (World)null); + var1 = this.func_98265_a(var1); + this.field_98291_j = var1; + } + + return this.field_98291_j; + } + + /** + * Sets the delay to minDelay if parameter given is 1, else return false. + */ + public boolean setDelayToMin(int par1) + { + if (par1 == 1 && this.getSpawnerWorld().isRemote) + { + this.spawnDelay = this.minSpawnDelay; + return true; + } + else + { + return false; + } + } + + public WeightedRandomMinecart getRandomMinecart() + { + return this.randomMinecart; + } + + public void setRandomMinecart(WeightedRandomMinecart par1WeightedRandomMinecart) + { + this.randomMinecart = par1WeightedRandomMinecart; + } + + public abstract void func_98267_a(int var1); + + public abstract World getSpawnerWorld(); + + public abstract int getSpawnerX(); + + public abstract int getSpawnerY(); + + public abstract int getSpawnerZ(); +} diff --git a/src/main/java/net/minecraft/src/ModelBase.java b/src/main/java/net/minecraft/src/ModelBase.java new file mode 100644 index 0000000..47ca1e9 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelBase.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +public abstract class ModelBase +{ + public float onGround; + public boolean isRiding; + + /** + * This is a list of all the boxes (ModelRenderer.class) in the current model. + */ + public List boxList = new ArrayList(); + public boolean isChild = true; + + /** A mapping for all texture offsets */ + private Map modelTextureMap = new HashMap(); + public int textureWidth = 64; + public int textureHeight = 32; + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) {} + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) {} + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) {} + + public ModelRenderer getRandomModelBox(Random par1Random) + { + return (ModelRenderer)this.boxList.get(par1Random.nextInt(this.boxList.size())); + } + + protected void setTextureOffset(String par1Str, int par2, int par3) + { + this.modelTextureMap.put(par1Str, new TextureOffset(par2, par3)); + } + + public TextureOffset getTextureOffset(String par1Str) + { + return (TextureOffset)this.modelTextureMap.get(par1Str); + } +} diff --git a/src/main/java/net/minecraft/src/ModelBat.java b/src/main/java/net/minecraft/src/ModelBat.java new file mode 100644 index 0000000..8814f4f --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelBat.java @@ -0,0 +1,110 @@ +package net.minecraft.src; + +public class ModelBat extends ModelBase +{ + private ModelRenderer batHead; + + /** The body box of the bat model. */ + private ModelRenderer batBody; + + /** The inner right wing box of the bat model. */ + private ModelRenderer batRightWing; + + /** The inner left wing box of the bat model. */ + private ModelRenderer batLeftWing; + + /** The outer right wing box of the bat model. */ + private ModelRenderer batOuterRightWing; + + /** The outer left wing box of the bat model. */ + private ModelRenderer batOuterLeftWing; + + public ModelBat() + { + this.textureWidth = 64; + this.textureHeight = 64; + this.batHead = new ModelRenderer(this, 0, 0); + this.batHead.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6); + ModelRenderer var1 = new ModelRenderer(this, 24, 0); + var1.addBox(-4.0F, -6.0F, -2.0F, 3, 4, 1); + this.batHead.addChild(var1); + ModelRenderer var2 = new ModelRenderer(this, 24, 0); + var2.mirror = true; + var2.addBox(1.0F, -6.0F, -2.0F, 3, 4, 1); + this.batHead.addChild(var2); + this.batBody = new ModelRenderer(this, 0, 16); + this.batBody.addBox(-3.0F, 4.0F, -3.0F, 6, 12, 6); + this.batBody.setTextureOffset(0, 34).addBox(-5.0F, 16.0F, 0.0F, 10, 6, 1); + this.batRightWing = new ModelRenderer(this, 42, 0); + this.batRightWing.addBox(-12.0F, 1.0F, 1.5F, 10, 16, 1); + this.batOuterRightWing = new ModelRenderer(this, 24, 16); + this.batOuterRightWing.setRotationPoint(-12.0F, 1.0F, 1.5F); + this.batOuterRightWing.addBox(-8.0F, 1.0F, 0.0F, 8, 12, 1); + this.batLeftWing = new ModelRenderer(this, 42, 0); + this.batLeftWing.mirror = true; + this.batLeftWing.addBox(2.0F, 1.0F, 1.5F, 10, 16, 1); + this.batOuterLeftWing = new ModelRenderer(this, 24, 16); + this.batOuterLeftWing.mirror = true; + this.batOuterLeftWing.setRotationPoint(12.0F, 1.0F, 1.5F); + this.batOuterLeftWing.addBox(0.0F, 1.0F, 0.0F, 8, 12, 1); + this.batBody.addChild(this.batRightWing); + this.batBody.addChild(this.batLeftWing); + this.batRightWing.addChild(this.batOuterRightWing); + this.batLeftWing.addChild(this.batOuterLeftWing); + } + + /** + * not actually sure this is size, is not used as of now, but the model would be recreated if the value changed and + * it seems a good match for a bats size + */ + public int getBatSize() + { + return 36; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + EntityBat var8 = (EntityBat)par1Entity; + float var9; + + if (var8.getIsBatHanging()) + { + var9 = (180F / (float)Math.PI); + this.batHead.rotateAngleX = par6 / (180F / (float)Math.PI); + this.batHead.rotateAngleY = (float)Math.PI - par5 / (180F / (float)Math.PI); + this.batHead.rotateAngleZ = (float)Math.PI; + this.batHead.setRotationPoint(0.0F, -2.0F, 0.0F); + this.batRightWing.setRotationPoint(-3.0F, 0.0F, 3.0F); + this.batLeftWing.setRotationPoint(3.0F, 0.0F, 3.0F); + this.batBody.rotateAngleX = (float)Math.PI; + this.batRightWing.rotateAngleX = -0.15707964F; + this.batRightWing.rotateAngleY = -((float)Math.PI * 2F / 5F); + this.batOuterRightWing.rotateAngleY = -1.7278761F; + this.batLeftWing.rotateAngleX = this.batRightWing.rotateAngleX; + this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; + this.batOuterLeftWing.rotateAngleY = -this.batOuterRightWing.rotateAngleY; + } + else + { + var9 = (180F / (float)Math.PI); + this.batHead.rotateAngleX = par6 / (180F / (float)Math.PI); + this.batHead.rotateAngleY = par5 / (180F / (float)Math.PI); + this.batHead.rotateAngleZ = 0.0F; + this.batHead.setRotationPoint(0.0F, 0.0F, 0.0F); + this.batRightWing.setRotationPoint(0.0F, 0.0F, 0.0F); + this.batLeftWing.setRotationPoint(0.0F, 0.0F, 0.0F); + this.batBody.rotateAngleX = ((float)Math.PI / 4F) + MathHelper.cos(par4 * 0.1F) * 0.15F; + this.batBody.rotateAngleY = 0.0F; + this.batRightWing.rotateAngleY = MathHelper.cos(par4 * 1.3F) * (float)Math.PI * 0.25F; + this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; + this.batOuterRightWing.rotateAngleY = this.batRightWing.rotateAngleY * 0.5F; + this.batOuterLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY * 0.5F; + } + + this.batHead.render(par7); + this.batBody.render(par7); + } +} diff --git a/src/main/java/net/minecraft/src/ModelBiped.java b/src/main/java/net/minecraft/src/ModelBiped.java new file mode 100644 index 0000000..be17dd8 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelBiped.java @@ -0,0 +1,245 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class ModelBiped extends ModelBase +{ + public ModelRenderer bipedHead; + public ModelRenderer bipedHeadwear; + public ModelRenderer bipedBody; + public ModelRenderer bipedRightArm; + public ModelRenderer bipedLeftArm; + public ModelRenderer bipedRightLeg; + public ModelRenderer bipedLeftLeg; + public ModelRenderer bipedEars; + public ModelRenderer bipedCloak; + + /** + * Records whether the model should be rendered holding an item in the left hand, and if that item is a block. + */ + public int heldItemLeft; + + /** + * Records whether the model should be rendered holding an item in the right hand, and if that item is a block. + */ + public int heldItemRight; + public boolean isSneak; + + /** Records whether the model should be rendered aiming a bow. */ + public boolean aimedBow; + + public ModelBiped() + { + this(0.0F); + } + + public ModelBiped(float par1) + { + this(par1, 0.0F, 64, 32); + } + + public ModelBiped(float par1, float par2, int par3, int par4) + { + this.textureWidth = par3; + this.textureHeight = par4; + this.bipedCloak = new ModelRenderer(this, 0, 0); + this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, par1); + this.bipedEars = new ModelRenderer(this, 24, 0); + this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, par1); + this.bipedHead = new ModelRenderer(this, 0, 0); + this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1); + this.bipedHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F); + this.bipedHeadwear = new ModelRenderer(this, 32, 0); + this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F); + this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + par2, 0.0F); + this.bipedBody = new ModelRenderer(this, 16, 16); + this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1); + this.bipedBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F); + this.bipedRightArm = new ModelRenderer(this, 40, 16); + this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1); + this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F); + this.bipedLeftArm = new ModelRenderer(this, 40, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F); + this.bipedRightLeg = new ModelRenderer(this, 0, 16); + this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1); + this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + par2, 0.0F); + this.bipedLeftLeg = new ModelRenderer(this, 0, 16); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1); + this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + par2, 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + + if (this.isChild) + { + float var8 = 2.0F; + GL11.glPushMatrix(); + GL11.glScalef(1.5F / var8, 1.5F / var8, 1.5F / var8); + GL11.glTranslatef(0.0F, 16.0F * par7, 0.0F); + this.bipedHead.render(par7); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glScalef(1.0F / var8, 1.0F / var8, 1.0F / var8); + GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F); + this.bipedBody.render(par7); + this.bipedRightArm.render(par7); + this.bipedLeftArm.render(par7); + this.bipedRightLeg.render(par7); + this.bipedLeftLeg.render(par7); + this.bipedHeadwear.render(par7); + GL11.glPopMatrix(); + } + else + { + this.bipedHead.render(par7); + this.bipedBody.render(par7); + this.bipedRightArm.render(par7); + this.bipedLeftArm.render(par7); + this.bipedRightLeg.render(par7); + this.bipedLeftLeg.render(par7); + this.bipedHeadwear.render(par7); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + this.bipedHead.rotateAngleY = par4 / (180F / (float)Math.PI); + this.bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI); + this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY; + this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX; + this.bipedRightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F; + this.bipedLeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F; + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; + this.bipedLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + this.bipedRightLeg.rotateAngleY = 0.0F; + this.bipedLeftLeg.rotateAngleY = 0.0F; + + if (this.isRiding) + { + this.bipedRightArm.rotateAngleX += -((float)Math.PI / 5F); + this.bipedLeftArm.rotateAngleX += -((float)Math.PI / 5F); + this.bipedRightLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); + this.bipedLeftLeg.rotateAngleX = -((float)Math.PI * 2F / 5F); + this.bipedRightLeg.rotateAngleY = ((float)Math.PI / 10F); + this.bipedLeftLeg.rotateAngleY = -((float)Math.PI / 10F); + } + + if (this.heldItemLeft != 0) + { + this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemLeft; + } + + if (this.heldItemRight != 0) + { + this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight; + } + + this.bipedRightArm.rotateAngleY = 0.0F; + this.bipedLeftArm.rotateAngleY = 0.0F; + float var8; + float var9; + + if (this.onGround > -9990.0F) + { + var8 = this.onGround; + this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(var8) * (float)Math.PI * 2.0F) * 0.2F; + this.bipedRightArm.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F; + this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY; + this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY; + this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY; + var8 = 1.0F - this.onGround; + var8 *= var8; + var8 *= var8; + var8 = 1.0F - var8; + var9 = MathHelper.sin(var8 * (float)Math.PI); + float var10 = MathHelper.sin(this.onGround * (float)Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F; + this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX - ((double)var9 * 1.2D + (double)var10)); + this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F; + this.bipedRightArm.rotateAngleZ = MathHelper.sin(this.onGround * (float)Math.PI) * -0.4F; + } + + if (this.isSneak) + { + this.bipedBody.rotateAngleX = 0.5F; + this.bipedRightArm.rotateAngleX += 0.4F; + this.bipedLeftArm.rotateAngleX += 0.4F; + this.bipedRightLeg.rotationPointZ = 4.0F; + this.bipedLeftLeg.rotationPointZ = 4.0F; + this.bipedRightLeg.rotationPointY = 9.0F; + this.bipedLeftLeg.rotationPointY = 9.0F; + this.bipedHead.rotationPointY = 1.0F; + this.bipedHeadwear.rotationPointY = 1.0F; + } + else + { + this.bipedBody.rotateAngleX = 0.0F; + this.bipedRightLeg.rotationPointZ = 0.1F; + this.bipedLeftLeg.rotationPointZ = 0.1F; + this.bipedRightLeg.rotationPointY = 12.0F; + this.bipedLeftLeg.rotationPointY = 12.0F; + this.bipedHead.rotationPointY = 0.0F; + this.bipedHeadwear.rotationPointY = 0.0F; + } + + this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + + if (this.aimedBow) + { + var8 = 0.0F; + var9 = 0.0F; + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightArm.rotateAngleY = -(0.1F - var8 * 0.6F) + this.bipedHead.rotateAngleY; + this.bipedLeftArm.rotateAngleY = 0.1F - var8 * 0.6F + this.bipedHead.rotateAngleY + 0.4F; + this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX; + this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX; + this.bipedRightArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F; + this.bipedLeftArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F; + this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + } + } + + /** + * renders the ears (specifically, deadmau5's) + */ + public void renderEars(float par1) + { + this.bipedEars.rotateAngleY = this.bipedHead.rotateAngleY; + this.bipedEars.rotateAngleX = this.bipedHead.rotateAngleX; + this.bipedEars.rotationPointX = 0.0F; + this.bipedEars.rotationPointY = 0.0F; + this.bipedEars.render(par1); + } + + /** + * Renders the cloak of the current biped (in most cases, it's a player) + */ + public void renderCloak(float par1) + { + this.bipedCloak.render(par1); + } +} diff --git a/src/main/java/net/minecraft/src/ModelBlaze.java b/src/main/java/net/minecraft/src/ModelBlaze.java new file mode 100644 index 0000000..3109a29 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelBlaze.java @@ -0,0 +1,81 @@ +package net.minecraft.src; + +public class ModelBlaze extends ModelBase +{ + /** The sticks that fly around the Blaze. */ + private ModelRenderer[] blazeSticks = new ModelRenderer[12]; + private ModelRenderer blazeHead; + + public ModelBlaze() + { + for (int var1 = 0; var1 < this.blazeSticks.length; ++var1) + { + this.blazeSticks[var1] = new ModelRenderer(this, 0, 16); + this.blazeSticks[var1].addBox(0.0F, 0.0F, 0.0F, 2, 8, 2); + } + + this.blazeHead = new ModelRenderer(this, 0, 0); + this.blazeHead.addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8); + } + + public int func_78104_a() + { + return 8; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.blazeHead.render(par7); + + for (int var8 = 0; var8 < this.blazeSticks.length; ++var8) + { + this.blazeSticks[var8].render(par7); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + float var8 = par3 * (float)Math.PI * -0.1F; + int var9; + + for (var9 = 0; var9 < 4; ++var9) + { + this.blazeSticks[var9].rotationPointY = -2.0F + MathHelper.cos(((float)(var9 * 2) + par3) * 0.25F); + this.blazeSticks[var9].rotationPointX = MathHelper.cos(var8) * 9.0F; + this.blazeSticks[var9].rotationPointZ = MathHelper.sin(var8) * 9.0F; + ++var8; + } + + var8 = ((float)Math.PI / 4F) + par3 * (float)Math.PI * 0.03F; + + for (var9 = 4; var9 < 8; ++var9) + { + this.blazeSticks[var9].rotationPointY = 2.0F + MathHelper.cos(((float)(var9 * 2) + par3) * 0.25F); + this.blazeSticks[var9].rotationPointX = MathHelper.cos(var8) * 7.0F; + this.blazeSticks[var9].rotationPointZ = MathHelper.sin(var8) * 7.0F; + ++var8; + } + + var8 = 0.47123894F + par3 * (float)Math.PI * -0.05F; + + for (var9 = 8; var9 < 12; ++var9) + { + this.blazeSticks[var9].rotationPointY = 11.0F + MathHelper.cos(((float)var9 * 1.5F + par3) * 0.5F); + this.blazeSticks[var9].rotationPointX = MathHelper.cos(var8) * 5.0F; + this.blazeSticks[var9].rotationPointZ = MathHelper.sin(var8) * 5.0F; + ++var8; + } + + this.blazeHead.rotateAngleY = par4 / (180F / (float)Math.PI); + this.blazeHead.rotateAngleX = par5 / (180F / (float)Math.PI); + } +} diff --git a/src/main/java/net/minecraft/src/ModelBoat.java b/src/main/java/net/minecraft/src/ModelBoat.java new file mode 100644 index 0000000..b12537e --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelBoat.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +public class ModelBoat extends ModelBase +{ + public ModelRenderer[] boatSides = new ModelRenderer[5]; + + public ModelBoat() + { + this.boatSides[0] = new ModelRenderer(this, 0, 8); + this.boatSides[1] = new ModelRenderer(this, 0, 0); + this.boatSides[2] = new ModelRenderer(this, 0, 0); + this.boatSides[3] = new ModelRenderer(this, 0, 0); + this.boatSides[4] = new ModelRenderer(this, 0, 0); + byte var1 = 24; + byte var2 = 6; + byte var3 = 20; + byte var4 = 4; + this.boatSides[0].addBox((float)(-var1 / 2), (float)(-var3 / 2 + 2), -3.0F, var1, var3 - 4, 4, 0.0F); + this.boatSides[0].setRotationPoint(0.0F, (float)var4, 0.0F); + this.boatSides[1].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.boatSides[1].setRotationPoint((float)(-var1 / 2 + 1), (float)var4, 0.0F); + this.boatSides[2].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.boatSides[2].setRotationPoint((float)(var1 / 2 - 1), (float)var4, 0.0F); + this.boatSides[3].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.boatSides[3].setRotationPoint(0.0F, (float)var4, (float)(-var3 / 2 + 1)); + this.boatSides[4].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.boatSides[4].setRotationPoint(0.0F, (float)var4, (float)(var3 / 2 - 1)); + this.boatSides[0].rotateAngleX = ((float)Math.PI / 2F); + this.boatSides[1].rotateAngleY = ((float)Math.PI * 3F / 2F); + this.boatSides[2].rotateAngleY = ((float)Math.PI / 2F); + this.boatSides[3].rotateAngleY = (float)Math.PI; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + for (int var8 = 0; var8 < 5; ++var8) + { + this.boatSides[var8].render(par7); + } + } +} diff --git a/src/main/java/net/minecraft/src/ModelBook.java b/src/main/java/net/minecraft/src/ModelBook.java new file mode 100644 index 0000000..1cf7322 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelBook.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +public class ModelBook extends ModelBase +{ + /** Right cover renderer (when facing the book) */ + public ModelRenderer coverRight = (new ModelRenderer(this)).setTextureOffset(0, 0).addBox(-6.0F, -5.0F, 0.0F, 6, 10, 0); + + /** Left cover renderer (when facing the book) */ + public ModelRenderer coverLeft = (new ModelRenderer(this)).setTextureOffset(16, 0).addBox(0.0F, -5.0F, 0.0F, 6, 10, 0); + + /** The right pages renderer (when facing the book) */ + public ModelRenderer pagesRight = (new ModelRenderer(this)).setTextureOffset(0, 10).addBox(0.0F, -4.0F, -0.99F, 5, 8, 1); + + /** The left pages renderer (when facing the book) */ + public ModelRenderer pagesLeft = (new ModelRenderer(this)).setTextureOffset(12, 10).addBox(0.0F, -4.0F, -0.01F, 5, 8, 1); + + /** Right cover renderer (when facing the book) */ + public ModelRenderer flippingPageRight = (new ModelRenderer(this)).setTextureOffset(24, 10).addBox(0.0F, -4.0F, 0.0F, 5, 8, 0); + + /** Right cover renderer (when facing the book) */ + public ModelRenderer flippingPageLeft = (new ModelRenderer(this)).setTextureOffset(24, 10).addBox(0.0F, -4.0F, 0.0F, 5, 8, 0); + + /** The renderer of spine of the book */ + public ModelRenderer bookSpine = (new ModelRenderer(this)).setTextureOffset(12, 0).addBox(-1.0F, -5.0F, 0.0F, 2, 10, 0); + + public ModelBook() + { + this.coverRight.setRotationPoint(0.0F, 0.0F, -1.0F); + this.coverLeft.setRotationPoint(0.0F, 0.0F, 1.0F); + this.bookSpine.rotateAngleY = ((float)Math.PI / 2F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.coverRight.render(par7); + this.coverLeft.render(par7); + this.bookSpine.render(par7); + this.pagesRight.render(par7); + this.pagesLeft.render(par7); + this.flippingPageRight.render(par7); + this.flippingPageLeft.render(par7); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + float var8 = (MathHelper.sin(par1 * 0.02F) * 0.1F + 1.25F) * par4; + this.coverRight.rotateAngleY = (float)Math.PI + var8; + this.coverLeft.rotateAngleY = -var8; + this.pagesRight.rotateAngleY = var8; + this.pagesLeft.rotateAngleY = -var8; + this.flippingPageRight.rotateAngleY = var8 - var8 * 2.0F * par2; + this.flippingPageLeft.rotateAngleY = var8 - var8 * 2.0F * par3; + this.pagesRight.rotationPointX = MathHelper.sin(var8); + this.pagesLeft.rotationPointX = MathHelper.sin(var8); + this.flippingPageRight.rotationPointX = MathHelper.sin(var8); + this.flippingPageLeft.rotationPointX = MathHelper.sin(var8); + } +} diff --git a/src/main/java/net/minecraft/src/ModelBox.java b/src/main/java/net/minecraft/src/ModelBox.java new file mode 100644 index 0000000..b00408e --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelBox.java @@ -0,0 +1,107 @@ +package net.minecraft.src; + +public class ModelBox +{ + /** + * The (x,y,z) vertex positions and (u,v) texture coordinates for each of the 8 points on a cube + */ + private PositionTextureVertex[] vertexPositions; + + /** An array of 6 TexturedQuads, one for each face of a cube */ + private TexturedQuad[] quadList; + + /** X vertex coordinate of lower box corner */ + public final float posX1; + + /** Y vertex coordinate of lower box corner */ + public final float posY1; + + /** Z vertex coordinate of lower box corner */ + public final float posZ1; + + /** X vertex coordinate of upper box corner */ + public final float posX2; + + /** Y vertex coordinate of upper box corner */ + public final float posY2; + + /** Z vertex coordinate of upper box corner */ + public final float posZ2; + public String field_78247_g; + + public ModelBox(ModelRenderer par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10) + { + this.posX1 = par4; + this.posY1 = par5; + this.posZ1 = par6; + this.posX2 = par4 + (float)par7; + this.posY2 = par5 + (float)par8; + this.posZ2 = par6 + (float)par9; + this.vertexPositions = new PositionTextureVertex[8]; + this.quadList = new TexturedQuad[6]; + float var11 = par4 + (float)par7; + float var12 = par5 + (float)par8; + float var13 = par6 + (float)par9; + par4 -= par10; + par5 -= par10; + par6 -= par10; + var11 += par10; + var12 += par10; + var13 += par10; + + if (par1ModelRenderer.mirror) + { + float var14 = var11; + var11 = par4; + par4 = var14; + } + + PositionTextureVertex var23 = new PositionTextureVertex(par4, par5, par6, 0.0F, 0.0F); + PositionTextureVertex var15 = new PositionTextureVertex(var11, par5, par6, 0.0F, 8.0F); + PositionTextureVertex var16 = new PositionTextureVertex(var11, var12, par6, 8.0F, 8.0F); + PositionTextureVertex var17 = new PositionTextureVertex(par4, var12, par6, 8.0F, 0.0F); + PositionTextureVertex var18 = new PositionTextureVertex(par4, par5, var13, 0.0F, 0.0F); + PositionTextureVertex var19 = new PositionTextureVertex(var11, par5, var13, 0.0F, 8.0F); + PositionTextureVertex var20 = new PositionTextureVertex(var11, var12, var13, 8.0F, 8.0F); + PositionTextureVertex var21 = new PositionTextureVertex(par4, var12, var13, 8.0F, 0.0F); + this.vertexPositions[0] = var23; + this.vertexPositions[1] = var15; + this.vertexPositions[2] = var16; + this.vertexPositions[3] = var17; + this.vertexPositions[4] = var18; + this.vertexPositions[5] = var19; + this.vertexPositions[6] = var20; + this.vertexPositions[7] = var21; + this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] {var19, var15, var16, var20}, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] {var23, var18, var21, var17}, par2, par3 + par9, par2 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] {var19, var18, var23, var15}, par2 + par9, par3, par2 + par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] {var16, var17, var21, var20}, par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] {var15, var23, var17, var16}, par2 + par9, par3 + par9, par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] {var18, var19, var20, var21}, par2 + par9 + par7 + par9, par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); + + if (par1ModelRenderer.mirror) + { + for (int var22 = 0; var22 < this.quadList.length; ++var22) + { + this.quadList[var22].flipFace(); + } + } + } + + /** + * Draw the six sided box defined by this ModelBox + */ + public void render(Tessellator par1Tessellator, float par2) + { + for (int var3 = 0; var3 < this.quadList.length; ++var3) + { + this.quadList[var3].draw(par1Tessellator, par2); + } + } + + public ModelBox func_78244_a(String par1Str) + { + this.field_78247_g = par1Str; + return this; + } +} diff --git a/src/main/java/net/minecraft/src/ModelChest.java b/src/main/java/net/minecraft/src/ModelChest.java new file mode 100644 index 0000000..d9bec86 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelChest.java @@ -0,0 +1,42 @@ +package net.minecraft.src; + +public class ModelChest extends ModelBase +{ + /** The chest lid in the chest's model. */ + public ModelRenderer chestLid = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + + /** The model of the bottom of the chest. */ + public ModelRenderer chestBelow; + + /** The chest's knob in the chest model. */ + public ModelRenderer chestKnob; + + public ModelChest() + { + this.chestLid.addBox(0.0F, -5.0F, -14.0F, 14, 5, 14, 0.0F); + this.chestLid.rotationPointX = 1.0F; + this.chestLid.rotationPointY = 7.0F; + this.chestLid.rotationPointZ = 15.0F; + this.chestKnob = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + this.chestKnob.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F); + this.chestKnob.rotationPointX = 8.0F; + this.chestKnob.rotationPointY = 7.0F; + this.chestKnob.rotationPointZ = 15.0F; + this.chestBelow = (new ModelRenderer(this, 0, 19)).setTextureSize(64, 64); + this.chestBelow.addBox(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F); + this.chestBelow.rotationPointX = 1.0F; + this.chestBelow.rotationPointY = 6.0F; + this.chestBelow.rotationPointZ = 1.0F; + } + + /** + * This method renders out all parts of the chest model. + */ + public void renderAll() + { + this.chestKnob.rotateAngleX = this.chestLid.rotateAngleX; + this.chestLid.render(0.0625F); + this.chestKnob.render(0.0625F); + this.chestBelow.render(0.0625F); + } +} diff --git a/src/main/java/net/minecraft/src/ModelChicken.java b/src/main/java/net/minecraft/src/ModelChicken.java new file mode 100644 index 0000000..b04fb2e --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelChicken.java @@ -0,0 +1,103 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class ModelChicken extends ModelBase +{ + public ModelRenderer head; + public ModelRenderer body; + public ModelRenderer rightLeg; + public ModelRenderer leftLeg; + public ModelRenderer rightWing; + public ModelRenderer leftWing; + public ModelRenderer bill; + public ModelRenderer chin; + + public ModelChicken() + { + byte var1 = 16; + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-2.0F, -6.0F, -2.0F, 4, 6, 3, 0.0F); + this.head.setRotationPoint(0.0F, (float)(-1 + var1), -4.0F); + this.bill = new ModelRenderer(this, 14, 0); + this.bill.addBox(-2.0F, -4.0F, -4.0F, 4, 2, 2, 0.0F); + this.bill.setRotationPoint(0.0F, (float)(-1 + var1), -4.0F); + this.chin = new ModelRenderer(this, 14, 4); + this.chin.addBox(-1.0F, -2.0F, -3.0F, 2, 2, 2, 0.0F); + this.chin.setRotationPoint(0.0F, (float)(-1 + var1), -4.0F); + this.body = new ModelRenderer(this, 0, 9); + this.body.addBox(-3.0F, -4.0F, -3.0F, 6, 8, 6, 0.0F); + this.body.setRotationPoint(0.0F, (float)var1, 0.0F); + this.rightLeg = new ModelRenderer(this, 26, 0); + this.rightLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3); + this.rightLeg.setRotationPoint(-2.0F, (float)(3 + var1), 1.0F); + this.leftLeg = new ModelRenderer(this, 26, 0); + this.leftLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3); + this.leftLeg.setRotationPoint(1.0F, (float)(3 + var1), 1.0F); + this.rightWing = new ModelRenderer(this, 24, 13); + this.rightWing.addBox(0.0F, 0.0F, -3.0F, 1, 4, 6); + this.rightWing.setRotationPoint(-4.0F, (float)(-3 + var1), 0.0F); + this.leftWing = new ModelRenderer(this, 24, 13); + this.leftWing.addBox(-1.0F, 0.0F, -3.0F, 1, 4, 6); + this.leftWing.setRotationPoint(4.0F, (float)(-3 + var1), 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + + if (this.isChild) + { + float var8 = 2.0F; + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 5.0F * par7, 2.0F * par7); + this.head.render(par7); + this.bill.render(par7); + this.chin.render(par7); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glScalef(1.0F / var8, 1.0F / var8, 1.0F / var8); + GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F); + this.body.render(par7); + this.rightLeg.render(par7); + this.leftLeg.render(par7); + this.rightWing.render(par7); + this.leftWing.render(par7); + GL11.glPopMatrix(); + } + else + { + this.head.render(par7); + this.bill.render(par7); + this.chin.render(par7); + this.body.render(par7); + this.rightLeg.render(par7); + this.leftLeg.render(par7); + this.rightWing.render(par7); + this.leftWing.render(par7); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + this.head.rotateAngleX = par5 / (180F / (float)Math.PI); + this.head.rotateAngleY = par4 / (180F / (float)Math.PI); + this.bill.rotateAngleX = this.head.rotateAngleX; + this.bill.rotateAngleY = this.head.rotateAngleY; + this.chin.rotateAngleX = this.head.rotateAngleX; + this.chin.rotateAngleY = this.head.rotateAngleY; + this.body.rotateAngleX = ((float)Math.PI / 2F); + this.rightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; + this.leftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + this.rightWing.rotateAngleZ = par3; + this.leftWing.rotateAngleZ = -par3; + } +} diff --git a/src/main/java/net/minecraft/src/ModelCow.java b/src/main/java/net/minecraft/src/ModelCow.java new file mode 100644 index 0000000..5704036 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelCow.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +public class ModelCow extends ModelQuadruped +{ + public ModelCow() + { + super(12, 0.0F); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-4.0F, -4.0F, -6.0F, 8, 8, 6, 0.0F); + this.head.setRotationPoint(0.0F, 4.0F, -8.0F); + this.head.setTextureOffset(22, 0).addBox(-5.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F); + this.head.setTextureOffset(22, 0).addBox(4.0F, -5.0F, -4.0F, 1, 3, 1, 0.0F); + this.body = new ModelRenderer(this, 18, 4); + this.body.addBox(-6.0F, -10.0F, -7.0F, 12, 18, 10, 0.0F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + this.body.setTextureOffset(52, 0).addBox(-2.0F, 2.0F, -8.0F, 4, 6, 1); + --this.leg1.rotationPointX; + ++this.leg2.rotationPointX; + this.leg1.rotationPointZ += 0.0F; + this.leg2.rotationPointZ += 0.0F; + --this.leg3.rotationPointX; + ++this.leg4.rotationPointX; + --this.leg3.rotationPointZ; + --this.leg4.rotationPointZ; + this.field_78151_h += 2.0F; + } +} diff --git a/src/main/java/net/minecraft/src/ModelCreeper.java b/src/main/java/net/minecraft/src/ModelCreeper.java new file mode 100644 index 0000000..a5344ef --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelCreeper.java @@ -0,0 +1,72 @@ +package net.minecraft.src; + +public class ModelCreeper extends ModelBase +{ + public ModelRenderer head; + public ModelRenderer field_78133_b; + public ModelRenderer body; + public ModelRenderer leg1; + public ModelRenderer leg2; + public ModelRenderer leg3; + public ModelRenderer leg4; + + public ModelCreeper() + { + this(0.0F); + } + + public ModelCreeper(float par1) + { + byte var2 = 4; + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1); + this.head.setRotationPoint(0.0F, (float)var2, 0.0F); + this.field_78133_b = new ModelRenderer(this, 32, 0); + this.field_78133_b.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F); + this.field_78133_b.setRotationPoint(0.0F, (float)var2, 0.0F); + this.body = new ModelRenderer(this, 16, 16); + this.body.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1); + this.body.setRotationPoint(0.0F, (float)var2, 0.0F); + this.leg1 = new ModelRenderer(this, 0, 16); + this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1); + this.leg1.setRotationPoint(-2.0F, (float)(12 + var2), 4.0F); + this.leg2 = new ModelRenderer(this, 0, 16); + this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1); + this.leg2.setRotationPoint(2.0F, (float)(12 + var2), 4.0F); + this.leg3 = new ModelRenderer(this, 0, 16); + this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1); + this.leg3.setRotationPoint(-2.0F, (float)(12 + var2), -4.0F); + this.leg4 = new ModelRenderer(this, 0, 16); + this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, par1); + this.leg4.setRotationPoint(2.0F, (float)(12 + var2), -4.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.head.render(par7); + this.body.render(par7); + this.leg1.render(par7); + this.leg2.render(par7); + this.leg3.render(par7); + this.leg4.render(par7); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + this.head.rotateAngleY = par4 / (180F / (float)Math.PI); + this.head.rotateAngleX = par5 / (180F / (float)Math.PI); + this.leg1.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; + this.leg2.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + this.leg3.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + this.leg4.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; + } +} diff --git a/src/main/java/net/minecraft/src/ModelDragon.java b/src/main/java/net/minecraft/src/ModelDragon.java new file mode 100644 index 0000000..eac653b --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelDragon.java @@ -0,0 +1,260 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class ModelDragon extends ModelBase +{ + /** The head Model renderer of the dragon */ + private ModelRenderer head; + + /** The spine Model renderer of the dragon */ + private ModelRenderer spine; + + /** The jaw Model renderer of the dragon */ + private ModelRenderer jaw; + + /** The body Model renderer of the dragon */ + private ModelRenderer body; + + /** The rear leg Model renderer of the dragon */ + private ModelRenderer rearLeg; + + /** The front leg Model renderer of the dragon */ + private ModelRenderer frontLeg; + + /** The rear leg tip Model renderer of the dragon */ + private ModelRenderer rearLegTip; + + /** The front leg tip Model renderer of the dragon */ + private ModelRenderer frontLegTip; + + /** The rear foot Model renderer of the dragon */ + private ModelRenderer rearFoot; + + /** The front foot Model renderer of the dragon */ + private ModelRenderer frontFoot; + + /** The wing Model renderer of the dragon */ + private ModelRenderer wing; + + /** The wing tip Model renderer of the dragon */ + private ModelRenderer wingTip; + private float partialTicks; + + public ModelDragon(float par1) + { + this.textureWidth = 256; + this.textureHeight = 256; + this.setTextureOffset("body.body", 0, 0); + this.setTextureOffset("wing.skin", -56, 88); + this.setTextureOffset("wingtip.skin", -56, 144); + this.setTextureOffset("rearleg.main", 0, 0); + this.setTextureOffset("rearfoot.main", 112, 0); + this.setTextureOffset("rearlegtip.main", 196, 0); + this.setTextureOffset("head.upperhead", 112, 30); + this.setTextureOffset("wing.bone", 112, 88); + this.setTextureOffset("head.upperlip", 176, 44); + this.setTextureOffset("jaw.jaw", 176, 65); + this.setTextureOffset("frontleg.main", 112, 104); + this.setTextureOffset("wingtip.bone", 112, 136); + this.setTextureOffset("frontfoot.main", 144, 104); + this.setTextureOffset("neck.box", 192, 104); + this.setTextureOffset("frontlegtip.main", 226, 138); + this.setTextureOffset("body.scale", 220, 53); + this.setTextureOffset("head.scale", 0, 0); + this.setTextureOffset("neck.scale", 48, 0); + this.setTextureOffset("head.nostril", 112, 0); + float var2 = -16.0F; + this.head = new ModelRenderer(this, "head"); + this.head.addBox("upperlip", -6.0F, -1.0F, -8.0F + var2, 12, 5, 16); + this.head.addBox("upperhead", -8.0F, -8.0F, 6.0F + var2, 16, 16, 16); + this.head.mirror = true; + this.head.addBox("scale", -5.0F, -12.0F, 12.0F + var2, 2, 4, 6); + this.head.addBox("nostril", -5.0F, -3.0F, -6.0F + var2, 2, 2, 4); + this.head.mirror = false; + this.head.addBox("scale", 3.0F, -12.0F, 12.0F + var2, 2, 4, 6); + this.head.addBox("nostril", 3.0F, -3.0F, -6.0F + var2, 2, 2, 4); + this.jaw = new ModelRenderer(this, "jaw"); + this.jaw.setRotationPoint(0.0F, 4.0F, 8.0F + var2); + this.jaw.addBox("jaw", -6.0F, 0.0F, -16.0F, 12, 4, 16); + this.head.addChild(this.jaw); + this.spine = new ModelRenderer(this, "neck"); + this.spine.addBox("box", -5.0F, -5.0F, -5.0F, 10, 10, 10); + this.spine.addBox("scale", -1.0F, -9.0F, -3.0F, 2, 4, 6); + this.body = new ModelRenderer(this, "body"); + this.body.setRotationPoint(0.0F, 4.0F, 8.0F); + this.body.addBox("body", -12.0F, 0.0F, -16.0F, 24, 24, 64); + this.body.addBox("scale", -1.0F, -6.0F, -10.0F, 2, 6, 12); + this.body.addBox("scale", -1.0F, -6.0F, 10.0F, 2, 6, 12); + this.body.addBox("scale", -1.0F, -6.0F, 30.0F, 2, 6, 12); + this.wing = new ModelRenderer(this, "wing"); + this.wing.setRotationPoint(-12.0F, 5.0F, 2.0F); + this.wing.addBox("bone", -56.0F, -4.0F, -4.0F, 56, 8, 8); + this.wing.addBox("skin", -56.0F, 0.0F, 2.0F, 56, 0, 56); + this.wingTip = new ModelRenderer(this, "wingtip"); + this.wingTip.setRotationPoint(-56.0F, 0.0F, 0.0F); + this.wingTip.addBox("bone", -56.0F, -2.0F, -2.0F, 56, 4, 4); + this.wingTip.addBox("skin", -56.0F, 0.0F, 2.0F, 56, 0, 56); + this.wing.addChild(this.wingTip); + this.frontLeg = new ModelRenderer(this, "frontleg"); + this.frontLeg.setRotationPoint(-12.0F, 20.0F, 2.0F); + this.frontLeg.addBox("main", -4.0F, -4.0F, -4.0F, 8, 24, 8); + this.frontLegTip = new ModelRenderer(this, "frontlegtip"); + this.frontLegTip.setRotationPoint(0.0F, 20.0F, -1.0F); + this.frontLegTip.addBox("main", -3.0F, -1.0F, -3.0F, 6, 24, 6); + this.frontLeg.addChild(this.frontLegTip); + this.frontFoot = new ModelRenderer(this, "frontfoot"); + this.frontFoot.setRotationPoint(0.0F, 23.0F, 0.0F); + this.frontFoot.addBox("main", -4.0F, 0.0F, -12.0F, 8, 4, 16); + this.frontLegTip.addChild(this.frontFoot); + this.rearLeg = new ModelRenderer(this, "rearleg"); + this.rearLeg.setRotationPoint(-16.0F, 16.0F, 42.0F); + this.rearLeg.addBox("main", -8.0F, -4.0F, -8.0F, 16, 32, 16); + this.rearLegTip = new ModelRenderer(this, "rearlegtip"); + this.rearLegTip.setRotationPoint(0.0F, 32.0F, -4.0F); + this.rearLegTip.addBox("main", -6.0F, -2.0F, 0.0F, 12, 32, 12); + this.rearLeg.addChild(this.rearLegTip); + this.rearFoot = new ModelRenderer(this, "rearfoot"); + this.rearFoot.setRotationPoint(0.0F, 31.0F, 4.0F); + this.rearFoot.addBox("main", -9.0F, 0.0F, -20.0F, 18, 6, 24); + this.rearLegTip.addChild(this.rearFoot); + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + this.partialTicks = par4; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + GL11.glPushMatrix(); + EntityDragon var8 = (EntityDragon)par1Entity; + float var9 = var8.prevAnimTime + (var8.animTime - var8.prevAnimTime) * this.partialTicks; + this.jaw.rotateAngleX = (float)(Math.sin((double)(var9 * (float)Math.PI * 2.0F)) + 1.0D) * 0.2F; + float var10 = (float)(Math.sin((double)(var9 * (float)Math.PI * 2.0F - 1.0F)) + 1.0D); + var10 = (var10 * var10 * 1.0F + var10 * 2.0F) * 0.05F; + GL11.glTranslatef(0.0F, var10 - 2.0F, -3.0F); + GL11.glRotatef(var10 * 2.0F, 1.0F, 0.0F, 0.0F); + float var11 = -30.0F; + float var13 = 0.0F; + float var14 = 1.5F; + double[] var15 = var8.getMovementOffsets(6, this.partialTicks); + float var16 = this.updateRotations(var8.getMovementOffsets(5, this.partialTicks)[0] - var8.getMovementOffsets(10, this.partialTicks)[0]); + float var17 = this.updateRotations(var8.getMovementOffsets(5, this.partialTicks)[0] + (double)(var16 / 2.0F)); + var11 += 2.0F; + float var18 = var9 * (float)Math.PI * 2.0F; + var11 = 20.0F; + float var12 = -12.0F; + float var21; + + for (int var19 = 0; var19 < 5; ++var19) + { + double[] var20 = var8.getMovementOffsets(5 - var19, this.partialTicks); + var21 = (float)Math.cos((double)((float)var19 * 0.45F + var18)) * 0.15F; + this.spine.rotateAngleY = this.updateRotations(var20[0] - var15[0]) * (float)Math.PI / 180.0F * var14; + this.spine.rotateAngleX = var21 + (float)(var20[1] - var15[1]) * (float)Math.PI / 180.0F * var14 * 5.0F; + this.spine.rotateAngleZ = -this.updateRotations(var20[0] - (double)var17) * (float)Math.PI / 180.0F * var14; + this.spine.rotationPointY = var11; + this.spine.rotationPointZ = var12; + this.spine.rotationPointX = var13; + var11 = (float)((double)var11 + Math.sin((double)this.spine.rotateAngleX) * 10.0D); + var12 = (float)((double)var12 - Math.cos((double)this.spine.rotateAngleY) * Math.cos((double)this.spine.rotateAngleX) * 10.0D); + var13 = (float)((double)var13 - Math.sin((double)this.spine.rotateAngleY) * Math.cos((double)this.spine.rotateAngleX) * 10.0D); + this.spine.render(par7); + } + + this.head.rotationPointY = var11; + this.head.rotationPointZ = var12; + this.head.rotationPointX = var13; + double[] var22 = var8.getMovementOffsets(0, this.partialTicks); + this.head.rotateAngleY = this.updateRotations(var22[0] - var15[0]) * (float)Math.PI / 180.0F * 1.0F; + this.head.rotateAngleZ = -this.updateRotations(var22[0] - (double)var17) * (float)Math.PI / 180.0F * 1.0F; + this.head.render(par7); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 1.0F, 0.0F); + GL11.glRotatef(-var16 * var14 * 1.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.0F, -1.0F, 0.0F); + this.body.rotateAngleZ = 0.0F; + this.body.render(par7); + + for (int var23 = 0; var23 < 2; ++var23) + { + GL11.glEnable(GL11.GL_CULL_FACE); + var21 = var9 * (float)Math.PI * 2.0F; + this.wing.rotateAngleX = 0.125F - (float)Math.cos((double)var21) * 0.2F; + this.wing.rotateAngleY = 0.25F; + this.wing.rotateAngleZ = (float)(Math.sin((double)var21) + 0.125D) * 0.8F; + this.wingTip.rotateAngleZ = -((float)(Math.sin((double)(var21 + 2.0F)) + 0.5D)) * 0.75F; + this.rearLeg.rotateAngleX = 1.0F + var10 * 0.1F; + this.rearLegTip.rotateAngleX = 0.5F + var10 * 0.1F; + this.rearFoot.rotateAngleX = 0.75F + var10 * 0.1F; + this.frontLeg.rotateAngleX = 1.3F + var10 * 0.1F; + this.frontLegTip.rotateAngleX = -0.5F - var10 * 0.1F; + this.frontFoot.rotateAngleX = 0.75F + var10 * 0.1F; + this.wing.render(par7); + this.frontLeg.render(par7); + this.rearLeg.render(par7); + GL11.glScalef(-1.0F, 1.0F, 1.0F); + + if (var23 == 0) + { + GL11.glCullFace(GL11.GL_FRONT); + } + } + + GL11.glPopMatrix(); + GL11.glCullFace(GL11.GL_BACK); + GL11.glDisable(GL11.GL_CULL_FACE); + float var24 = -((float)Math.sin((double)(var9 * (float)Math.PI * 2.0F))) * 0.0F; + var18 = var9 * (float)Math.PI * 2.0F; + var11 = 10.0F; + var12 = 60.0F; + var13 = 0.0F; + var15 = var8.getMovementOffsets(11, this.partialTicks); + + for (int var25 = 0; var25 < 12; ++var25) + { + var22 = var8.getMovementOffsets(12 + var25, this.partialTicks); + var24 = (float)((double)var24 + Math.sin((double)((float)var25 * 0.45F + var18)) * 0.05000000074505806D); + this.spine.rotateAngleY = (this.updateRotations(var22[0] - var15[0]) * var14 + 180.0F) * (float)Math.PI / 180.0F; + this.spine.rotateAngleX = var24 + (float)(var22[1] - var15[1]) * (float)Math.PI / 180.0F * var14 * 5.0F; + this.spine.rotateAngleZ = this.updateRotations(var22[0] - (double)var17) * (float)Math.PI / 180.0F * var14; + this.spine.rotationPointY = var11; + this.spine.rotationPointZ = var12; + this.spine.rotationPointX = var13; + var11 = (float)((double)var11 + Math.sin((double)this.spine.rotateAngleX) * 10.0D); + var12 = (float)((double)var12 - Math.cos((double)this.spine.rotateAngleY) * Math.cos((double)this.spine.rotateAngleX) * 10.0D); + var13 = (float)((double)var13 - Math.sin((double)this.spine.rotateAngleY) * Math.cos((double)this.spine.rotateAngleX) * 10.0D); + this.spine.render(par7); + } + + GL11.glPopMatrix(); + } + + /** + * Updates the rotations in the parameters for rotations greater than 180 degrees or less than -180 degrees. It adds + * or subtracts 360 degrees, so that the appearance is the same, although the numbers are then simplified to range + * -180 to 180 + */ + private float updateRotations(double par1) + { + while (par1 >= 180.0D) + { + par1 -= 360.0D; + } + + while (par1 < -180.0D) + { + par1 += 360.0D; + } + + return (float)par1; + } +} diff --git a/src/main/java/net/minecraft/src/ModelEnderCrystal.java b/src/main/java/net/minecraft/src/ModelEnderCrystal.java new file mode 100644 index 0000000..39aa46e --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelEnderCrystal.java @@ -0,0 +1,58 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class ModelEnderCrystal extends ModelBase +{ + /** The cube model for the Ender Crystal. */ + private ModelRenderer cube; + + /** The glass model for the Ender Crystal. */ + private ModelRenderer glass = new ModelRenderer(this, "glass"); + + /** The base model for the Ender Crystal. */ + private ModelRenderer base; + + public ModelEnderCrystal(float par1, boolean par2) + { + this.glass.setTextureOffset(0, 0).addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8); + this.cube = new ModelRenderer(this, "cube"); + this.cube.setTextureOffset(32, 0).addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8); + + if (par2) + { + this.base = new ModelRenderer(this, "base"); + this.base.setTextureOffset(0, 16).addBox(-6.0F, 0.0F, -6.0F, 12, 4, 12); + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + GL11.glPushMatrix(); + GL11.glScalef(2.0F, 2.0F, 2.0F); + GL11.glTranslatef(0.0F, -0.5F, 0.0F); + + if (this.base != null) + { + this.base.render(par7); + } + + GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, 0.8F + par4, 0.0F); + GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F); + this.glass.render(par7); + float var8 = 0.875F; + GL11.glScalef(var8, var8, var8); + GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F); + GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F); + this.glass.render(par7); + GL11.glScalef(var8, var8, var8); + GL11.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F); + GL11.glRotatef(par3, 0.0F, 1.0F, 0.0F); + this.cube.render(par7); + GL11.glPopMatrix(); + } +} diff --git a/src/main/java/net/minecraft/src/ModelEnderman.java b/src/main/java/net/minecraft/src/ModelEnderman.java new file mode 100644 index 0000000..21d9f64 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelEnderman.java @@ -0,0 +1,128 @@ +package net.minecraft.src; + +public class ModelEnderman extends ModelBiped +{ + /** Is the enderman carrying a block? */ + public boolean isCarrying; + + /** Is the enderman attacking an entity? */ + public boolean isAttacking; + + public ModelEnderman() + { + super(0.0F, -14.0F, 64, 32); + float var1 = -14.0F; + float var2 = 0.0F; + this.bipedHeadwear = new ModelRenderer(this, 0, 16); + this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, var2 - 0.5F); + this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + var1, 0.0F); + this.bipedBody = new ModelRenderer(this, 32, 16); + this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, var2); + this.bipedBody.setRotationPoint(0.0F, 0.0F + var1, 0.0F); + this.bipedRightArm = new ModelRenderer(this, 56, 0); + this.bipedRightArm.addBox(-1.0F, -2.0F, -1.0F, 2, 30, 2, var2); + this.bipedRightArm.setRotationPoint(-3.0F, 2.0F + var1, 0.0F); + this.bipedLeftArm = new ModelRenderer(this, 56, 0); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -1.0F, 2, 30, 2, var2); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + var1, 0.0F); + this.bipedRightLeg = new ModelRenderer(this, 56, 0); + this.bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 30, 2, var2); + this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F + var1, 0.0F); + this.bipedLeftLeg = new ModelRenderer(this, 56, 0); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 30, 2, var2); + this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F + var1, 0.0F); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + this.bipedHead.showModel = true; + float var8 = -14.0F; + this.bipedBody.rotateAngleX = 0.0F; + this.bipedBody.rotationPointY = var8; + this.bipedBody.rotationPointZ = -0.0F; + this.bipedRightLeg.rotateAngleX -= 0.0F; + this.bipedLeftLeg.rotateAngleX -= 0.0F; + this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX * 0.5D); + this.bipedLeftArm.rotateAngleX = (float)((double)this.bipedLeftArm.rotateAngleX * 0.5D); + this.bipedRightLeg.rotateAngleX = (float)((double)this.bipedRightLeg.rotateAngleX * 0.5D); + this.bipedLeftLeg.rotateAngleX = (float)((double)this.bipedLeftLeg.rotateAngleX * 0.5D); + float var9 = 0.4F; + + if (this.bipedRightArm.rotateAngleX > var9) + { + this.bipedRightArm.rotateAngleX = var9; + } + + if (this.bipedLeftArm.rotateAngleX > var9) + { + this.bipedLeftArm.rotateAngleX = var9; + } + + if (this.bipedRightArm.rotateAngleX < -var9) + { + this.bipedRightArm.rotateAngleX = -var9; + } + + if (this.bipedLeftArm.rotateAngleX < -var9) + { + this.bipedLeftArm.rotateAngleX = -var9; + } + + if (this.bipedRightLeg.rotateAngleX > var9) + { + this.bipedRightLeg.rotateAngleX = var9; + } + + if (this.bipedLeftLeg.rotateAngleX > var9) + { + this.bipedLeftLeg.rotateAngleX = var9; + } + + if (this.bipedRightLeg.rotateAngleX < -var9) + { + this.bipedRightLeg.rotateAngleX = -var9; + } + + if (this.bipedLeftLeg.rotateAngleX < -var9) + { + this.bipedLeftLeg.rotateAngleX = -var9; + } + + if (this.isCarrying) + { + this.bipedRightArm.rotateAngleX = -0.5F; + this.bipedLeftArm.rotateAngleX = -0.5F; + this.bipedRightArm.rotateAngleZ = 0.05F; + this.bipedLeftArm.rotateAngleZ = -0.05F; + } + + this.bipedRightArm.rotationPointZ = 0.0F; + this.bipedLeftArm.rotationPointZ = 0.0F; + this.bipedRightLeg.rotationPointZ = 0.0F; + this.bipedLeftLeg.rotationPointZ = 0.0F; + this.bipedRightLeg.rotationPointY = 9.0F + var8; + this.bipedLeftLeg.rotationPointY = 9.0F + var8; + this.bipedHead.rotationPointZ = -0.0F; + this.bipedHead.rotationPointY = var8 + 1.0F; + this.bipedHeadwear.rotationPointX = this.bipedHead.rotationPointX; + this.bipedHeadwear.rotationPointY = this.bipedHead.rotationPointY; + this.bipedHeadwear.rotationPointZ = this.bipedHead.rotationPointZ; + this.bipedHeadwear.rotateAngleX = this.bipedHead.rotateAngleX; + this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY; + this.bipedHeadwear.rotateAngleZ = this.bipedHead.rotateAngleZ; + + if (this.isAttacking) + { + float var10 = 1.0F; + this.bipedHead.rotationPointY -= var10 * 5.0F; + } + } +} diff --git a/src/main/java/net/minecraft/src/ModelGhast.java b/src/main/java/net/minecraft/src/ModelGhast.java new file mode 100644 index 0000000..d8573fa --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelGhast.java @@ -0,0 +1,65 @@ +package net.minecraft.src; + +import java.util.Random; +import org.lwjgl.opengl.GL11; + +public class ModelGhast extends ModelBase +{ + ModelRenderer body; + ModelRenderer[] tentacles = new ModelRenderer[9]; + + public ModelGhast() + { + byte var1 = -16; + this.body = new ModelRenderer(this, 0, 0); + this.body.addBox(-8.0F, -8.0F, -8.0F, 16, 16, 16); + this.body.rotationPointY += (float)(24 + var1); + Random var2 = new Random(1660L); + + for (int var3 = 0; var3 < this.tentacles.length; ++var3) + { + this.tentacles[var3] = new ModelRenderer(this, 0, 0); + float var4 = (((float)(var3 % 3) - (float)(var3 / 3 % 2) * 0.5F + 0.25F) / 2.0F * 2.0F - 1.0F) * 5.0F; + float var5 = ((float)(var3 / 3) / 2.0F * 2.0F - 1.0F) * 5.0F; + int var6 = var2.nextInt(7) + 8; + this.tentacles[var3].addBox(-1.0F, 0.0F, -1.0F, 2, var6, 2); + this.tentacles[var3].rotationPointX = var4; + this.tentacles[var3].rotationPointZ = var5; + this.tentacles[var3].rotationPointY = (float)(31 + var1); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + for (int var8 = 0; var8 < this.tentacles.length; ++var8) + { + this.tentacles[var8].rotateAngleX = 0.2F * MathHelper.sin(par3 * 0.3F + (float)var8) + 0.4F; + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 0.6F, 0.0F); + this.body.render(par7); + ModelRenderer[] var8 = this.tentacles; + int var9 = var8.length; + + for (int var10 = 0; var10 < var9; ++var10) + { + ModelRenderer var11 = var8[var10]; + var11.render(par7); + } + + GL11.glPopMatrix(); + } +} diff --git a/src/main/java/net/minecraft/src/ModelHorse.java b/src/main/java/net/minecraft/src/ModelHorse.java new file mode 100644 index 0000000..63b9ac0 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelHorse.java @@ -0,0 +1,549 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class ModelHorse extends ModelBase +{ + private ModelRenderer head; + private ModelRenderer mouthTop; + private ModelRenderer mouthBottom; + private ModelRenderer horseLeftEar; + private ModelRenderer horseRightEar; + private ModelRenderer field_110703_f; + private ModelRenderer field_110704_g; + private ModelRenderer neck; + private ModelRenderer field_110717_i; + private ModelRenderer mane; + private ModelRenderer body; + private ModelRenderer tailBase; + private ModelRenderer tailMiddle; + private ModelRenderer tailTip; + private ModelRenderer backLeftLeg; + private ModelRenderer backLeftShin; + private ModelRenderer backLeftHoof; + private ModelRenderer backRightLeg; + private ModelRenderer backRightShin; + private ModelRenderer backRightHoof; + private ModelRenderer frontRightLeg; + private ModelRenderer frontLeftShin; + private ModelRenderer frontLeftHoof; + private ModelRenderer field_110684_D; + private ModelRenderer frontRightShin; + private ModelRenderer frontRightHoof; + private ModelRenderer field_110687_G; + private ModelRenderer field_110695_H; + private ModelRenderer field_110696_I; + private ModelRenderer field_110697_J; + private ModelRenderer field_110698_K; + private ModelRenderer field_110691_L; + private ModelRenderer field_110692_M; + private ModelRenderer field_110693_N; + private ModelRenderer field_110694_O; + private ModelRenderer field_110700_P; + private ModelRenderer field_110699_Q; + private ModelRenderer field_110702_R; + private ModelRenderer field_110701_S; + + public ModelHorse() + { + this.textureWidth = 128; + this.textureHeight = 128; + this.body = new ModelRenderer(this, 0, 34); + this.body.addBox(-5.0F, -8.0F, -19.0F, 10, 10, 24); + this.body.setRotationPoint(0.0F, 11.0F, 9.0F); + this.tailBase = new ModelRenderer(this, 44, 0); + this.tailBase.addBox(-1.0F, -1.0F, 0.0F, 2, 2, 3); + this.tailBase.setRotationPoint(0.0F, 3.0F, 14.0F); + this.func_110682_a(this.tailBase, -1.134464F, 0.0F, 0.0F); + this.tailMiddle = new ModelRenderer(this, 38, 7); + this.tailMiddle.addBox(-1.5F, -2.0F, 3.0F, 3, 4, 7); + this.tailMiddle.setRotationPoint(0.0F, 3.0F, 14.0F); + this.func_110682_a(this.tailMiddle, -1.134464F, 0.0F, 0.0F); + this.tailTip = new ModelRenderer(this, 24, 3); + this.tailTip.addBox(-1.5F, -4.5F, 9.0F, 3, 4, 7); + this.tailTip.setRotationPoint(0.0F, 3.0F, 14.0F); + this.func_110682_a(this.tailTip, -1.40215F, 0.0F, 0.0F); + this.backLeftLeg = new ModelRenderer(this, 78, 29); + this.backLeftLeg.addBox(-2.5F, -2.0F, -2.5F, 4, 9, 5); + this.backLeftLeg.setRotationPoint(4.0F, 9.0F, 11.0F); + this.backLeftShin = new ModelRenderer(this, 78, 43); + this.backLeftShin.addBox(-2.0F, 0.0F, -1.5F, 3, 5, 3); + this.backLeftShin.setRotationPoint(4.0F, 16.0F, 11.0F); + this.backLeftHoof = new ModelRenderer(this, 78, 51); + this.backLeftHoof.addBox(-2.5F, 5.1F, -2.0F, 4, 3, 4); + this.backLeftHoof.setRotationPoint(4.0F, 16.0F, 11.0F); + this.backRightLeg = new ModelRenderer(this, 96, 29); + this.backRightLeg.addBox(-1.5F, -2.0F, -2.5F, 4, 9, 5); + this.backRightLeg.setRotationPoint(-4.0F, 9.0F, 11.0F); + this.backRightShin = new ModelRenderer(this, 96, 43); + this.backRightShin.addBox(-1.0F, 0.0F, -1.5F, 3, 5, 3); + this.backRightShin.setRotationPoint(-4.0F, 16.0F, 11.0F); + this.backRightHoof = new ModelRenderer(this, 96, 51); + this.backRightHoof.addBox(-1.5F, 5.1F, -2.0F, 4, 3, 4); + this.backRightHoof.setRotationPoint(-4.0F, 16.0F, 11.0F); + this.frontRightLeg = new ModelRenderer(this, 44, 29); + this.frontRightLeg.addBox(-1.9F, -1.0F, -2.1F, 3, 8, 4); + this.frontRightLeg.setRotationPoint(4.0F, 9.0F, -8.0F); + this.frontLeftShin = new ModelRenderer(this, 44, 41); + this.frontLeftShin.addBox(-1.9F, 0.0F, -1.6F, 3, 5, 3); + this.frontLeftShin.setRotationPoint(4.0F, 16.0F, -8.0F); + this.frontLeftHoof = new ModelRenderer(this, 44, 51); + this.frontLeftHoof.addBox(-2.4F, 5.1F, -2.1F, 4, 3, 4); + this.frontLeftHoof.setRotationPoint(4.0F, 16.0F, -8.0F); + this.field_110684_D = new ModelRenderer(this, 60, 29); + this.field_110684_D.addBox(-1.1F, -1.0F, -2.1F, 3, 8, 4); + this.field_110684_D.setRotationPoint(-4.0F, 9.0F, -8.0F); + this.frontRightShin = new ModelRenderer(this, 60, 41); + this.frontRightShin.addBox(-1.1F, 0.0F, -1.6F, 3, 5, 3); + this.frontRightShin.setRotationPoint(-4.0F, 16.0F, -8.0F); + this.frontRightHoof = new ModelRenderer(this, 60, 51); + this.frontRightHoof.addBox(-1.6F, 5.1F, -2.1F, 4, 3, 4); + this.frontRightHoof.setRotationPoint(-4.0F, 16.0F, -8.0F); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-2.5F, -10.0F, -1.5F, 5, 5, 7); + this.head.setRotationPoint(0.0F, 4.0F, -10.0F); + this.func_110682_a(this.head, 0.5235988F, 0.0F, 0.0F); + this.mouthTop = new ModelRenderer(this, 24, 18); + this.mouthTop.addBox(-2.0F, -10.0F, -7.0F, 4, 3, 6); + this.mouthTop.setRotationPoint(0.0F, 3.95F, -10.0F); + this.func_110682_a(this.mouthTop, 0.5235988F, 0.0F, 0.0F); + this.mouthBottom = new ModelRenderer(this, 24, 27); + this.mouthBottom.addBox(-2.0F, -7.0F, -6.5F, 4, 2, 5); + this.mouthBottom.setRotationPoint(0.0F, 4.0F, -10.0F); + this.func_110682_a(this.mouthBottom, 0.5235988F, 0.0F, 0.0F); + this.head.addChild(this.mouthTop); + this.head.addChild(this.mouthBottom); + this.horseLeftEar = new ModelRenderer(this, 0, 0); + this.horseLeftEar.addBox(0.45F, -12.0F, 4.0F, 2, 3, 1); + this.horseLeftEar.setRotationPoint(0.0F, 4.0F, -10.0F); + this.func_110682_a(this.horseLeftEar, 0.5235988F, 0.0F, 0.0F); + this.horseRightEar = new ModelRenderer(this, 0, 0); + this.horseRightEar.addBox(-2.45F, -12.0F, 4.0F, 2, 3, 1); + this.horseRightEar.setRotationPoint(0.0F, 4.0F, -10.0F); + this.func_110682_a(this.horseRightEar, 0.5235988F, 0.0F, 0.0F); + this.field_110703_f = new ModelRenderer(this, 0, 12); + this.field_110703_f.addBox(-2.0F, -16.0F, 4.0F, 2, 7, 1); + this.field_110703_f.setRotationPoint(0.0F, 4.0F, -10.0F); + this.func_110682_a(this.field_110703_f, 0.5235988F, 0.0F, 0.2617994F); + this.field_110704_g = new ModelRenderer(this, 0, 12); + this.field_110704_g.addBox(0.0F, -16.0F, 4.0F, 2, 7, 1); + this.field_110704_g.setRotationPoint(0.0F, 4.0F, -10.0F); + this.func_110682_a(this.field_110704_g, 0.5235988F, 0.0F, -0.2617994F); + this.neck = new ModelRenderer(this, 0, 12); + this.neck.addBox(-2.05F, -9.8F, -2.0F, 4, 14, 8); + this.neck.setRotationPoint(0.0F, 4.0F, -10.0F); + this.func_110682_a(this.neck, 0.5235988F, 0.0F, 0.0F); + this.field_110687_G = new ModelRenderer(this, 0, 34); + this.field_110687_G.addBox(-3.0F, 0.0F, 0.0F, 8, 8, 3); + this.field_110687_G.setRotationPoint(-7.5F, 3.0F, 10.0F); + this.func_110682_a(this.field_110687_G, 0.0F, ((float)Math.PI / 2F), 0.0F); + this.field_110695_H = new ModelRenderer(this, 0, 47); + this.field_110695_H.addBox(-3.0F, 0.0F, 0.0F, 8, 8, 3); + this.field_110695_H.setRotationPoint(4.5F, 3.0F, 10.0F); + this.func_110682_a(this.field_110695_H, 0.0F, ((float)Math.PI / 2F), 0.0F); + this.field_110696_I = new ModelRenderer(this, 80, 0); + this.field_110696_I.addBox(-5.0F, 0.0F, -3.0F, 10, 1, 8); + this.field_110696_I.setRotationPoint(0.0F, 2.0F, 2.0F); + this.field_110697_J = new ModelRenderer(this, 106, 9); + this.field_110697_J.addBox(-1.5F, -1.0F, -3.0F, 3, 1, 2); + this.field_110697_J.setRotationPoint(0.0F, 2.0F, 2.0F); + this.field_110698_K = new ModelRenderer(this, 80, 9); + this.field_110698_K.addBox(-4.0F, -1.0F, 3.0F, 8, 1, 2); + this.field_110698_K.setRotationPoint(0.0F, 2.0F, 2.0F); + this.field_110692_M = new ModelRenderer(this, 74, 0); + this.field_110692_M.addBox(-0.5F, 6.0F, -1.0F, 1, 2, 2); + this.field_110692_M.setRotationPoint(5.0F, 3.0F, 2.0F); + this.field_110691_L = new ModelRenderer(this, 70, 0); + this.field_110691_L.addBox(-0.5F, 0.0F, -0.5F, 1, 6, 1); + this.field_110691_L.setRotationPoint(5.0F, 3.0F, 2.0F); + this.field_110694_O = new ModelRenderer(this, 74, 4); + this.field_110694_O.addBox(-0.5F, 6.0F, -1.0F, 1, 2, 2); + this.field_110694_O.setRotationPoint(-5.0F, 3.0F, 2.0F); + this.field_110693_N = new ModelRenderer(this, 80, 0); + this.field_110693_N.addBox(-0.5F, 0.0F, -0.5F, 1, 6, 1); + this.field_110693_N.setRotationPoint(-5.0F, 3.0F, 2.0F); + this.field_110700_P = new ModelRenderer(this, 74, 13); + this.field_110700_P.addBox(1.5F, -8.0F, -4.0F, 1, 2, 2); + this.field_110700_P.setRotationPoint(0.0F, 4.0F, -10.0F); + this.func_110682_a(this.field_110700_P, 0.5235988F, 0.0F, 0.0F); + this.field_110699_Q = new ModelRenderer(this, 74, 13); + this.field_110699_Q.addBox(-2.5F, -8.0F, -4.0F, 1, 2, 2); + this.field_110699_Q.setRotationPoint(0.0F, 4.0F, -10.0F); + this.func_110682_a(this.field_110699_Q, 0.5235988F, 0.0F, 0.0F); + this.field_110702_R = new ModelRenderer(this, 44, 10); + this.field_110702_R.addBox(2.6F, -6.0F, -6.0F, 0, 3, 16); + this.field_110702_R.setRotationPoint(0.0F, 4.0F, -10.0F); + this.field_110701_S = new ModelRenderer(this, 44, 5); + this.field_110701_S.addBox(-2.6F, -6.0F, -6.0F, 0, 3, 16); + this.field_110701_S.setRotationPoint(0.0F, 4.0F, -10.0F); + this.mane = new ModelRenderer(this, 58, 0); + this.mane.addBox(-1.0F, -11.5F, 5.0F, 2, 16, 4); + this.mane.setRotationPoint(0.0F, 4.0F, -10.0F); + this.func_110682_a(this.mane, 0.5235988F, 0.0F, 0.0F); + this.field_110717_i = new ModelRenderer(this, 80, 12); + this.field_110717_i.addBox(-2.5F, -10.1F, -7.0F, 5, 5, 12, 0.2F); + this.field_110717_i.setRotationPoint(0.0F, 4.0F, -10.0F); + this.func_110682_a(this.field_110717_i, 0.5235988F, 0.0F, 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + EntityHorse var8 = (EntityHorse)par1Entity; + int var9 = var8.getHorseType(); + float var10 = var8.getGrassEatingAmount(0.0F); + boolean var11 = var8.isAdultHorse(); + boolean var12 = var11 && var8.isHorseSaddled(); + boolean var13 = var11 && var8.isChested(); + boolean var14 = var9 == 1 || var9 == 2; + float var15 = var8.getHorseSize(); + boolean var16 = var8.riddenByEntity != null; + + if (var12) + { + this.field_110717_i.render(par7); + this.field_110696_I.render(par7); + this.field_110697_J.render(par7); + this.field_110698_K.render(par7); + this.field_110691_L.render(par7); + this.field_110692_M.render(par7); + this.field_110693_N.render(par7); + this.field_110694_O.render(par7); + this.field_110700_P.render(par7); + this.field_110699_Q.render(par7); + + if (var16) + { + this.field_110702_R.render(par7); + this.field_110701_S.render(par7); + } + } + + if (!var11) + { + GL11.glPushMatrix(); + GL11.glScalef(var15, 0.5F + var15 * 0.5F, var15); + GL11.glTranslatef(0.0F, 0.95F * (1.0F - var15), 0.0F); + } + + this.backLeftLeg.render(par7); + this.backLeftShin.render(par7); + this.backLeftHoof.render(par7); + this.backRightLeg.render(par7); + this.backRightShin.render(par7); + this.backRightHoof.render(par7); + this.frontRightLeg.render(par7); + this.frontLeftShin.render(par7); + this.frontLeftHoof.render(par7); + this.field_110684_D.render(par7); + this.frontRightShin.render(par7); + this.frontRightHoof.render(par7); + + if (!var11) + { + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glScalef(var15, var15, var15); + GL11.glTranslatef(0.0F, 1.35F * (1.0F - var15), 0.0F); + } + + this.body.render(par7); + this.tailBase.render(par7); + this.tailMiddle.render(par7); + this.tailTip.render(par7); + this.neck.render(par7); + this.mane.render(par7); + + if (!var11) + { + GL11.glPopMatrix(); + GL11.glPushMatrix(); + float var17 = 0.5F + var15 * var15 * 0.5F; + GL11.glScalef(var17, var17, var17); + + if (var10 <= 0.0F) + { + GL11.glTranslatef(0.0F, 1.35F * (1.0F - var15), 0.0F); + } + else + { + GL11.glTranslatef(0.0F, 0.9F * (1.0F - var15) * var10 + 1.35F * (1.0F - var15) * (1.0F - var10), 0.15F * (1.0F - var15) * var10); + } + } + + if (var14) + { + this.field_110703_f.render(par7); + this.field_110704_g.render(par7); + } + else + { + this.horseLeftEar.render(par7); + this.horseRightEar.render(par7); + } + + this.head.render(par7); + + if (!var11) + { + GL11.glPopMatrix(); + } + + if (var13) + { + this.field_110687_G.render(par7); + this.field_110695_H.render(par7); + } + } + + private void func_110682_a(ModelRenderer par1ModelRenderer, float par2, float par3, float par4) + { + par1ModelRenderer.rotateAngleX = par2; + par1ModelRenderer.rotateAngleY = par3; + par1ModelRenderer.rotateAngleZ = par4; + } + + private float func_110683_a(float par1, float par2, float par3) + { + float var4; + + for (var4 = par2 - par1; var4 < -180.0F; var4 += 360.0F) + { + ; + } + + while (var4 >= 180.0F) + { + var4 -= 360.0F; + } + + return par1 + par3 * var4; + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + super.setLivingAnimations(par1EntityLivingBase, par2, par3, par4); + float var5 = this.func_110683_a(par1EntityLivingBase.prevRenderYawOffset, par1EntityLivingBase.renderYawOffset, par4); + float var6 = this.func_110683_a(par1EntityLivingBase.prevRotationYawHead, par1EntityLivingBase.rotationYawHead, par4); + float var7 = par1EntityLivingBase.prevRotationPitch + (par1EntityLivingBase.rotationPitch - par1EntityLivingBase.prevRotationPitch) * par4; + float var8 = var6 - var5; + float var9 = var7 / (180F / (float)Math.PI); + + if (var8 > 20.0F) + { + var8 = 20.0F; + } + + if (var8 < -20.0F) + { + var8 = -20.0F; + } + + if (par3 > 0.2F) + { + var9 += MathHelper.cos(par2 * 0.4F) * 0.15F * par3; + } + + EntityHorse var10 = (EntityHorse)par1EntityLivingBase; + float var11 = var10.getGrassEatingAmount(par4); + float var12 = var10.getRearingAmount(par4); + float var13 = 1.0F - var12; + float var14 = var10.func_110201_q(par4); + boolean var15 = var10.field_110278_bp != 0; + boolean var16 = var10.isHorseSaddled(); + boolean var17 = var10.riddenByEntity != null; + float var18 = (float)par1EntityLivingBase.ticksExisted + par4; + float var19 = MathHelper.cos(par2 * 0.6662F + (float)Math.PI); + float var20 = var19 * 0.8F * par3; + this.head.rotationPointY = 4.0F; + this.head.rotationPointZ = -10.0F; + this.tailBase.rotationPointY = 3.0F; + this.tailMiddle.rotationPointZ = 14.0F; + this.field_110695_H.rotationPointY = 3.0F; + this.field_110695_H.rotationPointZ = 10.0F; + this.body.rotateAngleX = 0.0F; + this.head.rotateAngleX = 0.5235988F + var9; + this.head.rotateAngleY = var8 / (180F / (float)Math.PI); + this.head.rotateAngleX = var12 * (0.2617994F + var9) + var11 * 2.18166F + (1.0F - Math.max(var12, var11)) * this.head.rotateAngleX; + this.head.rotateAngleY = var12 * (var8 / (180F / (float)Math.PI)) + (1.0F - Math.max(var12, var11)) * this.head.rotateAngleY; + this.head.rotationPointY = var12 * -6.0F + var11 * 11.0F + (1.0F - Math.max(var12, var11)) * this.head.rotationPointY; + this.head.rotationPointZ = var12 * -1.0F + var11 * -10.0F + (1.0F - Math.max(var12, var11)) * this.head.rotationPointZ; + this.tailBase.rotationPointY = var12 * 9.0F + var13 * this.tailBase.rotationPointY; + this.tailMiddle.rotationPointZ = var12 * 18.0F + var13 * this.tailMiddle.rotationPointZ; + this.field_110695_H.rotationPointY = var12 * 5.5F + var13 * this.field_110695_H.rotationPointY; + this.field_110695_H.rotationPointZ = var12 * 15.0F + var13 * this.field_110695_H.rotationPointZ; + this.body.rotateAngleX = var12 * -((float)Math.PI / 4F) + var13 * this.body.rotateAngleX; + this.horseLeftEar.rotationPointY = this.head.rotationPointY; + this.horseRightEar.rotationPointY = this.head.rotationPointY; + this.field_110703_f.rotationPointY = this.head.rotationPointY; + this.field_110704_g.rotationPointY = this.head.rotationPointY; + this.neck.rotationPointY = this.head.rotationPointY; + this.mouthTop.rotationPointY = 0.02F; + this.mouthBottom.rotationPointY = 0.0F; + this.mane.rotationPointY = this.head.rotationPointY; + this.horseLeftEar.rotationPointZ = this.head.rotationPointZ; + this.horseRightEar.rotationPointZ = this.head.rotationPointZ; + this.field_110703_f.rotationPointZ = this.head.rotationPointZ; + this.field_110704_g.rotationPointZ = this.head.rotationPointZ; + this.neck.rotationPointZ = this.head.rotationPointZ; + this.mouthTop.rotationPointZ = 0.02F - var14 * 1.0F; + this.mouthBottom.rotationPointZ = 0.0F + var14 * 1.0F; + this.mane.rotationPointZ = this.head.rotationPointZ; + this.horseLeftEar.rotateAngleX = this.head.rotateAngleX; + this.horseRightEar.rotateAngleX = this.head.rotateAngleX; + this.field_110703_f.rotateAngleX = this.head.rotateAngleX; + this.field_110704_g.rotateAngleX = this.head.rotateAngleX; + this.neck.rotateAngleX = this.head.rotateAngleX; + this.mouthTop.rotateAngleX = 0.0F - 0.09424778F * var14; + this.mouthBottom.rotateAngleX = 0.0F + 0.15707964F * var14; + this.mane.rotateAngleX = this.head.rotateAngleX; + this.horseLeftEar.rotateAngleY = this.head.rotateAngleY; + this.horseRightEar.rotateAngleY = this.head.rotateAngleY; + this.field_110703_f.rotateAngleY = this.head.rotateAngleY; + this.field_110704_g.rotateAngleY = this.head.rotateAngleY; + this.neck.rotateAngleY = this.head.rotateAngleY; + this.mouthTop.rotateAngleY = 0.0F; + this.mouthBottom.rotateAngleY = 0.0F; + this.mane.rotateAngleY = this.head.rotateAngleY; + this.field_110687_G.rotateAngleX = var20 / 5.0F; + this.field_110695_H.rotateAngleX = -var20 / 5.0F; + float var21 = ((float)Math.PI / 2F); + float var22 = ((float)Math.PI * 3F / 2F); + float var23 = -1.0471976F; + float var24 = 0.2617994F * var12; + float var25 = MathHelper.cos(var18 * 0.6F + (float)Math.PI); + this.frontRightLeg.rotationPointY = -2.0F * var12 + 9.0F * var13; + this.frontRightLeg.rotationPointZ = -2.0F * var12 + -8.0F * var13; + this.field_110684_D.rotationPointY = this.frontRightLeg.rotationPointY; + this.field_110684_D.rotationPointZ = this.frontRightLeg.rotationPointZ; + this.backLeftShin.rotationPointY = this.backLeftLeg.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + var24 + var13 * -var19 * 0.5F * par3) * 7.0F; + this.backLeftShin.rotationPointZ = this.backLeftLeg.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + var24 + var13 * -var19 * 0.5F * par3) * 7.0F; + this.backRightShin.rotationPointY = this.backRightLeg.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + var24 + var13 * var19 * 0.5F * par3) * 7.0F; + this.backRightShin.rotationPointZ = this.backRightLeg.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + var24 + var13 * var19 * 0.5F * par3) * 7.0F; + float var26 = (-1.0471976F + var25) * var12 + var20 * var13; + float var27 = (-1.0471976F + -var25) * var12 + -var20 * var13; + this.frontLeftShin.rotationPointY = this.frontRightLeg.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + var26) * 7.0F; + this.frontLeftShin.rotationPointZ = this.frontRightLeg.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + var26) * 7.0F; + this.frontRightShin.rotationPointY = this.field_110684_D.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + var27) * 7.0F; + this.frontRightShin.rotationPointZ = this.field_110684_D.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + var27) * 7.0F; + this.backLeftLeg.rotateAngleX = var24 + -var19 * 0.5F * par3 * var13; + this.backLeftShin.rotateAngleX = -0.08726646F * var12 + (-var19 * 0.5F * par3 - Math.max(0.0F, var19 * 0.5F * par3)) * var13; + this.backLeftHoof.rotateAngleX = this.backLeftShin.rotateAngleX; + this.backRightLeg.rotateAngleX = var24 + var19 * 0.5F * par3 * var13; + this.backRightShin.rotateAngleX = -0.08726646F * var12 + (var19 * 0.5F * par3 - Math.max(0.0F, -var19 * 0.5F * par3)) * var13; + this.backRightHoof.rotateAngleX = this.backRightShin.rotateAngleX; + this.frontRightLeg.rotateAngleX = var26; + this.frontLeftShin.rotateAngleX = (this.frontRightLeg.rotateAngleX + (float)Math.PI * Math.max(0.0F, 0.2F + var25 * 0.2F)) * var12 + (var20 + Math.max(0.0F, var19 * 0.5F * par3)) * var13; + this.frontLeftHoof.rotateAngleX = this.frontLeftShin.rotateAngleX; + this.field_110684_D.rotateAngleX = var27; + this.frontRightShin.rotateAngleX = (this.field_110684_D.rotateAngleX + (float)Math.PI * Math.max(0.0F, 0.2F - var25 * 0.2F)) * var12 + (-var20 + Math.max(0.0F, -var19 * 0.5F * par3)) * var13; + this.frontRightHoof.rotateAngleX = this.frontRightShin.rotateAngleX; + this.backLeftHoof.rotationPointY = this.backLeftShin.rotationPointY; + this.backLeftHoof.rotationPointZ = this.backLeftShin.rotationPointZ; + this.backRightHoof.rotationPointY = this.backRightShin.rotationPointY; + this.backRightHoof.rotationPointZ = this.backRightShin.rotationPointZ; + this.frontLeftHoof.rotationPointY = this.frontLeftShin.rotationPointY; + this.frontLeftHoof.rotationPointZ = this.frontLeftShin.rotationPointZ; + this.frontRightHoof.rotationPointY = this.frontRightShin.rotationPointY; + this.frontRightHoof.rotationPointZ = this.frontRightShin.rotationPointZ; + + if (var16) + { + this.field_110696_I.rotationPointY = var12 * 0.5F + var13 * 2.0F; + this.field_110696_I.rotationPointZ = var12 * 11.0F + var13 * 2.0F; + this.field_110697_J.rotationPointY = this.field_110696_I.rotationPointY; + this.field_110698_K.rotationPointY = this.field_110696_I.rotationPointY; + this.field_110691_L.rotationPointY = this.field_110696_I.rotationPointY; + this.field_110693_N.rotationPointY = this.field_110696_I.rotationPointY; + this.field_110692_M.rotationPointY = this.field_110696_I.rotationPointY; + this.field_110694_O.rotationPointY = this.field_110696_I.rotationPointY; + this.field_110687_G.rotationPointY = this.field_110695_H.rotationPointY; + this.field_110697_J.rotationPointZ = this.field_110696_I.rotationPointZ; + this.field_110698_K.rotationPointZ = this.field_110696_I.rotationPointZ; + this.field_110691_L.rotationPointZ = this.field_110696_I.rotationPointZ; + this.field_110693_N.rotationPointZ = this.field_110696_I.rotationPointZ; + this.field_110692_M.rotationPointZ = this.field_110696_I.rotationPointZ; + this.field_110694_O.rotationPointZ = this.field_110696_I.rotationPointZ; + this.field_110687_G.rotationPointZ = this.field_110695_H.rotationPointZ; + this.field_110696_I.rotateAngleX = this.body.rotateAngleX; + this.field_110697_J.rotateAngleX = this.body.rotateAngleX; + this.field_110698_K.rotateAngleX = this.body.rotateAngleX; + this.field_110702_R.rotationPointY = this.head.rotationPointY; + this.field_110701_S.rotationPointY = this.head.rotationPointY; + this.field_110717_i.rotationPointY = this.head.rotationPointY; + this.field_110700_P.rotationPointY = this.head.rotationPointY; + this.field_110699_Q.rotationPointY = this.head.rotationPointY; + this.field_110702_R.rotationPointZ = this.head.rotationPointZ; + this.field_110701_S.rotationPointZ = this.head.rotationPointZ; + this.field_110717_i.rotationPointZ = this.head.rotationPointZ; + this.field_110700_P.rotationPointZ = this.head.rotationPointZ; + this.field_110699_Q.rotationPointZ = this.head.rotationPointZ; + this.field_110702_R.rotateAngleX = var9; + this.field_110701_S.rotateAngleX = var9; + this.field_110717_i.rotateAngleX = this.head.rotateAngleX; + this.field_110700_P.rotateAngleX = this.head.rotateAngleX; + this.field_110699_Q.rotateAngleX = this.head.rotateAngleX; + this.field_110717_i.rotateAngleY = this.head.rotateAngleY; + this.field_110700_P.rotateAngleY = this.head.rotateAngleY; + this.field_110702_R.rotateAngleY = this.head.rotateAngleY; + this.field_110699_Q.rotateAngleY = this.head.rotateAngleY; + this.field_110701_S.rotateAngleY = this.head.rotateAngleY; + + if (var17) + { + this.field_110691_L.rotateAngleX = -1.0471976F; + this.field_110692_M.rotateAngleX = -1.0471976F; + this.field_110693_N.rotateAngleX = -1.0471976F; + this.field_110694_O.rotateAngleX = -1.0471976F; + this.field_110691_L.rotateAngleZ = 0.0F; + this.field_110692_M.rotateAngleZ = 0.0F; + this.field_110693_N.rotateAngleZ = 0.0F; + this.field_110694_O.rotateAngleZ = 0.0F; + } + else + { + this.field_110691_L.rotateAngleX = var20 / 3.0F; + this.field_110692_M.rotateAngleX = var20 / 3.0F; + this.field_110693_N.rotateAngleX = var20 / 3.0F; + this.field_110694_O.rotateAngleX = var20 / 3.0F; + this.field_110691_L.rotateAngleZ = var20 / 5.0F; + this.field_110692_M.rotateAngleZ = var20 / 5.0F; + this.field_110693_N.rotateAngleZ = -var20 / 5.0F; + this.field_110694_O.rotateAngleZ = -var20 / 5.0F; + } + } + + var21 = -1.3089F + par3 * 1.5F; + + if (var21 > 0.0F) + { + var21 = 0.0F; + } + + if (var15) + { + this.tailBase.rotateAngleY = MathHelper.cos(var18 * 0.7F); + var21 = 0.0F; + } + else + { + this.tailBase.rotateAngleY = 0.0F; + } + + this.tailMiddle.rotateAngleY = this.tailBase.rotateAngleY; + this.tailTip.rotateAngleY = this.tailBase.rotateAngleY; + this.tailMiddle.rotationPointY = this.tailBase.rotationPointY; + this.tailTip.rotationPointY = this.tailBase.rotationPointY; + this.tailMiddle.rotationPointZ = this.tailBase.rotationPointZ; + this.tailTip.rotationPointZ = this.tailBase.rotationPointZ; + this.tailBase.rotateAngleX = var21; + this.tailMiddle.rotateAngleX = var21; + this.tailTip.rotateAngleX = -0.2618F + var21; + } +} diff --git a/src/main/java/net/minecraft/src/ModelIronGolem.java b/src/main/java/net/minecraft/src/ModelIronGolem.java new file mode 100644 index 0000000..88a0221 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelIronGolem.java @@ -0,0 +1,124 @@ +package net.minecraft.src; + +public class ModelIronGolem extends ModelBase +{ + /** The head model for the iron golem. */ + public ModelRenderer ironGolemHead; + + /** The body model for the iron golem. */ + public ModelRenderer ironGolemBody; + + /** The right arm model for the iron golem. */ + public ModelRenderer ironGolemRightArm; + + /** The left arm model for the iron golem. */ + public ModelRenderer ironGolemLeftArm; + + /** The left leg model for the Iron Golem. */ + public ModelRenderer ironGolemLeftLeg; + + /** The right leg model for the Iron Golem. */ + public ModelRenderer ironGolemRightLeg; + + public ModelIronGolem() + { + this(0.0F); + } + + public ModelIronGolem(float par1) + { + this(par1, -7.0F); + } + + public ModelIronGolem(float par1, float par2) + { + short var3 = 128; + short var4 = 128; + this.ironGolemHead = (new ModelRenderer(this)).setTextureSize(var3, var4); + this.ironGolemHead.setRotationPoint(0.0F, 0.0F + par2, -2.0F); + this.ironGolemHead.setTextureOffset(0, 0).addBox(-4.0F, -12.0F, -5.5F, 8, 10, 8, par1); + this.ironGolemHead.setTextureOffset(24, 0).addBox(-1.0F, -5.0F, -7.5F, 2, 4, 2, par1); + this.ironGolemBody = (new ModelRenderer(this)).setTextureSize(var3, var4); + this.ironGolemBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F); + this.ironGolemBody.setTextureOffset(0, 40).addBox(-9.0F, -2.0F, -6.0F, 18, 12, 11, par1); + this.ironGolemBody.setTextureOffset(0, 70).addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, par1 + 0.5F); + this.ironGolemRightArm = (new ModelRenderer(this)).setTextureSize(var3, var4); + this.ironGolemRightArm.setRotationPoint(0.0F, -7.0F, 0.0F); + this.ironGolemRightArm.setTextureOffset(60, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 30, 6, par1); + this.ironGolemLeftArm = (new ModelRenderer(this)).setTextureSize(var3, var4); + this.ironGolemLeftArm.setRotationPoint(0.0F, -7.0F, 0.0F); + this.ironGolemLeftArm.setTextureOffset(60, 58).addBox(9.0F, -2.5F, -3.0F, 4, 30, 6, par1); + this.ironGolemLeftLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(var3, var4); + this.ironGolemLeftLeg.setRotationPoint(-4.0F, 18.0F + par2, 0.0F); + this.ironGolemLeftLeg.setTextureOffset(37, 0).addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1); + this.ironGolemRightLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(var3, var4); + this.ironGolemRightLeg.mirror = true; + this.ironGolemRightLeg.setTextureOffset(60, 0).setRotationPoint(5.0F, 18.0F + par2, 0.0F); + this.ironGolemRightLeg.addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.ironGolemHead.render(par7); + this.ironGolemBody.render(par7); + this.ironGolemLeftLeg.render(par7); + this.ironGolemRightLeg.render(par7); + this.ironGolemRightArm.render(par7); + this.ironGolemLeftArm.render(par7); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + this.ironGolemHead.rotateAngleY = par4 / (180F / (float)Math.PI); + this.ironGolemHead.rotateAngleX = par5 / (180F / (float)Math.PI); + this.ironGolemLeftLeg.rotateAngleX = -1.5F * this.func_78172_a(par1, 13.0F) * par2; + this.ironGolemRightLeg.rotateAngleX = 1.5F * this.func_78172_a(par1, 13.0F) * par2; + this.ironGolemLeftLeg.rotateAngleY = 0.0F; + this.ironGolemRightLeg.rotateAngleY = 0.0F; + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + EntityIronGolem var5 = (EntityIronGolem)par1EntityLivingBase; + int var6 = var5.getAttackTimer(); + + if (var6 > 0) + { + this.ironGolemRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)var6 - par4, 10.0F); + this.ironGolemLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)var6 - par4, 10.0F); + } + else + { + int var7 = var5.getHoldRoseTick(); + + if (var7 > 0) + { + this.ironGolemRightArm.rotateAngleX = -0.8F + 0.025F * this.func_78172_a((float)var7, 70.0F); + this.ironGolemLeftArm.rotateAngleX = 0.0F; + } + else + { + this.ironGolemRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(par2, 13.0F)) * par3; + this.ironGolemLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(par2, 13.0F)) * par3; + } + } + } + + private float func_78172_a(float par1, float par2) + { + return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F); + } +} diff --git a/src/main/java/net/minecraft/src/ModelLargeChest.java b/src/main/java/net/minecraft/src/ModelLargeChest.java new file mode 100644 index 0000000..2ff9f06 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelLargeChest.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +public class ModelLargeChest extends ModelChest +{ + public ModelLargeChest() + { + this.chestLid = (new ModelRenderer(this, 0, 0)).setTextureSize(128, 64); + this.chestLid.addBox(0.0F, -5.0F, -14.0F, 30, 5, 14, 0.0F); + this.chestLid.rotationPointX = 1.0F; + this.chestLid.rotationPointY = 7.0F; + this.chestLid.rotationPointZ = 15.0F; + this.chestKnob = (new ModelRenderer(this, 0, 0)).setTextureSize(128, 64); + this.chestKnob.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F); + this.chestKnob.rotationPointX = 16.0F; + this.chestKnob.rotationPointY = 7.0F; + this.chestKnob.rotationPointZ = 15.0F; + this.chestBelow = (new ModelRenderer(this, 0, 19)).setTextureSize(128, 64); + this.chestBelow.addBox(0.0F, 0.0F, 0.0F, 30, 10, 14, 0.0F); + this.chestBelow.rotationPointX = 1.0F; + this.chestBelow.rotationPointY = 6.0F; + this.chestBelow.rotationPointZ = 1.0F; + } +} diff --git a/src/main/java/net/minecraft/src/ModelLeashKnot.java b/src/main/java/net/minecraft/src/ModelLeashKnot.java new file mode 100644 index 0000000..9f21ed5 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelLeashKnot.java @@ -0,0 +1,41 @@ +package net.minecraft.src; + +public class ModelLeashKnot extends ModelBase +{ + public ModelRenderer field_110723_a; + + public ModelLeashKnot() + { + this(0, 0, 32, 32); + } + + public ModelLeashKnot(int par1, int par2, int par3, int par4) + { + this.textureWidth = par3; + this.textureHeight = par4; + this.field_110723_a = new ModelRenderer(this, par1, par2); + this.field_110723_a.addBox(-3.0F, -6.0F, -3.0F, 6, 8, 6, 0.0F); + this.field_110723_a.setRotationPoint(0.0F, 0.0F, 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.field_110723_a.render(par7); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + this.field_110723_a.rotateAngleY = par4 / (180F / (float)Math.PI); + this.field_110723_a.rotateAngleX = par5 / (180F / (float)Math.PI); + } +} diff --git a/src/main/java/net/minecraft/src/ModelMagmaCube.java b/src/main/java/net/minecraft/src/ModelMagmaCube.java new file mode 100644 index 0000000..94788ef --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelMagmaCube.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +public class ModelMagmaCube extends ModelBase +{ + ModelRenderer[] field_78109_a = new ModelRenderer[8]; + ModelRenderer field_78108_b; + + public ModelMagmaCube() + { + for (int var1 = 0; var1 < this.field_78109_a.length; ++var1) + { + byte var2 = 0; + int var3 = var1; + + if (var1 == 2) + { + var2 = 24; + var3 = 10; + } + else if (var1 == 3) + { + var2 = 24; + var3 = 19; + } + + this.field_78109_a[var1] = new ModelRenderer(this, var2, var3); + this.field_78109_a[var1].addBox(-4.0F, (float)(16 + var1), -4.0F, 8, 1, 8); + } + + this.field_78108_b = new ModelRenderer(this, 0, 16); + this.field_78108_b.addBox(-2.0F, 18.0F, -2.0F, 4, 4, 4); + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + EntityMagmaCube var5 = (EntityMagmaCube)par1EntityLivingBase; + float var6 = var5.prevSquishFactor + (var5.squishFactor - var5.prevSquishFactor) * par4; + + if (var6 < 0.0F) + { + var6 = 0.0F; + } + + for (int var7 = 0; var7 < this.field_78109_a.length; ++var7) + { + this.field_78109_a[var7].rotationPointY = (float)(-(4 - var7)) * var6 * 1.7F; + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.field_78108_b.render(par7); + + for (int var8 = 0; var8 < this.field_78109_a.length; ++var8) + { + this.field_78109_a[var8].render(par7); + } + } +} diff --git a/src/main/java/net/minecraft/src/ModelMinecart.java b/src/main/java/net/minecraft/src/ModelMinecart.java new file mode 100644 index 0000000..8d83ff4 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelMinecart.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +public class ModelMinecart extends ModelBase +{ + public ModelRenderer[] sideModels = new ModelRenderer[7]; + + public ModelMinecart() + { + this.sideModels[0] = new ModelRenderer(this, 0, 10); + this.sideModels[1] = new ModelRenderer(this, 0, 0); + this.sideModels[2] = new ModelRenderer(this, 0, 0); + this.sideModels[3] = new ModelRenderer(this, 0, 0); + this.sideModels[4] = new ModelRenderer(this, 0, 0); + this.sideModels[5] = new ModelRenderer(this, 44, 10); + byte var1 = 20; + byte var2 = 8; + byte var3 = 16; + byte var4 = 4; + this.sideModels[0].addBox((float)(-var1 / 2), (float)(-var3 / 2), -1.0F, var1, var3, 2, 0.0F); + this.sideModels[0].setRotationPoint(0.0F, (float)var4, 0.0F); + this.sideModels[5].addBox((float)(-var1 / 2 + 1), (float)(-var3 / 2 + 1), -1.0F, var1 - 2, var3 - 2, 1, 0.0F); + this.sideModels[5].setRotationPoint(0.0F, (float)var4, 0.0F); + this.sideModels[1].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.sideModels[1].setRotationPoint((float)(-var1 / 2 + 1), (float)var4, 0.0F); + this.sideModels[2].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.sideModels[2].setRotationPoint((float)(var1 / 2 - 1), (float)var4, 0.0F); + this.sideModels[3].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.sideModels[3].setRotationPoint(0.0F, (float)var4, (float)(-var3 / 2 + 1)); + this.sideModels[4].addBox((float)(-var1 / 2 + 2), (float)(-var2 - 1), -1.0F, var1 - 4, var2, 2, 0.0F); + this.sideModels[4].setRotationPoint(0.0F, (float)var4, (float)(var3 / 2 - 1)); + this.sideModels[0].rotateAngleX = ((float)Math.PI / 2F); + this.sideModels[1].rotateAngleY = ((float)Math.PI * 3F / 2F); + this.sideModels[2].rotateAngleY = ((float)Math.PI / 2F); + this.sideModels[3].rotateAngleY = (float)Math.PI; + this.sideModels[5].rotateAngleX = -((float)Math.PI / 2F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.sideModels[5].rotationPointY = 4.0F - par4; + + for (int var8 = 0; var8 < 6; ++var8) + { + this.sideModels[var8].render(par7); + } + } +} diff --git a/src/main/java/net/minecraft/src/ModelOcelot.java b/src/main/java/net/minecraft/src/ModelOcelot.java new file mode 100644 index 0000000..0a33343 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelOcelot.java @@ -0,0 +1,215 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class ModelOcelot extends ModelBase +{ + /** The back left leg model for the Ocelot. */ + ModelRenderer ocelotBackLeftLeg; + + /** The back right leg model for the Ocelot. */ + ModelRenderer ocelotBackRightLeg; + + /** The front left leg model for the Ocelot. */ + ModelRenderer ocelotFrontLeftLeg; + + /** The front right leg model for the Ocelot. */ + ModelRenderer ocelotFrontRightLeg; + + /** The tail model for the Ocelot. */ + ModelRenderer ocelotTail; + + /** The second part of tail model for the Ocelot. */ + ModelRenderer ocelotTail2; + + /** The head model for the Ocelot. */ + ModelRenderer ocelotHead; + + /** The body model for the Ocelot. */ + ModelRenderer ocelotBody; + int field_78163_i = 1; + + public ModelOcelot() + { + this.setTextureOffset("head.main", 0, 0); + this.setTextureOffset("head.nose", 0, 24); + this.setTextureOffset("head.ear1", 0, 10); + this.setTextureOffset("head.ear2", 6, 10); + this.ocelotHead = new ModelRenderer(this, "head"); + this.ocelotHead.addBox("main", -2.5F, -2.0F, -3.0F, 5, 4, 5); + this.ocelotHead.addBox("nose", -1.5F, 0.0F, -4.0F, 3, 2, 2); + this.ocelotHead.addBox("ear1", -2.0F, -3.0F, 0.0F, 1, 1, 2); + this.ocelotHead.addBox("ear2", 1.0F, -3.0F, 0.0F, 1, 1, 2); + this.ocelotHead.setRotationPoint(0.0F, 15.0F, -9.0F); + this.ocelotBody = new ModelRenderer(this, 20, 0); + this.ocelotBody.addBox(-2.0F, 3.0F, -8.0F, 4, 16, 6, 0.0F); + this.ocelotBody.setRotationPoint(0.0F, 12.0F, -10.0F); + this.ocelotTail = new ModelRenderer(this, 0, 15); + this.ocelotTail.addBox(-0.5F, 0.0F, 0.0F, 1, 8, 1); + this.ocelotTail.rotateAngleX = 0.9F; + this.ocelotTail.setRotationPoint(0.0F, 15.0F, 8.0F); + this.ocelotTail2 = new ModelRenderer(this, 4, 15); + this.ocelotTail2.addBox(-0.5F, 0.0F, 0.0F, 1, 8, 1); + this.ocelotTail2.setRotationPoint(0.0F, 20.0F, 14.0F); + this.ocelotBackLeftLeg = new ModelRenderer(this, 8, 13); + this.ocelotBackLeftLeg.addBox(-1.0F, 0.0F, 1.0F, 2, 6, 2); + this.ocelotBackLeftLeg.setRotationPoint(1.1F, 18.0F, 5.0F); + this.ocelotBackRightLeg = new ModelRenderer(this, 8, 13); + this.ocelotBackRightLeg.addBox(-1.0F, 0.0F, 1.0F, 2, 6, 2); + this.ocelotBackRightLeg.setRotationPoint(-1.1F, 18.0F, 5.0F); + this.ocelotFrontLeftLeg = new ModelRenderer(this, 40, 0); + this.ocelotFrontLeftLeg.addBox(-1.0F, 0.0F, 0.0F, 2, 10, 2); + this.ocelotFrontLeftLeg.setRotationPoint(1.2F, 13.8F, -5.0F); + this.ocelotFrontRightLeg = new ModelRenderer(this, 40, 0); + this.ocelotFrontRightLeg.addBox(-1.0F, 0.0F, 0.0F, 2, 10, 2); + this.ocelotFrontRightLeg.setRotationPoint(-1.2F, 13.8F, -5.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + + if (this.isChild) + { + float var8 = 2.0F; + GL11.glPushMatrix(); + GL11.glScalef(1.5F / var8, 1.5F / var8, 1.5F / var8); + GL11.glTranslatef(0.0F, 10.0F * par7, 4.0F * par7); + this.ocelotHead.render(par7); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glScalef(1.0F / var8, 1.0F / var8, 1.0F / var8); + GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F); + this.ocelotBody.render(par7); + this.ocelotBackLeftLeg.render(par7); + this.ocelotBackRightLeg.render(par7); + this.ocelotFrontLeftLeg.render(par7); + this.ocelotFrontRightLeg.render(par7); + this.ocelotTail.render(par7); + this.ocelotTail2.render(par7); + GL11.glPopMatrix(); + } + else + { + this.ocelotHead.render(par7); + this.ocelotBody.render(par7); + this.ocelotTail.render(par7); + this.ocelotTail2.render(par7); + this.ocelotBackLeftLeg.render(par7); + this.ocelotBackRightLeg.render(par7); + this.ocelotFrontLeftLeg.render(par7); + this.ocelotFrontRightLeg.render(par7); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + this.ocelotHead.rotateAngleX = par5 / (180F / (float)Math.PI); + this.ocelotHead.rotateAngleY = par4 / (180F / (float)Math.PI); + + if (this.field_78163_i != 3) + { + this.ocelotBody.rotateAngleX = ((float)Math.PI / 2F); + + if (this.field_78163_i == 2) + { + this.ocelotBackLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.0F * par2; + this.ocelotBackRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + 0.3F) * 1.0F * par2; + this.ocelotFrontLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI + 0.3F) * 1.0F * par2; + this.ocelotFrontRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2; + this.ocelotTail2.rotateAngleX = 1.7278761F + ((float)Math.PI / 10F) * MathHelper.cos(par1) * par2; + } + else + { + this.ocelotBackLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.0F * par2; + this.ocelotBackRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2; + this.ocelotFrontLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.0F * par2; + this.ocelotFrontRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.0F * par2; + + if (this.field_78163_i == 1) + { + this.ocelotTail2.rotateAngleX = 1.7278761F + ((float)Math.PI / 4F) * MathHelper.cos(par1) * par2; + } + else + { + this.ocelotTail2.rotateAngleX = 1.7278761F + 0.47123894F * MathHelper.cos(par1) * par2; + } + } + } + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + EntityOcelot var5 = (EntityOcelot)par1EntityLivingBase; + this.ocelotBody.rotationPointY = 12.0F; + this.ocelotBody.rotationPointZ = -10.0F; + this.ocelotHead.rotationPointY = 15.0F; + this.ocelotHead.rotationPointZ = -9.0F; + this.ocelotTail.rotationPointY = 15.0F; + this.ocelotTail.rotationPointZ = 8.0F; + this.ocelotTail2.rotationPointY = 20.0F; + this.ocelotTail2.rotationPointZ = 14.0F; + this.ocelotFrontLeftLeg.rotationPointY = this.ocelotFrontRightLeg.rotationPointY = 13.8F; + this.ocelotFrontLeftLeg.rotationPointZ = this.ocelotFrontRightLeg.rotationPointZ = -5.0F; + this.ocelotBackLeftLeg.rotationPointY = this.ocelotBackRightLeg.rotationPointY = 18.0F; + this.ocelotBackLeftLeg.rotationPointZ = this.ocelotBackRightLeg.rotationPointZ = 5.0F; + this.ocelotTail.rotateAngleX = 0.9F; + + if (var5.isSneaking()) + { + ++this.ocelotBody.rotationPointY; + this.ocelotHead.rotationPointY += 2.0F; + ++this.ocelotTail.rotationPointY; + this.ocelotTail2.rotationPointY += -4.0F; + this.ocelotTail2.rotationPointZ += 2.0F; + this.ocelotTail.rotateAngleX = ((float)Math.PI / 2F); + this.ocelotTail2.rotateAngleX = ((float)Math.PI / 2F); + this.field_78163_i = 0; + } + else if (var5.isSprinting()) + { + this.ocelotTail2.rotationPointY = this.ocelotTail.rotationPointY; + this.ocelotTail2.rotationPointZ += 2.0F; + this.ocelotTail.rotateAngleX = ((float)Math.PI / 2F); + this.ocelotTail2.rotateAngleX = ((float)Math.PI / 2F); + this.field_78163_i = 2; + } + else if (var5.isSitting()) + { + this.ocelotBody.rotateAngleX = ((float)Math.PI / 4F); + this.ocelotBody.rotationPointY += -4.0F; + this.ocelotBody.rotationPointZ += 5.0F; + this.ocelotHead.rotationPointY += -3.3F; + ++this.ocelotHead.rotationPointZ; + this.ocelotTail.rotationPointY += 8.0F; + this.ocelotTail.rotationPointZ += -2.0F; + this.ocelotTail2.rotationPointY += 2.0F; + this.ocelotTail2.rotationPointZ += -0.8F; + this.ocelotTail.rotateAngleX = 1.7278761F; + this.ocelotTail2.rotateAngleX = 2.670354F; + this.ocelotFrontLeftLeg.rotateAngleX = this.ocelotFrontRightLeg.rotateAngleX = -0.15707964F; + this.ocelotFrontLeftLeg.rotationPointY = this.ocelotFrontRightLeg.rotationPointY = 15.8F; + this.ocelotFrontLeftLeg.rotationPointZ = this.ocelotFrontRightLeg.rotationPointZ = -7.0F; + this.ocelotBackLeftLeg.rotateAngleX = this.ocelotBackRightLeg.rotateAngleX = -((float)Math.PI / 2F); + this.ocelotBackLeftLeg.rotationPointY = this.ocelotBackRightLeg.rotationPointY = 21.0F; + this.ocelotBackLeftLeg.rotationPointZ = this.ocelotBackRightLeg.rotationPointZ = 1.0F; + this.field_78163_i = 3; + } + else + { + this.field_78163_i = 1; + } + } +} diff --git a/src/main/java/net/minecraft/src/ModelPig.java b/src/main/java/net/minecraft/src/ModelPig.java new file mode 100644 index 0000000..9626b52 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelPig.java @@ -0,0 +1,16 @@ +package net.minecraft.src; + +public class ModelPig extends ModelQuadruped +{ + public ModelPig() + { + this(0.0F); + } + + public ModelPig(float par1) + { + super(6, par1); + this.head.setTextureOffset(16, 16).addBox(-2.0F, 0.0F, -9.0F, 4, 3, 1, par1); + this.field_78145_g = 4.0F; + } +} diff --git a/src/main/java/net/minecraft/src/ModelQuadruped.java b/src/main/java/net/minecraft/src/ModelQuadruped.java new file mode 100644 index 0000000..dee319e --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelQuadruped.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class ModelQuadruped extends ModelBase +{ + public ModelRenderer head = new ModelRenderer(this, 0, 0); + public ModelRenderer body; + public ModelRenderer leg1; + public ModelRenderer leg2; + public ModelRenderer leg3; + public ModelRenderer leg4; + protected float field_78145_g = 8.0F; + protected float field_78151_h = 4.0F; + + public ModelQuadruped(int par1, float par2) + { + this.head.addBox(-4.0F, -4.0F, -8.0F, 8, 8, 8, par2); + this.head.setRotationPoint(0.0F, (float)(18 - par1), -6.0F); + this.body = new ModelRenderer(this, 28, 8); + this.body.addBox(-5.0F, -10.0F, -7.0F, 10, 16, 8, par2); + this.body.setRotationPoint(0.0F, (float)(17 - par1), 2.0F); + this.leg1 = new ModelRenderer(this, 0, 16); + this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, par1, 4, par2); + this.leg1.setRotationPoint(-3.0F, (float)(24 - par1), 7.0F); + this.leg2 = new ModelRenderer(this, 0, 16); + this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, par1, 4, par2); + this.leg2.setRotationPoint(3.0F, (float)(24 - par1), 7.0F); + this.leg3 = new ModelRenderer(this, 0, 16); + this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, par1, 4, par2); + this.leg3.setRotationPoint(-3.0F, (float)(24 - par1), -5.0F); + this.leg4 = new ModelRenderer(this, 0, 16); + this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, par1, 4, par2); + this.leg4.setRotationPoint(3.0F, (float)(24 - par1), -5.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + + if (this.isChild) + { + float var8 = 2.0F; + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, this.field_78145_g * par7, this.field_78151_h * par7); + this.head.render(par7); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glScalef(1.0F / var8, 1.0F / var8, 1.0F / var8); + GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F); + this.body.render(par7); + this.leg1.render(par7); + this.leg2.render(par7); + this.leg3.render(par7); + this.leg4.render(par7); + GL11.glPopMatrix(); + } + else + { + this.head.render(par7); + this.body.render(par7); + this.leg1.render(par7); + this.leg2.render(par7); + this.leg3.render(par7); + this.leg4.render(par7); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + float var8 = (180F / (float)Math.PI); + this.head.rotateAngleX = par5 / (180F / (float)Math.PI); + this.head.rotateAngleY = par4 / (180F / (float)Math.PI); + this.body.rotateAngleX = ((float)Math.PI / 2F); + this.leg1.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; + this.leg2.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + this.leg3.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2; + this.leg4.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2; + } +} diff --git a/src/main/java/net/minecraft/src/ModelRenderer.java b/src/main/java/net/minecraft/src/ModelRenderer.java new file mode 100644 index 0000000..421a8b8 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelRenderer.java @@ -0,0 +1,304 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; +import org.lwjgl.opengl.GL11; + +public class ModelRenderer +{ + /** The size of the texture file's width in pixels. */ + public float textureWidth; + + /** The size of the texture file's height in pixels. */ + public float textureHeight; + + /** The X offset into the texture used for displaying this model */ + private int textureOffsetX; + + /** The Y offset into the texture used for displaying this model */ + private int textureOffsetY; + public float rotationPointX; + public float rotationPointY; + public float rotationPointZ; + public float rotateAngleX; + public float rotateAngleY; + public float rotateAngleZ; + private boolean compiled; + + /** The GL display list rendered by the Tessellator for this model */ + private int displayList; + public boolean mirror; + public boolean showModel; + + /** Hides the model. */ + public boolean isHidden; + public List cubeList; + public List childModels; + public final String boxName; + private ModelBase baseModel; + public float offsetX; + public float offsetY; + public float offsetZ; + + public ModelRenderer(ModelBase par1ModelBase, String par2Str) + { + this.textureWidth = 64.0F; + this.textureHeight = 32.0F; + this.showModel = true; + this.cubeList = new ArrayList(); + this.baseModel = par1ModelBase; + par1ModelBase.boxList.add(this); + this.boxName = par2Str; + this.setTextureSize(par1ModelBase.textureWidth, par1ModelBase.textureHeight); + } + + public ModelRenderer(ModelBase par1ModelBase) + { + this(par1ModelBase, (String)null); + } + + public ModelRenderer(ModelBase par1ModelBase, int par2, int par3) + { + this(par1ModelBase); + this.setTextureOffset(par2, par3); + } + + /** + * Sets the current box's rotation points and rotation angles to another box. + */ + public void addChild(ModelRenderer par1ModelRenderer) + { + if (this.childModels == null) + { + this.childModels = new ArrayList(); + } + + this.childModels.add(par1ModelRenderer); + } + + public ModelRenderer setTextureOffset(int par1, int par2) + { + this.textureOffsetX = par1; + this.textureOffsetY = par2; + return this; + } + + public ModelRenderer addBox(String par1Str, float par2, float par3, float par4, int par5, int par6, int par7) + { + par1Str = this.boxName + "." + par1Str; + TextureOffset var8 = this.baseModel.getTextureOffset(par1Str); + this.setTextureOffset(var8.textureOffsetX, var8.textureOffsetY); + this.cubeList.add((new ModelBox(this, this.textureOffsetX, this.textureOffsetY, par2, par3, par4, par5, par6, par7, 0.0F)).func_78244_a(par1Str)); + return this; + } + + public ModelRenderer addBox(float par1, float par2, float par3, int par4, int par5, int par6) + { + this.cubeList.add(new ModelBox(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, 0.0F)); + return this; + } + + /** + * Creates a textured box. Args: originX, originY, originZ, width, height, depth, scaleFactor. + */ + public void addBox(float par1, float par2, float par3, int par4, int par5, int par6, float par7) + { + this.cubeList.add(new ModelBox(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, par7)); + } + + public void setRotationPoint(float par1, float par2, float par3) + { + this.rotationPointX = par1; + this.rotationPointY = par2; + this.rotationPointZ = par3; + } + + public void render(float par1) + { + if (!this.isHidden) + { + if (this.showModel) + { + if (!this.compiled) + { + this.compileDisplayList(par1); + } + + GL11.glTranslatef(this.offsetX, this.offsetY, this.offsetZ); + int var2; + + if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) + { + if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) + { + GL11.glCallList(this.displayList); + + if (this.childModels != null) + { + for (var2 = 0; var2 < this.childModels.size(); ++var2) + { + ((ModelRenderer)this.childModels.get(var2)).render(par1); + } + } + } + else + { + GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); + GL11.glCallList(this.displayList); + + if (this.childModels != null) + { + for (var2 = 0; var2 < this.childModels.size(); ++var2) + { + ((ModelRenderer)this.childModels.get(var2)).render(par1); + } + } + + GL11.glTranslatef(-this.rotationPointX * par1, -this.rotationPointY * par1, -this.rotationPointZ * par1); + } + } + else + { + GL11.glPushMatrix(); + GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); + + if (this.rotateAngleZ != 0.0F) + { + GL11.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + } + + if (this.rotateAngleY != 0.0F) + { + GL11.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + } + + if (this.rotateAngleX != 0.0F) + { + GL11.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + } + + GL11.glCallList(this.displayList); + + if (this.childModels != null) + { + for (var2 = 0; var2 < this.childModels.size(); ++var2) + { + ((ModelRenderer)this.childModels.get(var2)).render(par1); + } + } + + GL11.glPopMatrix(); + } + + GL11.glTranslatef(-this.offsetX, -this.offsetY, -this.offsetZ); + } + } + } + + public void renderWithRotation(float par1) + { + if (!this.isHidden) + { + if (this.showModel) + { + if (!this.compiled) + { + this.compileDisplayList(par1); + } + + GL11.glPushMatrix(); + GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); + + if (this.rotateAngleY != 0.0F) + { + GL11.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + } + + if (this.rotateAngleX != 0.0F) + { + GL11.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + } + + if (this.rotateAngleZ != 0.0F) + { + GL11.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + } + + GL11.glCallList(this.displayList); + GL11.glPopMatrix(); + } + } + } + + /** + * Allows the changing of Angles after a box has been rendered + */ + public void postRender(float par1) + { + if (!this.isHidden) + { + if (this.showModel) + { + if (!this.compiled) + { + this.compileDisplayList(par1); + } + + if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) + { + if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) + { + GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); + } + } + else + { + GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); + + if (this.rotateAngleZ != 0.0F) + { + GL11.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + } + + if (this.rotateAngleY != 0.0F) + { + GL11.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + } + + if (this.rotateAngleX != 0.0F) + { + GL11.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + } + } + } + } + } + + /** + * Compiles a GL display list for this model + */ + private void compileDisplayList(float par1) + { + this.displayList = GLAllocation.generateDisplayLists(1); + GL11.glNewList(this.displayList, GL11.GL_COMPILE); + Tessellator var2 = Tessellator.instance; + + for (int var3 = 0; var3 < this.cubeList.size(); ++var3) + { + ((ModelBox)this.cubeList.get(var3)).render(var2, par1); + } + + GL11.glEndList(); + this.compiled = true; + } + + /** + * Returns the model renderer with the new texture parameters. + */ + public ModelRenderer setTextureSize(int par1, int par2) + { + this.textureWidth = (float)par1; + this.textureHeight = (float)par2; + return this; + } +} diff --git a/src/main/java/net/minecraft/src/ModelSheep1.java b/src/main/java/net/minecraft/src/ModelSheep1.java new file mode 100644 index 0000000..8a5e552 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelSheep1.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +public class ModelSheep1 extends ModelQuadruped +{ + private float field_78152_i; + + public ModelSheep1() + { + super(12, 0.0F); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-3.0F, -4.0F, -4.0F, 6, 6, 6, 0.6F); + this.head.setRotationPoint(0.0F, 6.0F, -8.0F); + this.body = new ModelRenderer(this, 28, 8); + this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, 1.75F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + float var1 = 0.5F; + this.leg1 = new ModelRenderer(this, 0, 16); + this.leg1.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg1.setRotationPoint(-3.0F, 12.0F, 7.0F); + this.leg2 = new ModelRenderer(this, 0, 16); + this.leg2.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg2.setRotationPoint(3.0F, 12.0F, 7.0F); + this.leg3 = new ModelRenderer(this, 0, 16); + this.leg3.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg3.setRotationPoint(-3.0F, 12.0F, -5.0F); + this.leg4 = new ModelRenderer(this, 0, 16); + this.leg4.addBox(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1); + this.leg4.setRotationPoint(3.0F, 12.0F, -5.0F); + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + super.setLivingAnimations(par1EntityLivingBase, par2, par3, par4); + this.head.rotationPointY = 6.0F + ((EntitySheep)par1EntityLivingBase).func_70894_j(par4) * 9.0F; + this.field_78152_i = ((EntitySheep)par1EntityLivingBase).func_70890_k(par4); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + this.head.rotateAngleX = this.field_78152_i; + } +} diff --git a/src/main/java/net/minecraft/src/ModelSheep2.java b/src/main/java/net/minecraft/src/ModelSheep2.java new file mode 100644 index 0000000..eb0d901 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelSheep2.java @@ -0,0 +1,39 @@ +package net.minecraft.src; + +public class ModelSheep2 extends ModelQuadruped +{ + private float field_78153_i; + + public ModelSheep2() + { + super(12, 0.0F); + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-3.0F, -4.0F, -6.0F, 6, 6, 8, 0.0F); + this.head.setRotationPoint(0.0F, 6.0F, -8.0F); + this.body = new ModelRenderer(this, 28, 8); + this.body.addBox(-4.0F, -10.0F, -7.0F, 8, 16, 6, 0.0F); + this.body.setRotationPoint(0.0F, 5.0F, 2.0F); + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + super.setLivingAnimations(par1EntityLivingBase, par2, par3, par4); + this.head.rotationPointY = 6.0F + ((EntitySheep)par1EntityLivingBase).func_70894_j(par4) * 9.0F; + this.field_78153_i = ((EntitySheep)par1EntityLivingBase).func_70890_k(par4); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + this.head.rotateAngleX = this.field_78153_i; + } +} diff --git a/src/main/java/net/minecraft/src/ModelSign.java b/src/main/java/net/minecraft/src/ModelSign.java new file mode 100644 index 0000000..ac31808 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelSign.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +public class ModelSign extends ModelBase +{ + /** The board on a sign that has the writing on it. */ + public ModelRenderer signBoard = new ModelRenderer(this, 0, 0); + + /** The stick a sign stands on. */ + public ModelRenderer signStick; + + public ModelSign() + { + this.signBoard.addBox(-12.0F, -14.0F, -1.0F, 24, 12, 2, 0.0F); + this.signStick = new ModelRenderer(this, 0, 14); + this.signStick.addBox(-1.0F, -2.0F, -1.0F, 2, 14, 2, 0.0F); + } + + /** + * Renders the sign model through TileEntitySignRenderer + */ + public void renderSign() + { + this.signBoard.render(0.0625F); + this.signStick.render(0.0625F); + } +} diff --git a/src/main/java/net/minecraft/src/ModelSilverfish.java b/src/main/java/net/minecraft/src/ModelSilverfish.java new file mode 100644 index 0000000..aef759d --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelSilverfish.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +public class ModelSilverfish extends ModelBase +{ + /** The body parts of the silverfish's model. */ + private ModelRenderer[] silverfishBodyParts = new ModelRenderer[7]; + + /** The wings (dust-looking sprites) on the silverfish's model. */ + private ModelRenderer[] silverfishWings; + private float[] field_78170_c = new float[7]; + + /** The widths, heights, and lengths for the silverfish model boxes. */ + private static final int[][] silverfishBoxLength = new int[][] {{3, 2, 2}, {4, 3, 2}, {6, 4, 3}, {3, 3, 3}, {2, 2, 3}, {2, 1, 2}, {1, 1, 2}}; + + /** The texture positions for the silverfish's model's boxes. */ + private static final int[][] silverfishTexturePositions = new int[][] {{0, 0}, {0, 4}, {0, 9}, {0, 16}, {0, 22}, {11, 0}, {13, 4}}; + + public ModelSilverfish() + { + float var1 = -3.5F; + + for (int var2 = 0; var2 < this.silverfishBodyParts.length; ++var2) + { + this.silverfishBodyParts[var2] = new ModelRenderer(this, silverfishTexturePositions[var2][0], silverfishTexturePositions[var2][1]); + this.silverfishBodyParts[var2].addBox((float)silverfishBoxLength[var2][0] * -0.5F, 0.0F, (float)silverfishBoxLength[var2][2] * -0.5F, silverfishBoxLength[var2][0], silverfishBoxLength[var2][1], silverfishBoxLength[var2][2]); + this.silverfishBodyParts[var2].setRotationPoint(0.0F, (float)(24 - silverfishBoxLength[var2][1]), var1); + this.field_78170_c[var2] = var1; + + if (var2 < this.silverfishBodyParts.length - 1) + { + var1 += (float)(silverfishBoxLength[var2][2] + silverfishBoxLength[var2 + 1][2]) * 0.5F; + } + } + + this.silverfishWings = new ModelRenderer[3]; + this.silverfishWings[0] = new ModelRenderer(this, 20, 0); + this.silverfishWings[0].addBox(-5.0F, 0.0F, (float)silverfishBoxLength[2][2] * -0.5F, 10, 8, silverfishBoxLength[2][2]); + this.silverfishWings[0].setRotationPoint(0.0F, 16.0F, this.field_78170_c[2]); + this.silverfishWings[1] = new ModelRenderer(this, 20, 11); + this.silverfishWings[1].addBox(-3.0F, 0.0F, (float)silverfishBoxLength[4][2] * -0.5F, 6, 4, silverfishBoxLength[4][2]); + this.silverfishWings[1].setRotationPoint(0.0F, 20.0F, this.field_78170_c[4]); + this.silverfishWings[2] = new ModelRenderer(this, 20, 18); + this.silverfishWings[2].addBox(-3.0F, 0.0F, (float)silverfishBoxLength[4][2] * -0.5F, 6, 5, silverfishBoxLength[1][2]); + this.silverfishWings[2].setRotationPoint(0.0F, 19.0F, this.field_78170_c[1]); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + int var8; + + for (var8 = 0; var8 < this.silverfishBodyParts.length; ++var8) + { + this.silverfishBodyParts[var8].render(par7); + } + + for (var8 = 0; var8 < this.silverfishWings.length; ++var8) + { + this.silverfishWings[var8].render(par7); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + for (int var8 = 0; var8 < this.silverfishBodyParts.length; ++var8) + { + this.silverfishBodyParts[var8].rotateAngleY = MathHelper.cos(par3 * 0.9F + (float)var8 * 0.15F * (float)Math.PI) * (float)Math.PI * 0.05F * (float)(1 + Math.abs(var8 - 2)); + this.silverfishBodyParts[var8].rotationPointX = MathHelper.sin(par3 * 0.9F + (float)var8 * 0.15F * (float)Math.PI) * (float)Math.PI * 0.2F * (float)Math.abs(var8 - 2); + } + + this.silverfishWings[0].rotateAngleY = this.silverfishBodyParts[2].rotateAngleY; + this.silverfishWings[1].rotateAngleY = this.silverfishBodyParts[4].rotateAngleY; + this.silverfishWings[1].rotationPointX = this.silverfishBodyParts[4].rotationPointX; + this.silverfishWings[2].rotateAngleY = this.silverfishBodyParts[1].rotateAngleY; + this.silverfishWings[2].rotationPointX = this.silverfishBodyParts[1].rotationPointX; + } +} diff --git a/src/main/java/net/minecraft/src/ModelSkeleton.java b/src/main/java/net/minecraft/src/ModelSkeleton.java new file mode 100644 index 0000000..0c9f9ef --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelSkeleton.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +public class ModelSkeleton extends ModelZombie +{ + public ModelSkeleton() + { + this(0.0F); + } + + public ModelSkeleton(float par1) + { + super(par1, 0.0F, 64, 32); + this.bipedRightArm = new ModelRenderer(this, 40, 16); + this.bipedRightArm.addBox(-1.0F, -2.0F, -1.0F, 2, 12, 2, par1); + this.bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F); + this.bipedLeftArm = new ModelRenderer(this, 40, 16); + this.bipedLeftArm.mirror = true; + this.bipedLeftArm.addBox(-1.0F, -2.0F, -1.0F, 2, 12, 2, par1); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F); + this.bipedRightLeg = new ModelRenderer(this, 0, 16); + this.bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 12, 2, par1); + this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F); + this.bipedLeftLeg = new ModelRenderer(this, 0, 16); + this.bipedLeftLeg.mirror = true; + this.bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 12, 2, par1); + this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F, 0.0F); + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + this.aimedBow = ((EntitySkeleton)par1EntityLivingBase).getSkeletonType() == 1; + super.setLivingAnimations(par1EntityLivingBase, par2, par3, par4); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + } +} diff --git a/src/main/java/net/minecraft/src/ModelSkeletonHead.java b/src/main/java/net/minecraft/src/ModelSkeletonHead.java new file mode 100644 index 0000000..eafec10 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelSkeletonHead.java @@ -0,0 +1,41 @@ +package net.minecraft.src; + +public class ModelSkeletonHead extends ModelBase +{ + public ModelRenderer skeletonHead; + + public ModelSkeletonHead() + { + this(0, 35, 64, 64); + } + + public ModelSkeletonHead(int par1, int par2, int par3, int par4) + { + this.textureWidth = par3; + this.textureHeight = par4; + this.skeletonHead = new ModelRenderer(this, par1, par2); + this.skeletonHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F); + this.skeletonHead.setRotationPoint(0.0F, 0.0F, 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.skeletonHead.render(par7); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + this.skeletonHead.rotateAngleY = par4 / (180F / (float)Math.PI); + this.skeletonHead.rotateAngleX = par5 / (180F / (float)Math.PI); + } +} diff --git a/src/main/java/net/minecraft/src/ModelSlime.java b/src/main/java/net/minecraft/src/ModelSlime.java new file mode 100644 index 0000000..34a904a --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelSlime.java @@ -0,0 +1,50 @@ +package net.minecraft.src; + +public class ModelSlime extends ModelBase +{ + /** The slime's bodies, both the inside box and the outside box */ + ModelRenderer slimeBodies; + + /** The slime's right eye */ + ModelRenderer slimeRightEye; + + /** The slime's left eye */ + ModelRenderer slimeLeftEye; + + /** The slime's mouth */ + ModelRenderer slimeMouth; + + public ModelSlime(int par1) + { + this.slimeBodies = new ModelRenderer(this, 0, par1); + this.slimeBodies.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8); + + if (par1 > 0) + { + this.slimeBodies = new ModelRenderer(this, 0, par1); + this.slimeBodies.addBox(-3.0F, 17.0F, -3.0F, 6, 6, 6); + this.slimeRightEye = new ModelRenderer(this, 32, 0); + this.slimeRightEye.addBox(-3.25F, 18.0F, -3.5F, 2, 2, 2); + this.slimeLeftEye = new ModelRenderer(this, 32, 4); + this.slimeLeftEye.addBox(1.25F, 18.0F, -3.5F, 2, 2, 2); + this.slimeMouth = new ModelRenderer(this, 32, 8); + this.slimeMouth.addBox(0.0F, 21.0F, -3.5F, 1, 1, 1); + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.slimeBodies.render(par7); + + if (this.slimeRightEye != null) + { + this.slimeRightEye.render(par7); + this.slimeLeftEye.render(par7); + this.slimeMouth.render(par7); + } + } +} diff --git a/src/main/java/net/minecraft/src/ModelSnowMan.java b/src/main/java/net/minecraft/src/ModelSnowMan.java new file mode 100644 index 0000000..5ed6bfe --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelSnowMan.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +public class ModelSnowMan extends ModelBase +{ + public ModelRenderer body; + public ModelRenderer bottomBody; + public ModelRenderer head; + public ModelRenderer rightHand; + public ModelRenderer leftHand; + + public ModelSnowMan() + { + float var1 = 4.0F; + float var2 = 0.0F; + this.head = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, var2 - 0.5F); + this.head.setRotationPoint(0.0F, 0.0F + var1, 0.0F); + this.rightHand = (new ModelRenderer(this, 32, 0)).setTextureSize(64, 64); + this.rightHand.addBox(-1.0F, 0.0F, -1.0F, 12, 2, 2, var2 - 0.5F); + this.rightHand.setRotationPoint(0.0F, 0.0F + var1 + 9.0F - 7.0F, 0.0F); + this.leftHand = (new ModelRenderer(this, 32, 0)).setTextureSize(64, 64); + this.leftHand.addBox(-1.0F, 0.0F, -1.0F, 12, 2, 2, var2 - 0.5F); + this.leftHand.setRotationPoint(0.0F, 0.0F + var1 + 9.0F - 7.0F, 0.0F); + this.body = (new ModelRenderer(this, 0, 16)).setTextureSize(64, 64); + this.body.addBox(-5.0F, -10.0F, -5.0F, 10, 10, 10, var2 - 0.5F); + this.body.setRotationPoint(0.0F, 0.0F + var1 + 9.0F, 0.0F); + this.bottomBody = (new ModelRenderer(this, 0, 36)).setTextureSize(64, 64); + this.bottomBody.addBox(-6.0F, -12.0F, -6.0F, 12, 12, 12, var2 - 0.5F); + this.bottomBody.setRotationPoint(0.0F, 0.0F + var1 + 20.0F, 0.0F); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + this.head.rotateAngleY = par4 / (180F / (float)Math.PI); + this.head.rotateAngleX = par5 / (180F / (float)Math.PI); + this.body.rotateAngleY = par4 / (180F / (float)Math.PI) * 0.25F; + float var8 = MathHelper.sin(this.body.rotateAngleY); + float var9 = MathHelper.cos(this.body.rotateAngleY); + this.rightHand.rotateAngleZ = 1.0F; + this.leftHand.rotateAngleZ = -1.0F; + this.rightHand.rotateAngleY = 0.0F + this.body.rotateAngleY; + this.leftHand.rotateAngleY = (float)Math.PI + this.body.rotateAngleY; + this.rightHand.rotationPointX = var9 * 5.0F; + this.rightHand.rotationPointZ = -var8 * 5.0F; + this.leftHand.rotationPointX = -var9 * 5.0F; + this.leftHand.rotationPointZ = var8 * 5.0F; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.body.render(par7); + this.bottomBody.render(par7); + this.head.render(par7); + this.rightHand.render(par7); + this.leftHand.render(par7); + } +} diff --git a/src/main/java/net/minecraft/src/ModelSpider.java b/src/main/java/net/minecraft/src/ModelSpider.java new file mode 100644 index 0000000..98fda0b --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelSpider.java @@ -0,0 +1,149 @@ +package net.minecraft.src; + +public class ModelSpider extends ModelBase +{ + /** The spider's head box */ + public ModelRenderer spiderHead; + + /** The spider's neck box */ + public ModelRenderer spiderNeck; + + /** The spider's body box */ + public ModelRenderer spiderBody; + + /** Spider's first leg */ + public ModelRenderer spiderLeg1; + + /** Spider's second leg */ + public ModelRenderer spiderLeg2; + + /** Spider's third leg */ + public ModelRenderer spiderLeg3; + + /** Spider's fourth leg */ + public ModelRenderer spiderLeg4; + + /** Spider's fifth leg */ + public ModelRenderer spiderLeg5; + + /** Spider's sixth leg */ + public ModelRenderer spiderLeg6; + + /** Spider's seventh leg */ + public ModelRenderer spiderLeg7; + + /** Spider's eight leg */ + public ModelRenderer spiderLeg8; + + public ModelSpider() + { + float var1 = 0.0F; + byte var2 = 15; + this.spiderHead = new ModelRenderer(this, 32, 4); + this.spiderHead.addBox(-4.0F, -4.0F, -8.0F, 8, 8, 8, var1); + this.spiderHead.setRotationPoint(0.0F, (float)var2, -3.0F); + this.spiderNeck = new ModelRenderer(this, 0, 0); + this.spiderNeck.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6, var1); + this.spiderNeck.setRotationPoint(0.0F, (float)var2, 0.0F); + this.spiderBody = new ModelRenderer(this, 0, 12); + this.spiderBody.addBox(-5.0F, -4.0F, -6.0F, 10, 8, 12, var1); + this.spiderBody.setRotationPoint(0.0F, (float)var2, 9.0F); + this.spiderLeg1 = new ModelRenderer(this, 18, 0); + this.spiderLeg1.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg1.setRotationPoint(-4.0F, (float)var2, 2.0F); + this.spiderLeg2 = new ModelRenderer(this, 18, 0); + this.spiderLeg2.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg2.setRotationPoint(4.0F, (float)var2, 2.0F); + this.spiderLeg3 = new ModelRenderer(this, 18, 0); + this.spiderLeg3.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg3.setRotationPoint(-4.0F, (float)var2, 1.0F); + this.spiderLeg4 = new ModelRenderer(this, 18, 0); + this.spiderLeg4.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg4.setRotationPoint(4.0F, (float)var2, 1.0F); + this.spiderLeg5 = new ModelRenderer(this, 18, 0); + this.spiderLeg5.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg5.setRotationPoint(-4.0F, (float)var2, 0.0F); + this.spiderLeg6 = new ModelRenderer(this, 18, 0); + this.spiderLeg6.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg6.setRotationPoint(4.0F, (float)var2, 0.0F); + this.spiderLeg7 = new ModelRenderer(this, 18, 0); + this.spiderLeg7.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg7.setRotationPoint(-4.0F, (float)var2, -1.0F); + this.spiderLeg8 = new ModelRenderer(this, 18, 0); + this.spiderLeg8.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, var1); + this.spiderLeg8.setRotationPoint(4.0F, (float)var2, -1.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.spiderHead.render(par7); + this.spiderNeck.render(par7); + this.spiderBody.render(par7); + this.spiderLeg1.render(par7); + this.spiderLeg2.render(par7); + this.spiderLeg3.render(par7); + this.spiderLeg4.render(par7); + this.spiderLeg5.render(par7); + this.spiderLeg6.render(par7); + this.spiderLeg7.render(par7); + this.spiderLeg8.render(par7); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + this.spiderHead.rotateAngleY = par4 / (180F / (float)Math.PI); + this.spiderHead.rotateAngleX = par5 / (180F / (float)Math.PI); + float var8 = ((float)Math.PI / 4F); + this.spiderLeg1.rotateAngleZ = -var8; + this.spiderLeg2.rotateAngleZ = var8; + this.spiderLeg3.rotateAngleZ = -var8 * 0.74F; + this.spiderLeg4.rotateAngleZ = var8 * 0.74F; + this.spiderLeg5.rotateAngleZ = -var8 * 0.74F; + this.spiderLeg6.rotateAngleZ = var8 * 0.74F; + this.spiderLeg7.rotateAngleZ = -var8; + this.spiderLeg8.rotateAngleZ = var8; + float var9 = -0.0F; + float var10 = 0.3926991F; + this.spiderLeg1.rotateAngleY = var10 * 2.0F + var9; + this.spiderLeg2.rotateAngleY = -var10 * 2.0F - var9; + this.spiderLeg3.rotateAngleY = var10 * 1.0F + var9; + this.spiderLeg4.rotateAngleY = -var10 * 1.0F - var9; + this.spiderLeg5.rotateAngleY = -var10 * 1.0F + var9; + this.spiderLeg6.rotateAngleY = var10 * 1.0F - var9; + this.spiderLeg7.rotateAngleY = -var10 * 2.0F + var9; + this.spiderLeg8.rotateAngleY = var10 * 2.0F - var9; + float var11 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + 0.0F) * 0.4F) * par2; + float var12 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + (float)Math.PI) * 0.4F) * par2; + float var13 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + ((float)Math.PI / 2F)) * 0.4F) * par2; + float var14 = -(MathHelper.cos(par1 * 0.6662F * 2.0F + ((float)Math.PI * 3F / 2F)) * 0.4F) * par2; + float var15 = Math.abs(MathHelper.sin(par1 * 0.6662F + 0.0F) * 0.4F) * par2; + float var16 = Math.abs(MathHelper.sin(par1 * 0.6662F + (float)Math.PI) * 0.4F) * par2; + float var17 = Math.abs(MathHelper.sin(par1 * 0.6662F + ((float)Math.PI / 2F)) * 0.4F) * par2; + float var18 = Math.abs(MathHelper.sin(par1 * 0.6662F + ((float)Math.PI * 3F / 2F)) * 0.4F) * par2; + this.spiderLeg1.rotateAngleY += var11; + this.spiderLeg2.rotateAngleY += -var11; + this.spiderLeg3.rotateAngleY += var12; + this.spiderLeg4.rotateAngleY += -var12; + this.spiderLeg5.rotateAngleY += var13; + this.spiderLeg6.rotateAngleY += -var13; + this.spiderLeg7.rotateAngleY += var14; + this.spiderLeg8.rotateAngleY += -var14; + this.spiderLeg1.rotateAngleZ += var15; + this.spiderLeg2.rotateAngleZ += -var15; + this.spiderLeg3.rotateAngleZ += var16; + this.spiderLeg4.rotateAngleZ += -var16; + this.spiderLeg5.rotateAngleZ += var17; + this.spiderLeg6.rotateAngleZ += -var17; + this.spiderLeg7.rotateAngleZ += var18; + this.spiderLeg8.rotateAngleZ += -var18; + } +} diff --git a/src/main/java/net/minecraft/src/ModelSquid.java b/src/main/java/net/minecraft/src/ModelSquid.java new file mode 100644 index 0000000..72d5f1b --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelSquid.java @@ -0,0 +1,63 @@ +package net.minecraft.src; + +public class ModelSquid extends ModelBase +{ + /** The squid's body */ + ModelRenderer squidBody; + + /** The squid's tentacles */ + ModelRenderer[] squidTentacles = new ModelRenderer[8]; + + public ModelSquid() + { + byte var1 = -16; + this.squidBody = new ModelRenderer(this, 0, 0); + this.squidBody.addBox(-6.0F, -8.0F, -6.0F, 12, 16, 12); + this.squidBody.rotationPointY += (float)(24 + var1); + + for (int var2 = 0; var2 < this.squidTentacles.length; ++var2) + { + this.squidTentacles[var2] = new ModelRenderer(this, 48, 0); + double var3 = (double)var2 * Math.PI * 2.0D / (double)this.squidTentacles.length; + float var5 = (float)Math.cos(var3) * 5.0F; + float var6 = (float)Math.sin(var3) * 5.0F; + this.squidTentacles[var2].addBox(-1.0F, 0.0F, -1.0F, 2, 18, 2); + this.squidTentacles[var2].rotationPointX = var5; + this.squidTentacles[var2].rotationPointZ = var6; + this.squidTentacles[var2].rotationPointY = (float)(31 + var1); + var3 = (double)var2 * Math.PI * -2.0D / (double)this.squidTentacles.length + (Math.PI / 2D); + this.squidTentacles[var2].rotateAngleY = (float)var3; + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + ModelRenderer[] var8 = this.squidTentacles; + int var9 = var8.length; + + for (int var10 = 0; var10 < var9; ++var10) + { + ModelRenderer var11 = var8[var10]; + var11.rotateAngleX = par3; + } + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.squidBody.render(par7); + + for (int var8 = 0; var8 < this.squidTentacles.length; ++var8) + { + this.squidTentacles[var8].render(par7); + } + } +} diff --git a/src/main/java/net/minecraft/src/ModelVillager.java b/src/main/java/net/minecraft/src/ModelVillager.java new file mode 100644 index 0000000..0ccdb45 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelVillager.java @@ -0,0 +1,83 @@ +package net.minecraft.src; + +public class ModelVillager extends ModelBase +{ + /** The head box of the VillagerModel */ + public ModelRenderer villagerHead; + + /** The body of the VillagerModel */ + public ModelRenderer villagerBody; + + /** The arms of the VillagerModel */ + public ModelRenderer villagerArms; + + /** The right leg of the VillagerModel */ + public ModelRenderer rightVillagerLeg; + + /** The left leg of the VillagerModel */ + public ModelRenderer leftVillagerLeg; + public ModelRenderer villagerNose; + + public ModelVillager(float par1) + { + this(par1, 0.0F, 64, 64); + } + + public ModelVillager(float par1, float par2, int par3, int par4) + { + this.villagerHead = (new ModelRenderer(this)).setTextureSize(par3, par4); + this.villagerHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F); + this.villagerHead.setTextureOffset(0, 0).addBox(-4.0F, -10.0F, -4.0F, 8, 10, 8, par1); + this.villagerNose = (new ModelRenderer(this)).setTextureSize(par3, par4); + this.villagerNose.setRotationPoint(0.0F, par2 - 2.0F, 0.0F); + this.villagerNose.setTextureOffset(24, 0).addBox(-1.0F, -1.0F, -6.0F, 2, 4, 2, par1); + this.villagerHead.addChild(this.villagerNose); + this.villagerBody = (new ModelRenderer(this)).setTextureSize(par3, par4); + this.villagerBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F); + this.villagerBody.setTextureOffset(16, 20).addBox(-4.0F, 0.0F, -3.0F, 8, 12, 6, par1); + this.villagerBody.setTextureOffset(0, 38).addBox(-4.0F, 0.0F, -3.0F, 8, 18, 6, par1 + 0.5F); + this.villagerArms = (new ModelRenderer(this)).setTextureSize(par3, par4); + this.villagerArms.setRotationPoint(0.0F, 0.0F + par2 + 2.0F, 0.0F); + this.villagerArms.setTextureOffset(44, 22).addBox(-8.0F, -2.0F, -2.0F, 4, 8, 4, par1); + this.villagerArms.setTextureOffset(44, 22).addBox(4.0F, -2.0F, -2.0F, 4, 8, 4, par1); + this.villagerArms.setTextureOffset(40, 38).addBox(-4.0F, 2.0F, -2.0F, 8, 4, 4, par1); + this.rightVillagerLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(par3, par4); + this.rightVillagerLeg.setRotationPoint(-2.0F, 12.0F + par2, 0.0F); + this.rightVillagerLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1); + this.leftVillagerLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(par3, par4); + this.leftVillagerLeg.mirror = true; + this.leftVillagerLeg.setRotationPoint(2.0F, 12.0F + par2, 0.0F); + this.leftVillagerLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + this.villagerHead.render(par7); + this.villagerBody.render(par7); + this.rightVillagerLeg.render(par7); + this.leftVillagerLeg.render(par7); + this.villagerArms.render(par7); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + this.villagerHead.rotateAngleY = par4 / (180F / (float)Math.PI); + this.villagerHead.rotateAngleX = par5 / (180F / (float)Math.PI); + this.villagerArms.rotationPointY = 3.0F; + this.villagerArms.rotationPointZ = -1.0F; + this.villagerArms.rotateAngleX = -0.75F; + this.rightVillagerLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2 * 0.5F; + this.leftVillagerLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2 * 0.5F; + this.rightVillagerLeg.rotateAngleY = 0.0F; + this.leftVillagerLeg.rotateAngleY = 0.0F; + } +} diff --git a/src/main/java/net/minecraft/src/ModelWitch.java b/src/main/java/net/minecraft/src/ModelWitch.java new file mode 100644 index 0000000..509032a --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelWitch.java @@ -0,0 +1,60 @@ +package net.minecraft.src; + +public class ModelWitch extends ModelVillager +{ + public boolean field_82900_g; + private ModelRenderer field_82901_h = (new ModelRenderer(this)).setTextureSize(64, 128); + private ModelRenderer witchHat; + + public ModelWitch(float par1) + { + super(par1, 0.0F, 64, 128); + this.field_82901_h.setRotationPoint(0.0F, -2.0F, 0.0F); + this.field_82901_h.setTextureOffset(0, 0).addBox(0.0F, 3.0F, -6.75F, 1, 1, 1, -0.25F); + this.villagerNose.addChild(this.field_82901_h); + this.witchHat = (new ModelRenderer(this)).setTextureSize(64, 128); + this.witchHat.setRotationPoint(-5.0F, -10.03125F, -5.0F); + this.witchHat.setTextureOffset(0, 64).addBox(0.0F, 0.0F, 0.0F, 10, 2, 10); + this.villagerHead.addChild(this.witchHat); + ModelRenderer var2 = (new ModelRenderer(this)).setTextureSize(64, 128); + var2.setRotationPoint(1.75F, -4.0F, 2.0F); + var2.setTextureOffset(0, 76).addBox(0.0F, 0.0F, 0.0F, 7, 4, 7); + var2.rotateAngleX = -0.05235988F; + var2.rotateAngleZ = 0.02617994F; + this.witchHat.addChild(var2); + ModelRenderer var3 = (new ModelRenderer(this)).setTextureSize(64, 128); + var3.setRotationPoint(1.75F, -4.0F, 2.0F); + var3.setTextureOffset(0, 87).addBox(0.0F, 0.0F, 0.0F, 4, 4, 4); + var3.rotateAngleX = -0.10471976F; + var3.rotateAngleZ = 0.05235988F; + var2.addChild(var3); + ModelRenderer var4 = (new ModelRenderer(this)).setTextureSize(64, 128); + var4.setRotationPoint(1.75F, -2.0F, 2.0F); + var4.setTextureOffset(0, 95).addBox(0.0F, 0.0F, 0.0F, 1, 2, 1, 0.25F); + var4.rotateAngleX = -0.20943952F; + var4.rotateAngleZ = 0.10471976F; + var3.addChild(var4); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + this.villagerNose.offsetX = this.villagerNose.offsetY = this.villagerNose.offsetZ = 0.0F; + float var8 = 0.01F * (float)(par7Entity.entityId % 10); + this.villagerNose.rotateAngleX = MathHelper.sin((float)par7Entity.ticksExisted * var8) * 4.5F * (float)Math.PI / 180.0F; + this.villagerNose.rotateAngleY = 0.0F; + this.villagerNose.rotateAngleZ = MathHelper.cos((float)par7Entity.ticksExisted * var8) * 2.5F * (float)Math.PI / 180.0F; + + if (this.field_82900_g) + { + this.villagerNose.rotateAngleX = -0.9F; + this.villagerNose.offsetZ = -0.09375F; + this.villagerNose.offsetY = 0.1875F; + } + } +} diff --git a/src/main/java/net/minecraft/src/ModelWither.java b/src/main/java/net/minecraft/src/ModelWither.java new file mode 100644 index 0000000..4440d10 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelWither.java @@ -0,0 +1,97 @@ +package net.minecraft.src; + +public class ModelWither extends ModelBase +{ + private ModelRenderer[] field_82905_a; + private ModelRenderer[] field_82904_b; + + public ModelWither() + { + this.textureWidth = 64; + this.textureHeight = 64; + this.field_82905_a = new ModelRenderer[3]; + this.field_82905_a[0] = new ModelRenderer(this, 0, 16); + this.field_82905_a[0].addBox(-10.0F, 3.9F, -0.5F, 20, 3, 3); + this.field_82905_a[1] = (new ModelRenderer(this)).setTextureSize(this.textureWidth, this.textureHeight); + this.field_82905_a[1].setRotationPoint(-2.0F, 6.9F, -0.5F); + this.field_82905_a[1].setTextureOffset(0, 22).addBox(0.0F, 0.0F, 0.0F, 3, 10, 3); + this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 1.5F, 0.5F, 11, 2, 2); + this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 4.0F, 0.5F, 11, 2, 2); + this.field_82905_a[1].setTextureOffset(24, 22).addBox(-4.0F, 6.5F, 0.5F, 11, 2, 2); + this.field_82905_a[2] = new ModelRenderer(this, 12, 22); + this.field_82905_a[2].addBox(0.0F, 0.0F, 0.0F, 3, 6, 3); + this.field_82904_b = new ModelRenderer[3]; + this.field_82904_b[0] = new ModelRenderer(this, 0, 0); + this.field_82904_b[0].addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8); + this.field_82904_b[1] = new ModelRenderer(this, 32, 0); + this.field_82904_b[1].addBox(-4.0F, -4.0F, -4.0F, 6, 6, 6); + this.field_82904_b[1].rotationPointX = -8.0F; + this.field_82904_b[1].rotationPointY = 4.0F; + this.field_82904_b[2] = new ModelRenderer(this, 32, 0); + this.field_82904_b[2].addBox(-4.0F, -4.0F, -4.0F, 6, 6, 6); + this.field_82904_b[2].rotationPointX = 10.0F; + this.field_82904_b[2].rotationPointY = 4.0F; + } + + public int func_82903_a() + { + return 32; + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + ModelRenderer[] var8 = this.field_82904_b; + int var9 = var8.length; + int var10; + ModelRenderer var11; + + for (var10 = 0; var10 < var9; ++var10) + { + var11 = var8[var10]; + var11.render(par7); + } + + var8 = this.field_82905_a; + var9 = var8.length; + + for (var10 = 0; var10 < var9; ++var10) + { + var11 = var8[var10]; + var11.render(par7); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + float var8 = MathHelper.cos(par3 * 0.1F); + this.field_82905_a[1].rotateAngleX = (0.065F + 0.05F * var8) * (float)Math.PI; + this.field_82905_a[2].setRotationPoint(-2.0F, 6.9F + MathHelper.cos(this.field_82905_a[1].rotateAngleX) * 10.0F, -0.5F + MathHelper.sin(this.field_82905_a[1].rotateAngleX) * 10.0F); + this.field_82905_a[2].rotateAngleX = (0.265F + 0.1F * var8) * (float)Math.PI; + this.field_82904_b[0].rotateAngleY = par4 / (180F / (float)Math.PI); + this.field_82904_b[0].rotateAngleX = par5 / (180F / (float)Math.PI); + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + EntityWither var5 = (EntityWither)par1EntityLivingBase; + + for (int var6 = 1; var6 < 3; ++var6) + { + this.field_82904_b[var6].rotateAngleY = (var5.func_82207_a(var6 - 1) - par1EntityLivingBase.renderYawOffset) / (180F / (float)Math.PI); + this.field_82904_b[var6].rotateAngleX = var5.func_82210_r(var6 - 1) / (180F / (float)Math.PI); + } + } +} diff --git a/src/main/java/net/minecraft/src/ModelWolf.java b/src/main/java/net/minecraft/src/ModelWolf.java new file mode 100644 index 0000000..be98236 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelWolf.java @@ -0,0 +1,173 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class ModelWolf extends ModelBase +{ + /** main box for the wolf head */ + public ModelRenderer wolfHeadMain; + + /** The wolf's body */ + public ModelRenderer wolfBody; + + /** Wolf'se first leg */ + public ModelRenderer wolfLeg1; + + /** Wolf's second leg */ + public ModelRenderer wolfLeg2; + + /** Wolf's third leg */ + public ModelRenderer wolfLeg3; + + /** Wolf's fourth leg */ + public ModelRenderer wolfLeg4; + + /** The wolf's tail */ + ModelRenderer wolfTail; + + /** The wolf's mane */ + ModelRenderer wolfMane; + + public ModelWolf() + { + float var1 = 0.0F; + float var2 = 13.5F; + this.wolfHeadMain = new ModelRenderer(this, 0, 0); + this.wolfHeadMain.addBox(-3.0F, -3.0F, -2.0F, 6, 6, 4, var1); + this.wolfHeadMain.setRotationPoint(-1.0F, var2, -7.0F); + this.wolfBody = new ModelRenderer(this, 18, 14); + this.wolfBody.addBox(-4.0F, -2.0F, -3.0F, 6, 9, 6, var1); + this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F); + this.wolfMane = new ModelRenderer(this, 21, 0); + this.wolfMane.addBox(-4.0F, -3.0F, -3.0F, 8, 6, 7, var1); + this.wolfMane.setRotationPoint(-1.0F, 14.0F, 2.0F); + this.wolfLeg1 = new ModelRenderer(this, 0, 18); + this.wolfLeg1.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, var1); + this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F); + this.wolfLeg2 = new ModelRenderer(this, 0, 18); + this.wolfLeg2.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, var1); + this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F); + this.wolfLeg3 = new ModelRenderer(this, 0, 18); + this.wolfLeg3.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, var1); + this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F); + this.wolfLeg4 = new ModelRenderer(this, 0, 18); + this.wolfLeg4.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, var1); + this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F); + this.wolfTail = new ModelRenderer(this, 9, 18); + this.wolfTail.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, var1); + this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F); + this.wolfHeadMain.setTextureOffset(16, 14).addBox(-3.0F, -5.0F, 0.0F, 2, 2, 1, var1); + this.wolfHeadMain.setTextureOffset(16, 14).addBox(1.0F, -5.0F, 0.0F, 2, 2, 1, var1); + this.wolfHeadMain.setTextureOffset(0, 10).addBox(-1.5F, 0.0F, -5.0F, 3, 3, 4, var1); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) + { + super.render(par1Entity, par2, par3, par4, par5, par6, par7); + this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); + + if (this.isChild) + { + float var8 = 2.0F; + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 5.0F * par7, 2.0F * par7); + this.wolfHeadMain.renderWithRotation(par7); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glScalef(1.0F / var8, 1.0F / var8, 1.0F / var8); + GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F); + this.wolfBody.render(par7); + this.wolfLeg1.render(par7); + this.wolfLeg2.render(par7); + this.wolfLeg3.render(par7); + this.wolfLeg4.render(par7); + this.wolfTail.renderWithRotation(par7); + this.wolfMane.render(par7); + GL11.glPopMatrix(); + } + else + { + this.wolfHeadMain.renderWithRotation(par7); + this.wolfBody.render(par7); + this.wolfLeg1.render(par7); + this.wolfLeg2.render(par7); + this.wolfLeg3.render(par7); + this.wolfLeg4.render(par7); + this.wolfTail.renderWithRotation(par7); + this.wolfMane.render(par7); + } + } + + /** + * Used for easily adding entity-dependent animations. The second and third float params here are the same second + * and third as in the setRotationAngles method. + */ + public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + EntityWolf var5 = (EntityWolf)par1EntityLivingBase; + + if (var5.isAngry()) + { + this.wolfTail.rotateAngleY = 0.0F; + } + else + { + this.wolfTail.rotateAngleY = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3; + } + + if (var5.isSitting()) + { + this.wolfMane.setRotationPoint(-1.0F, 16.0F, -3.0F); + this.wolfMane.rotateAngleX = ((float)Math.PI * 2F / 5F); + this.wolfMane.rotateAngleY = 0.0F; + this.wolfBody.setRotationPoint(0.0F, 18.0F, 0.0F); + this.wolfBody.rotateAngleX = ((float)Math.PI / 4F); + this.wolfTail.setRotationPoint(-1.0F, 21.0F, 6.0F); + this.wolfLeg1.setRotationPoint(-2.5F, 22.0F, 2.0F); + this.wolfLeg1.rotateAngleX = ((float)Math.PI * 3F / 2F); + this.wolfLeg2.setRotationPoint(0.5F, 22.0F, 2.0F); + this.wolfLeg2.rotateAngleX = ((float)Math.PI * 3F / 2F); + this.wolfLeg3.rotateAngleX = 5.811947F; + this.wolfLeg3.setRotationPoint(-2.49F, 17.0F, -4.0F); + this.wolfLeg4.rotateAngleX = 5.811947F; + this.wolfLeg4.setRotationPoint(0.51F, 17.0F, -4.0F); + } + else + { + this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F); + this.wolfBody.rotateAngleX = ((float)Math.PI / 2F); + this.wolfMane.setRotationPoint(-1.0F, 14.0F, -3.0F); + this.wolfMane.rotateAngleX = this.wolfBody.rotateAngleX; + this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F); + this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F); + this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F); + this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F); + this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F); + this.wolfLeg1.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3; + this.wolfLeg2.rotateAngleX = MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3; + this.wolfLeg3.rotateAngleX = MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3; + this.wolfLeg4.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3; + } + + this.wolfHeadMain.rotateAngleZ = var5.getInterestedAngle(par4) + var5.getShakeAngle(par4, 0.0F); + this.wolfMane.rotateAngleZ = var5.getShakeAngle(par4, -0.08F); + this.wolfBody.rotateAngleZ = var5.getShakeAngle(par4, -0.16F); + this.wolfTail.rotateAngleZ = var5.getShakeAngle(par4, -0.2F); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + this.wolfHeadMain.rotateAngleX = par5 / (180F / (float)Math.PI); + this.wolfHeadMain.rotateAngleY = par4 / (180F / (float)Math.PI); + this.wolfTail.rotateAngleX = par3; + } +} diff --git a/src/main/java/net/minecraft/src/ModelZombie.java b/src/main/java/net/minecraft/src/ModelZombie.java new file mode 100644 index 0000000..eb73926 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelZombie.java @@ -0,0 +1,43 @@ +package net.minecraft.src; + +public class ModelZombie extends ModelBiped +{ + public ModelZombie() + { + this(0.0F, false); + } + + protected ModelZombie(float par1, float par2, int par3, int par4) + { + super(par1, par2, par3, par4); + } + + public ModelZombie(float par1, boolean par2) + { + super(par1, 0.0F, 64, par2 ? 32 : 64); + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + float var8 = MathHelper.sin(this.onGround * (float)Math.PI); + float var9 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * (float)Math.PI); + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightArm.rotateAngleY = -(0.1F - var8 * 0.6F); + this.bipedLeftArm.rotateAngleY = 0.1F - var8 * 0.6F; + this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F); + this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); + this.bipedRightArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F; + this.bipedLeftArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F; + this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + } +} diff --git a/src/main/java/net/minecraft/src/ModelZombieVillager.java b/src/main/java/net/minecraft/src/ModelZombieVillager.java new file mode 100644 index 0000000..a1fa425 --- /dev/null +++ b/src/main/java/net/minecraft/src/ModelZombieVillager.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +public class ModelZombieVillager extends ModelBiped +{ + public ModelZombieVillager() + { + this(0.0F, 0.0F, false); + } + + public ModelZombieVillager(float par1, float par2, boolean par3) + { + super(par1, 0.0F, 64, par3 ? 32 : 64); + + if (par3) + { + this.bipedHead = new ModelRenderer(this, 0, 0); + this.bipedHead.addBox(-4.0F, -10.0F, -4.0F, 8, 6, 8, par1); + this.bipedHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F); + } + else + { + this.bipedHead = new ModelRenderer(this); + this.bipedHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F); + this.bipedHead.setTextureOffset(0, 32).addBox(-4.0F, -10.0F, -4.0F, 8, 10, 8, par1); + this.bipedHead.setTextureOffset(24, 32).addBox(-1.0F, -3.0F, -6.0F, 2, 4, 2, par1); + } + } + + public int func_82897_a() + { + return 10; + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) + { + super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity); + float var8 = MathHelper.sin(this.onGround * (float)Math.PI); + float var9 = MathHelper.sin((1.0F - (1.0F - this.onGround) * (1.0F - this.onGround)) * (float)Math.PI); + this.bipedRightArm.rotateAngleZ = 0.0F; + this.bipedLeftArm.rotateAngleZ = 0.0F; + this.bipedRightArm.rotateAngleY = -(0.1F - var8 * 0.6F); + this.bipedLeftArm.rotateAngleY = 0.1F - var8 * 0.6F; + this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F); + this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F); + this.bipedRightArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F; + this.bipedLeftArm.rotateAngleX -= var8 * 1.2F - var9 * 0.4F; + this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; + this.bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F; + this.bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F; + } +} diff --git a/src/main/java/net/minecraft/src/ModifiableAttributeInstance.java b/src/main/java/net/minecraft/src/ModifiableAttributeInstance.java new file mode 100644 index 0000000..0ae937a --- /dev/null +++ b/src/main/java/net/minecraft/src/ModifiableAttributeInstance.java @@ -0,0 +1,186 @@ +package net.minecraft.src; + +import com.google.common.collect.Maps; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +public class ModifiableAttributeInstance implements AttributeInstance +{ + private final BaseAttributeMap field_111138_a; + private final Attribute field_111136_b; + private final Map field_111137_c = Maps.newHashMap(); + private final Map field_111134_d = Maps.newHashMap(); + private final Map field_111135_e = Maps.newHashMap(); + private double baseValue; + private boolean field_111133_g = true; + private double field_111139_h; + + public ModifiableAttributeInstance(BaseAttributeMap par1BaseAttributeMap, Attribute par2Attribute) + { + this.field_111138_a = par1BaseAttributeMap; + this.field_111136_b = par2Attribute; + this.baseValue = par2Attribute.getDefaultValue(); + + for (int var3 = 0; var3 < 3; ++var3) + { + this.field_111137_c.put(Integer.valueOf(var3), new HashSet()); + } + } + + public Attribute func_111123_a() + { + return this.field_111136_b; + } + + public double getBaseValue() + { + return this.baseValue; + } + + public void setAttribute(double par1) + { + if (par1 != this.getBaseValue()) + { + this.baseValue = par1; + this.func_111131_f(); + } + } + + public Collection func_111130_a(int par1) + { + return (Collection)this.field_111137_c.get(Integer.valueOf(par1)); + } + + public Collection func_111122_c() + { + HashSet var1 = new HashSet(); + + for (int var2 = 0; var2 < 3; ++var2) + { + var1.addAll(this.func_111130_a(var2)); + } + + return var1; + } + + /** + * Returns attribute modifier, if any, by the given UUID + */ + public AttributeModifier getModifier(UUID par1UUID) + { + return (AttributeModifier)this.field_111135_e.get(par1UUID); + } + + public void applyModifier(AttributeModifier par1AttributeModifier) + { + if (this.getModifier(par1AttributeModifier.getID()) != null) + { + throw new IllegalArgumentException("Modifier is already applied on this attribute!"); + } + else + { + Object var2 = (Set)this.field_111134_d.get(par1AttributeModifier.getName()); + + if (var2 == null) + { + var2 = new HashSet(); + this.field_111134_d.put(par1AttributeModifier.getName(), var2); + } + + ((Set)this.field_111137_c.get(Integer.valueOf(par1AttributeModifier.getOperation()))).add(par1AttributeModifier); + ((Set)var2).add(par1AttributeModifier); + this.field_111135_e.put(par1AttributeModifier.getID(), par1AttributeModifier); + this.func_111131_f(); + } + } + + private void func_111131_f() + { + this.field_111133_g = true; + this.field_111138_a.func_111149_a(this); + } + + public void removeModifier(AttributeModifier par1AttributeModifier) + { + for (int var2 = 0; var2 < 3; ++var2) + { + Set var3 = (Set)this.field_111137_c.get(Integer.valueOf(var2)); + var3.remove(par1AttributeModifier); + } + + Set var4 = (Set)this.field_111134_d.get(par1AttributeModifier.getName()); + + if (var4 != null) + { + var4.remove(par1AttributeModifier); + + if (var4.isEmpty()) + { + this.field_111134_d.remove(par1AttributeModifier.getName()); + } + } + + this.field_111135_e.remove(par1AttributeModifier.getID()); + this.func_111131_f(); + } + + public void func_142049_d() + { + Collection var1 = this.func_111122_c(); + + if (var1 != null) + { + ArrayList var4 = new ArrayList(var1); + Iterator var2 = var4.iterator(); + + while (var2.hasNext()) + { + AttributeModifier var3 = (AttributeModifier)var2.next(); + this.removeModifier(var3); + } + } + } + + public double getAttributeValue() + { + if (this.field_111133_g) + { + this.field_111139_h = this.func_111129_g(); + this.field_111133_g = false; + } + + return this.field_111139_h; + } + + private double func_111129_g() + { + double var1 = this.getBaseValue(); + AttributeModifier var4; + + for (Iterator var3 = this.func_111130_a(0).iterator(); var3.hasNext(); var1 += var4.getAmount()) + { + var4 = (AttributeModifier)var3.next(); + } + + double var7 = var1; + Iterator var5; + AttributeModifier var6; + + for (var5 = this.func_111130_a(1).iterator(); var5.hasNext(); var7 += var1 * var6.getAmount()) + { + var6 = (AttributeModifier)var5.next(); + } + + for (var5 = this.func_111130_a(2).iterator(); var5.hasNext(); var7 *= 1.0D + var6.getAmount()) + { + var6 = (AttributeModifier)var5.next(); + } + + return this.field_111136_b.clampValue(var7); + } +} diff --git a/src/main/java/net/minecraft/src/MouseFilter.java b/src/main/java/net/minecraft/src/MouseFilter.java new file mode 100644 index 0000000..5b90be4 --- /dev/null +++ b/src/main/java/net/minecraft/src/MouseFilter.java @@ -0,0 +1,26 @@ +package net.minecraft.src; + +public class MouseFilter +{ + private float field_76336_a; + private float field_76334_b; + private float field_76335_c; + + /** + * Smooths mouse input + */ + public float smooth(float par1, float par2) + { + this.field_76336_a += par1; + par1 = (this.field_76336_a - this.field_76334_b) * par2; + this.field_76335_c += (par1 - this.field_76335_c) * 0.5F; + + if (par1 > 0.0F && par1 > this.field_76335_c || par1 < 0.0F && par1 < this.field_76335_c) + { + par1 = this.field_76335_c; + } + + this.field_76334_b += par1; + return par1; + } +} diff --git a/src/main/java/net/minecraft/src/MouseHelper.java b/src/main/java/net/minecraft/src/MouseHelper.java new file mode 100644 index 0000000..c84b6bd --- /dev/null +++ b/src/main/java/net/minecraft/src/MouseHelper.java @@ -0,0 +1,38 @@ +package net.minecraft.src; + +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.Display; + +public class MouseHelper +{ + /** Mouse delta X this frame */ + public int deltaX; + + /** Mouse delta Y this frame */ + public int deltaY; + + /** + * Grabs the mouse cursor it doesn't move and isn't seen. + */ + public void grabMouseCursor() + { + Mouse.setGrabbed(true); + this.deltaX = 0; + this.deltaY = 0; + } + + /** + * Ungrabs the mouse cursor so it can be moved and set it to the center of the screen + */ + public void ungrabMouseCursor() + { + Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2); + Mouse.setGrabbed(false); + } + + public void mouseXYChange() + { + this.deltaX = Mouse.getDX(); + this.deltaY = Mouse.getDY(); + } +} diff --git a/src/main/java/net/minecraft/src/MovementInput.java b/src/main/java/net/minecraft/src/MovementInput.java new file mode 100644 index 0000000..2dc7ad7 --- /dev/null +++ b/src/main/java/net/minecraft/src/MovementInput.java @@ -0,0 +1,18 @@ +package net.minecraft.src; + +public class MovementInput +{ + /** + * The speed at which the player is strafing. Postive numbers to the left and negative to the right. + */ + public float moveStrafe; + + /** + * The speed at which the player is moving forward. Negative numbers will move backwards. + */ + public float moveForward; + public boolean jump; + public boolean sneak; + + public void updatePlayerMoveState() {} +} diff --git a/src/main/java/net/minecraft/src/MovementInputFromOptions.java b/src/main/java/net/minecraft/src/MovementInputFromOptions.java new file mode 100644 index 0000000..c6d6616 --- /dev/null +++ b/src/main/java/net/minecraft/src/MovementInputFromOptions.java @@ -0,0 +1,46 @@ +package net.minecraft.src; + +public class MovementInputFromOptions extends MovementInput +{ + private GameSettings gameSettings; + + public MovementInputFromOptions(GameSettings par1GameSettings) + { + this.gameSettings = par1GameSettings; + } + + public void updatePlayerMoveState() + { + this.moveStrafe = 0.0F; + this.moveForward = 0.0F; + + if (this.gameSettings.keyBindForward.pressed) + { + ++this.moveForward; + } + + if (this.gameSettings.keyBindBack.pressed) + { + --this.moveForward; + } + + if (this.gameSettings.keyBindLeft.pressed) + { + ++this.moveStrafe; + } + + if (this.gameSettings.keyBindRight.pressed) + { + --this.moveStrafe; + } + + this.jump = this.gameSettings.keyBindJump.pressed; + this.sneak = this.gameSettings.keyBindSneak.pressed; + + if (this.sneak) + { + this.moveStrafe = (float)((double)this.moveStrafe * 0.3D); + this.moveForward = (float)((double)this.moveForward * 0.3D); + } + } +} diff --git a/src/main/java/net/minecraft/src/MovingObjectPosition.java b/src/main/java/net/minecraft/src/MovingObjectPosition.java new file mode 100644 index 0000000..15ecac2 --- /dev/null +++ b/src/main/java/net/minecraft/src/MovingObjectPosition.java @@ -0,0 +1,45 @@ +package net.minecraft.src; + +public class MovingObjectPosition +{ + /** What type of ray trace hit was this? 0 = block, 1 = entity */ + public EnumMovingObjectType typeOfHit; + + /** x coordinate of the block ray traced against */ + public int blockX; + + /** y coordinate of the block ray traced against */ + public int blockY; + + /** z coordinate of the block ray traced against */ + public int blockZ; + + /** + * Which side was hit. If its -1 then it went the full length of the ray trace. Bottom = 0, Top = 1, East = 2, West + * = 3, North = 4, South = 5. + */ + public int sideHit; + + /** The vector position of the hit */ + public Vec3 hitVec; + + /** The hit entity */ + public Entity entityHit; + + public MovingObjectPosition(int par1, int par2, int par3, int par4, Vec3 par5Vec3) + { + this.typeOfHit = EnumMovingObjectType.TILE; + this.blockX = par1; + this.blockY = par2; + this.blockZ = par3; + this.sideHit = par4; + this.hitVec = par5Vec3.myVec3LocalPool.getVecFromPool(par5Vec3.xCoord, par5Vec3.yCoord, par5Vec3.zCoord); + } + + public MovingObjectPosition(Entity par1Entity) + { + this.typeOfHit = EnumMovingObjectType.ENTITY; + this.entityHit = par1Entity; + this.hitVec = par1Entity.worldObj.getWorldVec3Pool().getVecFromPool(par1Entity.posX, par1Entity.posY, par1Entity.posZ); + } +} diff --git a/src/main/java/net/minecraft/src/NBTBase.java b/src/main/java/net/minecraft/src/NBTBase.java new file mode 100644 index 0000000..730985e --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTBase.java @@ -0,0 +1,236 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public abstract class NBTBase +{ + public static final String[] NBTTypes = new String[] {"END", "BYTE", "SHORT", "INT", "LONG", "FLOAT", "DOUBLE", "BYTE[]", "STRING", "LIST", "COMPOUND", "INT[]"}; + + /** The UTF string key used to lookup values. */ + private String name; + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + abstract void write(DataOutput var1) throws IOException; + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + abstract void load(DataInput var1, int var2) throws IOException; + + /** + * Gets the type byte for the tag. + */ + public abstract byte getId(); + + protected NBTBase(String par1Str) + { + if (par1Str == null) + { + this.name = ""; + } + else + { + this.name = par1Str; + } + } + + /** + * Sets the name for this tag and returns this for convenience. + */ + public NBTBase setName(String par1Str) + { + if (par1Str == null) + { + this.name = ""; + } + else + { + this.name = par1Str; + } + + return this; + } + + /** + * Gets the name corresponding to the tag, or an empty string if none set. + */ + public String getName() + { + return this.name == null ? "" : this.name; + } + + /** + * Reads and returns a tag from the given DataInput, or the End tag if no tag could be read. + */ + public static NBTBase readNamedTag(DataInput par0DataInput) throws IOException + { + return func_130104_b(par0DataInput, 0); + } + + public static NBTBase func_130104_b(DataInput par0DataInput, int par1) throws IOException + { + byte var2 = par0DataInput.readByte(); + + if (var2 == 0) + { + return new NBTTagEnd(); + } + else + { + String var3 = par0DataInput.readUTF(); + NBTBase var4 = newTag(var2, var3); + + try + { + var4.load(par0DataInput, par1); + return var4; + } + catch (IOException var8) + { + CrashReport var6 = CrashReport.makeCrashReport(var8, "Loading NBT data"); + CrashReportCategory var7 = var6.makeCategory("NBT Tag"); + var7.addCrashSection("Tag name", var3); + var7.addCrashSection("Tag type", Byte.valueOf(var2)); + throw new ReportedException(var6); + } + } + } + + /** + * Writes the specified tag to the given DataOutput, writing the type byte, the UTF string key and then calling the + * tag to write its data. + */ + public static void writeNamedTag(NBTBase par0NBTBase, DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(par0NBTBase.getId()); + + if (par0NBTBase.getId() != 0) + { + par1DataOutput.writeUTF(par0NBTBase.getName()); + par0NBTBase.write(par1DataOutput); + } + } + + /** + * Creates and returns a new tag of the specified type, or null if invalid. + */ + public static NBTBase newTag(byte par0, String par1Str) + { + switch (par0) + { + case 0: + return new NBTTagEnd(); + + case 1: + return new NBTTagByte(par1Str); + + case 2: + return new NBTTagShort(par1Str); + + case 3: + return new NBTTagInt(par1Str); + + case 4: + return new NBTTagLong(par1Str); + + case 5: + return new NBTTagFloat(par1Str); + + case 6: + return new NBTTagDouble(par1Str); + + case 7: + return new NBTTagByteArray(par1Str); + + case 8: + return new NBTTagString(par1Str); + + case 9: + return new NBTTagList(par1Str); + + case 10: + return new NBTTagCompound(par1Str); + + case 11: + return new NBTTagIntArray(par1Str); + + default: + return null; + } + } + + /** + * Returns the string name of a tag with the specified type, or 'UNKNOWN' if invalid. + */ + public static String getTagName(byte par0) + { + switch (par0) + { + case 0: + return "TAG_End"; + + case 1: + return "TAG_Byte"; + + case 2: + return "TAG_Short"; + + case 3: + return "TAG_Int"; + + case 4: + return "TAG_Long"; + + case 5: + return "TAG_Float"; + + case 6: + return "TAG_Double"; + + case 7: + return "TAG_Byte_Array"; + + case 8: + return "TAG_String"; + + case 9: + return "TAG_List"; + + case 10: + return "TAG_Compound"; + + case 11: + return "TAG_Int_Array"; + + default: + return "UNKNOWN"; + } + } + + /** + * Creates a clone of the tag. + */ + public abstract NBTBase copy(); + + public boolean equals(Object par1Obj) + { + if (!(par1Obj instanceof NBTBase)) + { + return false; + } + else + { + NBTBase var2 = (NBTBase)par1Obj; + return this.getId() != var2.getId() ? false : ((this.name != null || var2.name == null) && (this.name == null || var2.name != null) ? this.name == null || this.name.equals(var2.name) : false); + } + } + + public int hashCode() + { + return this.name.hashCode() ^ this.getId(); + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagByte.java b/src/main/java/net/minecraft/src/NBTTagByte.java new file mode 100644 index 0000000..6150162 --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagByte.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagByte extends NBTBase +{ + /** The byte value for the tag. */ + public byte data; + + public NBTTagByte(String par1Str) + { + super(par1Str); + } + + public NBTTagByte(String par1Str, byte par2) + { + super(par1Str); + this.data = par2; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.data); + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException + { + this.data = par1DataInput.readByte(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)1; + } + + public String toString() + { + return "" + this.data; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagByte(this.getName(), this.data); + } + + public boolean equals(Object par1Obj) + { + if (super.equals(par1Obj)) + { + NBTTagByte var2 = (NBTTagByte)par1Obj; + return this.data == var2.data; + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ this.data; + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagByteArray.java b/src/main/java/net/minecraft/src/NBTTagByteArray.java new file mode 100644 index 0000000..fa3c593 --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagByteArray.java @@ -0,0 +1,75 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Arrays; + +public class NBTTagByteArray extends NBTBase +{ + /** The byte array stored in the tag. */ + public byte[] byteArray; + + public NBTTagByteArray(String par1Str) + { + super(par1Str); + } + + public NBTTagByteArray(String par1Str, byte[] par2ArrayOfByte) + { + super(par1Str); + this.byteArray = par2ArrayOfByte; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.byteArray.length); + par1DataOutput.write(this.byteArray); + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException + { + int var3 = par1DataInput.readInt(); + this.byteArray = new byte[var3]; + par1DataInput.readFully(this.byteArray); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)7; + } + + public String toString() + { + return "[" + this.byteArray.length + " bytes]"; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + byte[] var1 = new byte[this.byteArray.length]; + System.arraycopy(this.byteArray, 0, var1, 0, this.byteArray.length); + return new NBTTagByteArray(this.getName(), var1); + } + + public boolean equals(Object par1Obj) + { + return super.equals(par1Obj) ? Arrays.equals(this.byteArray, ((NBTTagByteArray)par1Obj).byteArray) : false; + } + + public int hashCode() + { + return super.hashCode() ^ Arrays.hashCode(this.byteArray); + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagCompound.java b/src/main/java/net/minecraft/src/NBTTagCompound.java new file mode 100644 index 0000000..ec07483 --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagCompound.java @@ -0,0 +1,458 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +public class NBTTagCompound extends NBTBase +{ + /** + * The key-value pairs for the tag. Each key is a UTF string, each value is a tag. + */ + private Map tagMap = new HashMap(); + + public NBTTagCompound() + { + super(""); + } + + public NBTTagCompound(String par1Str) + { + super(par1Str); + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException + { + Iterator var2 = this.tagMap.values().iterator(); + + while (var2.hasNext()) + { + NBTBase var3 = (NBTBase)var2.next(); + NBTBase.writeNamedTag(var3, par1DataOutput); + } + + par1DataOutput.writeByte(0); + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException + { + if (par2 > 512) + { + throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512"); + } + else + { + this.tagMap.clear(); + NBTBase var3; + + while ((var3 = NBTBase.func_130104_b(par1DataInput, par2 + 1)).getId() != 0) + { + this.tagMap.put(var3.getName(), var3); + } + } + } + + /** + * Returns all the values in the tagMap HashMap. + */ + public Collection getTags() + { + return this.tagMap.values(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)10; + } + + /** + * Stores the given tag into the map with the given string key. This is mostly used to store tag lists. + */ + public void setTag(String par1Str, NBTBase par2NBTBase) + { + this.tagMap.put(par1Str, par2NBTBase.setName(par1Str)); + } + + /** + * Stores a new NBTTagByte with the given byte value into the map with the given string key. + */ + public void setByte(String par1Str, byte par2) + { + this.tagMap.put(par1Str, new NBTTagByte(par1Str, par2)); + } + + /** + * Stores a new NBTTagShort with the given short value into the map with the given string key. + */ + public void setShort(String par1Str, short par2) + { + this.tagMap.put(par1Str, new NBTTagShort(par1Str, par2)); + } + + /** + * Stores a new NBTTagInt with the given integer value into the map with the given string key. + */ + public void setInteger(String par1Str, int par2) + { + this.tagMap.put(par1Str, new NBTTagInt(par1Str, par2)); + } + + /** + * Stores a new NBTTagLong with the given long value into the map with the given string key. + */ + public void setLong(String par1Str, long par2) + { + this.tagMap.put(par1Str, new NBTTagLong(par1Str, par2)); + } + + /** + * Stores a new NBTTagFloat with the given float value into the map with the given string key. + */ + public void setFloat(String par1Str, float par2) + { + this.tagMap.put(par1Str, new NBTTagFloat(par1Str, par2)); + } + + /** + * Stores a new NBTTagDouble with the given double value into the map with the given string key. + */ + public void setDouble(String par1Str, double par2) + { + this.tagMap.put(par1Str, new NBTTagDouble(par1Str, par2)); + } + + /** + * Stores a new NBTTagString with the given string value into the map with the given string key. + */ + public void setString(String par1Str, String par2Str) + { + this.tagMap.put(par1Str, new NBTTagString(par1Str, par2Str)); + } + + /** + * Stores a new NBTTagByteArray with the given array as data into the map with the given string key. + */ + public void setByteArray(String par1Str, byte[] par2ArrayOfByte) + { + this.tagMap.put(par1Str, new NBTTagByteArray(par1Str, par2ArrayOfByte)); + } + + /** + * Stores a new NBTTagIntArray with the given array as data into the map with the given string key. + */ + public void setIntArray(String par1Str, int[] par2ArrayOfInteger) + { + this.tagMap.put(par1Str, new NBTTagIntArray(par1Str, par2ArrayOfInteger)); + } + + /** + * Stores the given NBTTagCompound into the map with the given string key. + */ + public void setCompoundTag(String par1Str, NBTTagCompound par2NBTTagCompound) + { + this.tagMap.put(par1Str, par2NBTTagCompound.setName(par1Str)); + } + + /** + * Stores the given boolean value as a NBTTagByte, storing 1 for true and 0 for false, using the given string key. + */ + public void setBoolean(String par1Str, boolean par2) + { + this.setByte(par1Str, (byte)(par2 ? 1 : 0)); + } + + /** + * gets a generic tag with the specified name + */ + public NBTBase getTag(String par1Str) + { + return (NBTBase)this.tagMap.get(par1Str); + } + + /** + * Returns whether the given string has been previously stored as a key in the map. + */ + public boolean hasKey(String par1Str) + { + return this.tagMap.containsKey(par1Str); + } + + /** + * Retrieves a byte value using the specified key, or 0 if no such key was stored. + */ + public byte getByte(String par1Str) + { + try + { + return !this.tagMap.containsKey(par1Str) ? 0 : ((NBTTagByte)this.tagMap.get(par1Str)).data; + } + catch (ClassCastException var3) + { + throw new ReportedException(this.createCrashReport(par1Str, 1, var3)); + } + } + + /** + * Retrieves a short value using the specified key, or 0 if no such key was stored. + */ + public short getShort(String par1Str) + { + try + { + return !this.tagMap.containsKey(par1Str) ? 0 : ((NBTTagShort)this.tagMap.get(par1Str)).data; + } + catch (ClassCastException var3) + { + throw new ReportedException(this.createCrashReport(par1Str, 2, var3)); + } + } + + /** + * Retrieves an integer value using the specified key, or 0 if no such key was stored. + */ + public int getInteger(String par1Str) + { + try + { + return !this.tagMap.containsKey(par1Str) ? 0 : ((NBTTagInt)this.tagMap.get(par1Str)).data; + } + catch (ClassCastException var3) + { + throw new ReportedException(this.createCrashReport(par1Str, 3, var3)); + } + } + + /** + * Retrieves a long value using the specified key, or 0 if no such key was stored. + */ + public long getLong(String par1Str) + { + try + { + return !this.tagMap.containsKey(par1Str) ? 0L : ((NBTTagLong)this.tagMap.get(par1Str)).data; + } + catch (ClassCastException var3) + { + throw new ReportedException(this.createCrashReport(par1Str, 4, var3)); + } + } + + /** + * Retrieves a float value using the specified key, or 0 if no such key was stored. + */ + public float getFloat(String par1Str) + { + try + { + return !this.tagMap.containsKey(par1Str) ? 0.0F : ((NBTTagFloat)this.tagMap.get(par1Str)).data; + } + catch (ClassCastException var3) + { + throw new ReportedException(this.createCrashReport(par1Str, 5, var3)); + } + } + + /** + * Retrieves a double value using the specified key, or 0 if no such key was stored. + */ + public double getDouble(String par1Str) + { + try + { + return !this.tagMap.containsKey(par1Str) ? 0.0D : ((NBTTagDouble)this.tagMap.get(par1Str)).data; + } + catch (ClassCastException var3) + { + throw new ReportedException(this.createCrashReport(par1Str, 6, var3)); + } + } + + /** + * Retrieves a string value using the specified key, or an empty string if no such key was stored. + */ + public String getString(String par1Str) + { + try + { + return !this.tagMap.containsKey(par1Str) ? "" : ((NBTTagString)this.tagMap.get(par1Str)).data; + } + catch (ClassCastException var3) + { + throw new ReportedException(this.createCrashReport(par1Str, 8, var3)); + } + } + + /** + * Retrieves a byte array using the specified key, or a zero-length array if no such key was stored. + */ + public byte[] getByteArray(String par1Str) + { + try + { + return !this.tagMap.containsKey(par1Str) ? new byte[0] : ((NBTTagByteArray)this.tagMap.get(par1Str)).byteArray; + } + catch (ClassCastException var3) + { + throw new ReportedException(this.createCrashReport(par1Str, 7, var3)); + } + } + + /** + * Retrieves an int array using the specified key, or a zero-length array if no such key was stored. + */ + public int[] getIntArray(String par1Str) + { + try + { + return !this.tagMap.containsKey(par1Str) ? new int[0] : ((NBTTagIntArray)this.tagMap.get(par1Str)).intArray; + } + catch (ClassCastException var3) + { + throw new ReportedException(this.createCrashReport(par1Str, 11, var3)); + } + } + + /** + * Retrieves a NBTTagCompound subtag matching the specified key, or a new empty NBTTagCompound if no such key was + * stored. + */ + public NBTTagCompound getCompoundTag(String par1Str) + { + try + { + return !this.tagMap.containsKey(par1Str) ? new NBTTagCompound(par1Str) : (NBTTagCompound)this.tagMap.get(par1Str); + } + catch (ClassCastException var3) + { + throw new ReportedException(this.createCrashReport(par1Str, 10, var3)); + } + } + + /** + * Retrieves a NBTTagList subtag matching the specified key, or a new empty NBTTagList if no such key was stored. + */ + public NBTTagList getTagList(String par1Str) + { + try + { + return !this.tagMap.containsKey(par1Str) ? new NBTTagList(par1Str) : (NBTTagList)this.tagMap.get(par1Str); + } + catch (ClassCastException var3) + { + throw new ReportedException(this.createCrashReport(par1Str, 9, var3)); + } + } + + /** + * Retrieves a boolean value using the specified key, or false if no such key was stored. This uses the getByte + * method. + */ + public boolean getBoolean(String par1Str) + { + return this.getByte(par1Str) != 0; + } + + /** + * Remove the specified tag. + */ + public void removeTag(String par1Str) + { + this.tagMap.remove(par1Str); + } + + public String toString() + { + String var1 = this.getName() + ":["; + String var3; + + for (Iterator var2 = this.tagMap.keySet().iterator(); var2.hasNext(); var1 = var1 + var3 + ":" + this.tagMap.get(var3) + ",") + { + var3 = (String)var2.next(); + } + + return var1 + "]"; + } + + /** + * Return whether this compound has no tags. + */ + public boolean hasNoTags() + { + return this.tagMap.isEmpty(); + } + + /** + * Create a crash report which indicates a NBT read error. + */ + private CrashReport createCrashReport(String par1Str, int par2, ClassCastException par3ClassCastException) + { + CrashReport var4 = CrashReport.makeCrashReport(par3ClassCastException, "Reading NBT data"); + CrashReportCategory var5 = var4.makeCategoryDepth("Corrupt NBT tag", 1); + var5.addCrashSectionCallable("Tag type found", new CallableTagCompound1(this, par1Str)); + var5.addCrashSectionCallable("Tag type expected", new CallableTagCompound2(this, par2)); + var5.addCrashSection("Tag name", par1Str); + + if (this.getName() != null && this.getName().length() > 0) + { + var5.addCrashSection("Tag parent", this.getName()); + } + + return var4; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + NBTTagCompound var1 = new NBTTagCompound(this.getName()); + Iterator var2 = this.tagMap.keySet().iterator(); + + while (var2.hasNext()) + { + String var3 = (String)var2.next(); + var1.setTag(var3, ((NBTBase)this.tagMap.get(var3)).copy()); + } + + return var1; + } + + public boolean equals(Object par1Obj) + { + if (super.equals(par1Obj)) + { + NBTTagCompound var2 = (NBTTagCompound)par1Obj; + return this.tagMap.entrySet().equals(var2.tagMap.entrySet()); + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ this.tagMap.hashCode(); + } + + /** + * Return the tag map for this compound. + */ + static Map getTagMap(NBTTagCompound par0NBTTagCompound) + { + return par0NBTTagCompound.tagMap; + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagDouble.java b/src/main/java/net/minecraft/src/NBTTagDouble.java new file mode 100644 index 0000000..b943a47 --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagDouble.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagDouble extends NBTBase +{ + /** The double value for the tag. */ + public double data; + + public NBTTagDouble(String par1Str) + { + super(par1Str); + } + + public NBTTagDouble(String par1Str, double par2) + { + super(par1Str); + this.data = par2; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeDouble(this.data); + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException + { + this.data = par1DataInput.readDouble(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)6; + } + + public String toString() + { + return "" + this.data; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagDouble(this.getName(), this.data); + } + + public boolean equals(Object par1Obj) + { + if (super.equals(par1Obj)) + { + NBTTagDouble var2 = (NBTTagDouble)par1Obj; + return this.data == var2.data; + } + else + { + return false; + } + } + + public int hashCode() + { + long var1 = Double.doubleToLongBits(this.data); + return super.hashCode() ^ (int)(var1 ^ var1 >>> 32); + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagEnd.java b/src/main/java/net/minecraft/src/NBTTagEnd.java new file mode 100644 index 0000000..b987b6d --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagEnd.java @@ -0,0 +1,44 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagEnd extends NBTBase +{ + public NBTTagEnd() + { + super((String)null); + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException {} + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException {} + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)0; + } + + public String toString() + { + return "END"; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagEnd(); + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagFloat.java b/src/main/java/net/minecraft/src/NBTTagFloat.java new file mode 100644 index 0000000..0a6af61 --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagFloat.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagFloat extends NBTBase +{ + /** The float value for the tag. */ + public float data; + + public NBTTagFloat(String par1Str) + { + super(par1Str); + } + + public NBTTagFloat(String par1Str, float par2) + { + super(par1Str); + this.data = par2; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeFloat(this.data); + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException + { + this.data = par1DataInput.readFloat(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)5; + } + + public String toString() + { + return "" + this.data; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagFloat(this.getName(), this.data); + } + + public boolean equals(Object par1Obj) + { + if (super.equals(par1Obj)) + { + NBTTagFloat var2 = (NBTTagFloat)par1Obj; + return this.data == var2.data; + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ Float.floatToIntBits(this.data); + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagInt.java b/src/main/java/net/minecraft/src/NBTTagInt.java new file mode 100644 index 0000000..e64175b --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagInt.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagInt extends NBTBase +{ + /** The integer value for the tag. */ + public int data; + + public NBTTagInt(String par1Str) + { + super(par1Str); + } + + public NBTTagInt(String par1Str, int par2) + { + super(par1Str); + this.data = par2; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.data); + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException + { + this.data = par1DataInput.readInt(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)3; + } + + public String toString() + { + return "" + this.data; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagInt(this.getName(), this.data); + } + + public boolean equals(Object par1Obj) + { + if (super.equals(par1Obj)) + { + NBTTagInt var2 = (NBTTagInt)par1Obj; + return this.data == var2.data; + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ this.data; + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagIntArray.java b/src/main/java/net/minecraft/src/NBTTagIntArray.java new file mode 100644 index 0000000..314ab6a --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagIntArray.java @@ -0,0 +1,91 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Arrays; + +public class NBTTagIntArray extends NBTBase +{ + /** The array of saved integers */ + public int[] intArray; + + public NBTTagIntArray(String par1Str) + { + super(par1Str); + } + + public NBTTagIntArray(String par1Str, int[] par2ArrayOfInteger) + { + super(par1Str); + this.intArray = par2ArrayOfInteger; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.intArray.length); + + for (int var2 = 0; var2 < this.intArray.length; ++var2) + { + par1DataOutput.writeInt(this.intArray[var2]); + } + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException + { + int var3 = par1DataInput.readInt(); + this.intArray = new int[var3]; + + for (int var4 = 0; var4 < var3; ++var4) + { + this.intArray[var4] = par1DataInput.readInt(); + } + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)11; + } + + public String toString() + { + return "[" + this.intArray.length + " bytes]"; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + int[] var1 = new int[this.intArray.length]; + System.arraycopy(this.intArray, 0, var1, 0, this.intArray.length); + return new NBTTagIntArray(this.getName(), var1); + } + + public boolean equals(Object par1Obj) + { + if (!super.equals(par1Obj)) + { + return false; + } + else + { + NBTTagIntArray var2 = (NBTTagIntArray)par1Obj; + return this.intArray == null && var2.intArray == null || this.intArray != null && Arrays.equals(this.intArray, var2.intArray); + } + } + + public int hashCode() + { + return super.hashCode() ^ Arrays.hashCode(this.intArray); + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagList.java b/src/main/java/net/minecraft/src/NBTTagList.java new file mode 100644 index 0000000..3e66ca7 --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagList.java @@ -0,0 +1,162 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class NBTTagList extends NBTBase +{ + /** The array list containing the tags encapsulated in this list. */ + private List tagList = new ArrayList(); + + /** + * The type byte for the tags in the list - they must all be of the same type. + */ + private byte tagType; + + public NBTTagList() + { + super(""); + } + + public NBTTagList(String par1Str) + { + super(par1Str); + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException + { + if (!this.tagList.isEmpty()) + { + this.tagType = ((NBTBase)this.tagList.get(0)).getId(); + } + else + { + this.tagType = 1; + } + + par1DataOutput.writeByte(this.tagType); + par1DataOutput.writeInt(this.tagList.size()); + + for (int var2 = 0; var2 < this.tagList.size(); ++var2) + { + ((NBTBase)this.tagList.get(var2)).write(par1DataOutput); + } + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException + { + if (par2 > 512) + { + throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512"); + } + else + { + this.tagType = par1DataInput.readByte(); + int var3 = par1DataInput.readInt(); + this.tagList = new ArrayList(); + + for (int var4 = 0; var4 < var3; ++var4) + { + NBTBase var5 = NBTBase.newTag(this.tagType, (String)null); + var5.load(par1DataInput, par2 + 1); + this.tagList.add(var5); + } + } + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)9; + } + + public String toString() + { + return "" + this.tagList.size() + " entries of type " + NBTBase.getTagName(this.tagType); + } + + /** + * Adds the provided tag to the end of the list. There is no check to verify this tag is of the same type as any + * previous tag. + */ + public void appendTag(NBTBase par1NBTBase) + { + this.tagType = par1NBTBase.getId(); + this.tagList.add(par1NBTBase); + } + + /** + * Removes a tag at the given index. + */ + public NBTBase removeTag(int par1) + { + return (NBTBase)this.tagList.remove(par1); + } + + /** + * Retrieves the tag at the specified index from the list. + */ + public NBTBase tagAt(int par1) + { + return (NBTBase)this.tagList.get(par1); + } + + /** + * Returns the number of tags in the list. + */ + public int tagCount() + { + return this.tagList.size(); + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + NBTTagList var1 = new NBTTagList(this.getName()); + var1.tagType = this.tagType; + Iterator var2 = this.tagList.iterator(); + + while (var2.hasNext()) + { + NBTBase var3 = (NBTBase)var2.next(); + NBTBase var4 = var3.copy(); + var1.tagList.add(var4); + } + + return var1; + } + + public boolean equals(Object par1Obj) + { + if (super.equals(par1Obj)) + { + NBTTagList var2 = (NBTTagList)par1Obj; + + if (this.tagType == var2.tagType) + { + return this.tagList.equals(var2.tagList); + } + } + + return false; + } + + public int hashCode() + { + return super.hashCode() ^ this.tagList.hashCode(); + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagLong.java b/src/main/java/net/minecraft/src/NBTTagLong.java new file mode 100644 index 0000000..a876fed --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagLong.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagLong extends NBTBase +{ + /** The long value for the tag. */ + public long data; + + public NBTTagLong(String par1Str) + { + super(par1Str); + } + + public NBTTagLong(String par1Str, long par2) + { + super(par1Str); + this.data = par2; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeLong(this.data); + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException + { + this.data = par1DataInput.readLong(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)4; + } + + public String toString() + { + return "" + this.data; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagLong(this.getName(), this.data); + } + + public boolean equals(Object par1Obj) + { + if (super.equals(par1Obj)) + { + NBTTagLong var2 = (NBTTagLong)par1Obj; + return this.data == var2.data; + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ (int)(this.data ^ this.data >>> 32); + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagShort.java b/src/main/java/net/minecraft/src/NBTTagShort.java new file mode 100644 index 0000000..8c2f590 --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagShort.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagShort extends NBTBase +{ + /** The short value for the tag. */ + public short data; + + public NBTTagShort(String par1Str) + { + super(par1Str); + } + + public NBTTagShort(String par1Str, short par2) + { + super(par1Str); + this.data = par2; + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeShort(this.data); + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException + { + this.data = par1DataInput.readShort(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)2; + } + + public String toString() + { + return "" + this.data; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagShort(this.getName(), this.data); + } + + public boolean equals(Object par1Obj) + { + if (super.equals(par1Obj)) + { + NBTTagShort var2 = (NBTTagShort)par1Obj; + return this.data == var2.data; + } + else + { + return false; + } + } + + public int hashCode() + { + return super.hashCode() ^ this.data; + } +} diff --git a/src/main/java/net/minecraft/src/NBTTagString.java b/src/main/java/net/minecraft/src/NBTTagString.java new file mode 100644 index 0000000..f621564 --- /dev/null +++ b/src/main/java/net/minecraft/src/NBTTagString.java @@ -0,0 +1,82 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class NBTTagString extends NBTBase +{ + /** The string value for the tag (cannot be empty). */ + public String data; + + public NBTTagString(String par1Str) + { + super(par1Str); + } + + public NBTTagString(String par1Str, String par2Str) + { + super(par1Str); + this.data = par2Str; + + if (par2Str == null) + { + throw new IllegalArgumentException("Empty string not allowed"); + } + } + + /** + * Write the actual data contents of the tag, implemented in NBT extension classes + */ + void write(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeUTF(this.data); + } + + /** + * Read the actual data contents of the tag, implemented in NBT extension classes + */ + void load(DataInput par1DataInput, int par2) throws IOException + { + this.data = par1DataInput.readUTF(); + } + + /** + * Gets the type byte for the tag. + */ + public byte getId() + { + return (byte)8; + } + + public String toString() + { + return "" + this.data; + } + + /** + * Creates a clone of the tag. + */ + public NBTBase copy() + { + return new NBTTagString(this.getName(), this.data); + } + + public boolean equals(Object par1Obj) + { + if (!super.equals(par1Obj)) + { + return false; + } + else + { + NBTTagString var2 = (NBTTagString)par1Obj; + return this.data == null && var2.data == null || this.data != null && this.data.equals(var2.data); + } + } + + public int hashCode() + { + return super.hashCode() ^ this.data.hashCode(); + } +} diff --git a/src/main/java/net/minecraft/src/NetClientHandler.java b/src/main/java/net/minecraft/src/NetClientHandler.java new file mode 100644 index 0000000..7ac20d0 --- /dev/null +++ b/src/main/java/net/minecraft/src/NetClientHandler.java @@ -0,0 +1,1673 @@ +package net.minecraft.src; + +import com.google.common.base.Charsets; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.math.BigInteger; +import java.net.InetAddress; +import java.net.Socket; +import java.net.URL; +import java.net.URLEncoder; +import java.security.PublicKey; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import javax.crypto.SecretKey; +import net.minecraft.client.ClientBrandRetriever; +import org.lwjgl.input.Keyboard; + +public class NetClientHandler extends NetHandler +{ + /** True if kicked or disconnected from the server. */ + private boolean disconnected; + + /** Reference to the NetworkManager object. */ + private INetworkManager netManager; + public String field_72560_a; + + /** Reference to the Minecraft object. */ + private Minecraft mc; + private WorldClient worldClient; + + /** + * True if the client has finished downloading terrain and may spawn. Set upon receipt of a player position packet, + * reset upon respawning. + */ + private boolean doneLoadingTerrain; + public MapStorage mapStorage = new MapStorage((ISaveHandler)null); + + /** A HashMap of all player names and their player information objects */ + private Map playerInfoMap = new HashMap(); + + /** + * An ArrayList of GuiPlayerInfo (includes all the players' GuiPlayerInfo on the current server) + */ + public List playerInfoList = new ArrayList(); + public int currentServerMaxPlayers = 20; + private GuiScreen field_98183_l; + + /** RNG. */ + Random rand = new Random(); + + public NetClientHandler(Minecraft par1Minecraft, String par2Str, int par3) throws IOException + { + this.mc = par1Minecraft; + Socket var4 = new Socket(InetAddress.getByName(par2Str), par3); + this.netManager = new TcpConnection(par1Minecraft.getLogAgent(), var4, "Client", this); + } + + public NetClientHandler(Minecraft par1Minecraft, String par2Str, int par3, GuiScreen par4GuiScreen) throws IOException + { + this.mc = par1Minecraft; + this.field_98183_l = par4GuiScreen; + Socket var5 = new Socket(InetAddress.getByName(par2Str), par3); + this.netManager = new TcpConnection(par1Minecraft.getLogAgent(), var5, "Client", this); + } + + public NetClientHandler(Minecraft par1Minecraft, IntegratedServer par2IntegratedServer) throws IOException + { + this.mc = par1Minecraft; + this.netManager = new MemoryConnection(par1Minecraft.getLogAgent(), this); + par2IntegratedServer.getServerListeningThread().func_71754_a((MemoryConnection)this.netManager, par1Minecraft.getSession().getUsername()); + } + + /** + * sets netManager and worldClient to null + */ + public void cleanup() + { + if (this.netManager != null) + { + this.netManager.wakeThreads(); + } + + this.netManager = null; + this.worldClient = null; + } + + /** + * Processes the packets that have been read since the last call to this function. + */ + public void processReadPackets() + { + if (!this.disconnected && this.netManager != null) + { + this.netManager.processReadPackets(); + } + + if (this.netManager != null) + { + this.netManager.wakeThreads(); + } + } + + public void handleServerAuthData(Packet253ServerAuthData par1Packet253ServerAuthData) + { + String var2 = par1Packet253ServerAuthData.getServerId().trim(); + PublicKey var3 = par1Packet253ServerAuthData.getPublicKey(); + SecretKey var4 = CryptManager.createNewSharedKey(); + + if (!"-".equals(var2)) + { + String var5 = (new BigInteger(CryptManager.getServerIdHash(var2, var3, var4))).toString(16); + String var6 = this.sendSessionRequest(this.mc.getSession().getUsername(), this.mc.getSession().getSessionID(), var5); + + if (!"ok".equalsIgnoreCase(var6)) + { + this.netManager.networkShutdown("disconnect.loginFailedInfo", new Object[] {var6}); + return; + } + } + + this.addToSendQueue(new Packet252SharedKey(var4, var3, par1Packet253ServerAuthData.getVerifyToken())); + } + + /** + * Send request to http://session.minecraft.net with user's sessionId and serverId hash + */ + private String sendSessionRequest(String par1Str, String par2Str, String par3Str) + { + try + { + URL var4 = new URL("http://session.minecraft.net/game/joinserver.jsp?user=" + urlEncode(par1Str) + "&sessionId=" + urlEncode(par2Str) + "&serverId=" + urlEncode(par3Str)); + InputStream var5 = var4.openConnection(this.mc.getProxy()).getInputStream(); + BufferedReader var6 = new BufferedReader(new InputStreamReader(var5)); + String var7 = var6.readLine(); + var6.close(); + return var7; + } + catch (IOException var8) + { + return var8.toString(); + } + } + + /** + * Encode the given string for insertion into a URL + */ + private static String urlEncode(String par0Str) throws IOException + { + return URLEncoder.encode(par0Str, "UTF-8"); + } + + public void handleSharedKey(Packet252SharedKey par1Packet252SharedKey) + { + this.addToSendQueue(new Packet205ClientCommand(0)); + } + + public void handleLogin(Packet1Login par1Packet1Login) + { + this.mc.playerController = new PlayerControllerMP(this.mc, this); + this.mc.statFileWriter.readStat(StatList.joinMultiplayerStat, 1); + this.worldClient = new WorldClient(this, new WorldSettings(0L, par1Packet1Login.gameType, false, par1Packet1Login.hardcoreMode, par1Packet1Login.terrainType), par1Packet1Login.dimension, par1Packet1Login.difficultySetting, this.mc.mcProfiler, this.mc.getLogAgent()); + this.worldClient.isRemote = true; + this.mc.loadWorld(this.worldClient); + this.mc.thePlayer.dimension = par1Packet1Login.dimension; + this.mc.displayGuiScreen(new GuiDownloadTerrain(this)); + this.mc.thePlayer.entityId = par1Packet1Login.clientEntityId; + this.currentServerMaxPlayers = par1Packet1Login.maxPlayers; + this.mc.playerController.setGameType(par1Packet1Login.gameType); + this.mc.gameSettings.sendSettingsToServer(); + this.netManager.addToSendQueue(new Packet250CustomPayload("MC|Brand", ClientBrandRetriever.getClientModName().getBytes(Charsets.UTF_8))); + } + + public void handleVehicleSpawn(Packet23VehicleSpawn par1Packet23VehicleSpawn) + { + double var2 = (double)par1Packet23VehicleSpawn.xPosition / 32.0D; + double var4 = (double)par1Packet23VehicleSpawn.yPosition / 32.0D; + double var6 = (double)par1Packet23VehicleSpawn.zPosition / 32.0D; + Object var8 = null; + + if (par1Packet23VehicleSpawn.type == 10) + { + var8 = EntityMinecart.createMinecart(this.worldClient, var2, var4, var6, par1Packet23VehicleSpawn.throwerEntityId); + } + else if (par1Packet23VehicleSpawn.type == 90) + { + Entity var9 = this.getEntityByID(par1Packet23VehicleSpawn.throwerEntityId); + + if (var9 instanceof EntityPlayer) + { + var8 = new EntityFishHook(this.worldClient, var2, var4, var6, (EntityPlayer)var9); + } + + par1Packet23VehicleSpawn.throwerEntityId = 0; + } + else if (par1Packet23VehicleSpawn.type == 60) + { + var8 = new EntityArrow(this.worldClient, var2, var4, var6); + } + else if (par1Packet23VehicleSpawn.type == 61) + { + var8 = new EntitySnowball(this.worldClient, var2, var4, var6); + } + else if (par1Packet23VehicleSpawn.type == 71) + { + var8 = new EntityItemFrame(this.worldClient, (int)var2, (int)var4, (int)var6, par1Packet23VehicleSpawn.throwerEntityId); + par1Packet23VehicleSpawn.throwerEntityId = 0; + } + else if (par1Packet23VehicleSpawn.type == 77) + { + var8 = new EntityLeashKnot(this.worldClient, (int)var2, (int)var4, (int)var6); + par1Packet23VehicleSpawn.throwerEntityId = 0; + } + else if (par1Packet23VehicleSpawn.type == 65) + { + var8 = new EntityEnderPearl(this.worldClient, var2, var4, var6); + } + else if (par1Packet23VehicleSpawn.type == 72) + { + var8 = new EntityEnderEye(this.worldClient, var2, var4, var6); + } + else if (par1Packet23VehicleSpawn.type == 76) + { + var8 = new EntityFireworkRocket(this.worldClient, var2, var4, var6, (ItemStack)null); + } + else if (par1Packet23VehicleSpawn.type == 63) + { + var8 = new EntityLargeFireball(this.worldClient, var2, var4, var6, (double)par1Packet23VehicleSpawn.speedX / 8000.0D, (double)par1Packet23VehicleSpawn.speedY / 8000.0D, (double)par1Packet23VehicleSpawn.speedZ / 8000.0D); + par1Packet23VehicleSpawn.throwerEntityId = 0; + } + else if (par1Packet23VehicleSpawn.type == 64) + { + var8 = new EntitySmallFireball(this.worldClient, var2, var4, var6, (double)par1Packet23VehicleSpawn.speedX / 8000.0D, (double)par1Packet23VehicleSpawn.speedY / 8000.0D, (double)par1Packet23VehicleSpawn.speedZ / 8000.0D); + par1Packet23VehicleSpawn.throwerEntityId = 0; + } + else if (par1Packet23VehicleSpawn.type == 66) + { + var8 = new EntityWitherSkull(this.worldClient, var2, var4, var6, (double)par1Packet23VehicleSpawn.speedX / 8000.0D, (double)par1Packet23VehicleSpawn.speedY / 8000.0D, (double)par1Packet23VehicleSpawn.speedZ / 8000.0D); + par1Packet23VehicleSpawn.throwerEntityId = 0; + } + else if (par1Packet23VehicleSpawn.type == 62) + { + var8 = new EntityEgg(this.worldClient, var2, var4, var6); + } + else if (par1Packet23VehicleSpawn.type == 73) + { + var8 = new EntityPotion(this.worldClient, var2, var4, var6, par1Packet23VehicleSpawn.throwerEntityId); + par1Packet23VehicleSpawn.throwerEntityId = 0; + } + else if (par1Packet23VehicleSpawn.type == 75) + { + var8 = new EntityExpBottle(this.worldClient, var2, var4, var6); + par1Packet23VehicleSpawn.throwerEntityId = 0; + } + else if (par1Packet23VehicleSpawn.type == 1) + { + var8 = new EntityBoat(this.worldClient, var2, var4, var6); + } + else if (par1Packet23VehicleSpawn.type == 50) + { + var8 = new EntityTNTPrimed(this.worldClient, var2, var4, var6, (EntityLivingBase)null); + } + else if (par1Packet23VehicleSpawn.type == 51) + { + var8 = new EntityEnderCrystal(this.worldClient, var2, var4, var6); + } + else if (par1Packet23VehicleSpawn.type == 2) + { + var8 = new EntityItem(this.worldClient, var2, var4, var6); + } + else if (par1Packet23VehicleSpawn.type == 70) + { + var8 = new EntityFallingSand(this.worldClient, var2, var4, var6, par1Packet23VehicleSpawn.throwerEntityId & 65535, par1Packet23VehicleSpawn.throwerEntityId >> 16); + par1Packet23VehicleSpawn.throwerEntityId = 0; + } + + if (var8 != null) + { + ((Entity)var8).serverPosX = par1Packet23VehicleSpawn.xPosition; + ((Entity)var8).serverPosY = par1Packet23VehicleSpawn.yPosition; + ((Entity)var8).serverPosZ = par1Packet23VehicleSpawn.zPosition; + ((Entity)var8).rotationPitch = (float)(par1Packet23VehicleSpawn.pitch * 360) / 256.0F; + ((Entity)var8).rotationYaw = (float)(par1Packet23VehicleSpawn.yaw * 360) / 256.0F; + Entity[] var12 = ((Entity)var8).getParts(); + + if (var12 != null) + { + int var10 = par1Packet23VehicleSpawn.entityId - ((Entity)var8).entityId; + + for (int var11 = 0; var11 < var12.length; ++var11) + { + var12[var11].entityId += var10; + } + } + + ((Entity)var8).entityId = par1Packet23VehicleSpawn.entityId; + this.worldClient.addEntityToWorld(par1Packet23VehicleSpawn.entityId, (Entity)var8); + + if (par1Packet23VehicleSpawn.throwerEntityId > 0) + { + if (par1Packet23VehicleSpawn.type == 60) + { + Entity var13 = this.getEntityByID(par1Packet23VehicleSpawn.throwerEntityId); + + if (var13 instanceof EntityLivingBase) + { + EntityArrow var14 = (EntityArrow)var8; + var14.shootingEntity = var13; + } + } + + ((Entity)var8).setVelocity((double)par1Packet23VehicleSpawn.speedX / 8000.0D, (double)par1Packet23VehicleSpawn.speedY / 8000.0D, (double)par1Packet23VehicleSpawn.speedZ / 8000.0D); + } + } + } + + /** + * Handle a entity experience orb packet. + */ + public void handleEntityExpOrb(Packet26EntityExpOrb par1Packet26EntityExpOrb) + { + EntityXPOrb var2 = new EntityXPOrb(this.worldClient, (double)par1Packet26EntityExpOrb.posX, (double)par1Packet26EntityExpOrb.posY, (double)par1Packet26EntityExpOrb.posZ, par1Packet26EntityExpOrb.xpValue); + var2.serverPosX = par1Packet26EntityExpOrb.posX; + var2.serverPosY = par1Packet26EntityExpOrb.posY; + var2.serverPosZ = par1Packet26EntityExpOrb.posZ; + var2.rotationYaw = 0.0F; + var2.rotationPitch = 0.0F; + var2.entityId = par1Packet26EntityExpOrb.entityId; + this.worldClient.addEntityToWorld(par1Packet26EntityExpOrb.entityId, var2); + } + + /** + * Handles weather packet + */ + public void handleWeather(Packet71Weather par1Packet71Weather) + { + double var2 = (double)par1Packet71Weather.posX / 32.0D; + double var4 = (double)par1Packet71Weather.posY / 32.0D; + double var6 = (double)par1Packet71Weather.posZ / 32.0D; + EntityLightningBolt var8 = null; + + if (par1Packet71Weather.isLightningBolt == 1) + { + var8 = new EntityLightningBolt(this.worldClient, var2, var4, var6); + } + + if (var8 != null) + { + var8.serverPosX = par1Packet71Weather.posX; + var8.serverPosY = par1Packet71Weather.posY; + var8.serverPosZ = par1Packet71Weather.posZ; + var8.rotationYaw = 0.0F; + var8.rotationPitch = 0.0F; + var8.entityId = par1Packet71Weather.entityID; + this.worldClient.addWeatherEffect(var8); + } + } + + /** + * Packet handler + */ + public void handleEntityPainting(Packet25EntityPainting par1Packet25EntityPainting) + { + EntityPainting var2 = new EntityPainting(this.worldClient, par1Packet25EntityPainting.xPosition, par1Packet25EntityPainting.yPosition, par1Packet25EntityPainting.zPosition, par1Packet25EntityPainting.direction, par1Packet25EntityPainting.title); + this.worldClient.addEntityToWorld(par1Packet25EntityPainting.entityId, var2); + } + + /** + * Packet handler + */ + public void handleEntityVelocity(Packet28EntityVelocity par1Packet28EntityVelocity) + { + Entity var2 = this.getEntityByID(par1Packet28EntityVelocity.entityId); + + if (var2 != null) + { + var2.setVelocity((double)par1Packet28EntityVelocity.motionX / 8000.0D, (double)par1Packet28EntityVelocity.motionY / 8000.0D, (double)par1Packet28EntityVelocity.motionZ / 8000.0D); + } + } + + /** + * Packet handler + */ + public void handleEntityMetadata(Packet40EntityMetadata par1Packet40EntityMetadata) + { + Entity var2 = this.getEntityByID(par1Packet40EntityMetadata.entityId); + + if (var2 != null && par1Packet40EntityMetadata.getMetadata() != null) + { + var2.getDataWatcher().updateWatchedObjectsFromList(par1Packet40EntityMetadata.getMetadata()); + } + } + + public void handleNamedEntitySpawn(Packet20NamedEntitySpawn par1Packet20NamedEntitySpawn) + { + double var2 = (double)par1Packet20NamedEntitySpawn.xPosition / 32.0D; + double var4 = (double)par1Packet20NamedEntitySpawn.yPosition / 32.0D; + double var6 = (double)par1Packet20NamedEntitySpawn.zPosition / 32.0D; + float var8 = (float)(par1Packet20NamedEntitySpawn.rotation * 360) / 256.0F; + float var9 = (float)(par1Packet20NamedEntitySpawn.pitch * 360) / 256.0F; + EntityOtherPlayerMP var10 = new EntityOtherPlayerMP(this.mc.theWorld, par1Packet20NamedEntitySpawn.name); + var10.prevPosX = var10.lastTickPosX = (double)(var10.serverPosX = par1Packet20NamedEntitySpawn.xPosition); + var10.prevPosY = var10.lastTickPosY = (double)(var10.serverPosY = par1Packet20NamedEntitySpawn.yPosition); + var10.prevPosZ = var10.lastTickPosZ = (double)(var10.serverPosZ = par1Packet20NamedEntitySpawn.zPosition); + int var11 = par1Packet20NamedEntitySpawn.currentItem; + + if (var11 == 0) + { + var10.inventory.mainInventory[var10.inventory.currentItem] = null; + } + else + { + var10.inventory.mainInventory[var10.inventory.currentItem] = new ItemStack(var11, 1, 0); + } + + var10.setPositionAndRotation(var2, var4, var6, var8, var9); + this.worldClient.addEntityToWorld(par1Packet20NamedEntitySpawn.entityId, var10); + List var12 = par1Packet20NamedEntitySpawn.getWatchedMetadata(); + + if (var12 != null) + { + var10.getDataWatcher().updateWatchedObjectsFromList(var12); + } + } + + public void handleEntityTeleport(Packet34EntityTeleport par1Packet34EntityTeleport) + { + Entity var2 = this.getEntityByID(par1Packet34EntityTeleport.entityId); + + if (var2 != null) + { + var2.serverPosX = par1Packet34EntityTeleport.xPosition; + var2.serverPosY = par1Packet34EntityTeleport.yPosition; + var2.serverPosZ = par1Packet34EntityTeleport.zPosition; + double var3 = (double)var2.serverPosX / 32.0D; + double var5 = (double)var2.serverPosY / 32.0D + 0.015625D; + double var7 = (double)var2.serverPosZ / 32.0D; + float var9 = (float)(par1Packet34EntityTeleport.yaw * 360) / 256.0F; + float var10 = (float)(par1Packet34EntityTeleport.pitch * 360) / 256.0F; + var2.setPositionAndRotation2(var3, var5, var7, var9, var10, 3); + } + } + + public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch) + { + if (par1Packet16BlockItemSwitch.id >= 0 && par1Packet16BlockItemSwitch.id < InventoryPlayer.getHotbarSize()) + { + this.mc.thePlayer.inventory.currentItem = par1Packet16BlockItemSwitch.id; + } + } + + public void handleEntity(Packet30Entity par1Packet30Entity) + { + Entity var2 = this.getEntityByID(par1Packet30Entity.entityId); + + if (var2 != null) + { + var2.serverPosX += par1Packet30Entity.xPosition; + var2.serverPosY += par1Packet30Entity.yPosition; + var2.serverPosZ += par1Packet30Entity.zPosition; + double var3 = (double)var2.serverPosX / 32.0D; + double var5 = (double)var2.serverPosY / 32.0D; + double var7 = (double)var2.serverPosZ / 32.0D; + float var9 = par1Packet30Entity.rotating ? (float)(par1Packet30Entity.yaw * 360) / 256.0F : var2.rotationYaw; + float var10 = par1Packet30Entity.rotating ? (float)(par1Packet30Entity.pitch * 360) / 256.0F : var2.rotationPitch; + var2.setPositionAndRotation2(var3, var5, var7, var9, var10, 3); + } + } + + public void handleEntityHeadRotation(Packet35EntityHeadRotation par1Packet35EntityHeadRotation) + { + Entity var2 = this.getEntityByID(par1Packet35EntityHeadRotation.entityId); + + if (var2 != null) + { + float var3 = (float)(par1Packet35EntityHeadRotation.headRotationYaw * 360) / 256.0F; + var2.setRotationYawHead(var3); + } + } + + public void handleDestroyEntity(Packet29DestroyEntity par1Packet29DestroyEntity) + { + for (int var2 = 0; var2 < par1Packet29DestroyEntity.entityId.length; ++var2) + { + this.worldClient.removeEntityFromWorld(par1Packet29DestroyEntity.entityId[var2]); + } + } + + public void handleFlying(Packet10Flying par1Packet10Flying) + { + EntityClientPlayerMP var2 = this.mc.thePlayer; + double var3 = var2.posX; + double var5 = var2.posY; + double var7 = var2.posZ; + float var9 = var2.rotationYaw; + float var10 = var2.rotationPitch; + + if (par1Packet10Flying.moving) + { + var3 = par1Packet10Flying.xPosition; + var5 = par1Packet10Flying.yPosition; + var7 = par1Packet10Flying.zPosition; + } + + if (par1Packet10Flying.rotating) + { + var9 = par1Packet10Flying.yaw; + var10 = par1Packet10Flying.pitch; + } + + var2.ySize = 0.0F; + var2.motionX = var2.motionY = var2.motionZ = 0.0D; + var2.setPositionAndRotation(var3, var5, var7, var9, var10); + par1Packet10Flying.xPosition = var2.posX; + par1Packet10Flying.yPosition = var2.boundingBox.minY; + par1Packet10Flying.zPosition = var2.posZ; + par1Packet10Flying.stance = var2.posY; + this.netManager.addToSendQueue(par1Packet10Flying); + + if (!this.doneLoadingTerrain) + { + this.mc.thePlayer.prevPosX = this.mc.thePlayer.posX; + this.mc.thePlayer.prevPosY = this.mc.thePlayer.posY; + this.mc.thePlayer.prevPosZ = this.mc.thePlayer.posZ; + this.doneLoadingTerrain = true; + this.mc.displayGuiScreen((GuiScreen)null); + } + } + + public void handleMultiBlockChange(Packet52MultiBlockChange par1Packet52MultiBlockChange) + { + int var2 = par1Packet52MultiBlockChange.xPosition * 16; + int var3 = par1Packet52MultiBlockChange.zPosition * 16; + + if (par1Packet52MultiBlockChange.metadataArray != null) + { + DataInputStream var4 = new DataInputStream(new ByteArrayInputStream(par1Packet52MultiBlockChange.metadataArray)); + + try + { + for (int var5 = 0; var5 < par1Packet52MultiBlockChange.size; ++var5) + { + short var6 = var4.readShort(); + short var7 = var4.readShort(); + int var8 = var7 >> 4 & 4095; + int var9 = var7 & 15; + int var10 = var6 >> 12 & 15; + int var11 = var6 >> 8 & 15; + int var12 = var6 & 255; + this.worldClient.setBlockAndMetadataAndInvalidate(var10 + var2, var12, var11 + var3, var8, var9); + } + } + catch (IOException var13) + { + ; + } + } + } + + /** + * Handle Packet51MapChunk (full chunk update of blocks, metadata, light levels, and optionally biome data) + */ + public void handleMapChunk(Packet51MapChunk par1Packet51MapChunk) + { + if (par1Packet51MapChunk.includeInitialize) + { + if (par1Packet51MapChunk.yChMin == 0) + { + this.worldClient.doPreChunk(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh, false); + return; + } + + this.worldClient.doPreChunk(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh, true); + } + + this.worldClient.invalidateBlockReceiveRegion(par1Packet51MapChunk.xCh << 4, 0, par1Packet51MapChunk.zCh << 4, (par1Packet51MapChunk.xCh << 4) + 15, 256, (par1Packet51MapChunk.zCh << 4) + 15); + Chunk var2 = this.worldClient.getChunkFromChunkCoords(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh); + + if (par1Packet51MapChunk.includeInitialize && var2 == null) + { + this.worldClient.doPreChunk(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh, true); + var2 = this.worldClient.getChunkFromChunkCoords(par1Packet51MapChunk.xCh, par1Packet51MapChunk.zCh); + } + + if (var2 != null) + { + var2.fillChunk(par1Packet51MapChunk.getCompressedChunkData(), par1Packet51MapChunk.yChMin, par1Packet51MapChunk.yChMax, par1Packet51MapChunk.includeInitialize); + this.worldClient.markBlockRangeForRenderUpdate(par1Packet51MapChunk.xCh << 4, 0, par1Packet51MapChunk.zCh << 4, (par1Packet51MapChunk.xCh << 4) + 15, 256, (par1Packet51MapChunk.zCh << 4) + 15); + + if (!par1Packet51MapChunk.includeInitialize || !(this.worldClient.provider instanceof WorldProviderSurface)) + { + var2.resetRelightChecks(); + } + } + } + + public void handleBlockChange(Packet53BlockChange par1Packet53BlockChange) + { + this.worldClient.setBlockAndMetadataAndInvalidate(par1Packet53BlockChange.xPosition, par1Packet53BlockChange.yPosition, par1Packet53BlockChange.zPosition, par1Packet53BlockChange.type, par1Packet53BlockChange.metadata); + } + + public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect) + { + this.netManager.networkShutdown("disconnect.kicked", new Object[0]); + this.disconnected = true; + this.mc.loadWorld((WorldClient)null); + + if (this.field_98183_l != null) + { + this.mc.displayGuiScreen(new GuiScreenDisconnectedOnline(this.field_98183_l, "disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason})); + } + else + { + this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason})); + } + } + + public void handleErrorMessage(String par1Str, Object[] par2ArrayOfObj) + { + if (!this.disconnected) + { + this.disconnected = true; + this.mc.loadWorld((WorldClient)null); + + if (this.field_98183_l != null) + { + this.mc.displayGuiScreen(new GuiScreenDisconnectedOnline(this.field_98183_l, "disconnect.lost", par1Str, par2ArrayOfObj)); + } + else + { + this.mc.displayGuiScreen(new GuiDisconnected(new GuiMultiplayer(new GuiMainMenu()), "disconnect.lost", par1Str, par2ArrayOfObj)); + } + } + } + + public void quitWithPacket(Packet par1Packet) + { + if (!this.disconnected) + { + this.netManager.addToSendQueue(par1Packet); + this.netManager.serverShutdown(); + } + } + + /** + * Adds the packet to the send queue + */ + public void addToSendQueue(Packet par1Packet) + { + if (!this.disconnected) + { + this.netManager.addToSendQueue(par1Packet); + } + } + + public void handleCollect(Packet22Collect par1Packet22Collect) + { + Entity var2 = this.getEntityByID(par1Packet22Collect.collectedEntityId); + Object var3 = (EntityLivingBase)this.getEntityByID(par1Packet22Collect.collectorEntityId); + + if (var3 == null) + { + var3 = this.mc.thePlayer; + } + + if (var2 != null) + { + if (var2 instanceof EntityXPOrb) + { + this.worldClient.playSoundAtEntity(var2, "random.orb", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + } + else + { + this.worldClient.playSoundAtEntity(var2, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + } + + this.mc.effectRenderer.addEffect(new EntityPickupFX(this.mc.theWorld, var2, (Entity)var3, -0.5F)); + this.worldClient.removeEntityFromWorld(par1Packet22Collect.collectedEntityId); + } + } + + public void handleChat(Packet3Chat par1Packet3Chat) + { + this.mc.ingameGUI.getChatGUI().printChatMessage(ChatMessageComponent.createFromJson(par1Packet3Chat.message).toStringWithFormatting(true)); + } + + public void handleAnimation(Packet18Animation par1Packet18Animation) + { + Entity var2 = this.getEntityByID(par1Packet18Animation.entityId); + + if (var2 != null) + { + if (par1Packet18Animation.animate == 1) + { + EntityLivingBase var3 = (EntityLivingBase)var2; + var3.swingItem(); + } + else if (par1Packet18Animation.animate == 2) + { + var2.performHurtAnimation(); + } + else if (par1Packet18Animation.animate == 3) + { + EntityPlayer var4 = (EntityPlayer)var2; + var4.wakeUpPlayer(false, false, false); + } + else if (par1Packet18Animation.animate != 4) + { + if (par1Packet18Animation.animate == 6) + { + this.mc.effectRenderer.addEffect(new EntityCrit2FX(this.mc.theWorld, var2)); + } + else if (par1Packet18Animation.animate == 7) + { + EntityCrit2FX var5 = new EntityCrit2FX(this.mc.theWorld, var2, "magicCrit"); + this.mc.effectRenderer.addEffect(var5); + } + else if (par1Packet18Animation.animate == 5 && var2 instanceof EntityOtherPlayerMP) + { + ; + } + } + } + } + + public void handleSleep(Packet17Sleep par1Packet17Sleep) + { + Entity var2 = this.getEntityByID(par1Packet17Sleep.entityID); + + if (var2 != null) + { + if (par1Packet17Sleep.field_73622_e == 0) + { + EntityPlayer var3 = (EntityPlayer)var2; + var3.sleepInBedAt(par1Packet17Sleep.bedX, par1Packet17Sleep.bedY, par1Packet17Sleep.bedZ); + } + } + } + + /** + * Disconnects the network connection. + */ + public void disconnect() + { + this.disconnected = true; + this.netManager.wakeThreads(); + this.netManager.networkShutdown("disconnect.closed", new Object[0]); + } + + public void handleMobSpawn(Packet24MobSpawn par1Packet24MobSpawn) + { + double var2 = (double)par1Packet24MobSpawn.xPosition / 32.0D; + double var4 = (double)par1Packet24MobSpawn.yPosition / 32.0D; + double var6 = (double)par1Packet24MobSpawn.zPosition / 32.0D; + float var8 = (float)(par1Packet24MobSpawn.yaw * 360) / 256.0F; + float var9 = (float)(par1Packet24MobSpawn.pitch * 360) / 256.0F; + EntityLivingBase var10 = (EntityLivingBase)EntityList.createEntityByID(par1Packet24MobSpawn.type, this.mc.theWorld); + var10.serverPosX = par1Packet24MobSpawn.xPosition; + var10.serverPosY = par1Packet24MobSpawn.yPosition; + var10.serverPosZ = par1Packet24MobSpawn.zPosition; + var10.rotationYawHead = (float)(par1Packet24MobSpawn.headYaw * 360) / 256.0F; + Entity[] var11 = var10.getParts(); + + if (var11 != null) + { + int var12 = par1Packet24MobSpawn.entityId - var10.entityId; + + for (int var13 = 0; var13 < var11.length; ++var13) + { + var11[var13].entityId += var12; + } + } + + var10.entityId = par1Packet24MobSpawn.entityId; + var10.setPositionAndRotation(var2, var4, var6, var8, var9); + var10.motionX = (double)((float)par1Packet24MobSpawn.velocityX / 8000.0F); + var10.motionY = (double)((float)par1Packet24MobSpawn.velocityY / 8000.0F); + var10.motionZ = (double)((float)par1Packet24MobSpawn.velocityZ / 8000.0F); + this.worldClient.addEntityToWorld(par1Packet24MobSpawn.entityId, var10); + List var14 = par1Packet24MobSpawn.getMetadata(); + + if (var14 != null) + { + var10.getDataWatcher().updateWatchedObjectsFromList(var14); + } + } + + public void handleUpdateTime(Packet4UpdateTime par1Packet4UpdateTime) + { + this.mc.theWorld.func_82738_a(par1Packet4UpdateTime.worldAge); + this.mc.theWorld.setWorldTime(par1Packet4UpdateTime.time); + } + + public void handleSpawnPosition(Packet6SpawnPosition par1Packet6SpawnPosition) + { + this.mc.thePlayer.setSpawnChunk(new ChunkCoordinates(par1Packet6SpawnPosition.xPosition, par1Packet6SpawnPosition.yPosition, par1Packet6SpawnPosition.zPosition), true); + this.mc.theWorld.getWorldInfo().setSpawnPosition(par1Packet6SpawnPosition.xPosition, par1Packet6SpawnPosition.yPosition, par1Packet6SpawnPosition.zPosition); + } + + /** + * Packet handler + */ + public void handleAttachEntity(Packet39AttachEntity par1Packet39AttachEntity) + { + Object var2 = this.getEntityByID(par1Packet39AttachEntity.ridingEntityId); + Entity var3 = this.getEntityByID(par1Packet39AttachEntity.vehicleEntityId); + + if (par1Packet39AttachEntity.attachState == 0) + { + boolean var4 = false; + + if (par1Packet39AttachEntity.ridingEntityId == this.mc.thePlayer.entityId) + { + var2 = this.mc.thePlayer; + + if (var3 instanceof EntityBoat) + { + ((EntityBoat)var3).func_70270_d(false); + } + + var4 = ((Entity)var2).ridingEntity == null && var3 != null; + } + else if (var3 instanceof EntityBoat) + { + ((EntityBoat)var3).func_70270_d(true); + } + + if (var2 == null) + { + return; + } + + ((Entity)var2).mountEntity(var3); + + if (var4) + { + GameSettings var5 = this.mc.gameSettings; + this.mc.ingameGUI.func_110326_a(I18n.getStringParams("mount.onboard", new Object[] {GameSettings.getKeyDisplayString(var5.keyBindSneak.keyCode)}), false); + } + } + else if (par1Packet39AttachEntity.attachState == 1 && var2 != null && var2 instanceof EntityLiving) + { + if (var3 != null) + { + ((EntityLiving)var2).setLeashedToEntity(var3, false); + } + else + { + ((EntityLiving)var2).clearLeashed(false, false); + } + } + } + + /** + * Packet handler + */ + public void handleEntityStatus(Packet38EntityStatus par1Packet38EntityStatus) + { + Entity var2 = this.getEntityByID(par1Packet38EntityStatus.entityId); + + if (var2 != null) + { + var2.handleHealthUpdate(par1Packet38EntityStatus.entityStatus); + } + } + + private Entity getEntityByID(int par1) + { + return (Entity)(par1 == this.mc.thePlayer.entityId ? this.mc.thePlayer : this.worldClient.getEntityByID(par1)); + } + + /** + * Recieves player health from the server and then proceeds to set it locally on the client. + */ + public void handleUpdateHealth(Packet8UpdateHealth par1Packet8UpdateHealth) + { + this.mc.thePlayer.setPlayerSPHealth(par1Packet8UpdateHealth.healthMP); + this.mc.thePlayer.getFoodStats().setFoodLevel(par1Packet8UpdateHealth.food); + this.mc.thePlayer.getFoodStats().setFoodSaturationLevel(par1Packet8UpdateHealth.foodSaturation); + } + + /** + * Handle an experience packet. + */ + public void handleExperience(Packet43Experience par1Packet43Experience) + { + this.mc.thePlayer.setXPStats(par1Packet43Experience.experience, par1Packet43Experience.experienceTotal, par1Packet43Experience.experienceLevel); + } + + /** + * respawns the player + */ + public void handleRespawn(Packet9Respawn par1Packet9Respawn) + { + if (par1Packet9Respawn.respawnDimension != this.mc.thePlayer.dimension) + { + this.doneLoadingTerrain = false; + Scoreboard var2 = this.worldClient.getScoreboard(); + this.worldClient = new WorldClient(this, new WorldSettings(0L, par1Packet9Respawn.gameType, false, this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled(), par1Packet9Respawn.terrainType), par1Packet9Respawn.respawnDimension, par1Packet9Respawn.difficulty, this.mc.mcProfiler, this.mc.getLogAgent()); + this.worldClient.func_96443_a(var2); + this.worldClient.isRemote = true; + this.mc.loadWorld(this.worldClient); + this.mc.thePlayer.dimension = par1Packet9Respawn.respawnDimension; + this.mc.displayGuiScreen(new GuiDownloadTerrain(this)); + } + + this.mc.setDimensionAndSpawnPlayer(par1Packet9Respawn.respawnDimension); + this.mc.playerController.setGameType(par1Packet9Respawn.gameType); + } + + public void handleExplosion(Packet60Explosion par1Packet60Explosion) + { + Explosion var2 = new Explosion(this.mc.theWorld, (Entity)null, par1Packet60Explosion.explosionX, par1Packet60Explosion.explosionY, par1Packet60Explosion.explosionZ, par1Packet60Explosion.explosionSize); + var2.affectedBlockPositions = par1Packet60Explosion.chunkPositionRecords; + var2.doExplosionB(true); + this.mc.thePlayer.motionX += (double)par1Packet60Explosion.getPlayerVelocityX(); + this.mc.thePlayer.motionY += (double)par1Packet60Explosion.getPlayerVelocityY(); + this.mc.thePlayer.motionZ += (double)par1Packet60Explosion.getPlayerVelocityZ(); + } + + public void handleOpenWindow(Packet100OpenWindow par1Packet100OpenWindow) + { + EntityClientPlayerMP var2 = this.mc.thePlayer; + + switch (par1Packet100OpenWindow.inventoryType) + { + case 0: + var2.displayGUIChest(new InventoryBasic(par1Packet100OpenWindow.windowTitle, par1Packet100OpenWindow.useProvidedWindowTitle, par1Packet100OpenWindow.slotsCount)); + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + break; + + case 1: + var2.displayGUIWorkbench(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ)); + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + break; + + case 2: + TileEntityFurnace var4 = new TileEntityFurnace(); + + if (par1Packet100OpenWindow.useProvidedWindowTitle) + { + var4.setGuiDisplayName(par1Packet100OpenWindow.windowTitle); + } + + var2.displayGUIFurnace(var4); + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + break; + + case 3: + TileEntityDispenser var7 = new TileEntityDispenser(); + + if (par1Packet100OpenWindow.useProvidedWindowTitle) + { + var7.setCustomName(par1Packet100OpenWindow.windowTitle); + } + + var2.displayGUIDispenser(var7); + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + break; + + case 4: + var2.displayGUIEnchantment(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ), par1Packet100OpenWindow.useProvidedWindowTitle ? par1Packet100OpenWindow.windowTitle : null); + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + break; + + case 5: + TileEntityBrewingStand var5 = new TileEntityBrewingStand(); + + if (par1Packet100OpenWindow.useProvidedWindowTitle) + { + var5.func_94131_a(par1Packet100OpenWindow.windowTitle); + } + + var2.displayGUIBrewingStand(var5); + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + break; + + case 6: + var2.displayGUIMerchant(new NpcMerchant(var2), par1Packet100OpenWindow.useProvidedWindowTitle ? par1Packet100OpenWindow.windowTitle : null); + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + break; + + case 7: + TileEntityBeacon var8 = new TileEntityBeacon(); + var2.displayGUIBeacon(var8); + + if (par1Packet100OpenWindow.useProvidedWindowTitle) + { + var8.func_94047_a(par1Packet100OpenWindow.windowTitle); + } + + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + break; + + case 8: + var2.displayGUIAnvil(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ)); + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + break; + + case 9: + TileEntityHopper var3 = new TileEntityHopper(); + + if (par1Packet100OpenWindow.useProvidedWindowTitle) + { + var3.setInventoryName(par1Packet100OpenWindow.windowTitle); + } + + var2.displayGUIHopper(var3); + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + break; + + case 10: + TileEntityDropper var6 = new TileEntityDropper(); + + if (par1Packet100OpenWindow.useProvidedWindowTitle) + { + var6.setCustomName(par1Packet100OpenWindow.windowTitle); + } + + var2.displayGUIDispenser(var6); + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + break; + + case 11: + Entity var9 = this.getEntityByID(par1Packet100OpenWindow.field_111008_f); + + if (var9 != null && var9 instanceof EntityHorse) + { + var2.displayGUIHorse((EntityHorse)var9, new AnimalChest(par1Packet100OpenWindow.windowTitle, par1Packet100OpenWindow.useProvidedWindowTitle, par1Packet100OpenWindow.slotsCount)); + var2.openContainer.windowId = par1Packet100OpenWindow.windowId; + } + } + } + + public void handleSetSlot(Packet103SetSlot par1Packet103SetSlot) + { + EntityClientPlayerMP var2 = this.mc.thePlayer; + + if (par1Packet103SetSlot.windowId == -1) + { + var2.inventory.setItemStack(par1Packet103SetSlot.myItemStack); + } + else + { + boolean var3 = false; + + if (this.mc.currentScreen instanceof GuiContainerCreative) + { + GuiContainerCreative var4 = (GuiContainerCreative)this.mc.currentScreen; + var3 = var4.getCurrentTabIndex() != CreativeTabs.tabInventory.getTabIndex(); + } + + if (par1Packet103SetSlot.windowId == 0 && par1Packet103SetSlot.itemSlot >= 36 && par1Packet103SetSlot.itemSlot < 45) + { + ItemStack var5 = var2.inventoryContainer.getSlot(par1Packet103SetSlot.itemSlot).getStack(); + + if (par1Packet103SetSlot.myItemStack != null && (var5 == null || var5.stackSize < par1Packet103SetSlot.myItemStack.stackSize)) + { + par1Packet103SetSlot.myItemStack.animationsToGo = 5; + } + + var2.inventoryContainer.putStackInSlot(par1Packet103SetSlot.itemSlot, par1Packet103SetSlot.myItemStack); + } + else if (par1Packet103SetSlot.windowId == var2.openContainer.windowId && (par1Packet103SetSlot.windowId != 0 || !var3)) + { + var2.openContainer.putStackInSlot(par1Packet103SetSlot.itemSlot, par1Packet103SetSlot.myItemStack); + } + } + } + + public void handleTransaction(Packet106Transaction par1Packet106Transaction) + { + Container var2 = null; + EntityClientPlayerMP var3 = this.mc.thePlayer; + + if (par1Packet106Transaction.windowId == 0) + { + var2 = var3.inventoryContainer; + } + else if (par1Packet106Transaction.windowId == var3.openContainer.windowId) + { + var2 = var3.openContainer; + } + + if (var2 != null && !par1Packet106Transaction.accepted) + { + this.addToSendQueue(new Packet106Transaction(par1Packet106Transaction.windowId, par1Packet106Transaction.shortWindowId, true)); + } + } + + public void handleWindowItems(Packet104WindowItems par1Packet104WindowItems) + { + EntityClientPlayerMP var2 = this.mc.thePlayer; + + if (par1Packet104WindowItems.windowId == 0) + { + var2.inventoryContainer.putStacksInSlots(par1Packet104WindowItems.itemStack); + } + else if (par1Packet104WindowItems.windowId == var2.openContainer.windowId) + { + var2.openContainer.putStacksInSlots(par1Packet104WindowItems.itemStack); + } + } + + public void func_142031_a(Packet133TileEditorOpen par1Packet133TileEditorOpen) + { + TileEntity var2 = this.worldClient.getBlockTileEntity(par1Packet133TileEditorOpen.field_142035_b, par1Packet133TileEditorOpen.field_142036_c, par1Packet133TileEditorOpen.field_142034_d); + + if (var2 != null) + { + this.mc.thePlayer.displayGUIEditSign(var2); + } + else if (par1Packet133TileEditorOpen.field_142037_a == 0) + { + TileEntitySign var3 = new TileEntitySign(); + var3.setWorldObj(this.worldClient); + var3.xCoord = par1Packet133TileEditorOpen.field_142035_b; + var3.yCoord = par1Packet133TileEditorOpen.field_142036_c; + var3.zCoord = par1Packet133TileEditorOpen.field_142034_d; + this.mc.thePlayer.displayGUIEditSign(var3); + } + } + + /** + * Updates Client side signs + */ + public void handleUpdateSign(Packet130UpdateSign par1Packet130UpdateSign) + { + boolean var2 = false; + + if (this.mc.theWorld.blockExists(par1Packet130UpdateSign.xPosition, par1Packet130UpdateSign.yPosition, par1Packet130UpdateSign.zPosition)) + { + TileEntity var3 = this.mc.theWorld.getBlockTileEntity(par1Packet130UpdateSign.xPosition, par1Packet130UpdateSign.yPosition, par1Packet130UpdateSign.zPosition); + + if (var3 instanceof TileEntitySign) + { + TileEntitySign var4 = (TileEntitySign)var3; + + if (var4.isEditable()) + { + for (int var5 = 0; var5 < 4; ++var5) + { + var4.signText[var5] = par1Packet130UpdateSign.signLines[var5]; + } + + var4.onInventoryChanged(); + } + + var2 = true; + } + } + + if (!var2 && this.mc.thePlayer != null) + { + this.mc.thePlayer.sendChatToPlayer(ChatMessageComponent.createFromText("Unable to locate sign at " + par1Packet130UpdateSign.xPosition + ", " + par1Packet130UpdateSign.yPosition + ", " + par1Packet130UpdateSign.zPosition)); + } + } + + public void handleTileEntityData(Packet132TileEntityData par1Packet132TileEntityData) + { + if (this.mc.theWorld.blockExists(par1Packet132TileEntityData.xPosition, par1Packet132TileEntityData.yPosition, par1Packet132TileEntityData.zPosition)) + { + TileEntity var2 = this.mc.theWorld.getBlockTileEntity(par1Packet132TileEntityData.xPosition, par1Packet132TileEntityData.yPosition, par1Packet132TileEntityData.zPosition); + + if (var2 != null) + { + if (par1Packet132TileEntityData.actionType == 1 && var2 instanceof TileEntityMobSpawner) + { + var2.readFromNBT(par1Packet132TileEntityData.data); + } + else if (par1Packet132TileEntityData.actionType == 2 && var2 instanceof TileEntityCommandBlock) + { + var2.readFromNBT(par1Packet132TileEntityData.data); + } + else if (par1Packet132TileEntityData.actionType == 3 && var2 instanceof TileEntityBeacon) + { + var2.readFromNBT(par1Packet132TileEntityData.data); + } + else if (par1Packet132TileEntityData.actionType == 4 && var2 instanceof TileEntitySkull) + { + var2.readFromNBT(par1Packet132TileEntityData.data); + } + } + } + } + + public void handleUpdateProgressbar(Packet105UpdateProgressbar par1Packet105UpdateProgressbar) + { + EntityClientPlayerMP var2 = this.mc.thePlayer; + this.unexpectedPacket(par1Packet105UpdateProgressbar); + + if (var2.openContainer != null && var2.openContainer.windowId == par1Packet105UpdateProgressbar.windowId) + { + var2.openContainer.updateProgressBar(par1Packet105UpdateProgressbar.progressBar, par1Packet105UpdateProgressbar.progressBarValue); + } + } + + public void handlePlayerInventory(Packet5PlayerInventory par1Packet5PlayerInventory) + { + Entity var2 = this.getEntityByID(par1Packet5PlayerInventory.entityID); + + if (var2 != null) + { + var2.setCurrentItemOrArmor(par1Packet5PlayerInventory.slot, par1Packet5PlayerInventory.getItemSlot()); + } + } + + public void handleCloseWindow(Packet101CloseWindow par1Packet101CloseWindow) + { + this.mc.thePlayer.func_92015_f(); + } + + public void handleBlockEvent(Packet54PlayNoteBlock par1Packet54PlayNoteBlock) + { + this.mc.theWorld.addBlockEvent(par1Packet54PlayNoteBlock.xLocation, par1Packet54PlayNoteBlock.yLocation, par1Packet54PlayNoteBlock.zLocation, par1Packet54PlayNoteBlock.blockId, par1Packet54PlayNoteBlock.instrumentType, par1Packet54PlayNoteBlock.pitch); + } + + public void handleBlockDestroy(Packet55BlockDestroy par1Packet55BlockDestroy) + { + this.mc.theWorld.destroyBlockInWorldPartially(par1Packet55BlockDestroy.getEntityId(), par1Packet55BlockDestroy.getPosX(), par1Packet55BlockDestroy.getPosY(), par1Packet55BlockDestroy.getPosZ(), par1Packet55BlockDestroy.getDestroyedStage()); + } + + public void handleMapChunks(Packet56MapChunks par1Packet56MapChunks) + { + for (int var2 = 0; var2 < par1Packet56MapChunks.getNumberOfChunkInPacket(); ++var2) + { + int var3 = par1Packet56MapChunks.getChunkPosX(var2); + int var4 = par1Packet56MapChunks.getChunkPosZ(var2); + this.worldClient.doPreChunk(var3, var4, true); + this.worldClient.invalidateBlockReceiveRegion(var3 << 4, 0, var4 << 4, (var3 << 4) + 15, 256, (var4 << 4) + 15); + Chunk var5 = this.worldClient.getChunkFromChunkCoords(var3, var4); + + if (var5 == null) + { + this.worldClient.doPreChunk(var3, var4, true); + var5 = this.worldClient.getChunkFromChunkCoords(var3, var4); + } + + if (var5 != null) + { + var5.fillChunk(par1Packet56MapChunks.getChunkCompressedData(var2), par1Packet56MapChunks.field_73590_a[var2], par1Packet56MapChunks.field_73588_b[var2], true); + this.worldClient.markBlockRangeForRenderUpdate(var3 << 4, 0, var4 << 4, (var3 << 4) + 15, 256, (var4 << 4) + 15); + + if (!(this.worldClient.provider instanceof WorldProviderSurface)) + { + var5.resetRelightChecks(); + } + } + } + } + + /** + * If this returns false, all packets will be queued for the main thread to handle, even if they would otherwise be + * processed asynchronously. Used to avoid processing packets on the client before the world has been downloaded + * (which happens on the main thread) + */ + public boolean canProcessPacketsAsync() + { + return this.mc != null && this.mc.theWorld != null && this.mc.thePlayer != null && this.worldClient != null; + } + + public void handleGameEvent(Packet70GameEvent par1Packet70GameEvent) + { + EntityClientPlayerMP var2 = this.mc.thePlayer; + int var3 = par1Packet70GameEvent.eventType; + int var4 = par1Packet70GameEvent.gameMode; + + if (var3 >= 0 && var3 < Packet70GameEvent.clientMessage.length && Packet70GameEvent.clientMessage[var3] != null) + { + var2.addChatMessage(Packet70GameEvent.clientMessage[var3]); + } + + if (var3 == 1) + { + this.worldClient.getWorldInfo().setRaining(true); + this.worldClient.setRainStrength(0.0F); + } + else if (var3 == 2) + { + this.worldClient.getWorldInfo().setRaining(false); + this.worldClient.setRainStrength(1.0F); + } + else if (var3 == 3) + { + this.mc.playerController.setGameType(EnumGameType.getByID(var4)); + } + else if (var3 == 4) + { + this.mc.displayGuiScreen(new GuiWinGame()); + } + else if (var3 == 5) + { + GameSettings var5 = this.mc.gameSettings; + + if (var4 == 0) + { + this.mc.displayGuiScreen(new GuiScreenDemo()); + } + else if (var4 == 101) + { + this.mc.ingameGUI.getChatGUI().addTranslatedMessage("demo.help.movement", new Object[] {Keyboard.getKeyName(var5.keyBindForward.keyCode), Keyboard.getKeyName(var5.keyBindLeft.keyCode), Keyboard.getKeyName(var5.keyBindBack.keyCode), Keyboard.getKeyName(var5.keyBindRight.keyCode)}); + } + else if (var4 == 102) + { + this.mc.ingameGUI.getChatGUI().addTranslatedMessage("demo.help.jump", new Object[] {Keyboard.getKeyName(var5.keyBindJump.keyCode)}); + } + else if (var4 == 103) + { + this.mc.ingameGUI.getChatGUI().addTranslatedMessage("demo.help.inventory", new Object[] {Keyboard.getKeyName(var5.keyBindInventory.keyCode)}); + } + } + else if (var3 == 6) + { + this.worldClient.playSound(var2.posX, var2.posY + (double)var2.getEyeHeight(), var2.posZ, "random.successful_hit", 0.18F, 0.45F, false); + } + } + + /** + * Contains logic for handling packets containing arbitrary unique item data. Currently this is only for maps. + */ + public void handleMapData(Packet131MapData par1Packet131MapData) + { + if (par1Packet131MapData.itemID == Item.map.itemID) + { + ItemMap.getMPMapData(par1Packet131MapData.uniqueID, this.mc.theWorld).updateMPMapData(par1Packet131MapData.itemData); + } + else + { + this.mc.getLogAgent().logWarning("Unknown itemid: " + par1Packet131MapData.uniqueID); + } + } + + public void handleDoorChange(Packet61DoorChange par1Packet61DoorChange) + { + if (par1Packet61DoorChange.getRelativeVolumeDisabled()) + { + this.mc.theWorld.func_82739_e(par1Packet61DoorChange.sfxID, par1Packet61DoorChange.posX, par1Packet61DoorChange.posY, par1Packet61DoorChange.posZ, par1Packet61DoorChange.auxData); + } + else + { + this.mc.theWorld.playAuxSFX(par1Packet61DoorChange.sfxID, par1Packet61DoorChange.posX, par1Packet61DoorChange.posY, par1Packet61DoorChange.posZ, par1Packet61DoorChange.auxData); + } + } + + /** + * Increment player statistics + */ + public void handleStatistic(Packet200Statistic par1Packet200Statistic) + { + this.mc.thePlayer.incrementStat(StatList.getOneShotStat(par1Packet200Statistic.statisticId), par1Packet200Statistic.amount); + } + + /** + * Handle an entity effect packet. + */ + public void handleEntityEffect(Packet41EntityEffect par1Packet41EntityEffect) + { + Entity var2 = this.getEntityByID(par1Packet41EntityEffect.entityId); + + if (var2 instanceof EntityLivingBase) + { + PotionEffect var3 = new PotionEffect(par1Packet41EntityEffect.effectId, par1Packet41EntityEffect.duration, par1Packet41EntityEffect.effectAmplifier); + var3.setPotionDurationMax(par1Packet41EntityEffect.isDurationMax()); + ((EntityLivingBase)var2).addPotionEffect(var3); + } + } + + /** + * Handle a remove entity effect packet. + */ + public void handleRemoveEntityEffect(Packet42RemoveEntityEffect par1Packet42RemoveEntityEffect) + { + Entity var2 = this.getEntityByID(par1Packet42RemoveEntityEffect.entityId); + + if (var2 instanceof EntityLivingBase) + { + ((EntityLivingBase)var2).removePotionEffectClient(par1Packet42RemoveEntityEffect.effectId); + } + } + + /** + * determine if it is a server handler + */ + public boolean isServerHandler() + { + return false; + } + + /** + * Handle a player information packet. + */ + public void handlePlayerInfo(Packet201PlayerInfo par1Packet201PlayerInfo) + { + GuiPlayerInfo var2 = (GuiPlayerInfo)this.playerInfoMap.get(par1Packet201PlayerInfo.playerName); + + if (var2 == null && par1Packet201PlayerInfo.isConnected) + { + var2 = new GuiPlayerInfo(par1Packet201PlayerInfo.playerName); + this.playerInfoMap.put(par1Packet201PlayerInfo.playerName, var2); + this.playerInfoList.add(var2); + } + + if (var2 != null && !par1Packet201PlayerInfo.isConnected) + { + this.playerInfoMap.remove(par1Packet201PlayerInfo.playerName); + this.playerInfoList.remove(var2); + } + + if (par1Packet201PlayerInfo.isConnected && var2 != null) + { + var2.responseTime = par1Packet201PlayerInfo.ping; + } + } + + /** + * Handle a keep alive packet. + */ + public void handleKeepAlive(Packet0KeepAlive par1Packet0KeepAlive) + { + this.addToSendQueue(new Packet0KeepAlive(par1Packet0KeepAlive.randomId)); + } + + /** + * Handle a player abilities packet. + */ + public void handlePlayerAbilities(Packet202PlayerAbilities par1Packet202PlayerAbilities) + { + EntityClientPlayerMP var2 = this.mc.thePlayer; + var2.capabilities.isFlying = par1Packet202PlayerAbilities.getFlying(); + var2.capabilities.isCreativeMode = par1Packet202PlayerAbilities.isCreativeMode(); + var2.capabilities.disableDamage = par1Packet202PlayerAbilities.getDisableDamage(); + var2.capabilities.allowFlying = par1Packet202PlayerAbilities.getAllowFlying(); + var2.capabilities.setFlySpeed(par1Packet202PlayerAbilities.getFlySpeed()); + var2.capabilities.setPlayerWalkSpeed(par1Packet202PlayerAbilities.getWalkSpeed()); + } + + public void handleAutoComplete(Packet203AutoComplete par1Packet203AutoComplete) + { + String[] var2 = par1Packet203AutoComplete.getText().split("\u0000"); + + if (this.mc.currentScreen instanceof GuiChat) + { + GuiChat var3 = (GuiChat)this.mc.currentScreen; + var3.func_73894_a(var2); + } + } + + public void handleLevelSound(Packet62LevelSound par1Packet62LevelSound) + { + this.mc.theWorld.playSound(par1Packet62LevelSound.getEffectX(), par1Packet62LevelSound.getEffectY(), par1Packet62LevelSound.getEffectZ(), par1Packet62LevelSound.getSoundName(), par1Packet62LevelSound.getVolume(), par1Packet62LevelSound.getPitch(), false); + } + + public void handleCustomPayload(Packet250CustomPayload par1Packet250CustomPayload) + { + if ("MC|TrList".equals(par1Packet250CustomPayload.channel)) + { + DataInputStream var2 = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data)); + + try + { + int var3 = var2.readInt(); + GuiScreen var4 = this.mc.currentScreen; + + if (var4 != null && var4 instanceof GuiMerchant && var3 == this.mc.thePlayer.openContainer.windowId) + { + IMerchant var5 = ((GuiMerchant)var4).getIMerchant(); + MerchantRecipeList var6 = MerchantRecipeList.readRecipiesFromStream(var2); + var5.setRecipes(var6); + } + } + catch (IOException var7) + { + var7.printStackTrace(); + } + } + else if ("MC|Brand".equals(par1Packet250CustomPayload.channel)) + { + this.mc.thePlayer.func_142020_c(new String(par1Packet250CustomPayload.data, Charsets.UTF_8)); + } + } + + /** + * Handle a set objective packet. + */ + public void handleSetObjective(Packet206SetObjective par1Packet206SetObjective) + { + Scoreboard var2 = this.worldClient.getScoreboard(); + ScoreObjective var3; + + if (par1Packet206SetObjective.change == 0) + { + var3 = var2.func_96535_a(par1Packet206SetObjective.objectiveName, ScoreObjectiveCriteria.field_96641_b); + var3.setDisplayName(par1Packet206SetObjective.objectiveDisplayName); + } + else + { + var3 = var2.getObjective(par1Packet206SetObjective.objectiveName); + + if (par1Packet206SetObjective.change == 1) + { + var2.func_96519_k(var3); + } + else if (par1Packet206SetObjective.change == 2) + { + var3.setDisplayName(par1Packet206SetObjective.objectiveDisplayName); + } + } + } + + /** + * Handle a set score packet. + */ + public void handleSetScore(Packet207SetScore par1Packet207SetScore) + { + Scoreboard var2 = this.worldClient.getScoreboard(); + ScoreObjective var3 = var2.getObjective(par1Packet207SetScore.scoreName); + + if (par1Packet207SetScore.updateOrRemove == 0) + { + Score var4 = var2.func_96529_a(par1Packet207SetScore.itemName, var3); + var4.func_96647_c(par1Packet207SetScore.value); + } + else if (par1Packet207SetScore.updateOrRemove == 1) + { + var2.func_96515_c(par1Packet207SetScore.itemName); + } + } + + /** + * Handle a set display objective packet. + */ + public void handleSetDisplayObjective(Packet208SetDisplayObjective par1Packet208SetDisplayObjective) + { + Scoreboard var2 = this.worldClient.getScoreboard(); + + if (par1Packet208SetDisplayObjective.scoreName.length() == 0) + { + var2.func_96530_a(par1Packet208SetDisplayObjective.scoreboardPosition, (ScoreObjective)null); + } + else + { + ScoreObjective var3 = var2.getObjective(par1Packet208SetDisplayObjective.scoreName); + var2.func_96530_a(par1Packet208SetDisplayObjective.scoreboardPosition, var3); + } + } + + /** + * Handle a set player team packet. + */ + public void handleSetPlayerTeam(Packet209SetPlayerTeam par1Packet209SetPlayerTeam) + { + Scoreboard var2 = this.worldClient.getScoreboard(); + ScorePlayerTeam var3; + + if (par1Packet209SetPlayerTeam.mode == 0) + { + var3 = var2.func_96527_f(par1Packet209SetPlayerTeam.teamName); + } + else + { + var3 = var2.func_96508_e(par1Packet209SetPlayerTeam.teamName); + } + + if (par1Packet209SetPlayerTeam.mode == 0 || par1Packet209SetPlayerTeam.mode == 2) + { + var3.func_96664_a(par1Packet209SetPlayerTeam.teamDisplayName); + var3.func_96666_b(par1Packet209SetPlayerTeam.teamPrefix); + var3.func_96662_c(par1Packet209SetPlayerTeam.teamSuffix); + var3.func_98298_a(par1Packet209SetPlayerTeam.friendlyFire); + } + + Iterator var4; + String var5; + + if (par1Packet209SetPlayerTeam.mode == 0 || par1Packet209SetPlayerTeam.mode == 3) + { + var4 = par1Packet209SetPlayerTeam.playerNames.iterator(); + + while (var4.hasNext()) + { + var5 = (String)var4.next(); + var2.func_96521_a(var5, var3); + } + } + + if (par1Packet209SetPlayerTeam.mode == 4) + { + var4 = par1Packet209SetPlayerTeam.playerNames.iterator(); + + while (var4.hasNext()) + { + var5 = (String)var4.next(); + var2.removePlayerFromTeam(var5, var3); + } + } + + if (par1Packet209SetPlayerTeam.mode == 1) + { + var2.func_96511_d(var3); + } + } + + /** + * Handle a world particles packet. + */ + public void handleWorldParticles(Packet63WorldParticles par1Packet63WorldParticles) + { + for (int var2 = 0; var2 < par1Packet63WorldParticles.getQuantity(); ++var2) + { + double var3 = this.rand.nextGaussian() * (double)par1Packet63WorldParticles.getOffsetX(); + double var5 = this.rand.nextGaussian() * (double)par1Packet63WorldParticles.getOffsetY(); + double var7 = this.rand.nextGaussian() * (double)par1Packet63WorldParticles.getOffsetZ(); + double var9 = this.rand.nextGaussian() * (double)par1Packet63WorldParticles.getSpeed(); + double var11 = this.rand.nextGaussian() * (double)par1Packet63WorldParticles.getSpeed(); + double var13 = this.rand.nextGaussian() * (double)par1Packet63WorldParticles.getSpeed(); + this.worldClient.spawnParticle(par1Packet63WorldParticles.getParticleName(), par1Packet63WorldParticles.getPositionX() + var3, par1Packet63WorldParticles.getPositionY() + var5, par1Packet63WorldParticles.getPositionZ() + var7, var9, var11, var13); + } + } + + public void func_110773_a(Packet44UpdateAttributes par1Packet44UpdateAttributes) + { + Entity var2 = this.getEntityByID(par1Packet44UpdateAttributes.func_111002_d()); + + if (var2 != null) + { + if (!(var2 instanceof EntityLivingBase)) + { + throw new IllegalStateException("Server tried to update attributes of a non-living entity (actually: " + var2 + ")"); + } + else + { + BaseAttributeMap var3 = ((EntityLivingBase)var2).getAttributeMap(); + Iterator var4 = par1Packet44UpdateAttributes.func_111003_f().iterator(); + + while (var4.hasNext()) + { + Packet44UpdateAttributesSnapshot var5 = (Packet44UpdateAttributesSnapshot)var4.next(); + AttributeInstance var6 = var3.getAttributeInstanceByName(var5.func_142040_a()); + + if (var6 == null) + { + var6 = var3.func_111150_b(new RangedAttribute(var5.func_142040_a(), 0.0D, 2.2250738585072014E-308D, Double.MAX_VALUE)); + } + + var6.setAttribute(var5.func_142041_b()); + var6.func_142049_d(); + Iterator var7 = var5.func_142039_c().iterator(); + + while (var7.hasNext()) + { + AttributeModifier var8 = (AttributeModifier)var7.next(); + var6.applyModifier(var8); + } + } + } + } + } + + /** + * Return the NetworkManager instance used by this NetClientHandler + */ + public INetworkManager getNetManager() + { + return this.netManager; + } +} diff --git a/src/main/java/net/minecraft/src/NetHandler.java b/src/main/java/net/minecraft/src/NetHandler.java new file mode 100644 index 0000000..4a3e6de --- /dev/null +++ b/src/main/java/net/minecraft/src/NetHandler.java @@ -0,0 +1,478 @@ +package net.minecraft.src; + +public abstract class NetHandler +{ + /** + * determine if it is a server handler + */ + public abstract boolean isServerHandler(); + + /** + * Handle Packet51MapChunk (full chunk update of blocks, metadata, light levels, and optionally biome data) + */ + public void handleMapChunk(Packet51MapChunk par1Packet51MapChunk) {} + + /** + * Default handler called for packets that don't have their own handlers in NetClientHandler; currentlly does + * nothing. + */ + public void unexpectedPacket(Packet par1Packet) {} + + public void handleErrorMessage(String par1Str, Object[] par2ArrayOfObj) {} + + public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect) + { + this.unexpectedPacket(par1Packet255KickDisconnect); + } + + public void handleLogin(Packet1Login par1Packet1Login) + { + this.unexpectedPacket(par1Packet1Login); + } + + public void handleFlying(Packet10Flying par1Packet10Flying) + { + this.unexpectedPacket(par1Packet10Flying); + } + + public void handleMultiBlockChange(Packet52MultiBlockChange par1Packet52MultiBlockChange) + { + this.unexpectedPacket(par1Packet52MultiBlockChange); + } + + public void handleBlockDig(Packet14BlockDig par1Packet14BlockDig) + { + this.unexpectedPacket(par1Packet14BlockDig); + } + + public void handleBlockChange(Packet53BlockChange par1Packet53BlockChange) + { + this.unexpectedPacket(par1Packet53BlockChange); + } + + public void handleNamedEntitySpawn(Packet20NamedEntitySpawn par1Packet20NamedEntitySpawn) + { + this.unexpectedPacket(par1Packet20NamedEntitySpawn); + } + + public void handleEntity(Packet30Entity par1Packet30Entity) + { + this.unexpectedPacket(par1Packet30Entity); + } + + public void handleEntityTeleport(Packet34EntityTeleport par1Packet34EntityTeleport) + { + this.unexpectedPacket(par1Packet34EntityTeleport); + } + + public void handlePlace(Packet15Place par1Packet15Place) + { + this.unexpectedPacket(par1Packet15Place); + } + + public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch) + { + this.unexpectedPacket(par1Packet16BlockItemSwitch); + } + + public void handleDestroyEntity(Packet29DestroyEntity par1Packet29DestroyEntity) + { + this.unexpectedPacket(par1Packet29DestroyEntity); + } + + public void handleCollect(Packet22Collect par1Packet22Collect) + { + this.unexpectedPacket(par1Packet22Collect); + } + + public void handleChat(Packet3Chat par1Packet3Chat) + { + this.unexpectedPacket(par1Packet3Chat); + } + + public void handleVehicleSpawn(Packet23VehicleSpawn par1Packet23VehicleSpawn) + { + this.unexpectedPacket(par1Packet23VehicleSpawn); + } + + public void handleAnimation(Packet18Animation par1Packet18Animation) + { + this.unexpectedPacket(par1Packet18Animation); + } + + /** + * runs registerPacket on the given Packet19EntityAction + */ + public void handleEntityAction(Packet19EntityAction par1Packet19EntityAction) + { + this.unexpectedPacket(par1Packet19EntityAction); + } + + public void handleClientProtocol(Packet2ClientProtocol par1Packet2ClientProtocol) + { + this.unexpectedPacket(par1Packet2ClientProtocol); + } + + public void handleServerAuthData(Packet253ServerAuthData par1Packet253ServerAuthData) + { + this.unexpectedPacket(par1Packet253ServerAuthData); + } + + public void handleSharedKey(Packet252SharedKey par1Packet252SharedKey) + { + this.unexpectedPacket(par1Packet252SharedKey); + } + + public void handleMobSpawn(Packet24MobSpawn par1Packet24MobSpawn) + { + this.unexpectedPacket(par1Packet24MobSpawn); + } + + public void handleUpdateTime(Packet4UpdateTime par1Packet4UpdateTime) + { + this.unexpectedPacket(par1Packet4UpdateTime); + } + + public void handleSpawnPosition(Packet6SpawnPosition par1Packet6SpawnPosition) + { + this.unexpectedPacket(par1Packet6SpawnPosition); + } + + /** + * Packet handler + */ + public void handleEntityVelocity(Packet28EntityVelocity par1Packet28EntityVelocity) + { + this.unexpectedPacket(par1Packet28EntityVelocity); + } + + /** + * Packet handler + */ + public void handleEntityMetadata(Packet40EntityMetadata par1Packet40EntityMetadata) + { + this.unexpectedPacket(par1Packet40EntityMetadata); + } + + /** + * Packet handler + */ + public void handleAttachEntity(Packet39AttachEntity par1Packet39AttachEntity) + { + this.unexpectedPacket(par1Packet39AttachEntity); + } + + public void handleUseEntity(Packet7UseEntity par1Packet7UseEntity) + { + this.unexpectedPacket(par1Packet7UseEntity); + } + + /** + * Packet handler + */ + public void handleEntityStatus(Packet38EntityStatus par1Packet38EntityStatus) + { + this.unexpectedPacket(par1Packet38EntityStatus); + } + + /** + * Recieves player health from the server and then proceeds to set it locally on the client. + */ + public void handleUpdateHealth(Packet8UpdateHealth par1Packet8UpdateHealth) + { + this.unexpectedPacket(par1Packet8UpdateHealth); + } + + /** + * respawns the player + */ + public void handleRespawn(Packet9Respawn par1Packet9Respawn) + { + this.unexpectedPacket(par1Packet9Respawn); + } + + public void handleExplosion(Packet60Explosion par1Packet60Explosion) + { + this.unexpectedPacket(par1Packet60Explosion); + } + + public void handleOpenWindow(Packet100OpenWindow par1Packet100OpenWindow) + { + this.unexpectedPacket(par1Packet100OpenWindow); + } + + public void handleCloseWindow(Packet101CloseWindow par1Packet101CloseWindow) + { + this.unexpectedPacket(par1Packet101CloseWindow); + } + + public void handleWindowClick(Packet102WindowClick par1Packet102WindowClick) + { + this.unexpectedPacket(par1Packet102WindowClick); + } + + public void handleSetSlot(Packet103SetSlot par1Packet103SetSlot) + { + this.unexpectedPacket(par1Packet103SetSlot); + } + + public void handleWindowItems(Packet104WindowItems par1Packet104WindowItems) + { + this.unexpectedPacket(par1Packet104WindowItems); + } + + /** + * Updates Client side signs + */ + public void handleUpdateSign(Packet130UpdateSign par1Packet130UpdateSign) + { + this.unexpectedPacket(par1Packet130UpdateSign); + } + + public void handleUpdateProgressbar(Packet105UpdateProgressbar par1Packet105UpdateProgressbar) + { + this.unexpectedPacket(par1Packet105UpdateProgressbar); + } + + public void handlePlayerInventory(Packet5PlayerInventory par1Packet5PlayerInventory) + { + this.unexpectedPacket(par1Packet5PlayerInventory); + } + + public void handleTransaction(Packet106Transaction par1Packet106Transaction) + { + this.unexpectedPacket(par1Packet106Transaction); + } + + /** + * Packet handler + */ + public void handleEntityPainting(Packet25EntityPainting par1Packet25EntityPainting) + { + this.unexpectedPacket(par1Packet25EntityPainting); + } + + public void handleBlockEvent(Packet54PlayNoteBlock par1Packet54PlayNoteBlock) + { + this.unexpectedPacket(par1Packet54PlayNoteBlock); + } + + /** + * Increment player statistics + */ + public void handleStatistic(Packet200Statistic par1Packet200Statistic) + { + this.unexpectedPacket(par1Packet200Statistic); + } + + public void handleSleep(Packet17Sleep par1Packet17Sleep) + { + this.unexpectedPacket(par1Packet17Sleep); + } + + public void func_110774_a(Packet27PlayerInput par1Packet27PlayerInput) + { + this.unexpectedPacket(par1Packet27PlayerInput); + } + + public void handleGameEvent(Packet70GameEvent par1Packet70GameEvent) + { + this.unexpectedPacket(par1Packet70GameEvent); + } + + /** + * Handles weather packet + */ + public void handleWeather(Packet71Weather par1Packet71Weather) + { + this.unexpectedPacket(par1Packet71Weather); + } + + /** + * Contains logic for handling packets containing arbitrary unique item data. Currently this is only for maps. + */ + public void handleMapData(Packet131MapData par1Packet131MapData) + { + this.unexpectedPacket(par1Packet131MapData); + } + + public void handleDoorChange(Packet61DoorChange par1Packet61DoorChange) + { + this.unexpectedPacket(par1Packet61DoorChange); + } + + /** + * Handle a server ping packet. + */ + public void handleServerPing(Packet254ServerPing par1Packet254ServerPing) + { + this.unexpectedPacket(par1Packet254ServerPing); + } + + /** + * Handle an entity effect packet. + */ + public void handleEntityEffect(Packet41EntityEffect par1Packet41EntityEffect) + { + this.unexpectedPacket(par1Packet41EntityEffect); + } + + /** + * Handle a remove entity effect packet. + */ + public void handleRemoveEntityEffect(Packet42RemoveEntityEffect par1Packet42RemoveEntityEffect) + { + this.unexpectedPacket(par1Packet42RemoveEntityEffect); + } + + /** + * Handle a player information packet. + */ + public void handlePlayerInfo(Packet201PlayerInfo par1Packet201PlayerInfo) + { + this.unexpectedPacket(par1Packet201PlayerInfo); + } + + /** + * Handle a keep alive packet. + */ + public void handleKeepAlive(Packet0KeepAlive par1Packet0KeepAlive) + { + this.unexpectedPacket(par1Packet0KeepAlive); + } + + /** + * Handle an experience packet. + */ + public void handleExperience(Packet43Experience par1Packet43Experience) + { + this.unexpectedPacket(par1Packet43Experience); + } + + /** + * Handle a creative slot packet. + */ + public void handleCreativeSetSlot(Packet107CreativeSetSlot par1Packet107CreativeSetSlot) + { + this.unexpectedPacket(par1Packet107CreativeSetSlot); + } + + /** + * Handle a entity experience orb packet. + */ + public void handleEntityExpOrb(Packet26EntityExpOrb par1Packet26EntityExpOrb) + { + this.unexpectedPacket(par1Packet26EntityExpOrb); + } + + public void handleEnchantItem(Packet108EnchantItem par1Packet108EnchantItem) {} + + public void handleCustomPayload(Packet250CustomPayload par1Packet250CustomPayload) {} + + public void handleEntityHeadRotation(Packet35EntityHeadRotation par1Packet35EntityHeadRotation) + { + this.unexpectedPacket(par1Packet35EntityHeadRotation); + } + + public void handleTileEntityData(Packet132TileEntityData par1Packet132TileEntityData) + { + this.unexpectedPacket(par1Packet132TileEntityData); + } + + /** + * Handle a player abilities packet. + */ + public void handlePlayerAbilities(Packet202PlayerAbilities par1Packet202PlayerAbilities) + { + this.unexpectedPacket(par1Packet202PlayerAbilities); + } + + public void handleAutoComplete(Packet203AutoComplete par1Packet203AutoComplete) + { + this.unexpectedPacket(par1Packet203AutoComplete); + } + + public void handleClientInfo(Packet204ClientInfo par1Packet204ClientInfo) + { + this.unexpectedPacket(par1Packet204ClientInfo); + } + + public void handleLevelSound(Packet62LevelSound par1Packet62LevelSound) + { + this.unexpectedPacket(par1Packet62LevelSound); + } + + public void handleBlockDestroy(Packet55BlockDestroy par1Packet55BlockDestroy) + { + this.unexpectedPacket(par1Packet55BlockDestroy); + } + + public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand) {} + + public void handleMapChunks(Packet56MapChunks par1Packet56MapChunks) + { + this.unexpectedPacket(par1Packet56MapChunks); + } + + /** + * If this returns false, all packets will be queued for the main thread to handle, even if they would otherwise be + * processed asynchronously. Used to avoid processing packets on the client before the world has been downloaded + * (which happens on the main thread) + */ + public boolean canProcessPacketsAsync() + { + return false; + } + + /** + * Handle a set objective packet. + */ + public void handleSetObjective(Packet206SetObjective par1Packet206SetObjective) + { + this.unexpectedPacket(par1Packet206SetObjective); + } + + /** + * Handle a set score packet. + */ + public void handleSetScore(Packet207SetScore par1Packet207SetScore) + { + this.unexpectedPacket(par1Packet207SetScore); + } + + /** + * Handle a set display objective packet. + */ + public void handleSetDisplayObjective(Packet208SetDisplayObjective par1Packet208SetDisplayObjective) + { + this.unexpectedPacket(par1Packet208SetDisplayObjective); + } + + /** + * Handle a set player team packet. + */ + public void handleSetPlayerTeam(Packet209SetPlayerTeam par1Packet209SetPlayerTeam) + { + this.unexpectedPacket(par1Packet209SetPlayerTeam); + } + + /** + * Handle a world particles packet. + */ + public void handleWorldParticles(Packet63WorldParticles par1Packet63WorldParticles) + { + this.unexpectedPacket(par1Packet63WorldParticles); + } + + public void func_110773_a(Packet44UpdateAttributes par1Packet44UpdateAttributes) + { + this.unexpectedPacket(par1Packet44UpdateAttributes); + } + + public void func_142031_a(Packet133TileEditorOpen par1Packet133TileEditorOpen) {} + + public boolean isConnectionClosed() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/NetLoginHandler.java b/src/main/java/net/minecraft/src/NetLoginHandler.java new file mode 100644 index 0000000..fd9d142 --- /dev/null +++ b/src/main/java/net/minecraft/src/NetLoginHandler.java @@ -0,0 +1,310 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.io.Serializable; +import java.net.InetAddress; +import java.net.Socket; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Random; +import javax.crypto.SecretKey; +import net.minecraft.server.MinecraftServer; + +public class NetLoginHandler extends NetHandler +{ + /** The Random object used to generate serverId hex strings. */ + private static Random rand = new Random(); + + /** The 4 byte verify token read from a Packet252SharedKey */ + private byte[] verifyToken; + + /** Reference to the MinecraftServer object. */ + private final MinecraftServer mcServer; + public final TcpConnection myTCPConnection; + public boolean connectionComplete; + private int connectionTimer; + private String clientUsername; + private volatile boolean field_72544_i; + + /** server ID that is randomly generated by this login handler. */ + private String loginServerId = ""; + private boolean field_92079_k; + + /** Secret AES key obtained from the client's Packet252SharedKey */ + private SecretKey sharedKey; + + public NetLoginHandler(MinecraftServer par1MinecraftServer, Socket par2Socket, String par3Str) throws IOException + { + this.mcServer = par1MinecraftServer; + this.myTCPConnection = new TcpConnection(par1MinecraftServer.getLogAgent(), par2Socket, par3Str, this, par1MinecraftServer.getKeyPair().getPrivate()); + this.myTCPConnection.field_74468_e = 0; + } + + /** + * Logs the user in if a login packet is found, otherwise keeps processing network packets unless the timeout has + * occurred. + */ + public void tryLogin() + { + if (this.field_72544_i) + { + this.initializePlayerConnection(); + } + + if (this.connectionTimer++ == 600) + { + this.raiseErrorAndDisconnect("Took too long to log in"); + } + else + { + this.myTCPConnection.processReadPackets(); + } + } + + public void raiseErrorAndDisconnect(String par1Str) + { + try + { + this.mcServer.getLogAgent().logInfo("Disconnecting " + this.getUsernameAndAddress() + ": " + par1Str); + this.myTCPConnection.addToSendQueue(new Packet255KickDisconnect(par1Str)); + this.myTCPConnection.serverShutdown(); + this.connectionComplete = true; + } + catch (Exception var3) + { + var3.printStackTrace(); + } + } + + public void handleClientProtocol(Packet2ClientProtocol par1Packet2ClientProtocol) + { + if (this.clientUsername != null) + { + this.raiseErrorAndDisconnect("Quit repeating yourself!"); + } + else + { + this.clientUsername = par1Packet2ClientProtocol.getUsername(); + + if (!this.clientUsername.equals(StringUtils.stripControlCodes(this.clientUsername))) + { + this.raiseErrorAndDisconnect("Invalid username!"); + } + else + { + PublicKey var2 = this.mcServer.getKeyPair().getPublic(); + + if (par1Packet2ClientProtocol.getProtocolVersion() != 78) + { + if (par1Packet2ClientProtocol.getProtocolVersion() > 78) + { + this.raiseErrorAndDisconnect("Outdated server!"); + } + else + { + this.raiseErrorAndDisconnect("Outdated client!"); + } + } + else + { + this.loginServerId = this.mcServer.isServerInOnlineMode() ? Long.toString(rand.nextLong(), 16) : "-"; + this.verifyToken = new byte[4]; + rand.nextBytes(this.verifyToken); + this.myTCPConnection.addToSendQueue(new Packet253ServerAuthData(this.loginServerId, var2, this.verifyToken)); + } + } + } + } + + public void handleSharedKey(Packet252SharedKey par1Packet252SharedKey) + { + PrivateKey var2 = this.mcServer.getKeyPair().getPrivate(); + this.sharedKey = par1Packet252SharedKey.getSharedKey(var2); + + if (!Arrays.equals(this.verifyToken, par1Packet252SharedKey.getVerifyToken(var2))) + { + this.raiseErrorAndDisconnect("Invalid client reply"); + } + + this.myTCPConnection.addToSendQueue(new Packet252SharedKey()); + } + + public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand) + { + if (par1Packet205ClientCommand.forceRespawn == 0) + { + if (this.field_92079_k) + { + this.raiseErrorAndDisconnect("Duplicate login"); + return; + } + + this.field_92079_k = true; + + if (this.mcServer.isServerInOnlineMode()) + { + (new ThreadLoginVerifier(this)).start(); + } + else + { + this.field_72544_i = true; + } + } + } + + public void handleLogin(Packet1Login par1Packet1Login) {} + + /** + * on success the specified username is connected to the minecraftInstance, otherwise they are packet255'd + */ + public void initializePlayerConnection() + { + String var1 = this.mcServer.getConfigurationManager().allowUserToConnect(this.myTCPConnection.getSocketAddress(), this.clientUsername); + + if (var1 != null) + { + this.raiseErrorAndDisconnect(var1); + } + else + { + EntityPlayerMP var2 = this.mcServer.getConfigurationManager().createPlayerForUser(this.clientUsername); + + if (var2 != null) + { + this.mcServer.getConfigurationManager().initializeConnectionToPlayer(this.myTCPConnection, var2); + } + } + + this.connectionComplete = true; + } + + public void handleErrorMessage(String par1Str, Object[] par2ArrayOfObj) + { + this.mcServer.getLogAgent().logInfo(this.getUsernameAndAddress() + " lost connection"); + this.connectionComplete = true; + } + + /** + * Handle a server ping packet. + */ + public void handleServerPing(Packet254ServerPing par1Packet254ServerPing) + { + try + { + ServerConfigurationManager var2 = this.mcServer.getConfigurationManager(); + String var3 = null; + + if (par1Packet254ServerPing.func_140050_d()) + { + var3 = this.mcServer.getMOTD() + "\u00a7" + var2.getCurrentPlayerCount() + "\u00a7" + var2.getMaxPlayers(); + } + else + { + List var4 = Arrays.asList(new Serializable[] {Integer.valueOf(1), Integer.valueOf(78), this.mcServer.getMinecraftVersion(), this.mcServer.getMOTD(), Integer.valueOf(var2.getCurrentPlayerCount()), Integer.valueOf(var2.getMaxPlayers())}); + Object var6; + + for (Iterator var5 = var4.iterator(); var5.hasNext(); var3 = var3 + var6.toString().replaceAll("\u0000", "")) + { + var6 = var5.next(); + + if (var3 == null) + { + var3 = "\u00a7"; + } + else + { + var3 = var3 + "\u0000"; + } + } + } + + InetAddress var8 = null; + + if (this.myTCPConnection.getSocket() != null) + { + var8 = this.myTCPConnection.getSocket().getInetAddress(); + } + + this.myTCPConnection.addToSendQueue(new Packet255KickDisconnect(var3)); + this.myTCPConnection.serverShutdown(); + + if (var8 != null && this.mcServer.getNetworkThread() instanceof DedicatedServerListenThread) + { + ((DedicatedServerListenThread)this.mcServer.getNetworkThread()).func_71761_a(var8); + } + + this.connectionComplete = true; + } + catch (Exception var7) + { + var7.printStackTrace(); + } + } + + /** + * Default handler called for packets that don't have their own handlers in NetClientHandler; currentlly does + * nothing. + */ + public void unexpectedPacket(Packet par1Packet) + { + this.raiseErrorAndDisconnect("Protocol error"); + } + + public String getUsernameAndAddress() + { + return this.clientUsername != null ? this.clientUsername + " [" + this.myTCPConnection.getSocketAddress().toString() + "]" : this.myTCPConnection.getSocketAddress().toString(); + } + + /** + * determine if it is a server handler + */ + public boolean isServerHandler() + { + return true; + } + + public boolean isConnectionClosed() + { + return this.connectionComplete; + } + + /** + * Returns the server Id randomly generated by this login handler. + */ + static String getServerId(NetLoginHandler par0NetLoginHandler) + { + return par0NetLoginHandler.loginServerId; + } + + /** + * Returns the reference to Minecraft Server. + */ + static MinecraftServer getLoginMinecraftServer(NetLoginHandler par0NetLoginHandler) + { + return par0NetLoginHandler.mcServer; + } + + /** + * Return the secret AES sharedKey + */ + static SecretKey getSharedKey(NetLoginHandler par0NetLoginHandler) + { + return par0NetLoginHandler.sharedKey; + } + + /** + * Returns the connecting client username. + */ + static String getClientUsername(NetLoginHandler par0NetLoginHandler) + { + return par0NetLoginHandler.clientUsername; + } + + static boolean func_72531_a(NetLoginHandler par0NetLoginHandler, boolean par1) + { + return par0NetLoginHandler.field_72544_i = par1; + } +} diff --git a/src/main/java/net/minecraft/src/NetServerHandler.java b/src/main/java/net/minecraft/src/NetServerHandler.java new file mode 100644 index 0000000..c70ae02 --- /dev/null +++ b/src/main/java/net/minecraft/src/NetServerHandler.java @@ -0,0 +1,1191 @@ +package net.minecraft.src; + +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Random; +import net.minecraft.server.MinecraftServer; + +public class NetServerHandler extends NetHandler +{ + /** The underlying network manager for this server handler. */ + public final INetworkManager netManager; + + /** Reference to the MinecraftServer object. */ + private final MinecraftServer mcServer; + + /** This is set to true whenever a player disconnects from the server. */ + public boolean connectionClosed; + + /** Reference to the EntityPlayerMP object. */ + public EntityPlayerMP playerEntity; + + /** incremented each tick */ + private int currentTicks; + + /** + * player is kicked if they float for over 80 ticks without flying enabled + */ + private int ticksForFloatKick; + private boolean field_72584_h; + private int keepAliveRandomID; + private long keepAliveTimeSent; + private static Random randomGenerator = new Random(); + private long ticksOfLastKeepAlive; + private int chatSpamThresholdCount; + private int creativeItemCreationSpamThresholdTally; + + /** The last known x position for this connection. */ + private double lastPosX; + + /** The last known y position for this connection. */ + private double lastPosY; + + /** The last known z position for this connection. */ + private double lastPosZ; + + /** is true when the player has moved since his last movement packet */ + private boolean hasMoved = true; + private IntHashMap field_72586_s = new IntHashMap(); + + public NetServerHandler(MinecraftServer par1MinecraftServer, INetworkManager par2INetworkManager, EntityPlayerMP par3EntityPlayerMP) + { + this.mcServer = par1MinecraftServer; + this.netManager = par2INetworkManager; + par2INetworkManager.setNetHandler(this); + this.playerEntity = par3EntityPlayerMP; + par3EntityPlayerMP.playerNetServerHandler = this; + } + + /** + * run once each game tick + */ + public void networkTick() + { + this.field_72584_h = false; + ++this.currentTicks; + this.mcServer.theProfiler.startSection("packetflow"); + this.netManager.processReadPackets(); + this.mcServer.theProfiler.endStartSection("keepAlive"); + + if ((long)this.currentTicks - this.ticksOfLastKeepAlive > 20L) + { + this.ticksOfLastKeepAlive = (long)this.currentTicks; + this.keepAliveTimeSent = System.nanoTime() / 1000000L; + this.keepAliveRandomID = randomGenerator.nextInt(); + this.sendPacketToPlayer(new Packet0KeepAlive(this.keepAliveRandomID)); + } + + if (this.chatSpamThresholdCount > 0) + { + --this.chatSpamThresholdCount; + } + + if (this.creativeItemCreationSpamThresholdTally > 0) + { + --this.creativeItemCreationSpamThresholdTally; + } + + this.mcServer.theProfiler.endStartSection("playerTick"); + this.mcServer.theProfiler.endSection(); + } + + public void kickPlayerFromServer(String par1Str) + { + if (!this.connectionClosed) + { + this.playerEntity.mountEntityAndWakeUp(); + this.sendPacketToPlayer(new Packet255KickDisconnect(par1Str)); + this.netManager.serverShutdown(); + this.mcServer.getConfigurationManager().sendChatMsg(ChatMessageComponent.createFromTranslationWithSubstitutions("multiplayer.player.left", new Object[] {this.playerEntity.getTranslatedEntityName()}).setColor(EnumChatFormatting.YELLOW)); + this.mcServer.getConfigurationManager().playerLoggedOut(this.playerEntity); + this.connectionClosed = true; + } + } + + public void func_110774_a(Packet27PlayerInput par1Packet27PlayerInput) + { + this.playerEntity.setEntityActionState(par1Packet27PlayerInput.func_111010_d(), par1Packet27PlayerInput.func_111012_f(), par1Packet27PlayerInput.func_111013_g(), par1Packet27PlayerInput.func_111011_h()); + } + + public void handleFlying(Packet10Flying par1Packet10Flying) + { + WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension); + this.field_72584_h = true; + + if (!this.playerEntity.playerConqueredTheEnd) + { + double var3; + + if (!this.hasMoved) + { + var3 = par1Packet10Flying.yPosition - this.lastPosY; + + if (par1Packet10Flying.xPosition == this.lastPosX && var3 * var3 < 0.01D && par1Packet10Flying.zPosition == this.lastPosZ) + { + this.hasMoved = true; + } + } + + if (this.hasMoved) + { + double var5; + double var7; + double var9; + + if (this.playerEntity.ridingEntity != null) + { + float var34 = this.playerEntity.rotationYaw; + float var4 = this.playerEntity.rotationPitch; + this.playerEntity.ridingEntity.updateRiderPosition(); + var5 = this.playerEntity.posX; + var7 = this.playerEntity.posY; + var9 = this.playerEntity.posZ; + + if (par1Packet10Flying.rotating) + { + var34 = par1Packet10Flying.yaw; + var4 = par1Packet10Flying.pitch; + } + + this.playerEntity.onGround = par1Packet10Flying.onGround; + this.playerEntity.onUpdateEntity(); + this.playerEntity.ySize = 0.0F; + this.playerEntity.setPositionAndRotation(var5, var7, var9, var34, var4); + + if (this.playerEntity.ridingEntity != null) + { + this.playerEntity.ridingEntity.updateRiderPosition(); + } + + this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + + if (this.hasMoved) + { + this.lastPosX = this.playerEntity.posX; + this.lastPosY = this.playerEntity.posY; + this.lastPosZ = this.playerEntity.posZ; + } + + var2.updateEntity(this.playerEntity); + return; + } + + if (this.playerEntity.isPlayerSleeping()) + { + this.playerEntity.onUpdateEntity(); + this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch); + var2.updateEntity(this.playerEntity); + return; + } + + var3 = this.playerEntity.posY; + this.lastPosX = this.playerEntity.posX; + this.lastPosY = this.playerEntity.posY; + this.lastPosZ = this.playerEntity.posZ; + var5 = this.playerEntity.posX; + var7 = this.playerEntity.posY; + var9 = this.playerEntity.posZ; + float var11 = this.playerEntity.rotationYaw; + float var12 = this.playerEntity.rotationPitch; + + if (par1Packet10Flying.moving && par1Packet10Flying.yPosition == -999.0D && par1Packet10Flying.stance == -999.0D) + { + par1Packet10Flying.moving = false; + } + + double var13; + + if (par1Packet10Flying.moving) + { + var5 = par1Packet10Flying.xPosition; + var7 = par1Packet10Flying.yPosition; + var9 = par1Packet10Flying.zPosition; + var13 = par1Packet10Flying.stance - par1Packet10Flying.yPosition; + + if (!this.playerEntity.isPlayerSleeping() && (var13 > 1.65D || var13 < 0.1D)) + { + this.kickPlayerFromServer("Illegal stance"); + this.mcServer.getLogAgent().logWarning(this.playerEntity.getCommandSenderName() + " had an illegal stance: " + var13); + return; + } + + if (Math.abs(par1Packet10Flying.xPosition) > 3.2E7D || Math.abs(par1Packet10Flying.zPosition) > 3.2E7D) + { + this.kickPlayerFromServer("Illegal position"); + return; + } + } + + if (par1Packet10Flying.rotating) + { + var11 = par1Packet10Flying.yaw; + var12 = par1Packet10Flying.pitch; + } + + this.playerEntity.onUpdateEntity(); + this.playerEntity.ySize = 0.0F; + this.playerEntity.setPositionAndRotation(this.lastPosX, this.lastPosY, this.lastPosZ, var11, var12); + + if (!this.hasMoved) + { + return; + } + + var13 = var5 - this.playerEntity.posX; + double var15 = var7 - this.playerEntity.posY; + double var17 = var9 - this.playerEntity.posZ; + double var19 = Math.min(Math.abs(var13), Math.abs(this.playerEntity.motionX)); + double var21 = Math.min(Math.abs(var15), Math.abs(this.playerEntity.motionY)); + double var23 = Math.min(Math.abs(var17), Math.abs(this.playerEntity.motionZ)); + double var25 = var19 * var19 + var21 * var21 + var23 * var23; + + if (var25 > 100.0D && (!this.mcServer.isSinglePlayer() || !this.mcServer.getServerOwner().equals(this.playerEntity.getCommandSenderName()))) + { + this.mcServer.getLogAgent().logWarning(this.playerEntity.getCommandSenderName() + " moved too quickly! " + var13 + "," + var15 + "," + var17 + " (" + var19 + ", " + var21 + ", " + var23 + ")"); + this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch); + return; + } + + float var27 = 0.0625F; + boolean var28 = var2.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.boundingBox.copy().contract((double)var27, (double)var27, (double)var27)).isEmpty(); + + if (this.playerEntity.onGround && !par1Packet10Flying.onGround && var15 > 0.0D) + { + this.playerEntity.addExhaustion(0.2F); + } + + this.playerEntity.moveEntity(var13, var15, var17); + this.playerEntity.onGround = par1Packet10Flying.onGround; + this.playerEntity.addMovementStat(var13, var15, var17); + double var29 = var15; + var13 = var5 - this.playerEntity.posX; + var15 = var7 - this.playerEntity.posY; + + if (var15 > -0.5D || var15 < 0.5D) + { + var15 = 0.0D; + } + + var17 = var9 - this.playerEntity.posZ; + var25 = var13 * var13 + var15 * var15 + var17 * var17; + boolean var31 = false; + + if (var25 > 0.0625D && !this.playerEntity.isPlayerSleeping() && !this.playerEntity.theItemInWorldManager.isCreative()) + { + var31 = true; + this.mcServer.getLogAgent().logWarning(this.playerEntity.getCommandSenderName() + " moved wrongly!"); + } + + this.playerEntity.setPositionAndRotation(var5, var7, var9, var11, var12); + boolean var32 = var2.getCollidingBoundingBoxes(this.playerEntity, this.playerEntity.boundingBox.copy().contract((double)var27, (double)var27, (double)var27)).isEmpty(); + + if (var28 && (var31 || !var32) && !this.playerEntity.isPlayerSleeping()) + { + this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, var11, var12); + return; + } + + AxisAlignedBB var33 = this.playerEntity.boundingBox.copy().expand((double)var27, (double)var27, (double)var27).addCoord(0.0D, -0.55D, 0.0D); + + if (!this.mcServer.isFlightAllowed() && !this.playerEntity.theItemInWorldManager.isCreative() && !var2.checkBlockCollision(var33)) + { + if (var29 >= -0.03125D) + { + ++this.ticksForFloatKick; + + if (this.ticksForFloatKick > 80) + { + this.mcServer.getLogAgent().logWarning(this.playerEntity.getCommandSenderName() + " was kicked for floating too long!"); + this.kickPlayerFromServer("Flying is not enabled on this server"); + return; + } + } + } + else + { + this.ticksForFloatKick = 0; + } + + this.playerEntity.onGround = par1Packet10Flying.onGround; + this.mcServer.getConfigurationManager().serverUpdateMountedMovingPlayer(this.playerEntity); + this.playerEntity.updateFlyingState(this.playerEntity.posY - var3, par1Packet10Flying.onGround); + } + else if (this.currentTicks % 20 == 0) + { + this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, this.playerEntity.rotationYaw, this.playerEntity.rotationPitch); + } + } + } + + /** + * Moves the player to the specified destination and rotation + */ + public void setPlayerLocation(double par1, double par3, double par5, float par7, float par8) + { + this.hasMoved = false; + this.lastPosX = par1; + this.lastPosY = par3; + this.lastPosZ = par5; + this.playerEntity.setPositionAndRotation(par1, par3, par5, par7, par8); + this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet13PlayerLookMove(par1, par3 + 1.6200000047683716D, par3, par5, par7, par8, false)); + } + + public void handleBlockDig(Packet14BlockDig par1Packet14BlockDig) + { + WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension); + this.playerEntity.func_143004_u(); + + if (par1Packet14BlockDig.status == 4) + { + this.playerEntity.dropOneItem(false); + } + else if (par1Packet14BlockDig.status == 3) + { + this.playerEntity.dropOneItem(true); + } + else if (par1Packet14BlockDig.status == 5) + { + this.playerEntity.stopUsingItem(); + } + else + { + boolean var3 = false; + + if (par1Packet14BlockDig.status == 0) + { + var3 = true; + } + + if (par1Packet14BlockDig.status == 1) + { + var3 = true; + } + + if (par1Packet14BlockDig.status == 2) + { + var3 = true; + } + + int var4 = par1Packet14BlockDig.xPosition; + int var5 = par1Packet14BlockDig.yPosition; + int var6 = par1Packet14BlockDig.zPosition; + + if (var3) + { + double var7 = this.playerEntity.posX - ((double)var4 + 0.5D); + double var9 = this.playerEntity.posY - ((double)var5 + 0.5D) + 1.5D; + double var11 = this.playerEntity.posZ - ((double)var6 + 0.5D); + double var13 = var7 * var7 + var9 * var9 + var11 * var11; + + if (var13 > 36.0D) + { + return; + } + + if (var5 >= this.mcServer.getBuildLimit()) + { + return; + } + } + + if (par1Packet14BlockDig.status == 0) + { + if (!this.mcServer.isBlockProtected(var2, var4, var5, var6, this.playerEntity)) + { + this.playerEntity.theItemInWorldManager.onBlockClicked(var4, var5, var6, par1Packet14BlockDig.face); + } + else + { + this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(var4, var5, var6, var2)); + } + } + else if (par1Packet14BlockDig.status == 2) + { + this.playerEntity.theItemInWorldManager.uncheckedTryHarvestBlock(var4, var5, var6); + + if (var2.getBlockId(var4, var5, var6) != 0) + { + this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(var4, var5, var6, var2)); + } + } + else if (par1Packet14BlockDig.status == 1) + { + this.playerEntity.theItemInWorldManager.cancelDestroyingBlock(var4, var5, var6); + + if (var2.getBlockId(var4, var5, var6) != 0) + { + this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(var4, var5, var6, var2)); + } + } + } + } + + public void handlePlace(Packet15Place par1Packet15Place) + { + WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension); + ItemStack var3 = this.playerEntity.inventory.getCurrentItem(); + boolean var4 = false; + int var5 = par1Packet15Place.getXPosition(); + int var6 = par1Packet15Place.getYPosition(); + int var7 = par1Packet15Place.getZPosition(); + int var8 = par1Packet15Place.getDirection(); + this.playerEntity.func_143004_u(); + + if (par1Packet15Place.getDirection() == 255) + { + if (var3 == null) + { + return; + } + + this.playerEntity.theItemInWorldManager.tryUseItem(this.playerEntity, var2, var3); + } + else if (par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit() - 1 && (par1Packet15Place.getDirection() == 1 || par1Packet15Place.getYPosition() >= this.mcServer.getBuildLimit())) + { + this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromTranslationWithSubstitutions("build.tooHigh", new Object[] {Integer.valueOf(this.mcServer.getBuildLimit())}).setColor(EnumChatFormatting.RED))); + var4 = true; + } + else + { + if (this.hasMoved && this.playerEntity.getDistanceSq((double)var5 + 0.5D, (double)var6 + 0.5D, (double)var7 + 0.5D) < 64.0D && !this.mcServer.isBlockProtected(var2, var5, var6, var7, this.playerEntity)) + { + this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, var2, var3, var5, var6, var7, var8, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset()); + } + + var4 = true; + } + + if (var4) + { + this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(var5, var6, var7, var2)); + + if (var8 == 0) + { + --var6; + } + + if (var8 == 1) + { + ++var6; + } + + if (var8 == 2) + { + --var7; + } + + if (var8 == 3) + { + ++var7; + } + + if (var8 == 4) + { + --var5; + } + + if (var8 == 5) + { + ++var5; + } + + this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet53BlockChange(var5, var6, var7, var2)); + } + + var3 = this.playerEntity.inventory.getCurrentItem(); + + if (var3 != null && var3.stackSize == 0) + { + this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = null; + var3 = null; + } + + if (var3 == null || var3.getMaxItemUseDuration() == 0) + { + this.playerEntity.playerInventoryBeingManipulated = true; + this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem] = ItemStack.copyItemStack(this.playerEntity.inventory.mainInventory[this.playerEntity.inventory.currentItem]); + Slot var9 = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem); + this.playerEntity.openContainer.detectAndSendChanges(); + this.playerEntity.playerInventoryBeingManipulated = false; + + if (!ItemStack.areItemStacksEqual(this.playerEntity.inventory.getCurrentItem(), par1Packet15Place.getItemStack())) + { + this.sendPacketToPlayer(new Packet103SetSlot(this.playerEntity.openContainer.windowId, var9.slotNumber, this.playerEntity.inventory.getCurrentItem())); + } + } + } + + public void handleErrorMessage(String par1Str, Object[] par2ArrayOfObj) + { + this.mcServer.getLogAgent().logInfo(this.playerEntity.getCommandSenderName() + " lost connection: " + par1Str); + this.mcServer.getConfigurationManager().sendChatMsg(ChatMessageComponent.createFromTranslationWithSubstitutions("multiplayer.player.left", new Object[] {this.playerEntity.getTranslatedEntityName()}).setColor(EnumChatFormatting.YELLOW)); + this.mcServer.getConfigurationManager().playerLoggedOut(this.playerEntity); + this.connectionClosed = true; + + if (this.mcServer.isSinglePlayer() && this.playerEntity.getCommandSenderName().equals(this.mcServer.getServerOwner())) + { + this.mcServer.getLogAgent().logInfo("Stopping singleplayer server as player logged out"); + this.mcServer.initiateShutdown(); + } + } + + /** + * Default handler called for packets that don't have their own handlers in NetClientHandler; currentlly does + * nothing. + */ + public void unexpectedPacket(Packet par1Packet) + { + this.mcServer.getLogAgent().logWarning(this.getClass() + " wasn\'t prepared to deal with a " + par1Packet.getClass()); + this.kickPlayerFromServer("Protocol error, unexpected packet"); + } + + /** + * addToSendQueue. if it is a chat packet, check before sending it + */ + public void sendPacketToPlayer(Packet par1Packet) + { + if (par1Packet instanceof Packet3Chat) + { + Packet3Chat var2 = (Packet3Chat)par1Packet; + int var3 = this.playerEntity.getChatVisibility(); + + if (var3 == 2) + { + return; + } + + if (var3 == 1 && !var2.getIsServer()) + { + return; + } + } + + try + { + this.netManager.addToSendQueue(par1Packet); + } + catch (Throwable var5) + { + CrashReport var6 = CrashReport.makeCrashReport(var5, "Sending packet"); + CrashReportCategory var4 = var6.makeCategory("Packet being sent"); + var4.addCrashSectionCallable("Packet ID", new CallablePacketID(this, par1Packet)); + var4.addCrashSectionCallable("Packet class", new CallablePacketClass(this, par1Packet)); + throw new ReportedException(var6); + } + } + + public void handleBlockItemSwitch(Packet16BlockItemSwitch par1Packet16BlockItemSwitch) + { + if (par1Packet16BlockItemSwitch.id >= 0 && par1Packet16BlockItemSwitch.id < InventoryPlayer.getHotbarSize()) + { + this.playerEntity.inventory.currentItem = par1Packet16BlockItemSwitch.id; + this.playerEntity.func_143004_u(); + } + else + { + this.mcServer.getLogAgent().logWarning(this.playerEntity.getCommandSenderName() + " tried to set an invalid carried item"); + } + } + + public void handleChat(Packet3Chat par1Packet3Chat) + { + if (this.playerEntity.getChatVisibility() == 2) + { + this.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromTranslationKey("chat.cannotSend").setColor(EnumChatFormatting.RED))); + } + else + { + this.playerEntity.func_143004_u(); + String var2 = par1Packet3Chat.message; + + if (var2.length() > 100) + { + this.kickPlayerFromServer("Chat message too long"); + } + else + { + var2 = org.apache.commons.lang3.StringUtils.normalizeSpace(var2); + + for (int var3 = 0; var3 < var2.length(); ++var3) + { + if (!ChatAllowedCharacters.isAllowedCharacter(var2.charAt(var3))) + { + this.kickPlayerFromServer("Illegal characters in chat"); + return; + } + } + + if (var2.startsWith("/")) + { + this.handleSlashCommand(var2); + } + else + { + if (this.playerEntity.getChatVisibility() == 1) + { + this.sendPacketToPlayer(new Packet3Chat(ChatMessageComponent.createFromTranslationKey("chat.cannotSend").setColor(EnumChatFormatting.RED))); + return; + } + + ChatMessageComponent var4 = ChatMessageComponent.createFromTranslationWithSubstitutions("chat.type.text", new Object[] {this.playerEntity.getTranslatedEntityName(), var2}); + this.mcServer.getConfigurationManager().func_110459_a(var4, false); + } + + this.chatSpamThresholdCount += 20; + + if (this.chatSpamThresholdCount > 200 && !this.mcServer.getConfigurationManager().isPlayerOpped(this.playerEntity.getCommandSenderName())) + { + this.kickPlayerFromServer("disconnect.spam"); + } + } + } + } + + /** + * Processes a / command + */ + private void handleSlashCommand(String par1Str) + { + this.mcServer.getCommandManager().executeCommand(this.playerEntity, par1Str); + } + + public void handleAnimation(Packet18Animation par1Packet18Animation) + { + this.playerEntity.func_143004_u(); + + if (par1Packet18Animation.animate == 1) + { + this.playerEntity.swingItem(); + } + } + + /** + * runs registerPacket on the given Packet19EntityAction + */ + public void handleEntityAction(Packet19EntityAction par1Packet19EntityAction) + { + this.playerEntity.func_143004_u(); + + if (par1Packet19EntityAction.action == 1) + { + this.playerEntity.setSneaking(true); + } + else if (par1Packet19EntityAction.action == 2) + { + this.playerEntity.setSneaking(false); + } + else if (par1Packet19EntityAction.action == 4) + { + this.playerEntity.setSprinting(true); + } + else if (par1Packet19EntityAction.action == 5) + { + this.playerEntity.setSprinting(false); + } + else if (par1Packet19EntityAction.action == 3) + { + this.playerEntity.wakeUpPlayer(false, true, true); + this.hasMoved = false; + } + else if (par1Packet19EntityAction.action == 6) + { + if (this.playerEntity.ridingEntity != null && this.playerEntity.ridingEntity instanceof EntityHorse) + { + ((EntityHorse)this.playerEntity.ridingEntity).setJumpPower(par1Packet19EntityAction.auxData); + } + } + else if (par1Packet19EntityAction.action == 7 && this.playerEntity.ridingEntity != null && this.playerEntity.ridingEntity instanceof EntityHorse) + { + ((EntityHorse)this.playerEntity.ridingEntity).openGUI(this.playerEntity); + } + } + + public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect) + { + this.netManager.networkShutdown("disconnect.quitting", new Object[0]); + } + + /** + * returns 0 for memoryMapped connections + */ + public int packetSize() + { + return this.netManager.packetSize(); + } + + public void handleUseEntity(Packet7UseEntity par1Packet7UseEntity) + { + WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension); + Entity var3 = var2.getEntityByID(par1Packet7UseEntity.targetEntity); + this.playerEntity.func_143004_u(); + + if (var3 != null) + { + boolean var4 = this.playerEntity.canEntityBeSeen(var3); + double var5 = 36.0D; + + if (!var4) + { + var5 = 9.0D; + } + + if (this.playerEntity.getDistanceSqToEntity(var3) < var5) + { + if (par1Packet7UseEntity.isLeftClick == 0) + { + this.playerEntity.interactWith(var3); + } + else if (par1Packet7UseEntity.isLeftClick == 1) + { + if (var3 instanceof EntityItem || var3 instanceof EntityXPOrb || var3 instanceof EntityArrow || var3 == this.playerEntity) + { + this.kickPlayerFromServer("Attempting to attack an invalid entity"); + this.mcServer.logWarning("Player " + this.playerEntity.getCommandSenderName() + " tried to attack an invalid entity"); + return; + } + + this.playerEntity.attackTargetEntityWithCurrentItem(var3); + } + } + } + } + + public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand) + { + this.playerEntity.func_143004_u(); + + if (par1Packet205ClientCommand.forceRespawn == 1) + { + if (this.playerEntity.playerConqueredTheEnd) + { + this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, 0, true); + } + else if (this.playerEntity.getServerForPlayer().getWorldInfo().isHardcoreModeEnabled()) + { + if (this.mcServer.isSinglePlayer() && this.playerEntity.getCommandSenderName().equals(this.mcServer.getServerOwner())) + { + this.playerEntity.playerNetServerHandler.kickPlayerFromServer("You have died. Game over, man, it\'s game over!"); + this.mcServer.deleteWorldAndStopServer(); + } + else + { + BanEntry var2 = new BanEntry(this.playerEntity.getCommandSenderName()); + var2.setBanReason("Death in Hardcore"); + this.mcServer.getConfigurationManager().getBannedPlayers().put(var2); + this.playerEntity.playerNetServerHandler.kickPlayerFromServer("You have died. Game over, man, it\'s game over!"); + } + } + else + { + if (this.playerEntity.getHealth() > 0.0F) + { + return; + } + + this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, 0, false); + } + } + } + + /** + * If this returns false, all packets will be queued for the main thread to handle, even if they would otherwise be + * processed asynchronously. Used to avoid processing packets on the client before the world has been downloaded + * (which happens on the main thread) + */ + public boolean canProcessPacketsAsync() + { + return true; + } + + /** + * respawns the player + */ + public void handleRespawn(Packet9Respawn par1Packet9Respawn) {} + + public void handleCloseWindow(Packet101CloseWindow par1Packet101CloseWindow) + { + this.playerEntity.closeContainer(); + } + + public void handleWindowClick(Packet102WindowClick par1Packet102WindowClick) + { + this.playerEntity.func_143004_u(); + + if (this.playerEntity.openContainer.windowId == par1Packet102WindowClick.window_Id && this.playerEntity.openContainer.isPlayerNotUsingContainer(this.playerEntity)) + { + ItemStack var2 = this.playerEntity.openContainer.slotClick(par1Packet102WindowClick.inventorySlot, par1Packet102WindowClick.mouseClick, par1Packet102WindowClick.holdingShift, this.playerEntity); + + if (ItemStack.areItemStacksEqual(par1Packet102WindowClick.itemStack, var2)) + { + this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet106Transaction(par1Packet102WindowClick.window_Id, par1Packet102WindowClick.action, true)); + this.playerEntity.playerInventoryBeingManipulated = true; + this.playerEntity.openContainer.detectAndSendChanges(); + this.playerEntity.updateHeldItem(); + this.playerEntity.playerInventoryBeingManipulated = false; + } + else + { + this.field_72586_s.addKey(this.playerEntity.openContainer.windowId, Short.valueOf(par1Packet102WindowClick.action)); + this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet106Transaction(par1Packet102WindowClick.window_Id, par1Packet102WindowClick.action, false)); + this.playerEntity.openContainer.setPlayerIsPresent(this.playerEntity, false); + ArrayList var3 = new ArrayList(); + + for (int var4 = 0; var4 < this.playerEntity.openContainer.inventorySlots.size(); ++var4) + { + var3.add(((Slot)this.playerEntity.openContainer.inventorySlots.get(var4)).getStack()); + } + + this.playerEntity.sendContainerAndContentsToPlayer(this.playerEntity.openContainer, var3); + } + } + } + + public void handleEnchantItem(Packet108EnchantItem par1Packet108EnchantItem) + { + this.playerEntity.func_143004_u(); + + if (this.playerEntity.openContainer.windowId == par1Packet108EnchantItem.windowId && this.playerEntity.openContainer.isPlayerNotUsingContainer(this.playerEntity)) + { + this.playerEntity.openContainer.enchantItem(this.playerEntity, par1Packet108EnchantItem.enchantment); + this.playerEntity.openContainer.detectAndSendChanges(); + } + } + + /** + * Handle a creative slot packet. + */ + public void handleCreativeSetSlot(Packet107CreativeSetSlot par1Packet107CreativeSetSlot) + { + if (this.playerEntity.theItemInWorldManager.isCreative()) + { + boolean var2 = par1Packet107CreativeSetSlot.slot < 0; + ItemStack var3 = par1Packet107CreativeSetSlot.itemStack; + boolean var4 = par1Packet107CreativeSetSlot.slot >= 1 && par1Packet107CreativeSetSlot.slot < 36 + InventoryPlayer.getHotbarSize(); + boolean var5 = var3 == null || var3.itemID < Item.itemsList.length && var3.itemID >= 0 && Item.itemsList[var3.itemID] != null; + boolean var6 = var3 == null || var3.getItemDamage() >= 0 && var3.getItemDamage() >= 0 && var3.stackSize <= 64 && var3.stackSize > 0; + + if (var4 && var5 && var6) + { + if (var3 == null) + { + this.playerEntity.inventoryContainer.putStackInSlot(par1Packet107CreativeSetSlot.slot, (ItemStack)null); + } + else + { + this.playerEntity.inventoryContainer.putStackInSlot(par1Packet107CreativeSetSlot.slot, var3); + } + + this.playerEntity.inventoryContainer.setPlayerIsPresent(this.playerEntity, true); + } + else if (var2 && var5 && var6 && this.creativeItemCreationSpamThresholdTally < 200) + { + this.creativeItemCreationSpamThresholdTally += 20; + EntityItem var7 = this.playerEntity.dropPlayerItem(var3); + + if (var7 != null) + { + var7.setAgeToCreativeDespawnTime(); + } + } + } + } + + public void handleTransaction(Packet106Transaction par1Packet106Transaction) + { + Short var2 = (Short)this.field_72586_s.lookup(this.playerEntity.openContainer.windowId); + + if (var2 != null && par1Packet106Transaction.shortWindowId == var2.shortValue() && this.playerEntity.openContainer.windowId == par1Packet106Transaction.windowId && !this.playerEntity.openContainer.isPlayerNotUsingContainer(this.playerEntity)) + { + this.playerEntity.openContainer.setPlayerIsPresent(this.playerEntity, true); + } + } + + /** + * Updates Client side signs + */ + public void handleUpdateSign(Packet130UpdateSign par1Packet130UpdateSign) + { + this.playerEntity.func_143004_u(); + WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension); + + if (var2.blockExists(par1Packet130UpdateSign.xPosition, par1Packet130UpdateSign.yPosition, par1Packet130UpdateSign.zPosition)) + { + TileEntity var3 = var2.getBlockTileEntity(par1Packet130UpdateSign.xPosition, par1Packet130UpdateSign.yPosition, par1Packet130UpdateSign.zPosition); + + if (var3 instanceof TileEntitySign) + { + TileEntitySign var4 = (TileEntitySign)var3; + + if (!var4.isEditable() || var4.func_142009_b() != this.playerEntity) + { + this.mcServer.logWarning("Player " + this.playerEntity.getCommandSenderName() + " just tried to change non-editable sign"); + return; + } + } + + int var6; + int var8; + + for (var8 = 0; var8 < 4; ++var8) + { + boolean var5 = true; + + if (par1Packet130UpdateSign.signLines[var8].length() > 15) + { + var5 = false; + } + else + { + for (var6 = 0; var6 < par1Packet130UpdateSign.signLines[var8].length(); ++var6) + { + if (ChatAllowedCharacters.allowedCharacters.indexOf(par1Packet130UpdateSign.signLines[var8].charAt(var6)) < 0) + { + var5 = false; + } + } + } + + if (!var5) + { + par1Packet130UpdateSign.signLines[var8] = "!?"; + } + } + + if (var3 instanceof TileEntitySign) + { + var8 = par1Packet130UpdateSign.xPosition; + int var9 = par1Packet130UpdateSign.yPosition; + var6 = par1Packet130UpdateSign.zPosition; + TileEntitySign var7 = (TileEntitySign)var3; + System.arraycopy(par1Packet130UpdateSign.signLines, 0, var7.signText, 0, 4); + var7.onInventoryChanged(); + var2.markBlockForUpdate(var8, var9, var6); + } + } + } + + /** + * Handle a keep alive packet. + */ + public void handleKeepAlive(Packet0KeepAlive par1Packet0KeepAlive) + { + if (par1Packet0KeepAlive.randomId == this.keepAliveRandomID) + { + int var2 = (int)(System.nanoTime() / 1000000L - this.keepAliveTimeSent); + this.playerEntity.ping = (this.playerEntity.ping * 3 + var2) / 4; + } + } + + /** + * determine if it is a server handler + */ + public boolean isServerHandler() + { + return true; + } + + /** + * Handle a player abilities packet. + */ + public void handlePlayerAbilities(Packet202PlayerAbilities par1Packet202PlayerAbilities) + { + this.playerEntity.capabilities.isFlying = par1Packet202PlayerAbilities.getFlying() && this.playerEntity.capabilities.allowFlying; + } + + public void handleAutoComplete(Packet203AutoComplete par1Packet203AutoComplete) + { + StringBuilder var2 = new StringBuilder(); + String var4; + + for (Iterator var3 = this.mcServer.getPossibleCompletions(this.playerEntity, par1Packet203AutoComplete.getText()).iterator(); var3.hasNext(); var2.append(var4)) + { + var4 = (String)var3.next(); + + if (var2.length() > 0) + { + var2.append("\u0000"); + } + } + + this.playerEntity.playerNetServerHandler.sendPacketToPlayer(new Packet203AutoComplete(var2.toString())); + } + + public void handleClientInfo(Packet204ClientInfo par1Packet204ClientInfo) + { + this.playerEntity.updateClientInfo(par1Packet204ClientInfo); + } + + public void handleCustomPayload(Packet250CustomPayload par1Packet250CustomPayload) + { + DataInputStream var2; + ItemStack var3; + ItemStack var4; + + if ("MC|BEdit".equals(par1Packet250CustomPayload.channel)) + { + try + { + var2 = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data)); + var3 = Packet.readItemStack(var2); + + if (!ItemWritableBook.validBookTagPages(var3.getTagCompound())) + { + throw new IOException("Invalid book tag!"); + } + + var4 = this.playerEntity.inventory.getCurrentItem(); + + if (var3 != null && var3.itemID == Item.writableBook.itemID && var3.itemID == var4.itemID) + { + var4.setTagInfo("pages", var3.getTagCompound().getTagList("pages")); + } + } + catch (Exception var12) + { + var12.printStackTrace(); + } + } + else if ("MC|BSign".equals(par1Packet250CustomPayload.channel)) + { + try + { + var2 = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data)); + var3 = Packet.readItemStack(var2); + + if (!ItemEditableBook.validBookTagContents(var3.getTagCompound())) + { + throw new IOException("Invalid book tag!"); + } + + var4 = this.playerEntity.inventory.getCurrentItem(); + + if (var3 != null && var3.itemID == Item.writtenBook.itemID && var4.itemID == Item.writableBook.itemID) + { + var4.setTagInfo("author", new NBTTagString("author", this.playerEntity.getCommandSenderName())); + var4.setTagInfo("title", new NBTTagString("title", var3.getTagCompound().getString("title"))); + var4.setTagInfo("pages", var3.getTagCompound().getTagList("pages")); + var4.itemID = Item.writtenBook.itemID; + } + } + catch (Exception var11) + { + var11.printStackTrace(); + } + } + else + { + int var13; + + if ("MC|TrSel".equals(par1Packet250CustomPayload.channel)) + { + try + { + var2 = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data)); + var13 = var2.readInt(); + Container var15 = this.playerEntity.openContainer; + + if (var15 instanceof ContainerMerchant) + { + ((ContainerMerchant)var15).setCurrentRecipeIndex(var13); + } + } + catch (Exception var10) + { + var10.printStackTrace(); + } + } + else + { + int var17; + + if ("MC|AdvCdm".equals(par1Packet250CustomPayload.channel)) + { + if (!this.mcServer.isCommandBlockEnabled()) + { + this.playerEntity.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("advMode.notEnabled")); + } + else if (this.playerEntity.canCommandSenderUseCommand(2, "") && this.playerEntity.capabilities.isCreativeMode) + { + try + { + var2 = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data)); + var13 = var2.readInt(); + var17 = var2.readInt(); + int var5 = var2.readInt(); + String var6 = Packet.readString(var2, 256); + TileEntity var7 = this.playerEntity.worldObj.getBlockTileEntity(var13, var17, var5); + + if (var7 != null && var7 instanceof TileEntityCommandBlock) + { + ((TileEntityCommandBlock)var7).setCommand(var6); + this.playerEntity.worldObj.markBlockForUpdate(var13, var17, var5); + this.playerEntity.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions("advMode.setCommand.success", new Object[] {var6})); + } + } + catch (Exception var9) + { + var9.printStackTrace(); + } + } + else + { + this.playerEntity.sendChatToPlayer(ChatMessageComponent.createFromTranslationKey("advMode.notAllowed")); + } + } + else if ("MC|Beacon".equals(par1Packet250CustomPayload.channel)) + { + if (this.playerEntity.openContainer instanceof ContainerBeacon) + { + try + { + var2 = new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data)); + var13 = var2.readInt(); + var17 = var2.readInt(); + ContainerBeacon var18 = (ContainerBeacon)this.playerEntity.openContainer; + Slot var19 = var18.getSlot(0); + + if (var19.getHasStack()) + { + var19.decrStackSize(1); + TileEntityBeacon var20 = var18.getBeacon(); + var20.setPrimaryEffect(var13); + var20.setSecondaryEffect(var17); + var20.onInventoryChanged(); + } + } + catch (Exception var8) + { + var8.printStackTrace(); + } + } + } + else if ("MC|ItemName".equals(par1Packet250CustomPayload.channel) && this.playerEntity.openContainer instanceof ContainerRepair) + { + ContainerRepair var14 = (ContainerRepair)this.playerEntity.openContainer; + + if (par1Packet250CustomPayload.data != null && par1Packet250CustomPayload.data.length >= 1) + { + String var16 = ChatAllowedCharacters.filerAllowedCharacters(new String(par1Packet250CustomPayload.data)); + + if (var16.length() <= 30) + { + var14.updateItemName(var16); + } + } + else + { + var14.updateItemName(""); + } + } + } + } + } + + public boolean isConnectionClosed() + { + return this.connectionClosed; + } +} diff --git a/src/main/java/net/minecraft/src/NetworkListenThread.java b/src/main/java/net/minecraft/src/NetworkListenThread.java new file mode 100644 index 0000000..764cea5 --- /dev/null +++ b/src/main/java/net/minecraft/src/NetworkListenThread.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import net.minecraft.server.MinecraftServer; + +public abstract class NetworkListenThread +{ + /** Reference to the MinecraftServer object. */ + private final MinecraftServer mcServer; + private final List connections = Collections.synchronizedList(new ArrayList()); + + /** Whether the network listener object is listening. */ + public volatile boolean isListening; + + public NetworkListenThread(MinecraftServer par1MinecraftServer) throws IOException + { + this.mcServer = par1MinecraftServer; + this.isListening = true; + } + + /** + * adds this connection to the list of currently connected players + */ + public void addPlayer(NetServerHandler par1NetServerHandler) + { + this.connections.add(par1NetServerHandler); + } + + public void stopListening() + { + this.isListening = false; + } + + /** + * processes packets and pending connections + */ + public void networkTick() + { + for (int var1 = 0; var1 < this.connections.size(); ++var1) + { + NetServerHandler var2 = (NetServerHandler)this.connections.get(var1); + + try + { + var2.networkTick(); + } + catch (Exception var6) + { + if (var2.netManager instanceof MemoryConnection) + { + CrashReport var4 = CrashReport.makeCrashReport(var6, "Ticking memory connection"); + CrashReportCategory var5 = var4.makeCategory("Ticking connection"); + var5.addCrashSectionCallable("Connection", new CallableConnectionName(this, var2)); + throw new ReportedException(var4); + } + + this.mcServer.getLogAgent().logWarningException("Failed to handle packet for " + var2.playerEntity.getEntityName() + "/" + var2.playerEntity.getPlayerIP() + ": " + var6, var6); + var2.kickPlayerFromServer("Internal server error"); + } + + if (var2.connectionClosed) + { + this.connections.remove(var1--); + } + + var2.netManager.wakeThreads(); + } + } + + public MinecraftServer getServer() + { + return this.mcServer; + } +} diff --git a/src/main/java/net/minecraft/src/NextTickListEntry.java b/src/main/java/net/minecraft/src/NextTickListEntry.java new file mode 100644 index 0000000..ea2f051 --- /dev/null +++ b/src/main/java/net/minecraft/src/NextTickListEntry.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +public class NextTickListEntry implements Comparable +{ + /** The id number for the next tick entry */ + private static long nextTickEntryID; + + /** X position this tick is occuring at */ + public int xCoord; + + /** Y position this tick is occuring at */ + public int yCoord; + + /** Z position this tick is occuring at */ + public int zCoord; + + /** + * blockID of the scheduled tick (ensures when the tick occurs its still for this block) + */ + public int blockID; + + /** Time this tick is scheduled to occur at */ + public long scheduledTime; + public int priority; + + /** The id of the tick entry */ + private long tickEntryID; + + public NextTickListEntry(int par1, int par2, int par3, int par4) + { + this.tickEntryID = (long)(nextTickEntryID++); + this.xCoord = par1; + this.yCoord = par2; + this.zCoord = par3; + this.blockID = par4; + } + + public boolean equals(Object par1Obj) + { + if (!(par1Obj instanceof NextTickListEntry)) + { + return false; + } + else + { + NextTickListEntry var2 = (NextTickListEntry)par1Obj; + return this.xCoord == var2.xCoord && this.yCoord == var2.yCoord && this.zCoord == var2.zCoord && Block.isAssociatedBlockID(this.blockID, var2.blockID); + } + } + + public int hashCode() + { + return (this.xCoord * 1024 * 1024 + this.zCoord * 1024 + this.yCoord) * 256; + } + + /** + * Sets the scheduled time for this tick entry + */ + public NextTickListEntry setScheduledTime(long par1) + { + this.scheduledTime = par1; + return this; + } + + public void setPriority(int par1) + { + this.priority = par1; + } + + /** + * Compares this tick entry to another tick entry for sorting purposes. Compared first based on the scheduled time + * and second based on tickEntryID. + */ + public int comparer(NextTickListEntry par1NextTickListEntry) + { + return this.scheduledTime < par1NextTickListEntry.scheduledTime ? -1 : (this.scheduledTime > par1NextTickListEntry.scheduledTime ? 1 : (this.priority != par1NextTickListEntry.priority ? this.priority - par1NextTickListEntry.priority : (this.tickEntryID < par1NextTickListEntry.tickEntryID ? -1 : (this.tickEntryID > par1NextTickListEntry.tickEntryID ? 1 : 0)))); + } + + public String toString() + { + return this.blockID + ": (" + this.xCoord + ", " + this.yCoord + ", " + this.zCoord + "), " + this.scheduledTime + ", " + this.priority + ", " + this.tickEntryID; + } + + public int compareTo(Object par1Obj) + { + return this.comparer((NextTickListEntry)par1Obj); + } +} diff --git a/src/main/java/net/minecraft/src/NibbleArray.java b/src/main/java/net/minecraft/src/NibbleArray.java new file mode 100644 index 0000000..6df2f7f --- /dev/null +++ b/src/main/java/net/minecraft/src/NibbleArray.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +public class NibbleArray +{ + /** + * Byte array of data stored in this holder. Possibly a light map or some chunk data. Data is accessed in 4-bit + * pieces. + */ + public final byte[] data; + + /** + * Log base 2 of the chunk height (128); applied as a shift on Z coordinate + */ + private final int depthBits; + + /** + * Log base 2 of the chunk height (128) * width (16); applied as a shift on X coordinate + */ + private final int depthBitsPlusFour; + + public NibbleArray(int par1, int par2) + { + this.data = new byte[par1 >> 1]; + this.depthBits = par2; + this.depthBitsPlusFour = par2 + 4; + } + + public NibbleArray(byte[] par1ArrayOfByte, int par2) + { + this.data = par1ArrayOfByte; + this.depthBits = par2; + this.depthBitsPlusFour = par2 + 4; + } + + /** + * Returns the nibble of data corresponding to the passed in x, y, z. y is at most 6 bits, z is at most 4. + */ + public int get(int par1, int par2, int par3) + { + int var4 = par2 << this.depthBitsPlusFour | par3 << this.depthBits | par1; + int var5 = var4 >> 1; + int var6 = var4 & 1; + return var6 == 0 ? this.data[var5] & 15 : this.data[var5] >> 4 & 15; + } + + /** + * Arguments are x, y, z, val. Sets the nibble of data at x << 11 | z << 7 | y to val. + */ + public void set(int par1, int par2, int par3, int par4) + { + int var5 = par2 << this.depthBitsPlusFour | par3 << this.depthBits | par1; + int var6 = var5 >> 1; + int var7 = var5 & 1; + + if (var7 == 0) + { + this.data[var6] = (byte)(this.data[var6] & 240 | par4 & 15); + } + else + { + this.data[var6] = (byte)(this.data[var6] & 15 | (par4 & 15) << 4); + } + } +} diff --git a/src/main/java/net/minecraft/src/NibbleArrayReader.java b/src/main/java/net/minecraft/src/NibbleArrayReader.java new file mode 100644 index 0000000..9132435 --- /dev/null +++ b/src/main/java/net/minecraft/src/NibbleArrayReader.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +public class NibbleArrayReader +{ + public final byte[] data; + private final int depthBits; + private final int depthBitsPlusFour; + + public NibbleArrayReader(byte[] par1ArrayOfByte, int par2) + { + this.data = par1ArrayOfByte; + this.depthBits = par2; + this.depthBitsPlusFour = par2 + 4; + } + + public int get(int par1, int par2, int par3) + { + int var4 = par1 << this.depthBitsPlusFour | par3 << this.depthBits | par2; + int var5 = var4 >> 1; + int var6 = var4 & 1; + return var6 == 0 ? this.data[var5] & 15 : this.data[var5] >> 4 & 15; + } +} diff --git a/src/main/java/net/minecraft/src/NoiseGenerator.java b/src/main/java/net/minecraft/src/NoiseGenerator.java new file mode 100644 index 0000000..a3a9211 --- /dev/null +++ b/src/main/java/net/minecraft/src/NoiseGenerator.java @@ -0,0 +1,5 @@ +package net.minecraft.src; + +public abstract class NoiseGenerator +{ +} diff --git a/src/main/java/net/minecraft/src/NoiseGeneratorOctaves.java b/src/main/java/net/minecraft/src/NoiseGeneratorOctaves.java new file mode 100644 index 0000000..2e58a08 --- /dev/null +++ b/src/main/java/net/minecraft/src/NoiseGeneratorOctaves.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +import java.util.Random; + +public class NoiseGeneratorOctaves extends NoiseGenerator +{ + /** + * Collection of noise generation functions. Output is combined to produce different octaves of noise. + */ + private NoiseGeneratorPerlin[] generatorCollection; + private int octaves; + + public NoiseGeneratorOctaves(Random par1Random, int par2) + { + this.octaves = par2; + this.generatorCollection = new NoiseGeneratorPerlin[par2]; + + for (int var3 = 0; var3 < par2; ++var3) + { + this.generatorCollection[var3] = new NoiseGeneratorPerlin(par1Random); + } + } + + /** + * pars:(par2,3,4=noiseOffset ; so that adjacent noise segments connect) (pars5,6,7=x,y,zArraySize),(pars8,10,12 = + * x,y,z noiseScale) + */ + public double[] generateNoiseOctaves(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7, double par8, double par10, double par12) + { + if (par1ArrayOfDouble == null) + { + par1ArrayOfDouble = new double[par5 * par6 * par7]; + } + else + { + for (int var14 = 0; var14 < par1ArrayOfDouble.length; ++var14) + { + par1ArrayOfDouble[var14] = 0.0D; + } + } + + double var27 = 1.0D; + + for (int var16 = 0; var16 < this.octaves; ++var16) + { + double var17 = (double)par2 * var27 * par8; + double var19 = (double)par3 * var27 * par10; + double var21 = (double)par4 * var27 * par12; + long var23 = MathHelper.floor_double_long(var17); + long var25 = MathHelper.floor_double_long(var21); + var17 -= (double)var23; + var21 -= (double)var25; + var23 %= 16777216L; + var25 %= 16777216L; + var17 += (double)var23; + var21 += (double)var25; + this.generatorCollection[var16].populateNoiseArray(par1ArrayOfDouble, var17, var19, var21, par5, par6, par7, par8 * var27, par10 * var27, par12 * var27, var27); + var27 /= 2.0D; + } + + return par1ArrayOfDouble; + } + + /** + * Bouncer function to the main one with some default arguments. + */ + public double[] generateNoiseOctaves(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, double par6, double par8, double par10) + { + return this.generateNoiseOctaves(par1ArrayOfDouble, par2, 10, par3, par4, 1, par5, par6, 1.0D, par8); + } +} diff --git a/src/main/java/net/minecraft/src/NoiseGeneratorPerlin.java b/src/main/java/net/minecraft/src/NoiseGeneratorPerlin.java new file mode 100644 index 0000000..87ebd7d --- /dev/null +++ b/src/main/java/net/minecraft/src/NoiseGeneratorPerlin.java @@ -0,0 +1,212 @@ +package net.minecraft.src; + +import java.util.Random; + +public class NoiseGeneratorPerlin extends NoiseGenerator +{ + private int[] permutations; + public double xCoord; + public double yCoord; + public double zCoord; + + public NoiseGeneratorPerlin() + { + this(new Random()); + } + + public NoiseGeneratorPerlin(Random par1Random) + { + this.permutations = new int[512]; + this.xCoord = par1Random.nextDouble() * 256.0D; + this.yCoord = par1Random.nextDouble() * 256.0D; + this.zCoord = par1Random.nextDouble() * 256.0D; + int var2; + + for (var2 = 0; var2 < 256; this.permutations[var2] = var2++) + { + ; + } + + for (var2 = 0; var2 < 256; ++var2) + { + int var3 = par1Random.nextInt(256 - var2) + var2; + int var4 = this.permutations[var2]; + this.permutations[var2] = this.permutations[var3]; + this.permutations[var3] = var4; + this.permutations[var2 + 256] = this.permutations[var2]; + } + } + + public final double lerp(double par1, double par3, double par5) + { + return par3 + par1 * (par5 - par3); + } + + public final double func_76309_a(int par1, double par2, double par4) + { + int var6 = par1 & 15; + double var7 = (double)(1 - ((var6 & 8) >> 3)) * par2; + double var9 = var6 < 4 ? 0.0D : (var6 != 12 && var6 != 14 ? par4 : par2); + return ((var6 & 1) == 0 ? var7 : -var7) + ((var6 & 2) == 0 ? var9 : -var9); + } + + public final double grad(int par1, double par2, double par4, double par6) + { + int var8 = par1 & 15; + double var9 = var8 < 8 ? par2 : par4; + double var11 = var8 < 4 ? par4 : (var8 != 12 && var8 != 14 ? par6 : par2); + return ((var8 & 1) == 0 ? var9 : -var9) + ((var8 & 2) == 0 ? var11 : -var11); + } + + /** + * pars: noiseArray , xOffset , yOffset , zOffset , xSize , ySize , zSize , xScale, yScale , zScale , noiseScale. + * noiseArray should be xSize*ySize*zSize in size + */ + public void populateNoiseArray(double[] par1ArrayOfDouble, double par2, double par4, double par6, int par8, int par9, int par10, double par11, double par13, double par15, double par17) + { + int var10001; + int var19; + int var22; + double var31; + double var35; + int var37; + double var38; + int var40; + int var41; + double var42; + int var75; + + if (par9 == 1) + { + boolean var64 = false; + boolean var65 = false; + boolean var21 = false; + boolean var68 = false; + double var70 = 0.0D; + double var73 = 0.0D; + var75 = 0; + double var77 = 1.0D / par17; + + for (int var30 = 0; var30 < par8; ++var30) + { + var31 = par2 + (double)var30 * par11 + this.xCoord; + int var78 = (int)var31; + + if (var31 < (double)var78) + { + --var78; + } + + int var34 = var78 & 255; + var31 -= (double)var78; + var35 = var31 * var31 * var31 * (var31 * (var31 * 6.0D - 15.0D) + 10.0D); + + for (var37 = 0; var37 < par10; ++var37) + { + var38 = par6 + (double)var37 * par15 + this.zCoord; + var40 = (int)var38; + + if (var38 < (double)var40) + { + --var40; + } + + var41 = var40 & 255; + var38 -= (double)var40; + var42 = var38 * var38 * var38 * (var38 * (var38 * 6.0D - 15.0D) + 10.0D); + var19 = this.permutations[var34] + 0; + int var66 = this.permutations[var19] + var41; + int var67 = this.permutations[var34 + 1] + 0; + var22 = this.permutations[var67] + var41; + var70 = this.lerp(var35, this.func_76309_a(this.permutations[var66], var31, var38), this.grad(this.permutations[var22], var31 - 1.0D, 0.0D, var38)); + var73 = this.lerp(var35, this.grad(this.permutations[var66 + 1], var31, 0.0D, var38 - 1.0D), this.grad(this.permutations[var22 + 1], var31 - 1.0D, 0.0D, var38 - 1.0D)); + double var79 = this.lerp(var42, var70, var73); + var10001 = var75++; + par1ArrayOfDouble[var10001] += var79 * var77; + } + } + } + else + { + var19 = 0; + double var20 = 1.0D / par17; + var22 = -1; + boolean var23 = false; + boolean var24 = false; + boolean var25 = false; + boolean var26 = false; + boolean var27 = false; + boolean var28 = false; + double var29 = 0.0D; + var31 = 0.0D; + double var33 = 0.0D; + var35 = 0.0D; + + for (var37 = 0; var37 < par8; ++var37) + { + var38 = par2 + (double)var37 * par11 + this.xCoord; + var40 = (int)var38; + + if (var38 < (double)var40) + { + --var40; + } + + var41 = var40 & 255; + var38 -= (double)var40; + var42 = var38 * var38 * var38 * (var38 * (var38 * 6.0D - 15.0D) + 10.0D); + + for (int var44 = 0; var44 < par10; ++var44) + { + double var45 = par6 + (double)var44 * par15 + this.zCoord; + int var47 = (int)var45; + + if (var45 < (double)var47) + { + --var47; + } + + int var48 = var47 & 255; + var45 -= (double)var47; + double var49 = var45 * var45 * var45 * (var45 * (var45 * 6.0D - 15.0D) + 10.0D); + + for (int var51 = 0; var51 < par9; ++var51) + { + double var52 = par4 + (double)var51 * par13 + this.yCoord; + int var54 = (int)var52; + + if (var52 < (double)var54) + { + --var54; + } + + int var55 = var54 & 255; + var52 -= (double)var54; + double var56 = var52 * var52 * var52 * (var52 * (var52 * 6.0D - 15.0D) + 10.0D); + + if (var51 == 0 || var55 != var22) + { + var22 = var55; + int var69 = this.permutations[var41] + var55; + int var71 = this.permutations[var69] + var48; + int var72 = this.permutations[var69 + 1] + var48; + int var74 = this.permutations[var41 + 1] + var55; + var75 = this.permutations[var74] + var48; + int var76 = this.permutations[var74 + 1] + var48; + var29 = this.lerp(var42, this.grad(this.permutations[var71], var38, var52, var45), this.grad(this.permutations[var75], var38 - 1.0D, var52, var45)); + var31 = this.lerp(var42, this.grad(this.permutations[var72], var38, var52 - 1.0D, var45), this.grad(this.permutations[var76], var38 - 1.0D, var52 - 1.0D, var45)); + var33 = this.lerp(var42, this.grad(this.permutations[var71 + 1], var38, var52, var45 - 1.0D), this.grad(this.permutations[var75 + 1], var38 - 1.0D, var52, var45 - 1.0D)); + var35 = this.lerp(var42, this.grad(this.permutations[var72 + 1], var38, var52 - 1.0D, var45 - 1.0D), this.grad(this.permutations[var76 + 1], var38 - 1.0D, var52 - 1.0D, var45 - 1.0D)); + } + + double var58 = this.lerp(var56, var29, var31); + double var60 = this.lerp(var56, var33, var35); + double var62 = this.lerp(var49, var58, var60); + var10001 = var19++; + par1ArrayOfDouble[var10001] += var62 * var20; + } + } + } + } + } +} diff --git a/src/main/java/net/minecraft/src/NpcMerchant.java b/src/main/java/net/minecraft/src/NpcMerchant.java new file mode 100644 index 0000000..39a9c64 --- /dev/null +++ b/src/main/java/net/minecraft/src/NpcMerchant.java @@ -0,0 +1,40 @@ +package net.minecraft.src; + +public class NpcMerchant implements IMerchant +{ + /** Instance of Merchants Inventory. */ + private InventoryMerchant theMerchantInventory; + + /** This merchant's current player customer. */ + private EntityPlayer customer; + + /** The MerchantRecipeList instance. */ + private MerchantRecipeList recipeList; + + public NpcMerchant(EntityPlayer par1EntityPlayer) + { + this.customer = par1EntityPlayer; + this.theMerchantInventory = new InventoryMerchant(par1EntityPlayer, this); + } + + public EntityPlayer getCustomer() + { + return this.customer; + } + + public void setCustomer(EntityPlayer par1EntityPlayer) {} + + public MerchantRecipeList getRecipes(EntityPlayer par1EntityPlayer) + { + return this.recipeList; + } + + public void setRecipes(MerchantRecipeList par1MerchantRecipeList) + { + this.recipeList = par1MerchantRecipeList; + } + + public void useRecipe(MerchantRecipe par1MerchantRecipe) {} + + public void func_110297_a_(ItemStack par1ItemStack) {} +} diff --git a/src/main/java/net/minecraft/src/NumberInvalidException.java b/src/main/java/net/minecraft/src/NumberInvalidException.java new file mode 100644 index 0000000..084bf2d --- /dev/null +++ b/src/main/java/net/minecraft/src/NumberInvalidException.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +public class NumberInvalidException extends CommandException +{ + public NumberInvalidException() + { + this("commands.generic.num.invalid", new Object[0]); + } + + public NumberInvalidException(String par1Str, Object ... par2ArrayOfObj) + { + super(par1Str, par2ArrayOfObj); + } +} diff --git a/src/main/java/net/minecraft/src/OpenGlCapsChecker.java b/src/main/java/net/minecraft/src/OpenGlCapsChecker.java new file mode 100644 index 0000000..110d1a3 --- /dev/null +++ b/src/main/java/net/minecraft/src/OpenGlCapsChecker.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GLContext; + +public class OpenGlCapsChecker +{ + /** + * Checks if we support OpenGL occlusion. + */ + public static boolean checkARBOcclusion() + { + return GLContext.getCapabilities().GL_ARB_occlusion_query; + } +} diff --git a/src/main/java/net/minecraft/src/OpenGlHelper.java b/src/main/java/net/minecraft/src/OpenGlHelper.java new file mode 100644 index 0000000..3b5ece4 --- /dev/null +++ b/src/main/java/net/minecraft/src/OpenGlHelper.java @@ -0,0 +1,89 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.ARBMultitexture; +import org.lwjgl.opengl.GL13; +import org.lwjgl.opengl.GLContext; + +public class OpenGlHelper +{ + /** + * An OpenGL constant corresponding to GL_TEXTURE0, used when setting data pertaining to auxiliary OpenGL texture + * units. + */ + public static int defaultTexUnit; + + /** + * An OpenGL constant corresponding to GL_TEXTURE1, used when setting data pertaining to auxiliary OpenGL texture + * units. + */ + public static int lightmapTexUnit; + + /** + * True if the renderer supports multitextures and the OpenGL version != 1.3 + */ + private static boolean useMultitextureARB; + + /** + * Initializes the texture constants to be used when rendering lightmap values + */ + public static void initializeTextures() + { + useMultitextureARB = GLContext.getCapabilities().GL_ARB_multitexture && !GLContext.getCapabilities().OpenGL13; + + if (useMultitextureARB) + { + defaultTexUnit = 33984; + lightmapTexUnit = 33985; + } + else + { + defaultTexUnit = 33984; + lightmapTexUnit = 33985; + } + } + + /** + * Sets the current lightmap texture to the specified OpenGL constant + */ + public static void setActiveTexture(int par0) + { + if (useMultitextureARB) + { + ARBMultitexture.glActiveTextureARB(par0); + } + else + { + GL13.glActiveTexture(par0); + } + } + + /** + * Sets the current lightmap texture to the specified OpenGL constant + */ + public static void setClientActiveTexture(int par0) + { + if (useMultitextureARB) + { + ARBMultitexture.glClientActiveTextureARB(par0); + } + else + { + GL13.glClientActiveTexture(par0); + } + } + + /** + * Sets the current coordinates of the given lightmap texture + */ + public static void setLightmapTextureCoords(int par0, float par1, float par2) + { + if (useMultitextureARB) + { + ARBMultitexture.glMultiTexCoord2fARB(par0, par1, par2); + } + else + { + GL13.glMultiTexCoord2f(par0, par1, par2); + } + } +} diff --git a/src/main/java/net/minecraft/src/PackMetadataSection.java b/src/main/java/net/minecraft/src/PackMetadataSection.java new file mode 100644 index 0000000..39845af --- /dev/null +++ b/src/main/java/net/minecraft/src/PackMetadataSection.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +public class PackMetadataSection implements MetadataSection +{ + private final String packDescription; + private final int packFormat; + + public PackMetadataSection(String par1Str, int par2) + { + this.packDescription = par1Str; + this.packFormat = par2; + } + + public String getPackDescription() + { + return this.packDescription; + } + + public int getPackFormat() + { + return this.packFormat; + } +} diff --git a/src/main/java/net/minecraft/src/PackMetadataSectionSerializer.java b/src/main/java/net/minecraft/src/PackMetadataSectionSerializer.java new file mode 100644 index 0000000..d503af2 --- /dev/null +++ b/src/main/java/net/minecraft/src/PackMetadataSectionSerializer.java @@ -0,0 +1,45 @@ +package net.minecraft.src; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import java.lang.reflect.Type; + +public class PackMetadataSectionSerializer extends BaseMetadataSectionSerializer implements JsonSerializer +{ + public PackMetadataSection func_110489_a(JsonElement par1JsonElement, Type par2Type, JsonDeserializationContext par3JsonDeserializationContext) + { + JsonObject var4 = par1JsonElement.getAsJsonObject(); + String var5 = this.func_110486_a(var4.get("description"), "description", (String)null, 1, Integer.MAX_VALUE); + int var6 = this.func_110485_a(var4.get("pack_format"), "pack_format", (Integer)null, 1, Integer.MAX_VALUE); + return new PackMetadataSection(var5, var6); + } + + public JsonElement func_110488_a(PackMetadataSection par1PackMetadataSection, Type par2Type, JsonSerializationContext par3JsonSerializationContext) + { + JsonObject var4 = new JsonObject(); + var4.addProperty("pack_format", Integer.valueOf(par1PackMetadataSection.getPackFormat())); + var4.addProperty("description", par1PackMetadataSection.getPackDescription()); + return var4; + } + + /** + * The name of this section type as it appears in JSON. + */ + public String getSectionName() + { + return "pack"; + } + + public Object deserialize(JsonElement par1JsonElement, Type par2Type, JsonDeserializationContext par3JsonDeserializationContext) + { + return this.func_110489_a(par1JsonElement, par2Type, par3JsonDeserializationContext); + } + + public JsonElement serialize(Object par1Obj, Type par2Type, JsonSerializationContext par3JsonSerializationContext) + { + return this.func_110488_a((PackMetadataSection)par1Obj, par2Type, par3JsonSerializationContext); + } +} diff --git a/src/main/java/net/minecraft/src/Packet.java b/src/main/java/net/minecraft/src/Packet.java new file mode 100644 index 0000000..bac9710 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet.java @@ -0,0 +1,450 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.EOFException; +import java.io.IOException; +import java.net.Socket; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import net.minecraft.server.MinecraftServer; + +public abstract class Packet +{ + /** Maps packet id to packet class */ + public static IntHashMap packetIdToClassMap = new IntHashMap(); + + /** Maps packet class to packet id */ + private static Map packetClassToIdMap = new HashMap(); + + /** List of the client's packet IDs. */ + private static Set clientPacketIdList = new HashSet(); + + /** List of the server's packet IDs. */ + private static Set serverPacketIdList = new HashSet(); + protected ILogAgent field_98193_m; + + /** the system time in milliseconds when this packet was created. */ + public final long creationTimeMillis = MinecraftServer.getSystemTimeMillis(); + public static long receivedID; + public static long receivedSize; + + /** Assumed to be sequential by the profiler. */ + public static long sentID; + public static long sentSize; + + /** + * Only true for Packet51MapChunk, Packet52MultiBlockChange, Packet53BlockChange and Packet59ComplexEntity. Used to + * separate them into a different send queue. + */ + public boolean isChunkDataPacket; + + /** + * Adds a two way mapping between the packet ID and packet class. + */ + static void addIdClassMapping(int par0, boolean par1, boolean par2, Class par3Class) + { + if (packetIdToClassMap.containsItem(par0)) + { + throw new IllegalArgumentException("Duplicate packet id:" + par0); + } + else if (packetClassToIdMap.containsKey(par3Class)) + { + throw new IllegalArgumentException("Duplicate packet class:" + par3Class); + } + else + { + packetIdToClassMap.addKey(par0, par3Class); + packetClassToIdMap.put(par3Class, Integer.valueOf(par0)); + + if (par1) + { + clientPacketIdList.add(Integer.valueOf(par0)); + } + + if (par2) + { + serverPacketIdList.add(Integer.valueOf(par0)); + } + } + } + + /** + * Returns a new instance of the specified Packet class. + */ + public static Packet getNewPacket(ILogAgent par0ILogAgent, int par1) + { + try + { + Class var2 = (Class)packetIdToClassMap.lookup(par1); + return var2 == null ? null : (Packet)var2.newInstance(); + } + catch (Exception var3) + { + var3.printStackTrace(); + par0ILogAgent.logSevere("Skipping packet with id " + par1); + return null; + } + } + + /** + * Writes a byte array to the DataOutputStream + */ + public static void writeByteArray(DataOutput par0DataOutput, byte[] par1ArrayOfByte) throws IOException + { + par0DataOutput.writeShort(par1ArrayOfByte.length); + par0DataOutput.write(par1ArrayOfByte); + } + + /** + * the first short in the stream indicates the number of bytes to read + */ + public static byte[] readBytesFromStream(DataInput par0DataInput) throws IOException + { + short var1 = par0DataInput.readShort(); + + if (var1 < 0) + { + throw new IOException("Key was smaller than nothing! Weird key!"); + } + else + { + byte[] var2 = new byte[var1]; + par0DataInput.readFully(var2); + return var2; + } + } + + /** + * Returns the ID of this packet. + */ + public final int getPacketId() + { + return ((Integer)packetClassToIdMap.get(this.getClass())).intValue(); + } + + /** + * Read a packet, prefixed by its ID, from the data stream. + */ + public static Packet readPacket(ILogAgent par0ILogAgent, DataInput par1DataInput, boolean par2, Socket par3Socket) throws IOException + { + boolean var4 = false; + Packet var5 = null; + int var6 = par3Socket.getSoTimeout(); + int var9; + + try + { + var9 = par1DataInput.readUnsignedByte(); + + if (par2 && !serverPacketIdList.contains(Integer.valueOf(var9)) || !par2 && !clientPacketIdList.contains(Integer.valueOf(var9))) + { + throw new IOException("Bad packet id " + var9); + } + + var5 = getNewPacket(par0ILogAgent, var9); + + if (var5 == null) + { + throw new IOException("Bad packet id " + var9); + } + + var5.field_98193_m = par0ILogAgent; + + if (var5 instanceof Packet254ServerPing) + { + par3Socket.setSoTimeout(1500); + } + + var5.readPacketData(par1DataInput); + ++receivedID; + receivedSize += (long)var5.getPacketSize(); + } + catch (EOFException var8) + { + par0ILogAgent.logSevere("Reached end of stream for " + par3Socket.getInetAddress()); + return null; + } + + PacketCount.countPacket(var9, (long)var5.getPacketSize()); + ++receivedID; + receivedSize += (long)var5.getPacketSize(); + par3Socket.setSoTimeout(var6); + return var5; + } + + /** + * Writes a packet, prefixed by its ID, to the data stream. + */ + public static void writePacket(Packet par0Packet, DataOutput par1DataOutput) throws IOException + { + par1DataOutput.write(par0Packet.getPacketId()); + par0Packet.writePacketData(par1DataOutput); + ++sentID; + sentSize += (long)par0Packet.getPacketSize(); + } + + /** + * Writes a String to the DataOutputStream + */ + public static void writeString(String par0Str, DataOutput par1DataOutput) throws IOException + { + if (par0Str.length() > 32767) + { + throw new IOException("String too big"); + } + else + { + par1DataOutput.writeShort(par0Str.length()); + par1DataOutput.writeChars(par0Str); + } + } + + /** + * Reads a string from a packet + */ + public static String readString(DataInput par0DataInput, int par1) throws IOException + { + short var2 = par0DataInput.readShort(); + + if (var2 > par1) + { + throw new IOException("Received string length longer than maximum allowed (" + var2 + " > " + par1 + ")"); + } + else if (var2 < 0) + { + throw new IOException("Received string length is less than zero! Weird string!"); + } + else + { + StringBuilder var3 = new StringBuilder(); + + for (int var4 = 0; var4 < var2; ++var4) + { + var3.append(par0DataInput.readChar()); + } + + return var3.toString(); + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public abstract void readPacketData(DataInput var1) throws IOException; + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public abstract void writePacketData(DataOutput var1) throws IOException; + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public abstract void processPacket(NetHandler var1); + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public abstract int getPacketSize(); + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return false; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return false; + } + + /** + * If this returns true, the packet may be processed on any thread; otherwise it is queued for the main thread to + * handle. + */ + public boolean canProcessAsync() + { + return false; + } + + public String toString() + { + String var1 = this.getClass().getSimpleName(); + return var1; + } + + /** + * Reads a ItemStack from the InputStream + */ + public static ItemStack readItemStack(DataInput par0DataInput) throws IOException + { + ItemStack var1 = null; + short var2 = par0DataInput.readShort(); + + if (var2 >= 0) + { + byte var3 = par0DataInput.readByte(); + short var4 = par0DataInput.readShort(); + var1 = new ItemStack(var2, var3, var4); + var1.stackTagCompound = readNBTTagCompound(par0DataInput); + } + + return var1; + } + + /** + * Writes the ItemStack's ID (short), then size (byte), then damage. (short) + */ + public static void writeItemStack(ItemStack par0ItemStack, DataOutput par1DataOutput) throws IOException + { + if (par0ItemStack == null) + { + par1DataOutput.writeShort(-1); + } + else + { + par1DataOutput.writeShort(par0ItemStack.itemID); + par1DataOutput.writeByte(par0ItemStack.stackSize); + par1DataOutput.writeShort(par0ItemStack.getItemDamage()); + NBTTagCompound var2 = null; + + if (par0ItemStack.getItem().isDamageable() || par0ItemStack.getItem().getShareTag()) + { + var2 = par0ItemStack.stackTagCompound; + } + + writeNBTTagCompound(var2, par1DataOutput); + } + } + + /** + * Reads a compressed NBTTagCompound from the InputStream + */ + public static NBTTagCompound readNBTTagCompound(DataInput par0DataInput) throws IOException + { + short var1 = par0DataInput.readShort(); + + if (var1 < 0) + { + return null; + } + else + { + byte[] var2 = new byte[var1]; + par0DataInput.readFully(var2); + return CompressedStreamTools.decompress(var2); + } + } + + /** + * Writes a compressed NBTTagCompound to the OutputStream + */ + protected static void writeNBTTagCompound(NBTTagCompound par0NBTTagCompound, DataOutput par1DataOutput) throws IOException + { + if (par0NBTTagCompound == null) + { + par1DataOutput.writeShort(-1); + } + else + { + byte[] var2 = CompressedStreamTools.compress(par0NBTTagCompound); + par1DataOutput.writeShort((short)var2.length); + par1DataOutput.write(var2); + } + } + + static + { + addIdClassMapping(0, true, true, Packet0KeepAlive.class); + addIdClassMapping(1, true, true, Packet1Login.class); + addIdClassMapping(2, false, true, Packet2ClientProtocol.class); + addIdClassMapping(3, true, true, Packet3Chat.class); + addIdClassMapping(4, true, false, Packet4UpdateTime.class); + addIdClassMapping(5, true, false, Packet5PlayerInventory.class); + addIdClassMapping(6, true, false, Packet6SpawnPosition.class); + addIdClassMapping(7, false, true, Packet7UseEntity.class); + addIdClassMapping(8, true, false, Packet8UpdateHealth.class); + addIdClassMapping(9, true, true, Packet9Respawn.class); + addIdClassMapping(10, true, true, Packet10Flying.class); + addIdClassMapping(11, true, true, Packet11PlayerPosition.class); + addIdClassMapping(12, true, true, Packet12PlayerLook.class); + addIdClassMapping(13, true, true, Packet13PlayerLookMove.class); + addIdClassMapping(14, false, true, Packet14BlockDig.class); + addIdClassMapping(15, false, true, Packet15Place.class); + addIdClassMapping(16, true, true, Packet16BlockItemSwitch.class); + addIdClassMapping(17, true, false, Packet17Sleep.class); + addIdClassMapping(18, true, true, Packet18Animation.class); + addIdClassMapping(19, false, true, Packet19EntityAction.class); + addIdClassMapping(20, true, false, Packet20NamedEntitySpawn.class); + addIdClassMapping(22, true, false, Packet22Collect.class); + addIdClassMapping(23, true, false, Packet23VehicleSpawn.class); + addIdClassMapping(24, true, false, Packet24MobSpawn.class); + addIdClassMapping(25, true, false, Packet25EntityPainting.class); + addIdClassMapping(26, true, false, Packet26EntityExpOrb.class); + addIdClassMapping(27, false, true, Packet27PlayerInput.class); + addIdClassMapping(28, true, false, Packet28EntityVelocity.class); + addIdClassMapping(29, true, false, Packet29DestroyEntity.class); + addIdClassMapping(30, true, false, Packet30Entity.class); + addIdClassMapping(31, true, false, Packet31RelEntityMove.class); + addIdClassMapping(32, true, false, Packet32EntityLook.class); + addIdClassMapping(33, true, false, Packet33RelEntityMoveLook.class); + addIdClassMapping(34, true, false, Packet34EntityTeleport.class); + addIdClassMapping(35, true, false, Packet35EntityHeadRotation.class); + addIdClassMapping(38, true, false, Packet38EntityStatus.class); + addIdClassMapping(39, true, false, Packet39AttachEntity.class); + addIdClassMapping(40, true, false, Packet40EntityMetadata.class); + addIdClassMapping(41, true, false, Packet41EntityEffect.class); + addIdClassMapping(42, true, false, Packet42RemoveEntityEffect.class); + addIdClassMapping(43, true, false, Packet43Experience.class); + addIdClassMapping(44, true, false, Packet44UpdateAttributes.class); + addIdClassMapping(51, true, false, Packet51MapChunk.class); + addIdClassMapping(52, true, false, Packet52MultiBlockChange.class); + addIdClassMapping(53, true, false, Packet53BlockChange.class); + addIdClassMapping(54, true, false, Packet54PlayNoteBlock.class); + addIdClassMapping(55, true, false, Packet55BlockDestroy.class); + addIdClassMapping(56, true, false, Packet56MapChunks.class); + addIdClassMapping(60, true, false, Packet60Explosion.class); + addIdClassMapping(61, true, false, Packet61DoorChange.class); + addIdClassMapping(62, true, false, Packet62LevelSound.class); + addIdClassMapping(63, true, false, Packet63WorldParticles.class); + addIdClassMapping(70, true, false, Packet70GameEvent.class); + addIdClassMapping(71, true, false, Packet71Weather.class); + addIdClassMapping(100, true, false, Packet100OpenWindow.class); + addIdClassMapping(101, true, true, Packet101CloseWindow.class); + addIdClassMapping(102, false, true, Packet102WindowClick.class); + addIdClassMapping(103, true, false, Packet103SetSlot.class); + addIdClassMapping(104, true, false, Packet104WindowItems.class); + addIdClassMapping(105, true, false, Packet105UpdateProgressbar.class); + addIdClassMapping(106, true, true, Packet106Transaction.class); + addIdClassMapping(107, true, true, Packet107CreativeSetSlot.class); + addIdClassMapping(108, false, true, Packet108EnchantItem.class); + addIdClassMapping(130, true, true, Packet130UpdateSign.class); + addIdClassMapping(131, true, false, Packet131MapData.class); + addIdClassMapping(132, true, false, Packet132TileEntityData.class); + addIdClassMapping(133, true, false, Packet133TileEditorOpen.class); + addIdClassMapping(200, true, false, Packet200Statistic.class); + addIdClassMapping(201, true, false, Packet201PlayerInfo.class); + addIdClassMapping(202, true, true, Packet202PlayerAbilities.class); + addIdClassMapping(203, true, true, Packet203AutoComplete.class); + addIdClassMapping(204, false, true, Packet204ClientInfo.class); + addIdClassMapping(205, false, true, Packet205ClientCommand.class); + addIdClassMapping(206, true, false, Packet206SetObjective.class); + addIdClassMapping(207, true, false, Packet207SetScore.class); + addIdClassMapping(208, true, false, Packet208SetDisplayObjective.class); + addIdClassMapping(209, true, false, Packet209SetPlayerTeam.class); + addIdClassMapping(250, true, true, Packet250CustomPayload.class); + addIdClassMapping(252, true, true, Packet252SharedKey.class); + addIdClassMapping(253, true, false, Packet253ServerAuthData.class); + addIdClassMapping(254, false, true, Packet254ServerPing.class); + addIdClassMapping(255, true, true, Packet255KickDisconnect.class); + } +} diff --git a/src/main/java/net/minecraft/src/Packet0KeepAlive.java b/src/main/java/net/minecraft/src/Packet0KeepAlive.java new file mode 100644 index 0000000..24392fa --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet0KeepAlive.java @@ -0,0 +1,75 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet0KeepAlive extends Packet +{ + public int randomId; + + public Packet0KeepAlive() {} + + public Packet0KeepAlive(int par1) + { + this.randomId = par1; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleKeepAlive(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.randomId = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.randomId); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 4; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return true; + } + + /** + * If this returns true, the packet may be processed on any thread; otherwise it is queued for the main thread to + * handle. + */ + public boolean canProcessAsync() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet100OpenWindow.java b/src/main/java/net/minecraft/src/Packet100OpenWindow.java new file mode 100644 index 0000000..9ae3aa0 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet100OpenWindow.java @@ -0,0 +1,87 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet100OpenWindow extends Packet +{ + public int windowId; + public int inventoryType; + public String windowTitle; + public int slotsCount; + + /** + * If false, the client will look up a string like "window.minecart". If true, the client uses what the server + * provides. + */ + public boolean useProvidedWindowTitle; + public int field_111008_f; + + public Packet100OpenWindow() {} + + public Packet100OpenWindow(int par1, int par2, String par3Str, int par4, boolean par5) + { + this.windowId = par1; + this.inventoryType = par2; + this.windowTitle = par3Str; + this.slotsCount = par4; + this.useProvidedWindowTitle = par5; + } + + public Packet100OpenWindow(int par1, int par2, String par3Str, int par4, boolean par5, int par6) + { + this(par1, par2, par3Str, par4, par5); + this.field_111008_f = par6; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleOpenWindow(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.windowId = par1DataInput.readByte() & 255; + this.inventoryType = par1DataInput.readByte() & 255; + this.windowTitle = readString(par1DataInput, 32); + this.slotsCount = par1DataInput.readByte() & 255; + this.useProvidedWindowTitle = par1DataInput.readBoolean(); + + if (this.inventoryType == 11) + { + this.field_111008_f = par1DataInput.readInt(); + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.windowId & 255); + par1DataOutput.writeByte(this.inventoryType & 255); + writeString(this.windowTitle, par1DataOutput); + par1DataOutput.writeByte(this.slotsCount & 255); + par1DataOutput.writeBoolean(this.useProvidedWindowTitle); + + if (this.inventoryType == 11) + { + par1DataOutput.writeInt(this.field_111008_f); + } + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return this.inventoryType == 11 ? 8 + this.windowTitle.length() : 4 + this.windowTitle.length(); + } +} diff --git a/src/main/java/net/minecraft/src/Packet101CloseWindow.java b/src/main/java/net/minecraft/src/Packet101CloseWindow.java new file mode 100644 index 0000000..4e41aa7 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet101CloseWindow.java @@ -0,0 +1,49 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet101CloseWindow extends Packet +{ + public int windowId; + + public Packet101CloseWindow() {} + + public Packet101CloseWindow(int par1) + { + this.windowId = par1; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleCloseWindow(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.windowId = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.windowId); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 1; + } +} diff --git a/src/main/java/net/minecraft/src/Packet102WindowClick.java b/src/main/java/net/minecraft/src/Packet102WindowClick.java new file mode 100644 index 0000000..14b4a7e --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet102WindowClick.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet102WindowClick extends Packet +{ + /** The id of the window which was clicked. 0 for player inventory. */ + public int window_Id; + + /** The clicked slot (-999 is outside of inventory) */ + public int inventorySlot; + + /** 1 when right-clicking and otherwise 0 */ + public int mouseClick; + + /** A unique number for the action, used for transaction handling */ + public short action; + + /** Item stack for inventory */ + public ItemStack itemStack; + public int holdingShift; + + public Packet102WindowClick() {} + + public Packet102WindowClick(int par1, int par2, int par3, int par4, ItemStack par5ItemStack, short par6) + { + this.window_Id = par1; + this.inventorySlot = par2; + this.mouseClick = par3; + this.itemStack = par5ItemStack != null ? par5ItemStack.copy() : null; + this.action = par6; + this.holdingShift = par4; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleWindowClick(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.window_Id = par1DataInput.readByte(); + this.inventorySlot = par1DataInput.readShort(); + this.mouseClick = par1DataInput.readByte(); + this.action = par1DataInput.readShort(); + this.holdingShift = par1DataInput.readByte(); + this.itemStack = readItemStack(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.window_Id); + par1DataOutput.writeShort(this.inventorySlot); + par1DataOutput.writeByte(this.mouseClick); + par1DataOutput.writeShort(this.action); + par1DataOutput.writeByte(this.holdingShift); + writeItemStack(this.itemStack, par1DataOutput); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 11; + } +} diff --git a/src/main/java/net/minecraft/src/Packet103SetSlot.java b/src/main/java/net/minecraft/src/Packet103SetSlot.java new file mode 100644 index 0000000..9611e33 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet103SetSlot.java @@ -0,0 +1,62 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet103SetSlot extends Packet +{ + /** The window which is being updated. 0 for player inventory */ + public int windowId; + + /** Slot that should be updated */ + public int itemSlot; + + /** Item stack */ + public ItemStack myItemStack; + + public Packet103SetSlot() {} + + public Packet103SetSlot(int par1, int par2, ItemStack par3ItemStack) + { + this.windowId = par1; + this.itemSlot = par2; + this.myItemStack = par3ItemStack == null ? par3ItemStack : par3ItemStack.copy(); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleSetSlot(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.windowId = par1DataInput.readByte(); + this.itemSlot = par1DataInput.readShort(); + this.myItemStack = readItemStack(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.windowId); + par1DataOutput.writeShort(this.itemSlot); + writeItemStack(this.myItemStack, par1DataOutput); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 8; + } +} diff --git a/src/main/java/net/minecraft/src/Packet104WindowItems.java b/src/main/java/net/minecraft/src/Packet104WindowItems.java new file mode 100644 index 0000000..db262f2 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet104WindowItems.java @@ -0,0 +1,76 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.List; + +public class Packet104WindowItems extends Packet +{ + /** + * The id of window which items are being sent for. 0 for player inventory. + */ + public int windowId; + + /** Stack of items */ + public ItemStack[] itemStack; + + public Packet104WindowItems() {} + + public Packet104WindowItems(int par1, List par2List) + { + this.windowId = par1; + this.itemStack = new ItemStack[par2List.size()]; + + for (int var3 = 0; var3 < this.itemStack.length; ++var3) + { + ItemStack var4 = (ItemStack)par2List.get(var3); + this.itemStack[var3] = var4 == null ? null : var4.copy(); + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.windowId = par1DataInput.readByte(); + short var2 = par1DataInput.readShort(); + this.itemStack = new ItemStack[var2]; + + for (int var3 = 0; var3 < var2; ++var3) + { + this.itemStack[var3] = readItemStack(par1DataInput); + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.windowId); + par1DataOutput.writeShort(this.itemStack.length); + + for (int var2 = 0; var2 < this.itemStack.length; ++var2) + { + writeItemStack(this.itemStack[var2], par1DataOutput); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleWindowItems(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 3 + this.itemStack.length * 5; + } +} diff --git a/src/main/java/net/minecraft/src/Packet105UpdateProgressbar.java b/src/main/java/net/minecraft/src/Packet105UpdateProgressbar.java new file mode 100644 index 0000000..79ede17 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet105UpdateProgressbar.java @@ -0,0 +1,68 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet105UpdateProgressbar extends Packet +{ + /** The id of the window that the progress bar is in. */ + public int windowId; + + /** + * Which of the progress bars that should be updated. (For furnaces, 0 = progress arrow, 1 = fire icon) + */ + public int progressBar; + + /** + * The value of the progress bar. The maximum values vary depending on the progress bar. Presumably the values are + * specified as in-game ticks. Some progress bar values increase, while others decrease. For furnaces, 0 is empty, + * full progress arrow = about 180, full fire icon = about 250) + */ + public int progressBarValue; + + public Packet105UpdateProgressbar() {} + + public Packet105UpdateProgressbar(int par1, int par2, int par3) + { + this.windowId = par1; + this.progressBar = par2; + this.progressBarValue = par3; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleUpdateProgressbar(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.windowId = par1DataInput.readByte(); + this.progressBar = par1DataInput.readShort(); + this.progressBarValue = par1DataInput.readShort(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.windowId); + par1DataOutput.writeShort(this.progressBar); + par1DataOutput.writeShort(this.progressBarValue); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 5; + } +} diff --git a/src/main/java/net/minecraft/src/Packet106Transaction.java b/src/main/java/net/minecraft/src/Packet106Transaction.java new file mode 100644 index 0000000..79a4f17 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet106Transaction.java @@ -0,0 +1,58 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet106Transaction extends Packet +{ + /** The id of the window that the action occurred in. */ + public int windowId; + public short shortWindowId; + public boolean accepted; + + public Packet106Transaction() {} + + public Packet106Transaction(int par1, short par2, boolean par3) + { + this.windowId = par1; + this.shortWindowId = par2; + this.accepted = par3; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleTransaction(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.windowId = par1DataInput.readByte(); + this.shortWindowId = par1DataInput.readShort(); + this.accepted = par1DataInput.readByte() != 0; + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.windowId); + par1DataOutput.writeShort(this.shortWindowId); + par1DataOutput.writeByte(this.accepted ? 1 : 0); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 4; + } +} diff --git a/src/main/java/net/minecraft/src/Packet107CreativeSetSlot.java b/src/main/java/net/minecraft/src/Packet107CreativeSetSlot.java new file mode 100644 index 0000000..42c8c77 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet107CreativeSetSlot.java @@ -0,0 +1,53 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet107CreativeSetSlot extends Packet +{ + public int slot; + public ItemStack itemStack; + + public Packet107CreativeSetSlot() {} + + public Packet107CreativeSetSlot(int par1, ItemStack par2ItemStack) + { + this.slot = par1; + this.itemStack = par2ItemStack != null ? par2ItemStack.copy() : null; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleCreativeSetSlot(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.slot = par1DataInput.readShort(); + this.itemStack = readItemStack(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeShort(this.slot); + writeItemStack(this.itemStack, par1DataOutput); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 8; + } +} diff --git a/src/main/java/net/minecraft/src/Packet108EnchantItem.java b/src/main/java/net/minecraft/src/Packet108EnchantItem.java new file mode 100644 index 0000000..6740861 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet108EnchantItem.java @@ -0,0 +1,57 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet108EnchantItem extends Packet +{ + public int windowId; + + /** + * The position of the enchantment on the enchantment table window, starting with 0 as the topmost one. + */ + public int enchantment; + + public Packet108EnchantItem() {} + + public Packet108EnchantItem(int par1, int par2) + { + this.windowId = par1; + this.enchantment = par2; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleEnchantItem(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.windowId = par1DataInput.readByte(); + this.enchantment = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.windowId); + par1DataOutput.writeByte(this.enchantment); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 2; + } +} diff --git a/src/main/java/net/minecraft/src/Packet10Flying.java b/src/main/java/net/minecraft/src/Packet10Flying.java new file mode 100644 index 0000000..4580f35 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet10Flying.java @@ -0,0 +1,91 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet10Flying extends Packet +{ + /** The player's X position. */ + public double xPosition; + + /** The player's Y position. */ + public double yPosition; + + /** The player's Z position. */ + public double zPosition; + + /** The player's stance. (boundingBox.minY) */ + public double stance; + + /** The player's yaw rotation. */ + public float yaw; + + /** The player's pitch rotation. */ + public float pitch; + + /** True if the client is on the ground. */ + public boolean onGround; + + /** Boolean set to true if the player is moving. */ + public boolean moving; + + /** Boolean set to true if the player is rotating. */ + public boolean rotating; + + public Packet10Flying() {} + + public Packet10Flying(boolean par1) + { + this.onGround = par1; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleFlying(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.onGround = par1DataInput.readUnsignedByte() != 0; + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.write(this.onGround ? 1 : 0); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 1; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet11PlayerPosition.java b/src/main/java/net/minecraft/src/Packet11PlayerPosition.java new file mode 100644 index 0000000..5f97988 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet11PlayerPosition.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet11PlayerPosition extends Packet10Flying +{ + public Packet11PlayerPosition() + { + this.moving = true; + } + + public Packet11PlayerPosition(double par1, double par3, double par5, double par7, boolean par9) + { + this.xPosition = par1; + this.yPosition = par3; + this.stance = par5; + this.zPosition = par7; + this.onGround = par9; + this.moving = true; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.xPosition = par1DataInput.readDouble(); + this.yPosition = par1DataInput.readDouble(); + this.stance = par1DataInput.readDouble(); + this.zPosition = par1DataInput.readDouble(); + super.readPacketData(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeDouble(this.xPosition); + par1DataOutput.writeDouble(this.yPosition); + par1DataOutput.writeDouble(this.stance); + par1DataOutput.writeDouble(this.zPosition); + super.writePacketData(par1DataOutput); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 33; + } +} diff --git a/src/main/java/net/minecraft/src/Packet12PlayerLook.java b/src/main/java/net/minecraft/src/Packet12PlayerLook.java new file mode 100644 index 0000000..568d950 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet12PlayerLook.java @@ -0,0 +1,49 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet12PlayerLook extends Packet10Flying +{ + public Packet12PlayerLook() + { + this.rotating = true; + } + + public Packet12PlayerLook(float par1, float par2, boolean par3) + { + this.yaw = par1; + this.pitch = par2; + this.onGround = par3; + this.rotating = true; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.yaw = par1DataInput.readFloat(); + this.pitch = par1DataInput.readFloat(); + super.readPacketData(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeFloat(this.yaw); + par1DataOutput.writeFloat(this.pitch); + super.writePacketData(par1DataOutput); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 9; + } +} diff --git a/src/main/java/net/minecraft/src/Packet130UpdateSign.java b/src/main/java/net/minecraft/src/Packet130UpdateSign.java new file mode 100644 index 0000000..fa34132 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet130UpdateSign.java @@ -0,0 +1,81 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet130UpdateSign extends Packet +{ + public int xPosition; + public int yPosition; + public int zPosition; + public String[] signLines; + + public Packet130UpdateSign() + { + this.isChunkDataPacket = true; + } + + public Packet130UpdateSign(int par1, int par2, int par3, String[] par4ArrayOfStr) + { + this.isChunkDataPacket = true; + this.xPosition = par1; + this.yPosition = par2; + this.zPosition = par3; + this.signLines = new String[] {par4ArrayOfStr[0], par4ArrayOfStr[1], par4ArrayOfStr[2], par4ArrayOfStr[3]}; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.xPosition = par1DataInput.readInt(); + this.yPosition = par1DataInput.readShort(); + this.zPosition = par1DataInput.readInt(); + this.signLines = new String[4]; + + for (int var2 = 0; var2 < 4; ++var2) + { + this.signLines[var2] = readString(par1DataInput, 15); + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.writeShort(this.yPosition); + par1DataOutput.writeInt(this.zPosition); + + for (int var2 = 0; var2 < 4; ++var2) + { + writeString(this.signLines[var2], par1DataOutput); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleUpdateSign(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + int var1 = 0; + + for (int var2 = 0; var2 < 4; ++var2) + { + var1 += this.signLines[var2].length(); + } + + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/Packet131MapData.java b/src/main/java/net/minecraft/src/Packet131MapData.java new file mode 100644 index 0000000..66e0ea1 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet131MapData.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet131MapData extends Packet +{ + public short itemID; + + /** + * Contains a unique ID for the item that this packet will be populating. + */ + public short uniqueID; + + /** + * Contains a buffer of arbitrary data with which to populate an individual item in the world. + */ + public byte[] itemData; + + public Packet131MapData() + { + this.isChunkDataPacket = true; + } + + public Packet131MapData(short par1, short par2, byte[] par3ArrayOfByte) + { + this.isChunkDataPacket = true; + this.itemID = par1; + this.uniqueID = par2; + this.itemData = par3ArrayOfByte; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.itemID = par1DataInput.readShort(); + this.uniqueID = par1DataInput.readShort(); + this.itemData = new byte[par1DataInput.readUnsignedShort()]; + par1DataInput.readFully(this.itemData); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeShort(this.itemID); + par1DataOutput.writeShort(this.uniqueID); + par1DataOutput.writeShort(this.itemData.length); + par1DataOutput.write(this.itemData); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleMapData(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 4 + this.itemData.length; + } +} diff --git a/src/main/java/net/minecraft/src/Packet132TileEntityData.java b/src/main/java/net/minecraft/src/Packet132TileEntityData.java new file mode 100644 index 0000000..03f6b8b --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet132TileEntityData.java @@ -0,0 +1,80 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet132TileEntityData extends Packet +{ + /** The X position of the tile entity to update. */ + public int xPosition; + + /** The Y position of the tile entity to update. */ + public int yPosition; + + /** The Z position of the tile entity to update. */ + public int zPosition; + + /** The type of update to perform on the tile entity. */ + public int actionType; + + /** + * NBT tile entity data. This is NOT related to writeToNBT or readFromNBT. + */ + public NBTTagCompound data; + + public Packet132TileEntityData() + { + this.isChunkDataPacket = true; + } + + public Packet132TileEntityData(int par1, int par2, int par3, int par4, NBTTagCompound par5NBTTagCompound) + { + this.isChunkDataPacket = true; + this.xPosition = par1; + this.yPosition = par2; + this.zPosition = par3; + this.actionType = par4; + this.data = par5NBTTagCompound; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.xPosition = par1DataInput.readInt(); + this.yPosition = par1DataInput.readShort(); + this.zPosition = par1DataInput.readInt(); + this.actionType = par1DataInput.readByte(); + this.data = readNBTTagCompound(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.writeShort(this.yPosition); + par1DataOutput.writeInt(this.zPosition); + par1DataOutput.writeByte((byte)this.actionType); + writeNBTTagCompound(this.data, par1DataOutput); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleTileEntityData(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 25; + } +} diff --git a/src/main/java/net/minecraft/src/Packet133TileEditorOpen.java b/src/main/java/net/minecraft/src/Packet133TileEditorOpen.java new file mode 100644 index 0000000..6c663c5 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet133TileEditorOpen.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet133TileEditorOpen extends Packet +{ + public int field_142037_a; + public int field_142035_b; + public int field_142036_c; + public int field_142034_d; + + public Packet133TileEditorOpen() {} + + public Packet133TileEditorOpen(int par1, int par2, int par3, int par4) + { + this.field_142037_a = par1; + this.field_142035_b = par2; + this.field_142036_c = par3; + this.field_142034_d = par4; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.func_142031_a(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.field_142037_a = par1DataInput.readByte(); + this.field_142035_b = par1DataInput.readInt(); + this.field_142036_c = par1DataInput.readInt(); + this.field_142034_d = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.field_142037_a); + par1DataOutput.writeInt(this.field_142035_b); + par1DataOutput.writeInt(this.field_142036_c); + par1DataOutput.writeInt(this.field_142034_d); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 13; + } +} diff --git a/src/main/java/net/minecraft/src/Packet13PlayerLookMove.java b/src/main/java/net/minecraft/src/Packet13PlayerLookMove.java new file mode 100644 index 0000000..66b99d8 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet13PlayerLookMove.java @@ -0,0 +1,63 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet13PlayerLookMove extends Packet10Flying +{ + public Packet13PlayerLookMove() + { + this.rotating = true; + this.moving = true; + } + + public Packet13PlayerLookMove(double par1, double par3, double par5, double par7, float par9, float par10, boolean par11) + { + this.xPosition = par1; + this.yPosition = par3; + this.stance = par5; + this.zPosition = par7; + this.yaw = par9; + this.pitch = par10; + this.onGround = par11; + this.rotating = true; + this.moving = true; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.xPosition = par1DataInput.readDouble(); + this.yPosition = par1DataInput.readDouble(); + this.stance = par1DataInput.readDouble(); + this.zPosition = par1DataInput.readDouble(); + this.yaw = par1DataInput.readFloat(); + this.pitch = par1DataInput.readFloat(); + super.readPacketData(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeDouble(this.xPosition); + par1DataOutput.writeDouble(this.yPosition); + par1DataOutput.writeDouble(this.stance); + par1DataOutput.writeDouble(this.zPosition); + par1DataOutput.writeFloat(this.yaw); + par1DataOutput.writeFloat(this.pitch); + super.writePacketData(par1DataOutput); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 41; + } +} diff --git a/src/main/java/net/minecraft/src/Packet14BlockDig.java b/src/main/java/net/minecraft/src/Packet14BlockDig.java new file mode 100644 index 0000000..0ff71e0 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet14BlockDig.java @@ -0,0 +1,74 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet14BlockDig extends Packet +{ + /** Block X position. */ + public int xPosition; + + /** Block Y position. */ + public int yPosition; + + /** Block Z position. */ + public int zPosition; + + /** Punched face of the block. */ + public int face; + + /** Status of the digging (started, ongoing, broken). */ + public int status; + + public Packet14BlockDig() {} + + public Packet14BlockDig(int par1, int par2, int par3, int par4, int par5) + { + this.status = par1; + this.xPosition = par2; + this.yPosition = par3; + this.zPosition = par4; + this.face = par5; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.status = par1DataInput.readUnsignedByte(); + this.xPosition = par1DataInput.readInt(); + this.yPosition = par1DataInput.readUnsignedByte(); + this.zPosition = par1DataInput.readInt(); + this.face = par1DataInput.readUnsignedByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.write(this.status); + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.write(this.yPosition); + par1DataOutput.writeInt(this.zPosition); + par1DataOutput.write(this.face); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleBlockDig(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 11; + } +} diff --git a/src/main/java/net/minecraft/src/Packet15Place.java b/src/main/java/net/minecraft/src/Packet15Place.java new file mode 100644 index 0000000..c733166 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet15Place.java @@ -0,0 +1,134 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet15Place extends Packet +{ + private int xPosition; + private int yPosition; + private int zPosition; + + /** The offset to use for block/item placement. */ + private int direction; + private ItemStack itemStack; + + /** The offset from xPosition where the actual click took place */ + private float xOffset; + + /** The offset from yPosition where the actual click took place */ + private float yOffset; + + /** The offset from zPosition where the actual click took place */ + private float zOffset; + + public Packet15Place() {} + + public Packet15Place(int par1, int par2, int par3, int par4, ItemStack par5ItemStack, float par6, float par7, float par8) + { + this.xPosition = par1; + this.yPosition = par2; + this.zPosition = par3; + this.direction = par4; + this.itemStack = par5ItemStack != null ? par5ItemStack.copy() : null; + this.xOffset = par6; + this.yOffset = par7; + this.zOffset = par8; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.xPosition = par1DataInput.readInt(); + this.yPosition = par1DataInput.readUnsignedByte(); + this.zPosition = par1DataInput.readInt(); + this.direction = par1DataInput.readUnsignedByte(); + this.itemStack = readItemStack(par1DataInput); + this.xOffset = (float)par1DataInput.readUnsignedByte() / 16.0F; + this.yOffset = (float)par1DataInput.readUnsignedByte() / 16.0F; + this.zOffset = (float)par1DataInput.readUnsignedByte() / 16.0F; + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.write(this.yPosition); + par1DataOutput.writeInt(this.zPosition); + par1DataOutput.write(this.direction); + writeItemStack(this.itemStack, par1DataOutput); + par1DataOutput.write((int)(this.xOffset * 16.0F)); + par1DataOutput.write((int)(this.yOffset * 16.0F)); + par1DataOutput.write((int)(this.zOffset * 16.0F)); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handlePlace(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 19; + } + + public int getXPosition() + { + return this.xPosition; + } + + public int getYPosition() + { + return this.yPosition; + } + + public int getZPosition() + { + return this.zPosition; + } + + public int getDirection() + { + return this.direction; + } + + public ItemStack getItemStack() + { + return this.itemStack; + } + + /** + * Returns the offset from xPosition where the actual click took place + */ + public float getXOffset() + { + return this.xOffset; + } + + /** + * Returns the offset from yPosition where the actual click took place + */ + public float getYOffset() + { + return this.yOffset; + } + + /** + * Returns the offset from zPosition where the actual click took place + */ + public float getZOffset() + { + return this.zOffset; + } +} diff --git a/src/main/java/net/minecraft/src/Packet16BlockItemSwitch.java b/src/main/java/net/minecraft/src/Packet16BlockItemSwitch.java new file mode 100644 index 0000000..dcd73d7 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet16BlockItemSwitch.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet16BlockItemSwitch extends Packet +{ + /** The block/item id to be equipped. */ + public int id; + + public Packet16BlockItemSwitch() {} + + public Packet16BlockItemSwitch(int par1) + { + this.id = par1; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.id = par1DataInput.readShort(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeShort(this.id); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleBlockItemSwitch(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 2; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet17Sleep.java b/src/main/java/net/minecraft/src/Packet17Sleep.java new file mode 100644 index 0000000..84d03f0 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet17Sleep.java @@ -0,0 +1,65 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet17Sleep extends Packet +{ + public int entityID; + public int bedX; + public int bedY; + public int bedZ; + public int field_73622_e; + + public Packet17Sleep() {} + + public Packet17Sleep(Entity par1Entity, int par2, int par3, int par4, int par5) + { + this.field_73622_e = par2; + this.bedX = par3; + this.bedY = par4; + this.bedZ = par5; + this.entityID = par1Entity.entityId; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityID = par1DataInput.readInt(); + this.field_73622_e = par1DataInput.readByte(); + this.bedX = par1DataInput.readInt(); + this.bedY = par1DataInput.readByte(); + this.bedZ = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityID); + par1DataOutput.writeByte(this.field_73622_e); + par1DataOutput.writeInt(this.bedX); + par1DataOutput.writeByte(this.bedY); + par1DataOutput.writeInt(this.bedZ); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleSleep(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 14; + } +} diff --git a/src/main/java/net/minecraft/src/Packet18Animation.java b/src/main/java/net/minecraft/src/Packet18Animation.java new file mode 100644 index 0000000..c82c07b --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet18Animation.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet18Animation extends Packet +{ + /** The entity ID, in this case it's the player ID. */ + public int entityId; + public int animate; + + public Packet18Animation() {} + + public Packet18Animation(Entity par1Entity, int par2) + { + this.entityId = par1Entity.entityId; + this.animate = par2; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.animate = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeByte(this.animate); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleAnimation(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 5; + } +} diff --git a/src/main/java/net/minecraft/src/Packet19EntityAction.java b/src/main/java/net/minecraft/src/Packet19EntityAction.java new file mode 100644 index 0000000..2b7cbea --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet19EntityAction.java @@ -0,0 +1,68 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet19EntityAction extends Packet +{ + /** Player ID. */ + public int entityId; + + /** + * 1=start sneaking, 2=stop sneaking, 3=wake up, 4=start sprinting, 5=stop sprinting, 6 = horse jump?, 7 = open + * horse GUI + */ + public int action; + public int auxData; + + public Packet19EntityAction() {} + + public Packet19EntityAction(Entity par1Entity, int par2) + { + this(par1Entity, par2, 0); + } + + public Packet19EntityAction(Entity par1Entity, int par2, int par3) + { + this.entityId = par1Entity.entityId; + this.action = par2; + this.auxData = par3; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.action = par1DataInput.readByte(); + this.auxData = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeByte(this.action); + par1DataOutput.writeInt(this.auxData); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleEntityAction(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 9; + } +} diff --git a/src/main/java/net/minecraft/src/Packet1Login.java b/src/main/java/net/minecraft/src/Packet1Login.java new file mode 100644 index 0000000..703103c --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet1Login.java @@ -0,0 +1,108 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet1Login extends Packet +{ + /** The player's entity ID */ + public int clientEntityId; + public WorldType terrainType; + public boolean hardcoreMode; + public EnumGameType gameType; + + /** -1: The Nether, 0: The Overworld, 1: The End */ + public int dimension; + + /** The difficulty setting byte. */ + public byte difficultySetting; + + /** Defaults to 128 */ + public byte worldHeight; + + /** The maximum players. */ + public byte maxPlayers; + + public Packet1Login() {} + + public Packet1Login(int par1, WorldType par2WorldType, EnumGameType par3EnumGameType, boolean par4, int par5, int par6, int par7, int par8) + { + this.clientEntityId = par1; + this.terrainType = par2WorldType; + this.dimension = par5; + this.difficultySetting = (byte)par6; + this.gameType = par3EnumGameType; + this.worldHeight = (byte)par7; + this.maxPlayers = (byte)par8; + this.hardcoreMode = par4; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.clientEntityId = par1DataInput.readInt(); + String var2 = readString(par1DataInput, 16); + this.terrainType = WorldType.parseWorldType(var2); + + if (this.terrainType == null) + { + this.terrainType = WorldType.DEFAULT; + } + + byte var3 = par1DataInput.readByte(); + this.hardcoreMode = (var3 & 8) == 8; + int var4 = var3 & -9; + this.gameType = EnumGameType.getByID(var4); + this.dimension = par1DataInput.readByte(); + this.difficultySetting = par1DataInput.readByte(); + this.worldHeight = par1DataInput.readByte(); + this.maxPlayers = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.clientEntityId); + writeString(this.terrainType == null ? "" : this.terrainType.getWorldTypeName(), par1DataOutput); + int var2 = this.gameType.getID(); + + if (this.hardcoreMode) + { + var2 |= 8; + } + + par1DataOutput.writeByte(var2); + par1DataOutput.writeByte(this.dimension); + par1DataOutput.writeByte(this.difficultySetting); + par1DataOutput.writeByte(this.worldHeight); + par1DataOutput.writeByte(this.maxPlayers); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleLogin(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + int var1 = 0; + + if (this.terrainType != null) + { + var1 = this.terrainType.getWorldTypeName().length(); + } + + return 6 + 2 * var1 + 4 + 4 + 1 + 1 + 1; + } +} diff --git a/src/main/java/net/minecraft/src/Packet200Statistic.java b/src/main/java/net/minecraft/src/Packet200Statistic.java new file mode 100644 index 0000000..28676c4 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet200Statistic.java @@ -0,0 +1,62 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet200Statistic extends Packet +{ + public int statisticId; + public int amount; + + public Packet200Statistic() {} + + public Packet200Statistic(int par1, int par2) + { + this.statisticId = par1; + this.amount = par2; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleStatistic(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.statisticId = par1DataInput.readInt(); + this.amount = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.statisticId); + par1DataOutput.writeInt(this.amount); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 6; + } + + /** + * If this returns true, the packet may be processed on any thread; otherwise it is queued for the main thread to + * handle. + */ + public boolean canProcessAsync() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet201PlayerInfo.java b/src/main/java/net/minecraft/src/Packet201PlayerInfo.java new file mode 100644 index 0000000..218230a --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet201PlayerInfo.java @@ -0,0 +1,60 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet201PlayerInfo extends Packet +{ + /** The player's name. */ + public String playerName; + + /** Byte that tells whether the player is connected. */ + public boolean isConnected; + public int ping; + + public Packet201PlayerInfo() {} + + public Packet201PlayerInfo(String par1Str, boolean par2, int par3) + { + this.playerName = par1Str; + this.isConnected = par2; + this.ping = par3; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.playerName = readString(par1DataInput, 16); + this.isConnected = par1DataInput.readByte() != 0; + this.ping = par1DataInput.readShort(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(this.playerName, par1DataOutput); + par1DataOutput.writeByte(this.isConnected ? 1 : 0); + par1DataOutput.writeShort(this.ping); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handlePlayerInfo(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return this.playerName.length() + 2 + 1 + 2; + } +} diff --git a/src/main/java/net/minecraft/src/Packet202PlayerAbilities.java b/src/main/java/net/minecraft/src/Packet202PlayerAbilities.java new file mode 100644 index 0000000..9ae21ea --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet202PlayerAbilities.java @@ -0,0 +1,187 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet202PlayerAbilities extends Packet +{ + /** Disables player damage. */ + private boolean disableDamage; + + /** Indicates whether the player is flying or not. */ + private boolean isFlying; + + /** Whether or not to allow the player to fly when they double jump. */ + private boolean allowFlying; + + /** + * Used to determine if creative mode is enabled, and therefore if items should be depleted on usage + */ + private boolean isCreativeMode; + private float flySpeed; + private float walkSpeed; + + public Packet202PlayerAbilities() {} + + public Packet202PlayerAbilities(PlayerCapabilities par1PlayerCapabilities) + { + this.setDisableDamage(par1PlayerCapabilities.disableDamage); + this.setFlying(par1PlayerCapabilities.isFlying); + this.setAllowFlying(par1PlayerCapabilities.allowFlying); + this.setCreativeMode(par1PlayerCapabilities.isCreativeMode); + this.setFlySpeed(par1PlayerCapabilities.getFlySpeed()); + this.setWalkSpeed(par1PlayerCapabilities.getWalkSpeed()); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + byte var2 = par1DataInput.readByte(); + this.setDisableDamage((var2 & 1) > 0); + this.setFlying((var2 & 2) > 0); + this.setAllowFlying((var2 & 4) > 0); + this.setCreativeMode((var2 & 8) > 0); + this.setFlySpeed(par1DataInput.readFloat()); + this.setWalkSpeed(par1DataInput.readFloat()); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + byte var2 = 0; + + if (this.getDisableDamage()) + { + var2 = (byte)(var2 | 1); + } + + if (this.getFlying()) + { + var2 = (byte)(var2 | 2); + } + + if (this.getAllowFlying()) + { + var2 = (byte)(var2 | 4); + } + + if (this.isCreativeMode()) + { + var2 = (byte)(var2 | 8); + } + + par1DataOutput.writeByte(var2); + par1DataOutput.writeFloat(this.flySpeed); + par1DataOutput.writeFloat(this.walkSpeed); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handlePlayerAbilities(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 2; + } + + public boolean getDisableDamage() + { + return this.disableDamage; + } + + /** + * Sets whether damage is disabled or not. + */ + public void setDisableDamage(boolean par1) + { + this.disableDamage = par1; + } + + public boolean getFlying() + { + return this.isFlying; + } + + /** + * Sets whether we're currently flying or not. + */ + public void setFlying(boolean par1) + { + this.isFlying = par1; + } + + public boolean getAllowFlying() + { + return this.allowFlying; + } + + public void setAllowFlying(boolean par1) + { + this.allowFlying = par1; + } + + public boolean isCreativeMode() + { + return this.isCreativeMode; + } + + public void setCreativeMode(boolean par1) + { + this.isCreativeMode = par1; + } + + public float getFlySpeed() + { + return this.flySpeed; + } + + /** + * Sets the flying speed. + */ + public void setFlySpeed(float par1) + { + this.flySpeed = par1; + } + + public float getWalkSpeed() + { + return this.walkSpeed; + } + + /** + * Sets the walking speed. + */ + public void setWalkSpeed(float par1) + { + this.walkSpeed = par1; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet203AutoComplete.java b/src/main/java/net/minecraft/src/Packet203AutoComplete.java new file mode 100644 index 0000000..e0bb54a --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet203AutoComplete.java @@ -0,0 +1,75 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet203AutoComplete extends Packet +{ + /** + * Sent by the client containing the text to be autocompleted. Sent by the server with possible completions + * separated by null (two bytes in UTF-16) + */ + private String text; + + public Packet203AutoComplete() {} + + public Packet203AutoComplete(String par1Str) + { + this.text = par1Str; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.text = readString(par1DataInput, 32767); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(org.apache.commons.lang3.StringUtils.substring(this.text, 0, 32767), par1DataOutput); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleAutoComplete(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 2 + this.text.length() * 2; + } + + public String getText() + { + return this.text; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet204ClientInfo.java b/src/main/java/net/minecraft/src/Packet204ClientInfo.java new file mode 100644 index 0000000..5e9e8f5 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet204ClientInfo.java @@ -0,0 +1,116 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet204ClientInfo extends Packet +{ + private String language; + private int renderDistance; + private int chatVisisble; + private boolean chatColours; + private int gameDifficulty; + private boolean showCape; + + public Packet204ClientInfo() {} + + public Packet204ClientInfo(String par1Str, int par2, int par3, boolean par4, int par5, boolean par6) + { + this.language = par1Str; + this.renderDistance = par2; + this.chatVisisble = par3; + this.chatColours = par4; + this.gameDifficulty = par5; + this.showCape = par6; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.language = readString(par1DataInput, 7); + this.renderDistance = par1DataInput.readByte(); + byte var2 = par1DataInput.readByte(); + this.chatVisisble = var2 & 7; + this.chatColours = (var2 & 8) == 8; + this.gameDifficulty = par1DataInput.readByte(); + this.showCape = par1DataInput.readBoolean(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(this.language, par1DataOutput); + par1DataOutput.writeByte(this.renderDistance); + par1DataOutput.writeByte(this.chatVisisble | (this.chatColours ? 1 : 0) << 3); + par1DataOutput.writeByte(this.gameDifficulty); + par1DataOutput.writeBoolean(this.showCape); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleClientInfo(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 7; + } + + public String getLanguage() + { + return this.language; + } + + public int getRenderDistance() + { + return this.renderDistance; + } + + public int getChatVisibility() + { + return this.chatVisisble; + } + + public boolean getChatColours() + { + return this.chatColours; + } + + public int getDifficulty() + { + return this.gameDifficulty; + } + + public boolean getShowCape() + { + return this.showCape; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet205ClientCommand.java b/src/main/java/net/minecraft/src/Packet205ClientCommand.java new file mode 100644 index 0000000..f22a30d --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet205ClientCommand.java @@ -0,0 +1,52 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet205ClientCommand extends Packet +{ + /** + * 0 sent to a netLoginHandler starts the server, 1 sent to NetServerHandler forces a respawn + */ + public int forceRespawn; + + public Packet205ClientCommand() {} + + public Packet205ClientCommand(int par1) + { + this.forceRespawn = par1; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.forceRespawn = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.forceRespawn & 255); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleClientCommand(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 1; + } +} diff --git a/src/main/java/net/minecraft/src/Packet206SetObjective.java b/src/main/java/net/minecraft/src/Packet206SetObjective.java new file mode 100644 index 0000000..02725c1 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet206SetObjective.java @@ -0,0 +1,61 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet206SetObjective extends Packet +{ + public String objectiveName; + public String objectiveDisplayName; + + /** + * 0 to create scoreboard, 1 to remove scoreboard, 2 to update display text. + */ + public int change; + + public Packet206SetObjective() {} + + public Packet206SetObjective(ScoreObjective par1ScoreObjective, int par2) + { + this.objectiveName = par1ScoreObjective.getName(); + this.objectiveDisplayName = par1ScoreObjective.getDisplayName(); + this.change = par2; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.objectiveName = readString(par1DataInput, 16); + this.objectiveDisplayName = readString(par1DataInput, 32); + this.change = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(this.objectiveName, par1DataOutput); + writeString(this.objectiveDisplayName, par1DataOutput); + par1DataOutput.writeByte(this.change); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleSetObjective(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 2 + this.objectiveName.length() + 2 + this.objectiveDisplayName.length() + 1; + } +} diff --git a/src/main/java/net/minecraft/src/Packet207SetScore.java b/src/main/java/net/minecraft/src/Packet207SetScore.java new file mode 100644 index 0000000..7eb598a --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet207SetScore.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet207SetScore extends Packet +{ + /** An unique name to be displayed in the list. */ + public String itemName = ""; + + /** + * The unique name for the scoreboard to be updated. Only sent when updateOrRemove does not equal 1. + */ + public String scoreName = ""; + + /** + * The score to be displayed next to the entry. Only sent when Update/Remove does not equal 1. + */ + public int value; + + /** 0 to create/update an item. 1 to remove an item. */ + public int updateOrRemove; + + public Packet207SetScore() {} + + public Packet207SetScore(Score par1Score, int par2) + { + this.itemName = par1Score.getPlayerName(); + this.scoreName = par1Score.func_96645_d().getName(); + this.value = par1Score.getScorePoints(); + this.updateOrRemove = par2; + } + + public Packet207SetScore(String par1Str) + { + this.itemName = par1Str; + this.scoreName = ""; + this.value = 0; + this.updateOrRemove = 1; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.itemName = readString(par1DataInput, 16); + this.updateOrRemove = par1DataInput.readByte(); + + if (this.updateOrRemove != 1) + { + this.scoreName = readString(par1DataInput, 16); + this.value = par1DataInput.readInt(); + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(this.itemName, par1DataOutput); + par1DataOutput.writeByte(this.updateOrRemove); + + if (this.updateOrRemove != 1) + { + writeString(this.scoreName, par1DataOutput); + par1DataOutput.writeInt(this.value); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleSetScore(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 2 + (this.itemName == null ? 0 : this.itemName.length()) + 2 + (this.scoreName == null ? 0 : this.scoreName.length()) + 4 + 1; + } +} diff --git a/src/main/java/net/minecraft/src/Packet208SetDisplayObjective.java b/src/main/java/net/minecraft/src/Packet208SetDisplayObjective.java new file mode 100644 index 0000000..fb9307b --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet208SetDisplayObjective.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet208SetDisplayObjective extends Packet +{ + /** The position of the scoreboard. 0 = list, 1 = sidebar, 2 = belowName. */ + public int scoreboardPosition; + + /** The unique name for the scoreboard to be displayed. */ + public String scoreName; + + public Packet208SetDisplayObjective() {} + + public Packet208SetDisplayObjective(int par1, ScoreObjective par2ScoreObjective) + { + this.scoreboardPosition = par1; + + if (par2ScoreObjective == null) + { + this.scoreName = ""; + } + else + { + this.scoreName = par2ScoreObjective.getName(); + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.scoreboardPosition = par1DataInput.readByte(); + this.scoreName = readString(par1DataInput, 16); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.scoreboardPosition); + writeString(this.scoreName, par1DataOutput); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleSetDisplayObjective(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 3 + this.scoreName.length(); + } +} diff --git a/src/main/java/net/minecraft/src/Packet209SetPlayerTeam.java b/src/main/java/net/minecraft/src/Packet209SetPlayerTeam.java new file mode 100644 index 0000000..0256a8e --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet209SetPlayerTeam.java @@ -0,0 +1,150 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +public class Packet209SetPlayerTeam extends Packet +{ + /** A unique name for the team. */ + public String teamName = ""; + + /** Only if mode = 0 or 2. */ + public String teamDisplayName = ""; + + /** + * Only if mode = 0 or 2. Displayed before the players' name that are part of this team. + */ + public String teamPrefix = ""; + + /** + * Only if mode = 0 or 2. Displayed after the players' name that are part of this team. + */ + public String teamSuffix = ""; + + /** Only if mode = 0 or 3 or 4. Players to be added/remove from the team. */ + public Collection playerNames = new ArrayList(); + + /** + * If 0 then the team is created. If 1 then the team is removed. If 2 the team team information is updated. If 3 + * then new players are added to the team. If 4 then players are removed from the team. + */ + public int mode; + + /** Only if mode = 0 or 2. */ + public int friendlyFire; + + public Packet209SetPlayerTeam() {} + + public Packet209SetPlayerTeam(ScorePlayerTeam par1ScorePlayerTeam, int par2) + { + this.teamName = par1ScorePlayerTeam.func_96661_b(); + this.mode = par2; + + if (par2 == 0 || par2 == 2) + { + this.teamDisplayName = par1ScorePlayerTeam.func_96669_c(); + this.teamPrefix = par1ScorePlayerTeam.getColorPrefix(); + this.teamSuffix = par1ScorePlayerTeam.getColorSuffix(); + this.friendlyFire = par1ScorePlayerTeam.func_98299_i(); + } + + if (par2 == 0) + { + this.playerNames.addAll(par1ScorePlayerTeam.getMembershipCollection()); + } + } + + public Packet209SetPlayerTeam(ScorePlayerTeam par1ScorePlayerTeam, Collection par2Collection, int par3) + { + if (par3 != 3 && par3 != 4) + { + throw new IllegalArgumentException("Method must be join or leave for player constructor"); + } + else if (par2Collection != null && !par2Collection.isEmpty()) + { + this.mode = par3; + this.teamName = par1ScorePlayerTeam.func_96661_b(); + this.playerNames.addAll(par2Collection); + } + else + { + throw new IllegalArgumentException("Players cannot be null/empty"); + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.teamName = readString(par1DataInput, 16); + this.mode = par1DataInput.readByte(); + + if (this.mode == 0 || this.mode == 2) + { + this.teamDisplayName = readString(par1DataInput, 32); + this.teamPrefix = readString(par1DataInput, 16); + this.teamSuffix = readString(par1DataInput, 16); + this.friendlyFire = par1DataInput.readByte(); + } + + if (this.mode == 0 || this.mode == 3 || this.mode == 4) + { + short var2 = par1DataInput.readShort(); + + for (int var3 = 0; var3 < var2; ++var3) + { + this.playerNames.add(readString(par1DataInput, 16)); + } + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(this.teamName, par1DataOutput); + par1DataOutput.writeByte(this.mode); + + if (this.mode == 0 || this.mode == 2) + { + writeString(this.teamDisplayName, par1DataOutput); + writeString(this.teamPrefix, par1DataOutput); + writeString(this.teamSuffix, par1DataOutput); + par1DataOutput.writeByte(this.friendlyFire); + } + + if (this.mode == 0 || this.mode == 3 || this.mode == 4) + { + par1DataOutput.writeShort(this.playerNames.size()); + Iterator var2 = this.playerNames.iterator(); + + while (var2.hasNext()) + { + String var3 = (String)var2.next(); + writeString(var3, par1DataOutput); + } + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleSetPlayerTeam(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 3 + this.teamName.length(); + } +} diff --git a/src/main/java/net/minecraft/src/Packet20NamedEntitySpawn.java b/src/main/java/net/minecraft/src/Packet20NamedEntitySpawn.java new file mode 100644 index 0000000..d2a0f80 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet20NamedEntitySpawn.java @@ -0,0 +1,109 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.List; + +public class Packet20NamedEntitySpawn extends Packet +{ + /** The entity ID, in this case it's the player ID. */ + public int entityId; + + /** The player's name. */ + public String name; + + /** The player's X position. */ + public int xPosition; + + /** The player's Y position. */ + public int yPosition; + + /** The player's Z position. */ + public int zPosition; + + /** The player's rotation. */ + public byte rotation; + + /** The player's pitch. */ + public byte pitch; + + /** The current item the player is holding. */ + public int currentItem; + private DataWatcher metadata; + private List metadataWatchableObjects; + + public Packet20NamedEntitySpawn() {} + + public Packet20NamedEntitySpawn(EntityPlayer par1EntityPlayer) + { + this.entityId = par1EntityPlayer.entityId; + this.name = par1EntityPlayer.getCommandSenderName(); + this.xPosition = MathHelper.floor_double(par1EntityPlayer.posX * 32.0D); + this.yPosition = MathHelper.floor_double(par1EntityPlayer.posY * 32.0D); + this.zPosition = MathHelper.floor_double(par1EntityPlayer.posZ * 32.0D); + this.rotation = (byte)((int)(par1EntityPlayer.rotationYaw * 256.0F / 360.0F)); + this.pitch = (byte)((int)(par1EntityPlayer.rotationPitch * 256.0F / 360.0F)); + ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); + this.currentItem = var2 == null ? 0 : var2.itemID; + this.metadata = par1EntityPlayer.getDataWatcher(); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.name = readString(par1DataInput, 16); + this.xPosition = par1DataInput.readInt(); + this.yPosition = par1DataInput.readInt(); + this.zPosition = par1DataInput.readInt(); + this.rotation = par1DataInput.readByte(); + this.pitch = par1DataInput.readByte(); + this.currentItem = par1DataInput.readShort(); + this.metadataWatchableObjects = DataWatcher.readWatchableObjects(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + writeString(this.name, par1DataOutput); + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.writeInt(this.yPosition); + par1DataOutput.writeInt(this.zPosition); + par1DataOutput.writeByte(this.rotation); + par1DataOutput.writeByte(this.pitch); + par1DataOutput.writeShort(this.currentItem); + this.metadata.writeWatchableObjects(par1DataOutput); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleNamedEntitySpawn(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 28; + } + + public List getWatchedMetadata() + { + if (this.metadataWatchableObjects == null) + { + this.metadataWatchableObjects = this.metadata.getAllWatched(); + } + + return this.metadataWatchableObjects; + } +} diff --git a/src/main/java/net/minecraft/src/Packet22Collect.java b/src/main/java/net/minecraft/src/Packet22Collect.java new file mode 100644 index 0000000..1d4a946 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet22Collect.java @@ -0,0 +1,56 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet22Collect extends Packet +{ + /** The entity on the ground that was picked up. */ + public int collectedEntityId; + + /** The entity that picked up the one from the ground. */ + public int collectorEntityId; + + public Packet22Collect() {} + + public Packet22Collect(int par1, int par2) + { + this.collectedEntityId = par1; + this.collectorEntityId = par2; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.collectedEntityId = par1DataInput.readInt(); + this.collectorEntityId = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.collectedEntityId); + par1DataOutput.writeInt(this.collectorEntityId); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleCollect(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 8; + } +} diff --git a/src/main/java/net/minecraft/src/Packet23VehicleSpawn.java b/src/main/java/net/minecraft/src/Packet23VehicleSpawn.java new file mode 100644 index 0000000..97c3395 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet23VehicleSpawn.java @@ -0,0 +1,168 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet23VehicleSpawn extends Packet +{ + /** Entity ID of the object. */ + public int entityId; + + /** The X position of the object. */ + public int xPosition; + + /** The Y position of the object. */ + public int yPosition; + + /** The Z position of the object. */ + public int zPosition; + + /** + * Not sent if the thrower entity ID is 0. The speed of this fireball along the X axis. + */ + public int speedX; + + /** + * Not sent if the thrower entity ID is 0. The speed of this fireball along the Y axis. + */ + public int speedY; + + /** + * Not sent if the thrower entity ID is 0. The speed of this fireball along the Z axis. + */ + public int speedZ; + + /** The pitch in steps of 2p/256 */ + public int pitch; + + /** The yaw in steps of 2p/256 */ + public int yaw; + + /** The type of object. */ + public int type; + + /** 0 if not a fireball. Otherwise, this is the Entity ID of the thrower. */ + public int throwerEntityId; + + public Packet23VehicleSpawn() {} + + public Packet23VehicleSpawn(Entity par1Entity, int par2) + { + this(par1Entity, par2, 0); + } + + public Packet23VehicleSpawn(Entity par1Entity, int par2, int par3) + { + this.entityId = par1Entity.entityId; + this.xPosition = MathHelper.floor_double(par1Entity.posX * 32.0D); + this.yPosition = MathHelper.floor_double(par1Entity.posY * 32.0D); + this.zPosition = MathHelper.floor_double(par1Entity.posZ * 32.0D); + this.pitch = MathHelper.floor_float(par1Entity.rotationPitch * 256.0F / 360.0F); + this.yaw = MathHelper.floor_float(par1Entity.rotationYaw * 256.0F / 360.0F); + this.type = par2; + this.throwerEntityId = par3; + + if (par3 > 0) + { + double var4 = par1Entity.motionX; + double var6 = par1Entity.motionY; + double var8 = par1Entity.motionZ; + double var10 = 3.9D; + + if (var4 < -var10) + { + var4 = -var10; + } + + if (var6 < -var10) + { + var6 = -var10; + } + + if (var8 < -var10) + { + var8 = -var10; + } + + if (var4 > var10) + { + var4 = var10; + } + + if (var6 > var10) + { + var6 = var10; + } + + if (var8 > var10) + { + var8 = var10; + } + + this.speedX = (int)(var4 * 8000.0D); + this.speedY = (int)(var6 * 8000.0D); + this.speedZ = (int)(var8 * 8000.0D); + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.type = par1DataInput.readByte(); + this.xPosition = par1DataInput.readInt(); + this.yPosition = par1DataInput.readInt(); + this.zPosition = par1DataInput.readInt(); + this.pitch = par1DataInput.readByte(); + this.yaw = par1DataInput.readByte(); + this.throwerEntityId = par1DataInput.readInt(); + + if (this.throwerEntityId > 0) + { + this.speedX = par1DataInput.readShort(); + this.speedY = par1DataInput.readShort(); + this.speedZ = par1DataInput.readShort(); + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeByte(this.type); + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.writeInt(this.yPosition); + par1DataOutput.writeInt(this.zPosition); + par1DataOutput.writeByte(this.pitch); + par1DataOutput.writeByte(this.yaw); + par1DataOutput.writeInt(this.throwerEntityId); + + if (this.throwerEntityId > 0) + { + par1DataOutput.writeShort(this.speedX); + par1DataOutput.writeShort(this.speedY); + par1DataOutput.writeShort(this.speedZ); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleVehicleSpawn(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 21 + this.throwerEntityId > 0 ? 6 : 0; + } +} diff --git a/src/main/java/net/minecraft/src/Packet24MobSpawn.java b/src/main/java/net/minecraft/src/Packet24MobSpawn.java new file mode 100644 index 0000000..3620a92 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet24MobSpawn.java @@ -0,0 +1,157 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.List; + +public class Packet24MobSpawn extends Packet +{ + /** The entity ID. */ + public int entityId; + + /** The type of mob. */ + public int type; + + /** The X position of the entity. */ + public int xPosition; + + /** The Y position of the entity. */ + public int yPosition; + + /** The Z position of the entity. */ + public int zPosition; + public int velocityX; + public int velocityY; + public int velocityZ; + + /** The yaw of the entity. */ + public byte yaw; + + /** The pitch of the entity. */ + public byte pitch; + + /** The yaw of the entity's head. */ + public byte headYaw; + + /** Indexed metadata for Mob, terminated by 0x7F */ + private DataWatcher metaData; + private List metadata; + + public Packet24MobSpawn() {} + + public Packet24MobSpawn(EntityLivingBase par1EntityLivingBase) + { + this.entityId = par1EntityLivingBase.entityId; + this.type = (byte)EntityList.getEntityID(par1EntityLivingBase); + this.xPosition = par1EntityLivingBase.myEntitySize.multiplyBy32AndRound(par1EntityLivingBase.posX); + this.yPosition = MathHelper.floor_double(par1EntityLivingBase.posY * 32.0D); + this.zPosition = par1EntityLivingBase.myEntitySize.multiplyBy32AndRound(par1EntityLivingBase.posZ); + this.yaw = (byte)((int)(par1EntityLivingBase.rotationYaw * 256.0F / 360.0F)); + this.pitch = (byte)((int)(par1EntityLivingBase.rotationPitch * 256.0F / 360.0F)); + this.headYaw = (byte)((int)(par1EntityLivingBase.rotationYawHead * 256.0F / 360.0F)); + double var2 = 3.9D; + double var4 = par1EntityLivingBase.motionX; + double var6 = par1EntityLivingBase.motionY; + double var8 = par1EntityLivingBase.motionZ; + + if (var4 < -var2) + { + var4 = -var2; + } + + if (var6 < -var2) + { + var6 = -var2; + } + + if (var8 < -var2) + { + var8 = -var2; + } + + if (var4 > var2) + { + var4 = var2; + } + + if (var6 > var2) + { + var6 = var2; + } + + if (var8 > var2) + { + var8 = var2; + } + + this.velocityX = (int)(var4 * 8000.0D); + this.velocityY = (int)(var6 * 8000.0D); + this.velocityZ = (int)(var8 * 8000.0D); + this.metaData = par1EntityLivingBase.getDataWatcher(); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.type = par1DataInput.readByte() & 255; + this.xPosition = par1DataInput.readInt(); + this.yPosition = par1DataInput.readInt(); + this.zPosition = par1DataInput.readInt(); + this.yaw = par1DataInput.readByte(); + this.pitch = par1DataInput.readByte(); + this.headYaw = par1DataInput.readByte(); + this.velocityX = par1DataInput.readShort(); + this.velocityY = par1DataInput.readShort(); + this.velocityZ = par1DataInput.readShort(); + this.metadata = DataWatcher.readWatchableObjects(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeByte(this.type & 255); + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.writeInt(this.yPosition); + par1DataOutput.writeInt(this.zPosition); + par1DataOutput.writeByte(this.yaw); + par1DataOutput.writeByte(this.pitch); + par1DataOutput.writeByte(this.headYaw); + par1DataOutput.writeShort(this.velocityX); + par1DataOutput.writeShort(this.velocityY); + par1DataOutput.writeShort(this.velocityZ); + this.metaData.writeWatchableObjects(par1DataOutput); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleMobSpawn(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 26; + } + + public List getMetadata() + { + if (this.metadata == null) + { + this.metadata = this.metaData.getAllWatched(); + } + + return this.metadata; + } +} diff --git a/src/main/java/net/minecraft/src/Packet250CustomPayload.java b/src/main/java/net/minecraft/src/Packet250CustomPayload.java new file mode 100644 index 0000000..e24f576 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet250CustomPayload.java @@ -0,0 +1,80 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet250CustomPayload extends Packet +{ + /** Name of the 'channel' used to send data */ + public String channel; + + /** Length of the data to be read */ + public int length; + + /** Any data */ + public byte[] data; + + public Packet250CustomPayload() {} + + public Packet250CustomPayload(String par1Str, byte[] par2ArrayOfByte) + { + this.channel = par1Str; + this.data = par2ArrayOfByte; + + if (par2ArrayOfByte != null) + { + this.length = par2ArrayOfByte.length; + + if (this.length > 32767) + { + throw new IllegalArgumentException("Payload may not be larger than 32k"); + } + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.channel = readString(par1DataInput, 20); + this.length = par1DataInput.readShort(); + + if (this.length > 0 && this.length < 32767) + { + this.data = new byte[this.length]; + par1DataInput.readFully(this.data); + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(this.channel, par1DataOutput); + par1DataOutput.writeShort((short)this.length); + + if (this.data != null) + { + par1DataOutput.write(this.data); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleCustomPayload(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 2 + this.channel.length() * 2 + 2 + this.length; + } +} diff --git a/src/main/java/net/minecraft/src/Packet252SharedKey.java b/src/main/java/net/minecraft/src/Packet252SharedKey.java new file mode 100644 index 0000000..60979ec --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet252SharedKey.java @@ -0,0 +1,86 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.security.PrivateKey; +import java.security.PublicKey; +import javax.crypto.SecretKey; + +public class Packet252SharedKey extends Packet +{ + private byte[] sharedSecret = new byte[0]; + private byte[] verifyToken = new byte[0]; + + /** + * Secret AES key decrypted from sharedSecret via the server's private RSA key + */ + private SecretKey sharedKey; + + public Packet252SharedKey() {} + + public Packet252SharedKey(SecretKey par1SecretKey, PublicKey par2PublicKey, byte[] par3ArrayOfByte) + { + this.sharedKey = par1SecretKey; + this.sharedSecret = CryptManager.encryptData(par2PublicKey, par1SecretKey.getEncoded()); + this.verifyToken = CryptManager.encryptData(par2PublicKey, par3ArrayOfByte); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.sharedSecret = readBytesFromStream(par1DataInput); + this.verifyToken = readBytesFromStream(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeByteArray(par1DataOutput, this.sharedSecret); + writeByteArray(par1DataOutput, this.verifyToken); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleSharedKey(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 2 + this.sharedSecret.length + 2 + this.verifyToken.length; + } + + /** + * Return secretKey, decrypting it from the sharedSecret byte array if needed + */ + public SecretKey getSharedKey(PrivateKey par1PrivateKey) + { + return par1PrivateKey == null ? this.sharedKey : (this.sharedKey = CryptManager.decryptSharedKey(par1PrivateKey, this.sharedSecret)); + } + + /** + * Return the secret AES sharedKey (used by client only) + */ + public SecretKey getSharedKey() + { + return this.getSharedKey((PrivateKey)null); + } + + /** + * Return verifyToken + */ + public byte[] getVerifyToken(PrivateKey par1PrivateKey) + { + return par1PrivateKey == null ? this.verifyToken : CryptManager.decryptData(par1PrivateKey, this.verifyToken); + } +} diff --git a/src/main/java/net/minecraft/src/Packet253ServerAuthData.java b/src/main/java/net/minecraft/src/Packet253ServerAuthData.java new file mode 100644 index 0000000..48020c3 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet253ServerAuthData.java @@ -0,0 +1,73 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.security.PublicKey; + +public class Packet253ServerAuthData extends Packet +{ + private String serverId; + private PublicKey publicKey; + private byte[] verifyToken = new byte[0]; + + public Packet253ServerAuthData() {} + + public Packet253ServerAuthData(String par1Str, PublicKey par2PublicKey, byte[] par3ArrayOfByte) + { + this.serverId = par1Str; + this.publicKey = par2PublicKey; + this.verifyToken = par3ArrayOfByte; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.serverId = readString(par1DataInput, 20); + this.publicKey = CryptManager.decodePublicKey(readBytesFromStream(par1DataInput)); + this.verifyToken = readBytesFromStream(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(this.serverId, par1DataOutput); + writeByteArray(par1DataOutput, this.publicKey.getEncoded()); + writeByteArray(par1DataOutput, this.verifyToken); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleServerAuthData(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 2 + this.serverId.length() * 2 + 2 + this.publicKey.getEncoded().length + 2 + this.verifyToken.length; + } + + public String getServerId() + { + return this.serverId; + } + + public PublicKey getPublicKey() + { + return this.publicKey; + } + + public byte[] getVerifyToken() + { + return this.verifyToken; + } +} diff --git a/src/main/java/net/minecraft/src/Packet254ServerPing.java b/src/main/java/net/minecraft/src/Packet254ServerPing.java new file mode 100644 index 0000000..4c601d8 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet254ServerPing.java @@ -0,0 +1,93 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet254ServerPing extends Packet +{ + private static final int field_140051_d = (new Packet250CustomPayload()).getPacketId(); + + /** Always 1, unless readByte threw an exception. */ + public int readSuccessfully; + public String field_140052_b; + public int field_140053_c; + + public Packet254ServerPing() {} + + public Packet254ServerPing(int par1, String par2Str, int par3) + { + this.readSuccessfully = par1; + this.field_140052_b = par2Str; + this.field_140053_c = par3; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + try + { + this.readSuccessfully = par1DataInput.readByte(); + + try + { + par1DataInput.readByte(); + readString(par1DataInput, 255); + par1DataInput.readShort(); + this.readSuccessfully = par1DataInput.readByte(); + + if (this.readSuccessfully >= 73) + { + this.field_140052_b = readString(par1DataInput, 255); + this.field_140053_c = par1DataInput.readInt(); + } + } + catch (Throwable var3) + { + this.field_140052_b = ""; + } + } + catch (Throwable var4) + { + this.readSuccessfully = 0; + this.field_140052_b = ""; + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(1); + par1DataOutput.writeByte(field_140051_d); + Packet.writeString("MC|PingHost", par1DataOutput); + par1DataOutput.writeShort(3 + 2 * this.field_140052_b.length() + 4); + par1DataOutput.writeByte(this.readSuccessfully); + Packet.writeString(this.field_140052_b, par1DataOutput); + par1DataOutput.writeInt(this.field_140053_c); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleServerPing(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 3 + this.field_140052_b.length() * 2 + 4; + } + + public boolean func_140050_d() + { + return this.readSuccessfully == 0; + } +} diff --git a/src/main/java/net/minecraft/src/Packet255KickDisconnect.java b/src/main/java/net/minecraft/src/Packet255KickDisconnect.java new file mode 100644 index 0000000..80f791a --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet255KickDisconnect.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet255KickDisconnect extends Packet +{ + /** Displayed to the client when the connection terminates. */ + public String reason; + + public Packet255KickDisconnect() {} + + public Packet255KickDisconnect(String par1Str) + { + this.reason = par1Str; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.reason = readString(par1DataInput, 256); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(this.reason, par1DataOutput); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleKickDisconnect(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return this.reason.length(); + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet25EntityPainting.java b/src/main/java/net/minecraft/src/Packet25EntityPainting.java new file mode 100644 index 0000000..915006c --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet25EntityPainting.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet25EntityPainting extends Packet +{ + public int entityId; + public int xPosition; + public int yPosition; + public int zPosition; + public int direction; + public String title; + + public Packet25EntityPainting() {} + + public Packet25EntityPainting(EntityPainting par1EntityPainting) + { + this.entityId = par1EntityPainting.entityId; + this.xPosition = par1EntityPainting.xPosition; + this.yPosition = par1EntityPainting.yPosition; + this.zPosition = par1EntityPainting.zPosition; + this.direction = par1EntityPainting.hangingDirection; + this.title = par1EntityPainting.art.title; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.title = readString(par1DataInput, EnumArt.maxArtTitleLength); + this.xPosition = par1DataInput.readInt(); + this.yPosition = par1DataInput.readInt(); + this.zPosition = par1DataInput.readInt(); + this.direction = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + writeString(this.title, par1DataOutput); + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.writeInt(this.yPosition); + par1DataOutput.writeInt(this.zPosition); + par1DataOutput.writeInt(this.direction); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleEntityPainting(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 24; + } +} diff --git a/src/main/java/net/minecraft/src/Packet26EntityExpOrb.java b/src/main/java/net/minecraft/src/Packet26EntityExpOrb.java new file mode 100644 index 0000000..9714666 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet26EntityExpOrb.java @@ -0,0 +1,68 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet26EntityExpOrb extends Packet +{ + /** Entity ID for the XP Orb */ + public int entityId; + public int posX; + public int posY; + public int posZ; + + /** The Orbs Experience points value. */ + public int xpValue; + + public Packet26EntityExpOrb() {} + + public Packet26EntityExpOrb(EntityXPOrb par1EntityXPOrb) + { + this.entityId = par1EntityXPOrb.entityId; + this.posX = MathHelper.floor_double(par1EntityXPOrb.posX * 32.0D); + this.posY = MathHelper.floor_double(par1EntityXPOrb.posY * 32.0D); + this.posZ = MathHelper.floor_double(par1EntityXPOrb.posZ * 32.0D); + this.xpValue = par1EntityXPOrb.getXpValue(); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.posX = par1DataInput.readInt(); + this.posY = par1DataInput.readInt(); + this.posZ = par1DataInput.readInt(); + this.xpValue = par1DataInput.readShort(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeInt(this.posX); + par1DataOutput.writeInt(this.posY); + par1DataOutput.writeInt(this.posZ); + par1DataOutput.writeShort(this.xpValue); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleEntityExpOrb(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 18; + } +} diff --git a/src/main/java/net/minecraft/src/Packet27PlayerInput.java b/src/main/java/net/minecraft/src/Packet27PlayerInput.java new file mode 100644 index 0000000..038cf1b --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet27PlayerInput.java @@ -0,0 +1,81 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet27PlayerInput extends Packet +{ + private float field_111017_a; + private float field_111015_b; + private boolean field_111016_c; + private boolean field_111014_d; + + public Packet27PlayerInput() {} + + public Packet27PlayerInput(float par1, float par2, boolean par3, boolean par4) + { + this.field_111017_a = par1; + this.field_111015_b = par2; + this.field_111016_c = par3; + this.field_111014_d = par4; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.field_111017_a = par1DataInput.readFloat(); + this.field_111015_b = par1DataInput.readFloat(); + this.field_111016_c = par1DataInput.readBoolean(); + this.field_111014_d = par1DataInput.readBoolean(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeFloat(this.field_111017_a); + par1DataOutput.writeFloat(this.field_111015_b); + par1DataOutput.writeBoolean(this.field_111016_c); + par1DataOutput.writeBoolean(this.field_111014_d); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.func_110774_a(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 10; + } + + public float func_111010_d() + { + return this.field_111017_a; + } + + public float func_111012_f() + { + return this.field_111015_b; + } + + public boolean func_111013_g() + { + return this.field_111016_c; + } + + public boolean func_111011_h() + { + return this.field_111014_d; + } +} diff --git a/src/main/java/net/minecraft/src/Packet28EntityVelocity.java b/src/main/java/net/minecraft/src/Packet28EntityVelocity.java new file mode 100644 index 0000000..edcc2d0 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet28EntityVelocity.java @@ -0,0 +1,116 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet28EntityVelocity extends Packet +{ + public int entityId; + public int motionX; + public int motionY; + public int motionZ; + + public Packet28EntityVelocity() {} + + public Packet28EntityVelocity(Entity par1Entity) + { + this(par1Entity.entityId, par1Entity.motionX, par1Entity.motionY, par1Entity.motionZ); + } + + public Packet28EntityVelocity(int par1, double par2, double par4, double par6) + { + this.entityId = par1; + double var8 = 3.9D; + + if (par2 < -var8) + { + par2 = -var8; + } + + if (par4 < -var8) + { + par4 = -var8; + } + + if (par6 < -var8) + { + par6 = -var8; + } + + if (par2 > var8) + { + par2 = var8; + } + + if (par4 > var8) + { + par4 = var8; + } + + if (par6 > var8) + { + par6 = var8; + } + + this.motionX = (int)(par2 * 8000.0D); + this.motionY = (int)(par4 * 8000.0D); + this.motionZ = (int)(par6 * 8000.0D); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.motionX = par1DataInput.readShort(); + this.motionY = par1DataInput.readShort(); + this.motionZ = par1DataInput.readShort(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeShort(this.motionX); + par1DataOutput.writeShort(this.motionY); + par1DataOutput.writeShort(this.motionZ); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleEntityVelocity(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 10; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + Packet28EntityVelocity var2 = (Packet28EntityVelocity)par1Packet; + return var2.entityId == this.entityId; + } +} diff --git a/src/main/java/net/minecraft/src/Packet29DestroyEntity.java b/src/main/java/net/minecraft/src/Packet29DestroyEntity.java new file mode 100644 index 0000000..ff27c81 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet29DestroyEntity.java @@ -0,0 +1,60 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet29DestroyEntity extends Packet +{ + /** ID of the entity to be destroyed on the client. */ + public int[] entityId; + + public Packet29DestroyEntity() {} + + public Packet29DestroyEntity(int ... par1ArrayOfInteger) + { + this.entityId = par1ArrayOfInteger; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = new int[par1DataInput.readByte()]; + + for (int var2 = 0; var2 < this.entityId.length; ++var2) + { + this.entityId[var2] = par1DataInput.readInt(); + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.entityId.length); + + for (int var2 = 0; var2 < this.entityId.length; ++var2) + { + par1DataOutput.writeInt(this.entityId[var2]); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleDestroyEntity(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 1 + this.entityId.length * 4; + } +} diff --git a/src/main/java/net/minecraft/src/Packet2ClientProtocol.java b/src/main/java/net/minecraft/src/Packet2ClientProtocol.java new file mode 100644 index 0000000..5f86bea --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet2ClientProtocol.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet2ClientProtocol extends Packet +{ + private int protocolVersion; + private String username; + private String serverHost; + private int serverPort; + + public Packet2ClientProtocol() {} + + public Packet2ClientProtocol(int par1, String par2Str, String par3Str, int par4) + { + this.protocolVersion = par1; + this.username = par2Str; + this.serverHost = par3Str; + this.serverPort = par4; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.protocolVersion = par1DataInput.readByte(); + this.username = readString(par1DataInput, 16); + this.serverHost = readString(par1DataInput, 255); + this.serverPort = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.protocolVersion); + writeString(this.username, par1DataOutput); + writeString(this.serverHost, par1DataOutput); + par1DataOutput.writeInt(this.serverPort); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleClientProtocol(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 3 + 2 * this.username.length(); + } + + /** + * Returns the protocol version. + */ + public int getProtocolVersion() + { + return this.protocolVersion; + } + + /** + * Returns the username. + */ + public String getUsername() + { + return this.username; + } +} diff --git a/src/main/java/net/minecraft/src/Packet30Entity.java b/src/main/java/net/minecraft/src/Packet30Entity.java new file mode 100644 index 0000000..b810844 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet30Entity.java @@ -0,0 +1,91 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet30Entity extends Packet +{ + /** The ID of this entity. */ + public int entityId; + + /** The X axis relative movement. */ + public byte xPosition; + + /** The Y axis relative movement. */ + public byte yPosition; + + /** The Z axis relative movement. */ + public byte zPosition; + + /** The X axis rotation. */ + public byte yaw; + + /** The Y axis rotation. */ + public byte pitch; + + /** Boolean set to true if the entity is rotating. */ + public boolean rotating; + + public Packet30Entity() {} + + public Packet30Entity(int par1) + { + this.entityId = par1; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleEntity(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 4; + } + + public String toString() + { + return "Entity_" + super.toString(); + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + Packet30Entity var2 = (Packet30Entity)par1Packet; + return var2.entityId == this.entityId; + } +} diff --git a/src/main/java/net/minecraft/src/Packet31RelEntityMove.java b/src/main/java/net/minecraft/src/Packet31RelEntityMove.java new file mode 100644 index 0000000..819038e --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet31RelEntityMove.java @@ -0,0 +1,48 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet31RelEntityMove extends Packet30Entity +{ + public Packet31RelEntityMove() {} + + public Packet31RelEntityMove(int par1, byte par2, byte par3, byte par4) + { + super(par1); + this.xPosition = par2; + this.yPosition = par3; + this.zPosition = par4; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + super.readPacketData(par1DataInput); + this.xPosition = par1DataInput.readByte(); + this.yPosition = par1DataInput.readByte(); + this.zPosition = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + super.writePacketData(par1DataOutput); + par1DataOutput.writeByte(this.xPosition); + par1DataOutput.writeByte(this.yPosition); + par1DataOutput.writeByte(this.zPosition); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 7; + } +} diff --git a/src/main/java/net/minecraft/src/Packet32EntityLook.java b/src/main/java/net/minecraft/src/Packet32EntityLook.java new file mode 100644 index 0000000..17d490c --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet32EntityLook.java @@ -0,0 +1,49 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet32EntityLook extends Packet30Entity +{ + public Packet32EntityLook() + { + this.rotating = true; + } + + public Packet32EntityLook(int par1, byte par2, byte par3) + { + super(par1); + this.yaw = par2; + this.pitch = par3; + this.rotating = true; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + super.readPacketData(par1DataInput); + this.yaw = par1DataInput.readByte(); + this.pitch = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + super.writePacketData(par1DataOutput); + par1DataOutput.writeByte(this.yaw); + par1DataOutput.writeByte(this.pitch); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 6; + } +} diff --git a/src/main/java/net/minecraft/src/Packet33RelEntityMoveLook.java b/src/main/java/net/minecraft/src/Packet33RelEntityMoveLook.java new file mode 100644 index 0000000..d2eaae2 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet33RelEntityMoveLook.java @@ -0,0 +1,58 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet33RelEntityMoveLook extends Packet30Entity +{ + public Packet33RelEntityMoveLook() + { + this.rotating = true; + } + + public Packet33RelEntityMoveLook(int par1, byte par2, byte par3, byte par4, byte par5, byte par6) + { + super(par1); + this.xPosition = par2; + this.yPosition = par3; + this.zPosition = par4; + this.yaw = par5; + this.pitch = par6; + this.rotating = true; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + super.readPacketData(par1DataInput); + this.xPosition = par1DataInput.readByte(); + this.yPosition = par1DataInput.readByte(); + this.zPosition = par1DataInput.readByte(); + this.yaw = par1DataInput.readByte(); + this.pitch = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + super.writePacketData(par1DataOutput); + par1DataOutput.writeByte(this.xPosition); + par1DataOutput.writeByte(this.yPosition); + par1DataOutput.writeByte(this.zPosition); + par1DataOutput.writeByte(this.yaw); + par1DataOutput.writeByte(this.pitch); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 9; + } +} diff --git a/src/main/java/net/minecraft/src/Packet34EntityTeleport.java b/src/main/java/net/minecraft/src/Packet34EntityTeleport.java new file mode 100644 index 0000000..2ae328f --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet34EntityTeleport.java @@ -0,0 +1,108 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet34EntityTeleport extends Packet +{ + /** ID of the entity. */ + public int entityId; + + /** X position of the entity. */ + public int xPosition; + + /** Y position of the entity. */ + public int yPosition; + + /** Z position of the entity. */ + public int zPosition; + + /** Yaw of the entity. */ + public byte yaw; + + /** Pitch of the entity. */ + public byte pitch; + + public Packet34EntityTeleport() {} + + public Packet34EntityTeleport(Entity par1Entity) + { + this.entityId = par1Entity.entityId; + this.xPosition = MathHelper.floor_double(par1Entity.posX * 32.0D); + this.yPosition = MathHelper.floor_double(par1Entity.posY * 32.0D); + this.zPosition = MathHelper.floor_double(par1Entity.posZ * 32.0D); + this.yaw = (byte)((int)(par1Entity.rotationYaw * 256.0F / 360.0F)); + this.pitch = (byte)((int)(par1Entity.rotationPitch * 256.0F / 360.0F)); + } + + public Packet34EntityTeleport(int par1, int par2, int par3, int par4, byte par5, byte par6) + { + this.entityId = par1; + this.xPosition = par2; + this.yPosition = par3; + this.zPosition = par4; + this.yaw = par5; + this.pitch = par6; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.xPosition = par1DataInput.readInt(); + this.yPosition = par1DataInput.readInt(); + this.zPosition = par1DataInput.readInt(); + this.yaw = par1DataInput.readByte(); + this.pitch = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.writeInt(this.yPosition); + par1DataOutput.writeInt(this.zPosition); + par1DataOutput.write(this.yaw); + par1DataOutput.write(this.pitch); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleEntityTeleport(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 34; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + Packet34EntityTeleport var2 = (Packet34EntityTeleport)par1Packet; + return var2.entityId == this.entityId; + } +} diff --git a/src/main/java/net/minecraft/src/Packet35EntityHeadRotation.java b/src/main/java/net/minecraft/src/Packet35EntityHeadRotation.java new file mode 100644 index 0000000..9a5d954 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet35EntityHeadRotation.java @@ -0,0 +1,80 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet35EntityHeadRotation extends Packet +{ + public int entityId; + public byte headRotationYaw; + + public Packet35EntityHeadRotation() {} + + public Packet35EntityHeadRotation(int par1, byte par2) + { + this.entityId = par1; + this.headRotationYaw = par2; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.headRotationYaw = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeByte(this.headRotationYaw); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleEntityHeadRotation(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 5; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + Packet35EntityHeadRotation var2 = (Packet35EntityHeadRotation)par1Packet; + return var2.entityId == this.entityId; + } + + /** + * If this returns true, the packet may be processed on any thread; otherwise it is queued for the main thread to + * handle. + */ + public boolean canProcessAsync() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet38EntityStatus.java b/src/main/java/net/minecraft/src/Packet38EntityStatus.java new file mode 100644 index 0000000..44abaa8 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet38EntityStatus.java @@ -0,0 +1,55 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet38EntityStatus extends Packet +{ + public int entityId; + + /** 2 for hurt, 3 for dead */ + public byte entityStatus; + + public Packet38EntityStatus() {} + + public Packet38EntityStatus(int par1, byte par2) + { + this.entityId = par1; + this.entityStatus = par2; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.entityStatus = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeByte(this.entityStatus); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleEntityStatus(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 5; + } +} diff --git a/src/main/java/net/minecraft/src/Packet39AttachEntity.java b/src/main/java/net/minecraft/src/Packet39AttachEntity.java new file mode 100644 index 0000000..3e12e64 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet39AttachEntity.java @@ -0,0 +1,76 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet39AttachEntity extends Packet +{ + /** 0 for riding, 1 for leashed. */ + public int attachState; + public int ridingEntityId; + public int vehicleEntityId; + + public Packet39AttachEntity() {} + + public Packet39AttachEntity(int par1, Entity par2Entity, Entity par3Entity) + { + this.attachState = par1; + this.ridingEntityId = par2Entity.entityId; + this.vehicleEntityId = par3Entity != null ? par3Entity.entityId : -1; + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 8; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.ridingEntityId = par1DataInput.readInt(); + this.vehicleEntityId = par1DataInput.readInt(); + this.attachState = par1DataInput.readUnsignedByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.ridingEntityId); + par1DataOutput.writeInt(this.vehicleEntityId); + par1DataOutput.writeByte(this.attachState); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleAttachEntity(this); + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + Packet39AttachEntity var2 = (Packet39AttachEntity)par1Packet; + return var2.ridingEntityId == this.ridingEntityId; + } +} diff --git a/src/main/java/net/minecraft/src/Packet3Chat.java b/src/main/java/net/minecraft/src/Packet3Chat.java new file mode 100644 index 0000000..50abf80 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet3Chat.java @@ -0,0 +1,85 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet3Chat extends Packet +{ + /** The message being sent. */ + public String message; + private boolean isServer; + + public Packet3Chat() + { + this.isServer = true; + } + + public Packet3Chat(ChatMessageComponent par1ChatMessageComponent) + { + this(par1ChatMessageComponent.toJson()); + } + + public Packet3Chat(ChatMessageComponent par1ChatMessageComponent, boolean par2) + { + this(par1ChatMessageComponent.toJson(), par2); + } + + public Packet3Chat(String par1Str) + { + this(par1Str, true); + } + + public Packet3Chat(String par1Str, boolean par2) + { + this.isServer = true; + + if (par1Str.length() > 32767) + { + par1Str = par1Str.substring(0, 32767); + } + + this.message = par1Str; + this.isServer = par2; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.message = readString(par1DataInput, 32767); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(this.message, par1DataOutput); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleChat(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 2 + this.message.length() * 2; + } + + /** + * Get whether this is a server + */ + public boolean getIsServer() + { + return this.isServer; + } +} diff --git a/src/main/java/net/minecraft/src/Packet40EntityMetadata.java b/src/main/java/net/minecraft/src/Packet40EntityMetadata.java new file mode 100644 index 0000000..fb43397 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet40EntityMetadata.java @@ -0,0 +1,67 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.List; + +public class Packet40EntityMetadata extends Packet +{ + public int entityId; + private List metadata; + + public Packet40EntityMetadata() {} + + public Packet40EntityMetadata(int par1, DataWatcher par2DataWatcher, boolean par3) + { + this.entityId = par1; + + if (par3) + { + this.metadata = par2DataWatcher.getAllWatched(); + } + else + { + this.metadata = par2DataWatcher.unwatchAndReturnAllWatched(); + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.metadata = DataWatcher.readWatchableObjects(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + DataWatcher.writeObjectsInListToStream(this.metadata, par1DataOutput); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleEntityMetadata(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 5; + } + + public List getMetadata() + { + return this.metadata; + } +} diff --git a/src/main/java/net/minecraft/src/Packet41EntityEffect.java b/src/main/java/net/minecraft/src/Packet41EntityEffect.java new file mode 100644 index 0000000..fe3d078 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet41EntityEffect.java @@ -0,0 +1,97 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet41EntityEffect extends Packet +{ + public int entityId; + public byte effectId; + + /** The effect's amplifier. */ + public byte effectAmplifier; + public short duration; + + public Packet41EntityEffect() {} + + public Packet41EntityEffect(int par1, PotionEffect par2PotionEffect) + { + this.entityId = par1; + this.effectId = (byte)(par2PotionEffect.getPotionID() & 255); + this.effectAmplifier = (byte)(par2PotionEffect.getAmplifier() & 255); + + if (par2PotionEffect.getDuration() > 32767) + { + this.duration = 32767; + } + else + { + this.duration = (short)par2PotionEffect.getDuration(); + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.effectId = par1DataInput.readByte(); + this.effectAmplifier = par1DataInput.readByte(); + this.duration = par1DataInput.readShort(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeByte(this.effectId); + par1DataOutput.writeByte(this.effectAmplifier); + par1DataOutput.writeShort(this.duration); + } + + /** + * Returns true if duration is at maximum, false otherwise. + */ + public boolean isDurationMax() + { + return this.duration == 32767; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleEntityEffect(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 8; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + Packet41EntityEffect var2 = (Packet41EntityEffect)par1Packet; + return var2.entityId == this.entityId && var2.effectId == this.effectId; + } +} diff --git a/src/main/java/net/minecraft/src/Packet42RemoveEntityEffect.java b/src/main/java/net/minecraft/src/Packet42RemoveEntityEffect.java new file mode 100644 index 0000000..14c16e3 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet42RemoveEntityEffect.java @@ -0,0 +1,56 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet42RemoveEntityEffect extends Packet +{ + /** The ID of the entity which an effect is being removed from. */ + public int entityId; + + /** The ID of the effect which is being removed from an entity. */ + public byte effectId; + + public Packet42RemoveEntityEffect() {} + + public Packet42RemoveEntityEffect(int par1, PotionEffect par2PotionEffect) + { + this.entityId = par1; + this.effectId = (byte)(par2PotionEffect.getPotionID() & 255); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.effectId = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeByte(this.effectId); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleRemoveEntityEffect(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 5; + } +} diff --git a/src/main/java/net/minecraft/src/Packet43Experience.java b/src/main/java/net/minecraft/src/Packet43Experience.java new file mode 100644 index 0000000..9f9dabf --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet43Experience.java @@ -0,0 +1,79 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet43Experience extends Packet +{ + /** The current experience bar points. */ + public float experience; + + /** The total experience points. */ + public int experienceTotal; + + /** The experience level. */ + public int experienceLevel; + + public Packet43Experience() {} + + public Packet43Experience(float par1, int par2, int par3) + { + this.experience = par1; + this.experienceTotal = par2; + this.experienceLevel = par3; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.experience = par1DataInput.readFloat(); + this.experienceLevel = par1DataInput.readShort(); + this.experienceTotal = par1DataInput.readShort(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeFloat(this.experience); + par1DataOutput.writeShort(this.experienceLevel); + par1DataOutput.writeShort(this.experienceTotal); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleExperience(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 4; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet44UpdateAttributes.java b/src/main/java/net/minecraft/src/Packet44UpdateAttributes.java new file mode 100644 index 0000000..1131bb3 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet44UpdateAttributes.java @@ -0,0 +1,109 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + +public class Packet44UpdateAttributes extends Packet +{ + private int field_111005_a; + private final List field_111004_b = new ArrayList(); + + public Packet44UpdateAttributes() {} + + public Packet44UpdateAttributes(int par1, Collection par2Collection) + { + this.field_111005_a = par1; + Iterator var3 = par2Collection.iterator(); + + while (var3.hasNext()) + { + AttributeInstance var4 = (AttributeInstance)var3.next(); + this.field_111004_b.add(new Packet44UpdateAttributesSnapshot(this, var4.func_111123_a().getAttributeUnlocalizedName(), var4.getBaseValue(), var4.func_111122_c())); + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.field_111005_a = par1DataInput.readInt(); + int var2 = par1DataInput.readInt(); + + for (int var3 = 0; var3 < var2; ++var3) + { + String var4 = readString(par1DataInput, 64); + double var5 = par1DataInput.readDouble(); + ArrayList var7 = new ArrayList(); + short var8 = par1DataInput.readShort(); + + for (int var9 = 0; var9 < var8; ++var9) + { + UUID var10 = new UUID(par1DataInput.readLong(), par1DataInput.readLong()); + var7.add(new AttributeModifier(var10, "Unknown synced attribute modifier", par1DataInput.readDouble(), par1DataInput.readByte())); + } + + this.field_111004_b.add(new Packet44UpdateAttributesSnapshot(this, var4, var5, var7)); + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.field_111005_a); + par1DataOutput.writeInt(this.field_111004_b.size()); + Iterator var2 = this.field_111004_b.iterator(); + + while (var2.hasNext()) + { + Packet44UpdateAttributesSnapshot var3 = (Packet44UpdateAttributesSnapshot)var2.next(); + writeString(var3.func_142040_a(), par1DataOutput); + par1DataOutput.writeDouble(var3.func_142041_b()); + par1DataOutput.writeShort(var3.func_142039_c().size()); + Iterator var4 = var3.func_142039_c().iterator(); + + while (var4.hasNext()) + { + AttributeModifier var5 = (AttributeModifier)var4.next(); + par1DataOutput.writeLong(var5.getID().getMostSignificantBits()); + par1DataOutput.writeLong(var5.getID().getLeastSignificantBits()); + par1DataOutput.writeDouble(var5.getAmount()); + par1DataOutput.writeByte(var5.getOperation()); + } + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.func_110773_a(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 8 + this.field_111004_b.size() * 24; + } + + public int func_111002_d() + { + return this.field_111005_a; + } + + public List func_111003_f() + { + return this.field_111004_b; + } +} diff --git a/src/main/java/net/minecraft/src/Packet44UpdateAttributesSnapshot.java b/src/main/java/net/minecraft/src/Packet44UpdateAttributesSnapshot.java new file mode 100644 index 0000000..a631a29 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet44UpdateAttributesSnapshot.java @@ -0,0 +1,35 @@ +package net.minecraft.src; + +import java.util.Collection; + +public class Packet44UpdateAttributesSnapshot +{ + private final String field_142043_b; + private final double field_142044_c; + private final Collection field_142042_d; + + final Packet44UpdateAttributes field_142045_a; + + public Packet44UpdateAttributesSnapshot(Packet44UpdateAttributes par1Packet44UpdateAttributes, String par2Str, double par3, Collection par5Collection) + { + this.field_142045_a = par1Packet44UpdateAttributes; + this.field_142043_b = par2Str; + this.field_142044_c = par3; + this.field_142042_d = par5Collection; + } + + public String func_142040_a() + { + return this.field_142043_b; + } + + public double func_142041_b() + { + return this.field_142044_c; + } + + public Collection func_142039_c() + { + return this.field_142042_d; + } +} diff --git a/src/main/java/net/minecraft/src/Packet4UpdateTime.java b/src/main/java/net/minecraft/src/Packet4UpdateTime.java new file mode 100644 index 0000000..633402b --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet4UpdateTime.java @@ -0,0 +1,92 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet4UpdateTime extends Packet +{ + /** World age in ticks. */ + public long worldAge; + + /** The world time in minutes. */ + public long time; + + public Packet4UpdateTime() {} + + public Packet4UpdateTime(long par1, long par3, boolean par5) + { + this.worldAge = par1; + this.time = par3; + + if (!par5) + { + this.time = -this.time; + + if (this.time == 0L) + { + this.time = -1L; + } + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.worldAge = par1DataInput.readLong(); + this.time = par1DataInput.readLong(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeLong(this.worldAge); + par1DataOutput.writeLong(this.time); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleUpdateTime(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 16; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return true; + } + + /** + * If this returns true, the packet may be processed on any thread; otherwise it is queued for the main thread to + * handle. + */ + public boolean canProcessAsync() + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet51MapChunk.java b/src/main/java/net/minecraft/src/Packet51MapChunk.java new file mode 100644 index 0000000..3d5bfde --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet51MapChunk.java @@ -0,0 +1,259 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.zip.DataFormatException; +import java.util.zip.Deflater; +import java.util.zip.Inflater; + +public class Packet51MapChunk extends Packet +{ + /** The x-position of the transmitted chunk, in chunk coordinates. */ + public int xCh; + + /** The z-position of the transmitted chunk, in chunk coordinates. */ + public int zCh; + + /** + * The y-position of the lowest chunk Section in the transmitted chunk, in chunk coordinates. + */ + public int yChMin; + + /** + * The y-position of the highest chunk Section in the transmitted chunk, in chunk coordinates. + */ + public int yChMax; + + /** The transmitted chunk data, decompressed. */ + private byte[] chunkData; + + /** The compressed chunk data */ + private byte[] compressedChunkData; + + /** + * Whether to initialize the Chunk before applying the effect of the Packet51MapChunk. + */ + public boolean includeInitialize; + + /** The length of the compressed chunk data byte array. */ + private int tempLength; + + /** A temporary storage for the compressed chunk data byte array. */ + private static byte[] temp = new byte[196864]; + + public Packet51MapChunk() + { + this.isChunkDataPacket = true; + } + + public Packet51MapChunk(Chunk par1Chunk, boolean par2, int par3) + { + this.isChunkDataPacket = true; + this.xCh = par1Chunk.xPosition; + this.zCh = par1Chunk.zPosition; + this.includeInitialize = par2; + Packet51MapChunkData var4 = getMapChunkData(par1Chunk, par2, par3); + Deflater var5 = new Deflater(-1); + this.yChMax = var4.chunkHasAddSectionFlag; + this.yChMin = var4.chunkExistFlag; + + try + { + this.compressedChunkData = var4.compressedData; + var5.setInput(var4.compressedData, 0, var4.compressedData.length); + var5.finish(); + this.chunkData = new byte[var4.compressedData.length]; + this.tempLength = var5.deflate(this.chunkData); + } + finally + { + var5.end(); + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.xCh = par1DataInput.readInt(); + this.zCh = par1DataInput.readInt(); + this.includeInitialize = par1DataInput.readBoolean(); + this.yChMin = par1DataInput.readShort(); + this.yChMax = par1DataInput.readShort(); + this.tempLength = par1DataInput.readInt(); + + if (temp.length < this.tempLength) + { + temp = new byte[this.tempLength]; + } + + par1DataInput.readFully(temp, 0, this.tempLength); + int var2 = 0; + int var3; + + for (var3 = 0; var3 < 16; ++var3) + { + var2 += this.yChMin >> var3 & 1; + } + + var3 = 12288 * var2; + + if (this.includeInitialize) + { + var3 += 256; + } + + this.compressedChunkData = new byte[var3]; + Inflater var4 = new Inflater(); + var4.setInput(temp, 0, this.tempLength); + + try + { + var4.inflate(this.compressedChunkData); + } + catch (DataFormatException var9) + { + throw new IOException("Bad compressed data format"); + } + finally + { + var4.end(); + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.xCh); + par1DataOutput.writeInt(this.zCh); + par1DataOutput.writeBoolean(this.includeInitialize); + par1DataOutput.writeShort((short)(this.yChMin & 65535)); + par1DataOutput.writeShort((short)(this.yChMax & 65535)); + par1DataOutput.writeInt(this.tempLength); + par1DataOutput.write(this.chunkData, 0, this.tempLength); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleMapChunk(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 17 + this.tempLength; + } + + public byte[] getCompressedChunkData() + { + return this.compressedChunkData; + } + + public static Packet51MapChunkData getMapChunkData(Chunk par0Chunk, boolean par1, int par2) + { + int var3 = 0; + ExtendedBlockStorage[] var4 = par0Chunk.getBlockStorageArray(); + int var5 = 0; + Packet51MapChunkData var6 = new Packet51MapChunkData(); + byte[] var7 = temp; + + if (par1) + { + par0Chunk.sendUpdates = true; + } + + int var8; + + for (var8 = 0; var8 < var4.length; ++var8) + { + if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && (par2 & 1 << var8) != 0) + { + var6.chunkExistFlag |= 1 << var8; + + if (var4[var8].getBlockMSBArray() != null) + { + var6.chunkHasAddSectionFlag |= 1 << var8; + ++var5; + } + } + } + + for (var8 = 0; var8 < var4.length; ++var8) + { + if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && (par2 & 1 << var8) != 0) + { + byte[] var9 = var4[var8].getBlockLSBArray(); + System.arraycopy(var9, 0, var7, var3, var9.length); + var3 += var9.length; + } + } + + NibbleArray var10; + + for (var8 = 0; var8 < var4.length; ++var8) + { + if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && (par2 & 1 << var8) != 0) + { + var10 = var4[var8].getMetadataArray(); + System.arraycopy(var10.data, 0, var7, var3, var10.data.length); + var3 += var10.data.length; + } + } + + for (var8 = 0; var8 < var4.length; ++var8) + { + if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && (par2 & 1 << var8) != 0) + { + var10 = var4[var8].getBlocklightArray(); + System.arraycopy(var10.data, 0, var7, var3, var10.data.length); + var3 += var10.data.length; + } + } + + if (!par0Chunk.worldObj.provider.hasNoSky) + { + for (var8 = 0; var8 < var4.length; ++var8) + { + if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && (par2 & 1 << var8) != 0) + { + var10 = var4[var8].getSkylightArray(); + System.arraycopy(var10.data, 0, var7, var3, var10.data.length); + var3 += var10.data.length; + } + } + } + + if (var5 > 0) + { + for (var8 = 0; var8 < var4.length; ++var8) + { + if (var4[var8] != null && (!par1 || !var4[var8].isEmpty()) && var4[var8].getBlockMSBArray() != null && (par2 & 1 << var8) != 0) + { + var10 = var4[var8].getBlockMSBArray(); + System.arraycopy(var10.data, 0, var7, var3, var10.data.length); + var3 += var10.data.length; + } + } + } + + if (par1) + { + byte[] var11 = par0Chunk.getBiomeArray(); + System.arraycopy(var11, 0, var7, var3, var11.length); + var3 += var11.length; + } + + var6.compressedData = new byte[var3]; + System.arraycopy(var7, 0, var6.compressedData, 0, var3); + return var6; + } +} diff --git a/src/main/java/net/minecraft/src/Packet51MapChunkData.java b/src/main/java/net/minecraft/src/Packet51MapChunkData.java new file mode 100644 index 0000000..718f673 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet51MapChunkData.java @@ -0,0 +1,8 @@ +package net.minecraft.src; + +public class Packet51MapChunkData +{ + public byte[] compressedData; + public int chunkExistFlag; + public int chunkHasAddSectionFlag; +} diff --git a/src/main/java/net/minecraft/src/Packet52MultiBlockChange.java b/src/main/java/net/minecraft/src/Packet52MultiBlockChange.java new file mode 100644 index 0000000..41a62f4 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet52MultiBlockChange.java @@ -0,0 +1,130 @@ +package net.minecraft.src; + +import java.io.ByteArrayOutputStream; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.DataOutputStream; +import java.io.IOException; + +public class Packet52MultiBlockChange extends Packet +{ + /** Chunk X position. */ + public int xPosition; + + /** Chunk Z position. */ + public int zPosition; + + /** The metadata for each block changed. */ + public byte[] metadataArray; + + /** The size of the arrays. */ + public int size; + private static byte[] field_73449_e = new byte[0]; + + public Packet52MultiBlockChange() + { + this.isChunkDataPacket = true; + } + + public Packet52MultiBlockChange(int par1, int par2, short[] par3ArrayOfShort, int par4, World par5World) + { + this.isChunkDataPacket = true; + this.xPosition = par1; + this.zPosition = par2; + this.size = par4; + int var6 = 4 * par4; + Chunk var7 = par5World.getChunkFromChunkCoords(par1, par2); + + try + { + if (par4 >= 64) + { + this.field_98193_m.logInfo("ChunkTilesUpdatePacket compress " + par4); + + if (field_73449_e.length < var6) + { + field_73449_e = new byte[var6]; + } + } + else + { + ByteArrayOutputStream var8 = new ByteArrayOutputStream(var6); + DataOutputStream var9 = new DataOutputStream(var8); + + for (int var10 = 0; var10 < par4; ++var10) + { + int var11 = par3ArrayOfShort[var10] >> 12 & 15; + int var12 = par3ArrayOfShort[var10] >> 8 & 15; + int var13 = par3ArrayOfShort[var10] & 255; + var9.writeShort(par3ArrayOfShort[var10]); + var9.writeShort((short)((var7.getBlockID(var11, var13, var12) & 4095) << 4 | var7.getBlockMetadata(var11, var13, var12) & 15)); + } + + this.metadataArray = var8.toByteArray(); + + if (this.metadataArray.length != var6) + { + throw new RuntimeException("Expected length " + var6 + " doesn\'t match received length " + this.metadataArray.length); + } + } + } + catch (IOException var14) + { + this.field_98193_m.logSevereException("Couldn\'t create chunk packet", var14); + this.metadataArray = null; + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.xPosition = par1DataInput.readInt(); + this.zPosition = par1DataInput.readInt(); + this.size = par1DataInput.readShort() & 65535; + int var2 = par1DataInput.readInt(); + + if (var2 > 0) + { + this.metadataArray = new byte[var2]; + par1DataInput.readFully(this.metadataArray); + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.writeInt(this.zPosition); + par1DataOutput.writeShort((short)this.size); + + if (this.metadataArray != null) + { + par1DataOutput.writeInt(this.metadataArray.length); + par1DataOutput.write(this.metadataArray); + } + else + { + par1DataOutput.writeInt(0); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleMultiBlockChange(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 10 + this.size * 4; + } +} diff --git a/src/main/java/net/minecraft/src/Packet53BlockChange.java b/src/main/java/net/minecraft/src/Packet53BlockChange.java new file mode 100644 index 0000000..5f9e687 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet53BlockChange.java @@ -0,0 +1,78 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet53BlockChange extends Packet +{ + /** Block X position. */ + public int xPosition; + + /** Block Y position. */ + public int yPosition; + + /** Block Z position. */ + public int zPosition; + + /** The new block type for the block. */ + public int type; + + /** Metadata of the block. */ + public int metadata; + + public Packet53BlockChange() + { + this.isChunkDataPacket = true; + } + + public Packet53BlockChange(int par1, int par2, int par3, World par4World) + { + this.isChunkDataPacket = true; + this.xPosition = par1; + this.yPosition = par2; + this.zPosition = par3; + this.type = par4World.getBlockId(par1, par2, par3); + this.metadata = par4World.getBlockMetadata(par1, par2, par3); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.xPosition = par1DataInput.readInt(); + this.yPosition = par1DataInput.readUnsignedByte(); + this.zPosition = par1DataInput.readInt(); + this.type = par1DataInput.readShort(); + this.metadata = par1DataInput.readUnsignedByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.write(this.yPosition); + par1DataOutput.writeInt(this.zPosition); + par1DataOutput.writeShort(this.type); + par1DataOutput.write(this.metadata); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleBlockChange(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 11; + } +} diff --git a/src/main/java/net/minecraft/src/Packet54PlayNoteBlock.java b/src/main/java/net/minecraft/src/Packet54PlayNoteBlock.java new file mode 100644 index 0000000..105a4be --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet54PlayNoteBlock.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet54PlayNoteBlock extends Packet +{ + public int xLocation; + public int yLocation; + public int zLocation; + + /** 1=Double Bass, 2=Snare Drum, 3=Clicks / Sticks, 4=Bass Drum, 5=Harp */ + public int instrumentType; + + /** + * The pitch of the note (between 0-24 inclusive where 0 is the lowest and 24 is the highest). + */ + public int pitch; + + /** The block ID this action is set for. */ + public int blockId; + + public Packet54PlayNoteBlock() {} + + public Packet54PlayNoteBlock(int par1, int par2, int par3, int par4, int par5, int par6) + { + this.xLocation = par1; + this.yLocation = par2; + this.zLocation = par3; + this.instrumentType = par5; + this.pitch = par6; + this.blockId = par4; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.xLocation = par1DataInput.readInt(); + this.yLocation = par1DataInput.readShort(); + this.zLocation = par1DataInput.readInt(); + this.instrumentType = par1DataInput.readUnsignedByte(); + this.pitch = par1DataInput.readUnsignedByte(); + this.blockId = par1DataInput.readShort() & 4095; + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.xLocation); + par1DataOutput.writeShort(this.yLocation); + par1DataOutput.writeInt(this.zLocation); + par1DataOutput.write(this.instrumentType); + par1DataOutput.write(this.pitch); + par1DataOutput.writeShort(this.blockId & 4095); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleBlockEvent(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 14; + } +} diff --git a/src/main/java/net/minecraft/src/Packet55BlockDestroy.java b/src/main/java/net/minecraft/src/Packet55BlockDestroy.java new file mode 100644 index 0000000..a13a93c --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet55BlockDestroy.java @@ -0,0 +1,132 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet55BlockDestroy extends Packet +{ + /** Entity breaking the block */ + private int entityId; + + /** X posiiton of the block */ + private int posX; + + /** Y position of the block */ + private int posY; + + /** Z position of the block */ + private int posZ; + + /** How far destroyed this block is */ + private int destroyedStage; + + public Packet55BlockDestroy() {} + + public Packet55BlockDestroy(int par1, int par2, int par3, int par4, int par5) + { + this.entityId = par1; + this.posX = par2; + this.posY = par3; + this.posZ = par4; + this.destroyedStage = par5; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityId = par1DataInput.readInt(); + this.posX = par1DataInput.readInt(); + this.posY = par1DataInput.readInt(); + this.posZ = par1DataInput.readInt(); + this.destroyedStage = par1DataInput.readUnsignedByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityId); + par1DataOutput.writeInt(this.posX); + par1DataOutput.writeInt(this.posY); + par1DataOutput.writeInt(this.posZ); + par1DataOutput.write(this.destroyedStage); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleBlockDestroy(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 13; + } + + /** + * Gets the ID of the entity breaking the block + */ + public int getEntityId() + { + return this.entityId; + } + + /** + * Gets the X position of the block + */ + public int getPosX() + { + return this.posX; + } + + /** + * Gets the Y position of the block + */ + public int getPosY() + { + return this.posY; + } + + /** + * Gets the Z position of the block + */ + public int getPosZ() + { + return this.posZ; + } + + /** + * Gets how far destroyed this block is + */ + public int getDestroyedStage() + { + return this.destroyedStage; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + Packet55BlockDestroy var2 = (Packet55BlockDestroy)par1Packet; + return var2.entityId == this.entityId; + } +} diff --git a/src/main/java/net/minecraft/src/Packet56MapChunks.java b/src/main/java/net/minecraft/src/Packet56MapChunks.java new file mode 100644 index 0000000..037cd92 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet56MapChunks.java @@ -0,0 +1,204 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.List; +import java.util.zip.DataFormatException; +import java.util.zip.Deflater; +import java.util.zip.Inflater; + +public class Packet56MapChunks extends Packet +{ + private int[] chunkPostX; + private int[] chunkPosZ; + public int[] field_73590_a; + public int[] field_73588_b; + + /** The compressed chunk data buffer */ + private byte[] chunkDataBuffer; + private byte[][] field_73584_f; + + /** total size of the compressed data */ + private int dataLength; + + /** + * Whether or not the chunk data contains a light nibble array. This is true in the main world, false in the end + + * nether. + */ + private boolean skyLightSent; + private static byte[] chunkDataNotCompressed = new byte[0]; + + public Packet56MapChunks() {} + + public Packet56MapChunks(List par1List) + { + int var2 = par1List.size(); + this.chunkPostX = new int[var2]; + this.chunkPosZ = new int[var2]; + this.field_73590_a = new int[var2]; + this.field_73588_b = new int[var2]; + this.field_73584_f = new byte[var2][]; + this.skyLightSent = !par1List.isEmpty() && !((Chunk)par1List.get(0)).worldObj.provider.hasNoSky; + int var3 = 0; + + for (int var4 = 0; var4 < var2; ++var4) + { + Chunk var5 = (Chunk)par1List.get(var4); + Packet51MapChunkData var6 = Packet51MapChunk.getMapChunkData(var5, true, 65535); + + if (chunkDataNotCompressed.length < var3 + var6.compressedData.length) + { + byte[] var7 = new byte[var3 + var6.compressedData.length]; + System.arraycopy(chunkDataNotCompressed, 0, var7, 0, chunkDataNotCompressed.length); + chunkDataNotCompressed = var7; + } + + System.arraycopy(var6.compressedData, 0, chunkDataNotCompressed, var3, var6.compressedData.length); + var3 += var6.compressedData.length; + this.chunkPostX[var4] = var5.xPosition; + this.chunkPosZ[var4] = var5.zPosition; + this.field_73590_a[var4] = var6.chunkExistFlag; + this.field_73588_b[var4] = var6.chunkHasAddSectionFlag; + this.field_73584_f[var4] = var6.compressedData; + } + + Deflater var11 = new Deflater(-1); + + try + { + var11.setInput(chunkDataNotCompressed, 0, var3); + var11.finish(); + this.chunkDataBuffer = new byte[var3]; + this.dataLength = var11.deflate(this.chunkDataBuffer); + } + finally + { + var11.end(); + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + short var2 = par1DataInput.readShort(); + this.dataLength = par1DataInput.readInt(); + this.skyLightSent = par1DataInput.readBoolean(); + this.chunkPostX = new int[var2]; + this.chunkPosZ = new int[var2]; + this.field_73590_a = new int[var2]; + this.field_73588_b = new int[var2]; + this.field_73584_f = new byte[var2][]; + + if (chunkDataNotCompressed.length < this.dataLength) + { + chunkDataNotCompressed = new byte[this.dataLength]; + } + + par1DataInput.readFully(chunkDataNotCompressed, 0, this.dataLength); + byte[] var3 = new byte[196864 * var2]; + Inflater var4 = new Inflater(); + var4.setInput(chunkDataNotCompressed, 0, this.dataLength); + + try + { + var4.inflate(var3); + } + catch (DataFormatException var12) + { + throw new IOException("Bad compressed data format"); + } + finally + { + var4.end(); + } + + int var5 = 0; + + for (int var6 = 0; var6 < var2; ++var6) + { + this.chunkPostX[var6] = par1DataInput.readInt(); + this.chunkPosZ[var6] = par1DataInput.readInt(); + this.field_73590_a[var6] = par1DataInput.readShort(); + this.field_73588_b[var6] = par1DataInput.readShort(); + int var7 = 0; + int var8 = 0; + int var9; + + for (var9 = 0; var9 < 16; ++var9) + { + var7 += this.field_73590_a[var6] >> var9 & 1; + var8 += this.field_73588_b[var6] >> var9 & 1; + } + + var9 = 2048 * 4 * var7 + 256; + var9 += 2048 * var8; + + if (this.skyLightSent) + { + var9 += 2048 * var7; + } + + this.field_73584_f[var6] = new byte[var9]; + System.arraycopy(var3, var5, this.field_73584_f[var6], 0, var9); + var5 += var9; + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeShort(this.chunkPostX.length); + par1DataOutput.writeInt(this.dataLength); + par1DataOutput.writeBoolean(this.skyLightSent); + par1DataOutput.write(this.chunkDataBuffer, 0, this.dataLength); + + for (int var2 = 0; var2 < this.chunkPostX.length; ++var2) + { + par1DataOutput.writeInt(this.chunkPostX[var2]); + par1DataOutput.writeInt(this.chunkPosZ[var2]); + par1DataOutput.writeShort((short)(this.field_73590_a[var2] & 65535)); + par1DataOutput.writeShort((short)(this.field_73588_b[var2] & 65535)); + } + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleMapChunks(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 6 + this.dataLength + 12 * this.getNumberOfChunkInPacket(); + } + + public int getChunkPosX(int par1) + { + return this.chunkPostX[par1]; + } + + public int getChunkPosZ(int par1) + { + return this.chunkPosZ[par1]; + } + + public int getNumberOfChunkInPacket() + { + return this.chunkPostX.length; + } + + public byte[] getChunkCompressedData(int par1) + { + return this.field_73584_f[par1]; + } +} diff --git a/src/main/java/net/minecraft/src/Packet5PlayerInventory.java b/src/main/java/net/minecraft/src/Packet5PlayerInventory.java new file mode 100644 index 0000000..082e2e8 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet5PlayerInventory.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet5PlayerInventory extends Packet +{ + /** Entity ID of the object. */ + public int entityID; + + /** Equipment slot: 0=held, 1-4=armor slot */ + public int slot; + + /** The item in the slot format (an ItemStack) */ + private ItemStack itemSlot; + + public Packet5PlayerInventory() {} + + public Packet5PlayerInventory(int par1, int par2, ItemStack par3ItemStack) + { + this.entityID = par1; + this.slot = par2; + this.itemSlot = par3ItemStack == null ? null : par3ItemStack.copy(); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityID = par1DataInput.readInt(); + this.slot = par1DataInput.readShort(); + this.itemSlot = readItemStack(par1DataInput); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityID); + par1DataOutput.writeShort(this.slot); + writeItemStack(this.itemSlot, par1DataOutput); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handlePlayerInventory(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 8; + } + + /** + * Gets the item in the slot format (an ItemStack) + */ + public ItemStack getItemSlot() + { + return this.itemSlot; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + Packet5PlayerInventory var2 = (Packet5PlayerInventory)par1Packet; + return var2.entityID == this.entityID && var2.slot == this.slot; + } +} diff --git a/src/main/java/net/minecraft/src/Packet60Explosion.java b/src/main/java/net/minecraft/src/Packet60Explosion.java new file mode 100644 index 0000000..a278ec3 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet60Explosion.java @@ -0,0 +1,143 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class Packet60Explosion extends Packet +{ + public double explosionX; + public double explosionY; + public double explosionZ; + public float explosionSize; + public List chunkPositionRecords; + + /** X velocity of the player being pushed by the explosion */ + private float playerVelocityX; + + /** Y velocity of the player being pushed by the explosion */ + private float playerVelocityY; + + /** Z velocity of the player being pushed by the explosion */ + private float playerVelocityZ; + + public Packet60Explosion() {} + + public Packet60Explosion(double par1, double par3, double par5, float par7, List par8List, Vec3 par9Vec3) + { + this.explosionX = par1; + this.explosionY = par3; + this.explosionZ = par5; + this.explosionSize = par7; + this.chunkPositionRecords = new ArrayList(par8List); + + if (par9Vec3 != null) + { + this.playerVelocityX = (float)par9Vec3.xCoord; + this.playerVelocityY = (float)par9Vec3.yCoord; + this.playerVelocityZ = (float)par9Vec3.zCoord; + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.explosionX = par1DataInput.readDouble(); + this.explosionY = par1DataInput.readDouble(); + this.explosionZ = par1DataInput.readDouble(); + this.explosionSize = par1DataInput.readFloat(); + int var2 = par1DataInput.readInt(); + this.chunkPositionRecords = new ArrayList(var2); + int var3 = (int)this.explosionX; + int var4 = (int)this.explosionY; + int var5 = (int)this.explosionZ; + + for (int var6 = 0; var6 < var2; ++var6) + { + int var7 = par1DataInput.readByte() + var3; + int var8 = par1DataInput.readByte() + var4; + int var9 = par1DataInput.readByte() + var5; + this.chunkPositionRecords.add(new ChunkPosition(var7, var8, var9)); + } + + this.playerVelocityX = par1DataInput.readFloat(); + this.playerVelocityY = par1DataInput.readFloat(); + this.playerVelocityZ = par1DataInput.readFloat(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeDouble(this.explosionX); + par1DataOutput.writeDouble(this.explosionY); + par1DataOutput.writeDouble(this.explosionZ); + par1DataOutput.writeFloat(this.explosionSize); + par1DataOutput.writeInt(this.chunkPositionRecords.size()); + int var2 = (int)this.explosionX; + int var3 = (int)this.explosionY; + int var4 = (int)this.explosionZ; + Iterator var5 = this.chunkPositionRecords.iterator(); + + while (var5.hasNext()) + { + ChunkPosition var6 = (ChunkPosition)var5.next(); + int var7 = var6.x - var2; + int var8 = var6.y - var3; + int var9 = var6.z - var4; + par1DataOutput.writeByte(var7); + par1DataOutput.writeByte(var8); + par1DataOutput.writeByte(var9); + } + + par1DataOutput.writeFloat(this.playerVelocityX); + par1DataOutput.writeFloat(this.playerVelocityY); + par1DataOutput.writeFloat(this.playerVelocityZ); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleExplosion(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 32 + this.chunkPositionRecords.size() * 3 + 3; + } + + /** + * Gets the X velocity of the player being pushed by the explosion. + */ + public float getPlayerVelocityX() + { + return this.playerVelocityX; + } + + /** + * Gets the Y velocity of the player being pushed by the explosion. + */ + public float getPlayerVelocityY() + { + return this.playerVelocityY; + } + + /** + * Gets the Z velocity of the player being pushed by the explosion. + */ + public float getPlayerVelocityZ() + { + return this.playerVelocityZ; + } +} diff --git a/src/main/java/net/minecraft/src/Packet61DoorChange.java b/src/main/java/net/minecraft/src/Packet61DoorChange.java new file mode 100644 index 0000000..22ffec5 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet61DoorChange.java @@ -0,0 +1,74 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet61DoorChange extends Packet +{ + public int sfxID; + public int auxData; + public int posX; + public int posY; + public int posZ; + private boolean disableRelativeVolume; + + public Packet61DoorChange() {} + + public Packet61DoorChange(int par1, int par2, int par3, int par4, int par5, boolean par6) + { + this.sfxID = par1; + this.posX = par2; + this.posY = par3; + this.posZ = par4; + this.auxData = par5; + this.disableRelativeVolume = par6; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.sfxID = par1DataInput.readInt(); + this.posX = par1DataInput.readInt(); + this.posY = par1DataInput.readByte() & 255; + this.posZ = par1DataInput.readInt(); + this.auxData = par1DataInput.readInt(); + this.disableRelativeVolume = par1DataInput.readBoolean(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.sfxID); + par1DataOutput.writeInt(this.posX); + par1DataOutput.writeByte(this.posY & 255); + par1DataOutput.writeInt(this.posZ); + par1DataOutput.writeInt(this.auxData); + par1DataOutput.writeBoolean(this.disableRelativeVolume); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleDoorChange(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 21; + } + + public boolean getRelativeVolumeDisabled() + { + return this.disableRelativeVolume; + } +} diff --git a/src/main/java/net/minecraft/src/Packet62LevelSound.java b/src/main/java/net/minecraft/src/Packet62LevelSound.java new file mode 100644 index 0000000..4a49f24 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet62LevelSound.java @@ -0,0 +1,123 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet62LevelSound extends Packet +{ + /** e.g. step.grass */ + private String soundName; + + /** Effect X multiplied by 8 */ + private int effectX; + + /** Effect Y multiplied by 8 */ + private int effectY = Integer.MAX_VALUE; + + /** Effect Z multiplied by 8 */ + private int effectZ; + + /** 1 is 100%. Can be more. */ + private float volume; + + /** 63 is 100%. Can be more. */ + private int pitch; + + public Packet62LevelSound() {} + + public Packet62LevelSound(String par1Str, double par2, double par4, double par6, float par8, float par9) + { + this.soundName = par1Str; + this.effectX = (int)(par2 * 8.0D); + this.effectY = (int)(par4 * 8.0D); + this.effectZ = (int)(par6 * 8.0D); + this.volume = par8; + this.pitch = (int)(par9 * 63.0F); + + if (this.pitch < 0) + { + this.pitch = 0; + } + + if (this.pitch > 255) + { + this.pitch = 255; + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.soundName = readString(par1DataInput, 256); + this.effectX = par1DataInput.readInt(); + this.effectY = par1DataInput.readInt(); + this.effectZ = par1DataInput.readInt(); + this.volume = par1DataInput.readFloat(); + this.pitch = par1DataInput.readUnsignedByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(this.soundName, par1DataOutput); + par1DataOutput.writeInt(this.effectX); + par1DataOutput.writeInt(this.effectY); + par1DataOutput.writeInt(this.effectZ); + par1DataOutput.writeFloat(this.volume); + par1DataOutput.writeByte(this.pitch); + } + + public String getSoundName() + { + return this.soundName; + } + + public double getEffectX() + { + return (double)((float)this.effectX / 8.0F); + } + + public double getEffectY() + { + return (double)((float)this.effectY / 8.0F); + } + + public double getEffectZ() + { + return (double)((float)this.effectZ / 8.0F); + } + + public float getVolume() + { + return this.volume; + } + + /** + * Gets the pitch divided by 63 (63 is 100%) + */ + public float getPitch() + { + return (float)this.pitch / 63.0F; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleLevelSound(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 24; + } +} diff --git a/src/main/java/net/minecraft/src/Packet63WorldParticles.java b/src/main/java/net/minecraft/src/Packet63WorldParticles.java new file mode 100644 index 0000000..a433e47 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet63WorldParticles.java @@ -0,0 +1,160 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet63WorldParticles extends Packet +{ + /** + * The name of the particle to create. A list can be found at https://gist.github.com/thinkofdeath/5110835 + */ + private String particleName; + + /** X position of the particle. */ + private float posX; + + /** Y position of the particle. */ + private float posY; + + /** Z position of the particle. */ + private float posZ; + + /** + * This is added to the X position after being multiplied by random.nextGaussian() + */ + private float offsetX; + + /** + * This is added to the Y position after being multiplied by random.nextGaussian() + */ + private float offsetY; + + /** + * This is added to the Z position after being multiplied by random.nextGaussian() + */ + private float offsetZ; + + /** The speed of each particle. */ + private float speed; + + /** The number of particles to create. */ + private int quantity; + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.particleName = readString(par1DataInput, 64); + this.posX = par1DataInput.readFloat(); + this.posY = par1DataInput.readFloat(); + this.posZ = par1DataInput.readFloat(); + this.offsetX = par1DataInput.readFloat(); + this.offsetY = par1DataInput.readFloat(); + this.offsetZ = par1DataInput.readFloat(); + this.speed = par1DataInput.readFloat(); + this.quantity = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + writeString(this.particleName, par1DataOutput); + par1DataOutput.writeFloat(this.posX); + par1DataOutput.writeFloat(this.posY); + par1DataOutput.writeFloat(this.posZ); + par1DataOutput.writeFloat(this.offsetX); + par1DataOutput.writeFloat(this.offsetY); + par1DataOutput.writeFloat(this.offsetZ); + par1DataOutput.writeFloat(this.speed); + par1DataOutput.writeInt(this.quantity); + } + + public String getParticleName() + { + return this.particleName; + } + + /** + * Gets the X position of the particle. + */ + public double getPositionX() + { + return (double)this.posX; + } + + /** + * Gets the Y position of the particle. + */ + public double getPositionY() + { + return (double)this.posY; + } + + /** + * Gets the Z position of the particle. + */ + public double getPositionZ() + { + return (double)this.posZ; + } + + /** + * This is added to the X position after being multiplied by random.nextGaussian() + */ + public float getOffsetX() + { + return this.offsetX; + } + + /** + * This is added to the Y position after being multiplied by random.nextGaussian() + */ + public float getOffsetY() + { + return this.offsetY; + } + + /** + * This is added to the Z position after being multiplied by random.nextGaussian() + */ + public float getOffsetZ() + { + return this.offsetZ; + } + + /** + * Gets the speed of the particles. + */ + public float getSpeed() + { + return this.speed; + } + + /** + * Gets the number of particles to create. + */ + public int getQuantity() + { + return this.quantity; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleWorldParticles(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 64; + } +} diff --git a/src/main/java/net/minecraft/src/Packet6SpawnPosition.java b/src/main/java/net/minecraft/src/Packet6SpawnPosition.java new file mode 100644 index 0000000..a30e297 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet6SpawnPosition.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet6SpawnPosition extends Packet +{ + /** X coordinate of spawn. */ + public int xPosition; + + /** Y coordinate of spawn. */ + public int yPosition; + + /** Z coordinate of spawn. */ + public int zPosition; + + public Packet6SpawnPosition() {} + + public Packet6SpawnPosition(int par1, int par2, int par3) + { + this.xPosition = par1; + this.yPosition = par2; + this.zPosition = par3; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.xPosition = par1DataInput.readInt(); + this.yPosition = par1DataInput.readInt(); + this.zPosition = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.xPosition); + par1DataOutput.writeInt(this.yPosition); + par1DataOutput.writeInt(this.zPosition); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleSpawnPosition(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 12; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return true; + } + + /** + * If this returns true, the packet may be processed on any thread; otherwise it is queued for the main thread to + * handle. + */ + public boolean canProcessAsync() + { + return false; + } +} diff --git a/src/main/java/net/minecraft/src/Packet70GameEvent.java b/src/main/java/net/minecraft/src/Packet70GameEvent.java new file mode 100644 index 0000000..08511f7 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet70GameEvent.java @@ -0,0 +1,63 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet70GameEvent extends Packet +{ + /** + * The client prints clientMessage[eventType] to chat when this packet is received. + */ + public static final String[] clientMessage = new String[] {"tile.bed.notValid", null, null, "gameMode.changed"}; + + /** 0: Invalid bed, 1: Rain starts, 2: Rain stops, 3: Game mode changed. */ + public int eventType; + + /** + * When reason==3, the game mode to set. See EnumGameType for a list of values. + */ + public int gameMode; + + public Packet70GameEvent() {} + + public Packet70GameEvent(int par1, int par2) + { + this.eventType = par1; + this.gameMode = par2; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.eventType = par1DataInput.readByte(); + this.gameMode = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeByte(this.eventType); + par1DataOutput.writeByte(this.gameMode); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleGameEvent(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 2; + } +} diff --git a/src/main/java/net/minecraft/src/Packet71Weather.java b/src/main/java/net/minecraft/src/Packet71Weather.java new file mode 100644 index 0000000..d15417e --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet71Weather.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet71Weather extends Packet +{ + public int entityID; + public int posX; + public int posY; + public int posZ; + public int isLightningBolt; + + public Packet71Weather() {} + + public Packet71Weather(Entity par1Entity) + { + this.entityID = par1Entity.entityId; + this.posX = MathHelper.floor_double(par1Entity.posX * 32.0D); + this.posY = MathHelper.floor_double(par1Entity.posY * 32.0D); + this.posZ = MathHelper.floor_double(par1Entity.posZ * 32.0D); + + if (par1Entity instanceof EntityLightningBolt) + { + this.isLightningBolt = 1; + } + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.entityID = par1DataInput.readInt(); + this.isLightningBolt = par1DataInput.readByte(); + this.posX = par1DataInput.readInt(); + this.posY = par1DataInput.readInt(); + this.posZ = par1DataInput.readInt(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.entityID); + par1DataOutput.writeByte(this.isLightningBolt); + par1DataOutput.writeInt(this.posX); + par1DataOutput.writeInt(this.posY); + par1DataOutput.writeInt(this.posZ); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleWeather(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 17; + } +} diff --git a/src/main/java/net/minecraft/src/Packet7UseEntity.java b/src/main/java/net/minecraft/src/Packet7UseEntity.java new file mode 100644 index 0000000..de23ed0 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet7UseEntity.java @@ -0,0 +1,64 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet7UseEntity extends Packet +{ + /** The entity of the player (ignored by the server) */ + public int playerEntityId; + + /** The entity the player is interacting with */ + public int targetEntity; + + /** + * Seems to be true when the player is pointing at an entity and left-clicking and false when right-clicking. + */ + public int isLeftClick; + + public Packet7UseEntity() {} + + public Packet7UseEntity(int par1, int par2, int par3) + { + this.playerEntityId = par1; + this.targetEntity = par2; + this.isLeftClick = par3; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.playerEntityId = par1DataInput.readInt(); + this.targetEntity = par1DataInput.readInt(); + this.isLeftClick = par1DataInput.readByte(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.playerEntityId); + par1DataOutput.writeInt(this.targetEntity); + par1DataOutput.writeByte(this.isLeftClick); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleUseEntity(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 9; + } +} diff --git a/src/main/java/net/minecraft/src/Packet8UpdateHealth.java b/src/main/java/net/minecraft/src/Packet8UpdateHealth.java new file mode 100644 index 0000000..da39281 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet8UpdateHealth.java @@ -0,0 +1,79 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet8UpdateHealth extends Packet +{ + /** Variable used for incoming health packets */ + public float healthMP; + public int food; + + /** + * Players logging on get a saturation of 5.0. Eating food increases the saturation as well as the food bar. + */ + public float foodSaturation; + + public Packet8UpdateHealth() {} + + public Packet8UpdateHealth(float par1, int par2, float par3) + { + this.healthMP = par1; + this.food = par2; + this.foodSaturation = par3; + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.healthMP = par1DataInput.readFloat(); + this.food = par1DataInput.readShort(); + this.foodSaturation = par1DataInput.readFloat(); + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeFloat(this.healthMP); + par1DataOutput.writeShort(this.food); + par1DataOutput.writeFloat(this.foodSaturation); + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleUpdateHealth(this); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 8; + } + + /** + * only false for the abstract Packet class, all real packets return true + */ + public boolean isRealPacket() + { + return true; + } + + /** + * eg return packet30entity.entityId == entityId; WARNING : will throw if you compare a packet to a different packet + * class + */ + public boolean containsSameEntityIDAs(Packet par1Packet) + { + return true; + } +} diff --git a/src/main/java/net/minecraft/src/Packet9Respawn.java b/src/main/java/net/minecraft/src/Packet9Respawn.java new file mode 100644 index 0000000..35ba966 --- /dev/null +++ b/src/main/java/net/minecraft/src/Packet9Respawn.java @@ -0,0 +1,77 @@ +package net.minecraft.src; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +public class Packet9Respawn extends Packet +{ + public int respawnDimension; + + /** + * The difficulty setting. 0 through 3 for peaceful, easy, normal, hard. The client always sends 1. + */ + public int difficulty; + + /** Defaults to 128 */ + public int worldHeight; + public EnumGameType gameType; + public WorldType terrainType; + + public Packet9Respawn() {} + + public Packet9Respawn(int par1, byte par2, WorldType par3WorldType, int par4, EnumGameType par5EnumGameType) + { + this.respawnDimension = par1; + this.difficulty = par2; + this.worldHeight = par4; + this.gameType = par5EnumGameType; + this.terrainType = par3WorldType; + } + + /** + * Passes this Packet on to the NetHandler for processing. + */ + public void processPacket(NetHandler par1NetHandler) + { + par1NetHandler.handleRespawn(this); + } + + /** + * Abstract. Reads the raw packet data from the data stream. + */ + public void readPacketData(DataInput par1DataInput) throws IOException + { + this.respawnDimension = par1DataInput.readInt(); + this.difficulty = par1DataInput.readByte(); + this.gameType = EnumGameType.getByID(par1DataInput.readByte()); + this.worldHeight = par1DataInput.readShort(); + String var2 = readString(par1DataInput, 16); + this.terrainType = WorldType.parseWorldType(var2); + + if (this.terrainType == null) + { + this.terrainType = WorldType.DEFAULT; + } + } + + /** + * Abstract. Writes the raw packet data to the data stream. + */ + public void writePacketData(DataOutput par1DataOutput) throws IOException + { + par1DataOutput.writeInt(this.respawnDimension); + par1DataOutput.writeByte(this.difficulty); + par1DataOutput.writeByte(this.gameType.getID()); + par1DataOutput.writeShort(this.worldHeight); + writeString(this.terrainType.getWorldTypeName(), par1DataOutput); + } + + /** + * Abstract. Return the size of the packet (not counting the header). + */ + public int getPacketSize() + { + return 8 + (this.terrainType == null ? 0 : this.terrainType.getWorldTypeName().length()); + } +} diff --git a/src/main/java/net/minecraft/src/PacketCount.java b/src/main/java/net/minecraft/src/PacketCount.java new file mode 100644 index 0000000..b589d21 --- /dev/null +++ b/src/main/java/net/minecraft/src/PacketCount.java @@ -0,0 +1,41 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.Map; + +public class PacketCount +{ + /** If false, countPacket does nothing */ + public static boolean allowCounting = true; + + /** A count of the total number of each packet sent grouped by IDs. */ + private static final Map packetCountForID = new HashMap(); + + /** A count of the total size of each packet sent grouped by IDs. */ + private static final Map sizeCountForID = new HashMap(); + + /** Used to make threads queue to add packets */ + private static final Object lock = new Object(); + + public static void countPacket(int par0, long par1) + { + if (allowCounting) + { + Object var3 = lock; + + synchronized (lock) + { + if (packetCountForID.containsKey(Integer.valueOf(par0))) + { + packetCountForID.put(Integer.valueOf(par0), Long.valueOf(((Long)packetCountForID.get(Integer.valueOf(par0))).longValue() + 1L)); + sizeCountForID.put(Integer.valueOf(par0), Long.valueOf(((Long)sizeCountForID.get(Integer.valueOf(par0))).longValue() + par1)); + } + else + { + packetCountForID.put(Integer.valueOf(par0), Long.valueOf(1L)); + sizeCountForID.put(Integer.valueOf(par0), Long.valueOf(par1)); + } + } + } + } +} diff --git a/src/main/java/net/minecraft/src/Path.java b/src/main/java/net/minecraft/src/Path.java new file mode 100644 index 0000000..cd9b5f1 --- /dev/null +++ b/src/main/java/net/minecraft/src/Path.java @@ -0,0 +1,175 @@ +package net.minecraft.src; + +public class Path +{ + /** Contains the points in this path */ + private PathPoint[] pathPoints = new PathPoint[1024]; + + /** The number of points in this path */ + private int count; + + /** + * Adds a point to the path + */ + public PathPoint addPoint(PathPoint par1PathPoint) + { + if (par1PathPoint.index >= 0) + { + throw new IllegalStateException("OW KNOWS!"); + } + else + { + if (this.count == this.pathPoints.length) + { + PathPoint[] var2 = new PathPoint[this.count << 1]; + System.arraycopy(this.pathPoints, 0, var2, 0, this.count); + this.pathPoints = var2; + } + + this.pathPoints[this.count] = par1PathPoint; + par1PathPoint.index = this.count; + this.sortBack(this.count++); + return par1PathPoint; + } + } + + /** + * Clears the path + */ + public void clearPath() + { + this.count = 0; + } + + /** + * Returns and removes the first point in the path + */ + public PathPoint dequeue() + { + PathPoint var1 = this.pathPoints[0]; + this.pathPoints[0] = this.pathPoints[--this.count]; + this.pathPoints[this.count] = null; + + if (this.count > 0) + { + this.sortForward(0); + } + + var1.index = -1; + return var1; + } + + /** + * Changes the provided point's distance to target + */ + public void changeDistance(PathPoint par1PathPoint, float par2) + { + float var3 = par1PathPoint.distanceToTarget; + par1PathPoint.distanceToTarget = par2; + + if (par2 < var3) + { + this.sortBack(par1PathPoint.index); + } + else + { + this.sortForward(par1PathPoint.index); + } + } + + /** + * Sorts a point to the left + */ + private void sortBack(int par1) + { + PathPoint var2 = this.pathPoints[par1]; + int var4; + + for (float var3 = var2.distanceToTarget; par1 > 0; par1 = var4) + { + var4 = par1 - 1 >> 1; + PathPoint var5 = this.pathPoints[var4]; + + if (var3 >= var5.distanceToTarget) + { + break; + } + + this.pathPoints[par1] = var5; + var5.index = par1; + } + + this.pathPoints[par1] = var2; + var2.index = par1; + } + + /** + * Sorts a point to the right + */ + private void sortForward(int par1) + { + PathPoint var2 = this.pathPoints[par1]; + float var3 = var2.distanceToTarget; + + while (true) + { + int var4 = 1 + (par1 << 1); + int var5 = var4 + 1; + + if (var4 >= this.count) + { + break; + } + + PathPoint var6 = this.pathPoints[var4]; + float var7 = var6.distanceToTarget; + PathPoint var8; + float var9; + + if (var5 >= this.count) + { + var8 = null; + var9 = Float.POSITIVE_INFINITY; + } + else + { + var8 = this.pathPoints[var5]; + var9 = var8.distanceToTarget; + } + + if (var7 < var9) + { + if (var7 >= var3) + { + break; + } + + this.pathPoints[par1] = var6; + var6.index = par1; + par1 = var4; + } + else + { + if (var9 >= var3) + { + break; + } + + this.pathPoints[par1] = var8; + var8.index = par1; + par1 = var5; + } + } + + this.pathPoints[par1] = var2; + var2.index = par1; + } + + /** + * Returns true if this path contains no points + */ + public boolean isPathEmpty() + { + return this.count == 0; + } +} diff --git a/src/main/java/net/minecraft/src/PathEntity.java b/src/main/java/net/minecraft/src/PathEntity.java new file mode 100644 index 0000000..dcb1225 --- /dev/null +++ b/src/main/java/net/minecraft/src/PathEntity.java @@ -0,0 +1,126 @@ +package net.minecraft.src; + +public class PathEntity +{ + /** The actual points in the path */ + private final PathPoint[] points; + + /** PathEntity Array Index the Entity is currently targeting */ + private int currentPathIndex; + + /** The total length of the path */ + private int pathLength; + + public PathEntity(PathPoint[] par1ArrayOfPathPoint) + { + this.points = par1ArrayOfPathPoint; + this.pathLength = par1ArrayOfPathPoint.length; + } + + /** + * Directs this path to the next point in its array + */ + public void incrementPathIndex() + { + ++this.currentPathIndex; + } + + /** + * Returns true if this path has reached the end + */ + public boolean isFinished() + { + return this.currentPathIndex >= this.pathLength; + } + + /** + * returns the last PathPoint of the Array + */ + public PathPoint getFinalPathPoint() + { + return this.pathLength > 0 ? this.points[this.pathLength - 1] : null; + } + + /** + * return the PathPoint located at the specified PathIndex, usually the current one + */ + public PathPoint getPathPointFromIndex(int par1) + { + return this.points[par1]; + } + + public int getCurrentPathLength() + { + return this.pathLength; + } + + public void setCurrentPathLength(int par1) + { + this.pathLength = par1; + } + + public int getCurrentPathIndex() + { + return this.currentPathIndex; + } + + public void setCurrentPathIndex(int par1) + { + this.currentPathIndex = par1; + } + + /** + * Gets the vector of the PathPoint associated with the given index. + */ + public Vec3 getVectorFromIndex(Entity par1Entity, int par2) + { + double var3 = (double)this.points[par2].xCoord + (double)((int)(par1Entity.width + 1.0F)) * 0.5D; + double var5 = (double)this.points[par2].yCoord; + double var7 = (double)this.points[par2].zCoord + (double)((int)(par1Entity.width + 1.0F)) * 0.5D; + return par1Entity.worldObj.getWorldVec3Pool().getVecFromPool(var3, var5, var7); + } + + /** + * returns the current PathEntity target node as Vec3D + */ + public Vec3 getPosition(Entity par1Entity) + { + return this.getVectorFromIndex(par1Entity, this.currentPathIndex); + } + + /** + * Returns true if the EntityPath are the same. Non instance related equals. + */ + public boolean isSamePath(PathEntity par1PathEntity) + { + if (par1PathEntity == null) + { + return false; + } + else if (par1PathEntity.points.length != this.points.length) + { + return false; + } + else + { + for (int var2 = 0; var2 < this.points.length; ++var2) + { + if (this.points[var2].xCoord != par1PathEntity.points[var2].xCoord || this.points[var2].yCoord != par1PathEntity.points[var2].yCoord || this.points[var2].zCoord != par1PathEntity.points[var2].zCoord) + { + return false; + } + } + + return true; + } + } + + /** + * Returns true if the final PathPoint in the PathEntity is equal to Vec3D coords. + */ + public boolean isDestinationSame(Vec3 par1Vec3) + { + PathPoint var2 = this.getFinalPathPoint(); + return var2 == null ? false : var2.xCoord == (int)par1Vec3.xCoord && var2.zCoord == (int)par1Vec3.zCoord; + } +} diff --git a/src/main/java/net/minecraft/src/PathFinder.java b/src/main/java/net/minecraft/src/PathFinder.java new file mode 100644 index 0000000..8da91be --- /dev/null +++ b/src/main/java/net/minecraft/src/PathFinder.java @@ -0,0 +1,394 @@ +package net.minecraft.src; + +public class PathFinder +{ + /** Used to find obstacles */ + private IBlockAccess worldMap; + + /** The path being generated */ + private Path path = new Path(); + + /** The points in the path */ + private IntHashMap pointMap = new IntHashMap(); + + /** Selection of path points to add to the path */ + private PathPoint[] pathOptions = new PathPoint[32]; + + /** should the PathFinder go through wodden door blocks */ + private boolean isWoddenDoorAllowed; + + /** + * should the PathFinder disregard BlockMovement type materials in its path + */ + private boolean isMovementBlockAllowed; + private boolean isPathingInWater; + + /** tells the FathFinder to not stop pathing underwater */ + private boolean canEntityDrown; + + public PathFinder(IBlockAccess par1IBlockAccess, boolean par2, boolean par3, boolean par4, boolean par5) + { + this.worldMap = par1IBlockAccess; + this.isWoddenDoorAllowed = par2; + this.isMovementBlockAllowed = par3; + this.isPathingInWater = par4; + this.canEntityDrown = par5; + } + + /** + * Creates a path from one entity to another within a minimum distance + */ + public PathEntity createEntityPathTo(Entity par1Entity, Entity par2Entity, float par3) + { + return this.createEntityPathTo(par1Entity, par2Entity.posX, par2Entity.boundingBox.minY, par2Entity.posZ, par3); + } + + /** + * Creates a path from an entity to a specified location within a minimum distance + */ + public PathEntity createEntityPathTo(Entity par1Entity, int par2, int par3, int par4, float par5) + { + return this.createEntityPathTo(par1Entity, (double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), par5); + } + + /** + * Internal implementation of creating a path from an entity to a point + */ + private PathEntity createEntityPathTo(Entity par1Entity, double par2, double par4, double par6, float par8) + { + this.path.clearPath(); + this.pointMap.clearMap(); + boolean var9 = this.isPathingInWater; + int var10 = MathHelper.floor_double(par1Entity.boundingBox.minY + 0.5D); + + if (this.canEntityDrown && par1Entity.isInWater()) + { + var10 = (int)par1Entity.boundingBox.minY; + + for (int var11 = this.worldMap.getBlockId(MathHelper.floor_double(par1Entity.posX), var10, MathHelper.floor_double(par1Entity.posZ)); var11 == Block.waterMoving.blockID || var11 == Block.waterStill.blockID; var11 = this.worldMap.getBlockId(MathHelper.floor_double(par1Entity.posX), var10, MathHelper.floor_double(par1Entity.posZ))) + { + ++var10; + } + + var9 = this.isPathingInWater; + this.isPathingInWater = false; + } + else + { + var10 = MathHelper.floor_double(par1Entity.boundingBox.minY + 0.5D); + } + + PathPoint var15 = this.openPoint(MathHelper.floor_double(par1Entity.boundingBox.minX), var10, MathHelper.floor_double(par1Entity.boundingBox.minZ)); + PathPoint var12 = this.openPoint(MathHelper.floor_double(par2 - (double)(par1Entity.width / 2.0F)), MathHelper.floor_double(par4), MathHelper.floor_double(par6 - (double)(par1Entity.width / 2.0F))); + PathPoint var13 = new PathPoint(MathHelper.floor_float(par1Entity.width + 1.0F), MathHelper.floor_float(par1Entity.height + 1.0F), MathHelper.floor_float(par1Entity.width + 1.0F)); + PathEntity var14 = this.addToPath(par1Entity, var15, var12, var13, par8); + this.isPathingInWater = var9; + return var14; + } + + /** + * Adds a path from start to end and returns the whole path (args: unused, start, end, unused, maxDistance) + */ + private PathEntity addToPath(Entity par1Entity, PathPoint par2PathPoint, PathPoint par3PathPoint, PathPoint par4PathPoint, float par5) + { + par2PathPoint.totalPathDistance = 0.0F; + par2PathPoint.distanceToNext = par2PathPoint.func_75832_b(par3PathPoint); + par2PathPoint.distanceToTarget = par2PathPoint.distanceToNext; + this.path.clearPath(); + this.path.addPoint(par2PathPoint); + PathPoint var6 = par2PathPoint; + + while (!this.path.isPathEmpty()) + { + PathPoint var7 = this.path.dequeue(); + + if (var7.equals(par3PathPoint)) + { + return this.createEntityPath(par2PathPoint, par3PathPoint); + } + + if (var7.func_75832_b(par3PathPoint) < var6.func_75832_b(par3PathPoint)) + { + var6 = var7; + } + + var7.isFirst = true; + int var8 = this.findPathOptions(par1Entity, var7, par4PathPoint, par3PathPoint, par5); + + for (int var9 = 0; var9 < var8; ++var9) + { + PathPoint var10 = this.pathOptions[var9]; + float var11 = var7.totalPathDistance + var7.func_75832_b(var10); + + if (!var10.isAssigned() || var11 < var10.totalPathDistance) + { + var10.previous = var7; + var10.totalPathDistance = var11; + var10.distanceToNext = var10.func_75832_b(par3PathPoint); + + if (var10.isAssigned()) + { + this.path.changeDistance(var10, var10.totalPathDistance + var10.distanceToNext); + } + else + { + var10.distanceToTarget = var10.totalPathDistance + var10.distanceToNext; + this.path.addPoint(var10); + } + } + } + } + + if (var6 == par2PathPoint) + { + return null; + } + else + { + return this.createEntityPath(par2PathPoint, var6); + } + } + + /** + * populates pathOptions with available points and returns the number of options found (args: unused1, currentPoint, + * unused2, targetPoint, maxDistance) + */ + private int findPathOptions(Entity par1Entity, PathPoint par2PathPoint, PathPoint par3PathPoint, PathPoint par4PathPoint, float par5) + { + int var6 = 0; + byte var7 = 0; + + if (this.getVerticalOffset(par1Entity, par2PathPoint.xCoord, par2PathPoint.yCoord + 1, par2PathPoint.zCoord, par3PathPoint) == 1) + { + var7 = 1; + } + + PathPoint var8 = this.getSafePoint(par1Entity, par2PathPoint.xCoord, par2PathPoint.yCoord, par2PathPoint.zCoord + 1, par3PathPoint, var7); + PathPoint var9 = this.getSafePoint(par1Entity, par2PathPoint.xCoord - 1, par2PathPoint.yCoord, par2PathPoint.zCoord, par3PathPoint, var7); + PathPoint var10 = this.getSafePoint(par1Entity, par2PathPoint.xCoord + 1, par2PathPoint.yCoord, par2PathPoint.zCoord, par3PathPoint, var7); + PathPoint var11 = this.getSafePoint(par1Entity, par2PathPoint.xCoord, par2PathPoint.yCoord, par2PathPoint.zCoord - 1, par3PathPoint, var7); + + if (var8 != null && !var8.isFirst && var8.distanceTo(par4PathPoint) < par5) + { + this.pathOptions[var6++] = var8; + } + + if (var9 != null && !var9.isFirst && var9.distanceTo(par4PathPoint) < par5) + { + this.pathOptions[var6++] = var9; + } + + if (var10 != null && !var10.isFirst && var10.distanceTo(par4PathPoint) < par5) + { + this.pathOptions[var6++] = var10; + } + + if (var11 != null && !var11.isFirst && var11.distanceTo(par4PathPoint) < par5) + { + this.pathOptions[var6++] = var11; + } + + return var6; + } + + /** + * Returns a point that the entity can safely move to + */ + private PathPoint getSafePoint(Entity par1Entity, int par2, int par3, int par4, PathPoint par5PathPoint, int par6) + { + PathPoint var7 = null; + int var8 = this.getVerticalOffset(par1Entity, par2, par3, par4, par5PathPoint); + + if (var8 == 2) + { + return this.openPoint(par2, par3, par4); + } + else + { + if (var8 == 1) + { + var7 = this.openPoint(par2, par3, par4); + } + + if (var7 == null && par6 > 0 && var8 != -3 && var8 != -4 && this.getVerticalOffset(par1Entity, par2, par3 + par6, par4, par5PathPoint) == 1) + { + var7 = this.openPoint(par2, par3 + par6, par4); + par3 += par6; + } + + if (var7 != null) + { + int var9 = 0; + int var10 = 0; + + while (par3 > 0) + { + var10 = this.getVerticalOffset(par1Entity, par2, par3 - 1, par4, par5PathPoint); + + if (this.isPathingInWater && var10 == -1) + { + return null; + } + + if (var10 != 1) + { + break; + } + + if (var9++ >= par1Entity.getMaxSafePointTries()) + { + return null; + } + + --par3; + + if (par3 > 0) + { + var7 = this.openPoint(par2, par3, par4); + } + } + + if (var10 == -2) + { + return null; + } + } + + return var7; + } + } + + /** + * Returns a mapped point or creates and adds one + */ + private final PathPoint openPoint(int par1, int par2, int par3) + { + int var4 = PathPoint.makeHash(par1, par2, par3); + PathPoint var5 = (PathPoint)this.pointMap.lookup(var4); + + if (var5 == null) + { + var5 = new PathPoint(par1, par2, par3); + this.pointMap.addKey(var4, var5); + } + + return var5; + } + + /** + * Checks if an entity collides with blocks at a position. Returns 1 if clear, 0 for colliding with any solid block, + * -1 for water(if avoiding water) but otherwise clear, -2 for lava, -3 for fence, -4 for closed trapdoor, 2 if + * otherwise clear except for open trapdoor or water(if not avoiding) + */ + public int getVerticalOffset(Entity par1Entity, int par2, int par3, int par4, PathPoint par5PathPoint) + { + return func_82565_a(par1Entity, par2, par3, par4, par5PathPoint, this.isPathingInWater, this.isMovementBlockAllowed, this.isWoddenDoorAllowed); + } + + public static int func_82565_a(Entity par0Entity, int par1, int par2, int par3, PathPoint par4PathPoint, boolean par5, boolean par6, boolean par7) + { + boolean var8 = false; + + for (int var9 = par1; var9 < par1 + par4PathPoint.xCoord; ++var9) + { + for (int var10 = par2; var10 < par2 + par4PathPoint.yCoord; ++var10) + { + for (int var11 = par3; var11 < par3 + par4PathPoint.zCoord; ++var11) + { + int var12 = par0Entity.worldObj.getBlockId(var9, var10, var11); + + if (var12 > 0) + { + if (var12 == Block.trapdoor.blockID) + { + var8 = true; + } + else if (var12 != Block.waterMoving.blockID && var12 != Block.waterStill.blockID) + { + if (!par7 && var12 == Block.doorWood.blockID) + { + return 0; + } + } + else + { + if (par5) + { + return -1; + } + + var8 = true; + } + + Block var13 = Block.blocksList[var12]; + int var14 = var13.getRenderType(); + + if (par0Entity.worldObj.blockGetRenderType(var9, var10, var11) == 9) + { + int var18 = MathHelper.floor_double(par0Entity.posX); + int var16 = MathHelper.floor_double(par0Entity.posY); + int var17 = MathHelper.floor_double(par0Entity.posZ); + + if (par0Entity.worldObj.blockGetRenderType(var18, var16, var17) != 9 && par0Entity.worldObj.blockGetRenderType(var18, var16 - 1, var17) != 9) + { + return -3; + } + } + else if (!var13.getBlocksMovement(par0Entity.worldObj, var9, var10, var11) && (!par6 || var12 != Block.doorWood.blockID)) + { + if (var14 == 11 || var12 == Block.fenceGate.blockID || var14 == 32) + { + return -3; + } + + if (var12 == Block.trapdoor.blockID) + { + return -4; + } + + Material var15 = var13.blockMaterial; + + if (var15 != Material.lava) + { + return 0; + } + + if (!par0Entity.handleLavaMovement()) + { + return -2; + } + } + } + } + } + } + + return var8 ? 2 : 1; + } + + /** + * Returns a new PathEntity for a given start and end point + */ + private PathEntity createEntityPath(PathPoint par1PathPoint, PathPoint par2PathPoint) + { + int var3 = 1; + PathPoint var4; + + for (var4 = par2PathPoint; var4.previous != null; var4 = var4.previous) + { + ++var3; + } + + PathPoint[] var5 = new PathPoint[var3]; + var4 = par2PathPoint; + --var3; + + for (var5[var3] = par2PathPoint; var4.previous != null; var5[var3] = var4) + { + var4 = var4.previous; + --var3; + } + + return new PathEntity(var5); + } +} diff --git a/src/main/java/net/minecraft/src/PathNavigate.java b/src/main/java/net/minecraft/src/PathNavigate.java new file mode 100644 index 0000000..99d2458 --- /dev/null +++ b/src/main/java/net/minecraft/src/PathNavigate.java @@ -0,0 +1,524 @@ +package net.minecraft.src; + +public class PathNavigate +{ + private EntityLiving theEntity; + private World worldObj; + + /** The PathEntity being followed. */ + private PathEntity currentPath; + private double speed; + + /** + * The number of blocks (extra) +/- in each axis that get pulled out as cache for the pathfinder's search space + */ + private AttributeInstance pathSearchRange; + private boolean noSunPathfind; + + /** Time, in number of ticks, following the current path */ + private int totalTicks; + + /** + * The time when the last position check was done (to detect successful movement) + */ + private int ticksAtLastPos; + + /** + * Coordinates of the entity's position last time a check was done (part of monitoring getting 'stuck') + */ + private Vec3 lastPosCheck = Vec3.createVectorHelper(0.0D, 0.0D, 0.0D); + + /** + * Specifically, if a wooden door block is even considered to be passable by the pathfinder + */ + private boolean canPassOpenWoodenDoors = true; + + /** If door blocks are considered passable even when closed */ + private boolean canPassClosedWoodenDoors; + + /** If water blocks are avoided (at least by the pathfinder) */ + private boolean avoidsWater; + + /** + * If the entity can swim. Swimming AI enables this and the pathfinder will also cause the entity to swim straight + * upwards when underwater + */ + private boolean canSwim; + + public PathNavigate(EntityLiving par1EntityLiving, World par2World) + { + this.theEntity = par1EntityLiving; + this.worldObj = par2World; + this.pathSearchRange = par1EntityLiving.getEntityAttribute(SharedMonsterAttributes.followRange); + } + + public void setAvoidsWater(boolean par1) + { + this.avoidsWater = par1; + } + + public boolean getAvoidsWater() + { + return this.avoidsWater; + } + + public void setBreakDoors(boolean par1) + { + this.canPassClosedWoodenDoors = par1; + } + + /** + * Sets if the entity can enter open doors + */ + public void setEnterDoors(boolean par1) + { + this.canPassOpenWoodenDoors = par1; + } + + /** + * Returns true if the entity can break doors, false otherwise + */ + public boolean getCanBreakDoors() + { + return this.canPassClosedWoodenDoors; + } + + /** + * Sets if the path should avoid sunlight + */ + public void setAvoidSun(boolean par1) + { + this.noSunPathfind = par1; + } + + /** + * Sets the speed + */ + public void setSpeed(double par1) + { + this.speed = par1; + } + + /** + * Sets if the entity can swim + */ + public void setCanSwim(boolean par1) + { + this.canSwim = par1; + } + + public float func_111269_d() + { + return (float)this.pathSearchRange.getAttributeValue(); + } + + /** + * Returns the path to the given coordinates + */ + public PathEntity getPathToXYZ(double par1, double par3, double par5) + { + return !this.canNavigate() ? null : this.worldObj.getEntityPathToXYZ(this.theEntity, MathHelper.floor_double(par1), (int)par3, MathHelper.floor_double(par5), this.func_111269_d(), this.canPassOpenWoodenDoors, this.canPassClosedWoodenDoors, this.avoidsWater, this.canSwim); + } + + /** + * Try to find and set a path to XYZ. Returns true if successful. + */ + public boolean tryMoveToXYZ(double par1, double par3, double par5, double par7) + { + PathEntity var9 = this.getPathToXYZ((double)MathHelper.floor_double(par1), (double)((int)par3), (double)MathHelper.floor_double(par5)); + return this.setPath(var9, par7); + } + + /** + * Returns the path to the given EntityLiving + */ + public PathEntity getPathToEntityLiving(Entity par1Entity) + { + return !this.canNavigate() ? null : this.worldObj.getPathEntityToEntity(this.theEntity, par1Entity, this.func_111269_d(), this.canPassOpenWoodenDoors, this.canPassClosedWoodenDoors, this.avoidsWater, this.canSwim); + } + + /** + * Try to find and set a path to EntityLiving. Returns true if successful. + */ + public boolean tryMoveToEntityLiving(Entity par1Entity, double par2) + { + PathEntity var4 = this.getPathToEntityLiving(par1Entity); + return var4 != null ? this.setPath(var4, par2) : false; + } + + /** + * sets the active path data if path is 100% unique compared to old path, checks to adjust path for sun avoiding + * ents and stores end coords + */ + public boolean setPath(PathEntity par1PathEntity, double par2) + { + if (par1PathEntity == null) + { + this.currentPath = null; + return false; + } + else + { + if (!par1PathEntity.isSamePath(this.currentPath)) + { + this.currentPath = par1PathEntity; + } + + if (this.noSunPathfind) + { + this.removeSunnyPath(); + } + + if (this.currentPath.getCurrentPathLength() == 0) + { + return false; + } + else + { + this.speed = par2; + Vec3 var4 = this.getEntityPosition(); + this.ticksAtLastPos = this.totalTicks; + this.lastPosCheck.xCoord = var4.xCoord; + this.lastPosCheck.yCoord = var4.yCoord; + this.lastPosCheck.zCoord = var4.zCoord; + return true; + } + } + } + + /** + * gets the actively used PathEntity + */ + public PathEntity getPath() + { + return this.currentPath; + } + + public void onUpdateNavigation() + { + ++this.totalTicks; + + if (!this.noPath()) + { + if (this.canNavigate()) + { + this.pathFollow(); + } + + if (!this.noPath()) + { + Vec3 var1 = this.currentPath.getPosition(this.theEntity); + + if (var1 != null) + { + this.theEntity.getMoveHelper().setMoveTo(var1.xCoord, var1.yCoord, var1.zCoord, this.speed); + } + } + } + } + + private void pathFollow() + { + Vec3 var1 = this.getEntityPosition(); + int var2 = this.currentPath.getCurrentPathLength(); + + for (int var3 = this.currentPath.getCurrentPathIndex(); var3 < this.currentPath.getCurrentPathLength(); ++var3) + { + if (this.currentPath.getPathPointFromIndex(var3).yCoord != (int)var1.yCoord) + { + var2 = var3; + break; + } + } + + float var8 = this.theEntity.width * this.theEntity.width; + int var4; + + for (var4 = this.currentPath.getCurrentPathIndex(); var4 < var2; ++var4) + { + if (var1.squareDistanceTo(this.currentPath.getVectorFromIndex(this.theEntity, var4)) < (double)var8) + { + this.currentPath.setCurrentPathIndex(var4 + 1); + } + } + + var4 = MathHelper.ceiling_float_int(this.theEntity.width); + int var5 = (int)this.theEntity.height + 1; + int var6 = var4; + + for (int var7 = var2 - 1; var7 >= this.currentPath.getCurrentPathIndex(); --var7) + { + if (this.isDirectPathBetweenPoints(var1, this.currentPath.getVectorFromIndex(this.theEntity, var7), var4, var5, var6)) + { + this.currentPath.setCurrentPathIndex(var7); + break; + } + } + + if (this.totalTicks - this.ticksAtLastPos > 100) + { + if (var1.squareDistanceTo(this.lastPosCheck) < 2.25D) + { + this.clearPathEntity(); + } + + this.ticksAtLastPos = this.totalTicks; + this.lastPosCheck.xCoord = var1.xCoord; + this.lastPosCheck.yCoord = var1.yCoord; + this.lastPosCheck.zCoord = var1.zCoord; + } + } + + /** + * If null path or reached the end + */ + public boolean noPath() + { + return this.currentPath == null || this.currentPath.isFinished(); + } + + /** + * sets active PathEntity to null + */ + public void clearPathEntity() + { + this.currentPath = null; + } + + private Vec3 getEntityPosition() + { + return this.worldObj.getWorldVec3Pool().getVecFromPool(this.theEntity.posX, (double)this.getPathableYPos(), this.theEntity.posZ); + } + + /** + * Gets the safe pathing Y position for the entity depending on if it can path swim or not + */ + private int getPathableYPos() + { + if (this.theEntity.isInWater() && this.canSwim) + { + int var1 = (int)this.theEntity.boundingBox.minY; + int var2 = this.worldObj.getBlockId(MathHelper.floor_double(this.theEntity.posX), var1, MathHelper.floor_double(this.theEntity.posZ)); + int var3 = 0; + + do + { + if (var2 != Block.waterMoving.blockID && var2 != Block.waterStill.blockID) + { + return var1; + } + + ++var1; + var2 = this.worldObj.getBlockId(MathHelper.floor_double(this.theEntity.posX), var1, MathHelper.floor_double(this.theEntity.posZ)); + ++var3; + } + while (var3 <= 16); + + return (int)this.theEntity.boundingBox.minY; + } + else + { + return (int)(this.theEntity.boundingBox.minY + 0.5D); + } + } + + /** + * If on ground or swimming and can swim + */ + private boolean canNavigate() + { + return this.theEntity.onGround || this.canSwim && this.isInFluid(); + } + + /** + * Returns true if the entity is in water or lava, false otherwise + */ + private boolean isInFluid() + { + return this.theEntity.isInWater() || this.theEntity.handleLavaMovement(); + } + + /** + * Trims path data from the end to the first sun covered block + */ + private void removeSunnyPath() + { + if (!this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.theEntity.posX), (int)(this.theEntity.boundingBox.minY + 0.5D), MathHelper.floor_double(this.theEntity.posZ))) + { + for (int var1 = 0; var1 < this.currentPath.getCurrentPathLength(); ++var1) + { + PathPoint var2 = this.currentPath.getPathPointFromIndex(var1); + + if (this.worldObj.canBlockSeeTheSky(var2.xCoord, var2.yCoord, var2.zCoord)) + { + this.currentPath.setCurrentPathLength(var1 - 1); + return; + } + } + } + } + + /** + * Returns true when an entity of specified size could safely walk in a straight line between the two points. Args: + * pos1, pos2, entityXSize, entityYSize, entityZSize + */ + private boolean isDirectPathBetweenPoints(Vec3 par1Vec3, Vec3 par2Vec3, int par3, int par4, int par5) + { + int var6 = MathHelper.floor_double(par1Vec3.xCoord); + int var7 = MathHelper.floor_double(par1Vec3.zCoord); + double var8 = par2Vec3.xCoord - par1Vec3.xCoord; + double var10 = par2Vec3.zCoord - par1Vec3.zCoord; + double var12 = var8 * var8 + var10 * var10; + + if (var12 < 1.0E-8D) + { + return false; + } + else + { + double var14 = 1.0D / Math.sqrt(var12); + var8 *= var14; + var10 *= var14; + par3 += 2; + par5 += 2; + + if (!this.isSafeToStandAt(var6, (int)par1Vec3.yCoord, var7, par3, par4, par5, par1Vec3, var8, var10)) + { + return false; + } + else + { + par3 -= 2; + par5 -= 2; + double var16 = 1.0D / Math.abs(var8); + double var18 = 1.0D / Math.abs(var10); + double var20 = (double)(var6 * 1) - par1Vec3.xCoord; + double var22 = (double)(var7 * 1) - par1Vec3.zCoord; + + if (var8 >= 0.0D) + { + ++var20; + } + + if (var10 >= 0.0D) + { + ++var22; + } + + var20 /= var8; + var22 /= var10; + int var24 = var8 < 0.0D ? -1 : 1; + int var25 = var10 < 0.0D ? -1 : 1; + int var26 = MathHelper.floor_double(par2Vec3.xCoord); + int var27 = MathHelper.floor_double(par2Vec3.zCoord); + int var28 = var26 - var6; + int var29 = var27 - var7; + + do + { + if (var28 * var24 <= 0 && var29 * var25 <= 0) + { + return true; + } + + if (var20 < var22) + { + var20 += var16; + var6 += var24; + var28 = var26 - var6; + } + else + { + var22 += var18; + var7 += var25; + var29 = var27 - var7; + } + } + while (this.isSafeToStandAt(var6, (int)par1Vec3.yCoord, var7, par3, par4, par5, par1Vec3, var8, var10)); + + return false; + } + } + } + + /** + * Returns true when an entity could stand at a position, including solid blocks under the entire entity. Args: + * xOffset, yOffset, zOffset, entityXSize, entityYSize, entityZSize, originPosition, vecX, vecZ + */ + private boolean isSafeToStandAt(int par1, int par2, int par3, int par4, int par5, int par6, Vec3 par7Vec3, double par8, double par10) + { + int var12 = par1 - par4 / 2; + int var13 = par3 - par6 / 2; + + if (!this.isPositionClear(var12, par2, var13, par4, par5, par6, par7Vec3, par8, par10)) + { + return false; + } + else + { + for (int var14 = var12; var14 < var12 + par4; ++var14) + { + for (int var15 = var13; var15 < var13 + par6; ++var15) + { + double var16 = (double)var14 + 0.5D - par7Vec3.xCoord; + double var18 = (double)var15 + 0.5D - par7Vec3.zCoord; + + if (var16 * par8 + var18 * par10 >= 0.0D) + { + int var20 = this.worldObj.getBlockId(var14, par2 - 1, var15); + + if (var20 <= 0) + { + return false; + } + + Material var21 = Block.blocksList[var20].blockMaterial; + + if (var21 == Material.water && !this.theEntity.isInWater()) + { + return false; + } + + if (var21 == Material.lava) + { + return false; + } + } + } + } + + return true; + } + } + + /** + * Returns true if an entity does not collide with any solid blocks at the position. Args: xOffset, yOffset, + * zOffset, entityXSize, entityYSize, entityZSize, originPosition, vecX, vecZ + */ + private boolean isPositionClear(int par1, int par2, int par3, int par4, int par5, int par6, Vec3 par7Vec3, double par8, double par10) + { + for (int var12 = par1; var12 < par1 + par4; ++var12) + { + for (int var13 = par2; var13 < par2 + par5; ++var13) + { + for (int var14 = par3; var14 < par3 + par6; ++var14) + { + double var15 = (double)var12 + 0.5D - par7Vec3.xCoord; + double var17 = (double)var14 + 0.5D - par7Vec3.zCoord; + + if (var15 * par8 + var17 * par10 >= 0.0D) + { + int var19 = this.worldObj.getBlockId(var12, var13, var14); + + if (var19 > 0 && !Block.blocksList[var19].getBlocksMovement(this.worldObj, var12, var13, var14)) + { + return false; + } + } + } + } + } + + return true; + } +} diff --git a/src/main/java/net/minecraft/src/PathPoint.java b/src/main/java/net/minecraft/src/PathPoint.java new file mode 100644 index 0000000..d1bec9e --- /dev/null +++ b/src/main/java/net/minecraft/src/PathPoint.java @@ -0,0 +1,97 @@ +package net.minecraft.src; + +public class PathPoint +{ + /** The x coordinate of this point */ + public final int xCoord; + + /** The y coordinate of this point */ + public final int yCoord; + + /** The z coordinate of this point */ + public final int zCoord; + + /** A hash of the coordinates used to identify this point */ + private final int hash; + + /** The index of this point in its assigned path */ + int index = -1; + + /** The distance along the path to this point */ + float totalPathDistance; + + /** The linear distance to the next point */ + float distanceToNext; + + /** The distance to the target */ + float distanceToTarget; + + /** The point preceding this in its assigned path */ + PathPoint previous; + + /** Indicates this is the origin */ + public boolean isFirst; + + public PathPoint(int par1, int par2, int par3) + { + this.xCoord = par1; + this.yCoord = par2; + this.zCoord = par3; + this.hash = makeHash(par1, par2, par3); + } + + public static int makeHash(int par0, int par1, int par2) + { + return par1 & 255 | (par0 & 32767) << 8 | (par2 & 32767) << 24 | (par0 < 0 ? Integer.MIN_VALUE : 0) | (par2 < 0 ? 32768 : 0); + } + + /** + * Returns the linear distance to another path point + */ + public float distanceTo(PathPoint par1PathPoint) + { + float var2 = (float)(par1PathPoint.xCoord - this.xCoord); + float var3 = (float)(par1PathPoint.yCoord - this.yCoord); + float var4 = (float)(par1PathPoint.zCoord - this.zCoord); + return MathHelper.sqrt_float(var2 * var2 + var3 * var3 + var4 * var4); + } + + public float func_75832_b(PathPoint par1PathPoint) + { + float var2 = (float)(par1PathPoint.xCoord - this.xCoord); + float var3 = (float)(par1PathPoint.yCoord - this.yCoord); + float var4 = (float)(par1PathPoint.zCoord - this.zCoord); + return var2 * var2 + var3 * var3 + var4 * var4; + } + + public boolean equals(Object par1Obj) + { + if (!(par1Obj instanceof PathPoint)) + { + return false; + } + else + { + PathPoint var2 = (PathPoint)par1Obj; + return this.hash == var2.hash && this.xCoord == var2.xCoord && this.yCoord == var2.yCoord && this.zCoord == var2.zCoord; + } + } + + public int hashCode() + { + return this.hash; + } + + /** + * Returns true if this point has already been assigned to a path + */ + public boolean isAssigned() + { + return this.index >= 0; + } + + public String toString() + { + return this.xCoord + ", " + this.yCoord + ", " + this.zCoord; + } +} diff --git a/src/main/java/net/minecraft/src/PendingInvite.java b/src/main/java/net/minecraft/src/PendingInvite.java new file mode 100644 index 0000000..c4f7e94 --- /dev/null +++ b/src/main/java/net/minecraft/src/PendingInvite.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +import argo.jdom.JsonNode; + +public class PendingInvite extends ValueObject +{ + public String field_130094_a; + public String field_130092_b; + public String field_130093_c; + + public static PendingInvite func_130091_a(JsonNode par0JsonNode) + { + PendingInvite var1 = new PendingInvite(); + + try + { + var1.field_130094_a = par0JsonNode.getStringValue(new Object[] {"invitationId"}); + var1.field_130092_b = par0JsonNode.getStringValue(new Object[] {"worldName"}); + var1.field_130093_c = par0JsonNode.getStringValue(new Object[] {"worldOwnerName"}); + } + catch (Exception var3) + { + ; + } + + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/PendingInvitesList.java b/src/main/java/net/minecraft/src/PendingInvitesList.java new file mode 100644 index 0000000..39c64be --- /dev/null +++ b/src/main/java/net/minecraft/src/PendingInvitesList.java @@ -0,0 +1,41 @@ +package net.minecraft.src; + +import argo.jdom.JdomParser; +import argo.jdom.JsonNode; +import argo.jdom.JsonRootNode; +import argo.saj.InvalidSyntaxException; +import com.google.common.collect.Lists; +import java.util.Iterator; +import java.util.List; + +public class PendingInvitesList extends ValueObject +{ + public List field_130096_a = Lists.newArrayList(); + + public static PendingInvitesList func_130095_a(String par0Str) + { + PendingInvitesList var1 = new PendingInvitesList(); + + try + { + JsonRootNode var2 = (new JdomParser()).parse(par0Str); + + if (var2.isArrayNode(new Object[] {"invites"})) + { + Iterator var3 = var2.getArrayNode(new Object[] {"invites"}).iterator(); + + while (var3.hasNext()) + { + JsonNode var4 = (JsonNode)var3.next(); + var1.field_130096_a.add(PendingInvite.func_130091_a(var4)); + } + } + } + catch (InvalidSyntaxException var5) + { + ; + } + + return var1; + } +} diff --git a/src/main/java/net/minecraft/src/PlayerCapabilities.java b/src/main/java/net/minecraft/src/PlayerCapabilities.java new file mode 100644 index 0000000..f59f4ce --- /dev/null +++ b/src/main/java/net/minecraft/src/PlayerCapabilities.java @@ -0,0 +1,79 @@ +package net.minecraft.src; + +public class PlayerCapabilities +{ + /** Disables player damage. */ + public boolean disableDamage; + + /** Sets/indicates whether the player is flying. */ + public boolean isFlying; + + /** whether or not to allow the player to fly when they double jump. */ + public boolean allowFlying; + + /** + * Used to determine if creative mode is enabled, and therefore if items should be depleted on usage + */ + public boolean isCreativeMode; + + /** Indicates whether the player is allowed to modify the surroundings */ + public boolean allowEdit = true; + private float flySpeed = 0.05F; + private float walkSpeed = 0.1F; + + public void writeCapabilitiesToNBT(NBTTagCompound par1NBTTagCompound) + { + NBTTagCompound var2 = new NBTTagCompound(); + var2.setBoolean("invulnerable", this.disableDamage); + var2.setBoolean("flying", this.isFlying); + var2.setBoolean("mayfly", this.allowFlying); + var2.setBoolean("instabuild", this.isCreativeMode); + var2.setBoolean("mayBuild", this.allowEdit); + var2.setFloat("flySpeed", this.flySpeed); + var2.setFloat("walkSpeed", this.walkSpeed); + par1NBTTagCompound.setTag("abilities", var2); + } + + public void readCapabilitiesFromNBT(NBTTagCompound par1NBTTagCompound) + { + if (par1NBTTagCompound.hasKey("abilities")) + { + NBTTagCompound var2 = par1NBTTagCompound.getCompoundTag("abilities"); + this.disableDamage = var2.getBoolean("invulnerable"); + this.isFlying = var2.getBoolean("flying"); + this.allowFlying = var2.getBoolean("mayfly"); + this.isCreativeMode = var2.getBoolean("instabuild"); + + if (var2.hasKey("flySpeed")) + { + this.flySpeed = var2.getFloat("flySpeed"); + this.walkSpeed = var2.getFloat("walkSpeed"); + } + + if (var2.hasKey("mayBuild")) + { + this.allowEdit = var2.getBoolean("mayBuild"); + } + } + } + + public float getFlySpeed() + { + return this.flySpeed; + } + + public void setFlySpeed(float par1) + { + this.flySpeed = par1; + } + + public float getWalkSpeed() + { + return this.walkSpeed; + } + + public void setPlayerWalkSpeed(float par1) + { + this.walkSpeed = par1; + } +} diff --git a/src/main/java/net/minecraft/src/PlayerControllerMP.java b/src/main/java/net/minecraft/src/PlayerControllerMP.java new file mode 100644 index 0000000..6d3e21b --- /dev/null +++ b/src/main/java/net/minecraft/src/PlayerControllerMP.java @@ -0,0 +1,498 @@ +package net.minecraft.src; + +public class PlayerControllerMP +{ + /** The Minecraft instance. */ + private final Minecraft mc; + private final NetClientHandler netClientHandler; + + /** PosX of the current block being destroyed */ + private int currentBlockX = -1; + + /** PosY of the current block being destroyed */ + private int currentBlockY = -1; + + /** PosZ of the current block being destroyed */ + private int currentblockZ = -1; + private ItemStack field_85183_f; + + /** Current block damage (MP) */ + private float curBlockDamageMP; + + /** + * Tick counter, when it hits 4 it resets back to 0 and plays the step sound + */ + private float stepSoundTickCounter; + + /** + * Delays the first damage on the block after the first click on the block + */ + private int blockHitDelay; + + /** Tells if the player is hitting a block */ + private boolean isHittingBlock; + + /** Current game type for the player */ + private EnumGameType currentGameType; + + /** Index of the current item held by the player in the inventory hotbar */ + private int currentPlayerItem; + + public PlayerControllerMP(Minecraft par1Minecraft, NetClientHandler par2NetClientHandler) + { + this.currentGameType = EnumGameType.SURVIVAL; + this.mc = par1Minecraft; + this.netClientHandler = par2NetClientHandler; + } + + /** + * Block dig operation in creative mode (instantly digs the block). + */ + public static void clickBlockCreative(Minecraft par0Minecraft, PlayerControllerMP par1PlayerControllerMP, int par2, int par3, int par4, int par5) + { + if (!par0Minecraft.theWorld.extinguishFire(par0Minecraft.thePlayer, par2, par3, par4, par5)) + { + par1PlayerControllerMP.onPlayerDestroyBlock(par2, par3, par4, par5); + } + } + + /** + * Sets player capabilities depending on current gametype. params: player + */ + public void setPlayerCapabilities(EntityPlayer par1EntityPlayer) + { + this.currentGameType.configurePlayerCapabilities(par1EntityPlayer.capabilities); + } + + /** + * If modified to return true, the player spins around slowly around (0, 68.5, 0). The GUI is disabled, the view is + * set to first person, and both chat and menu are disabled. Unless the server is modified to ignore illegal + * stances, attempting to enter a world at all will result in an immediate kick due to an illegal stance. Appears to + * be left-over debug, or demo code. + */ + public boolean enableEverythingIsScrewedUpMode() + { + return false; + } + + /** + * Sets the game type for the player. + */ + public void setGameType(EnumGameType par1EnumGameType) + { + this.currentGameType = par1EnumGameType; + this.currentGameType.configurePlayerCapabilities(this.mc.thePlayer.capabilities); + } + + /** + * Flips the player around. Args: player + */ + public void flipPlayer(EntityPlayer par1EntityPlayer) + { + par1EntityPlayer.rotationYaw = -180.0F; + } + + public boolean shouldDrawHUD() + { + return this.currentGameType.isSurvivalOrAdventure(); + } + + /** + * Called when a player completes the destruction of a block + */ + public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4) + { + if (this.currentGameType.isAdventure() && !this.mc.thePlayer.isCurrentToolAdventureModeExempt(par1, par2, par3)) + { + return false; + } + else if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword) + { + return false; + } + else + { + WorldClient var5 = this.mc.theWorld; + Block var6 = Block.blocksList[var5.getBlockId(par1, par2, par3)]; + + if (var6 == null) + { + return false; + } + else + { + var5.playAuxSFX(2001, par1, par2, par3, var6.blockID + (var5.getBlockMetadata(par1, par2, par3) << 12)); + int var7 = var5.getBlockMetadata(par1, par2, par3); + boolean var8 = var5.setBlockToAir(par1, par2, par3); + + if (var8) + { + var6.onBlockDestroyedByPlayer(var5, par1, par2, par3, var7); + } + + this.currentBlockY = -1; + + if (!this.currentGameType.isCreative()) + { + ItemStack var9 = this.mc.thePlayer.getCurrentEquippedItem(); + + if (var9 != null) + { + var9.onBlockDestroyed(var5, var6.blockID, par1, par2, par3, this.mc.thePlayer); + + if (var9.stackSize == 0) + { + this.mc.thePlayer.destroyCurrentEquippedItem(); + } + } + } + + return var8; + } + } + } + + /** + * Called by Minecraft class when the player is hitting a block with an item. Args: x, y, z, side + */ + public void clickBlock(int par1, int par2, int par3, int par4) + { + if (!this.currentGameType.isAdventure() || this.mc.thePlayer.isCurrentToolAdventureModeExempt(par1, par2, par3)) + { + if (this.currentGameType.isCreative()) + { + this.netClientHandler.addToSendQueue(new Packet14BlockDig(0, par1, par2, par3, par4)); + clickBlockCreative(this.mc, this, par1, par2, par3, par4); + this.blockHitDelay = 5; + } + else if (!this.isHittingBlock || !this.sameToolAndBlock(par1, par2, par3)) + { + if (this.isHittingBlock) + { + this.netClientHandler.addToSendQueue(new Packet14BlockDig(1, this.currentBlockX, this.currentBlockY, this.currentblockZ, par4)); + } + + this.netClientHandler.addToSendQueue(new Packet14BlockDig(0, par1, par2, par3, par4)); + int var5 = this.mc.theWorld.getBlockId(par1, par2, par3); + + if (var5 > 0 && this.curBlockDamageMP == 0.0F) + { + Block.blocksList[var5].onBlockClicked(this.mc.theWorld, par1, par2, par3, this.mc.thePlayer); + } + + if (var5 > 0 && Block.blocksList[var5].getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, par1, par2, par3) >= 1.0F) + { + this.onPlayerDestroyBlock(par1, par2, par3, par4); + } + else + { + this.isHittingBlock = true; + this.currentBlockX = par1; + this.currentBlockY = par2; + this.currentblockZ = par3; + this.field_85183_f = this.mc.thePlayer.getHeldItem(); + this.curBlockDamageMP = 0.0F; + this.stepSoundTickCounter = 0.0F; + this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.entityId, this.currentBlockX, this.currentBlockY, this.currentblockZ, (int)(this.curBlockDamageMP * 10.0F) - 1); + } + } + } + } + + /** + * Resets current block damage and isHittingBlock + */ + public void resetBlockRemoving() + { + if (this.isHittingBlock) + { + this.netClientHandler.addToSendQueue(new Packet14BlockDig(1, this.currentBlockX, this.currentBlockY, this.currentblockZ, -1)); + } + + this.isHittingBlock = false; + this.curBlockDamageMP = 0.0F; + this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.entityId, this.currentBlockX, this.currentBlockY, this.currentblockZ, -1); + } + + /** + * Called when a player damages a block and updates damage counters + */ + public void onPlayerDamageBlock(int par1, int par2, int par3, int par4) + { + this.syncCurrentPlayItem(); + + if (this.blockHitDelay > 0) + { + --this.blockHitDelay; + } + else if (this.currentGameType.isCreative()) + { + this.blockHitDelay = 5; + this.netClientHandler.addToSendQueue(new Packet14BlockDig(0, par1, par2, par3, par4)); + clickBlockCreative(this.mc, this, par1, par2, par3, par4); + } + else + { + if (this.sameToolAndBlock(par1, par2, par3)) + { + int var5 = this.mc.theWorld.getBlockId(par1, par2, par3); + + if (var5 == 0) + { + this.isHittingBlock = false; + return; + } + + Block var6 = Block.blocksList[var5]; + this.curBlockDamageMP += var6.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, par1, par2, par3); + + if (this.stepSoundTickCounter % 4.0F == 0.0F && var6 != null) + { + this.mc.sndManager.playSound(var6.stepSound.getStepSound(), (float)par1 + 0.5F, (float)par2 + 0.5F, (float)par3 + 0.5F, (var6.stepSound.getVolume() + 1.0F) / 8.0F, var6.stepSound.getPitch() * 0.5F); + } + + ++this.stepSoundTickCounter; + + if (this.curBlockDamageMP >= 1.0F) + { + this.isHittingBlock = false; + this.netClientHandler.addToSendQueue(new Packet14BlockDig(2, par1, par2, par3, par4)); + this.onPlayerDestroyBlock(par1, par2, par3, par4); + this.curBlockDamageMP = 0.0F; + this.stepSoundTickCounter = 0.0F; + this.blockHitDelay = 5; + } + + this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.entityId, this.currentBlockX, this.currentBlockY, this.currentblockZ, (int)(this.curBlockDamageMP * 10.0F) - 1); + } + else + { + this.clickBlock(par1, par2, par3, par4); + } + } + } + + /** + * player reach distance = 4F + */ + public float getBlockReachDistance() + { + return this.currentGameType.isCreative() ? 5.0F : 4.5F; + } + + public void updateController() + { + this.syncCurrentPlayItem(); + this.mc.sndManager.playRandomMusicIfReady(); + } + + private boolean sameToolAndBlock(int par1, int par2, int par3) + { + ItemStack var4 = this.mc.thePlayer.getHeldItem(); + boolean var5 = this.field_85183_f == null && var4 == null; + + if (this.field_85183_f != null && var4 != null) + { + var5 = var4.itemID == this.field_85183_f.itemID && ItemStack.areItemStackTagsEqual(var4, this.field_85183_f) && (var4.isItemStackDamageable() || var4.getItemDamage() == this.field_85183_f.getItemDamage()); + } + + return par1 == this.currentBlockX && par2 == this.currentBlockY && par3 == this.currentblockZ && var5; + } + + /** + * Syncs the current player item with the server + */ + private void syncCurrentPlayItem() + { + int var1 = this.mc.thePlayer.inventory.currentItem; + + if (var1 != this.currentPlayerItem) + { + this.currentPlayerItem = var1; + this.netClientHandler.addToSendQueue(new Packet16BlockItemSwitch(this.currentPlayerItem)); + } + } + + /** + * Handles a players right click. Args: player, world, x, y, z, side, hitVec + */ + public boolean onPlayerRightClick(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7, Vec3 par8Vec3) + { + this.syncCurrentPlayItem(); + float var9 = (float)par8Vec3.xCoord - (float)par4; + float var10 = (float)par8Vec3.yCoord - (float)par5; + float var11 = (float)par8Vec3.zCoord - (float)par6; + boolean var12 = false; + int var13; + + if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) + { + var13 = par2World.getBlockId(par4, par5, par6); + + if (var13 > 0 && Block.blocksList[var13].onBlockActivated(par2World, par4, par5, par6, par1EntityPlayer, par7, var9, var10, var11)) + { + var12 = true; + } + } + + if (!var12 && par3ItemStack != null && par3ItemStack.getItem() instanceof ItemBlock) + { + ItemBlock var16 = (ItemBlock)par3ItemStack.getItem(); + + if (!var16.canPlaceItemBlockOnSide(par2World, par4, par5, par6, par7, par1EntityPlayer, par3ItemStack)) + { + return false; + } + } + + this.netClientHandler.addToSendQueue(new Packet15Place(par4, par5, par6, par7, par1EntityPlayer.inventory.getCurrentItem(), var9, var10, var11)); + + if (var12) + { + return true; + } + else if (par3ItemStack == null) + { + return false; + } + else if (this.currentGameType.isCreative()) + { + var13 = par3ItemStack.getItemDamage(); + int var14 = par3ItemStack.stackSize; + boolean var15 = par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, var9, var10, var11); + par3ItemStack.setItemDamage(var13); + par3ItemStack.stackSize = var14; + return var15; + } + else + { + return par3ItemStack.tryPlaceItemIntoWorld(par1EntityPlayer, par2World, par4, par5, par6, par7, var9, var10, var11); + } + } + + /** + * Notifies the server of things like consuming food, etc... + */ + public boolean sendUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack) + { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet15Place(-1, -1, -1, 255, par1EntityPlayer.inventory.getCurrentItem(), 0.0F, 0.0F, 0.0F)); + int var4 = par3ItemStack.stackSize; + ItemStack var5 = par3ItemStack.useItemRightClick(par2World, par1EntityPlayer); + + if (var5 == par3ItemStack && (var5 == null || var5.stackSize == var4)) + { + return false; + } + else + { + par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = var5; + + if (var5.stackSize == 0) + { + par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null; + } + + return true; + } + } + + public EntityClientPlayerMP func_78754_a(World par1World) + { + return new EntityClientPlayerMP(this.mc, par1World, this.mc.getSession(), this.netClientHandler); + } + + /** + * Attacks an entity + */ + public void attackEntity(EntityPlayer par1EntityPlayer, Entity par2Entity) + { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet7UseEntity(par1EntityPlayer.entityId, par2Entity.entityId, 1)); + par1EntityPlayer.attackTargetEntityWithCurrentItem(par2Entity); + } + + public boolean func_78768_b(EntityPlayer par1EntityPlayer, Entity par2Entity) + { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet7UseEntity(par1EntityPlayer.entityId, par2Entity.entityId, 0)); + return par1EntityPlayer.interactWith(par2Entity); + } + + public ItemStack windowClick(int par1, int par2, int par3, int par4, EntityPlayer par5EntityPlayer) + { + short var6 = par5EntityPlayer.openContainer.getNextTransactionID(par5EntityPlayer.inventory); + ItemStack var7 = par5EntityPlayer.openContainer.slotClick(par2, par3, par4, par5EntityPlayer); + this.netClientHandler.addToSendQueue(new Packet102WindowClick(par1, par2, par3, par4, var7, var6)); + return var7; + } + + /** + * GuiEnchantment uses this during multiplayer to tell PlayerControllerMP to send a packet indicating the + * enchantment action the player has taken. + */ + public void sendEnchantPacket(int par1, int par2) + { + this.netClientHandler.addToSendQueue(new Packet108EnchantItem(par1, par2)); + } + + /** + * Used in PlayerControllerMP to update the server with an ItemStack in a slot. + */ + public void sendSlotPacket(ItemStack par1ItemStack, int par2) + { + if (this.currentGameType.isCreative()) + { + this.netClientHandler.addToSendQueue(new Packet107CreativeSetSlot(par2, par1ItemStack)); + } + } + + public void func_78752_a(ItemStack par1ItemStack) + { + if (this.currentGameType.isCreative() && par1ItemStack != null) + { + this.netClientHandler.addToSendQueue(new Packet107CreativeSetSlot(-1, par1ItemStack)); + } + } + + public void onStoppedUsingItem(EntityPlayer par1EntityPlayer) + { + this.syncCurrentPlayItem(); + this.netClientHandler.addToSendQueue(new Packet14BlockDig(5, 0, 0, 0, 255)); + par1EntityPlayer.stopUsingItem(); + } + + public boolean func_78763_f() + { + return this.currentGameType.isSurvivalOrAdventure(); + } + + /** + * Checks if the player is not creative, used for checking if it should break a block instantly + */ + public boolean isNotCreative() + { + return !this.currentGameType.isCreative(); + } + + /** + * returns true if player is in creative mode + */ + public boolean isInCreativeMode() + { + return this.currentGameType.isCreative(); + } + + /** + * true for hitting entities far away. + */ + public boolean extendedReach() + { + return this.currentGameType.isCreative(); + } + + public boolean func_110738_j() + { + return this.mc.thePlayer.isRiding() && this.mc.thePlayer.ridingEntity instanceof EntityHorse; + } +} diff --git a/src/main/java/net/minecraft/src/PlayerInstance.java b/src/main/java/net/minecraft/src/PlayerInstance.java new file mode 100644 index 0000000..a505201 --- /dev/null +++ b/src/main/java/net/minecraft/src/PlayerInstance.java @@ -0,0 +1,222 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +class PlayerInstance +{ + private final List playersInChunk; + + /** note: this is final */ + private final ChunkCoordIntPair chunkLocation; + private short[] locationOfBlockChange; + private int numberOfTilesToUpdate; + + /** + * Integer field where each bit means to make update 16x16x16 division of chunk (from bottom). + */ + private int flagsYAreasToUpdate; + + /** time what is using when chunk InhabitedTime is being calculated */ + private long previousWorldTime; + + final PlayerManager thePlayerManager; + + public PlayerInstance(PlayerManager par1PlayerManager, int par2, int par3) + { + this.thePlayerManager = par1PlayerManager; + this.playersInChunk = new ArrayList(); + this.locationOfBlockChange = new short[64]; + this.chunkLocation = new ChunkCoordIntPair(par2, par3); + par1PlayerManager.getWorldServer().theChunkProviderServer.loadChunk(par2, par3); + } + + public void addPlayer(EntityPlayerMP par1EntityPlayerMP) + { + if (this.playersInChunk.contains(par1EntityPlayerMP)) + { + throw new IllegalStateException("Failed to add player. " + par1EntityPlayerMP + " already is in chunk " + this.chunkLocation.chunkXPos + ", " + this.chunkLocation.chunkZPos); + } + else + { + if (this.playersInChunk.isEmpty()) + { + this.previousWorldTime = PlayerManager.getWorldServer(this.thePlayerManager).getTotalWorldTime(); + } + + this.playersInChunk.add(par1EntityPlayerMP); + par1EntityPlayerMP.loadedChunks.add(this.chunkLocation); + } + } + + public void removePlayer(EntityPlayerMP par1EntityPlayerMP) + { + if (this.playersInChunk.contains(par1EntityPlayerMP)) + { + Chunk var2 = PlayerManager.getWorldServer(this.thePlayerManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos); + par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet51MapChunk(var2, true, 0)); + this.playersInChunk.remove(par1EntityPlayerMP); + par1EntityPlayerMP.loadedChunks.remove(this.chunkLocation); + + if (this.playersInChunk.isEmpty()) + { + long var3 = (long)this.chunkLocation.chunkXPos + 2147483647L | (long)this.chunkLocation.chunkZPos + 2147483647L << 32; + this.increaseInhabitedTime(var2); + PlayerManager.getChunkWatchers(this.thePlayerManager).remove(var3); + PlayerManager.getChunkWatcherList(this.thePlayerManager).remove(this); + + if (this.numberOfTilesToUpdate > 0) + { + PlayerManager.getChunkWatchersWithPlayers(this.thePlayerManager).remove(this); + } + + this.thePlayerManager.getWorldServer().theChunkProviderServer.unloadChunksIfNotNearSpawn(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos); + } + } + } + + /** + * This method currently only increases chunk inhabited time. Extension is possible in next versions + */ + public void processChunk() + { + this.increaseInhabitedTime(PlayerManager.getWorldServer(this.thePlayerManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos)); + } + + /** + * Increases chunk inhabited time every 8000 ticks + */ + private void increaseInhabitedTime(Chunk par1Chunk) + { + par1Chunk.inhabitedTime += PlayerManager.getWorldServer(this.thePlayerManager).getTotalWorldTime() - this.previousWorldTime; + this.previousWorldTime = PlayerManager.getWorldServer(this.thePlayerManager).getTotalWorldTime(); + } + + public void flagChunkForUpdate(int par1, int par2, int par3) + { + if (this.numberOfTilesToUpdate == 0) + { + PlayerManager.getChunkWatchersWithPlayers(this.thePlayerManager).add(this); + } + + this.flagsYAreasToUpdate |= 1 << (par2 >> 4); + + if (this.numberOfTilesToUpdate < 64) + { + short var4 = (short)(par1 << 12 | par3 << 8 | par2); + + for (int var5 = 0; var5 < this.numberOfTilesToUpdate; ++var5) + { + if (this.locationOfBlockChange[var5] == var4) + { + return; + } + } + + this.locationOfBlockChange[this.numberOfTilesToUpdate++] = var4; + } + } + + public void sendToAllPlayersWatchingChunk(Packet par1Packet) + { + for (int var2 = 0; var2 < this.playersInChunk.size(); ++var2) + { + EntityPlayerMP var3 = (EntityPlayerMP)this.playersInChunk.get(var2); + + if (!var3.loadedChunks.contains(this.chunkLocation)) + { + var3.playerNetServerHandler.sendPacketToPlayer(par1Packet); + } + } + } + + public void sendChunkUpdate() + { + if (this.numberOfTilesToUpdate != 0) + { + int var1; + int var2; + int var3; + + if (this.numberOfTilesToUpdate == 1) + { + var1 = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[0] >> 12 & 15); + var2 = this.locationOfBlockChange[0] & 255; + var3 = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[0] >> 8 & 15); + this.sendToAllPlayersWatchingChunk(new Packet53BlockChange(var1, var2, var3, PlayerManager.getWorldServer(this.thePlayerManager))); + + if (PlayerManager.getWorldServer(this.thePlayerManager).blockHasTileEntity(var1, var2, var3)) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.thePlayerManager).getBlockTileEntity(var1, var2, var3)); + } + } + else + { + int var4; + + if (this.numberOfTilesToUpdate == 64) + { + var1 = this.chunkLocation.chunkXPos * 16; + var2 = this.chunkLocation.chunkZPos * 16; + this.sendToAllPlayersWatchingChunk(new Packet51MapChunk(PlayerManager.getWorldServer(this.thePlayerManager).getChunkFromChunkCoords(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos), false, this.flagsYAreasToUpdate)); + + for (var3 = 0; var3 < 16; ++var3) + { + if ((this.flagsYAreasToUpdate & 1 << var3) != 0) + { + var4 = var3 << 4; + List var5 = PlayerManager.getWorldServer(this.thePlayerManager).getAllTileEntityInBox(var1, var4, var2, var1 + 16, var4 + 16, var2 + 16); + + for (int var6 = 0; var6 < var5.size(); ++var6) + { + this.sendTileToAllPlayersWatchingChunk((TileEntity)var5.get(var6)); + } + } + } + } + else + { + this.sendToAllPlayersWatchingChunk(new Packet52MultiBlockChange(this.chunkLocation.chunkXPos, this.chunkLocation.chunkZPos, this.locationOfBlockChange, this.numberOfTilesToUpdate, PlayerManager.getWorldServer(this.thePlayerManager))); + + for (var1 = 0; var1 < this.numberOfTilesToUpdate; ++var1) + { + var2 = this.chunkLocation.chunkXPos * 16 + (this.locationOfBlockChange[var1] >> 12 & 15); + var3 = this.locationOfBlockChange[var1] & 255; + var4 = this.chunkLocation.chunkZPos * 16 + (this.locationOfBlockChange[var1] >> 8 & 15); + + if (PlayerManager.getWorldServer(this.thePlayerManager).blockHasTileEntity(var2, var3, var4)) + { + this.sendTileToAllPlayersWatchingChunk(PlayerManager.getWorldServer(this.thePlayerManager).getBlockTileEntity(var2, var3, var4)); + } + } + } + } + + this.numberOfTilesToUpdate = 0; + this.flagsYAreasToUpdate = 0; + } + } + + private void sendTileToAllPlayersWatchingChunk(TileEntity par1TileEntity) + { + if (par1TileEntity != null) + { + Packet var2 = par1TileEntity.getDescriptionPacket(); + + if (var2 != null) + { + this.sendToAllPlayersWatchingChunk(var2); + } + } + } + + static ChunkCoordIntPair getChunkLocation(PlayerInstance par0PlayerInstance) + { + return par0PlayerInstance.chunkLocation; + } + + static List getPlayersInChunk(PlayerInstance par0PlayerInstance) + { + return par0PlayerInstance.playersInChunk; + } +} diff --git a/src/main/java/net/minecraft/src/PlayerManager.java b/src/main/java/net/minecraft/src/PlayerManager.java new file mode 100644 index 0000000..418ae0e --- /dev/null +++ b/src/main/java/net/minecraft/src/PlayerManager.java @@ -0,0 +1,331 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.List; + +public class PlayerManager +{ + private final WorldServer theWorldServer; + + /** players in the current instance */ + private final List players = new ArrayList(); + + /** + * A map of chunk position (two ints concatenated into a long) to PlayerInstance + */ + private final LongHashMap playerInstances = new LongHashMap(); + + /** + * contains a PlayerInstance for every chunk they can see. the "player instance" cotains a list of all players who + * can also that chunk + */ + private final List chunkWatcherWithPlayers = new ArrayList(); + + /** This field is using when chunk should be processed (every 8000 ticks) */ + private final List playerInstanceList = new ArrayList(); + + /** + * Number of chunks the server sends to the client. Valid 3<=x<=15. In server.properties. + */ + private final int playerViewRadius; + + /** time what is using to check if InhabitedTime should be calculated */ + private long previousTotalWorldTime; + + /** x, z direction vectors: east, south, west, north */ + private final int[][] xzDirectionsConst = new int[][] {{1, 0}, {0, 1}, { -1, 0}, {0, -1}}; + + public PlayerManager(WorldServer par1WorldServer, int par2) + { + if (par2 > 15) + { + throw new IllegalArgumentException("Too big view radius!"); + } + else if (par2 < 3) + { + throw new IllegalArgumentException("Too small view radius!"); + } + else + { + this.playerViewRadius = par2; + this.theWorldServer = par1WorldServer; + } + } + + public WorldServer getWorldServer() + { + return this.theWorldServer; + } + + /** + * updates all the player instances that need to be updated + */ + public void updatePlayerInstances() + { + long var1 = this.theWorldServer.getTotalWorldTime(); + int var3; + PlayerInstance var4; + + if (var1 - this.previousTotalWorldTime > 8000L) + { + this.previousTotalWorldTime = var1; + + for (var3 = 0; var3 < this.playerInstanceList.size(); ++var3) + { + var4 = (PlayerInstance)this.playerInstanceList.get(var3); + var4.sendChunkUpdate(); + var4.processChunk(); + } + } + else + { + for (var3 = 0; var3 < this.chunkWatcherWithPlayers.size(); ++var3) + { + var4 = (PlayerInstance)this.chunkWatcherWithPlayers.get(var3); + var4.sendChunkUpdate(); + } + } + + this.chunkWatcherWithPlayers.clear(); + + if (this.players.isEmpty()) + { + WorldProvider var5 = this.theWorldServer.provider; + + if (!var5.canRespawnHere()) + { + this.theWorldServer.theChunkProviderServer.unloadAllChunks(); + } + } + } + + private PlayerInstance getOrCreateChunkWatcher(int par1, int par2, boolean par3) + { + long var4 = (long)par1 + 2147483647L | (long)par2 + 2147483647L << 32; + PlayerInstance var6 = (PlayerInstance)this.playerInstances.getValueByKey(var4); + + if (var6 == null && par3) + { + var6 = new PlayerInstance(this, par1, par2); + this.playerInstances.add(var4, var6); + this.playerInstanceList.add(var6); + } + + return var6; + } + + /** + * Called by WorldManager.markBlockForUpdate; marks a block to be resent to clients. + */ + public void markBlockForUpdate(int par1, int par2, int par3) + { + int var4 = par1 >> 4; + int var5 = par3 >> 4; + PlayerInstance var6 = this.getOrCreateChunkWatcher(var4, var5, false); + + if (var6 != null) + { + var6.flagChunkForUpdate(par1 & 15, par2, par3 & 15); + } + } + + /** + * Adds an EntityPlayerMP to the PlayerManager. + */ + public void addPlayer(EntityPlayerMP par1EntityPlayerMP) + { + int var2 = (int)par1EntityPlayerMP.posX >> 4; + int var3 = (int)par1EntityPlayerMP.posZ >> 4; + par1EntityPlayerMP.managedPosX = par1EntityPlayerMP.posX; + par1EntityPlayerMP.managedPosZ = par1EntityPlayerMP.posZ; + + for (int var4 = var2 - this.playerViewRadius; var4 <= var2 + this.playerViewRadius; ++var4) + { + for (int var5 = var3 - this.playerViewRadius; var5 <= var3 + this.playerViewRadius; ++var5) + { + this.getOrCreateChunkWatcher(var4, var5, true).addPlayer(par1EntityPlayerMP); + } + } + + this.players.add(par1EntityPlayerMP); + this.filterChunkLoadQueue(par1EntityPlayerMP); + } + + /** + * Removes all chunks from the given player's chunk load queue that are not in viewing range of the player. + */ + public void filterChunkLoadQueue(EntityPlayerMP par1EntityPlayerMP) + { + ArrayList var2 = new ArrayList(par1EntityPlayerMP.loadedChunks); + int var3 = 0; + int var4 = this.playerViewRadius; + int var5 = (int)par1EntityPlayerMP.posX >> 4; + int var6 = (int)par1EntityPlayerMP.posZ >> 4; + int var7 = 0; + int var8 = 0; + ChunkCoordIntPair var9 = PlayerInstance.getChunkLocation(this.getOrCreateChunkWatcher(var5, var6, true)); + par1EntityPlayerMP.loadedChunks.clear(); + + if (var2.contains(var9)) + { + par1EntityPlayerMP.loadedChunks.add(var9); + } + + int var10; + + for (var10 = 1; var10 <= var4 * 2; ++var10) + { + for (int var11 = 0; var11 < 2; ++var11) + { + int[] var12 = this.xzDirectionsConst[var3++ % 4]; + + for (int var13 = 0; var13 < var10; ++var13) + { + var7 += var12[0]; + var8 += var12[1]; + var9 = PlayerInstance.getChunkLocation(this.getOrCreateChunkWatcher(var5 + var7, var6 + var8, true)); + + if (var2.contains(var9)) + { + par1EntityPlayerMP.loadedChunks.add(var9); + } + } + } + } + + var3 %= 4; + + for (var10 = 0; var10 < var4 * 2; ++var10) + { + var7 += this.xzDirectionsConst[var3][0]; + var8 += this.xzDirectionsConst[var3][1]; + var9 = PlayerInstance.getChunkLocation(this.getOrCreateChunkWatcher(var5 + var7, var6 + var8, true)); + + if (var2.contains(var9)) + { + par1EntityPlayerMP.loadedChunks.add(var9); + } + } + } + + /** + * Removes an EntityPlayerMP from the PlayerManager. + */ + public void removePlayer(EntityPlayerMP par1EntityPlayerMP) + { + int var2 = (int)par1EntityPlayerMP.managedPosX >> 4; + int var3 = (int)par1EntityPlayerMP.managedPosZ >> 4; + + for (int var4 = var2 - this.playerViewRadius; var4 <= var2 + this.playerViewRadius; ++var4) + { + for (int var5 = var3 - this.playerViewRadius; var5 <= var3 + this.playerViewRadius; ++var5) + { + PlayerInstance var6 = this.getOrCreateChunkWatcher(var4, var5, false); + + if (var6 != null) + { + var6.removePlayer(par1EntityPlayerMP); + } + } + } + + this.players.remove(par1EntityPlayerMP); + } + + /** + * Determine if two rectangles centered at the given points overlap for the provided radius. Arguments: x1, z1, x2, + * z2, radius. + */ + private boolean overlaps(int par1, int par2, int par3, int par4, int par5) + { + int var6 = par1 - par3; + int var7 = par2 - par4; + return var6 >= -par5 && var6 <= par5 ? var7 >= -par5 && var7 <= par5 : false; + } + + /** + * update chunks around a player being moved by server logic (e.g. cart, boat) + */ + public void updateMountedMovingPlayer(EntityPlayerMP par1EntityPlayerMP) + { + int var2 = (int)par1EntityPlayerMP.posX >> 4; + int var3 = (int)par1EntityPlayerMP.posZ >> 4; + double var4 = par1EntityPlayerMP.managedPosX - par1EntityPlayerMP.posX; + double var6 = par1EntityPlayerMP.managedPosZ - par1EntityPlayerMP.posZ; + double var8 = var4 * var4 + var6 * var6; + + if (var8 >= 64.0D) + { + int var10 = (int)par1EntityPlayerMP.managedPosX >> 4; + int var11 = (int)par1EntityPlayerMP.managedPosZ >> 4; + int var12 = this.playerViewRadius; + int var13 = var2 - var10; + int var14 = var3 - var11; + + if (var13 != 0 || var14 != 0) + { + for (int var15 = var2 - var12; var15 <= var2 + var12; ++var15) + { + for (int var16 = var3 - var12; var16 <= var3 + var12; ++var16) + { + if (!this.overlaps(var15, var16, var10, var11, var12)) + { + this.getOrCreateChunkWatcher(var15, var16, true).addPlayer(par1EntityPlayerMP); + } + + if (!this.overlaps(var15 - var13, var16 - var14, var2, var3, var12)) + { + PlayerInstance var17 = this.getOrCreateChunkWatcher(var15 - var13, var16 - var14, false); + + if (var17 != null) + { + var17.removePlayer(par1EntityPlayerMP); + } + } + } + } + + this.filterChunkLoadQueue(par1EntityPlayerMP); + par1EntityPlayerMP.managedPosX = par1EntityPlayerMP.posX; + par1EntityPlayerMP.managedPosZ = par1EntityPlayerMP.posZ; + } + } + } + + public boolean isPlayerWatchingChunk(EntityPlayerMP par1EntityPlayerMP, int par2, int par3) + { + PlayerInstance var4 = this.getOrCreateChunkWatcher(par2, par3, false); + return var4 == null ? false : PlayerInstance.getPlayersInChunk(var4).contains(par1EntityPlayerMP) && !par1EntityPlayerMP.loadedChunks.contains(PlayerInstance.getChunkLocation(var4)); + } + + /** + * Get the furthest viewable block given player's view distance + */ + public static int getFurthestViewableBlock(int par0) + { + return par0 * 16 - 16; + } + + static WorldServer getWorldServer(PlayerManager par0PlayerManager) + { + return par0PlayerManager.theWorldServer; + } + + static LongHashMap getChunkWatchers(PlayerManager par0PlayerManager) + { + return par0PlayerManager.playerInstances; + } + + /** + * Returns player instances as list + */ + static List getChunkWatcherList(PlayerManager par0PlayerManager) + { + return par0PlayerManager.playerInstanceList; + } + + static List getChunkWatchersWithPlayers(PlayerManager par0PlayerManager) + { + return par0PlayerManager.chunkWatcherWithPlayers; + } +} diff --git a/src/main/java/net/minecraft/src/PlayerNotFoundException.java b/src/main/java/net/minecraft/src/PlayerNotFoundException.java new file mode 100644 index 0000000..8c2ecf8 --- /dev/null +++ b/src/main/java/net/minecraft/src/PlayerNotFoundException.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +public class PlayerNotFoundException extends CommandException +{ + public PlayerNotFoundException() + { + this("commands.generic.player.notFound", new Object[0]); + } + + public PlayerNotFoundException(String par1Str, Object ... par2ArrayOfObj) + { + super(par1Str, par2ArrayOfObj); + } +} diff --git a/src/main/java/net/minecraft/src/PlayerPositionComparator.java b/src/main/java/net/minecraft/src/PlayerPositionComparator.java new file mode 100644 index 0000000..883585a --- /dev/null +++ b/src/main/java/net/minecraft/src/PlayerPositionComparator.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +import java.util.Comparator; + +public class PlayerPositionComparator implements Comparator +{ + private final ChunkCoordinates theChunkCoordinates; + + public PlayerPositionComparator(ChunkCoordinates par1ChunkCoordinates) + { + this.theChunkCoordinates = par1ChunkCoordinates; + } + + /** + * Compare the position of two players. + */ + public int comparePlayers(EntityPlayerMP par1EntityPlayerMP, EntityPlayerMP par2EntityPlayerMP) + { + double var3 = par1EntityPlayerMP.getDistanceSq((double)this.theChunkCoordinates.posX, (double)this.theChunkCoordinates.posY, (double)this.theChunkCoordinates.posZ); + double var5 = par2EntityPlayerMP.getDistanceSq((double)this.theChunkCoordinates.posX, (double)this.theChunkCoordinates.posY, (double)this.theChunkCoordinates.posZ); + return var3 < var5 ? -1 : (var3 > var5 ? 1 : 0); + } + + public int compare(Object par1Obj, Object par2Obj) + { + return this.comparePlayers((EntityPlayerMP)par1Obj, (EntityPlayerMP)par2Obj); + } +} diff --git a/src/main/java/net/minecraft/src/PlayerSelector.java b/src/main/java/net/minecraft/src/PlayerSelector.java new file mode 100644 index 0000000..d50dc33 --- /dev/null +++ b/src/main/java/net/minecraft/src/PlayerSelector.java @@ -0,0 +1,343 @@ +package net.minecraft.src; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import net.minecraft.server.MinecraftServer; + +public class PlayerSelector +{ + /** + * This matches the at-tokens introduced for command blocks, including their arguments, if any. + */ + private static final Pattern tokenPattern = Pattern.compile("^@([parf])(?:\\[([\\w=,!-]*)\\])?$"); + + /** + * This matches things like "-1,,4", and is used for getting x,y,z,range from the token's argument list. + */ + private static final Pattern intListPattern = Pattern.compile("\\G([-!]?[\\w-]*)(?:$|,)"); + + /** + * This matches things like "rm=4,c=2" and is used for handling named token arguments. + */ + private static final Pattern keyValueListPattern = Pattern.compile("\\G(\\w+)=([-!]?[\\w-]*)(?:$|,)"); + + /** + * Returns the one player that matches the given at-token. Returns null if more than one player matches. + */ + public static EntityPlayerMP matchOnePlayer(ICommandSender par0ICommandSender, String par1Str) + { + EntityPlayerMP[] var2 = matchPlayers(par0ICommandSender, par1Str); + return var2 != null && var2.length == 1 ? var2[0] : null; + } + + /** + * Returns a nicely-formatted string listing the matching players. + */ + public static String matchPlayersAsString(ICommandSender par0ICommandSender, String par1Str) + { + EntityPlayerMP[] var2 = matchPlayers(par0ICommandSender, par1Str); + + if (var2 != null && var2.length != 0) + { + String[] var3 = new String[var2.length]; + + for (int var4 = 0; var4 < var3.length; ++var4) + { + var3[var4] = var2[var4].getTranslatedEntityName(); + } + + return CommandBase.joinNiceString(var3); + } + else + { + return null; + } + } + + /** + * Returns an array of all players matched by the given at-token. + */ + public static EntityPlayerMP[] matchPlayers(ICommandSender par0ICommandSender, String par1Str) + { + Matcher var2 = tokenPattern.matcher(par1Str); + + if (!var2.matches()) + { + return null; + } + else + { + Map var3 = getArgumentMap(var2.group(2)); + String var4 = var2.group(1); + int var5 = getDefaultMinimumRange(var4); + int var6 = getDefaultMaximumRange(var4); + int var7 = getDefaultMinimumLevel(var4); + int var8 = getDefaultMaximumLevel(var4); + int var9 = getDefaultCount(var4); + int var10 = EnumGameType.NOT_SET.getID(); + ChunkCoordinates var11 = par0ICommandSender.getPlayerCoordinates(); + Map var12 = func_96560_a(var3); + String var13 = null; + String var14 = null; + boolean var15 = false; + + if (var3.containsKey("rm")) + { + var5 = MathHelper.parseIntWithDefault((String)var3.get("rm"), var5); + var15 = true; + } + + if (var3.containsKey("r")) + { + var6 = MathHelper.parseIntWithDefault((String)var3.get("r"), var6); + var15 = true; + } + + if (var3.containsKey("lm")) + { + var7 = MathHelper.parseIntWithDefault((String)var3.get("lm"), var7); + } + + if (var3.containsKey("l")) + { + var8 = MathHelper.parseIntWithDefault((String)var3.get("l"), var8); + } + + if (var3.containsKey("x")) + { + var11.posX = MathHelper.parseIntWithDefault((String)var3.get("x"), var11.posX); + var15 = true; + } + + if (var3.containsKey("y")) + { + var11.posY = MathHelper.parseIntWithDefault((String)var3.get("y"), var11.posY); + var15 = true; + } + + if (var3.containsKey("z")) + { + var11.posZ = MathHelper.parseIntWithDefault((String)var3.get("z"), var11.posZ); + var15 = true; + } + + if (var3.containsKey("m")) + { + var10 = MathHelper.parseIntWithDefault((String)var3.get("m"), var10); + } + + if (var3.containsKey("c")) + { + var9 = MathHelper.parseIntWithDefault((String)var3.get("c"), var9); + } + + if (var3.containsKey("team")) + { + var14 = (String)var3.get("team"); + } + + if (var3.containsKey("name")) + { + var13 = (String)var3.get("name"); + } + + World var16 = var15 ? par0ICommandSender.getEntityWorld() : null; + List var17; + + if (!var4.equals("p") && !var4.equals("a")) + { + if (!var4.equals("r")) + { + return null; + } + else + { + var17 = MinecraftServer.getServer().getConfigurationManager().findPlayers(var11, var5, var6, 0, var10, var7, var8, var12, var13, var14, var16); + Collections.shuffle(var17); + var17 = var17.subList(0, Math.min(var9, var17.size())); + return var17 != null && !var17.isEmpty() ? (EntityPlayerMP[])var17.toArray(new EntityPlayerMP[0]) : new EntityPlayerMP[0]; + } + } + else + { + var17 = MinecraftServer.getServer().getConfigurationManager().findPlayers(var11, var5, var6, var9, var10, var7, var8, var12, var13, var14, var16); + return var17 != null && !var17.isEmpty() ? (EntityPlayerMP[])var17.toArray(new EntityPlayerMP[0]) : new EntityPlayerMP[0]; + } + } + } + + public static Map func_96560_a(Map par0Map) + { + HashMap var1 = new HashMap(); + Iterator var2 = par0Map.keySet().iterator(); + + while (var2.hasNext()) + { + String var3 = (String)var2.next(); + + if (var3.startsWith("score_") && var3.length() > "score_".length()) + { + String var4 = var3.substring("score_".length()); + var1.put(var4, Integer.valueOf(MathHelper.parseIntWithDefault((String)par0Map.get(var3), 1))); + } + } + + return var1; + } + + /** + * Returns whether the given pattern can match more than one player. + */ + public static boolean matchesMultiplePlayers(String par0Str) + { + Matcher var1 = tokenPattern.matcher(par0Str); + + if (var1.matches()) + { + Map var2 = getArgumentMap(var1.group(2)); + String var3 = var1.group(1); + int var4 = getDefaultCount(var3); + + if (var2.containsKey("c")) + { + var4 = MathHelper.parseIntWithDefault((String)var2.get("c"), var4); + } + + return var4 != 1; + } + else + { + return false; + } + } + + /** + * Returns whether the given token (parameter 1) has exactly the given arguments (parameter 2). + */ + public static boolean hasTheseArguments(String par0Str, String par1Str) + { + Matcher var2 = tokenPattern.matcher(par0Str); + + if (var2.matches()) + { + String var3 = var2.group(1); + return par1Str == null || par1Str.equals(var3); + } + else + { + return false; + } + } + + /** + * Returns whether the given token has any arguments set. + */ + public static boolean hasArguments(String par0Str) + { + return hasTheseArguments(par0Str, (String)null); + } + + /** + * Gets the default minimum range (argument rm). + */ + private static final int getDefaultMinimumRange(String par0Str) + { + return 0; + } + + /** + * Gets the default maximum range (argument r). + */ + private static final int getDefaultMaximumRange(String par0Str) + { + return 0; + } + + /** + * Gets the default maximum experience level (argument l) + */ + private static final int getDefaultMaximumLevel(String par0Str) + { + return Integer.MAX_VALUE; + } + + /** + * Gets the default minimum experience level (argument lm) + */ + private static final int getDefaultMinimumLevel(String par0Str) + { + return 0; + } + + /** + * Gets the default number of players to return (argument c, 0 for infinite) + */ + private static final int getDefaultCount(String par0Str) + { + return par0Str.equals("a") ? 0 : 1; + } + + /** + * Parses the given argument string, turning it into a HashMap<String, String> of name->value. + */ + private static Map getArgumentMap(String par0Str) + { + HashMap var1 = new HashMap(); + + if (par0Str == null) + { + return var1; + } + else + { + Matcher var2 = intListPattern.matcher(par0Str); + int var3 = 0; + int var4; + + for (var4 = -1; var2.find(); var4 = var2.end()) + { + String var5 = null; + + switch (var3++) + { + case 0: + var5 = "x"; + break; + + case 1: + var5 = "y"; + break; + + case 2: + var5 = "z"; + break; + + case 3: + var5 = "r"; + } + + if (var5 != null && var2.group(1).length() > 0) + { + var1.put(var5, var2.group(1)); + } + } + + if (var4 < par0Str.length()) + { + var2 = keyValueListPattern.matcher(var4 == -1 ? par0Str : par0Str.substring(var4)); + + while (var2.find()) + { + var1.put(var2.group(1), var2.group(2)); + } + } + + return var1; + } + } +} diff --git a/src/main/java/net/minecraft/src/PlayerUsageSnooper.java b/src/main/java/net/minecraft/src/PlayerUsageSnooper.java new file mode 100644 index 0000000..486a896 --- /dev/null +++ b/src/main/java/net/minecraft/src/PlayerUsageSnooper.java @@ -0,0 +1,183 @@ +package net.minecraft.src; + +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.Map.Entry; + +public class PlayerUsageSnooper +{ + /** String map for report data */ + private Map dataMap = new HashMap(); + private final String uniqueID = UUID.randomUUID().toString(); + + /** URL of the server to send the report to */ + private final URL serverUrl; + private final IPlayerUsage playerStatsCollector; + + /** set to fire the snooperThread every 15 mins */ + private final java.util.Timer threadTrigger = new java.util.Timer("Snooper Timer", true); + private final Object syncLock = new Object(); + private final long field_98224_g; + private boolean isRunning; + + /** incremented on every getSelfCounterFor */ + private int selfCounter; + + public PlayerUsageSnooper(String par1Str, IPlayerUsage par2IPlayerUsage, long par3) + { + try + { + this.serverUrl = new URL("http://snoop.minecraft.net/" + par1Str + "?version=" + 1); + } + catch (MalformedURLException var6) + { + throw new IllegalArgumentException(); + } + + this.playerStatsCollector = par2IPlayerUsage; + this.field_98224_g = par3; + } + + /** + * Note issuing start multiple times is not an error. + */ + public void startSnooper() + { + if (!this.isRunning) + { + this.isRunning = true; + this.addBaseDataToSnooper(); + this.threadTrigger.schedule(new PlayerUsageSnooperThread(this), 0L, 900000L); + } + } + + private void addBaseDataToSnooper() + { + this.addJvmArgsToSnooper(); + this.addData("snooper_token", this.uniqueID); + this.addData("os_name", System.getProperty("os.name")); + this.addData("os_version", System.getProperty("os.version")); + this.addData("os_architecture", System.getProperty("os.arch")); + this.addData("java_version", System.getProperty("java.version")); + this.addData("version", "1.6.4"); + this.playerStatsCollector.addServerTypeToSnooper(this); + } + + private void addJvmArgsToSnooper() + { + RuntimeMXBean var1 = ManagementFactory.getRuntimeMXBean(); + List var2 = var1.getInputArguments(); + int var3 = 0; + Iterator var4 = var2.iterator(); + + while (var4.hasNext()) + { + String var5 = (String)var4.next(); + + if (var5.startsWith("-X")) + { + this.addData("jvm_arg[" + var3++ + "]", var5); + } + } + + this.addData("jvm_args", Integer.valueOf(var3)); + } + + public void addMemoryStatsToSnooper() + { + this.addData("memory_total", Long.valueOf(Runtime.getRuntime().totalMemory())); + this.addData("memory_max", Long.valueOf(Runtime.getRuntime().maxMemory())); + this.addData("memory_free", Long.valueOf(Runtime.getRuntime().freeMemory())); + this.addData("cpu_cores", Integer.valueOf(Runtime.getRuntime().availableProcessors())); + this.playerStatsCollector.addServerStatsToSnooper(this); + } + + /** + * Adds information to the report + */ + public void addData(String par1Str, Object par2Obj) + { + Object var3 = this.syncLock; + + synchronized (this.syncLock) + { + this.dataMap.put(par1Str, par2Obj); + } + } + + public Map getCurrentStats() + { + LinkedHashMap var1 = new LinkedHashMap(); + Object var2 = this.syncLock; + + synchronized (this.syncLock) + { + this.addMemoryStatsToSnooper(); + Iterator var3 = this.dataMap.entrySet().iterator(); + + while (var3.hasNext()) + { + Entry var4 = (Entry)var3.next(); + var1.put(var4.getKey(), var4.getValue().toString()); + } + + return var1; + } + } + + public boolean isSnooperRunning() + { + return this.isRunning; + } + + public void stopSnooper() + { + this.threadTrigger.cancel(); + } + + public String getUniqueID() + { + return this.uniqueID; + } + + public long func_130105_g() + { + return this.field_98224_g; + } + + static IPlayerUsage getStatsCollectorFor(PlayerUsageSnooper par0PlayerUsageSnooper) + { + return par0PlayerUsageSnooper.playerStatsCollector; + } + + static Object getSyncLockFor(PlayerUsageSnooper par0PlayerUsageSnooper) + { + return par0PlayerUsageSnooper.syncLock; + } + + static Map getDataMapFor(PlayerUsageSnooper par0PlayerUsageSnooper) + { + return par0PlayerUsageSnooper.dataMap; + } + + /** + * returns a value indicating how many times this function has been run on the snooper + */ + static int getSelfCounterFor(PlayerUsageSnooper par0PlayerUsageSnooper) + { + return par0PlayerUsageSnooper.selfCounter++; + } + + static URL getServerUrlFor(PlayerUsageSnooper par0PlayerUsageSnooper) + { + return par0PlayerUsageSnooper.serverUrl; + } +} diff --git a/src/main/java/net/minecraft/src/PlayerUsageSnooperThread.java b/src/main/java/net/minecraft/src/PlayerUsageSnooperThread.java new file mode 100644 index 0000000..23ea0ba --- /dev/null +++ b/src/main/java/net/minecraft/src/PlayerUsageSnooperThread.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +import java.util.HashMap; +import java.util.TimerTask; + +class PlayerUsageSnooperThread extends TimerTask +{ + /** The PlayerUsageSnooper object. */ + final PlayerUsageSnooper snooper; + + PlayerUsageSnooperThread(PlayerUsageSnooper par1PlayerUsageSnooper) + { + this.snooper = par1PlayerUsageSnooper; + } + + public void run() + { + if (PlayerUsageSnooper.getStatsCollectorFor(this.snooper).isSnooperEnabled()) + { + HashMap var1; + + synchronized (PlayerUsageSnooper.getSyncLockFor(this.snooper)) + { + var1 = new HashMap(PlayerUsageSnooper.getDataMapFor(this.snooper)); + var1.put("snooper_count", Integer.valueOf(PlayerUsageSnooper.getSelfCounterFor(this.snooper))); + } + + HttpUtil.sendPost(PlayerUsageSnooper.getStatsCollectorFor(this.snooper).getLogAgent(), PlayerUsageSnooper.getServerUrlFor(this.snooper), var1, true); + } + } +} diff --git a/src/main/java/net/minecraft/src/PortalPosition.java b/src/main/java/net/minecraft/src/PortalPosition.java new file mode 100644 index 0000000..4b17146 --- /dev/null +++ b/src/main/java/net/minecraft/src/PortalPosition.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +public class PortalPosition extends ChunkCoordinates +{ + /** The worldtime at which this PortalPosition was last verified */ + public long lastUpdateTime; + + /** The teleporter to which this PortalPosition applies */ + final Teleporter teleporterInstance; + + public PortalPosition(Teleporter par1Teleporter, int par2, int par3, int par4, long par5) + { + super(par2, par3, par4); + this.teleporterInstance = par1Teleporter; + this.lastUpdateTime = par5; + } +} diff --git a/src/main/java/net/minecraft/src/PositionImpl.java b/src/main/java/net/minecraft/src/PositionImpl.java new file mode 100644 index 0000000..d9ff07a --- /dev/null +++ b/src/main/java/net/minecraft/src/PositionImpl.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +public class PositionImpl implements IPosition +{ + protected final double x; + protected final double y; + protected final double z; + + public PositionImpl(double par1, double par3, double par5) + { + this.x = par1; + this.y = par3; + this.z = par5; + } + + public double getX() + { + return this.x; + } + + public double getY() + { + return this.y; + } + + public double getZ() + { + return this.z; + } +} diff --git a/src/main/java/net/minecraft/src/PositionTextureVertex.java b/src/main/java/net/minecraft/src/PositionTextureVertex.java new file mode 100644 index 0000000..a66d352 --- /dev/null +++ b/src/main/java/net/minecraft/src/PositionTextureVertex.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +public class PositionTextureVertex +{ + public Vec3 vector3D; + public float texturePositionX; + public float texturePositionY; + + public PositionTextureVertex(float par1, float par2, float par3, float par4, float par5) + { + this(Vec3.createVectorHelper((double)par1, (double)par2, (double)par3), par4, par5); + } + + public PositionTextureVertex setTexturePosition(float par1, float par2) + { + return new PositionTextureVertex(this, par1, par2); + } + + public PositionTextureVertex(PositionTextureVertex par1PositionTextureVertex, float par2, float par3) + { + this.vector3D = par1PositionTextureVertex.vector3D; + this.texturePositionX = par2; + this.texturePositionY = par3; + } + + public PositionTextureVertex(Vec3 par1Vec3, float par2, float par3) + { + this.vector3D = par1Vec3; + this.texturePositionX = par2; + this.texturePositionY = par3; + } +} diff --git a/src/main/java/net/minecraft/src/Potion.java b/src/main/java/net/minecraft/src/Potion.java new file mode 100644 index 0000000..1659bd0 --- /dev/null +++ b/src/main/java/net/minecraft/src/Potion.java @@ -0,0 +1,359 @@ +package net.minecraft.src; + +import com.google.common.collect.Maps; +import java.util.Iterator; +import java.util.Map; +import java.util.UUID; +import java.util.Map.Entry; + +public class Potion +{ + /** The array of potion types. */ + public static final Potion[] potionTypes = new Potion[32]; + public static final Potion field_76423_b = null; + public static final Potion moveSpeed = (new Potion(1, false, 8171462)).setPotionName("potion.moveSpeed").setIconIndex(0, 0).func_111184_a(SharedMonsterAttributes.movementSpeed, "91AEAA56-376B-4498-935B-2F7F68070635", 0.20000000298023224D, 2); + public static final Potion moveSlowdown = (new Potion(2, true, 5926017)).setPotionName("potion.moveSlowdown").setIconIndex(1, 0).func_111184_a(SharedMonsterAttributes.movementSpeed, "7107DE5E-7CE8-4030-940E-514C1F160890", -0.15000000596046448D, 2); + public static final Potion digSpeed = (new Potion(3, false, 14270531)).setPotionName("potion.digSpeed").setIconIndex(2, 0).setEffectiveness(1.5D); + public static final Potion digSlowdown = (new Potion(4, true, 4866583)).setPotionName("potion.digSlowDown").setIconIndex(3, 0); + public static final Potion damageBoost = (new PotionAttackDamage(5, false, 9643043)).setPotionName("potion.damageBoost").setIconIndex(4, 0).func_111184_a(SharedMonsterAttributes.attackDamage, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 3.0D, 2); + public static final Potion heal = (new PotionHealth(6, false, 16262179)).setPotionName("potion.heal"); + public static final Potion harm = (new PotionHealth(7, true, 4393481)).setPotionName("potion.harm"); + public static final Potion jump = (new Potion(8, false, 7889559)).setPotionName("potion.jump").setIconIndex(2, 1); + public static final Potion confusion = (new Potion(9, true, 5578058)).setPotionName("potion.confusion").setIconIndex(3, 1).setEffectiveness(0.25D); + + /** The regeneration Potion object. */ + public static final Potion regeneration = (new Potion(10, false, 13458603)).setPotionName("potion.regeneration").setIconIndex(7, 0).setEffectiveness(0.25D); + public static final Potion resistance = (new Potion(11, false, 10044730)).setPotionName("potion.resistance").setIconIndex(6, 1); + + /** The fire resistance Potion object. */ + public static final Potion fireResistance = (new Potion(12, false, 14981690)).setPotionName("potion.fireResistance").setIconIndex(7, 1); + + /** The water breathing Potion object. */ + public static final Potion waterBreathing = (new Potion(13, false, 3035801)).setPotionName("potion.waterBreathing").setIconIndex(0, 2); + + /** The invisibility Potion object. */ + public static final Potion invisibility = (new Potion(14, false, 8356754)).setPotionName("potion.invisibility").setIconIndex(0, 1); + + /** The blindness Potion object. */ + public static final Potion blindness = (new Potion(15, true, 2039587)).setPotionName("potion.blindness").setIconIndex(5, 1).setEffectiveness(0.25D); + + /** The night vision Potion object. */ + public static final Potion nightVision = (new Potion(16, false, 2039713)).setPotionName("potion.nightVision").setIconIndex(4, 1); + + /** The hunger Potion object. */ + public static final Potion hunger = (new Potion(17, true, 5797459)).setPotionName("potion.hunger").setIconIndex(1, 1); + + /** The weakness Potion object. */ + public static final Potion weakness = (new PotionAttackDamage(18, true, 4738376)).setPotionName("potion.weakness").setIconIndex(5, 0).func_111184_a(SharedMonsterAttributes.attackDamage, "22653B89-116E-49DC-9B6B-9971489B5BE5", 2.0D, 0); + + /** The poison Potion object. */ + public static final Potion poison = (new Potion(19, true, 5149489)).setPotionName("potion.poison").setIconIndex(6, 0).setEffectiveness(0.25D); + + /** The wither Potion object. */ + public static final Potion wither = (new Potion(20, true, 3484199)).setPotionName("potion.wither").setIconIndex(1, 2).setEffectiveness(0.25D); + public static final Potion field_76434_w = (new PotionHealthBoost(21, false, 16284963)).setPotionName("potion.healthBoost").setIconIndex(2, 2).func_111184_a(SharedMonsterAttributes.maxHealth, "5D6F0BA2-1186-46AC-B896-C61C5CEE99CC", 4.0D, 0); + public static final Potion field_76444_x = (new PotionAbsoption(22, false, 2445989)).setPotionName("potion.absorption").setIconIndex(2, 2); + public static final Potion field_76443_y = (new PotionHealth(23, false, 16262179)).setPotionName("potion.saturation"); + public static final Potion field_76442_z = null; + public static final Potion field_76409_A = null; + public static final Potion field_76410_B = null; + public static final Potion field_76411_C = null; + public static final Potion field_76405_D = null; + public static final Potion field_76406_E = null; + public static final Potion field_76407_F = null; + public static final Potion field_76408_G = null; + + /** The Id of a Potion object. */ + public final int id; + private final Map field_111188_I = Maps.newHashMap(); + + /** + * This field indicated if the effect is 'bad' - negative - for the entity. + */ + private final boolean isBadEffect; + + /** Is the color of the liquid for this potion. */ + private final int liquidColor; + + /** The name of the Potion. */ + private String name = ""; + + /** The index for the icon displayed when the potion effect is active. */ + private int statusIconIndex = -1; + private double effectiveness; + private boolean usable; + + protected Potion(int par1, boolean par2, int par3) + { + this.id = par1; + potionTypes[par1] = this; + this.isBadEffect = par2; + + if (par2) + { + this.effectiveness = 0.5D; + } + else + { + this.effectiveness = 1.0D; + } + + this.liquidColor = par3; + } + + /** + * Sets the index for the icon displayed in the player's inventory when the status is active. + */ + protected Potion setIconIndex(int par1, int par2) + { + this.statusIconIndex = par1 + par2 * 8; + return this; + } + + /** + * returns the ID of the potion + */ + public int getId() + { + return this.id; + } + + public void performEffect(EntityLivingBase par1EntityLivingBase, int par2) + { + if (this.id == regeneration.id) + { + if (par1EntityLivingBase.getHealth() < par1EntityLivingBase.getMaxHealth()) + { + par1EntityLivingBase.heal(1.0F); + } + } + else if (this.id == poison.id) + { + if (par1EntityLivingBase.getHealth() > 1.0F) + { + par1EntityLivingBase.attackEntityFrom(DamageSource.magic, 1.0F); + } + } + else if (this.id == wither.id) + { + par1EntityLivingBase.attackEntityFrom(DamageSource.wither, 1.0F); + } + else if (this.id == hunger.id && par1EntityLivingBase instanceof EntityPlayer) + { + ((EntityPlayer)par1EntityLivingBase).addExhaustion(0.025F * (float)(par2 + 1)); + } + else if (this.id == field_76443_y.id && par1EntityLivingBase instanceof EntityPlayer) + { + if (!par1EntityLivingBase.worldObj.isRemote) + { + ((EntityPlayer)par1EntityLivingBase).getFoodStats().addStats(par2 + 1, 1.0F); + } + } + else if ((this.id != heal.id || par1EntityLivingBase.isEntityUndead()) && (this.id != harm.id || !par1EntityLivingBase.isEntityUndead())) + { + if (this.id == harm.id && !par1EntityLivingBase.isEntityUndead() || this.id == heal.id && par1EntityLivingBase.isEntityUndead()) + { + par1EntityLivingBase.attackEntityFrom(DamageSource.magic, (float)(6 << par2)); + } + } + else + { + par1EntityLivingBase.heal((float)Math.max(4 << par2, 0)); + } + } + + /** + * Hits the provided entity with this potion's instant effect. + */ + public void affectEntity(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase, int par3, double par4) + { + int var6; + + if ((this.id != heal.id || par2EntityLivingBase.isEntityUndead()) && (this.id != harm.id || !par2EntityLivingBase.isEntityUndead())) + { + if (this.id == harm.id && !par2EntityLivingBase.isEntityUndead() || this.id == heal.id && par2EntityLivingBase.isEntityUndead()) + { + var6 = (int)(par4 * (double)(6 << par3) + 0.5D); + + if (par1EntityLivingBase == null) + { + par2EntityLivingBase.attackEntityFrom(DamageSource.magic, (float)var6); + } + else + { + par2EntityLivingBase.attackEntityFrom(DamageSource.causeIndirectMagicDamage(par2EntityLivingBase, par1EntityLivingBase), (float)var6); + } + } + } + else + { + var6 = (int)(par4 * (double)(4 << par3) + 0.5D); + par2EntityLivingBase.heal((float)var6); + } + } + + /** + * Returns true if the potion has an instant effect instead of a continuous one (eg Harming) + */ + public boolean isInstant() + { + return false; + } + + /** + * checks if Potion effect is ready to be applied this tick. + */ + public boolean isReady(int par1, int par2) + { + int var3; + + if (this.id == regeneration.id) + { + var3 = 50 >> par2; + return var3 > 0 ? par1 % var3 == 0 : true; + } + else if (this.id == poison.id) + { + var3 = 25 >> par2; + return var3 > 0 ? par1 % var3 == 0 : true; + } + else if (this.id == wither.id) + { + var3 = 40 >> par2; + return var3 > 0 ? par1 % var3 == 0 : true; + } + else + { + return this.id == hunger.id; + } + } + + /** + * Set the potion name. + */ + public Potion setPotionName(String par1Str) + { + this.name = par1Str; + return this; + } + + /** + * returns the name of the potion + */ + public String getName() + { + return this.name; + } + + /** + * Returns true if the potion has a associated status icon to display in then inventory when active. + */ + public boolean hasStatusIcon() + { + return this.statusIconIndex >= 0; + } + + /** + * Returns the index for the icon to display when the potion is active. + */ + public int getStatusIconIndex() + { + return this.statusIconIndex; + } + + /** + * This method returns true if the potion effect is bad - negative - for the entity. + */ + public boolean isBadEffect() + { + return this.isBadEffect; + } + + public static String getDurationString(PotionEffect par0PotionEffect) + { + if (par0PotionEffect.getIsPotionDurationMax()) + { + return "**:**"; + } + else + { + int var1 = par0PotionEffect.getDuration(); + return StringUtils.ticksToElapsedTime(var1); + } + } + + protected Potion setEffectiveness(double par1) + { + this.effectiveness = par1; + return this; + } + + public double getEffectiveness() + { + return this.effectiveness; + } + + public boolean isUsable() + { + return this.usable; + } + + /** + * Returns the color of the potion liquid. + */ + public int getLiquidColor() + { + return this.liquidColor; + } + + public Potion func_111184_a(Attribute par1Attribute, String par2Str, double par3, int par5) + { + AttributeModifier var6 = new AttributeModifier(UUID.fromString(par2Str), this.getName(), par3, par5); + this.field_111188_I.put(par1Attribute, var6); + return this; + } + + public Map func_111186_k() + { + return this.field_111188_I; + } + + public void removeAttributesModifiersFromEntity(EntityLivingBase par1EntityLivingBase, BaseAttributeMap par2BaseAttributeMap, int par3) + { + Iterator var4 = this.field_111188_I.entrySet().iterator(); + + while (var4.hasNext()) + { + Entry var5 = (Entry)var4.next(); + AttributeInstance var6 = par2BaseAttributeMap.getAttributeInstance((Attribute)var5.getKey()); + + if (var6 != null) + { + var6.removeModifier((AttributeModifier)var5.getValue()); + } + } + } + + public void applyAttributesModifiersToEntity(EntityLivingBase par1EntityLivingBase, BaseAttributeMap par2BaseAttributeMap, int par3) + { + Iterator var4 = this.field_111188_I.entrySet().iterator(); + + while (var4.hasNext()) + { + Entry var5 = (Entry)var4.next(); + AttributeInstance var6 = par2BaseAttributeMap.getAttributeInstance((Attribute)var5.getKey()); + + if (var6 != null) + { + AttributeModifier var7 = (AttributeModifier)var5.getValue(); + var6.removeModifier(var7); + var6.applyModifier(new AttributeModifier(var7.getID(), this.getName() + " " + par3, this.func_111183_a(par3, var7), var7.getOperation())); + } + } + } + + public double func_111183_a(int par1, AttributeModifier par2AttributeModifier) + { + return par2AttributeModifier.getAmount() * (double)(par1 + 1); + } +} diff --git a/src/main/java/net/minecraft/src/PotionAbsoption.java b/src/main/java/net/minecraft/src/PotionAbsoption.java new file mode 100644 index 0000000..1ae1213 --- /dev/null +++ b/src/main/java/net/minecraft/src/PotionAbsoption.java @@ -0,0 +1,21 @@ +package net.minecraft.src; + +public class PotionAbsoption extends Potion +{ + protected PotionAbsoption(int par1, boolean par2, int par3) + { + super(par1, par2, par3); + } + + public void removeAttributesModifiersFromEntity(EntityLivingBase par1EntityLivingBase, BaseAttributeMap par2BaseAttributeMap, int par3) + { + par1EntityLivingBase.setAbsorptionAmount(par1EntityLivingBase.getAbsorptionAmount() - (float)(4 * (par3 + 1))); + super.removeAttributesModifiersFromEntity(par1EntityLivingBase, par2BaseAttributeMap, par3); + } + + public void applyAttributesModifiersToEntity(EntityLivingBase par1EntityLivingBase, BaseAttributeMap par2BaseAttributeMap, int par3) + { + par1EntityLivingBase.setAbsorptionAmount(par1EntityLivingBase.getAbsorptionAmount() + (float)(4 * (par3 + 1))); + super.applyAttributesModifiersToEntity(par1EntityLivingBase, par2BaseAttributeMap, par3); + } +} diff --git a/src/main/java/net/minecraft/src/PotionAttackDamage.java b/src/main/java/net/minecraft/src/PotionAttackDamage.java new file mode 100644 index 0000000..c7e07d7 --- /dev/null +++ b/src/main/java/net/minecraft/src/PotionAttackDamage.java @@ -0,0 +1,14 @@ +package net.minecraft.src; + +public class PotionAttackDamage extends Potion +{ + protected PotionAttackDamage(int par1, boolean par2, int par3) + { + super(par1, par2, par3); + } + + public double func_111183_a(int par1, AttributeModifier par2AttributeModifier) + { + return this.id == Potion.weakness.id ? (double)(-0.5F * (float)(par1 + 1)) : 1.3D * (double)(par1 + 1); + } +} diff --git a/src/main/java/net/minecraft/src/PotionEffect.java b/src/main/java/net/minecraft/src/PotionEffect.java new file mode 100644 index 0000000..cc6a1a5 --- /dev/null +++ b/src/main/java/net/minecraft/src/PotionEffect.java @@ -0,0 +1,216 @@ +package net.minecraft.src; + +public class PotionEffect +{ + /** ID value of the potion this effect matches. */ + private int potionID; + + /** The duration of the potion effect */ + private int duration; + + /** The amplifier of the potion effect */ + private int amplifier; + + /** Whether the potion is a splash potion */ + private boolean isSplashPotion; + + /** Whether the potion effect came from a beacon */ + private boolean isAmbient; + + /** True if potion effect duration is at maximum, false otherwise. */ + private boolean isPotionDurationMax; + + public PotionEffect(int par1, int par2) + { + this(par1, par2, 0); + } + + public PotionEffect(int par1, int par2, int par3) + { + this(par1, par2, par3, false); + } + + public PotionEffect(int par1, int par2, int par3, boolean par4) + { + this.potionID = par1; + this.duration = par2; + this.amplifier = par3; + this.isAmbient = par4; + } + + public PotionEffect(PotionEffect par1PotionEffect) + { + this.potionID = par1PotionEffect.potionID; + this.duration = par1PotionEffect.duration; + this.amplifier = par1PotionEffect.amplifier; + } + + /** + * merges the input PotionEffect into this one if this.amplifier <= tomerge.amplifier. The duration in the supplied + * potion effect is assumed to be greater. + */ + public void combine(PotionEffect par1PotionEffect) + { + if (this.potionID != par1PotionEffect.potionID) + { + System.err.println("This method should only be called for matching effects!"); + } + + if (par1PotionEffect.amplifier > this.amplifier) + { + this.amplifier = par1PotionEffect.amplifier; + this.duration = par1PotionEffect.duration; + } + else if (par1PotionEffect.amplifier == this.amplifier && this.duration < par1PotionEffect.duration) + { + this.duration = par1PotionEffect.duration; + } + else if (!par1PotionEffect.isAmbient && this.isAmbient) + { + this.isAmbient = par1PotionEffect.isAmbient; + } + } + + /** + * Retrieve the ID of the potion this effect matches. + */ + public int getPotionID() + { + return this.potionID; + } + + public int getDuration() + { + return this.duration; + } + + public int getAmplifier() + { + return this.amplifier; + } + + /** + * Set whether this potion is a splash potion. + */ + public void setSplashPotion(boolean par1) + { + this.isSplashPotion = par1; + } + + /** + * Gets whether this potion effect originated from a beacon + */ + public boolean getIsAmbient() + { + return this.isAmbient; + } + + public boolean onUpdate(EntityLivingBase par1EntityLivingBase) + { + if (this.duration > 0) + { + if (Potion.potionTypes[this.potionID].isReady(this.duration, this.amplifier)) + { + this.performEffect(par1EntityLivingBase); + } + + this.deincrementDuration(); + } + + return this.duration > 0; + } + + private int deincrementDuration() + { + return --this.duration; + } + + public void performEffect(EntityLivingBase par1EntityLivingBase) + { + if (this.duration > 0) + { + Potion.potionTypes[this.potionID].performEffect(par1EntityLivingBase, this.amplifier); + } + } + + public String getEffectName() + { + return Potion.potionTypes[this.potionID].getName(); + } + + public int hashCode() + { + return this.potionID; + } + + public String toString() + { + String var1 = ""; + + if (this.getAmplifier() > 0) + { + var1 = this.getEffectName() + " x " + (this.getAmplifier() + 1) + ", Duration: " + this.getDuration(); + } + else + { + var1 = this.getEffectName() + ", Duration: " + this.getDuration(); + } + + if (this.isSplashPotion) + { + var1 = var1 + ", Splash: true"; + } + + return Potion.potionTypes[this.potionID].isUsable() ? "(" + var1 + ")" : var1; + } + + public boolean equals(Object par1Obj) + { + if (!(par1Obj instanceof PotionEffect)) + { + return false; + } + else + { + PotionEffect var2 = (PotionEffect)par1Obj; + return this.potionID == var2.potionID && this.amplifier == var2.amplifier && this.duration == var2.duration && this.isSplashPotion == var2.isSplashPotion && this.isAmbient == var2.isAmbient; + } + } + + /** + * Write a custom potion effect to a potion item's NBT data. + */ + public NBTTagCompound writeCustomPotionEffectToNBT(NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setByte("Id", (byte)this.getPotionID()); + par1NBTTagCompound.setByte("Amplifier", (byte)this.getAmplifier()); + par1NBTTagCompound.setInteger("Duration", this.getDuration()); + par1NBTTagCompound.setBoolean("Ambient", this.getIsAmbient()); + return par1NBTTagCompound; + } + + /** + * Read a custom potion effect from a potion item's NBT data. + */ + public static PotionEffect readCustomPotionEffectFromNBT(NBTTagCompound par0NBTTagCompound) + { + byte var1 = par0NBTTagCompound.getByte("Id"); + byte var2 = par0NBTTagCompound.getByte("Amplifier"); + int var3 = par0NBTTagCompound.getInteger("Duration"); + boolean var4 = par0NBTTagCompound.getBoolean("Ambient"); + return new PotionEffect(var1, var3, var2, var4); + } + + /** + * Toggle the isPotionDurationMax field. + */ + public void setPotionDurationMax(boolean par1) + { + this.isPotionDurationMax = par1; + } + + public boolean getIsPotionDurationMax() + { + return this.isPotionDurationMax; + } +} diff --git a/src/main/java/net/minecraft/src/PotionHealth.java b/src/main/java/net/minecraft/src/PotionHealth.java new file mode 100644 index 0000000..1504ee5 --- /dev/null +++ b/src/main/java/net/minecraft/src/PotionHealth.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +public class PotionHealth extends Potion +{ + public PotionHealth(int par1, boolean par2, int par3) + { + super(par1, par2, par3); + } + + /** + * Returns true if the potion has an instant effect instead of a continuous one (eg Harming) + */ + public boolean isInstant() + { + return true; + } + + /** + * checks if Potion effect is ready to be applied this tick. + */ + public boolean isReady(int par1, int par2) + { + return par1 >= 1; + } +} diff --git a/src/main/java/net/minecraft/src/PotionHealthBoost.java b/src/main/java/net/minecraft/src/PotionHealthBoost.java new file mode 100644 index 0000000..0d7195e --- /dev/null +++ b/src/main/java/net/minecraft/src/PotionHealthBoost.java @@ -0,0 +1,19 @@ +package net.minecraft.src; + +public class PotionHealthBoost extends Potion +{ + public PotionHealthBoost(int par1, boolean par2, int par3) + { + super(par1, par2, par3); + } + + public void removeAttributesModifiersFromEntity(EntityLivingBase par1EntityLivingBase, BaseAttributeMap par2BaseAttributeMap, int par3) + { + super.removeAttributesModifiersFromEntity(par1EntityLivingBase, par2BaseAttributeMap, par3); + + if (par1EntityLivingBase.getHealth() > par1EntityLivingBase.getMaxHealth()) + { + par1EntityLivingBase.setHealth(par1EntityLivingBase.getMaxHealth()); + } + } +} diff --git a/src/main/java/net/minecraft/src/PotionHelper.java b/src/main/java/net/minecraft/src/PotionHelper.java new file mode 100644 index 0000000..afd1ecd --- /dev/null +++ b/src/main/java/net/minecraft/src/PotionHelper.java @@ -0,0 +1,608 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +public class PotionHelper +{ + public static final String field_77924_a = null; + public static final String sugarEffect; + public static final String ghastTearEffect = "+0-1-2-3&4-4+13"; + public static final String spiderEyeEffect; + public static final String fermentedSpiderEyeEffect; + public static final String speckledMelonEffect; + public static final String blazePowderEffect; + public static final String magmaCreamEffect; + public static final String redstoneEffect; + public static final String glowstoneEffect; + public static final String gunpowderEffect; + public static final String goldenCarrotEffect; + private static final HashMap potionRequirements = new HashMap(); + + /** Potion effect amplifier map */ + private static final HashMap potionAmplifiers = new HashMap(); + private static final HashMap field_77925_n; + + /** An array of possible potion prefix names, as translation IDs. */ + private static final String[] potionPrefixes; + + /** + * Is the bit given set to 1? + */ + public static boolean checkFlag(int par0, int par1) + { + return (par0 & 1 << par1) != 0; + } + + /** + * Returns 1 if the flag is set, 0 if it is not set. + */ + private static int isFlagSet(int par0, int par1) + { + return checkFlag(par0, par1) ? 1 : 0; + } + + /** + * Returns 0 if the flag is set, 1 if it is not set. + */ + private static int isFlagUnset(int par0, int par1) + { + return checkFlag(par0, par1) ? 0 : 1; + } + + public static int func_77909_a(int par0) + { + return func_77908_a(par0, 5, 4, 3, 2, 1); + } + + /** + * Given a {@link Collection}<{@link PotionEffect}> will return an Integer color. + */ + public static int calcPotionLiquidColor(Collection par0Collection) + { + int var1 = 3694022; + + if (par0Collection != null && !par0Collection.isEmpty()) + { + float var2 = 0.0F; + float var3 = 0.0F; + float var4 = 0.0F; + float var5 = 0.0F; + Iterator var6 = par0Collection.iterator(); + + while (var6.hasNext()) + { + PotionEffect var7 = (PotionEffect)var6.next(); + int var8 = Potion.potionTypes[var7.getPotionID()].getLiquidColor(); + + for (int var9 = 0; var9 <= var7.getAmplifier(); ++var9) + { + var2 += (float)(var8 >> 16 & 255) / 255.0F; + var3 += (float)(var8 >> 8 & 255) / 255.0F; + var4 += (float)(var8 >> 0 & 255) / 255.0F; + ++var5; + } + } + + var2 = var2 / var5 * 255.0F; + var3 = var3 / var5 * 255.0F; + var4 = var4 / var5 * 255.0F; + return (int)var2 << 16 | (int)var3 << 8 | (int)var4; + } + else + { + return var1; + } + } + + public static boolean func_82817_b(Collection par0Collection) + { + Iterator var1 = par0Collection.iterator(); + PotionEffect var2; + + do + { + if (!var1.hasNext()) + { + return true; + } + + var2 = (PotionEffect)var1.next(); + } + while (var2.getIsAmbient()); + + return false; + } + + public static int func_77915_a(int par0, boolean par1) + { + if (!par1) + { + if (field_77925_n.containsKey(Integer.valueOf(par0))) + { + return ((Integer)field_77925_n.get(Integer.valueOf(par0))).intValue(); + } + else + { + int var2 = calcPotionLiquidColor(getPotionEffects(par0, false)); + field_77925_n.put(Integer.valueOf(par0), Integer.valueOf(var2)); + return var2; + } + } + else + { + return calcPotionLiquidColor(getPotionEffects(par0, par1)); + } + } + + public static String func_77905_c(int par0) + { + int var1 = func_77909_a(par0); + return potionPrefixes[var1]; + } + + private static int func_77904_a(boolean par0, boolean par1, boolean par2, int par3, int par4, int par5, int par6) + { + int var7 = 0; + + if (par0) + { + var7 = isFlagUnset(par6, par4); + } + else if (par3 != -1) + { + if (par3 == 0 && countSetFlags(par6) == par4) + { + var7 = 1; + } + else if (par3 == 1 && countSetFlags(par6) > par4) + { + var7 = 1; + } + else if (par3 == 2 && countSetFlags(par6) < par4) + { + var7 = 1; + } + } + else + { + var7 = isFlagSet(par6, par4); + } + + if (par1) + { + var7 *= par5; + } + + if (par2) + { + var7 *= -1; + } + + return var7; + } + + /** + * Count the number of bits in an integer set to ON. + */ + private static int countSetFlags(int par0) + { + int var1; + + for (var1 = 0; par0 > 0; ++var1) + { + par0 &= par0 - 1; + } + + return var1; + } + + private static int parsePotionEffects(String par0Str, int par1, int par2, int par3) + { + if (par1 < par0Str.length() && par2 >= 0 && par1 < par2) + { + int var4 = par0Str.indexOf(124, par1); + int var5; + int var17; + + if (var4 >= 0 && var4 < par2) + { + var5 = parsePotionEffects(par0Str, par1, var4 - 1, par3); + + if (var5 > 0) + { + return var5; + } + else + { + var17 = parsePotionEffects(par0Str, var4 + 1, par2, par3); + return var17 > 0 ? var17 : 0; + } + } + else + { + var5 = par0Str.indexOf(38, par1); + + if (var5 >= 0 && var5 < par2) + { + var17 = parsePotionEffects(par0Str, par1, var5 - 1, par3); + + if (var17 <= 0) + { + return 0; + } + else + { + int var18 = parsePotionEffects(par0Str, var5 + 1, par2, par3); + return var18 <= 0 ? 0 : (var17 > var18 ? var17 : var18); + } + } + else + { + boolean var6 = false; + boolean var7 = false; + boolean var8 = false; + boolean var9 = false; + boolean var10 = false; + byte var11 = -1; + int var12 = 0; + int var13 = 0; + int var14 = 0; + + for (int var15 = par1; var15 < par2; ++var15) + { + char var16 = par0Str.charAt(var15); + + if (var16 >= 48 && var16 <= 57) + { + if (var6) + { + var13 = var16 - 48; + var7 = true; + } + else + { + var12 *= 10; + var12 += var16 - 48; + var8 = true; + } + } + else if (var16 == 42) + { + var6 = true; + } + else if (var16 == 33) + { + if (var8) + { + var14 += func_77904_a(var9, var7, var10, var11, var12, var13, par3); + var9 = false; + var10 = false; + var6 = false; + var7 = false; + var8 = false; + var13 = 0; + var12 = 0; + var11 = -1; + } + + var9 = true; + } + else if (var16 == 45) + { + if (var8) + { + var14 += func_77904_a(var9, var7, var10, var11, var12, var13, par3); + var9 = false; + var10 = false; + var6 = false; + var7 = false; + var8 = false; + var13 = 0; + var12 = 0; + var11 = -1; + } + + var10 = true; + } + else if (var16 != 61 && var16 != 60 && var16 != 62) + { + if (var16 == 43 && var8) + { + var14 += func_77904_a(var9, var7, var10, var11, var12, var13, par3); + var9 = false; + var10 = false; + var6 = false; + var7 = false; + var8 = false; + var13 = 0; + var12 = 0; + var11 = -1; + } + } + else + { + if (var8) + { + var14 += func_77904_a(var9, var7, var10, var11, var12, var13, par3); + var9 = false; + var10 = false; + var6 = false; + var7 = false; + var8 = false; + var13 = 0; + var12 = 0; + var11 = -1; + } + + if (var16 == 61) + { + var11 = 0; + } + else if (var16 == 60) + { + var11 = 2; + } + else if (var16 == 62) + { + var11 = 1; + } + } + } + + if (var8) + { + var14 += func_77904_a(var9, var7, var10, var11, var12, var13, par3); + } + + return var14; + } + } + } + else + { + return 0; + } + } + + /** + * Returns a list of effects for the specified potion damage value. + */ + public static List getPotionEffects(int par0, boolean par1) + { + ArrayList var2 = null; + Potion[] var3 = Potion.potionTypes; + int var4 = var3.length; + + for (int var5 = 0; var5 < var4; ++var5) + { + Potion var6 = var3[var5]; + + if (var6 != null && (!var6.isUsable() || par1)) + { + String var7 = (String)potionRequirements.get(Integer.valueOf(var6.getId())); + + if (var7 != null) + { + int var8 = parsePotionEffects(var7, 0, var7.length(), par0); + + if (var8 > 0) + { + int var9 = 0; + String var10 = (String)potionAmplifiers.get(Integer.valueOf(var6.getId())); + + if (var10 != null) + { + var9 = parsePotionEffects(var10, 0, var10.length(), par0); + + if (var9 < 0) + { + var9 = 0; + } + } + + if (var6.isInstant()) + { + var8 = 1; + } + else + { + var8 = 1200 * (var8 * 3 + (var8 - 1) * 2); + var8 >>= var9; + var8 = (int)Math.round((double)var8 * var6.getEffectiveness()); + + if ((par0 & 16384) != 0) + { + var8 = (int)Math.round((double)var8 * 0.75D + 0.5D); + } + } + + if (var2 == null) + { + var2 = new ArrayList(); + } + + PotionEffect var11 = new PotionEffect(var6.getId(), var8, var9); + + if ((par0 & 16384) != 0) + { + var11.setSplashPotion(true); + } + + var2.add(var11); + } + } + } + } + + return var2; + } + + /** + * Does bit operations for brewPotionData, given data, the index of the bit being operated upon, whether the bit + * will be removed, whether the bit will be toggled (NOT), or whether the data field will be set to 0 if the bit is + * not present. + */ + private static int brewBitOperations(int par0, int par1, boolean par2, boolean par3, boolean par4) + { + if (par4) + { + if (!checkFlag(par0, par1)) + { + return 0; + } + } + else if (par2) + { + par0 &= ~(1 << par1); + } + else if (par3) + { + if ((par0 & 1 << par1) == 0) + { + par0 |= 1 << par1; + } + else + { + par0 &= ~(1 << par1); + } + } + else + { + par0 |= 1 << par1; + } + + return par0; + } + + /** + * Generate a data value for a potion, given its previous data value and the encoded string of new effects it will + * receive + */ + public static int applyIngredient(int par0, String par1Str) + { + byte var2 = 0; + int var3 = par1Str.length(); + boolean var4 = false; + boolean var5 = false; + boolean var6 = false; + boolean var7 = false; + int var8 = 0; + + for (int var9 = var2; var9 < var3; ++var9) + { + char var10 = par1Str.charAt(var9); + + if (var10 >= 48 && var10 <= 57) + { + var8 *= 10; + var8 += var10 - 48; + var4 = true; + } + else if (var10 == 33) + { + if (var4) + { + par0 = brewBitOperations(par0, var8, var6, var5, var7); + var7 = false; + var5 = false; + var6 = false; + var4 = false; + var8 = 0; + } + + var5 = true; + } + else if (var10 == 45) + { + if (var4) + { + par0 = brewBitOperations(par0, var8, var6, var5, var7); + var7 = false; + var5 = false; + var6 = false; + var4 = false; + var8 = 0; + } + + var6 = true; + } + else if (var10 == 43) + { + if (var4) + { + par0 = brewBitOperations(par0, var8, var6, var5, var7); + var7 = false; + var5 = false; + var6 = false; + var4 = false; + var8 = 0; + } + } + else if (var10 == 38) + { + if (var4) + { + par0 = brewBitOperations(par0, var8, var6, var5, var7); + var7 = false; + var5 = false; + var6 = false; + var4 = false; + var8 = 0; + } + + var7 = true; + } + } + + if (var4) + { + par0 = brewBitOperations(par0, var8, var6, var5, var7); + } + + return par0 & 32767; + } + + public static int func_77908_a(int par0, int par1, int par2, int par3, int par4, int par5) + { + return (checkFlag(par0, par1) ? 16 : 0) | (checkFlag(par0, par2) ? 8 : 0) | (checkFlag(par0, par3) ? 4 : 0) | (checkFlag(par0, par4) ? 2 : 0) | (checkFlag(par0, par5) ? 1 : 0); + } + + static + { + potionRequirements.put(Integer.valueOf(Potion.regeneration.getId()), "0 & !1 & !2 & !3 & 0+6"); + sugarEffect = "-0+1-2-3&4-4+13"; + potionRequirements.put(Integer.valueOf(Potion.moveSpeed.getId()), "!0 & 1 & !2 & !3 & 1+6"); + magmaCreamEffect = "+0+1-2-3&4-4+13"; + potionRequirements.put(Integer.valueOf(Potion.fireResistance.getId()), "0 & 1 & !2 & !3 & 0+6"); + speckledMelonEffect = "+0-1+2-3&4-4+13"; + potionRequirements.put(Integer.valueOf(Potion.heal.getId()), "0 & !1 & 2 & !3"); + spiderEyeEffect = "-0-1+2-3&4-4+13"; + potionRequirements.put(Integer.valueOf(Potion.poison.getId()), "!0 & !1 & 2 & !3 & 2+6"); + fermentedSpiderEyeEffect = "-0+3-4+13"; + potionRequirements.put(Integer.valueOf(Potion.weakness.getId()), "!0 & !1 & !2 & 3 & 3+6"); + potionRequirements.put(Integer.valueOf(Potion.harm.getId()), "!0 & !1 & 2 & 3"); + potionRequirements.put(Integer.valueOf(Potion.moveSlowdown.getId()), "!0 & 1 & !2 & 3 & 3+6"); + blazePowderEffect = "+0-1-2+3&4-4+13"; + potionRequirements.put(Integer.valueOf(Potion.damageBoost.getId()), "0 & !1 & !2 & 3 & 3+6"); + goldenCarrotEffect = "-0+1+2-3+13&4-4"; + potionRequirements.put(Integer.valueOf(Potion.nightVision.getId()), "!0 & 1 & 2 & !3 & 2+6"); + potionRequirements.put(Integer.valueOf(Potion.invisibility.getId()), "!0 & 1 & 2 & 3 & 2+6"); + glowstoneEffect = "+5-6-7"; + potionAmplifiers.put(Integer.valueOf(Potion.moveSpeed.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.digSpeed.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.damageBoost.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.regeneration.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.harm.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.heal.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.resistance.getId()), "5"); + potionAmplifiers.put(Integer.valueOf(Potion.poison.getId()), "5"); + redstoneEffect = "-5+6-7"; + gunpowderEffect = "+14&13-13"; + field_77925_n = new HashMap(); + potionPrefixes = new String[] {"potion.prefix.mundane", "potion.prefix.uninteresting", "potion.prefix.bland", "potion.prefix.clear", "potion.prefix.milky", "potion.prefix.diffuse", "potion.prefix.artless", "potion.prefix.thin", "potion.prefix.awkward", "potion.prefix.flat", "potion.prefix.bulky", "potion.prefix.bungling", "potion.prefix.buttered", "potion.prefix.smooth", "potion.prefix.suave", "potion.prefix.debonair", "potion.prefix.thick", "potion.prefix.elegant", "potion.prefix.fancy", "potion.prefix.charming", "potion.prefix.dashing", "potion.prefix.refined", "potion.prefix.cordial", "potion.prefix.sparkling", "potion.prefix.potent", "potion.prefix.foul", "potion.prefix.odorless", "potion.prefix.rank", "potion.prefix.harsh", "potion.prefix.acrid", "potion.prefix.gross", "potion.prefix.stinky"}; + } +} diff --git a/src/main/java/net/minecraft/src/Profiler.java b/src/main/java/net/minecraft/src/Profiler.java new file mode 100644 index 0000000..5191c50 --- /dev/null +++ b/src/main/java/net/minecraft/src/Profiler.java @@ -0,0 +1,179 @@ +package net.minecraft.src; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +public class Profiler +{ + /** List of parent sections */ + private final List sectionList = new ArrayList(); + + /** List of timestamps (System.nanoTime) */ + private final List timestampList = new ArrayList(); + + /** Flag profiling enabled */ + public boolean profilingEnabled; + + /** Current profiling section */ + private String profilingSection = ""; + + /** Profiling map */ + private final Map profilingMap = new HashMap(); + + /** + * Clear profiling. + */ + public void clearProfiling() + { + this.profilingMap.clear(); + this.profilingSection = ""; + this.sectionList.clear(); + } + + /** + * Start section + */ + public void startSection(String par1Str) + { + if (this.profilingEnabled) + { + if (this.profilingSection.length() > 0) + { + this.profilingSection = this.profilingSection + "."; + } + + this.profilingSection = this.profilingSection + par1Str; + this.sectionList.add(this.profilingSection); + this.timestampList.add(Long.valueOf(System.nanoTime())); + } + } + + /** + * End section + */ + public void endSection() + { + if (this.profilingEnabled) + { + long var1 = System.nanoTime(); + long var3 = ((Long)this.timestampList.remove(this.timestampList.size() - 1)).longValue(); + this.sectionList.remove(this.sectionList.size() - 1); + long var5 = var1 - var3; + + if (this.profilingMap.containsKey(this.profilingSection)) + { + this.profilingMap.put(this.profilingSection, Long.valueOf(((Long)this.profilingMap.get(this.profilingSection)).longValue() + var5)); + } + else + { + this.profilingMap.put(this.profilingSection, Long.valueOf(var5)); + } + + if (var5 > 100000000L) + { + System.out.println("Something\'s taking too long! \'" + this.profilingSection + "\' took aprox " + (double)var5 / 1000000.0D + " ms"); + } + + this.profilingSection = !this.sectionList.isEmpty() ? (String)this.sectionList.get(this.sectionList.size() - 1) : ""; + } + } + + /** + * Get profiling data + */ + public List getProfilingData(String par1Str) + { + if (!this.profilingEnabled) + { + return null; + } + else + { + long var3 = this.profilingMap.containsKey("root") ? ((Long)this.profilingMap.get("root")).longValue() : 0L; + long var5 = this.profilingMap.containsKey(par1Str) ? ((Long)this.profilingMap.get(par1Str)).longValue() : -1L; + ArrayList var7 = new ArrayList(); + + if (par1Str.length() > 0) + { + par1Str = par1Str + "."; + } + + long var8 = 0L; + Iterator var10 = this.profilingMap.keySet().iterator(); + + while (var10.hasNext()) + { + String var11 = (String)var10.next(); + + if (var11.length() > par1Str.length() && var11.startsWith(par1Str) && var11.indexOf(".", par1Str.length() + 1) < 0) + { + var8 += ((Long)this.profilingMap.get(var11)).longValue(); + } + } + + float var20 = (float)var8; + + if (var8 < var5) + { + var8 = var5; + } + + if (var3 < var8) + { + var3 = var8; + } + + Iterator var21 = this.profilingMap.keySet().iterator(); + String var12; + + while (var21.hasNext()) + { + var12 = (String)var21.next(); + + if (var12.length() > par1Str.length() && var12.startsWith(par1Str) && var12.indexOf(".", par1Str.length() + 1) < 0) + { + long var13 = ((Long)this.profilingMap.get(var12)).longValue(); + double var15 = (double)var13 * 100.0D / (double)var8; + double var17 = (double)var13 * 100.0D / (double)var3; + String var19 = var12.substring(par1Str.length()); + var7.add(new ProfilerResult(var19, var15, var17)); + } + } + + var21 = this.profilingMap.keySet().iterator(); + + while (var21.hasNext()) + { + var12 = (String)var21.next(); + this.profilingMap.put(var12, Long.valueOf(((Long)this.profilingMap.get(var12)).longValue() * 999L / 1000L)); + } + + if ((float)var8 > var20) + { + var7.add(new ProfilerResult("unspecified", (double)((float)var8 - var20) * 100.0D / (double)var8, (double)((float)var8 - var20) * 100.0D / (double)var3)); + } + + Collections.sort(var7); + var7.add(0, new ProfilerResult(par1Str, 100.0D, (double)var8 * 100.0D / (double)var3)); + return var7; + } + } + + /** + * End current section and start a new section + */ + public void endStartSection(String par1Str) + { + this.endSection(); + this.startSection(par1Str); + } + + public String getNameOfLastSection() + { + return this.sectionList.size() == 0 ? "[UNKNOWN]" : (String)this.sectionList.get(this.sectionList.size() - 1); + } +} diff --git a/src/main/java/net/minecraft/src/ProfilerResult.java b/src/main/java/net/minecraft/src/ProfilerResult.java new file mode 100644 index 0000000..8b5d19c --- /dev/null +++ b/src/main/java/net/minecraft/src/ProfilerResult.java @@ -0,0 +1,30 @@ +package net.minecraft.src; + +public final class ProfilerResult implements Comparable +{ + public double field_76332_a; + public double field_76330_b; + public String field_76331_c; + + public ProfilerResult(String par1Str, double par2, double par4) + { + this.field_76331_c = par1Str; + this.field_76332_a = par2; + this.field_76330_b = par4; + } + + public int func_76328_a(ProfilerResult par1ProfilerResult) + { + return par1ProfilerResult.field_76332_a < this.field_76332_a ? -1 : (par1ProfilerResult.field_76332_a > this.field_76332_a ? 1 : par1ProfilerResult.field_76331_c.compareTo(this.field_76331_c)); + } + + public int func_76329_a() + { + return (this.field_76331_c.hashCode() & 11184810) + 4473924; + } + + public int compareTo(Object par1Obj) + { + return this.func_76328_a((ProfilerResult)par1Obj); + } +} diff --git a/src/main/java/net/minecraft/src/PropertyManager.java b/src/main/java/net/minecraft/src/PropertyManager.java new file mode 100644 index 0000000..589afe9 --- /dev/null +++ b/src/main/java/net/minecraft/src/PropertyManager.java @@ -0,0 +1,162 @@ +package net.minecraft.src; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Properties; + +public class PropertyManager +{ + private final Properties properties = new Properties(); + + /** Reference to the logger. */ + private final ILogAgent logger; + private final File associatedFile; + + public PropertyManager(File par1File, ILogAgent par2ILogAgent) + { + this.associatedFile = par1File; + this.logger = par2ILogAgent; + + if (par1File.exists()) + { + FileInputStream var3 = null; + + try + { + var3 = new FileInputStream(par1File); + this.properties.load(var3); + } + catch (Exception var13) + { + par2ILogAgent.logWarningException("Failed to load " + par1File, var13); + this.logMessageAndSave(); + } + finally + { + if (var3 != null) + { + try + { + var3.close(); + } + catch (IOException var12) + { + ; + } + } + } + } + else + { + par2ILogAgent.logWarning(par1File + " does not exist"); + this.logMessageAndSave(); + } + } + + /** + * logs an info message then calls saveSettingsToFile Yes this appears to be a potential stack overflow - these 2 + * functions call each other repeatdly if an exception occurs. + */ + public void logMessageAndSave() + { + this.logger.logInfo("Generating new properties file"); + this.saveProperties(); + } + + /** + * Writes the properties to the properties file. + */ + public void saveProperties() + { + FileOutputStream var1 = null; + + try + { + var1 = new FileOutputStream(this.associatedFile); + this.properties.store(var1, "Minecraft server properties"); + } + catch (Exception var11) + { + this.logger.logWarningException("Failed to save " + this.associatedFile, var11); + this.logMessageAndSave(); + } + finally + { + if (var1 != null) + { + try + { + var1.close(); + } + catch (IOException var10) + { + ; + } + } + } + } + + /** + * Returns this PropertyManager's file object used for property saving. + */ + public File getPropertiesFile() + { + return this.associatedFile; + } + + /** + * Gets a property. If it does not exist, set it to the specified value. + */ + public String getProperty(String par1Str, String par2Str) + { + if (!this.properties.containsKey(par1Str)) + { + this.properties.setProperty(par1Str, par2Str); + this.saveProperties(); + } + + return this.properties.getProperty(par1Str, par2Str); + } + + /** + * Gets an integer property. If it does not exist, set it to the specified value. + */ + public int getIntProperty(String par1Str, int par2) + { + try + { + return Integer.parseInt(this.getProperty(par1Str, "" + par2)); + } + catch (Exception var4) + { + this.properties.setProperty(par1Str, "" + par2); + return par2; + } + } + + /** + * Gets a boolean property. If it does not exist, set it to the specified value. + */ + public boolean getBooleanProperty(String par1Str, boolean par2) + { + try + { + return Boolean.parseBoolean(this.getProperty(par1Str, "" + par2)); + } + catch (Exception var4) + { + this.properties.setProperty(par1Str, "" + par2); + return par2; + } + } + + /** + * Saves an Object with the given property name. + */ + public void setProperty(String par1Str, Object par2Obj) + { + this.properties.setProperty(par1Str, "" + par2Obj); + } +} diff --git a/src/main/java/net/minecraft/src/RConConsoleSource.java b/src/main/java/net/minecraft/src/RConConsoleSource.java new file mode 100644 index 0000000..9397fc1 --- /dev/null +++ b/src/main/java/net/minecraft/src/RConConsoleSource.java @@ -0,0 +1,59 @@ +package net.minecraft.src; + +import net.minecraft.server.MinecraftServer; + +public class RConConsoleSource implements ICommandSender +{ + /** only ever used by MinecraftServer.executeCommand */ + public static final RConConsoleSource consoleBuffer = new RConConsoleSource(); + + /** RCon string buffer for log. */ + private StringBuffer buffer = new StringBuffer(); + + /** + * Clears the RCon log + */ + public void resetLog() + { + this.buffer.setLength(0); + } + + public String getChatBuffer() + { + return this.buffer.toString(); + } + + /** + * Gets the name of this command sender (usually username, but possibly "Rcon") + */ + public String getCommandSenderName() + { + return "Rcon"; + } + + public void sendChatToPlayer(ChatMessageComponent par1ChatMessageComponent) + { + this.buffer.append(par1ChatMessageComponent.toString()); + } + + /** + * Returns true if the command sender is allowed to use the given command. + */ + public boolean canCommandSenderUseCommand(int par1, String par2Str) + { + return true; + } + + /** + * Return the position for this command sender. + */ + public ChunkCoordinates getPlayerCoordinates() + { + return new ChunkCoordinates(0, 0, 0); + } + + public World getEntityWorld() + { + return MinecraftServer.getServer().getEntityWorld(); + } +} diff --git a/src/main/java/net/minecraft/src/RConOutputStream.java b/src/main/java/net/minecraft/src/RConOutputStream.java new file mode 100644 index 0000000..7e51314 --- /dev/null +++ b/src/main/java/net/minecraft/src/RConOutputStream.java @@ -0,0 +1,69 @@ +package net.minecraft.src; + +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; + +public class RConOutputStream +{ + /** Output stream */ + private ByteArrayOutputStream byteArrayOutput; + + /** ByteArrayOutputStream wrapper */ + private DataOutputStream output; + + public RConOutputStream(int par1) + { + this.byteArrayOutput = new ByteArrayOutputStream(par1); + this.output = new DataOutputStream(this.byteArrayOutput); + } + + /** + * Writes the given byte array to the output stream + */ + public void writeByteArray(byte[] par1ArrayOfByte) throws IOException + { + this.output.write(par1ArrayOfByte, 0, par1ArrayOfByte.length); + } + + /** + * Writes the given String to the output stream + */ + public void writeString(String par1Str) throws IOException + { + this.output.writeBytes(par1Str); + this.output.write(0); + } + + /** + * Writes the given int to the output stream + */ + public void writeInt(int par1) throws IOException + { + this.output.write(par1); + } + + /** + * Writes the given short to the output stream + */ + public void writeShort(short par1) throws IOException + { + this.output.writeShort(Short.reverseBytes(par1)); + } + + /** + * Returns the contents of the output stream as a byte array + */ + public byte[] toByteArray() + { + return this.byteArrayOutput.toByteArray(); + } + + /** + * Resets the byte array output. + */ + public void reset() + { + this.byteArrayOutput.reset(); + } +} diff --git a/src/main/java/net/minecraft/src/RConThreadBase.java b/src/main/java/net/minecraft/src/RConThreadBase.java new file mode 100644 index 0000000..ea36fcc --- /dev/null +++ b/src/main/java/net/minecraft/src/RConThreadBase.java @@ -0,0 +1,226 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.net.DatagramSocket; +import java.net.ServerSocket; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public abstract class RConThreadBase implements Runnable +{ + /** True if the Thread is running, false otherwise */ + protected boolean running; + + /** Reference to the IServer object. */ + protected IServer server; + + /** Thread for this runnable class */ + protected Thread rconThread; + protected int field_72615_d = 5; + + /** A list of registered DatagramSockets */ + protected List socketList = new ArrayList(); + + /** A list of registered ServerSockets */ + protected List serverSocketList = new ArrayList(); + + RConThreadBase(IServer par1IServer) + { + this.server = par1IServer; + + if (this.server.isDebuggingEnabled()) + { + this.logWarning("Debugging is enabled, performance maybe reduced!"); + } + } + + /** + * Creates a new Thread object from this class and starts running + */ + public synchronized void startThread() + { + this.rconThread = new Thread(this); + this.rconThread.start(); + this.running = true; + } + + /** + * Returns true if the Thread is running, false otherwise + */ + public boolean isRunning() + { + return this.running; + } + + /** + * Log debug message + */ + protected void logDebug(String par1Str) + { + this.server.logDebug(par1Str); + } + + /** + * Log information message + */ + protected void logInfo(String par1Str) + { + this.server.logInfo(par1Str); + } + + /** + * Log warning message + */ + protected void logWarning(String par1Str) + { + this.server.logWarning(par1Str); + } + + /** + * Log severe error message + */ + protected void logSevere(String par1Str) + { + this.server.logSevere(par1Str); + } + + /** + * Returns the number of players on the server + */ + protected int getNumberOfPlayers() + { + return this.server.getCurrentPlayerCount(); + } + + /** + * Registers a DatagramSocket with this thread + */ + protected void registerSocket(DatagramSocket par1DatagramSocket) + { + this.logDebug("registerSocket: " + par1DatagramSocket); + this.socketList.add(par1DatagramSocket); + } + + /** + * Closes the specified DatagramSocket + */ + protected boolean closeSocket(DatagramSocket par1DatagramSocket, boolean par2) + { + this.logDebug("closeSocket: " + par1DatagramSocket); + + if (null == par1DatagramSocket) + { + return false; + } + else + { + boolean var3 = false; + + if (!par1DatagramSocket.isClosed()) + { + par1DatagramSocket.close(); + var3 = true; + } + + if (par2) + { + this.socketList.remove(par1DatagramSocket); + } + + return var3; + } + } + + /** + * Closes the specified ServerSocket + */ + protected boolean closeServerSocket(ServerSocket par1ServerSocket) + { + return this.closeServerSocket_do(par1ServerSocket, true); + } + + /** + * Closes the specified ServerSocket + */ + protected boolean closeServerSocket_do(ServerSocket par1ServerSocket, boolean par2) + { + this.logDebug("closeSocket: " + par1ServerSocket); + + if (null == par1ServerSocket) + { + return false; + } + else + { + boolean var3 = false; + + try + { + if (!par1ServerSocket.isClosed()) + { + par1ServerSocket.close(); + var3 = true; + } + } + catch (IOException var5) + { + this.logWarning("IO: " + var5.getMessage()); + } + + if (par2) + { + this.serverSocketList.remove(par1ServerSocket); + } + + return var3; + } + } + + /** + * Closes all of the opened sockets + */ + protected void closeAllSockets() + { + this.closeAllSockets_do(false); + } + + /** + * Closes all of the opened sockets + */ + protected void closeAllSockets_do(boolean par1) + { + int var2 = 0; + Iterator var3 = this.socketList.iterator(); + + while (var3.hasNext()) + { + DatagramSocket var4 = (DatagramSocket)var3.next(); + + if (this.closeSocket(var4, false)) + { + ++var2; + } + } + + this.socketList.clear(); + var3 = this.serverSocketList.iterator(); + + while (var3.hasNext()) + { + ServerSocket var5 = (ServerSocket)var3.next(); + + if (this.closeServerSocket_do(var5, false)) + { + ++var2; + } + } + + this.serverSocketList.clear(); + + if (par1 && 0 < var2) + { + this.logWarning("Force closed " + var2 + " sockets"); + } + } +} diff --git a/src/main/java/net/minecraft/src/RConThreadClient.java b/src/main/java/net/minecraft/src/RConThreadClient.java new file mode 100644 index 0000000..e2e09f8 --- /dev/null +++ b/src/main/java/net/minecraft/src/RConThreadClient.java @@ -0,0 +1,195 @@ +package net.minecraft.src; + +import java.io.BufferedInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.net.Socket; +import java.net.SocketTimeoutException; + +public class RConThreadClient extends RConThreadBase +{ + /** + * True if the client has succefssfully logged into the RCon, otherwise false + */ + private boolean loggedIn; + + /** The client's Socket connection */ + private Socket clientSocket; + + /** A buffer for incoming Socket data */ + private byte[] buffer = new byte[1460]; + + /** The RCon password */ + private String rconPassword; + + RConThreadClient(IServer par1IServer, Socket par2Socket) + { + super(par1IServer); + this.clientSocket = par2Socket; + + try + { + this.clientSocket.setSoTimeout(0); + } + catch (Exception var4) + { + this.running = false; + } + + this.rconPassword = par1IServer.getStringProperty("rcon.password", ""); + this.logInfo("Rcon connection from: " + par2Socket.getInetAddress()); + } + + public void run() + { + try + { + while (true) + { + if (!this.running) + { + break; + } + + BufferedInputStream var1 = new BufferedInputStream(this.clientSocket.getInputStream()); + int var2 = var1.read(this.buffer, 0, 1460); + + if (10 <= var2) + { + byte var3 = 0; + int var4 = RConUtils.getBytesAsLEInt(this.buffer, 0, var2); + + if (var4 != var2 - 4) + { + return; + } + + int var21 = var3 + 4; + int var5 = RConUtils.getBytesAsLEInt(this.buffer, var21, var2); + var21 += 4; + int var6 = RConUtils.getRemainingBytesAsLEInt(this.buffer, var21); + var21 += 4; + + switch (var6) + { + case 2: + if (this.loggedIn) + { + String var8 = RConUtils.getBytesAsString(this.buffer, var21, var2); + + try + { + this.sendMultipacketResponse(var5, this.server.executeCommand(var8)); + } + catch (Exception var16) + { + this.sendMultipacketResponse(var5, "Error executing: " + var8 + " (" + var16.getMessage() + ")"); + } + + continue; + } + + this.sendLoginFailedResponse(); + continue; + + case 3: + String var7 = RConUtils.getBytesAsString(this.buffer, var21, var2); + int var10000 = var21 + var7.length(); + + if (0 != var7.length() && var7.equals(this.rconPassword)) + { + this.loggedIn = true; + this.sendResponse(var5, 2, ""); + continue; + } + + this.loggedIn = false; + this.sendLoginFailedResponse(); + continue; + + default: + this.sendMultipacketResponse(var5, String.format("Unknown request %s", new Object[] {Integer.toHexString(var6)})); + continue; + } + } + } + } + catch (SocketTimeoutException var17) + { + } + catch (IOException var18) + { + } + catch (Exception var19) + { + System.out.println(var19); + } + finally + { + this.closeSocket(); + } + } + + /** + * Sends the given response message to the client + */ + private void sendResponse(int par1, int par2, String par3Str) throws IOException + { + ByteArrayOutputStream var4 = new ByteArrayOutputStream(1248); + DataOutputStream var5 = new DataOutputStream(var4); + byte[] var6 = par3Str.getBytes("UTF-8"); + var5.writeInt(Integer.reverseBytes(var6.length + 10)); + var5.writeInt(Integer.reverseBytes(par1)); + var5.writeInt(Integer.reverseBytes(par2)); + var5.write(var6); + var5.write(0); + var5.write(0); + this.clientSocket.getOutputStream().write(var4.toByteArray()); + } + + /** + * Sends the standard RCon 'authorization failed' response packet + */ + private void sendLoginFailedResponse() throws IOException + { + this.sendResponse(-1, 2, ""); + } + + /** + * Splits the response message into individual packets and sends each one + */ + private void sendMultipacketResponse(int par1, String par2Str) throws IOException + { + int var3 = par2Str.length(); + + do + { + int var4 = 4096 <= var3 ? 4096 : var3; + this.sendResponse(par1, 0, par2Str.substring(0, var4)); + par2Str = par2Str.substring(var4); + var3 = par2Str.length(); + } + while (0 != var3); + } + + /** + * Closes the client socket + */ + private void closeSocket() + { + if (null != this.clientSocket) + { + try + { + this.clientSocket.close(); + } + catch (IOException var2) + { + this.logWarning("IO: " + var2.getMessage()); + } + + this.clientSocket = null; + } + } +} diff --git a/src/main/java/net/minecraft/src/RConThreadMain.java b/src/main/java/net/minecraft/src/RConThreadMain.java new file mode 100644 index 0000000..392183a --- /dev/null +++ b/src/main/java/net/minecraft/src/RConThreadMain.java @@ -0,0 +1,153 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketTimeoutException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + +public class RConThreadMain extends RConThreadBase +{ + /** Port RCon is running on */ + private int rconPort; + + /** Port the server is running on */ + private int serverPort; + + /** Hostname RCon is running on */ + private String hostname; + + /** The RCon ServerSocket. */ + private ServerSocket serverSocket; + + /** The RCon password */ + private String rconPassword; + + /** A map of client addresses to their running Threads */ + private Map clientThreads; + + public RConThreadMain(IServer par1IServer) + { + super(par1IServer); + this.rconPort = par1IServer.getIntProperty("rcon.port", 0); + this.rconPassword = par1IServer.getStringProperty("rcon.password", ""); + this.hostname = par1IServer.getHostname(); + this.serverPort = par1IServer.getPort(); + + if (0 == this.rconPort) + { + this.rconPort = this.serverPort + 10; + this.logInfo("Setting default rcon port to " + this.rconPort); + par1IServer.setProperty("rcon.port", Integer.valueOf(this.rconPort)); + + if (0 == this.rconPassword.length()) + { + par1IServer.setProperty("rcon.password", ""); + } + + par1IServer.saveProperties(); + } + + if (0 == this.hostname.length()) + { + this.hostname = "0.0.0.0"; + } + + this.initClientThreadList(); + this.serverSocket = null; + } + + private void initClientThreadList() + { + this.clientThreads = new HashMap(); + } + + /** + * Cleans up the clientThreads map by removing client Threads that are not running + */ + private void cleanClientThreadsMap() + { + Iterator var1 = this.clientThreads.entrySet().iterator(); + + while (var1.hasNext()) + { + Entry var2 = (Entry)var1.next(); + + if (!((RConThreadClient)var2.getValue()).isRunning()) + { + var1.remove(); + } + } + } + + public void run() + { + this.logInfo("RCON running on " + this.hostname + ":" + this.rconPort); + + try + { + while (this.running) + { + try + { + Socket var1 = this.serverSocket.accept(); + var1.setSoTimeout(500); + RConThreadClient var2 = new RConThreadClient(this.server, var1); + var2.startThread(); + this.clientThreads.put(var1.getRemoteSocketAddress(), var2); + this.cleanClientThreadsMap(); + } + catch (SocketTimeoutException var7) + { + this.cleanClientThreadsMap(); + } + catch (IOException var8) + { + if (this.running) + { + this.logInfo("IO: " + var8.getMessage()); + } + } + } + } + finally + { + this.closeServerSocket(this.serverSocket); + } + } + + /** + * Creates a new Thread object from this class and starts running + */ + public void startThread() + { + if (0 == this.rconPassword.length()) + { + this.logWarning("No rcon password set in \'" + this.server.getSettingsFilename() + "\', rcon disabled!"); + } + else if (0 < this.rconPort && 65535 >= this.rconPort) + { + if (!this.running) + { + try + { + this.serverSocket = new ServerSocket(this.rconPort, 0, InetAddress.getByName(this.hostname)); + this.serverSocket.setSoTimeout(500); + super.startThread(); + } + catch (IOException var2) + { + this.logWarning("Unable to initialise rcon on " + this.hostname + ":" + this.rconPort + " : " + var2.getMessage()); + } + } + } + else + { + this.logWarning("Invalid rcon port " + this.rconPort + " found in \'" + this.server.getSettingsFilename() + "\', rcon disabled!"); + } + } +} diff --git a/src/main/java/net/minecraft/src/RConThreadQuery.java b/src/main/java/net/minecraft/src/RConThreadQuery.java new file mode 100644 index 0000000..f76662d --- /dev/null +++ b/src/main/java/net/minecraft/src/RConThreadQuery.java @@ -0,0 +1,409 @@ +package net.minecraft.src; + +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.net.PortUnreachableException; +import java.net.SocketAddress; +import java.net.SocketException; +import java.net.SocketTimeoutException; +import java.net.UnknownHostException; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.server.MinecraftServer; + +public class RConThreadQuery extends RConThreadBase +{ + /** The time of the last client auth check */ + private long lastAuthCheckTime; + + /** The RCon query port */ + private int queryPort; + + /** Port the server is running on */ + private int serverPort; + + /** The maximum number of players allowed on the server */ + private int maxPlayers; + + /** The current server message of the day */ + private String serverMotd; + + /** The name of the currently loaded world */ + private String worldName; + + /** The remote socket querying the server */ + private DatagramSocket querySocket; + + /** A buffer for incoming DatagramPackets */ + private byte[] buffer = new byte[1460]; + + /** Storage for incoming DatagramPackets */ + private DatagramPacket incomingPacket; + private Map field_72644_p; + + /** The hostname of this query server */ + private String queryHostname; + + /** The hostname of the running server */ + private String serverHostname; + + /** A map of SocketAddress objects to RConThreadQueryAuth objects */ + private Map queryClients; + + /** + * The time that this RConThreadQuery was constructed, from (new Date()).getTime() + */ + private long time; + + /** The RConQuery output stream */ + private RConOutputStream output; + + /** The time of the last query response sent */ + private long lastQueryResponseTime; + + public RConThreadQuery(IServer par1IServer) + { + super(par1IServer); + this.queryPort = par1IServer.getIntProperty("query.port", 0); + this.serverHostname = par1IServer.getHostname(); + this.serverPort = par1IServer.getPort(); + this.serverMotd = par1IServer.getServerMOTD(); + this.maxPlayers = par1IServer.getMaxPlayers(); + this.worldName = par1IServer.getFolderName(); + this.lastQueryResponseTime = 0L; + this.queryHostname = "0.0.0.0"; + + if (0 != this.serverHostname.length() && !this.queryHostname.equals(this.serverHostname)) + { + this.queryHostname = this.serverHostname; + } + else + { + this.serverHostname = "0.0.0.0"; + + try + { + InetAddress var2 = InetAddress.getLocalHost(); + this.queryHostname = var2.getHostAddress(); + } + catch (UnknownHostException var3) + { + this.logWarning("Unable to determine local host IP, please set server-ip in \'" + par1IServer.getSettingsFilename() + "\' : " + var3.getMessage()); + } + } + + if (0 == this.queryPort) + { + this.queryPort = this.serverPort; + this.logInfo("Setting default query port to " + this.queryPort); + par1IServer.setProperty("query.port", Integer.valueOf(this.queryPort)); + par1IServer.setProperty("debug", Boolean.valueOf(false)); + par1IServer.saveProperties(); + } + + this.field_72644_p = new HashMap(); + this.output = new RConOutputStream(1460); + this.queryClients = new HashMap(); + this.time = (new Date()).getTime(); + } + + /** + * Sends a byte array as a DatagramPacket response to the client who sent the given DatagramPacket + */ + private void sendResponsePacket(byte[] par1ArrayOfByte, DatagramPacket par2DatagramPacket) throws IOException + { + this.querySocket.send(new DatagramPacket(par1ArrayOfByte, par1ArrayOfByte.length, par2DatagramPacket.getSocketAddress())); + } + + /** + * Parses an incoming DatagramPacket, returning true if the packet was valid + */ + private boolean parseIncomingPacket(DatagramPacket par1DatagramPacket) throws IOException + { + byte[] var2 = par1DatagramPacket.getData(); + int var3 = par1DatagramPacket.getLength(); + SocketAddress var4 = par1DatagramPacket.getSocketAddress(); + this.logDebug("Packet len " + var3 + " [" + var4 + "]"); + + if (3 <= var3 && -2 == var2[0] && -3 == var2[1]) + { + this.logDebug("Packet \'" + RConUtils.getByteAsHexString(var2[2]) + "\' [" + var4 + "]"); + + switch (var2[2]) + { + case 0: + if (!this.verifyClientAuth(par1DatagramPacket).booleanValue()) + { + this.logDebug("Invalid challenge [" + var4 + "]"); + return false; + } + else if (15 == var3) + { + this.sendResponsePacket(this.createQueryResponse(par1DatagramPacket), par1DatagramPacket); + this.logDebug("Rules [" + var4 + "]"); + } + else + { + RConOutputStream var5 = new RConOutputStream(1460); + var5.writeInt(0); + var5.writeByteArray(this.getRequestID(par1DatagramPacket.getSocketAddress())); + var5.writeString(this.serverMotd); + var5.writeString("SMP"); + var5.writeString(this.worldName); + var5.writeString(Integer.toString(this.getNumberOfPlayers())); + var5.writeString(Integer.toString(this.maxPlayers)); + var5.writeShort((short)this.serverPort); + var5.writeString(this.queryHostname); + this.sendResponsePacket(var5.toByteArray(), par1DatagramPacket); + this.logDebug("Status [" + var4 + "]"); + } + + case 9: + this.sendAuthChallenge(par1DatagramPacket); + this.logDebug("Challenge [" + var4 + "]"); + return true; + + default: + return true; + } + } + else + { + this.logDebug("Invalid packet [" + var4 + "]"); + return false; + } + } + + /** + * Creates a query response as a byte array for the specified query DatagramPacket + */ + private byte[] createQueryResponse(DatagramPacket par1DatagramPacket) throws IOException + { + long var2 = MinecraftServer.getSystemTimeMillis(); + + if (var2 < this.lastQueryResponseTime + 5000L) + { + byte[] var7 = this.output.toByteArray(); + byte[] var8 = this.getRequestID(par1DatagramPacket.getSocketAddress()); + var7[1] = var8[0]; + var7[2] = var8[1]; + var7[3] = var8[2]; + var7[4] = var8[3]; + return var7; + } + else + { + this.lastQueryResponseTime = var2; + this.output.reset(); + this.output.writeInt(0); + this.output.writeByteArray(this.getRequestID(par1DatagramPacket.getSocketAddress())); + this.output.writeString("splitnum"); + this.output.writeInt(128); + this.output.writeInt(0); + this.output.writeString("hostname"); + this.output.writeString(this.serverMotd); + this.output.writeString("gametype"); + this.output.writeString("SMP"); + this.output.writeString("game_id"); + this.output.writeString("MINECRAFT"); + this.output.writeString("version"); + this.output.writeString(this.server.getMinecraftVersion()); + this.output.writeString("plugins"); + this.output.writeString(this.server.getPlugins()); + this.output.writeString("map"); + this.output.writeString(this.worldName); + this.output.writeString("numplayers"); + this.output.writeString("" + this.getNumberOfPlayers()); + this.output.writeString("maxplayers"); + this.output.writeString("" + this.maxPlayers); + this.output.writeString("hostport"); + this.output.writeString("" + this.serverPort); + this.output.writeString("hostip"); + this.output.writeString(this.queryHostname); + this.output.writeInt(0); + this.output.writeInt(1); + this.output.writeString("player_"); + this.output.writeInt(0); + String[] var4 = this.server.getAllUsernames(); + byte var5 = (byte)var4.length; + + for (byte var6 = (byte)(var5 - 1); var6 >= 0; --var6) + { + this.output.writeString(var4[var6]); + } + + this.output.writeInt(0); + return this.output.toByteArray(); + } + } + + /** + * Returns the request ID provided by the authorized client + */ + private byte[] getRequestID(SocketAddress par1SocketAddress) + { + return ((RConThreadQueryAuth)this.queryClients.get(par1SocketAddress)).getRequestId(); + } + + /** + * Returns true if the client has a valid auth, otherwise false + */ + private Boolean verifyClientAuth(DatagramPacket par1DatagramPacket) + { + SocketAddress var2 = par1DatagramPacket.getSocketAddress(); + + if (!this.queryClients.containsKey(var2)) + { + return Boolean.valueOf(false); + } + else + { + byte[] var3 = par1DatagramPacket.getData(); + return ((RConThreadQueryAuth)this.queryClients.get(var2)).getRandomChallenge() != RConUtils.getBytesAsBEint(var3, 7, par1DatagramPacket.getLength()) ? Boolean.valueOf(false) : Boolean.valueOf(true); + } + } + + /** + * Sends an auth challenge DatagramPacket to the client and adds the client to the queryClients map + */ + private void sendAuthChallenge(DatagramPacket par1DatagramPacket) throws IOException + { + RConThreadQueryAuth var2 = new RConThreadQueryAuth(this, par1DatagramPacket); + this.queryClients.put(par1DatagramPacket.getSocketAddress(), var2); + this.sendResponsePacket(var2.getChallengeValue(), par1DatagramPacket); + } + + /** + * Removes all clients whose auth is no longer valid + */ + private void cleanQueryClientsMap() + { + if (this.running) + { + long var1 = MinecraftServer.getSystemTimeMillis(); + + if (var1 >= this.lastAuthCheckTime + 30000L) + { + this.lastAuthCheckTime = var1; + Iterator var3 = this.queryClients.entrySet().iterator(); + + while (var3.hasNext()) + { + Entry var4 = (Entry)var3.next(); + + if (((RConThreadQueryAuth)var4.getValue()).hasExpired(var1).booleanValue()) + { + var3.remove(); + } + } + } + } + } + + public void run() + { + this.logInfo("Query running on " + this.serverHostname + ":" + this.queryPort); + this.lastAuthCheckTime = MinecraftServer.getSystemTimeMillis(); + this.incomingPacket = new DatagramPacket(this.buffer, this.buffer.length); + + try + { + while (this.running) + { + try + { + this.querySocket.receive(this.incomingPacket); + this.cleanQueryClientsMap(); + this.parseIncomingPacket(this.incomingPacket); + } + catch (SocketTimeoutException var7) + { + this.cleanQueryClientsMap(); + } + catch (PortUnreachableException var8) + { + ; + } + catch (IOException var9) + { + this.stopWithException(var9); + } + } + } + finally + { + this.closeAllSockets(); + } + } + + /** + * Creates a new Thread object from this class and starts running + */ + public void startThread() + { + if (!this.running) + { + if (0 < this.queryPort && 65535 >= this.queryPort) + { + if (this.initQuerySystem()) + { + super.startThread(); + } + } + else + { + this.logWarning("Invalid query port " + this.queryPort + " found in \'" + this.server.getSettingsFilename() + "\' (queries disabled)"); + } + } + } + + /** + * Stops the query server and reports the given Exception + */ + private void stopWithException(Exception par1Exception) + { + if (this.running) + { + this.logWarning("Unexpected exception, buggy JRE? (" + par1Exception.toString() + ")"); + + if (!this.initQuerySystem()) + { + this.logSevere("Failed to recover from buggy JRE, shutting down!"); + this.running = false; + } + } + } + + /** + * Initializes the query system by binding it to a port + */ + private boolean initQuerySystem() + { + try + { + this.querySocket = new DatagramSocket(this.queryPort, InetAddress.getByName(this.serverHostname)); + this.registerSocket(this.querySocket); + this.querySocket.setSoTimeout(500); + return true; + } + catch (SocketException var2) + { + this.logWarning("Unable to initialise query system on " + this.serverHostname + ":" + this.queryPort + " (Socket): " + var2.getMessage()); + } + catch (UnknownHostException var3) + { + this.logWarning("Unable to initialise query system on " + this.serverHostname + ":" + this.queryPort + " (Unknown Host): " + var3.getMessage()); + } + catch (Exception var4) + { + this.logWarning("Unable to initialise query system on " + this.serverHostname + ":" + this.queryPort + " (E): " + var4.getMessage()); + } + + return false; + } +} diff --git a/src/main/java/net/minecraft/src/RConThreadQueryAuth.java b/src/main/java/net/minecraft/src/RConThreadQueryAuth.java new file mode 100644 index 0000000..3db016c --- /dev/null +++ b/src/main/java/net/minecraft/src/RConThreadQueryAuth.java @@ -0,0 +1,73 @@ +package net.minecraft.src; + +import java.net.DatagramPacket; +import java.util.Date; +import java.util.Random; + +class RConThreadQueryAuth +{ + /** The creation timestamp for this auth */ + private long timestamp; + + /** A random challenge */ + private int randomChallenge; + + /** A client-provided request ID associated with this query. */ + private byte[] requestId; + + /** A unique string of bytes used to verify client auth */ + private byte[] challengeValue; + + /** The request ID stored as a String */ + private String requestIdAsString; + + /** The RConThreadQuery that this is probably an inner class of */ + final RConThreadQuery queryThread; + + public RConThreadQueryAuth(RConThreadQuery par1RConThreadQuery, DatagramPacket par2DatagramPacket) + { + this.queryThread = par1RConThreadQuery; + this.timestamp = (new Date()).getTime(); + byte[] var3 = par2DatagramPacket.getData(); + this.requestId = new byte[4]; + this.requestId[0] = var3[3]; + this.requestId[1] = var3[4]; + this.requestId[2] = var3[5]; + this.requestId[3] = var3[6]; + this.requestIdAsString = new String(this.requestId); + this.randomChallenge = (new Random()).nextInt(16777216); + this.challengeValue = String.format("\t%s%d\u0000", new Object[] {this.requestIdAsString, Integer.valueOf(this.randomChallenge)}).getBytes(); + } + + /** + * Returns true if the auth's creation timestamp is less than the given time, otherwise false + */ + public Boolean hasExpired(long par1) + { + return Boolean.valueOf(this.timestamp < par1); + } + + /** + * Returns the random challenge number assigned to this auth + */ + public int getRandomChallenge() + { + return this.randomChallenge; + } + + /** + * Returns the auth challenge value + */ + public byte[] getChallengeValue() + { + return this.challengeValue; + } + + /** + * Returns the request ID provided by the client. + */ + public byte[] getRequestId() + { + return this.requestId; + } +} diff --git a/src/main/java/net/minecraft/src/RConUtils.java b/src/main/java/net/minecraft/src/RConUtils.java new file mode 100644 index 0000000..d195039 --- /dev/null +++ b/src/main/java/net/minecraft/src/RConUtils.java @@ -0,0 +1,65 @@ +package net.minecraft.src; + +import java.io.UnsupportedEncodingException; + +public class RConUtils +{ + /** Translation array of decimal to hex digits */ + public static char[] hexDigits = new char[] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + + /** + * Read a null-terminated string from the given byte array + */ + public static String getBytesAsString(byte[] par0ArrayOfByte, int par1, int par2) + { + int var3 = par2 - 1; + int var4; + + for (var4 = par1 > var3 ? var3 : par1; 0 != par0ArrayOfByte[var4] && var4 < var3; ++var4) + { + ; + } + + try + { + return new String(par0ArrayOfByte, par1, var4 - par1, "UTF-8"); + } + catch (UnsupportedEncodingException var6) + { + var6.printStackTrace(); + return null; + } + } + + /** + * Read 4 bytes from the + */ + public static int getRemainingBytesAsLEInt(byte[] par0ArrayOfByte, int par1) + { + return getBytesAsLEInt(par0ArrayOfByte, par1, par0ArrayOfByte.length); + } + + /** + * Read 4 bytes from the given array in little-endian format and return them as an int + */ + public static int getBytesAsLEInt(byte[] par0ArrayOfByte, int par1, int par2) + { + return 0 > par2 - par1 - 4 ? 0 : par0ArrayOfByte[par1 + 3] << 24 | (par0ArrayOfByte[par1 + 2] & 255) << 16 | (par0ArrayOfByte[par1 + 1] & 255) << 8 | par0ArrayOfByte[par1] & 255; + } + + /** + * Read 4 bytes from the given array in big-endian format and return them as an int + */ + public static int getBytesAsBEint(byte[] par0ArrayOfByte, int par1, int par2) + { + return 0 > par2 - par1 - 4 ? 0 : par0ArrayOfByte[par1] << 24 | (par0ArrayOfByte[par1 + 1] & 255) << 16 | (par0ArrayOfByte[par1 + 2] & 255) << 8 | par0ArrayOfByte[par1 + 3] & 255; + } + + /** + * Returns a String representation of the byte in hexadecimal format + */ + public static String getByteAsHexString(byte par0) + { + return "" + hexDigits[(par0 & 240) >>> 4] + hexDigits[par0 & 15]; + } +} diff --git a/src/main/java/net/minecraft/src/RandomPositionGenerator.java b/src/main/java/net/minecraft/src/RandomPositionGenerator.java new file mode 100644 index 0000000..7c674e3 --- /dev/null +++ b/src/main/java/net/minecraft/src/RandomPositionGenerator.java @@ -0,0 +1,105 @@ +package net.minecraft.src; + +import java.util.Random; + +public class RandomPositionGenerator +{ + /** + * used to store a driection when the user passes a point to move towards or away from. WARNING: NEVER THREAD SAFE. + * MULTIPLE findTowards and findAway calls, will share this var + */ + private static Vec3 staticVector = Vec3.createVectorHelper(0.0D, 0.0D, 0.0D); + + /** + * finds a random target within par1(x,z) and par2 (y) blocks + */ + public static Vec3 findRandomTarget(EntityCreature par0EntityCreature, int par1, int par2) + { + return findRandomTargetBlock(par0EntityCreature, par1, par2, (Vec3)null); + } + + /** + * finds a random target within par1(x,z) and par2 (y) blocks in the direction of the point par3 + */ + public static Vec3 findRandomTargetBlockTowards(EntityCreature par0EntityCreature, int par1, int par2, Vec3 par3Vec3) + { + staticVector.xCoord = par3Vec3.xCoord - par0EntityCreature.posX; + staticVector.yCoord = par3Vec3.yCoord - par0EntityCreature.posY; + staticVector.zCoord = par3Vec3.zCoord - par0EntityCreature.posZ; + return findRandomTargetBlock(par0EntityCreature, par1, par2, staticVector); + } + + /** + * finds a random target within par1(x,z) and par2 (y) blocks in the reverse direction of the point par3 + */ + public static Vec3 findRandomTargetBlockAwayFrom(EntityCreature par0EntityCreature, int par1, int par2, Vec3 par3Vec3) + { + staticVector.xCoord = par0EntityCreature.posX - par3Vec3.xCoord; + staticVector.yCoord = par0EntityCreature.posY - par3Vec3.yCoord; + staticVector.zCoord = par0EntityCreature.posZ - par3Vec3.zCoord; + return findRandomTargetBlock(par0EntityCreature, par1, par2, staticVector); + } + + /** + * searches 10 blocks at random in a within par1(x,z) and par2 (y) distance, ignores those not in the direction of + * par3Vec3, then points to the tile for which creature.getBlockPathWeight returns the highest number + */ + private static Vec3 findRandomTargetBlock(EntityCreature par0EntityCreature, int par1, int par2, Vec3 par3Vec3) + { + Random var4 = par0EntityCreature.getRNG(); + boolean var5 = false; + int var6 = 0; + int var7 = 0; + int var8 = 0; + float var9 = -99999.0F; + boolean var10; + + if (par0EntityCreature.hasHome()) + { + double var11 = (double)(par0EntityCreature.getHomePosition().getDistanceSquared(MathHelper.floor_double(par0EntityCreature.posX), MathHelper.floor_double(par0EntityCreature.posY), MathHelper.floor_double(par0EntityCreature.posZ)) + 4.0F); + double var13 = (double)(par0EntityCreature.func_110174_bM() + (float)par1); + var10 = var11 < var13 * var13; + } + else + { + var10 = false; + } + + for (int var16 = 0; var16 < 10; ++var16) + { + int var12 = var4.nextInt(2 * par1) - par1; + int var17 = var4.nextInt(2 * par2) - par2; + int var14 = var4.nextInt(2 * par1) - par1; + + if (par3Vec3 == null || (double)var12 * par3Vec3.xCoord + (double)var14 * par3Vec3.zCoord >= 0.0D) + { + var12 += MathHelper.floor_double(par0EntityCreature.posX); + var17 += MathHelper.floor_double(par0EntityCreature.posY); + var14 += MathHelper.floor_double(par0EntityCreature.posZ); + + if (!var10 || par0EntityCreature.func_110176_b(var12, var17, var14)) + { + float var15 = par0EntityCreature.getBlockPathWeight(var12, var17, var14); + + if (var15 > var9) + { + var9 = var15; + var6 = var12; + var7 = var17; + var8 = var14; + var5 = true; + } + } + } + } + + if (var5) + { + return par0EntityCreature.worldObj.getWorldVec3Pool().getVecFromPool((double)var6, (double)var7, (double)var8); + } + else + { + return null; + } + } +} diff --git a/src/main/java/net/minecraft/src/RangedAttribute.java b/src/main/java/net/minecraft/src/RangedAttribute.java new file mode 100644 index 0000000..8078ead --- /dev/null +++ b/src/main/java/net/minecraft/src/RangedAttribute.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +public class RangedAttribute extends BaseAttribute +{ + private final double minimumValue; + private final double maximumValue; + private String field_111119_c; + + public RangedAttribute(String par1Str, double par2, double par4, double par6) + { + super(par1Str, par2); + this.minimumValue = par4; + this.maximumValue = par6; + + if (par4 > par6) + { + throw new IllegalArgumentException("Minimum value cannot be bigger than maximum value!"); + } + else if (par2 < par4) + { + throw new IllegalArgumentException("Default value cannot be lower than minimum value!"); + } + else if (par2 > par6) + { + throw new IllegalArgumentException("Default value cannot be bigger than maximum value!"); + } + } + + public RangedAttribute func_111117_a(String par1Str) + { + this.field_111119_c = par1Str; + return this; + } + + public String func_111116_f() + { + return this.field_111119_c; + } + + public double clampValue(double par1) + { + if (par1 < this.minimumValue) + { + par1 = this.minimumValue; + } + + if (par1 > this.maximumValue) + { + par1 = this.maximumValue; + } + + return par1; + } +} diff --git a/src/main/java/net/minecraft/src/RecipeFireworks.java b/src/main/java/net/minecraft/src/RecipeFireworks.java new file mode 100644 index 0000000..f76f2f6 --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipeFireworks.java @@ -0,0 +1,248 @@ +package net.minecraft.src; + +import java.util.ArrayList; + +public class RecipeFireworks implements IRecipe +{ + private ItemStack field_92102_a; + + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World) + { + this.field_92102_a = null; + int var3 = 0; + int var4 = 0; + int var5 = 0; + int var6 = 0; + int var7 = 0; + int var8 = 0; + + for (int var9 = 0; var9 < par1InventoryCrafting.getSizeInventory(); ++var9) + { + ItemStack var10 = par1InventoryCrafting.getStackInSlot(var9); + + if (var10 != null) + { + if (var10.itemID == Item.gunpowder.itemID) + { + ++var4; + } + else if (var10.itemID == Item.fireworkCharge.itemID) + { + ++var6; + } + else if (var10.itemID == Item.dyePowder.itemID) + { + ++var5; + } + else if (var10.itemID == Item.paper.itemID) + { + ++var3; + } + else if (var10.itemID == Item.glowstone.itemID) + { + ++var7; + } + else if (var10.itemID == Item.diamond.itemID) + { + ++var7; + } + else if (var10.itemID == Item.fireballCharge.itemID) + { + ++var8; + } + else if (var10.itemID == Item.feather.itemID) + { + ++var8; + } + else if (var10.itemID == Item.goldNugget.itemID) + { + ++var8; + } + else + { + if (var10.itemID != Item.skull.itemID) + { + return false; + } + + ++var8; + } + } + } + + var7 += var5 + var8; + + if (var4 <= 3 && var3 <= 1) + { + NBTTagCompound var16; + NBTTagCompound var19; + + if (var4 >= 1 && var3 == 1 && var7 == 0) + { + this.field_92102_a = new ItemStack(Item.firework); + + if (var6 > 0) + { + var16 = new NBTTagCompound(); + var19 = new NBTTagCompound("Fireworks"); + NBTTagList var25 = new NBTTagList("Explosions"); + + for (int var22 = 0; var22 < par1InventoryCrafting.getSizeInventory(); ++var22) + { + ItemStack var26 = par1InventoryCrafting.getStackInSlot(var22); + + if (var26 != null && var26.itemID == Item.fireworkCharge.itemID && var26.hasTagCompound() && var26.getTagCompound().hasKey("Explosion")) + { + var25.appendTag(var26.getTagCompound().getCompoundTag("Explosion")); + } + } + + var19.setTag("Explosions", var25); + var19.setByte("Flight", (byte)var4); + var16.setTag("Fireworks", var19); + this.field_92102_a.setTagCompound(var16); + } + + return true; + } + else if (var4 == 1 && var3 == 0 && var6 == 0 && var5 > 0 && var8 <= 1) + { + this.field_92102_a = new ItemStack(Item.fireworkCharge); + var16 = new NBTTagCompound(); + var19 = new NBTTagCompound("Explosion"); + byte var23 = 0; + ArrayList var12 = new ArrayList(); + + for (int var13 = 0; var13 < par1InventoryCrafting.getSizeInventory(); ++var13) + { + ItemStack var14 = par1InventoryCrafting.getStackInSlot(var13); + + if (var14 != null) + { + if (var14.itemID == Item.dyePowder.itemID) + { + var12.add(Integer.valueOf(ItemDye.dyeColors[var14.getItemDamage()])); + } + else if (var14.itemID == Item.glowstone.itemID) + { + var19.setBoolean("Flicker", true); + } + else if (var14.itemID == Item.diamond.itemID) + { + var19.setBoolean("Trail", true); + } + else if (var14.itemID == Item.fireballCharge.itemID) + { + var23 = 1; + } + else if (var14.itemID == Item.feather.itemID) + { + var23 = 4; + } + else if (var14.itemID == Item.goldNugget.itemID) + { + var23 = 2; + } + else if (var14.itemID == Item.skull.itemID) + { + var23 = 3; + } + } + } + + int[] var24 = new int[var12.size()]; + + for (int var27 = 0; var27 < var24.length; ++var27) + { + var24[var27] = ((Integer)var12.get(var27)).intValue(); + } + + var19.setIntArray("Colors", var24); + var19.setByte("Type", var23); + var16.setTag("Explosion", var19); + this.field_92102_a.setTagCompound(var16); + return true; + } + else if (var4 == 0 && var3 == 0 && var6 == 1 && var5 > 0 && var5 == var7) + { + ArrayList var15 = new ArrayList(); + + for (int var17 = 0; var17 < par1InventoryCrafting.getSizeInventory(); ++var17) + { + ItemStack var11 = par1InventoryCrafting.getStackInSlot(var17); + + if (var11 != null) + { + if (var11.itemID == Item.dyePowder.itemID) + { + var15.add(Integer.valueOf(ItemDye.dyeColors[var11.getItemDamage()])); + } + else if (var11.itemID == Item.fireworkCharge.itemID) + { + this.field_92102_a = var11.copy(); + this.field_92102_a.stackSize = 1; + } + } + } + + int[] var18 = new int[var15.size()]; + + for (int var20 = 0; var20 < var18.length; ++var20) + { + var18[var20] = ((Integer)var15.get(var20)).intValue(); + } + + if (this.field_92102_a != null && this.field_92102_a.hasTagCompound()) + { + NBTTagCompound var21 = this.field_92102_a.getTagCompound().getCompoundTag("Explosion"); + + if (var21 == null) + { + return false; + } + else + { + var21.setIntArray("FadeColors", var18); + return true; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting) + { + return this.field_92102_a.copy(); + } + + /** + * Returns the size of the recipe area + */ + public int getRecipeSize() + { + return 10; + } + + public ItemStack getRecipeOutput() + { + return this.field_92102_a; + } +} diff --git a/src/main/java/net/minecraft/src/RecipeSorter.java b/src/main/java/net/minecraft/src/RecipeSorter.java new file mode 100644 index 0000000..825de74 --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipeSorter.java @@ -0,0 +1,23 @@ +package net.minecraft.src; + +import java.util.Comparator; + +class RecipeSorter implements Comparator +{ + final CraftingManager craftingManager; + + RecipeSorter(CraftingManager par1CraftingManager) + { + this.craftingManager = par1CraftingManager; + } + + public int compareRecipes(IRecipe par1IRecipe, IRecipe par2IRecipe) + { + return par1IRecipe instanceof ShapelessRecipes && par2IRecipe instanceof ShapedRecipes ? 1 : (par2IRecipe instanceof ShapelessRecipes && par1IRecipe instanceof ShapedRecipes ? -1 : (par2IRecipe.getRecipeSize() < par1IRecipe.getRecipeSize() ? -1 : (par2IRecipe.getRecipeSize() > par1IRecipe.getRecipeSize() ? 1 : 0))); + } + + public int compare(Object par1Obj, Object par2Obj) + { + return this.compareRecipes((IRecipe)par1Obj, (IRecipe)par2Obj); + } +} diff --git a/src/main/java/net/minecraft/src/RecipesArmor.java b/src/main/java/net/minecraft/src/RecipesArmor.java new file mode 100644 index 0000000..a1c9049 --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipesArmor.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +public class RecipesArmor +{ + private String[][] recipePatterns = new String[][] {{"XXX", "X X"}, {"X X", "XXX", "XXX"}, {"XXX", "X X", "X X"}, {"X X", "X X"}}; + private Object[][] recipeItems; + + public RecipesArmor() + { + this.recipeItems = new Object[][] {{Item.leather, Block.fire, Item.ingotIron, Item.diamond, Item.ingotGold}, {Item.helmetLeather, Item.helmetChain, Item.helmetIron, Item.helmetDiamond, Item.helmetGold}, {Item.plateLeather, Item.plateChain, Item.plateIron, Item.plateDiamond, Item.plateGold}, {Item.legsLeather, Item.legsChain, Item.legsIron, Item.legsDiamond, Item.legsGold}, {Item.bootsLeather, Item.bootsChain, Item.bootsIron, Item.bootsDiamond, Item.bootsGold}}; + } + + /** + * Adds the armor recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager par1CraftingManager) + { + for (int var2 = 0; var2 < this.recipeItems[0].length; ++var2) + { + Object var3 = this.recipeItems[0][var2]; + + for (int var4 = 0; var4 < this.recipeItems.length - 1; ++var4) + { + Item var5 = (Item)this.recipeItems[var4 + 1][var2]; + par1CraftingManager.addRecipe(new ItemStack(var5), new Object[] {this.recipePatterns[var4], 'X', var3}); + } + } + } +} diff --git a/src/main/java/net/minecraft/src/RecipesArmorDyes.java b/src/main/java/net/minecraft/src/RecipesArmorDyes.java new file mode 100644 index 0000000..8b22146 --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipesArmorDyes.java @@ -0,0 +1,147 @@ +package net.minecraft.src; + +import java.util.ArrayList; + +public class RecipesArmorDyes implements IRecipe +{ + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World) + { + ItemStack var3 = null; + ArrayList var4 = new ArrayList(); + + for (int var5 = 0; var5 < par1InventoryCrafting.getSizeInventory(); ++var5) + { + ItemStack var6 = par1InventoryCrafting.getStackInSlot(var5); + + if (var6 != null) + { + if (var6.getItem() instanceof ItemArmor) + { + ItemArmor var7 = (ItemArmor)var6.getItem(); + + if (var7.getArmorMaterial() != EnumArmorMaterial.CLOTH || var3 != null) + { + return false; + } + + var3 = var6; + } + else + { + if (var6.itemID != Item.dyePowder.itemID) + { + return false; + } + + var4.add(var6); + } + } + } + + return var3 != null && !var4.isEmpty(); + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting) + { + ItemStack var2 = null; + int[] var3 = new int[3]; + int var4 = 0; + int var5 = 0; + ItemArmor var6 = null; + int var7; + int var9; + float var10; + float var11; + int var17; + + for (var7 = 0; var7 < par1InventoryCrafting.getSizeInventory(); ++var7) + { + ItemStack var8 = par1InventoryCrafting.getStackInSlot(var7); + + if (var8 != null) + { + if (var8.getItem() instanceof ItemArmor) + { + var6 = (ItemArmor)var8.getItem(); + + if (var6.getArmorMaterial() != EnumArmorMaterial.CLOTH || var2 != null) + { + return null; + } + + var2 = var8.copy(); + var2.stackSize = 1; + + if (var6.hasColor(var8)) + { + var9 = var6.getColor(var2); + var10 = (float)(var9 >> 16 & 255) / 255.0F; + var11 = (float)(var9 >> 8 & 255) / 255.0F; + float var12 = (float)(var9 & 255) / 255.0F; + var4 = (int)((float)var4 + Math.max(var10, Math.max(var11, var12)) * 255.0F); + var3[0] = (int)((float)var3[0] + var10 * 255.0F); + var3[1] = (int)((float)var3[1] + var11 * 255.0F); + var3[2] = (int)((float)var3[2] + var12 * 255.0F); + ++var5; + } + } + else + { + if (var8.itemID != Item.dyePowder.itemID) + { + return null; + } + + float[] var14 = EntitySheep.fleeceColorTable[BlockColored.getBlockFromDye(var8.getItemDamage())]; + int var15 = (int)(var14[0] * 255.0F); + int var16 = (int)(var14[1] * 255.0F); + var17 = (int)(var14[2] * 255.0F); + var4 += Math.max(var15, Math.max(var16, var17)); + var3[0] += var15; + var3[1] += var16; + var3[2] += var17; + ++var5; + } + } + } + + if (var6 == null) + { + return null; + } + else + { + var7 = var3[0] / var5; + int var13 = var3[1] / var5; + var9 = var3[2] / var5; + var10 = (float)var4 / (float)var5; + var11 = (float)Math.max(var7, Math.max(var13, var9)); + var7 = (int)((float)var7 * var10 / var11); + var13 = (int)((float)var13 * var10 / var11); + var9 = (int)((float)var9 * var10 / var11); + var17 = (var7 << 8) + var13; + var17 = (var17 << 8) + var9; + var6.func_82813_b(var2, var17); + return var2; + } + } + + /** + * Returns the size of the recipe area + */ + public int getRecipeSize() + { + return 10; + } + + public ItemStack getRecipeOutput() + { + return null; + } +} diff --git a/src/main/java/net/minecraft/src/RecipesCrafting.java b/src/main/java/net/minecraft/src/RecipesCrafting.java new file mode 100644 index 0000000..5358f7b --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipesCrafting.java @@ -0,0 +1,27 @@ +package net.minecraft.src; + +public class RecipesCrafting +{ + /** + * Adds the crafting recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager par1CraftingManager) + { + par1CraftingManager.addRecipe(new ItemStack(Block.chest), new Object[] {"###", "# #", "###", '#', Block.planks}); + par1CraftingManager.addRecipe(new ItemStack(Block.chestTrapped), new Object[] {"#-", '#', Block.chest, '-', Block.tripWireSource}); + par1CraftingManager.addRecipe(new ItemStack(Block.enderChest), new Object[] {"###", "#E#", "###", '#', Block.obsidian, 'E', Item.eyeOfEnder}); + par1CraftingManager.addRecipe(new ItemStack(Block.furnaceIdle), new Object[] {"###", "# #", "###", '#', Block.cobblestone}); + par1CraftingManager.addRecipe(new ItemStack(Block.workbench), new Object[] {"##", "##", '#', Block.planks}); + par1CraftingManager.addRecipe(new ItemStack(Block.sandStone), new Object[] {"##", "##", '#', Block.sand}); + par1CraftingManager.addRecipe(new ItemStack(Block.sandStone, 4, 2), new Object[] {"##", "##", '#', Block.sandStone}); + par1CraftingManager.addRecipe(new ItemStack(Block.sandStone, 1, 1), new Object[] {"#", "#", '#', new ItemStack(Block.stoneSingleSlab, 1, 1)}); + par1CraftingManager.addRecipe(new ItemStack(Block.blockNetherQuartz, 1, 1), new Object[] {"#", "#", '#', new ItemStack(Block.stoneSingleSlab, 1, 7)}); + par1CraftingManager.addRecipe(new ItemStack(Block.blockNetherQuartz, 2, 2), new Object[] {"#", "#", '#', new ItemStack(Block.blockNetherQuartz, 1, 0)}); + par1CraftingManager.addRecipe(new ItemStack(Block.stoneBrick, 4), new Object[] {"##", "##", '#', Block.stone}); + par1CraftingManager.addRecipe(new ItemStack(Block.fenceIron, 16), new Object[] {"###", "###", '#', Item.ingotIron}); + par1CraftingManager.addRecipe(new ItemStack(Block.thinGlass, 16), new Object[] {"###", "###", '#', Block.glass}); + par1CraftingManager.addRecipe(new ItemStack(Block.redstoneLampIdle, 1), new Object[] {" R ", "RGR", " R ", 'R', Item.redstone, 'G', Block.glowStone}); + par1CraftingManager.addRecipe(new ItemStack(Block.beacon, 1), new Object[] {"GGG", "GSG", "OOO", 'G', Block.glass, 'S', Item.netherStar, 'O', Block.obsidian}); + par1CraftingManager.addRecipe(new ItemStack(Block.netherBrick, 1), new Object[] {"NN", "NN", 'N', Item.netherrackBrick}); + } +} diff --git a/src/main/java/net/minecraft/src/RecipesDyes.java b/src/main/java/net/minecraft/src/RecipesDyes.java new file mode 100644 index 0000000..db902bc --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipesDyes.java @@ -0,0 +1,39 @@ +package net.minecraft.src; + +public class RecipesDyes +{ + /** + * Adds the dye recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager par1CraftingManager) + { + int var2; + + for (var2 = 0; var2 < 16; ++var2) + { + par1CraftingManager.addShapelessRecipe(new ItemStack(Block.cloth, 1, BlockColored.getDyeFromBlock(var2)), new Object[] {new ItemStack(Item.dyePowder, 1, var2), new ItemStack(Item.itemsList[Block.cloth.blockID], 1, 0)}); + par1CraftingManager.addRecipe(new ItemStack(Block.stainedClay, 8, BlockColored.getDyeFromBlock(var2)), new Object[] {"###", "#X#", "###", '#', new ItemStack(Block.hardenedClay), 'X', new ItemStack(Item.dyePowder, 1, var2)}); + } + + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 11), new Object[] {Block.plantYellow}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 1), new Object[] {Block.plantRed}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 3, 15), new Object[] {Item.bone}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 9), new Object[] {new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.dyePowder, 1, 15)}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 14), new Object[] {new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.dyePowder, 1, 11)}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 10), new Object[] {new ItemStack(Item.dyePowder, 1, 2), new ItemStack(Item.dyePowder, 1, 15)}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 8), new Object[] {new ItemStack(Item.dyePowder, 1, 0), new ItemStack(Item.dyePowder, 1, 15)}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 7), new Object[] {new ItemStack(Item.dyePowder, 1, 8), new ItemStack(Item.dyePowder, 1, 15)}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 3, 7), new Object[] {new ItemStack(Item.dyePowder, 1, 0), new ItemStack(Item.dyePowder, 1, 15), new ItemStack(Item.dyePowder, 1, 15)}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 12), new Object[] {new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 15)}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 6), new Object[] {new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 2)}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 5), new Object[] {new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 1)}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 2, 13), new Object[] {new ItemStack(Item.dyePowder, 1, 5), new ItemStack(Item.dyePowder, 1, 9)}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 3, 13), new Object[] {new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.dyePowder, 1, 9)}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.dyePowder, 4, 13), new Object[] {new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.dyePowder, 1, 15)}); + + for (var2 = 0; var2 < 16; ++var2) + { + par1CraftingManager.addRecipe(new ItemStack(Block.carpet, 3, var2), new Object[] {"##", '#', new ItemStack(Block.cloth, 1, var2)}); + } + } +} diff --git a/src/main/java/net/minecraft/src/RecipesFood.java b/src/main/java/net/minecraft/src/RecipesFood.java new file mode 100644 index 0000000..e460c36 --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipesFood.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +public class RecipesFood +{ + /** + * Adds the food recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager par1CraftingManager) + { + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.bowlSoup), new Object[] {Block.mushroomBrown, Block.mushroomRed, Item.bowlEmpty}); + par1CraftingManager.addRecipe(new ItemStack(Item.cookie, 8), new Object[] {"#X#", 'X', new ItemStack(Item.dyePowder, 1, 3), '#', Item.wheat}); + par1CraftingManager.addRecipe(new ItemStack(Block.melon), new Object[] {"MMM", "MMM", "MMM", 'M', Item.melon}); + par1CraftingManager.addRecipe(new ItemStack(Item.melonSeeds), new Object[] {"M", 'M', Item.melon}); + par1CraftingManager.addRecipe(new ItemStack(Item.pumpkinSeeds, 4), new Object[] {"M", 'M', Block.pumpkin}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.pumpkinPie), new Object[] {Block.pumpkin, Item.sugar, Item.egg}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.fermentedSpiderEye), new Object[] {Item.spiderEye, Block.mushroomBrown, Item.sugar}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.blazePowder, 2), new Object[] {Item.blazeRod}); + par1CraftingManager.addShapelessRecipe(new ItemStack(Item.magmaCream), new Object[] {Item.blazePowder, Item.slimeBall}); + } +} diff --git a/src/main/java/net/minecraft/src/RecipesIngots.java b/src/main/java/net/minecraft/src/RecipesIngots.java new file mode 100644 index 0000000..8122c0c --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipesIngots.java @@ -0,0 +1,28 @@ +package net.minecraft.src; + +public class RecipesIngots +{ + private Object[][] recipeItems; + + public RecipesIngots() + { + this.recipeItems = new Object[][] {{Block.blockGold, new ItemStack(Item.ingotGold, 9)}, {Block.blockIron, new ItemStack(Item.ingotIron, 9)}, {Block.blockDiamond, new ItemStack(Item.diamond, 9)}, {Block.blockEmerald, new ItemStack(Item.emerald, 9)}, {Block.blockLapis, new ItemStack(Item.dyePowder, 9, 4)}, {Block.blockRedstone, new ItemStack(Item.redstone, 9)}, {Block.coalBlock, new ItemStack(Item.coal, 9, 0)}, {Block.hay, new ItemStack(Item.wheat, 9)}}; + } + + /** + * Adds the ingot recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager par1CraftingManager) + { + for (int var2 = 0; var2 < this.recipeItems.length; ++var2) + { + Block var3 = (Block)this.recipeItems[var2][0]; + ItemStack var4 = (ItemStack)this.recipeItems[var2][1]; + par1CraftingManager.addRecipe(new ItemStack(var3), new Object[] {"###", "###", "###", '#', var4}); + par1CraftingManager.addRecipe(var4, new Object[] {"#", '#', var3}); + } + + par1CraftingManager.addRecipe(new ItemStack(Item.ingotGold), new Object[] {"###", "###", "###", '#', Item.goldNugget}); + par1CraftingManager.addRecipe(new ItemStack(Item.goldNugget, 9), new Object[] {"#", '#', Item.ingotGold}); + } +} diff --git a/src/main/java/net/minecraft/src/RecipesMapCloning.java b/src/main/java/net/minecraft/src/RecipesMapCloning.java new file mode 100644 index 0000000..24c89c7 --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipesMapCloning.java @@ -0,0 +1,107 @@ +package net.minecraft.src; + +public class RecipesMapCloning implements IRecipe +{ + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World) + { + int var3 = 0; + ItemStack var4 = null; + + for (int var5 = 0; var5 < par1InventoryCrafting.getSizeInventory(); ++var5) + { + ItemStack var6 = par1InventoryCrafting.getStackInSlot(var5); + + if (var6 != null) + { + if (var6.itemID == Item.map.itemID) + { + if (var4 != null) + { + return false; + } + + var4 = var6; + } + else + { + if (var6.itemID != Item.emptyMap.itemID) + { + return false; + } + + ++var3; + } + } + } + + return var4 != null && var3 > 0; + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting) + { + int var2 = 0; + ItemStack var3 = null; + + for (int var4 = 0; var4 < par1InventoryCrafting.getSizeInventory(); ++var4) + { + ItemStack var5 = par1InventoryCrafting.getStackInSlot(var4); + + if (var5 != null) + { + if (var5.itemID == Item.map.itemID) + { + if (var3 != null) + { + return null; + } + + var3 = var5; + } + else + { + if (var5.itemID != Item.emptyMap.itemID) + { + return null; + } + + ++var2; + } + } + } + + if (var3 != null && var2 >= 1) + { + ItemStack var6 = new ItemStack(Item.map, var2 + 1, var3.getItemDamage()); + + if (var3.hasDisplayName()) + { + var6.setItemName(var3.getDisplayName()); + } + + return var6; + } + else + { + return null; + } + } + + /** + * Returns the size of the recipe area + */ + public int getRecipeSize() + { + return 9; + } + + public ItemStack getRecipeOutput() + { + return null; + } +} diff --git a/src/main/java/net/minecraft/src/RecipesMapExtending.java b/src/main/java/net/minecraft/src/RecipesMapExtending.java new file mode 100644 index 0000000..80a5873 --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipesMapExtending.java @@ -0,0 +1,73 @@ +package net.minecraft.src; + +public class RecipesMapExtending extends ShapedRecipes +{ + public RecipesMapExtending() + { + super(3, 3, new ItemStack[] {new ItemStack(Item.paper), new ItemStack(Item.paper), new ItemStack(Item.paper), new ItemStack(Item.paper), new ItemStack(Item.map, 0, 32767), new ItemStack(Item.paper), new ItemStack(Item.paper), new ItemStack(Item.paper), new ItemStack(Item.paper)}, new ItemStack(Item.emptyMap, 0, 0)); + } + + /** + * Used to check if a recipe matches current crafting inventory + */ + public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World) + { + if (!super.matches(par1InventoryCrafting, par2World)) + { + return false; + } + else + { + ItemStack var3 = null; + + for (int var4 = 0; var4 < par1InventoryCrafting.getSizeInventory() && var3 == null; ++var4) + { + ItemStack var5 = par1InventoryCrafting.getStackInSlot(var4); + + if (var5 != null && var5.itemID == Item.map.itemID) + { + var3 = var5; + } + } + + if (var3 == null) + { + return false; + } + else + { + MapData var6 = Item.map.getMapData(var3, par2World); + return var6 == null ? false : var6.scale < 4; + } + } + } + + /** + * Returns an Item that is the result of this recipe + */ + public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting) + { + ItemStack var2 = null; + + for (int var3 = 0; var3 < par1InventoryCrafting.getSizeInventory() && var2 == null; ++var3) + { + ItemStack var4 = par1InventoryCrafting.getStackInSlot(var3); + + if (var4 != null && var4.itemID == Item.map.itemID) + { + var2 = var4; + } + } + + var2 = var2.copy(); + var2.stackSize = 1; + + if (var2.getTagCompound() == null) + { + var2.setTagCompound(new NBTTagCompound()); + } + + var2.getTagCompound().setBoolean("map_is_scaling", true); + return var2; + } +} diff --git a/src/main/java/net/minecraft/src/RecipesTools.java b/src/main/java/net/minecraft/src/RecipesTools.java new file mode 100644 index 0000000..021b4fa --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipesTools.java @@ -0,0 +1,31 @@ +package net.minecraft.src; + +public class RecipesTools +{ + private String[][] recipePatterns = new String[][] {{"XXX", " # ", " # "}, {"X", "#", "#"}, {"XX", "X#", " #"}, {"XX", " #", " #"}}; + private Object[][] recipeItems; + + public RecipesTools() + { + this.recipeItems = new Object[][] {{Block.planks, Block.cobblestone, Item.ingotIron, Item.diamond, Item.ingotGold}, {Item.pickaxeWood, Item.pickaxeStone, Item.pickaxeIron, Item.pickaxeDiamond, Item.pickaxeGold}, {Item.shovelWood, Item.shovelStone, Item.shovelIron, Item.shovelDiamond, Item.shovelGold}, {Item.axeWood, Item.axeStone, Item.axeIron, Item.axeDiamond, Item.axeGold}, {Item.hoeWood, Item.hoeStone, Item.hoeIron, Item.hoeDiamond, Item.hoeGold}}; + } + + /** + * Adds the tool recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager par1CraftingManager) + { + for (int var2 = 0; var2 < this.recipeItems[0].length; ++var2) + { + Object var3 = this.recipeItems[0][var2]; + + for (int var4 = 0; var4 < this.recipeItems.length - 1; ++var4) + { + Item var5 = (Item)this.recipeItems[var4 + 1][var2]; + par1CraftingManager.addRecipe(new ItemStack(var5), new Object[] {this.recipePatterns[var4], '#', Item.stick, 'X', var3}); + } + } + + par1CraftingManager.addRecipe(new ItemStack(Item.shears), new Object[] {" #", "# ", '#', Item.ingotIron}); + } +} diff --git a/src/main/java/net/minecraft/src/RecipesWeapons.java b/src/main/java/net/minecraft/src/RecipesWeapons.java new file mode 100644 index 0000000..8599f3f --- /dev/null +++ b/src/main/java/net/minecraft/src/RecipesWeapons.java @@ -0,0 +1,32 @@ +package net.minecraft.src; + +public class RecipesWeapons +{ + private String[][] recipePatterns = new String[][] {{"X", "X", "#"}}; + private Object[][] recipeItems; + + public RecipesWeapons() + { + this.recipeItems = new Object[][] {{Block.planks, Block.cobblestone, Item.ingotIron, Item.diamond, Item.ingotGold}, {Item.swordWood, Item.swordStone, Item.swordIron, Item.swordDiamond, Item.swordGold}}; + } + + /** + * Adds the weapon recipes to the CraftingManager. + */ + public void addRecipes(CraftingManager par1CraftingManager) + { + for (int var2 = 0; var2 < this.recipeItems[0].length; ++var2) + { + Object var3 = this.recipeItems[0][var2]; + + for (int var4 = 0; var4 < this.recipeItems.length - 1; ++var4) + { + Item var5 = (Item)this.recipeItems[var4 + 1][var2]; + par1CraftingManager.addRecipe(new ItemStack(var5), new Object[] {this.recipePatterns[var4], '#', Item.stick, 'X', var3}); + } + } + + par1CraftingManager.addRecipe(new ItemStack(Item.bow, 1), new Object[] {" #X", "# X", " #X", 'X', Item.silk, '#', Item.stick}); + par1CraftingManager.addRecipe(new ItemStack(Item.arrow, 4), new Object[] {"X", "#", "Y", 'Y', Item.feather, 'X', Item.flint, '#', Item.stick}); + } +} diff --git a/src/main/java/net/minecraft/src/RedstoneUpdateInfo.java b/src/main/java/net/minecraft/src/RedstoneUpdateInfo.java new file mode 100644 index 0000000..53466a7 --- /dev/null +++ b/src/main/java/net/minecraft/src/RedstoneUpdateInfo.java @@ -0,0 +1,17 @@ +package net.minecraft.src; + +class RedstoneUpdateInfo +{ + int x; + int y; + int z; + long updateTime; + + public RedstoneUpdateInfo(int par1, int par2, int par3, long par4) + { + this.x = par1; + this.y = par2; + this.z = par3; + this.updateTime = par4; + } +} diff --git a/src/main/java/net/minecraft/src/RegionFile.java b/src/main/java/net/minecraft/src/RegionFile.java new file mode 100644 index 0000000..5f60742 --- /dev/null +++ b/src/main/java/net/minecraft/src/RegionFile.java @@ -0,0 +1,352 @@ +package net.minecraft.src; + +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.ArrayList; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.InflaterInputStream; +import net.minecraft.server.MinecraftServer; + +public class RegionFile +{ + private static final byte[] emptySector = new byte[4096]; + private final File fileName; + private RandomAccessFile dataFile; + private final int[] offsets = new int[1024]; + private final int[] chunkTimestamps = new int[1024]; + private ArrayList sectorFree; + + /** McRegion sizeDelta */ + private int sizeDelta; + private long lastModified; + + public RegionFile(File par1File) + { + this.fileName = par1File; + this.sizeDelta = 0; + + try + { + if (par1File.exists()) + { + this.lastModified = par1File.lastModified(); + } + + this.dataFile = new RandomAccessFile(par1File, "rw"); + int var2; + + if (this.dataFile.length() < 4096L) + { + for (var2 = 0; var2 < 1024; ++var2) + { + this.dataFile.writeInt(0); + } + + for (var2 = 0; var2 < 1024; ++var2) + { + this.dataFile.writeInt(0); + } + + this.sizeDelta += 8192; + } + + if ((this.dataFile.length() & 4095L) != 0L) + { + for (var2 = 0; (long)var2 < (this.dataFile.length() & 4095L); ++var2) + { + this.dataFile.write(0); + } + } + + var2 = (int)this.dataFile.length() / 4096; + this.sectorFree = new ArrayList(var2); + int var3; + + for (var3 = 0; var3 < var2; ++var3) + { + this.sectorFree.add(Boolean.valueOf(true)); + } + + this.sectorFree.set(0, Boolean.valueOf(false)); + this.sectorFree.set(1, Boolean.valueOf(false)); + this.dataFile.seek(0L); + int var4; + + for (var3 = 0; var3 < 1024; ++var3) + { + var4 = this.dataFile.readInt(); + this.offsets[var3] = var4; + + if (var4 != 0 && (var4 >> 8) + (var4 & 255) <= this.sectorFree.size()) + { + for (int var5 = 0; var5 < (var4 & 255); ++var5) + { + this.sectorFree.set((var4 >> 8) + var5, Boolean.valueOf(false)); + } + } + } + + for (var3 = 0; var3 < 1024; ++var3) + { + var4 = this.dataFile.readInt(); + this.chunkTimestamps[var3] = var4; + } + } + catch (IOException var6) + { + var6.printStackTrace(); + } + } + + /** + * args: x, y - get uncompressed chunk stream from the region file + */ + public synchronized DataInputStream getChunkDataInputStream(int par1, int par2) + { + if (this.outOfBounds(par1, par2)) + { + return null; + } + else + { + try + { + int var3 = this.getOffset(par1, par2); + + if (var3 == 0) + { + return null; + } + else + { + int var4 = var3 >> 8; + int var5 = var3 & 255; + + if (var4 + var5 > this.sectorFree.size()) + { + return null; + } + else + { + this.dataFile.seek((long)(var4 * 4096)); + int var6 = this.dataFile.readInt(); + + if (var6 > 4096 * var5) + { + return null; + } + else if (var6 <= 0) + { + return null; + } + else + { + byte var7 = this.dataFile.readByte(); + byte[] var8; + + if (var7 == 1) + { + var8 = new byte[var6 - 1]; + this.dataFile.read(var8); + return new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(var8)))); + } + else if (var7 == 2) + { + var8 = new byte[var6 - 1]; + this.dataFile.read(var8); + return new DataInputStream(new BufferedInputStream(new InflaterInputStream(new ByteArrayInputStream(var8)))); + } + else + { + return null; + } + } + } + } + } + catch (IOException var9) + { + return null; + } + } + } + + /** + * args: x, z - get an output stream used to write chunk data, data is on disk when the returned stream is closed + */ + public DataOutputStream getChunkDataOutputStream(int par1, int par2) + { + return this.outOfBounds(par1, par2) ? null : new DataOutputStream(new DeflaterOutputStream(new RegionFileChunkBuffer(this, par1, par2))); + } + + /** + * args: x, z, data, length - write chunk data at (x, z) to disk + */ + protected synchronized void write(int par1, int par2, byte[] par3ArrayOfByte, int par4) + { + try + { + int var5 = this.getOffset(par1, par2); + int var6 = var5 >> 8; + int var7 = var5 & 255; + int var8 = (par4 + 5) / 4096 + 1; + + if (var8 >= 256) + { + return; + } + + if (var6 != 0 && var7 == var8) + { + this.write(var6, par3ArrayOfByte, par4); + } + else + { + int var9; + + for (var9 = 0; var9 < var7; ++var9) + { + this.sectorFree.set(var6 + var9, Boolean.valueOf(true)); + } + + var9 = this.sectorFree.indexOf(Boolean.valueOf(true)); + int var10 = 0; + int var11; + + if (var9 != -1) + { + for (var11 = var9; var11 < this.sectorFree.size(); ++var11) + { + if (var10 != 0) + { + if (((Boolean)this.sectorFree.get(var11)).booleanValue()) + { + ++var10; + } + else + { + var10 = 0; + } + } + else if (((Boolean)this.sectorFree.get(var11)).booleanValue()) + { + var9 = var11; + var10 = 1; + } + + if (var10 >= var8) + { + break; + } + } + } + + if (var10 >= var8) + { + var6 = var9; + this.setOffset(par1, par2, var9 << 8 | var8); + + for (var11 = 0; var11 < var8; ++var11) + { + this.sectorFree.set(var6 + var11, Boolean.valueOf(false)); + } + + this.write(var6, par3ArrayOfByte, par4); + } + else + { + this.dataFile.seek(this.dataFile.length()); + var6 = this.sectorFree.size(); + + for (var11 = 0; var11 < var8; ++var11) + { + this.dataFile.write(emptySector); + this.sectorFree.add(Boolean.valueOf(false)); + } + + this.sizeDelta += 4096 * var8; + this.write(var6, par3ArrayOfByte, par4); + this.setOffset(par1, par2, var6 << 8 | var8); + } + } + + this.setChunkTimestamp(par1, par2, (int)(MinecraftServer.getSystemTimeMillis() / 1000L)); + } + catch (IOException var12) + { + var12.printStackTrace(); + } + } + + /** + * args: sectorNumber, data, length - write the chunk data to this RegionFile + */ + private void write(int par1, byte[] par2ArrayOfByte, int par3) throws IOException + { + this.dataFile.seek((long)(par1 * 4096)); + this.dataFile.writeInt(par3 + 1); + this.dataFile.writeByte(2); + this.dataFile.write(par2ArrayOfByte, 0, par3); + } + + /** + * args: x, z - check region bounds + */ + private boolean outOfBounds(int par1, int par2) + { + return par1 < 0 || par1 >= 32 || par2 < 0 || par2 >= 32; + } + + /** + * args: x, y - get chunk's offset in region file + */ + private int getOffset(int par1, int par2) + { + return this.offsets[par1 + par2 * 32]; + } + + /** + * args: x, z, - true if chunk has been saved / converted + */ + public boolean isChunkSaved(int par1, int par2) + { + return this.getOffset(par1, par2) != 0; + } + + /** + * args: x, z, offset - sets the chunk's offset in the region file + */ + private void setOffset(int par1, int par2, int par3) throws IOException + { + this.offsets[par1 + par2 * 32] = par3; + this.dataFile.seek((long)((par1 + par2 * 32) * 4)); + this.dataFile.writeInt(par3); + } + + /** + * args: x, z, timestamp - sets the chunk's write timestamp + */ + private void setChunkTimestamp(int par1, int par2, int par3) throws IOException + { + this.chunkTimestamps[par1 + par2 * 32] = par3; + this.dataFile.seek((long)(4096 + (par1 + par2 * 32) * 4)); + this.dataFile.writeInt(par3); + } + + /** + * close this RegionFile and prevent further writes + */ + public void close() throws IOException + { + if (this.dataFile != null) + { + this.dataFile.close(); + } + } +} diff --git a/src/main/java/net/minecraft/src/RegionFileCache.java b/src/main/java/net/minecraft/src/RegionFileCache.java new file mode 100644 index 0000000..7345c3b --- /dev/null +++ b/src/main/java/net/minecraft/src/RegionFileCache.java @@ -0,0 +1,88 @@ +package net.minecraft.src; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +public class RegionFileCache +{ + /** A map containing Files as keys and RegionFiles as values */ + private static final Map regionsByFilename = new HashMap(); + + public static synchronized RegionFile createOrLoadRegionFile(File par0File, int par1, int par2) + { + File var3 = new File(par0File, "region"); + File var4 = new File(var3, "r." + (par1 >> 5) + "." + (par2 >> 5) + ".mca"); + RegionFile var5 = (RegionFile)regionsByFilename.get(var4); + + if (var5 != null) + { + return var5; + } + else + { + if (!var3.exists()) + { + var3.mkdirs(); + } + + if (regionsByFilename.size() >= 256) + { + clearRegionFileReferences(); + } + + RegionFile var6 = new RegionFile(var4); + regionsByFilename.put(var4, var6); + return var6; + } + } + + /** + * Saves the current Chunk Map Cache + */ + public static synchronized void clearRegionFileReferences() + { + Iterator var0 = regionsByFilename.values().iterator(); + + while (var0.hasNext()) + { + RegionFile var1 = (RegionFile)var0.next(); + + try + { + if (var1 != null) + { + var1.close(); + } + } + catch (IOException var3) + { + var3.printStackTrace(); + } + } + + regionsByFilename.clear(); + } + + /** + * Returns an input stream for the specified chunk. Args: worldDir, chunkX, chunkZ + */ + public static DataInputStream getChunkInputStream(File par0File, int par1, int par2) + { + RegionFile var3 = createOrLoadRegionFile(par0File, par1, par2); + return var3.getChunkDataInputStream(par1 & 31, par2 & 31); + } + + /** + * Returns an output stream for the specified chunk. Args: worldDir, chunkX, chunkZ + */ + public static DataOutputStream getChunkOutputStream(File par0File, int par1, int par2) + { + RegionFile var3 = createOrLoadRegionFile(par0File, par1, par2); + return var3.getChunkDataOutputStream(par1 & 31, par2 & 31); + } +} diff --git a/src/main/java/net/minecraft/src/RegionFileChunkBuffer.java b/src/main/java/net/minecraft/src/RegionFileChunkBuffer.java new file mode 100644 index 0000000..1b06b69 --- /dev/null +++ b/src/main/java/net/minecraft/src/RegionFileChunkBuffer.java @@ -0,0 +1,25 @@ +package net.minecraft.src; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +class RegionFileChunkBuffer extends ByteArrayOutputStream +{ + private int chunkX; + private int chunkZ; + + final RegionFile regionFile; + + public RegionFileChunkBuffer(RegionFile par1RegionFile, int par2, int par3) + { + super(8096); + this.regionFile = par1RegionFile; + this.chunkX = par2; + this.chunkZ = par3; + } + + public void close() throws IOException + { + this.regionFile.write(this.chunkX, this.chunkZ, this.buf, this.count); + } +} diff --git a/src/main/java/net/minecraft/src/RegistryDefaulted.java b/src/main/java/net/minecraft/src/RegistryDefaulted.java new file mode 100644 index 0000000..610e1d6 --- /dev/null +++ b/src/main/java/net/minecraft/src/RegistryDefaulted.java @@ -0,0 +1,20 @@ +package net.minecraft.src; + +public class RegistryDefaulted extends RegistrySimple +{ + /** + * Default object for this registry, returned when an object is not found. + */ + private final Object defaultObject; + + public RegistryDefaulted(Object par1Obj) + { + this.defaultObject = par1Obj; + } + + public Object getObject(Object par1Obj) + { + Object var2 = super.getObject(par1Obj); + return var2 == null ? this.defaultObject : var2; + } +} diff --git a/src/main/java/net/minecraft/src/RegistrySimple.java b/src/main/java/net/minecraft/src/RegistrySimple.java new file mode 100644 index 0000000..48026b1 --- /dev/null +++ b/src/main/java/net/minecraft/src/RegistrySimple.java @@ -0,0 +1,29 @@ +package net.minecraft.src; + +import com.google.common.collect.Maps; +import java.util.HashMap; +import java.util.Map; + +public class RegistrySimple implements IRegistry +{ + /** Objects registered on this registry. */ + protected final Map registryObjects = this.func_111054_a(); + + protected HashMap func_111054_a() + { + return Maps.newHashMap(); + } + + public Object getObject(Object par1Obj) + { + return this.registryObjects.get(par1Obj); + } + + /** + * Register an object on this registry. + */ + public void putObject(Object par1Obj, Object par2Obj) + { + this.registryObjects.put(par1Obj, par2Obj); + } +} diff --git a/src/main/java/net/minecraft/src/ReloadableResourceManager.java b/src/main/java/net/minecraft/src/ReloadableResourceManager.java new file mode 100644 index 0000000..ba7e01c --- /dev/null +++ b/src/main/java/net/minecraft/src/ReloadableResourceManager.java @@ -0,0 +1,10 @@ +package net.minecraft.src; + +import java.util.List; + +public interface ReloadableResourceManager extends ResourceManager +{ + void reloadResources(List var1); + + void registerReloadListener(ResourceManagerReloadListener var1); +} diff --git a/src/main/java/net/minecraft/src/Render.java b/src/main/java/net/minecraft/src/Render.java new file mode 100644 index 0000000..07c5f6a --- /dev/null +++ b/src/main/java/net/minecraft/src/Render.java @@ -0,0 +1,321 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public abstract class Render +{ + private static final ResourceLocation shadowTextures = new ResourceLocation("textures/misc/shadow.png"); + protected RenderManager renderManager; + protected RenderBlocks renderBlocks = new RenderBlocks(); + protected float shadowSize; + + /** + * Determines the darkness of the object's shadow. Higher value makes a darker shadow. + */ + protected float shadowOpaque = 1.0F; + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render 0.0F) + { + Icon var19 = var18 % 2 == 0 ? var9 : var10; + this.bindTexture(TextureMap.locationBlocksTexture); + float var20 = var19.getMinU(); + float var21 = var19.getMinV(); + float var22 = var19.getMaxU(); + float var23 = var19.getMaxV(); + + if (var18 / 2 % 2 == 0) + { + float var24 = var22; + var22 = var20; + var20 = var24; + } + + var12.addVertexWithUV((double)(var13 - var14), (double)(0.0F - var16), (double)var17, (double)var22, (double)var23); + var12.addVertexWithUV((double)(-var13 - var14), (double)(0.0F - var16), (double)var17, (double)var20, (double)var23); + var12.addVertexWithUV((double)(-var13 - var14), (double)(1.4F - var16), (double)var17, (double)var20, (double)var21); + var12.addVertexWithUV((double)(var13 - var14), (double)(1.4F - var16), (double)var17, (double)var22, (double)var21); + var15 -= 0.45F; + var16 -= 0.45F; + var13 *= 0.9F; + var17 += 0.03F; + ++var18; + } + + var12.draw(); + GL11.glPopMatrix(); + GL11.glEnable(GL11.GL_LIGHTING); + } + + /** + * Renders the entity shadows at the position, shadow alpha and partialTickTime. Args: entity, x, y, z, shadowAlpha, + * partialTickTime + */ + private void renderShadow(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) + { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + this.renderManager.renderEngine.bindTexture(shadowTextures); + World var10 = this.getWorldFromRenderManager(); + GL11.glDepthMask(false); + float var11 = this.shadowSize; + + if (par1Entity instanceof EntityLiving) + { + EntityLiving var12 = (EntityLiving)par1Entity; + var11 *= var12.getRenderSizeModifier(); + + if (var12.isChild()) + { + var11 *= 0.5F; + } + } + + double var35 = par1Entity.lastTickPosX + (par1Entity.posX - par1Entity.lastTickPosX) * (double)par9; + double var14 = par1Entity.lastTickPosY + (par1Entity.posY - par1Entity.lastTickPosY) * (double)par9 + (double)par1Entity.getShadowSize(); + double var16 = par1Entity.lastTickPosZ + (par1Entity.posZ - par1Entity.lastTickPosZ) * (double)par9; + int var18 = MathHelper.floor_double(var35 - (double)var11); + int var19 = MathHelper.floor_double(var35 + (double)var11); + int var20 = MathHelper.floor_double(var14 - (double)var11); + int var21 = MathHelper.floor_double(var14); + int var22 = MathHelper.floor_double(var16 - (double)var11); + int var23 = MathHelper.floor_double(var16 + (double)var11); + double var24 = par2 - var35; + double var26 = par4 - var14; + double var28 = par6 - var16; + Tessellator var30 = Tessellator.instance; + var30.startDrawingQuads(); + + for (int var31 = var18; var31 <= var19; ++var31) + { + for (int var32 = var20; var32 <= var21; ++var32) + { + for (int var33 = var22; var33 <= var23; ++var33) + { + int var34 = var10.getBlockId(var31, var32 - 1, var33); + + if (var34 > 0 && var10.getBlockLightValue(var31, var32, var33) > 3) + { + this.renderShadowOnBlock(Block.blocksList[var34], par2, par4 + (double)par1Entity.getShadowSize(), par6, var31, var32, var33, par8, var11, var24, var26 + (double)par1Entity.getShadowSize(), var28); + } + } + } + } + + var30.draw(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + GL11.glDepthMask(true); + } + + /** + * Returns the render manager's world object + */ + private World getWorldFromRenderManager() + { + return this.renderManager.worldObj; + } + + /** + * Renders a shadow projected down onto the specified block. Brightness of the block plus how far away on the Y axis + * determines the alpha of the shadow. Args: block, centerX, centerY, centerZ, blockX, blockY, blockZ, baseAlpha, + * shadowSize, xOffset, yOffset, zOffset + */ + private void renderShadowOnBlock(Block par1Block, double par2, double par4, double par6, int par8, int par9, int par10, float par11, float par12, double par13, double par15, double par17) + { + Tessellator var19 = Tessellator.instance; + + if (par1Block.renderAsNormalBlock()) + { + double var20 = ((double)par11 - (par4 - ((double)par9 + par15)) / 2.0D) * 0.5D * (double)this.getWorldFromRenderManager().getLightBrightness(par8, par9, par10); + + if (var20 >= 0.0D) + { + if (var20 > 1.0D) + { + var20 = 1.0D; + } + + var19.setColorRGBA_F(1.0F, 1.0F, 1.0F, (float)var20); + double var22 = (double)par8 + par1Block.getBlockBoundsMinX() + par13; + double var24 = (double)par8 + par1Block.getBlockBoundsMaxX() + par13; + double var26 = (double)par9 + par1Block.getBlockBoundsMinY() + par15 + 0.015625D; + double var28 = (double)par10 + par1Block.getBlockBoundsMinZ() + par17; + double var30 = (double)par10 + par1Block.getBlockBoundsMaxZ() + par17; + float var32 = (float)((par2 - var22) / 2.0D / (double)par12 + 0.5D); + float var33 = (float)((par2 - var24) / 2.0D / (double)par12 + 0.5D); + float var34 = (float)((par6 - var28) / 2.0D / (double)par12 + 0.5D); + float var35 = (float)((par6 - var30) / 2.0D / (double)par12 + 0.5D); + var19.addVertexWithUV(var22, var26, var28, (double)var32, (double)var34); + var19.addVertexWithUV(var22, var26, var30, (double)var32, (double)var35); + var19.addVertexWithUV(var24, var26, var30, (double)var33, (double)var35); + var19.addVertexWithUV(var24, var26, var28, (double)var33, (double)var34); + } + } + } + + /** + * Renders a white box with the bounds of the AABB translated by the offset. Args: aabb, x, y, z + */ + public static void renderOffsetAABB(AxisAlignedBB par0AxisAlignedBB, double par1, double par3, double par5) + { + GL11.glDisable(GL11.GL_TEXTURE_2D); + Tessellator var7 = Tessellator.instance; + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + var7.startDrawingQuads(); + var7.setTranslation(par1, par3, par5); + var7.setNormal(0.0F, 0.0F, -1.0F); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var7.setNormal(0.0F, 0.0F, 1.0F); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var7.setNormal(0.0F, -1.0F, 0.0F); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var7.setNormal(0.0F, 1.0F, 0.0F); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var7.setNormal(-1.0F, 0.0F, 0.0F); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var7.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var7.setNormal(1.0F, 0.0F, 0.0F); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var7.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var7.setTranslation(0.0D, 0.0D, 0.0D); + var7.draw(); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + /** + * Adds to the tesselator a box using the aabb for the bounds. Args: aabb + */ + public static void renderAABB(AxisAlignedBB par0AxisAlignedBB) + { + Tessellator var1 = Tessellator.instance; + var1.startDrawingQuads(); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.minX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.minZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.maxY, par0AxisAlignedBB.maxZ); + var1.addVertex(par0AxisAlignedBB.maxX, par0AxisAlignedBB.minY, par0AxisAlignedBB.maxZ); + var1.draw(); + } + + /** + * Sets the RenderManager. + */ + public void setRenderManager(RenderManager par1RenderManager) + { + this.renderManager = par1RenderManager; + } + + /** + * Renders the entity's shadow and fire (if its on fire). Args: entity, x, y, z, yaw, partialTickTime + */ + public void doRenderShadowAndFire(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) + { + if (this.renderManager.options.fancyGraphics && this.shadowSize > 0.0F && !par1Entity.isInvisible()) + { + double var10 = this.renderManager.getDistanceToCamera(par1Entity.posX, par1Entity.posY, par1Entity.posZ); + float var12 = (float)((1.0D - var10 / 256.0D) * (double)this.shadowOpaque); + + if (var12 > 0.0F) + { + this.renderShadow(par1Entity, par2, par4, par6, var12, par9); + } + } + + if (par1Entity.canRenderOnFire()) + { + this.renderEntityOnFire(par1Entity, par2, par4, par6, par9); + } + } + + /** + * Returns the font renderer from the set render manager + */ + public FontRenderer getFontRendererFromRenderManager() + { + return this.renderManager.getFontRenderer(); + } + + public void updateIcons(IconRegister par1IconRegister) {} +} diff --git a/src/main/java/net/minecraft/src/RenderArrow.java b/src/main/java/net/minecraft/src/RenderArrow.java new file mode 100644 index 0000000..9cf38bb --- /dev/null +++ b/src/main/java/net/minecraft/src/RenderArrow.java @@ -0,0 +1,94 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +public class RenderArrow extends Render +{ + private static final ResourceLocation arrowTextures = new ResourceLocation("textures/entity/arrow.png"); + + public void renderArrow(EntityArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9) + { + this.bindEntityTexture(par1EntityArrow); + GL11.glPushMatrix(); + GL11.glTranslatef((float)par2, (float)par4, (float)par6); + GL11.glRotatef(par1EntityArrow.prevRotationYaw + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); + Tessellator var10 = Tessellator.instance; + byte var11 = 0; + float var12 = 0.0F; + float var13 = 0.5F; + float var14 = (float)(0 + var11 * 10) / 32.0F; + float var15 = (float)(5 + var11 * 10) / 32.0F; + float var16 = 0.0F; + float var17 = 0.15625F; + float var18 = (float)(5 + var11 * 10) / 32.0F; + float var19 = (float)(10 + var11 * 10) / 32.0F; + float var20 = 0.05625F; + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + float var21 = (float)par1EntityArrow.arrowShake - par9; + + if (var21 > 0.0F) + { + float var22 = -MathHelper.sin(var21 * 3.0F) * var21; + GL11.glRotatef(var22, 0.0F, 0.0F, 1.0F); + } + + GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); + GL11.glScalef(var20, var20, var20); + GL11.glTranslatef(-4.0F, 0.0F, 0.0F); + GL11.glNormal3f(var20, 0.0F, 0.0F); + var10.startDrawingQuads(); + var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)var16, (double)var18); + var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)var17, (double)var18); + var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)var17, (double)var19); + var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)var16, (double)var19); + var10.draw(); + GL11.glNormal3f(-var20, 0.0F, 0.0F); + var10.startDrawingQuads(); + var10.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)var16, (double)var18); + var10.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)var17, (double)var18); + var10.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)var17, (double)var19); + var10.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)var16, (double)var19); + var10.draw(); + + for (int var23 = 0; var23 < 4; ++var23) + { + GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + GL11.glNormal3f(0.0F, 0.0F, var20); + var10.startDrawingQuads(); + var10.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)var12, (double)var14); + var10.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)var13, (double)var14); + var10.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)var13, (double)var15); + var10.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)var12, (double)var15); + var10.draw(); + } + + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + + protected ResourceLocation getArrowTextures(EntityArrow par1EntityArrow) + { + return arrowTextures; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity par1Entity) + { + return this.getArrowTextures((EntityArrow)par1Entity); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render> 16 & 255) / 255.0F; + float var11 = (float)(var9 >> 8 & 255) / 255.0F; + float var12 = (float)(var9 & 255) / 255.0F; + GL11.glColor3f(var8 * var10, var8 * var11, var8 * var12); + + if (var4.isItemEnchanted()) + { + return 31; + } + + return 16; + } + + GL11.glColor3f(var8, var8, var8); + + if (var4.isItemEnchanted()) + { + return 15; + } + + return 1; + } + } + + return -1; + } + + protected void func_130013_c(EntityLiving par1EntityLiving, int par2, float par3) + { + ItemStack var4 = par1EntityLiving.func_130225_q(3 - par2); + + if (var4 != null) + { + Item var5 = var4.getItem(); + + if (var5 instanceof ItemArmor) + { + this.bindTexture(func_110858_a((ItemArmor)var5, par2, "overlay")); + float var6 = 1.0F; + GL11.glColor3f(var6, var6, var6); + } + } + } + + public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) + { + float var10 = 1.0F; + GL11.glColor3f(var10, var10, var10); + ItemStack var11 = par1EntityLiving.getHeldItem(); + this.func_82420_a(par1EntityLiving, var11); + double var12 = par4 - (double)par1EntityLiving.yOffset; + + if (par1EntityLiving.isSneaking()) + { + var12 -= 0.125D; + } + + super.doRenderLiving(par1EntityLiving, par2, var12, par6, par8, par9); + this.field_82423_g.aimedBow = this.field_82425_h.aimedBow = this.modelBipedMain.aimedBow = false; + this.field_82423_g.isSneak = this.field_82425_h.isSneak = this.modelBipedMain.isSneak = false; + this.field_82423_g.heldItemRight = this.field_82425_h.heldItemRight = this.modelBipedMain.heldItemRight = 0; + } + + protected ResourceLocation func_110856_a(EntityLiving par1EntityLiving) + { + return null; + } + + protected void func_82420_a(EntityLiving par1EntityLiving, ItemStack par2ItemStack) + { + this.field_82423_g.heldItemRight = this.field_82425_h.heldItemRight = this.modelBipedMain.heldItemRight = par2ItemStack != null ? 1 : 0; + this.field_82423_g.isSneak = this.field_82425_h.isSneak = this.modelBipedMain.isSneak = par1EntityLiving.isSneaking(); + } + + protected void func_130005_c(EntityLiving par1EntityLiving, float par2) + { + float var3 = 1.0F; + GL11.glColor3f(var3, var3, var3); + super.renderEquippedItems(par1EntityLiving, par2); + ItemStack var4 = par1EntityLiving.getHeldItem(); + ItemStack var5 = par1EntityLiving.func_130225_q(3); + float var6; + + if (var5 != null) + { + GL11.glPushMatrix(); + this.modelBipedMain.bipedHead.postRender(0.0625F); + + if (var5.getItem().itemID < 256) + { + if (RenderBlocks.renderItemIn3d(Block.blocksList[var5.itemID].getRenderType())) + { + var6 = 0.625F; + GL11.glTranslatef(0.0F, -0.25F, 0.0F); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(var6, -var6, -var6); + } + + this.renderManager.itemRenderer.renderItem(par1EntityLiving, var5, 0); + } + else if (var5.getItem().itemID == Item.skull.itemID) + { + var6 = 1.0625F; + GL11.glScalef(var6, -var6, -var6); + String var7 = ""; + + if (var5.hasTagCompound() && var5.getTagCompound().hasKey("SkullOwner")) + { + var7 = var5.getTagCompound().getString("SkullOwner"); + } + + TileEntitySkullRenderer.skullRenderer.func_82393_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, var5.getItemDamage(), var7); + } + + GL11.glPopMatrix(); + } + + if (var4 != null) + { + GL11.glPushMatrix(); + + if (this.mainModel.isChild) + { + var6 = 0.5F; + GL11.glTranslatef(0.0F, 0.625F, 0.0F); + GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F); + GL11.glScalef(var6, var6, var6); + } + + this.modelBipedMain.bipedRightArm.postRender(0.0625F); + GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); + + if (var4.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var4.itemID].getRenderType())) + { + var6 = 0.5F; + GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); + var6 *= 0.75F; + GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(-var6, -var6, var6); + } + else if (var4.itemID == Item.bow.itemID) + { + var6 = 0.625F; + GL11.glTranslatef(0.0F, 0.125F, 0.3125F); + GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(var6, -var6, var6); + GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + } + else if (Item.itemsList[var4.itemID].isFull3D()) + { + var6 = 0.625F; + + if (Item.itemsList[var4.itemID].shouldRotateAroundWhenRendering()) + { + GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.0F, -0.125F, 0.0F); + } + + this.func_82422_c(); + GL11.glScalef(var6, -var6, var6); + GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + } + else + { + var6 = 0.375F; + GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); + GL11.glScalef(var6, var6, var6); + GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F); + } + + this.renderManager.itemRenderer.renderItem(par1EntityLiving, var4, 0); + + if (var4.getItem().requiresMultipleRenderPasses()) + { + this.renderManager.itemRenderer.renderItem(par1EntityLiving, var4, 1); + } + + GL11.glPopMatrix(); + } + } + + protected void func_82422_c() + { + GL11.glTranslatef(0.0F, 0.1875F, 0.0F); + } + + protected void func_82439_b(EntityLivingBase par1EntityLivingBase, int par2, float par3) + { + this.func_130013_c((EntityLiving)par1EntityLivingBase, par2, par3); + } + + /** + * Queries whether should render the specified pass or not. + */ + protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3) + { + return this.func_130006_a((EntityLiving)par1EntityLivingBase, par2, par3); + } + + protected void renderEquippedItems(EntityLivingBase par1EntityLivingBase, float par2) + { + this.func_130005_c((EntityLiving)par1EntityLivingBase, par2); + } + + public void renderPlayer(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9) + { + this.doRenderLiving((EntityLiving)par1EntityLivingBase, par2, par4, par6, par8, par9); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity par1Entity) + { + return this.func_110856_a((EntityLiving)par1Entity); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render=0, all block faces will be rendered using this texture index + */ + private Icon overrideBlockTexture; + + /** + * Set to true if the texture should be flipped horizontally during render*Face + */ + private boolean flipTexture; + + /** + * If true, renders all faces on all blocks rather than using the logic in Block.shouldSideBeRendered. Unused. + */ + private boolean renderAllFaces; + + /** Fancy grass side matching biome */ + public static boolean fancyGrass = true; + public boolean useInventoryTint = true; + + /** The minimum X value for rendering (default 0.0). */ + private double renderMinX; + + /** The maximum X value for rendering (default 1.0). */ + private double renderMaxX; + + /** The minimum Y value for rendering (default 0.0). */ + private double renderMinY; + + /** The maximum Y value for rendering (default 1.0). */ + private double renderMaxY; + + /** The minimum Z value for rendering (default 0.0). */ + private double renderMinZ; + + /** The maximum Z value for rendering (default 1.0). */ + private double renderMaxZ; + + /** + * Set by overrideBlockBounds, to keep this class from changing the visual bounding box. + */ + private boolean lockBlockBounds; + private boolean partialRenderBounds; + private final Minecraft minecraftRB; + private int uvRotateEast; + private int uvRotateWest; + private int uvRotateSouth; + private int uvRotateNorth; + private int uvRotateTop; + private int uvRotateBottom; + + /** Whether ambient occlusion is enabled or not */ + private boolean enableAO; + + /** + * Used as a scratch variable for ambient occlusion on the north/bottom/east corner. + */ + private float aoLightValueScratchXYZNNN; + + /** + * Used as a scratch variable for ambient occlusion between the bottom face and the north face. + */ + private float aoLightValueScratchXYNN; + + /** + * Used as a scratch variable for ambient occlusion on the north/bottom/west corner. + */ + private float aoLightValueScratchXYZNNP; + + /** + * Used as a scratch variable for ambient occlusion between the bottom face and the east face. + */ + private float aoLightValueScratchYZNN; + + /** + * Used as a scratch variable for ambient occlusion between the bottom face and the west face. + */ + private float aoLightValueScratchYZNP; + + /** + * Used as a scratch variable for ambient occlusion on the south/bottom/east corner. + */ + private float aoLightValueScratchXYZPNN; + + /** + * Used as a scratch variable for ambient occlusion between the bottom face and the south face. + */ + private float aoLightValueScratchXYPN; + + /** + * Used as a scratch variable for ambient occlusion on the south/bottom/west corner. + */ + private float aoLightValueScratchXYZPNP; + + /** + * Used as a scratch variable for ambient occlusion on the north/top/east corner. + */ + private float aoLightValueScratchXYZNPN; + + /** + * Used as a scratch variable for ambient occlusion between the top face and the north face. + */ + private float aoLightValueScratchXYNP; + + /** + * Used as a scratch variable for ambient occlusion on the north/top/west corner. + */ + private float aoLightValueScratchXYZNPP; + + /** + * Used as a scratch variable for ambient occlusion between the top face and the east face. + */ + private float aoLightValueScratchYZPN; + + /** + * Used as a scratch variable for ambient occlusion on the south/top/east corner. + */ + private float aoLightValueScratchXYZPPN; + + /** + * Used as a scratch variable for ambient occlusion between the top face and the south face. + */ + private float aoLightValueScratchXYPP; + + /** + * Used as a scratch variable for ambient occlusion between the top face and the west face. + */ + private float aoLightValueScratchYZPP; + + /** + * Used as a scratch variable for ambient occlusion on the south/top/west corner. + */ + private float aoLightValueScratchXYZPPP; + + /** + * Used as a scratch variable for ambient occlusion between the north face and the east face. + */ + private float aoLightValueScratchXZNN; + + /** + * Used as a scratch variable for ambient occlusion between the south face and the east face. + */ + private float aoLightValueScratchXZPN; + + /** + * Used as a scratch variable for ambient occlusion between the north face and the west face. + */ + private float aoLightValueScratchXZNP; + + /** + * Used as a scratch variable for ambient occlusion between the south face and the west face. + */ + private float aoLightValueScratchXZPP; + + /** Ambient occlusion brightness XYZNNN */ + private int aoBrightnessXYZNNN; + + /** Ambient occlusion brightness XYNN */ + private int aoBrightnessXYNN; + + /** Ambient occlusion brightness XYZNNP */ + private int aoBrightnessXYZNNP; + + /** Ambient occlusion brightness YZNN */ + private int aoBrightnessYZNN; + + /** Ambient occlusion brightness YZNP */ + private int aoBrightnessYZNP; + + /** Ambient occlusion brightness XYZPNN */ + private int aoBrightnessXYZPNN; + + /** Ambient occlusion brightness XYPN */ + private int aoBrightnessXYPN; + + /** Ambient occlusion brightness XYZPNP */ + private int aoBrightnessXYZPNP; + + /** Ambient occlusion brightness XYZNPN */ + private int aoBrightnessXYZNPN; + + /** Ambient occlusion brightness XYNP */ + private int aoBrightnessXYNP; + + /** Ambient occlusion brightness XYZNPP */ + private int aoBrightnessXYZNPP; + + /** Ambient occlusion brightness YZPN */ + private int aoBrightnessYZPN; + + /** Ambient occlusion brightness XYZPPN */ + private int aoBrightnessXYZPPN; + + /** Ambient occlusion brightness XYPP */ + private int aoBrightnessXYPP; + + /** Ambient occlusion brightness YZPP */ + private int aoBrightnessYZPP; + + /** Ambient occlusion brightness XYZPPP */ + private int aoBrightnessXYZPPP; + + /** Ambient occlusion brightness XZNN */ + private int aoBrightnessXZNN; + + /** Ambient occlusion brightness XZPN */ + private int aoBrightnessXZPN; + + /** Ambient occlusion brightness XZNP */ + private int aoBrightnessXZNP; + + /** Ambient occlusion brightness XZPP */ + private int aoBrightnessXZPP; + + /** Brightness top left */ + private int brightnessTopLeft; + + /** Brightness bottom left */ + private int brightnessBottomLeft; + + /** Brightness bottom right */ + private int brightnessBottomRight; + + /** Brightness top right */ + private int brightnessTopRight; + + /** Red color value for the top left corner */ + private float colorRedTopLeft; + + /** Red color value for the bottom left corner */ + private float colorRedBottomLeft; + + /** Red color value for the bottom right corner */ + private float colorRedBottomRight; + + /** Red color value for the top right corner */ + private float colorRedTopRight; + + /** Green color value for the top left corner */ + private float colorGreenTopLeft; + + /** Green color value for the bottom left corner */ + private float colorGreenBottomLeft; + + /** Green color value for the bottom right corner */ + private float colorGreenBottomRight; + + /** Green color value for the top right corner */ + private float colorGreenTopRight; + + /** Blue color value for the top left corner */ + private float colorBlueTopLeft; + + /** Blue color value for the bottom left corner */ + private float colorBlueBottomLeft; + + /** Blue color value for the bottom right corner */ + private float colorBlueBottomRight; + + /** Blue color value for the top right corner */ + private float colorBlueTopRight; + + public RenderBlocks(IBlockAccess par1IBlockAccess) + { + this.blockAccess = par1IBlockAccess; + this.minecraftRB = Minecraft.getMinecraft(); + } + + public RenderBlocks() + { + this.minecraftRB = Minecraft.getMinecraft(); + } + + /** + * Sets overrideBlockTexture + */ + public void setOverrideBlockTexture(Icon par1Icon) + { + this.overrideBlockTexture = par1Icon; + } + + /** + * Clear override block texture + */ + public void clearOverrideBlockTexture() + { + this.overrideBlockTexture = null; + } + + public boolean hasOverrideBlockTexture() + { + return this.overrideBlockTexture != null; + } + + /** + * Sets the bounding box for the block to draw in, e.g. 0.25-0.75 on all axes for a half-size, centered block. + */ + public void setRenderBounds(double par1, double par3, double par5, double par7, double par9, double par11) + { + if (!this.lockBlockBounds) + { + this.renderMinX = par1; + this.renderMaxX = par7; + this.renderMinY = par3; + this.renderMaxY = par9; + this.renderMinZ = par5; + this.renderMaxZ = par11; + this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D || this.renderMinY > 0.0D || this.renderMaxY < 1.0D || this.renderMinZ > 0.0D || this.renderMaxZ < 1.0D); + } + } + + /** + * Like setRenderBounds, but automatically pulling the bounds from the given Block. + */ + public void setRenderBoundsFromBlock(Block par1Block) + { + if (!this.lockBlockBounds) + { + this.renderMinX = par1Block.getBlockBoundsMinX(); + this.renderMaxX = par1Block.getBlockBoundsMaxX(); + this.renderMinY = par1Block.getBlockBoundsMinY(); + this.renderMaxY = par1Block.getBlockBoundsMaxY(); + this.renderMinZ = par1Block.getBlockBoundsMinZ(); + this.renderMaxZ = par1Block.getBlockBoundsMaxZ(); + this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D || this.renderMinY > 0.0D || this.renderMaxY < 1.0D || this.renderMinZ > 0.0D || this.renderMaxZ < 1.0D); + } + } + + /** + * Like setRenderBounds, but locks the values so that RenderBlocks won't change them. If you use this, you must + * call unlockBlockBounds after you finish rendering! + */ + public void overrideBlockBounds(double par1, double par3, double par5, double par7, double par9, double par11) + { + this.renderMinX = par1; + this.renderMaxX = par7; + this.renderMinY = par3; + this.renderMaxY = par9; + this.renderMinZ = par5; + this.renderMaxZ = par11; + this.lockBlockBounds = true; + this.partialRenderBounds = this.minecraftRB.gameSettings.ambientOcclusion >= 2 && (this.renderMinX > 0.0D || this.renderMaxX < 1.0D || this.renderMinY > 0.0D || this.renderMaxY < 1.0D || this.renderMinZ > 0.0D || this.renderMaxZ < 1.0D); + } + + /** + * Unlocks the visual bounding box so that RenderBlocks can change it again. + */ + public void unlockBlockBounds() + { + this.lockBlockBounds = false; + } + + /** + * Renders a block using the given texture instead of the block's own default texture + */ + public void renderBlockUsingTexture(Block par1Block, int par2, int par3, int par4, Icon par5Icon) + { + this.setOverrideBlockTexture(par5Icon); + this.renderBlockByRenderType(par1Block, par2, par3, par4); + this.clearOverrideBlockTexture(); + } + + /** + * Render all faces of a block + */ + public void renderBlockAllFaces(Block par1Block, int par2, int par3, int par4) + { + this.renderAllFaces = true; + this.renderBlockByRenderType(par1Block, par2, par3, par4); + this.renderAllFaces = false; + } + + /** + * Renders the block at the given coordinates using the block's rendering type + */ + public boolean renderBlockByRenderType(Block par1Block, int par2, int par3, int par4) + { + int var5 = par1Block.getRenderType(); + + if (var5 == -1) + { + return false; + } + else + { + par1Block.setBlockBoundsBasedOnState(this.blockAccess, par2, par3, par4); + this.setRenderBoundsFromBlock(par1Block); + return var5 == 0 ? this.renderStandardBlock(par1Block, par2, par3, par4) : (var5 == 4 ? this.renderBlockFluids(par1Block, par2, par3, par4) : (var5 == 31 ? this.renderBlockLog(par1Block, par2, par3, par4) : (var5 == 1 ? this.renderCrossedSquares(par1Block, par2, par3, par4) : (var5 == 2 ? this.renderBlockTorch(par1Block, par2, par3, par4) : (var5 == 20 ? this.renderBlockVine(par1Block, par2, par3, par4) : (var5 == 11 ? this.renderBlockFence((BlockFence)par1Block, par2, par3, par4) : (var5 == 39 ? this.renderBlockQuartz(par1Block, par2, par3, par4) : (var5 == 5 ? this.renderBlockRedstoneWire(par1Block, par2, par3, par4) : (var5 == 13 ? this.renderBlockCactus(par1Block, par2, par3, par4) : (var5 == 9 ? this.renderBlockMinecartTrack((BlockRailBase)par1Block, par2, par3, par4) : (var5 == 19 ? this.renderBlockStem(par1Block, par2, par3, par4) : (var5 == 23 ? this.renderBlockLilyPad(par1Block, par2, par3, par4) : (var5 == 6 ? this.renderBlockCrops(par1Block, par2, par3, par4) : (var5 == 3 ? this.renderBlockFire((BlockFire)par1Block, par2, par3, par4) : (var5 == 8 ? this.renderBlockLadder(par1Block, par2, par3, par4) : (var5 == 7 ? this.renderBlockDoor(par1Block, par2, par3, par4) : (var5 == 10 ? this.renderBlockStairs((BlockStairs)par1Block, par2, par3, par4) : (var5 == 27 ? this.renderBlockDragonEgg((BlockDragonEgg)par1Block, par2, par3, par4) : (var5 == 32 ? this.renderBlockWall((BlockWall)par1Block, par2, par3, par4) : (var5 == 12 ? this.renderBlockLever(par1Block, par2, par3, par4) : (var5 == 29 ? this.renderBlockTripWireSource(par1Block, par2, par3, par4) : (var5 == 30 ? this.renderBlockTripWire(par1Block, par2, par3, par4) : (var5 == 14 ? this.renderBlockBed(par1Block, par2, par3, par4) : (var5 == 15 ? this.renderBlockRepeater((BlockRedstoneRepeater)par1Block, par2, par3, par4) : (var5 == 36 ? this.renderBlockRedstoneLogic((BlockRedstoneLogic)par1Block, par2, par3, par4) : (var5 == 37 ? this.renderBlockComparator((BlockComparator)par1Block, par2, par3, par4) : (var5 == 16 ? this.renderPistonBase(par1Block, par2, par3, par4, false) : (var5 == 17 ? this.renderPistonExtension(par1Block, par2, par3, par4, true) : (var5 == 18 ? this.renderBlockPane((BlockPane)par1Block, par2, par3, par4) : (var5 == 21 ? this.renderBlockFenceGate((BlockFenceGate)par1Block, par2, par3, par4) : (var5 == 24 ? this.renderBlockCauldron((BlockCauldron)par1Block, par2, par3, par4) : (var5 == 33 ? this.renderBlockFlowerpot((BlockFlowerPot)par1Block, par2, par3, par4) : (var5 == 35 ? this.renderBlockAnvil((BlockAnvil)par1Block, par2, par3, par4) : (var5 == 25 ? this.renderBlockBrewingStand((BlockBrewingStand)par1Block, par2, par3, par4) : (var5 == 26 ? this.renderBlockEndPortalFrame((BlockEndPortalFrame)par1Block, par2, par3, par4) : (var5 == 28 ? this.renderBlockCocoa((BlockCocoa)par1Block, par2, par3, par4) : (var5 == 34 ? this.renderBlockBeacon((BlockBeacon)par1Block, par2, par3, par4) : (var5 == 38 ? this.renderBlockHopper((BlockHopper)par1Block, par2, par3, par4) : false)))))))))))))))))))))))))))))))))))))); + } + } + + /** + * Render BlockEndPortalFrame + */ + private boolean renderBlockEndPortalFrame(BlockEndPortalFrame par1BlockEndPortalFrame, int par2, int par3, int par4) + { + int var5 = this.blockAccess.getBlockMetadata(par2, par3, par4); + int var6 = var5 & 3; + + if (var6 == 0) + { + this.uvRotateTop = 3; + } + else if (var6 == 3) + { + this.uvRotateTop = 1; + } + else if (var6 == 1) + { + this.uvRotateTop = 2; + } + + if (!BlockEndPortalFrame.isEnderEyeInserted(var5)) + { + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.8125D, 1.0D); + this.renderStandardBlock(par1BlockEndPortalFrame, par2, par3, par4); + this.uvRotateTop = 0; + return true; + } + else + { + this.renderAllFaces = true; + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.8125D, 1.0D); + this.renderStandardBlock(par1BlockEndPortalFrame, par2, par3, par4); + this.setOverrideBlockTexture(par1BlockEndPortalFrame.func_94398_p()); + this.setRenderBounds(0.25D, 0.8125D, 0.25D, 0.75D, 1.0D, 0.75D); + this.renderStandardBlock(par1BlockEndPortalFrame, par2, par3, par4); + this.renderAllFaces = false; + this.clearOverrideBlockTexture(); + this.uvRotateTop = 0; + return true; + } + } + + /** + * render a bed at the given coordinates + */ + private boolean renderBlockBed(Block par1Block, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); + int var7 = BlockBed.getDirection(var6); + boolean var8 = BlockBed.isBlockHeadOfBed(var6); + float var9 = 0.5F; + float var10 = 1.0F; + float var11 = 0.8F; + float var12 = 0.6F; + int var25 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4); + var5.setBrightness(var25); + var5.setColorOpaque_F(var9, var9, var9); + Icon var27 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0); + double var28 = (double)var27.getMinU(); + double var30 = (double)var27.getMaxU(); + double var32 = (double)var27.getMinV(); + double var34 = (double)var27.getMaxV(); + double var36 = (double)par2 + this.renderMinX; + double var38 = (double)par2 + this.renderMaxX; + double var40 = (double)par3 + this.renderMinY + 0.1875D; + double var42 = (double)par4 + this.renderMinZ; + double var44 = (double)par4 + this.renderMaxZ; + var5.addVertexWithUV(var36, var40, var44, var28, var34); + var5.addVertexWithUV(var36, var40, var42, var28, var32); + var5.addVertexWithUV(var38, var40, var42, var30, var32); + var5.addVertexWithUV(var38, var40, var44, var30, var34); + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4)); + var5.setColorOpaque_F(var10, var10, var10); + var27 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1); + var28 = (double)var27.getMinU(); + var30 = (double)var27.getMaxU(); + var32 = (double)var27.getMinV(); + var34 = (double)var27.getMaxV(); + var36 = var28; + var38 = var30; + var40 = var32; + var42 = var32; + var44 = var28; + double var46 = var30; + double var48 = var34; + double var50 = var34; + + if (var7 == 0) + { + var38 = var28; + var40 = var34; + var44 = var30; + var50 = var32; + } + else if (var7 == 2) + { + var36 = var30; + var42 = var34; + var46 = var28; + var48 = var32; + } + else if (var7 == 3) + { + var36 = var30; + var42 = var34; + var46 = var28; + var48 = var32; + var38 = var28; + var40 = var34; + var44 = var30; + var50 = var32; + } + + double var52 = (double)par2 + this.renderMinX; + double var54 = (double)par2 + this.renderMaxX; + double var56 = (double)par3 + this.renderMaxY; + double var58 = (double)par4 + this.renderMinZ; + double var60 = (double)par4 + this.renderMaxZ; + var5.addVertexWithUV(var54, var56, var60, var44, var48); + var5.addVertexWithUV(var54, var56, var58, var36, var40); + var5.addVertexWithUV(var52, var56, var58, var38, var42); + var5.addVertexWithUV(var52, var56, var60, var46, var50); + int var62 = Direction.directionToFacing[var7]; + + if (var8) + { + var62 = Direction.directionToFacing[Direction.rotateOpposite[var7]]; + } + + byte var63 = 4; + + switch (var7) + { + case 0: + var63 = 5; + break; + + case 1: + var63 = 3; + + case 2: + default: + break; + + case 3: + var63 = 2; + } + + if (var62 != 2 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2))) + { + var5.setBrightness(this.renderMinZ > 0.0D ? var25 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1)); + var5.setColorOpaque_F(var11, var11, var11); + this.flipTexture = var63 == 2; + this.renderFaceZNeg(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2)); + } + + if (var62 != 3 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3))) + { + var5.setBrightness(this.renderMaxZ < 1.0D ? var25 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1)); + var5.setColorOpaque_F(var11, var11, var11); + this.flipTexture = var63 == 3; + this.renderFaceZPos(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3)); + } + + if (var62 != 4 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4))) + { + var5.setBrightness(this.renderMinZ > 0.0D ? var25 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4)); + var5.setColorOpaque_F(var12, var12, var12); + this.flipTexture = var63 == 4; + this.renderFaceXNeg(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4)); + } + + if (var62 != 5 && (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5))) + { + var5.setBrightness(this.renderMaxZ < 1.0D ? var25 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4)); + var5.setColorOpaque_F(var12, var12, var12); + this.flipTexture = var63 == 5; + this.renderFaceXPos(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5)); + } + + this.flipTexture = false; + return true; + } + + /** + * Render BlockBrewingStand + */ + private boolean renderBlockBrewingStand(BlockBrewingStand par1BlockBrewingStand, int par2, int par3, int par4) + { + this.setRenderBounds(0.4375D, 0.0D, 0.4375D, 0.5625D, 0.875D, 0.5625D); + this.renderStandardBlock(par1BlockBrewingStand, par2, par3, par4); + this.setOverrideBlockTexture(par1BlockBrewingStand.getBrewingStandIcon()); + this.renderAllFaces = true; + this.setRenderBounds(0.5625D, 0.0D, 0.3125D, 0.9375D, 0.125D, 0.6875D); + this.renderStandardBlock(par1BlockBrewingStand, par2, par3, par4); + this.setRenderBounds(0.125D, 0.0D, 0.0625D, 0.5D, 0.125D, 0.4375D); + this.renderStandardBlock(par1BlockBrewingStand, par2, par3, par4); + this.setRenderBounds(0.125D, 0.0D, 0.5625D, 0.5D, 0.125D, 0.9375D); + this.renderStandardBlock(par1BlockBrewingStand, par2, par3, par4); + this.renderAllFaces = false; + this.clearOverrideBlockTexture(); + Tessellator var5 = Tessellator.instance; + var5.setBrightness(par1BlockBrewingStand.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var6 = 1.0F; + int var7 = par1BlockBrewingStand.colorMultiplier(this.blockAccess, par2, par3, par4); + float var8 = (float)(var7 >> 16 & 255) / 255.0F; + float var9 = (float)(var7 >> 8 & 255) / 255.0F; + float var10 = (float)(var7 & 255) / 255.0F; + + if (EntityRenderer.anaglyphEnable) + { + float var11 = (var8 * 30.0F + var9 * 59.0F + var10 * 11.0F) / 100.0F; + float var12 = (var8 * 30.0F + var9 * 70.0F) / 100.0F; + float var13 = (var8 * 30.0F + var10 * 70.0F) / 100.0F; + var8 = var11; + var9 = var12; + var10 = var13; + } + + var5.setColorOpaque_F(var6 * var8, var6 * var9, var6 * var10); + Icon var32 = this.getBlockIconFromSideAndMetadata(par1BlockBrewingStand, 0, 0); + + if (this.hasOverrideBlockTexture()) + { + var32 = this.overrideBlockTexture; + } + + double var33 = (double)var32.getMinV(); + double var14 = (double)var32.getMaxV(); + int var16 = this.blockAccess.getBlockMetadata(par2, par3, par4); + + for (int var17 = 0; var17 < 3; ++var17) + { + double var18 = (double)var17 * Math.PI * 2.0D / 3.0D + (Math.PI / 2D); + double var20 = (double)var32.getInterpolatedU(8.0D); + double var22 = (double)var32.getMaxU(); + + if ((var16 & 1 << var17) != 0) + { + var22 = (double)var32.getMinU(); + } + + double var24 = (double)par2 + 0.5D; + double var26 = (double)par2 + 0.5D + Math.sin(var18) * 8.0D / 16.0D; + double var28 = (double)par4 + 0.5D; + double var30 = (double)par4 + 0.5D + Math.cos(var18) * 8.0D / 16.0D; + var5.addVertexWithUV(var24, (double)(par3 + 1), var28, var20, var33); + var5.addVertexWithUV(var24, (double)(par3 + 0), var28, var20, var14); + var5.addVertexWithUV(var26, (double)(par3 + 0), var30, var22, var14); + var5.addVertexWithUV(var26, (double)(par3 + 1), var30, var22, var33); + var5.addVertexWithUV(var26, (double)(par3 + 1), var30, var22, var33); + var5.addVertexWithUV(var26, (double)(par3 + 0), var30, var22, var14); + var5.addVertexWithUV(var24, (double)(par3 + 0), var28, var20, var14); + var5.addVertexWithUV(var24, (double)(par3 + 1), var28, var20, var33); + } + + par1BlockBrewingStand.setBlockBoundsForItemRender(); + return true; + } + + /** + * Render block cauldron + */ + private boolean renderBlockCauldron(BlockCauldron par1BlockCauldron, int par2, int par3, int par4) + { + this.renderStandardBlock(par1BlockCauldron, par2, par3, par4); + Tessellator var5 = Tessellator.instance; + var5.setBrightness(par1BlockCauldron.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var6 = 1.0F; + int var7 = par1BlockCauldron.colorMultiplier(this.blockAccess, par2, par3, par4); + float var8 = (float)(var7 >> 16 & 255) / 255.0F; + float var9 = (float)(var7 >> 8 & 255) / 255.0F; + float var10 = (float)(var7 & 255) / 255.0F; + float var12; + + if (EntityRenderer.anaglyphEnable) + { + float var11 = (var8 * 30.0F + var9 * 59.0F + var10 * 11.0F) / 100.0F; + var12 = (var8 * 30.0F + var9 * 70.0F) / 100.0F; + float var13 = (var8 * 30.0F + var10 * 70.0F) / 100.0F; + var8 = var11; + var9 = var12; + var10 = var13; + } + + var5.setColorOpaque_F(var6 * var8, var6 * var9, var6 * var10); + Icon var16 = par1BlockCauldron.getBlockTextureFromSide(2); + var12 = 0.125F; + this.renderFaceXPos(par1BlockCauldron, (double)((float)par2 - 1.0F + var12), (double)par3, (double)par4, var16); + this.renderFaceXNeg(par1BlockCauldron, (double)((float)par2 + 1.0F - var12), (double)par3, (double)par4, var16); + this.renderFaceZPos(par1BlockCauldron, (double)par2, (double)par3, (double)((float)par4 - 1.0F + var12), var16); + this.renderFaceZNeg(par1BlockCauldron, (double)par2, (double)par3, (double)((float)par4 + 1.0F - var12), var16); + Icon var17 = BlockCauldron.getCauldronIcon("inner"); + this.renderFaceYPos(par1BlockCauldron, (double)par2, (double)((float)par3 - 1.0F + 0.25F), (double)par4, var17); + this.renderFaceYNeg(par1BlockCauldron, (double)par2, (double)((float)par3 + 1.0F - 0.75F), (double)par4, var17); + int var14 = this.blockAccess.getBlockMetadata(par2, par3, par4); + + if (var14 > 0) + { + Icon var15 = BlockFluid.getFluidIcon("water_still"); + + if (var14 > 3) + { + var14 = 3; + } + + this.renderFaceYPos(par1BlockCauldron, (double)par2, (double)((float)par3 - 1.0F + (6.0F + (float)var14 * 3.0F) / 16.0F), (double)par4, var15); + } + + return true; + } + + /** + * Renders flower pot + */ + private boolean renderBlockFlowerpot(BlockFlowerPot par1BlockFlowerPot, int par2, int par3, int par4) + { + this.renderStandardBlock(par1BlockFlowerPot, par2, par3, par4); + Tessellator var5 = Tessellator.instance; + var5.setBrightness(par1BlockFlowerPot.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var6 = 1.0F; + int var7 = par1BlockFlowerPot.colorMultiplier(this.blockAccess, par2, par3, par4); + Icon var8 = this.getBlockIconFromSide(par1BlockFlowerPot, 0); + float var9 = (float)(var7 >> 16 & 255) / 255.0F; + float var10 = (float)(var7 >> 8 & 255) / 255.0F; + float var11 = (float)(var7 & 255) / 255.0F; + float var12; + float var14; + + if (EntityRenderer.anaglyphEnable) + { + var12 = (var9 * 30.0F + var10 * 59.0F + var11 * 11.0F) / 100.0F; + float var13 = (var9 * 30.0F + var10 * 70.0F) / 100.0F; + var14 = (var9 * 30.0F + var11 * 70.0F) / 100.0F; + var9 = var12; + var10 = var13; + var11 = var14; + } + + var5.setColorOpaque_F(var6 * var9, var6 * var10, var6 * var11); + var12 = 0.1865F; + this.renderFaceXPos(par1BlockFlowerPot, (double)((float)par2 - 0.5F + var12), (double)par3, (double)par4, var8); + this.renderFaceXNeg(par1BlockFlowerPot, (double)((float)par2 + 0.5F - var12), (double)par3, (double)par4, var8); + this.renderFaceZPos(par1BlockFlowerPot, (double)par2, (double)par3, (double)((float)par4 - 0.5F + var12), var8); + this.renderFaceZNeg(par1BlockFlowerPot, (double)par2, (double)par3, (double)((float)par4 + 0.5F - var12), var8); + this.renderFaceYPos(par1BlockFlowerPot, (double)par2, (double)((float)par3 - 0.5F + var12 + 0.1875F), (double)par4, this.getBlockIcon(Block.dirt)); + int var19 = this.blockAccess.getBlockMetadata(par2, par3, par4); + + if (var19 != 0) + { + var14 = 0.0F; + float var15 = 4.0F; + float var16 = 0.0F; + BlockFlower var17 = null; + + switch (var19) + { + case 1: + var17 = Block.plantRed; + break; + + case 2: + var17 = Block.plantYellow; + + case 3: + case 4: + case 5: + case 6: + default: + break; + + case 7: + var17 = Block.mushroomRed; + break; + + case 8: + var17 = Block.mushroomBrown; + } + + var5.addTranslation(var14 / 16.0F, var15 / 16.0F, var16 / 16.0F); + + if (var17 != null) + { + this.renderBlockByRenderType(var17, par2, par3, par4); + } + else if (var19 == 9) + { + this.renderAllFaces = true; + float var18 = 0.125F; + this.setRenderBounds((double)(0.5F - var18), 0.0D, (double)(0.5F - var18), (double)(0.5F + var18), 0.25D, (double)(0.5F + var18)); + this.renderStandardBlock(Block.cactus, par2, par3, par4); + this.setRenderBounds((double)(0.5F - var18), 0.25D, (double)(0.5F - var18), (double)(0.5F + var18), 0.5D, (double)(0.5F + var18)); + this.renderStandardBlock(Block.cactus, par2, par3, par4); + this.setRenderBounds((double)(0.5F - var18), 0.5D, (double)(0.5F - var18), (double)(0.5F + var18), 0.75D, (double)(0.5F + var18)); + this.renderStandardBlock(Block.cactus, par2, par3, par4); + this.renderAllFaces = false; + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + } + else if (var19 == 3) + { + this.drawCrossedSquares(Block.sapling, 0, (double)par2, (double)par3, (double)par4, 0.75F); + } + else if (var19 == 5) + { + this.drawCrossedSquares(Block.sapling, 2, (double)par2, (double)par3, (double)par4, 0.75F); + } + else if (var19 == 4) + { + this.drawCrossedSquares(Block.sapling, 1, (double)par2, (double)par3, (double)par4, 0.75F); + } + else if (var19 == 6) + { + this.drawCrossedSquares(Block.sapling, 3, (double)par2, (double)par3, (double)par4, 0.75F); + } + else if (var19 == 11) + { + var7 = Block.tallGrass.colorMultiplier(this.blockAccess, par2, par3, par4); + var9 = (float)(var7 >> 16 & 255) / 255.0F; + var10 = (float)(var7 >> 8 & 255) / 255.0F; + var11 = (float)(var7 & 255) / 255.0F; + var5.setColorOpaque_F(var6 * var9, var6 * var10, var6 * var11); + this.drawCrossedSquares(Block.tallGrass, 2, (double)par2, (double)par3, (double)par4, 0.75F); + } + else if (var19 == 10) + { + this.drawCrossedSquares(Block.deadBush, 2, (double)par2, (double)par3, (double)par4, 0.75F); + } + + var5.addTranslation(-var14 / 16.0F, -var15 / 16.0F, -var16 / 16.0F); + } + + return true; + } + + /** + * Renders anvil + */ + private boolean renderBlockAnvil(BlockAnvil par1BlockAnvil, int par2, int par3, int par4) + { + return this.renderBlockAnvilMetadata(par1BlockAnvil, par2, par3, par4, this.blockAccess.getBlockMetadata(par2, par3, par4)); + } + + /** + * Renders anvil block with metadata + */ + public boolean renderBlockAnvilMetadata(BlockAnvil par1BlockAnvil, int par2, int par3, int par4, int par5) + { + Tessellator var6 = Tessellator.instance; + var6.setBrightness(par1BlockAnvil.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var7 = 1.0F; + int var8 = par1BlockAnvil.colorMultiplier(this.blockAccess, par2, par3, par4); + float var9 = (float)(var8 >> 16 & 255) / 255.0F; + float var10 = (float)(var8 >> 8 & 255) / 255.0F; + float var11 = (float)(var8 & 255) / 255.0F; + + if (EntityRenderer.anaglyphEnable) + { + float var12 = (var9 * 30.0F + var10 * 59.0F + var11 * 11.0F) / 100.0F; + float var13 = (var9 * 30.0F + var10 * 70.0F) / 100.0F; + float var14 = (var9 * 30.0F + var11 * 70.0F) / 100.0F; + var9 = var12; + var10 = var13; + var11 = var14; + } + + var6.setColorOpaque_F(var7 * var9, var7 * var10, var7 * var11); + return this.renderBlockAnvilOrient(par1BlockAnvil, par2, par3, par4, par5, false); + } + + /** + * Renders anvil block with orientation + */ + private boolean renderBlockAnvilOrient(BlockAnvil par1BlockAnvil, int par2, int par3, int par4, int par5, boolean par6) + { + int var7 = par6 ? 0 : par5 & 3; + boolean var8 = false; + float var9 = 0.0F; + + switch (var7) + { + case 0: + this.uvRotateSouth = 2; + this.uvRotateNorth = 1; + this.uvRotateTop = 3; + this.uvRotateBottom = 3; + break; + + case 1: + this.uvRotateEast = 1; + this.uvRotateWest = 2; + this.uvRotateTop = 2; + this.uvRotateBottom = 1; + var8 = true; + break; + + case 2: + this.uvRotateSouth = 1; + this.uvRotateNorth = 2; + break; + + case 3: + this.uvRotateEast = 2; + this.uvRotateWest = 1; + this.uvRotateTop = 1; + this.uvRotateBottom = 2; + var8 = true; + } + + var9 = this.renderBlockAnvilRotate(par1BlockAnvil, par2, par3, par4, 0, var9, 0.75F, 0.25F, 0.75F, var8, par6, par5); + var9 = this.renderBlockAnvilRotate(par1BlockAnvil, par2, par3, par4, 1, var9, 0.5F, 0.0625F, 0.625F, var8, par6, par5); + var9 = this.renderBlockAnvilRotate(par1BlockAnvil, par2, par3, par4, 2, var9, 0.25F, 0.3125F, 0.5F, var8, par6, par5); + this.renderBlockAnvilRotate(par1BlockAnvil, par2, par3, par4, 3, var9, 0.625F, 0.375F, 1.0F, var8, par6, par5); + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + this.uvRotateEast = 0; + this.uvRotateWest = 0; + this.uvRotateSouth = 0; + this.uvRotateNorth = 0; + this.uvRotateTop = 0; + this.uvRotateBottom = 0; + return true; + } + + /** + * Renders anvil block with rotation + */ + private float renderBlockAnvilRotate(BlockAnvil par1BlockAnvil, int par2, int par3, int par4, int par5, float par6, float par7, float par8, float par9, boolean par10, boolean par11, int par12) + { + if (par10) + { + float var13 = par7; + par7 = par9; + par9 = var13; + } + + par7 /= 2.0F; + par9 /= 2.0F; + par1BlockAnvil.field_82521_b = par5; + this.setRenderBounds((double)(0.5F - par7), (double)par6, (double)(0.5F - par9), (double)(0.5F + par7), (double)(par6 + par8), (double)(0.5F + par9)); + + if (par11) + { + Tessellator var14 = Tessellator.instance; + var14.startDrawingQuads(); + var14.setNormal(0.0F, -1.0F, 0.0F); + this.renderFaceYNeg(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 0, par12)); + var14.draw(); + var14.startDrawingQuads(); + var14.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 1, par12)); + var14.draw(); + var14.startDrawingQuads(); + var14.setNormal(0.0F, 0.0F, -1.0F); + this.renderFaceZNeg(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 2, par12)); + var14.draw(); + var14.startDrawingQuads(); + var14.setNormal(0.0F, 0.0F, 1.0F); + this.renderFaceZPos(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 3, par12)); + var14.draw(); + var14.startDrawingQuads(); + var14.setNormal(-1.0F, 0.0F, 0.0F); + this.renderFaceXNeg(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 4, par12)); + var14.draw(); + var14.startDrawingQuads(); + var14.setNormal(1.0F, 0.0F, 0.0F); + this.renderFaceXPos(par1BlockAnvil, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockAnvil, 5, par12)); + var14.draw(); + } + else + { + this.renderStandardBlock(par1BlockAnvil, par2, par3, par4); + } + + return par6 + par8; + } + + /** + * Renders a torch block at the given coordinates + */ + public boolean renderBlockTorch(Block par1Block, int par2, int par3, int par4) + { + int var5 = this.blockAccess.getBlockMetadata(par2, par3, par4); + Tessellator var6 = Tessellator.instance; + var6.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + var6.setColorOpaque_F(1.0F, 1.0F, 1.0F); + double var7 = 0.4000000059604645D; + double var9 = 0.5D - var7; + double var11 = 0.20000000298023224D; + + if (var5 == 1) + { + this.renderTorchAtAngle(par1Block, (double)par2 - var9, (double)par3 + var11, (double)par4, -var7, 0.0D, 0); + } + else if (var5 == 2) + { + this.renderTorchAtAngle(par1Block, (double)par2 + var9, (double)par3 + var11, (double)par4, var7, 0.0D, 0); + } + else if (var5 == 3) + { + this.renderTorchAtAngle(par1Block, (double)par2, (double)par3 + var11, (double)par4 - var9, 0.0D, -var7, 0); + } + else if (var5 == 4) + { + this.renderTorchAtAngle(par1Block, (double)par2, (double)par3 + var11, (double)par4 + var9, 0.0D, var7, 0); + } + else + { + this.renderTorchAtAngle(par1Block, (double)par2, (double)par3, (double)par4, 0.0D, 0.0D, 0); + } + + return true; + } + + /** + * render a redstone repeater at the given coordinates + */ + private boolean renderBlockRepeater(BlockRedstoneRepeater par1BlockRedstoneRepeater, int par2, int par3, int par4) + { + int var5 = this.blockAccess.getBlockMetadata(par2, par3, par4); + int var6 = var5 & 3; + int var7 = (var5 & 12) >> 2; + Tessellator var8 = Tessellator.instance; + var8.setBrightness(par1BlockRedstoneRepeater.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + var8.setColorOpaque_F(1.0F, 1.0F, 1.0F); + double var9 = -0.1875D; + boolean var11 = par1BlockRedstoneRepeater.func_94476_e(this.blockAccess, par2, par3, par4, var5); + double var12 = 0.0D; + double var14 = 0.0D; + double var16 = 0.0D; + double var18 = 0.0D; + + switch (var6) + { + case 0: + var18 = -0.3125D; + var14 = BlockRedstoneRepeater.repeaterTorchOffset[var7]; + break; + + case 1: + var16 = 0.3125D; + var12 = -BlockRedstoneRepeater.repeaterTorchOffset[var7]; + break; + + case 2: + var18 = 0.3125D; + var14 = -BlockRedstoneRepeater.repeaterTorchOffset[var7]; + break; + + case 3: + var16 = -0.3125D; + var12 = BlockRedstoneRepeater.repeaterTorchOffset[var7]; + } + + if (!var11) + { + this.renderTorchAtAngle(par1BlockRedstoneRepeater, (double)par2 + var12, (double)par3 + var9, (double)par4 + var14, 0.0D, 0.0D, 0); + } + else + { + Icon var20 = this.getBlockIcon(Block.bedrock); + this.setOverrideBlockTexture(var20); + float var21 = 2.0F; + float var22 = 14.0F; + float var23 = 7.0F; + float var24 = 9.0F; + + switch (var6) + { + case 1: + case 3: + var21 = 7.0F; + var22 = 9.0F; + var23 = 2.0F; + var24 = 14.0F; + + case 0: + case 2: + default: + this.setRenderBounds((double)(var21 / 16.0F + (float)var12), 0.125D, (double)(var23 / 16.0F + (float)var14), (double)(var22 / 16.0F + (float)var12), 0.25D, (double)(var24 / 16.0F + (float)var14)); + double var25 = (double)var20.getInterpolatedU((double)var21); + double var27 = (double)var20.getInterpolatedV((double)var23); + double var29 = (double)var20.getInterpolatedU((double)var22); + double var31 = (double)var20.getInterpolatedV((double)var24); + var8.addVertexWithUV((double)((float)par2 + var21 / 16.0F) + var12, (double)((float)par3 + 0.25F), (double)((float)par4 + var23 / 16.0F) + var14, var25, var27); + var8.addVertexWithUV((double)((float)par2 + var21 / 16.0F) + var12, (double)((float)par3 + 0.25F), (double)((float)par4 + var24 / 16.0F) + var14, var25, var31); + var8.addVertexWithUV((double)((float)par2 + var22 / 16.0F) + var12, (double)((float)par3 + 0.25F), (double)((float)par4 + var24 / 16.0F) + var14, var29, var31); + var8.addVertexWithUV((double)((float)par2 + var22 / 16.0F) + var12, (double)((float)par3 + 0.25F), (double)((float)par4 + var23 / 16.0F) + var14, var29, var27); + this.renderStandardBlock(par1BlockRedstoneRepeater, par2, par3, par4); + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.125D, 1.0D); + this.clearOverrideBlockTexture(); + } + } + + var8.setBrightness(par1BlockRedstoneRepeater.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + var8.setColorOpaque_F(1.0F, 1.0F, 1.0F); + this.renderTorchAtAngle(par1BlockRedstoneRepeater, (double)par2 + var16, (double)par3 + var9, (double)par4 + var18, 0.0D, 0.0D, 0); + this.renderBlockRedstoneLogic(par1BlockRedstoneRepeater, par2, par3, par4); + return true; + } + + private boolean renderBlockComparator(BlockComparator par1BlockComparator, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + var5.setBrightness(par1BlockComparator.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + var5.setColorOpaque_F(1.0F, 1.0F, 1.0F); + int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); + int var7 = var6 & 3; + double var8 = 0.0D; + double var10 = -0.1875D; + double var12 = 0.0D; + double var14 = 0.0D; + double var16 = 0.0D; + Icon var18; + + if (par1BlockComparator.func_94490_c(var6)) + { + var18 = Block.torchRedstoneActive.getBlockTextureFromSide(0); + } + else + { + var10 -= 0.1875D; + var18 = Block.torchRedstoneIdle.getBlockTextureFromSide(0); + } + + switch (var7) + { + case 0: + var12 = -0.3125D; + var16 = 1.0D; + break; + + case 1: + var8 = 0.3125D; + var14 = -1.0D; + break; + + case 2: + var12 = 0.3125D; + var16 = -1.0D; + break; + + case 3: + var8 = -0.3125D; + var14 = 1.0D; + } + + this.renderTorchAtAngle(par1BlockComparator, (double)par2 + 0.25D * var14 + 0.1875D * var16, (double)((float)par3 - 0.1875F), (double)par4 + 0.25D * var16 + 0.1875D * var14, 0.0D, 0.0D, var6); + this.renderTorchAtAngle(par1BlockComparator, (double)par2 + 0.25D * var14 + -0.1875D * var16, (double)((float)par3 - 0.1875F), (double)par4 + 0.25D * var16 + -0.1875D * var14, 0.0D, 0.0D, var6); + this.setOverrideBlockTexture(var18); + this.renderTorchAtAngle(par1BlockComparator, (double)par2 + var8, (double)par3 + var10, (double)par4 + var12, 0.0D, 0.0D, var6); + this.clearOverrideBlockTexture(); + this.renderBlockRedstoneLogicMetadata(par1BlockComparator, par2, par3, par4, var7); + return true; + } + + private boolean renderBlockRedstoneLogic(BlockRedstoneLogic par1BlockRedstoneLogic, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + this.renderBlockRedstoneLogicMetadata(par1BlockRedstoneLogic, par2, par3, par4, this.blockAccess.getBlockMetadata(par2, par3, par4) & 3); + return true; + } + + private void renderBlockRedstoneLogicMetadata(BlockRedstoneLogic par1BlockRedstoneLogic, int par2, int par3, int par4, int par5) + { + this.renderStandardBlock(par1BlockRedstoneLogic, par2, par3, par4); + Tessellator var6 = Tessellator.instance; + var6.setBrightness(par1BlockRedstoneLogic.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + var6.setColorOpaque_F(1.0F, 1.0F, 1.0F); + int var7 = this.blockAccess.getBlockMetadata(par2, par3, par4); + Icon var8 = this.getBlockIconFromSideAndMetadata(par1BlockRedstoneLogic, 1, var7); + double var9 = (double)var8.getMinU(); + double var11 = (double)var8.getMaxU(); + double var13 = (double)var8.getMinV(); + double var15 = (double)var8.getMaxV(); + double var17 = 0.125D; + double var19 = (double)(par2 + 1); + double var21 = (double)(par2 + 1); + double var23 = (double)(par2 + 0); + double var25 = (double)(par2 + 0); + double var27 = (double)(par4 + 0); + double var29 = (double)(par4 + 1); + double var31 = (double)(par4 + 1); + double var33 = (double)(par4 + 0); + double var35 = (double)par3 + var17; + + if (par5 == 2) + { + var19 = var21 = (double)(par2 + 0); + var23 = var25 = (double)(par2 + 1); + var27 = var33 = (double)(par4 + 1); + var29 = var31 = (double)(par4 + 0); + } + else if (par5 == 3) + { + var19 = var25 = (double)(par2 + 0); + var21 = var23 = (double)(par2 + 1); + var27 = var29 = (double)(par4 + 0); + var31 = var33 = (double)(par4 + 1); + } + else if (par5 == 1) + { + var19 = var25 = (double)(par2 + 1); + var21 = var23 = (double)(par2 + 0); + var27 = var29 = (double)(par4 + 1); + var31 = var33 = (double)(par4 + 0); + } + + var6.addVertexWithUV(var25, var35, var33, var9, var13); + var6.addVertexWithUV(var23, var35, var31, var9, var15); + var6.addVertexWithUV(var21, var35, var29, var11, var15); + var6.addVertexWithUV(var19, var35, var27, var11, var13); + } + + /** + * Render all faces of the piston base + */ + public void renderPistonBaseAllFaces(Block par1Block, int par2, int par3, int par4) + { + this.renderAllFaces = true; + this.renderPistonBase(par1Block, par2, par3, par4, true); + this.renderAllFaces = false; + } + + /** + * renders a block as a piston base + */ + private boolean renderPistonBase(Block par1Block, int par2, int par3, int par4, boolean par5) + { + int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); + boolean var7 = par5 || (var6 & 8) != 0; + int var8 = BlockPistonBase.getOrientation(var6); + float var9 = 0.25F; + + if (var7) + { + switch (var8) + { + case 0: + this.uvRotateEast = 3; + this.uvRotateWest = 3; + this.uvRotateSouth = 3; + this.uvRotateNorth = 3; + this.setRenderBounds(0.0D, 0.25D, 0.0D, 1.0D, 1.0D, 1.0D); + break; + + case 1: + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.75D, 1.0D); + break; + + case 2: + this.uvRotateSouth = 1; + this.uvRotateNorth = 2; + this.setRenderBounds(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D); + break; + + case 3: + this.uvRotateSouth = 2; + this.uvRotateNorth = 1; + this.uvRotateTop = 3; + this.uvRotateBottom = 3; + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D); + break; + + case 4: + this.uvRotateEast = 1; + this.uvRotateWest = 2; + this.uvRotateTop = 2; + this.uvRotateBottom = 1; + this.setRenderBounds(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + break; + + case 5: + this.uvRotateEast = 2; + this.uvRotateWest = 1; + this.uvRotateTop = 1; + this.uvRotateBottom = 2; + this.setRenderBounds(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D); + } + + ((BlockPistonBase)par1Block).func_96479_b((float)this.renderMinX, (float)this.renderMinY, (float)this.renderMinZ, (float)this.renderMaxX, (float)this.renderMaxY, (float)this.renderMaxZ); + this.renderStandardBlock(par1Block, par2, par3, par4); + this.uvRotateEast = 0; + this.uvRotateWest = 0; + this.uvRotateSouth = 0; + this.uvRotateNorth = 0; + this.uvRotateTop = 0; + this.uvRotateBottom = 0; + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + ((BlockPistonBase)par1Block).func_96479_b((float)this.renderMinX, (float)this.renderMinY, (float)this.renderMinZ, (float)this.renderMaxX, (float)this.renderMaxY, (float)this.renderMaxZ); + } + else + { + switch (var8) + { + case 0: + this.uvRotateEast = 3; + this.uvRotateWest = 3; + this.uvRotateSouth = 3; + this.uvRotateNorth = 3; + + case 1: + default: + break; + + case 2: + this.uvRotateSouth = 1; + this.uvRotateNorth = 2; + break; + + case 3: + this.uvRotateSouth = 2; + this.uvRotateNorth = 1; + this.uvRotateTop = 3; + this.uvRotateBottom = 3; + break; + + case 4: + this.uvRotateEast = 1; + this.uvRotateWest = 2; + this.uvRotateTop = 2; + this.uvRotateBottom = 1; + break; + + case 5: + this.uvRotateEast = 2; + this.uvRotateWest = 1; + this.uvRotateTop = 1; + this.uvRotateBottom = 2; + } + + this.renderStandardBlock(par1Block, par2, par3, par4); + this.uvRotateEast = 0; + this.uvRotateWest = 0; + this.uvRotateSouth = 0; + this.uvRotateNorth = 0; + this.uvRotateTop = 0; + this.uvRotateBottom = 0; + } + + return true; + } + + /** + * Render piston rod up/down + */ + private void renderPistonRodUD(double par1, double par3, double par5, double par7, double par9, double par11, float par13, double par14) + { + Icon var16 = BlockPistonBase.getPistonBaseIcon("piston_side"); + + if (this.hasOverrideBlockTexture()) + { + var16 = this.overrideBlockTexture; + } + + Tessellator var17 = Tessellator.instance; + double var18 = (double)var16.getMinU(); + double var20 = (double)var16.getMinV(); + double var22 = (double)var16.getInterpolatedU(par14); + double var24 = (double)var16.getInterpolatedV(4.0D); + var17.setColorOpaque_F(par13, par13, par13); + var17.addVertexWithUV(par1, par7, par9, var22, var20); + var17.addVertexWithUV(par1, par5, par9, var18, var20); + var17.addVertexWithUV(par3, par5, par11, var18, var24); + var17.addVertexWithUV(par3, par7, par11, var22, var24); + } + + /** + * Render piston rod south/north + */ + private void renderPistonRodSN(double par1, double par3, double par5, double par7, double par9, double par11, float par13, double par14) + { + Icon var16 = BlockPistonBase.getPistonBaseIcon("piston_side"); + + if (this.hasOverrideBlockTexture()) + { + var16 = this.overrideBlockTexture; + } + + Tessellator var17 = Tessellator.instance; + double var18 = (double)var16.getMinU(); + double var20 = (double)var16.getMinV(); + double var22 = (double)var16.getInterpolatedU(par14); + double var24 = (double)var16.getInterpolatedV(4.0D); + var17.setColorOpaque_F(par13, par13, par13); + var17.addVertexWithUV(par1, par5, par11, var22, var20); + var17.addVertexWithUV(par1, par5, par9, var18, var20); + var17.addVertexWithUV(par3, par7, par9, var18, var24); + var17.addVertexWithUV(par3, par7, par11, var22, var24); + } + + /** + * Render piston rod east/west + */ + private void renderPistonRodEW(double par1, double par3, double par5, double par7, double par9, double par11, float par13, double par14) + { + Icon var16 = BlockPistonBase.getPistonBaseIcon("piston_side"); + + if (this.hasOverrideBlockTexture()) + { + var16 = this.overrideBlockTexture; + } + + Tessellator var17 = Tessellator.instance; + double var18 = (double)var16.getMinU(); + double var20 = (double)var16.getMinV(); + double var22 = (double)var16.getInterpolatedU(par14); + double var24 = (double)var16.getInterpolatedV(4.0D); + var17.setColorOpaque_F(par13, par13, par13); + var17.addVertexWithUV(par3, par5, par9, var22, var20); + var17.addVertexWithUV(par1, par5, par9, var18, var20); + var17.addVertexWithUV(par1, par7, par11, var18, var24); + var17.addVertexWithUV(par3, par7, par11, var22, var24); + } + + /** + * Render all faces of the piston extension + */ + public void renderPistonExtensionAllFaces(Block par1Block, int par2, int par3, int par4, boolean par5) + { + this.renderAllFaces = true; + this.renderPistonExtension(par1Block, par2, par3, par4, par5); + this.renderAllFaces = false; + } + + /** + * renders the pushing part of a piston + */ + private boolean renderPistonExtension(Block par1Block, int par2, int par3, int par4, boolean par5) + { + int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); + int var7 = BlockPistonExtension.getDirectionMeta(var6); + float var8 = 0.25F; + float var9 = 0.375F; + float var10 = 0.625F; + float var11 = par1Block.getBlockBrightness(this.blockAccess, par2, par3, par4); + float var12 = par5 ? 1.0F : 0.5F; + double var13 = par5 ? 16.0D : 8.0D; + + switch (var7) + { + case 0: + this.uvRotateEast = 3; + this.uvRotateWest = 3; + this.uvRotateSouth = 3; + this.uvRotateNorth = 3; + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 0.25D, 1.0D); + this.renderStandardBlock(par1Block, par2, par3, par4); + this.renderPistonRodUD((double)((float)par2 + 0.375F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.25F), (double)((float)par3 + 0.25F + var12), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.625F), var11 * 0.8F, var13); + this.renderPistonRodUD((double)((float)par2 + 0.625F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.25F), (double)((float)par3 + 0.25F + var12), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.375F), var11 * 0.8F, var13); + this.renderPistonRodUD((double)((float)par2 + 0.375F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.25F), (double)((float)par3 + 0.25F + var12), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.625F), var11 * 0.6F, var13); + this.renderPistonRodUD((double)((float)par2 + 0.625F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.25F), (double)((float)par3 + 0.25F + var12), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.375F), var11 * 0.6F, var13); + break; + + case 1: + this.setRenderBounds(0.0D, 0.75D, 0.0D, 1.0D, 1.0D, 1.0D); + this.renderStandardBlock(par1Block, par2, par3, par4); + this.renderPistonRodUD((double)((float)par2 + 0.375F), (double)((float)par2 + 0.625F), (double)((float)par3 - 0.25F + 1.0F - var12), (double)((float)par3 - 0.25F + 1.0F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.625F), var11 * 0.8F, var13); + this.renderPistonRodUD((double)((float)par2 + 0.625F), (double)((float)par2 + 0.375F), (double)((float)par3 - 0.25F + 1.0F - var12), (double)((float)par3 - 0.25F + 1.0F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.375F), var11 * 0.8F, var13); + this.renderPistonRodUD((double)((float)par2 + 0.375F), (double)((float)par2 + 0.375F), (double)((float)par3 - 0.25F + 1.0F - var12), (double)((float)par3 - 0.25F + 1.0F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.625F), var11 * 0.6F, var13); + this.renderPistonRodUD((double)((float)par2 + 0.625F), (double)((float)par2 + 0.625F), (double)((float)par3 - 0.25F + 1.0F - var12), (double)((float)par3 - 0.25F + 1.0F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.375F), var11 * 0.6F, var13); + break; + + case 2: + this.uvRotateSouth = 1; + this.uvRotateNorth = 2; + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.25D); + this.renderStandardBlock(par1Block, par2, par3, par4); + this.renderPistonRodSN((double)((float)par2 + 0.375F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.25F), (double)((float)par4 + 0.25F + var12), var11 * 0.6F, var13); + this.renderPistonRodSN((double)((float)par2 + 0.625F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.25F), (double)((float)par4 + 0.25F + var12), var11 * 0.6F, var13); + this.renderPistonRodSN((double)((float)par2 + 0.375F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.25F), (double)((float)par4 + 0.25F + var12), var11 * 0.5F, var13); + this.renderPistonRodSN((double)((float)par2 + 0.625F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.25F), (double)((float)par4 + 0.25F + var12), var11, var13); + break; + + case 3: + this.uvRotateSouth = 2; + this.uvRotateNorth = 1; + this.uvRotateTop = 3; + this.uvRotateBottom = 3; + this.setRenderBounds(0.0D, 0.0D, 0.75D, 1.0D, 1.0D, 1.0D); + this.renderStandardBlock(par1Block, par2, par3, par4); + this.renderPistonRodSN((double)((float)par2 + 0.375F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par4 - 0.25F + 1.0F - var12), (double)((float)par4 - 0.25F + 1.0F), var11 * 0.6F, var13); + this.renderPistonRodSN((double)((float)par2 + 0.625F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par4 - 0.25F + 1.0F - var12), (double)((float)par4 - 0.25F + 1.0F), var11 * 0.6F, var13); + this.renderPistonRodSN((double)((float)par2 + 0.375F), (double)((float)par2 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.375F), (double)((float)par4 - 0.25F + 1.0F - var12), (double)((float)par4 - 0.25F + 1.0F), var11 * 0.5F, var13); + this.renderPistonRodSN((double)((float)par2 + 0.625F), (double)((float)par2 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.625F), (double)((float)par4 - 0.25F + 1.0F - var12), (double)((float)par4 - 0.25F + 1.0F), var11, var13); + break; + + case 4: + this.uvRotateEast = 1; + this.uvRotateWest = 2; + this.uvRotateTop = 2; + this.uvRotateBottom = 1; + this.setRenderBounds(0.0D, 0.0D, 0.0D, 0.25D, 1.0D, 1.0D); + this.renderStandardBlock(par1Block, par2, par3, par4); + this.renderPistonRodEW((double)((float)par2 + 0.25F), (double)((float)par2 + 0.25F + var12), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.375F), var11 * 0.5F, var13); + this.renderPistonRodEW((double)((float)par2 + 0.25F), (double)((float)par2 + 0.25F + var12), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.625F), var11, var13); + this.renderPistonRodEW((double)((float)par2 + 0.25F), (double)((float)par2 + 0.25F + var12), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.375F), var11 * 0.6F, var13); + this.renderPistonRodEW((double)((float)par2 + 0.25F), (double)((float)par2 + 0.25F + var12), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.625F), var11 * 0.6F, var13); + break; + + case 5: + this.uvRotateEast = 2; + this.uvRotateWest = 1; + this.uvRotateTop = 1; + this.uvRotateBottom = 2; + this.setRenderBounds(0.75D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + this.renderStandardBlock(par1Block, par2, par3, par4); + this.renderPistonRodEW((double)((float)par2 - 0.25F + 1.0F - var12), (double)((float)par2 - 0.25F + 1.0F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.375F), var11 * 0.5F, var13); + this.renderPistonRodEW((double)((float)par2 - 0.25F + 1.0F - var12), (double)((float)par2 - 0.25F + 1.0F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.625F), var11, var13); + this.renderPistonRodEW((double)((float)par2 - 0.25F + 1.0F - var12), (double)((float)par2 - 0.25F + 1.0F), (double)((float)par3 + 0.375F), (double)((float)par3 + 0.625F), (double)((float)par4 + 0.375F), (double)((float)par4 + 0.375F), var11 * 0.6F, var13); + this.renderPistonRodEW((double)((float)par2 - 0.25F + 1.0F - var12), (double)((float)par2 - 0.25F + 1.0F), (double)((float)par3 + 0.625F), (double)((float)par3 + 0.375F), (double)((float)par4 + 0.625F), (double)((float)par4 + 0.625F), var11 * 0.6F, var13); + } + + this.uvRotateEast = 0; + this.uvRotateWest = 0; + this.uvRotateSouth = 0; + this.uvRotateNorth = 0; + this.uvRotateTop = 0; + this.uvRotateBottom = 0; + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + return true; + } + + /** + * Renders a lever block at the given coordinates + */ + public boolean renderBlockLever(Block par1Block, int par2, int par3, int par4) + { + int var5 = this.blockAccess.getBlockMetadata(par2, par3, par4); + int var6 = var5 & 7; + boolean var7 = (var5 & 8) > 0; + Tessellator var8 = Tessellator.instance; + boolean var9 = this.hasOverrideBlockTexture(); + + if (!var9) + { + this.setOverrideBlockTexture(this.getBlockIcon(Block.cobblestone)); + } + + float var10 = 0.25F; + float var11 = 0.1875F; + float var12 = 0.1875F; + + if (var6 == 5) + { + this.setRenderBounds((double)(0.5F - var11), 0.0D, (double)(0.5F - var10), (double)(0.5F + var11), (double)var12, (double)(0.5F + var10)); + } + else if (var6 == 6) + { + this.setRenderBounds((double)(0.5F - var10), 0.0D, (double)(0.5F - var11), (double)(0.5F + var10), (double)var12, (double)(0.5F + var11)); + } + else if (var6 == 4) + { + this.setRenderBounds((double)(0.5F - var11), (double)(0.5F - var10), (double)(1.0F - var12), (double)(0.5F + var11), (double)(0.5F + var10), 1.0D); + } + else if (var6 == 3) + { + this.setRenderBounds((double)(0.5F - var11), (double)(0.5F - var10), 0.0D, (double)(0.5F + var11), (double)(0.5F + var10), (double)var12); + } + else if (var6 == 2) + { + this.setRenderBounds((double)(1.0F - var12), (double)(0.5F - var10), (double)(0.5F - var11), 1.0D, (double)(0.5F + var10), (double)(0.5F + var11)); + } + else if (var6 == 1) + { + this.setRenderBounds(0.0D, (double)(0.5F - var10), (double)(0.5F - var11), (double)var12, (double)(0.5F + var10), (double)(0.5F + var11)); + } + else if (var6 == 0) + { + this.setRenderBounds((double)(0.5F - var10), (double)(1.0F - var12), (double)(0.5F - var11), (double)(0.5F + var10), 1.0D, (double)(0.5F + var11)); + } + else if (var6 == 7) + { + this.setRenderBounds((double)(0.5F - var11), (double)(1.0F - var12), (double)(0.5F - var10), (double)(0.5F + var11), 1.0D, (double)(0.5F + var10)); + } + + this.renderStandardBlock(par1Block, par2, par3, par4); + + if (!var9) + { + this.clearOverrideBlockTexture(); + } + + var8.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var13 = 1.0F; + + if (Block.lightValue[par1Block.blockID] > 0) + { + var13 = 1.0F; + } + + var8.setColorOpaque_F(var13, var13, var13); + Icon var14 = this.getBlockIconFromSide(par1Block, 0); + + if (this.hasOverrideBlockTexture()) + { + var14 = this.overrideBlockTexture; + } + + double var15 = (double)var14.getMinU(); + double var17 = (double)var14.getMinV(); + double var19 = (double)var14.getMaxU(); + double var21 = (double)var14.getMaxV(); + Vec3[] var23 = new Vec3[8]; + float var24 = 0.0625F; + float var25 = 0.0625F; + float var26 = 0.625F; + var23[0] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var24), 0.0D, (double)(-var25)); + var23[1] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var24, 0.0D, (double)(-var25)); + var23[2] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var24, 0.0D, (double)var25); + var23[3] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var24), 0.0D, (double)var25); + var23[4] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var24), (double)var26, (double)(-var25)); + var23[5] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var24, (double)var26, (double)(-var25)); + var23[6] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var24, (double)var26, (double)var25); + var23[7] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var24), (double)var26, (double)var25); + + for (int var27 = 0; var27 < 8; ++var27) + { + if (var7) + { + var23[var27].zCoord -= 0.0625D; + var23[var27].rotateAroundX(((float)Math.PI * 2F / 9F)); + } + else + { + var23[var27].zCoord += 0.0625D; + var23[var27].rotateAroundX(-((float)Math.PI * 2F / 9F)); + } + + if (var6 == 0 || var6 == 7) + { + var23[var27].rotateAroundZ((float)Math.PI); + } + + if (var6 == 6 || var6 == 0) + { + var23[var27].rotateAroundY(((float)Math.PI / 2F)); + } + + if (var6 > 0 && var6 < 5) + { + var23[var27].yCoord -= 0.375D; + var23[var27].rotateAroundX(((float)Math.PI / 2F)); + + if (var6 == 4) + { + var23[var27].rotateAroundY(0.0F); + } + + if (var6 == 3) + { + var23[var27].rotateAroundY((float)Math.PI); + } + + if (var6 == 2) + { + var23[var27].rotateAroundY(((float)Math.PI / 2F)); + } + + if (var6 == 1) + { + var23[var27].rotateAroundY(-((float)Math.PI / 2F)); + } + + var23[var27].xCoord += (double)par2 + 0.5D; + var23[var27].yCoord += (double)((float)par3 + 0.5F); + var23[var27].zCoord += (double)par4 + 0.5D; + } + else if (var6 != 0 && var6 != 7) + { + var23[var27].xCoord += (double)par2 + 0.5D; + var23[var27].yCoord += (double)((float)par3 + 0.125F); + var23[var27].zCoord += (double)par4 + 0.5D; + } + else + { + var23[var27].xCoord += (double)par2 + 0.5D; + var23[var27].yCoord += (double)((float)par3 + 0.875F); + var23[var27].zCoord += (double)par4 + 0.5D; + } + } + + Vec3 var32 = null; + Vec3 var28 = null; + Vec3 var29 = null; + Vec3 var30 = null; + + for (int var31 = 0; var31 < 6; ++var31) + { + if (var31 == 0) + { + var15 = (double)var14.getInterpolatedU(7.0D); + var17 = (double)var14.getInterpolatedV(6.0D); + var19 = (double)var14.getInterpolatedU(9.0D); + var21 = (double)var14.getInterpolatedV(8.0D); + } + else if (var31 == 2) + { + var15 = (double)var14.getInterpolatedU(7.0D); + var17 = (double)var14.getInterpolatedV(6.0D); + var19 = (double)var14.getInterpolatedU(9.0D); + var21 = (double)var14.getMaxV(); + } + + if (var31 == 0) + { + var32 = var23[0]; + var28 = var23[1]; + var29 = var23[2]; + var30 = var23[3]; + } + else if (var31 == 1) + { + var32 = var23[7]; + var28 = var23[6]; + var29 = var23[5]; + var30 = var23[4]; + } + else if (var31 == 2) + { + var32 = var23[1]; + var28 = var23[0]; + var29 = var23[4]; + var30 = var23[5]; + } + else if (var31 == 3) + { + var32 = var23[2]; + var28 = var23[1]; + var29 = var23[5]; + var30 = var23[6]; + } + else if (var31 == 4) + { + var32 = var23[3]; + var28 = var23[2]; + var29 = var23[6]; + var30 = var23[7]; + } + else if (var31 == 5) + { + var32 = var23[0]; + var28 = var23[3]; + var29 = var23[7]; + var30 = var23[4]; + } + + var8.addVertexWithUV(var32.xCoord, var32.yCoord, var32.zCoord, var15, var21); + var8.addVertexWithUV(var28.xCoord, var28.yCoord, var28.zCoord, var19, var21); + var8.addVertexWithUV(var29.xCoord, var29.yCoord, var29.zCoord, var19, var17); + var8.addVertexWithUV(var30.xCoord, var30.yCoord, var30.zCoord, var15, var17); + } + + return true; + } + + /** + * Renders a trip wire source block at the given coordinates + */ + public boolean renderBlockTripWireSource(Block par1Block, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); + int var7 = var6 & 3; + boolean var8 = (var6 & 4) == 4; + boolean var9 = (var6 & 8) == 8; + boolean var10 = !this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4); + boolean var11 = this.hasOverrideBlockTexture(); + + if (!var11) + { + this.setOverrideBlockTexture(this.getBlockIcon(Block.planks)); + } + + float var12 = 0.25F; + float var13 = 0.125F; + float var14 = 0.125F; + float var15 = 0.3F - var12; + float var16 = 0.3F + var12; + + if (var7 == 2) + { + this.setRenderBounds((double)(0.5F - var13), (double)var15, (double)(1.0F - var14), (double)(0.5F + var13), (double)var16, 1.0D); + } + else if (var7 == 0) + { + this.setRenderBounds((double)(0.5F - var13), (double)var15, 0.0D, (double)(0.5F + var13), (double)var16, (double)var14); + } + else if (var7 == 1) + { + this.setRenderBounds((double)(1.0F - var14), (double)var15, (double)(0.5F - var13), 1.0D, (double)var16, (double)(0.5F + var13)); + } + else if (var7 == 3) + { + this.setRenderBounds(0.0D, (double)var15, (double)(0.5F - var13), (double)var14, (double)var16, (double)(0.5F + var13)); + } + + this.renderStandardBlock(par1Block, par2, par3, par4); + + if (!var11) + { + this.clearOverrideBlockTexture(); + } + + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var17 = 1.0F; + + if (Block.lightValue[par1Block.blockID] > 0) + { + var17 = 1.0F; + } + + var5.setColorOpaque_F(var17, var17, var17); + Icon var18 = this.getBlockIconFromSide(par1Block, 0); + + if (this.hasOverrideBlockTexture()) + { + var18 = this.overrideBlockTexture; + } + + double var19 = (double)var18.getMinU(); + double var21 = (double)var18.getMinV(); + double var23 = (double)var18.getMaxU(); + double var25 = (double)var18.getMaxV(); + Vec3[] var27 = new Vec3[8]; + float var28 = 0.046875F; + float var29 = 0.046875F; + float var30 = 0.3125F; + var27[0] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var28), 0.0D, (double)(-var29)); + var27[1] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var28, 0.0D, (double)(-var29)); + var27[2] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var28, 0.0D, (double)var29); + var27[3] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var28), 0.0D, (double)var29); + var27[4] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var28), (double)var30, (double)(-var29)); + var27[5] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var28, (double)var30, (double)(-var29)); + var27[6] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var28, (double)var30, (double)var29); + var27[7] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var28), (double)var30, (double)var29); + + for (int var31 = 0; var31 < 8; ++var31) + { + var27[var31].zCoord += 0.0625D; + + if (var9) + { + var27[var31].rotateAroundX(0.5235988F); + var27[var31].yCoord -= 0.4375D; + } + else if (var8) + { + var27[var31].rotateAroundX(0.08726647F); + var27[var31].yCoord -= 0.4375D; + } + else + { + var27[var31].rotateAroundX(-((float)Math.PI * 2F / 9F)); + var27[var31].yCoord -= 0.375D; + } + + var27[var31].rotateAroundX(((float)Math.PI / 2F)); + + if (var7 == 2) + { + var27[var31].rotateAroundY(0.0F); + } + + if (var7 == 0) + { + var27[var31].rotateAroundY((float)Math.PI); + } + + if (var7 == 1) + { + var27[var31].rotateAroundY(((float)Math.PI / 2F)); + } + + if (var7 == 3) + { + var27[var31].rotateAroundY(-((float)Math.PI / 2F)); + } + + var27[var31].xCoord += (double)par2 + 0.5D; + var27[var31].yCoord += (double)((float)par3 + 0.3125F); + var27[var31].zCoord += (double)par4 + 0.5D; + } + + Vec3 var62 = null; + Vec3 var32 = null; + Vec3 var33 = null; + Vec3 var34 = null; + byte var35 = 7; + byte var36 = 9; + byte var37 = 9; + byte var38 = 16; + + for (int var39 = 0; var39 < 6; ++var39) + { + if (var39 == 0) + { + var62 = var27[0]; + var32 = var27[1]; + var33 = var27[2]; + var34 = var27[3]; + var19 = (double)var18.getInterpolatedU((double)var35); + var21 = (double)var18.getInterpolatedV((double)var37); + var23 = (double)var18.getInterpolatedU((double)var36); + var25 = (double)var18.getInterpolatedV((double)(var37 + 2)); + } + else if (var39 == 1) + { + var62 = var27[7]; + var32 = var27[6]; + var33 = var27[5]; + var34 = var27[4]; + } + else if (var39 == 2) + { + var62 = var27[1]; + var32 = var27[0]; + var33 = var27[4]; + var34 = var27[5]; + var19 = (double)var18.getInterpolatedU((double)var35); + var21 = (double)var18.getInterpolatedV((double)var37); + var23 = (double)var18.getInterpolatedU((double)var36); + var25 = (double)var18.getInterpolatedV((double)var38); + } + else if (var39 == 3) + { + var62 = var27[2]; + var32 = var27[1]; + var33 = var27[5]; + var34 = var27[6]; + } + else if (var39 == 4) + { + var62 = var27[3]; + var32 = var27[2]; + var33 = var27[6]; + var34 = var27[7]; + } + else if (var39 == 5) + { + var62 = var27[0]; + var32 = var27[3]; + var33 = var27[7]; + var34 = var27[4]; + } + + var5.addVertexWithUV(var62.xCoord, var62.yCoord, var62.zCoord, var19, var25); + var5.addVertexWithUV(var32.xCoord, var32.yCoord, var32.zCoord, var23, var25); + var5.addVertexWithUV(var33.xCoord, var33.yCoord, var33.zCoord, var23, var21); + var5.addVertexWithUV(var34.xCoord, var34.yCoord, var34.zCoord, var19, var21); + } + + float var63 = 0.09375F; + float var40 = 0.09375F; + float var41 = 0.03125F; + var27[0] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var63), 0.0D, (double)(-var40)); + var27[1] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var63, 0.0D, (double)(-var40)); + var27[2] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var63, 0.0D, (double)var40); + var27[3] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var63), 0.0D, (double)var40); + var27[4] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var63), (double)var41, (double)(-var40)); + var27[5] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var63, (double)var41, (double)(-var40)); + var27[6] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)var63, (double)var41, (double)var40); + var27[7] = this.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-var63), (double)var41, (double)var40); + + for (int var42 = 0; var42 < 8; ++var42) + { + var27[var42].zCoord += 0.21875D; + + if (var9) + { + var27[var42].yCoord -= 0.09375D; + var27[var42].zCoord -= 0.1625D; + var27[var42].rotateAroundX(0.0F); + } + else if (var8) + { + var27[var42].yCoord += 0.015625D; + var27[var42].zCoord -= 0.171875D; + var27[var42].rotateAroundX(0.17453294F); + } + else + { + var27[var42].rotateAroundX(0.87266463F); + } + + if (var7 == 2) + { + var27[var42].rotateAroundY(0.0F); + } + + if (var7 == 0) + { + var27[var42].rotateAroundY((float)Math.PI); + } + + if (var7 == 1) + { + var27[var42].rotateAroundY(((float)Math.PI / 2F)); + } + + if (var7 == 3) + { + var27[var42].rotateAroundY(-((float)Math.PI / 2F)); + } + + var27[var42].xCoord += (double)par2 + 0.5D; + var27[var42].yCoord += (double)((float)par3 + 0.3125F); + var27[var42].zCoord += (double)par4 + 0.5D; + } + + byte var64 = 5; + byte var43 = 11; + byte var44 = 3; + byte var45 = 9; + + for (int var46 = 0; var46 < 6; ++var46) + { + if (var46 == 0) + { + var62 = var27[0]; + var32 = var27[1]; + var33 = var27[2]; + var34 = var27[3]; + var19 = (double)var18.getInterpolatedU((double)var64); + var21 = (double)var18.getInterpolatedV((double)var44); + var23 = (double)var18.getInterpolatedU((double)var43); + var25 = (double)var18.getInterpolatedV((double)var45); + } + else if (var46 == 1) + { + var62 = var27[7]; + var32 = var27[6]; + var33 = var27[5]; + var34 = var27[4]; + } + else if (var46 == 2) + { + var62 = var27[1]; + var32 = var27[0]; + var33 = var27[4]; + var34 = var27[5]; + var19 = (double)var18.getInterpolatedU((double)var64); + var21 = (double)var18.getInterpolatedV((double)var44); + var23 = (double)var18.getInterpolatedU((double)var43); + var25 = (double)var18.getInterpolatedV((double)(var44 + 2)); + } + else if (var46 == 3) + { + var62 = var27[2]; + var32 = var27[1]; + var33 = var27[5]; + var34 = var27[6]; + } + else if (var46 == 4) + { + var62 = var27[3]; + var32 = var27[2]; + var33 = var27[6]; + var34 = var27[7]; + } + else if (var46 == 5) + { + var62 = var27[0]; + var32 = var27[3]; + var33 = var27[7]; + var34 = var27[4]; + } + + var5.addVertexWithUV(var62.xCoord, var62.yCoord, var62.zCoord, var19, var25); + var5.addVertexWithUV(var32.xCoord, var32.yCoord, var32.zCoord, var23, var25); + var5.addVertexWithUV(var33.xCoord, var33.yCoord, var33.zCoord, var23, var21); + var5.addVertexWithUV(var34.xCoord, var34.yCoord, var34.zCoord, var19, var21); + } + + if (var8) + { + double var65 = var27[0].yCoord; + float var48 = 0.03125F; + float var49 = 0.5F - var48 / 2.0F; + float var50 = var49 + var48; + Icon var51 = this.getBlockIcon(Block.tripWire); + double var52 = (double)var18.getMinU(); + double var54 = (double)var18.getInterpolatedV(var8 ? 2.0D : 0.0D); + double var56 = (double)var18.getMaxU(); + double var58 = (double)var18.getInterpolatedV(var8 ? 4.0D : 2.0D); + double var60 = (double)(var10 ? 3.5F : 1.5F) / 16.0D; + var17 = par1Block.getBlockBrightness(this.blockAccess, par2, par3, par4) * 0.75F; + var5.setColorOpaque_F(var17, var17, var17); + + if (var7 == 2) + { + var5.addVertexWithUV((double)((float)par2 + var49), (double)par3 + var60, (double)par4 + 0.25D, var52, var54); + var5.addVertexWithUV((double)((float)par2 + var50), (double)par3 + var60, (double)par4 + 0.25D, var52, var58); + var5.addVertexWithUV((double)((float)par2 + var50), (double)par3 + var60, (double)par4, var56, var58); + var5.addVertexWithUV((double)((float)par2 + var49), (double)par3 + var60, (double)par4, var56, var54); + var5.addVertexWithUV((double)((float)par2 + var49), var65, (double)par4 + 0.5D, var52, var54); + var5.addVertexWithUV((double)((float)par2 + var50), var65, (double)par4 + 0.5D, var52, var58); + var5.addVertexWithUV((double)((float)par2 + var50), (double)par3 + var60, (double)par4 + 0.25D, var56, var58); + var5.addVertexWithUV((double)((float)par2 + var49), (double)par3 + var60, (double)par4 + 0.25D, var56, var54); + } + else if (var7 == 0) + { + var5.addVertexWithUV((double)((float)par2 + var49), (double)par3 + var60, (double)par4 + 0.75D, var52, var54); + var5.addVertexWithUV((double)((float)par2 + var50), (double)par3 + var60, (double)par4 + 0.75D, var52, var58); + var5.addVertexWithUV((double)((float)par2 + var50), var65, (double)par4 + 0.5D, var56, var58); + var5.addVertexWithUV((double)((float)par2 + var49), var65, (double)par4 + 0.5D, var56, var54); + var5.addVertexWithUV((double)((float)par2 + var49), (double)par3 + var60, (double)(par4 + 1), var52, var54); + var5.addVertexWithUV((double)((float)par2 + var50), (double)par3 + var60, (double)(par4 + 1), var52, var58); + var5.addVertexWithUV((double)((float)par2 + var50), (double)par3 + var60, (double)par4 + 0.75D, var56, var58); + var5.addVertexWithUV((double)((float)par2 + var49), (double)par3 + var60, (double)par4 + 0.75D, var56, var54); + } + else if (var7 == 1) + { + var5.addVertexWithUV((double)par2, (double)par3 + var60, (double)((float)par4 + var50), var52, var58); + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var60, (double)((float)par4 + var50), var56, var58); + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var60, (double)((float)par4 + var49), var56, var54); + var5.addVertexWithUV((double)par2, (double)par3 + var60, (double)((float)par4 + var49), var52, var54); + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var60, (double)((float)par4 + var50), var52, var58); + var5.addVertexWithUV((double)par2 + 0.5D, var65, (double)((float)par4 + var50), var56, var58); + var5.addVertexWithUV((double)par2 + 0.5D, var65, (double)((float)par4 + var49), var56, var54); + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var60, (double)((float)par4 + var49), var52, var54); + } + else + { + var5.addVertexWithUV((double)par2 + 0.5D, var65, (double)((float)par4 + var50), var52, var58); + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var60, (double)((float)par4 + var50), var56, var58); + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var60, (double)((float)par4 + var49), var56, var54); + var5.addVertexWithUV((double)par2 + 0.5D, var65, (double)((float)par4 + var49), var52, var54); + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var60, (double)((float)par4 + var50), var52, var58); + var5.addVertexWithUV((double)(par2 + 1), (double)par3 + var60, (double)((float)par4 + var50), var56, var58); + var5.addVertexWithUV((double)(par2 + 1), (double)par3 + var60, (double)((float)par4 + var49), var56, var54); + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var60, (double)((float)par4 + var49), var52, var54); + } + } + + return true; + } + + /** + * Renders a trip wire block at the given coordinates + */ + public boolean renderBlockTripWire(Block par1Block, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + Icon var6 = this.getBlockIconFromSide(par1Block, 0); + int var7 = this.blockAccess.getBlockMetadata(par2, par3, par4); + boolean var8 = (var7 & 4) == 4; + boolean var9 = (var7 & 2) == 2; + + if (this.hasOverrideBlockTexture()) + { + var6 = this.overrideBlockTexture; + } + + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var10 = par1Block.getBlockBrightness(this.blockAccess, par2, par3, par4) * 0.75F; + var5.setColorOpaque_F(var10, var10, var10); + double var11 = (double)var6.getMinU(); + double var13 = (double)var6.getInterpolatedV(var8 ? 2.0D : 0.0D); + double var15 = (double)var6.getMaxU(); + double var17 = (double)var6.getInterpolatedV(var8 ? 4.0D : 2.0D); + double var19 = (double)(var9 ? 3.5F : 1.5F) / 16.0D; + boolean var21 = BlockTripWire.func_72148_a(this.blockAccess, par2, par3, par4, var7, 1); + boolean var22 = BlockTripWire.func_72148_a(this.blockAccess, par2, par3, par4, var7, 3); + boolean var23 = BlockTripWire.func_72148_a(this.blockAccess, par2, par3, par4, var7, 2); + boolean var24 = BlockTripWire.func_72148_a(this.blockAccess, par2, par3, par4, var7, 0); + float var25 = 0.03125F; + float var26 = 0.5F - var25 / 2.0F; + float var27 = var26 + var25; + + if (!var23 && !var22 && !var24 && !var21) + { + var23 = true; + var24 = true; + } + + if (var23) + { + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.25D, var11, var13); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.25D, var11, var17); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4, var15, var17); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4, var15, var13); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4, var15, var13); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4, var15, var17); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.25D, var11, var17); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.25D, var11, var13); + } + + if (var23 || var24 && !var22 && !var21) + { + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.5D, var11, var13); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.5D, var11, var17); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.25D, var15, var17); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.25D, var15, var13); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.25D, var15, var13); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.25D, var15, var17); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.5D, var11, var17); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.5D, var11, var13); + } + + if (var24 || var23 && !var22 && !var21) + { + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.75D, var11, var13); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.75D, var11, var17); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.5D, var15, var17); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.5D, var15, var13); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.5D, var15, var13); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.5D, var15, var17); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.75D, var11, var17); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.75D, var11, var13); + } + + if (var24) + { + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)(par4 + 1), var11, var13); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)(par4 + 1), var11, var17); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.75D, var15, var17); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.75D, var15, var13); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)par4 + 0.75D, var15, var13); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)par4 + 0.75D, var15, var17); + var5.addVertexWithUV((double)((float)par2 + var27), (double)par3 + var19, (double)(par4 + 1), var11, var17); + var5.addVertexWithUV((double)((float)par2 + var26), (double)par3 + var19, (double)(par4 + 1), var11, var13); + } + + if (var21) + { + var5.addVertexWithUV((double)par2, (double)par3 + var19, (double)((float)par4 + var27), var11, var17); + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var19, (double)((float)par4 + var27), var15, var17); + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var19, (double)((float)par4 + var26), var15, var13); + var5.addVertexWithUV((double)par2, (double)par3 + var19, (double)((float)par4 + var26), var11, var13); + var5.addVertexWithUV((double)par2, (double)par3 + var19, (double)((float)par4 + var26), var11, var13); + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var19, (double)((float)par4 + var26), var15, var13); + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var19, (double)((float)par4 + var27), var15, var17); + var5.addVertexWithUV((double)par2, (double)par3 + var19, (double)((float)par4 + var27), var11, var17); + } + + if (var21 || var22 && !var23 && !var24) + { + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var19, (double)((float)par4 + var27), var11, var17); + var5.addVertexWithUV((double)par2 + 0.5D, (double)par3 + var19, (double)((float)par4 + var27), var15, var17); + var5.addVertexWithUV((double)par2 + 0.5D, (double)par3 + var19, (double)((float)par4 + var26), var15, var13); + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var19, (double)((float)par4 + var26), var11, var13); + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var19, (double)((float)par4 + var26), var11, var13); + var5.addVertexWithUV((double)par2 + 0.5D, (double)par3 + var19, (double)((float)par4 + var26), var15, var13); + var5.addVertexWithUV((double)par2 + 0.5D, (double)par3 + var19, (double)((float)par4 + var27), var15, var17); + var5.addVertexWithUV((double)par2 + 0.25D, (double)par3 + var19, (double)((float)par4 + var27), var11, var17); + } + + if (var22 || var21 && !var23 && !var24) + { + var5.addVertexWithUV((double)par2 + 0.5D, (double)par3 + var19, (double)((float)par4 + var27), var11, var17); + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var19, (double)((float)par4 + var27), var15, var17); + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var19, (double)((float)par4 + var26), var15, var13); + var5.addVertexWithUV((double)par2 + 0.5D, (double)par3 + var19, (double)((float)par4 + var26), var11, var13); + var5.addVertexWithUV((double)par2 + 0.5D, (double)par3 + var19, (double)((float)par4 + var26), var11, var13); + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var19, (double)((float)par4 + var26), var15, var13); + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var19, (double)((float)par4 + var27), var15, var17); + var5.addVertexWithUV((double)par2 + 0.5D, (double)par3 + var19, (double)((float)par4 + var27), var11, var17); + } + + if (var22) + { + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var19, (double)((float)par4 + var27), var11, var17); + var5.addVertexWithUV((double)(par2 + 1), (double)par3 + var19, (double)((float)par4 + var27), var15, var17); + var5.addVertexWithUV((double)(par2 + 1), (double)par3 + var19, (double)((float)par4 + var26), var15, var13); + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var19, (double)((float)par4 + var26), var11, var13); + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var19, (double)((float)par4 + var26), var11, var13); + var5.addVertexWithUV((double)(par2 + 1), (double)par3 + var19, (double)((float)par4 + var26), var15, var13); + var5.addVertexWithUV((double)(par2 + 1), (double)par3 + var19, (double)((float)par4 + var27), var15, var17); + var5.addVertexWithUV((double)par2 + 0.75D, (double)par3 + var19, (double)((float)par4 + var27), var11, var17); + } + + return true; + } + + /** + * Renders a fire block at the given coordinates + */ + public boolean renderBlockFire(BlockFire par1BlockFire, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + Icon var6 = par1BlockFire.getFireIcon(0); + Icon var7 = par1BlockFire.getFireIcon(1); + Icon var8 = var6; + + if (this.hasOverrideBlockTexture()) + { + var8 = this.overrideBlockTexture; + } + + var5.setColorOpaque_F(1.0F, 1.0F, 1.0F); + var5.setBrightness(par1BlockFire.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + double var9 = (double)var8.getMinU(); + double var11 = (double)var8.getMinV(); + double var13 = (double)var8.getMaxU(); + double var15 = (double)var8.getMaxV(); + float var17 = 1.4F; + double var20; + double var22; + double var24; + double var26; + double var28; + double var30; + double var32; + + if (!this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4)) + { + float var36 = 0.2F; + float var19 = 0.0625F; + + if ((par2 + par3 + par4 & 1) == 1) + { + var9 = (double)var7.getMinU(); + var11 = (double)var7.getMinV(); + var13 = (double)var7.getMaxU(); + var15 = (double)var7.getMaxV(); + } + + if ((par2 / 2 + par3 / 2 + par4 / 2 & 1) == 1) + { + var20 = var13; + var13 = var9; + var9 = var20; + } + + if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4)) + { + var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var19), (double)(par4 + 1), var13, var11); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 1), var13, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var9, var15); + var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var19), (double)(par4 + 0), var9, var11); + var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var19), (double)(par4 + 0), var9, var11); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var9, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 1), var13, var15); + var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var19), (double)(par4 + 1), var13, var11); + } + + if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4)) + { + var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var19), (double)(par4 + 0), var9, var11); + var5.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var9, var15); + var5.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 1), var13, var15); + var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var19), (double)(par4 + 1), var13, var11); + var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var19), (double)(par4 + 1), var13, var11); + var5.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 1), var13, var15); + var5.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var9, var15); + var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var19), (double)(par4 + 0), var9, var11); + } + + if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1)) + { + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var19), (double)((float)par4 + var36), var13, var11); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var13, var15); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var9, var15); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var19), (double)((float)par4 + var36), var9, var11); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var19), (double)((float)par4 + var36), var9, var11); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var9, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var13, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var19), (double)((float)par4 + var36), var13, var11); + } + + if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1)) + { + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var19), (double)((float)(par4 + 1) - var36), var9, var11); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + var19), (double)(par4 + 1 - 0), var9, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 1 - 0), var13, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var19), (double)((float)(par4 + 1) - var36), var13, var11); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var19), (double)((float)(par4 + 1) - var36), var13, var11); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 1 - 0), var13, var15); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + var19), (double)(par4 + 1 - 0), var9, var15); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var19), (double)((float)(par4 + 1) - var36), var9, var11); + } + + if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4)) + { + var20 = (double)par2 + 0.5D + 0.5D; + var22 = (double)par2 + 0.5D - 0.5D; + var24 = (double)par4 + 0.5D + 0.5D; + var26 = (double)par4 + 0.5D - 0.5D; + var28 = (double)par2 + 0.5D - 0.5D; + var30 = (double)par2 + 0.5D + 0.5D; + var32 = (double)par4 + 0.5D - 0.5D; + double var34 = (double)par4 + 0.5D + 0.5D; + var9 = (double)var6.getMinU(); + var11 = (double)var6.getMinV(); + var13 = (double)var6.getMaxU(); + var15 = (double)var6.getMaxV(); + ++par3; + var17 = -0.2F; + + if ((par2 + par3 + par4 & 1) == 0) + { + var5.addVertexWithUV(var28, (double)((float)par3 + var17), (double)(par4 + 0), var13, var11); + var5.addVertexWithUV(var20, (double)(par3 + 0), (double)(par4 + 0), var13, var15); + var5.addVertexWithUV(var20, (double)(par3 + 0), (double)(par4 + 1), var9, var15); + var5.addVertexWithUV(var28, (double)((float)par3 + var17), (double)(par4 + 1), var9, var11); + var9 = (double)var7.getMinU(); + var11 = (double)var7.getMinV(); + var13 = (double)var7.getMaxU(); + var15 = (double)var7.getMaxV(); + var5.addVertexWithUV(var30, (double)((float)par3 + var17), (double)(par4 + 1), var13, var11); + var5.addVertexWithUV(var22, (double)(par3 + 0), (double)(par4 + 1), var13, var15); + var5.addVertexWithUV(var22, (double)(par3 + 0), (double)(par4 + 0), var9, var15); + var5.addVertexWithUV(var30, (double)((float)par3 + var17), (double)(par4 + 0), var9, var11); + } + else + { + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17), var34, var13, var11); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), var26, var13, var15); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), var26, var9, var15); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17), var34, var9, var11); + var9 = (double)var7.getMinU(); + var11 = (double)var7.getMinV(); + var13 = (double)var7.getMaxU(); + var15 = (double)var7.getMaxV(); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17), var32, var13, var11); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), var24, var13, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), var24, var9, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17), var32, var9, var11); + } + } + } + else + { + double var18 = (double)par2 + 0.5D + 0.2D; + var20 = (double)par2 + 0.5D - 0.2D; + var22 = (double)par4 + 0.5D + 0.2D; + var24 = (double)par4 + 0.5D - 0.2D; + var26 = (double)par2 + 0.5D - 0.3D; + var28 = (double)par2 + 0.5D + 0.3D; + var30 = (double)par4 + 0.5D - 0.3D; + var32 = (double)par4 + 0.5D + 0.3D; + var5.addVertexWithUV(var26, (double)((float)par3 + var17), (double)(par4 + 1), var13, var11); + var5.addVertexWithUV(var18, (double)(par3 + 0), (double)(par4 + 1), var13, var15); + var5.addVertexWithUV(var18, (double)(par3 + 0), (double)(par4 + 0), var9, var15); + var5.addVertexWithUV(var26, (double)((float)par3 + var17), (double)(par4 + 0), var9, var11); + var5.addVertexWithUV(var28, (double)((float)par3 + var17), (double)(par4 + 0), var13, var11); + var5.addVertexWithUV(var20, (double)(par3 + 0), (double)(par4 + 0), var13, var15); + var5.addVertexWithUV(var20, (double)(par3 + 0), (double)(par4 + 1), var9, var15); + var5.addVertexWithUV(var28, (double)((float)par3 + var17), (double)(par4 + 1), var9, var11); + var9 = (double)var7.getMinU(); + var11 = (double)var7.getMinV(); + var13 = (double)var7.getMaxU(); + var15 = (double)var7.getMaxV(); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17), var32, var13, var11); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), var24, var13, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), var24, var9, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17), var32, var9, var11); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17), var30, var13, var11); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), var22, var13, var15); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), var22, var9, var15); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17), var30, var9, var11); + var18 = (double)par2 + 0.5D - 0.5D; + var20 = (double)par2 + 0.5D + 0.5D; + var22 = (double)par4 + 0.5D - 0.5D; + var24 = (double)par4 + 0.5D + 0.5D; + var26 = (double)par2 + 0.5D - 0.4D; + var28 = (double)par2 + 0.5D + 0.4D; + var30 = (double)par4 + 0.5D - 0.4D; + var32 = (double)par4 + 0.5D + 0.4D; + var5.addVertexWithUV(var26, (double)((float)par3 + var17), (double)(par4 + 0), var9, var11); + var5.addVertexWithUV(var18, (double)(par3 + 0), (double)(par4 + 0), var9, var15); + var5.addVertexWithUV(var18, (double)(par3 + 0), (double)(par4 + 1), var13, var15); + var5.addVertexWithUV(var26, (double)((float)par3 + var17), (double)(par4 + 1), var13, var11); + var5.addVertexWithUV(var28, (double)((float)par3 + var17), (double)(par4 + 1), var9, var11); + var5.addVertexWithUV(var20, (double)(par3 + 0), (double)(par4 + 1), var9, var15); + var5.addVertexWithUV(var20, (double)(par3 + 0), (double)(par4 + 0), var13, var15); + var5.addVertexWithUV(var28, (double)((float)par3 + var17), (double)(par4 + 0), var13, var11); + var9 = (double)var6.getMinU(); + var11 = (double)var6.getMinV(); + var13 = (double)var6.getMaxU(); + var15 = (double)var6.getMaxV(); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17), var32, var9, var11); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), var24, var9, var15); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), var24, var13, var15); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17), var32, var13, var11); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17), var30, var9, var11); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), var22, var9, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), var22, var13, var15); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17), var30, var13, var11); + } + + return true; + } + + /** + * Renders a redstone wire block at the given coordinates + */ + public boolean renderBlockRedstoneWire(Block par1Block, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); + Icon var7 = BlockRedstoneWire.getRedstoneWireIcon("cross"); + Icon var8 = BlockRedstoneWire.getRedstoneWireIcon("line"); + Icon var9 = BlockRedstoneWire.getRedstoneWireIcon("cross_overlay"); + Icon var10 = BlockRedstoneWire.getRedstoneWireIcon("line_overlay"); + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var11 = 1.0F; + float var12 = (float)var6 / 15.0F; + float var13 = var12 * 0.6F + 0.4F; + + if (var6 == 0) + { + var13 = 0.3F; + } + + float var14 = var12 * var12 * 0.7F - 0.5F; + float var15 = var12 * var12 * 0.6F - 0.7F; + + if (var14 < 0.0F) + { + var14 = 0.0F; + } + + if (var15 < 0.0F) + { + var15 = 0.0F; + } + + var5.setColorOpaque_F(var13, var14, var15); + double var16 = 0.015625D; + double var18 = 0.015625D; + boolean var20 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 - 1, par3, par4, 1) || !this.blockAccess.isBlockNormalCube(par2 - 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 - 1, par3 - 1, par4, -1); + boolean var21 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 + 1, par3, par4, 3) || !this.blockAccess.isBlockNormalCube(par2 + 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 + 1, par3 - 1, par4, -1); + boolean var22 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3, par4 - 1, 2) || !this.blockAccess.isBlockNormalCube(par2, par3, par4 - 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 - 1, par4 - 1, -1); + boolean var23 = BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3, par4 + 1, 0) || !this.blockAccess.isBlockNormalCube(par2, par3, par4 + 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 - 1, par4 + 1, -1); + + if (!this.blockAccess.isBlockNormalCube(par2, par3 + 1, par4)) + { + if (this.blockAccess.isBlockNormalCube(par2 - 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 - 1, par3 + 1, par4, -1)) + { + var20 = true; + } + + if (this.blockAccess.isBlockNormalCube(par2 + 1, par3, par4) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2 + 1, par3 + 1, par4, -1)) + { + var21 = true; + } + + if (this.blockAccess.isBlockNormalCube(par2, par3, par4 - 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 + 1, par4 - 1, -1)) + { + var22 = true; + } + + if (this.blockAccess.isBlockNormalCube(par2, par3, par4 + 1) && BlockRedstoneWire.isPowerProviderOrWire(this.blockAccess, par2, par3 + 1, par4 + 1, -1)) + { + var23 = true; + } + } + + float var24 = (float)(par2 + 0); + float var25 = (float)(par2 + 1); + float var26 = (float)(par4 + 0); + float var27 = (float)(par4 + 1); + int var28 = 0; + + if ((var20 || var21) && !var22 && !var23) + { + var28 = 1; + } + + if ((var22 || var23) && !var21 && !var20) + { + var28 = 2; + } + + if (var28 == 0) + { + int var29 = 0; + int var30 = 0; + int var31 = 16; + int var32 = 16; + boolean var33 = true; + + if (!var20) + { + var24 += 0.3125F; + } + + if (!var20) + { + var29 += 5; + } + + if (!var21) + { + var25 -= 0.3125F; + } + + if (!var21) + { + var31 -= 5; + } + + if (!var22) + { + var26 += 0.3125F; + } + + if (!var22) + { + var30 += 5; + } + + if (!var23) + { + var27 -= 0.3125F; + } + + if (!var23) + { + var32 -= 5; + } + + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var27, (double)var7.getInterpolatedU((double)var31), (double)var7.getInterpolatedV((double)var32)); + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var26, (double)var7.getInterpolatedU((double)var31), (double)var7.getInterpolatedV((double)var30)); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var26, (double)var7.getInterpolatedU((double)var29), (double)var7.getInterpolatedV((double)var30)); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var27, (double)var7.getInterpolatedU((double)var29), (double)var7.getInterpolatedV((double)var32)); + var5.setColorOpaque_F(var11, var11, var11); + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var27, (double)var9.getInterpolatedU((double)var31), (double)var9.getInterpolatedV((double)var32)); + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var26, (double)var9.getInterpolatedU((double)var31), (double)var9.getInterpolatedV((double)var30)); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var26, (double)var9.getInterpolatedU((double)var29), (double)var9.getInterpolatedV((double)var30)); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var27, (double)var9.getInterpolatedU((double)var29), (double)var9.getInterpolatedV((double)var32)); + } + else if (var28 == 1) + { + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var27, (double)var8.getMaxU(), (double)var8.getMaxV()); + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var26, (double)var8.getMaxU(), (double)var8.getMinV()); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var26, (double)var8.getMinU(), (double)var8.getMinV()); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var27, (double)var8.getMinU(), (double)var8.getMaxV()); + var5.setColorOpaque_F(var11, var11, var11); + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var27, (double)var10.getMaxU(), (double)var10.getMaxV()); + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var26, (double)var10.getMaxU(), (double)var10.getMinV()); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var26, (double)var10.getMinU(), (double)var10.getMinV()); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var27, (double)var10.getMinU(), (double)var10.getMaxV()); + } + else + { + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var27, (double)var8.getMaxU(), (double)var8.getMaxV()); + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var26, (double)var8.getMinU(), (double)var8.getMaxV()); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var26, (double)var8.getMinU(), (double)var8.getMinV()); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var27, (double)var8.getMaxU(), (double)var8.getMinV()); + var5.setColorOpaque_F(var11, var11, var11); + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var27, (double)var10.getMaxU(), (double)var10.getMaxV()); + var5.addVertexWithUV((double)var25, (double)par3 + 0.015625D, (double)var26, (double)var10.getMinU(), (double)var10.getMaxV()); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var26, (double)var10.getMinU(), (double)var10.getMinV()); + var5.addVertexWithUV((double)var24, (double)par3 + 0.015625D, (double)var27, (double)var10.getMaxU(), (double)var10.getMinV()); + } + + if (!this.blockAccess.isBlockNormalCube(par2, par3 + 1, par4)) + { + float var34 = 0.021875F; + + if (this.blockAccess.isBlockNormalCube(par2 - 1, par3, par4) && this.blockAccess.getBlockId(par2 - 1, par3 + 1, par4) == Block.redstoneWire.blockID) + { + var5.setColorOpaque_F(var11 * var13, var11 * var14, var11 * var15); + var5.addVertexWithUV((double)par2 + 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1), (double)var8.getMaxU(), (double)var8.getMinV()); + var5.addVertexWithUV((double)par2 + 0.015625D, (double)(par3 + 0), (double)(par4 + 1), (double)var8.getMinU(), (double)var8.getMinV()); + var5.addVertexWithUV((double)par2 + 0.015625D, (double)(par3 + 0), (double)(par4 + 0), (double)var8.getMinU(), (double)var8.getMaxV()); + var5.addVertexWithUV((double)par2 + 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 0), (double)var8.getMaxU(), (double)var8.getMaxV()); + var5.setColorOpaque_F(var11, var11, var11); + var5.addVertexWithUV((double)par2 + 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1), (double)var10.getMaxU(), (double)var10.getMinV()); + var5.addVertexWithUV((double)par2 + 0.015625D, (double)(par3 + 0), (double)(par4 + 1), (double)var10.getMinU(), (double)var10.getMinV()); + var5.addVertexWithUV((double)par2 + 0.015625D, (double)(par3 + 0), (double)(par4 + 0), (double)var10.getMinU(), (double)var10.getMaxV()); + var5.addVertexWithUV((double)par2 + 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 0), (double)var10.getMaxU(), (double)var10.getMaxV()); + } + + if (this.blockAccess.isBlockNormalCube(par2 + 1, par3, par4) && this.blockAccess.getBlockId(par2 + 1, par3 + 1, par4) == Block.redstoneWire.blockID) + { + var5.setColorOpaque_F(var11 * var13, var11 * var14, var11 * var15); + var5.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)(par3 + 0), (double)(par4 + 1), (double)var8.getMinU(), (double)var8.getMaxV()); + var5.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1), (double)var8.getMaxU(), (double)var8.getMaxV()); + var5.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 0), (double)var8.getMaxU(), (double)var8.getMinV()); + var5.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)(par3 + 0), (double)(par4 + 0), (double)var8.getMinU(), (double)var8.getMinV()); + var5.setColorOpaque_F(var11, var11, var11); + var5.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)(par3 + 0), (double)(par4 + 1), (double)var10.getMinU(), (double)var10.getMaxV()); + var5.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1), (double)var10.getMaxU(), (double)var10.getMaxV()); + var5.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 0), (double)var10.getMaxU(), (double)var10.getMinV()); + var5.addVertexWithUV((double)(par2 + 1) - 0.015625D, (double)(par3 + 0), (double)(par4 + 0), (double)var10.getMinU(), (double)var10.getMinV()); + } + + if (this.blockAccess.isBlockNormalCube(par2, par3, par4 - 1) && this.blockAccess.getBlockId(par2, par3 + 1, par4 - 1) == Block.redstoneWire.blockID) + { + var5.setColorOpaque_F(var11 * var13, var11 * var14, var11 * var15); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)par4 + 0.015625D, (double)var8.getMinU(), (double)var8.getMaxV()); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 1) + 0.021875F), (double)par4 + 0.015625D, (double)var8.getMaxU(), (double)var8.getMaxV()); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 1) + 0.021875F), (double)par4 + 0.015625D, (double)var8.getMaxU(), (double)var8.getMinV()); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)par4 + 0.015625D, (double)var8.getMinU(), (double)var8.getMinV()); + var5.setColorOpaque_F(var11, var11, var11); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)par4 + 0.015625D, (double)var10.getMinU(), (double)var10.getMaxV()); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 1) + 0.021875F), (double)par4 + 0.015625D, (double)var10.getMaxU(), (double)var10.getMaxV()); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 1) + 0.021875F), (double)par4 + 0.015625D, (double)var10.getMaxU(), (double)var10.getMinV()); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)par4 + 0.015625D, (double)var10.getMinU(), (double)var10.getMinV()); + } + + if (this.blockAccess.isBlockNormalCube(par2, par3, par4 + 1) && this.blockAccess.getBlockId(par2, par3 + 1, par4 + 1) == Block.redstoneWire.blockID) + { + var5.setColorOpaque_F(var11 * var13, var11 * var14, var11 * var15); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1) - 0.015625D, (double)var8.getMaxU(), (double)var8.getMinV()); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)(par4 + 1) - 0.015625D, (double)var8.getMinU(), (double)var8.getMinV()); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)(par4 + 1) - 0.015625D, (double)var8.getMinU(), (double)var8.getMaxV()); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1) - 0.015625D, (double)var8.getMaxU(), (double)var8.getMaxV()); + var5.setColorOpaque_F(var11, var11, var11); + var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1) - 0.015625D, (double)var10.getMaxU(), (double)var10.getMinV()); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)(par4 + 1) - 0.015625D, (double)var10.getMinU(), (double)var10.getMinV()); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)(par4 + 1) - 0.015625D, (double)var10.getMinU(), (double)var10.getMaxV()); + var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 1) + 0.021875F), (double)(par4 + 1) - 0.015625D, (double)var10.getMaxU(), (double)var10.getMaxV()); + } + } + + return true; + } + + /** + * Renders a minecart track block at the given coordinates + */ + public boolean renderBlockMinecartTrack(BlockRailBase par1BlockRailBase, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); + Icon var7 = this.getBlockIconFromSideAndMetadata(par1BlockRailBase, 0, var6); + + if (this.hasOverrideBlockTexture()) + { + var7 = this.overrideBlockTexture; + } + + if (par1BlockRailBase.isPowered()) + { + var6 &= 7; + } + + var5.setBrightness(par1BlockRailBase.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + var5.setColorOpaque_F(1.0F, 1.0F, 1.0F); + double var8 = (double)var7.getMinU(); + double var10 = (double)var7.getMinV(); + double var12 = (double)var7.getMaxU(); + double var14 = (double)var7.getMaxV(); + double var16 = 0.0625D; + double var18 = (double)(par2 + 1); + double var20 = (double)(par2 + 1); + double var22 = (double)(par2 + 0); + double var24 = (double)(par2 + 0); + double var26 = (double)(par4 + 0); + double var28 = (double)(par4 + 1); + double var30 = (double)(par4 + 1); + double var32 = (double)(par4 + 0); + double var34 = (double)par3 + var16; + double var36 = (double)par3 + var16; + double var38 = (double)par3 + var16; + double var40 = (double)par3 + var16; + + if (var6 != 1 && var6 != 2 && var6 != 3 && var6 != 7) + { + if (var6 == 8) + { + var18 = var20 = (double)(par2 + 0); + var22 = var24 = (double)(par2 + 1); + var26 = var32 = (double)(par4 + 1); + var28 = var30 = (double)(par4 + 0); + } + else if (var6 == 9) + { + var18 = var24 = (double)(par2 + 0); + var20 = var22 = (double)(par2 + 1); + var26 = var28 = (double)(par4 + 0); + var30 = var32 = (double)(par4 + 1); + } + } + else + { + var18 = var24 = (double)(par2 + 1); + var20 = var22 = (double)(par2 + 0); + var26 = var28 = (double)(par4 + 1); + var30 = var32 = (double)(par4 + 0); + } + + if (var6 != 2 && var6 != 4) + { + if (var6 == 3 || var6 == 5) + { + ++var36; + ++var38; + } + } + else + { + ++var34; + ++var40; + } + + var5.addVertexWithUV(var18, var34, var26, var12, var10); + var5.addVertexWithUV(var20, var36, var28, var12, var14); + var5.addVertexWithUV(var22, var38, var30, var8, var14); + var5.addVertexWithUV(var24, var40, var32, var8, var10); + var5.addVertexWithUV(var24, var40, var32, var8, var10); + var5.addVertexWithUV(var22, var38, var30, var8, var14); + var5.addVertexWithUV(var20, var36, var28, var12, var14); + var5.addVertexWithUV(var18, var34, var26, var12, var10); + return true; + } + + /** + * Renders a ladder block at the given coordinates + */ + public boolean renderBlockLadder(Block par1Block, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + Icon var6 = this.getBlockIconFromSide(par1Block, 0); + + if (this.hasOverrideBlockTexture()) + { + var6 = this.overrideBlockTexture; + } + + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var7 = 1.0F; + var5.setColorOpaque_F(var7, var7, var7); + double var20 = (double)var6.getMinU(); + double var9 = (double)var6.getMinV(); + double var11 = (double)var6.getMaxU(); + double var13 = (double)var6.getMaxV(); + int var15 = this.blockAccess.getBlockMetadata(par2, par3, par4); + double var16 = 0.0D; + double var18 = 0.05000000074505806D; + + if (var15 == 5) + { + var5.addVertexWithUV((double)par2 + var18, (double)(par3 + 1) + var16, (double)(par4 + 1) + var16, var20, var9); + var5.addVertexWithUV((double)par2 + var18, (double)(par3 + 0) - var16, (double)(par4 + 1) + var16, var20, var13); + var5.addVertexWithUV((double)par2 + var18, (double)(par3 + 0) - var16, (double)(par4 + 0) - var16, var11, var13); + var5.addVertexWithUV((double)par2 + var18, (double)(par3 + 1) + var16, (double)(par4 + 0) - var16, var11, var9); + } + + if (var15 == 4) + { + var5.addVertexWithUV((double)(par2 + 1) - var18, (double)(par3 + 0) - var16, (double)(par4 + 1) + var16, var11, var13); + var5.addVertexWithUV((double)(par2 + 1) - var18, (double)(par3 + 1) + var16, (double)(par4 + 1) + var16, var11, var9); + var5.addVertexWithUV((double)(par2 + 1) - var18, (double)(par3 + 1) + var16, (double)(par4 + 0) - var16, var20, var9); + var5.addVertexWithUV((double)(par2 + 1) - var18, (double)(par3 + 0) - var16, (double)(par4 + 0) - var16, var20, var13); + } + + if (var15 == 3) + { + var5.addVertexWithUV((double)(par2 + 1) + var16, (double)(par3 + 0) - var16, (double)par4 + var18, var11, var13); + var5.addVertexWithUV((double)(par2 + 1) + var16, (double)(par3 + 1) + var16, (double)par4 + var18, var11, var9); + var5.addVertexWithUV((double)(par2 + 0) - var16, (double)(par3 + 1) + var16, (double)par4 + var18, var20, var9); + var5.addVertexWithUV((double)(par2 + 0) - var16, (double)(par3 + 0) - var16, (double)par4 + var18, var20, var13); + } + + if (var15 == 2) + { + var5.addVertexWithUV((double)(par2 + 1) + var16, (double)(par3 + 1) + var16, (double)(par4 + 1) - var18, var20, var9); + var5.addVertexWithUV((double)(par2 + 1) + var16, (double)(par3 + 0) - var16, (double)(par4 + 1) - var18, var20, var13); + var5.addVertexWithUV((double)(par2 + 0) - var16, (double)(par3 + 0) - var16, (double)(par4 + 1) - var18, var11, var13); + var5.addVertexWithUV((double)(par2 + 0) - var16, (double)(par3 + 1) + var16, (double)(par4 + 1) - var18, var11, var9); + } + + return true; + } + + /** + * Render block vine + */ + public boolean renderBlockVine(Block par1Block, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + Icon var6 = this.getBlockIconFromSide(par1Block, 0); + + if (this.hasOverrideBlockTexture()) + { + var6 = this.overrideBlockTexture; + } + + float var7 = 1.0F; + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + int var8 = par1Block.colorMultiplier(this.blockAccess, par2, par3, par4); + float var9 = (float)(var8 >> 16 & 255) / 255.0F; + float var10 = (float)(var8 >> 8 & 255) / 255.0F; + float var11 = (float)(var8 & 255) / 255.0F; + var5.setColorOpaque_F(var7 * var9, var7 * var10, var7 * var11); + double var19 = (double)var6.getMinU(); + double var20 = (double)var6.getMinV(); + double var12 = (double)var6.getMaxU(); + double var14 = (double)var6.getMaxV(); + double var16 = 0.05000000074505806D; + int var18 = this.blockAccess.getBlockMetadata(par2, par3, par4); + + if ((var18 & 2) != 0) + { + var5.addVertexWithUV((double)par2 + var16, (double)(par3 + 1), (double)(par4 + 1), var19, var20); + var5.addVertexWithUV((double)par2 + var16, (double)(par3 + 0), (double)(par4 + 1), var19, var14); + var5.addVertexWithUV((double)par2 + var16, (double)(par3 + 0), (double)(par4 + 0), var12, var14); + var5.addVertexWithUV((double)par2 + var16, (double)(par3 + 1), (double)(par4 + 0), var12, var20); + var5.addVertexWithUV((double)par2 + var16, (double)(par3 + 1), (double)(par4 + 0), var12, var20); + var5.addVertexWithUV((double)par2 + var16, (double)(par3 + 0), (double)(par4 + 0), var12, var14); + var5.addVertexWithUV((double)par2 + var16, (double)(par3 + 0), (double)(par4 + 1), var19, var14); + var5.addVertexWithUV((double)par2 + var16, (double)(par3 + 1), (double)(par4 + 1), var19, var20); + } + + if ((var18 & 8) != 0) + { + var5.addVertexWithUV((double)(par2 + 1) - var16, (double)(par3 + 0), (double)(par4 + 1), var12, var14); + var5.addVertexWithUV((double)(par2 + 1) - var16, (double)(par3 + 1), (double)(par4 + 1), var12, var20); + var5.addVertexWithUV((double)(par2 + 1) - var16, (double)(par3 + 1), (double)(par4 + 0), var19, var20); + var5.addVertexWithUV((double)(par2 + 1) - var16, (double)(par3 + 0), (double)(par4 + 0), var19, var14); + var5.addVertexWithUV((double)(par2 + 1) - var16, (double)(par3 + 0), (double)(par4 + 0), var19, var14); + var5.addVertexWithUV((double)(par2 + 1) - var16, (double)(par3 + 1), (double)(par4 + 0), var19, var20); + var5.addVertexWithUV((double)(par2 + 1) - var16, (double)(par3 + 1), (double)(par4 + 1), var12, var20); + var5.addVertexWithUV((double)(par2 + 1) - var16, (double)(par3 + 0), (double)(par4 + 1), var12, var14); + } + + if ((var18 & 4) != 0) + { + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)par4 + var16, var12, var14); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1), (double)par4 + var16, var12, var20); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1), (double)par4 + var16, var19, var20); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)par4 + var16, var19, var14); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)par4 + var16, var19, var14); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1), (double)par4 + var16, var19, var20); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1), (double)par4 + var16, var12, var20); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)par4 + var16, var12, var14); + } + + if ((var18 & 1) != 0) + { + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1), (double)(par4 + 1) - var16, var19, var20); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)(par4 + 1) - var16, var19, var14); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)(par4 + 1) - var16, var12, var14); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1), (double)(par4 + 1) - var16, var12, var20); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1), (double)(par4 + 1) - var16, var12, var20); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 0), (double)(par4 + 1) - var16, var12, var14); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 0), (double)(par4 + 1) - var16, var19, var14); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1), (double)(par4 + 1) - var16, var19, var20); + } + + if (this.blockAccess.isBlockNormalCube(par2, par3 + 1, par4)) + { + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1) - var16, (double)(par4 + 0), var19, var20); + var5.addVertexWithUV((double)(par2 + 1), (double)(par3 + 1) - var16, (double)(par4 + 1), var19, var14); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1) - var16, (double)(par4 + 1), var12, var14); + var5.addVertexWithUV((double)(par2 + 0), (double)(par3 + 1) - var16, (double)(par4 + 0), var12, var20); + } + + return true; + } + + public boolean renderBlockPane(BlockPane par1BlockPane, int par2, int par3, int par4) + { + int var5 = this.blockAccess.getHeight(); + Tessellator var6 = Tessellator.instance; + var6.setBrightness(par1BlockPane.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var7 = 1.0F; + int var8 = par1BlockPane.colorMultiplier(this.blockAccess, par2, par3, par4); + float var9 = (float)(var8 >> 16 & 255) / 255.0F; + float var10 = (float)(var8 >> 8 & 255) / 255.0F; + float var11 = (float)(var8 & 255) / 255.0F; + + if (EntityRenderer.anaglyphEnable) + { + float var12 = (var9 * 30.0F + var10 * 59.0F + var11 * 11.0F) / 100.0F; + float var13 = (var9 * 30.0F + var10 * 70.0F) / 100.0F; + float var14 = (var9 * 30.0F + var11 * 70.0F) / 100.0F; + var9 = var12; + var10 = var13; + var11 = var14; + } + + var6.setColorOpaque_F(var7 * var9, var7 * var10, var7 * var11); + Icon var64; + Icon var65; + + if (this.hasOverrideBlockTexture()) + { + var64 = this.overrideBlockTexture; + var65 = this.overrideBlockTexture; + } + else + { + int var66 = this.blockAccess.getBlockMetadata(par2, par3, par4); + var64 = this.getBlockIconFromSideAndMetadata(par1BlockPane, 0, var66); + var65 = par1BlockPane.getSideTextureIndex(); + } + + double var67 = (double)var64.getMinU(); + double var16 = (double)var64.getInterpolatedU(8.0D); + double var18 = (double)var64.getMaxU(); + double var20 = (double)var64.getMinV(); + double var22 = (double)var64.getMaxV(); + double var24 = (double)var65.getInterpolatedU(7.0D); + double var26 = (double)var65.getInterpolatedU(9.0D); + double var28 = (double)var65.getMinV(); + double var30 = (double)var65.getInterpolatedV(8.0D); + double var32 = (double)var65.getMaxV(); + double var34 = (double)par2; + double var36 = (double)par2 + 0.5D; + double var38 = (double)(par2 + 1); + double var40 = (double)par4; + double var42 = (double)par4 + 0.5D; + double var44 = (double)(par4 + 1); + double var46 = (double)par2 + 0.5D - 0.0625D; + double var48 = (double)par2 + 0.5D + 0.0625D; + double var50 = (double)par4 + 0.5D - 0.0625D; + double var52 = (double)par4 + 0.5D + 0.0625D; + boolean var54 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2, par3, par4 - 1)); + boolean var55 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2, par3, par4 + 1)); + boolean var56 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2 - 1, par3, par4)); + boolean var57 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2 + 1, par3, par4)); + boolean var58 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1); + boolean var59 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0); + double var60 = 0.01D; + double var62 = 0.005D; + + if ((!var56 || !var57) && (var56 || var57 || var54 || var55)) + { + if (var56 && !var57) + { + var6.addVertexWithUV(var34, (double)(par3 + 1), var42, var67, var20); + var6.addVertexWithUV(var34, (double)(par3 + 0), var42, var67, var22); + var6.addVertexWithUV(var36, (double)(par3 + 0), var42, var16, var22); + var6.addVertexWithUV(var36, (double)(par3 + 1), var42, var16, var20); + var6.addVertexWithUV(var36, (double)(par3 + 1), var42, var67, var20); + var6.addVertexWithUV(var36, (double)(par3 + 0), var42, var67, var22); + var6.addVertexWithUV(var34, (double)(par3 + 0), var42, var16, var22); + var6.addVertexWithUV(var34, (double)(par3 + 1), var42, var16, var20); + + if (!var55 && !var54) + { + var6.addVertexWithUV(var36, (double)(par3 + 1), var52, var24, var28); + var6.addVertexWithUV(var36, (double)(par3 + 0), var52, var24, var32); + var6.addVertexWithUV(var36, (double)(par3 + 0), var50, var26, var32); + var6.addVertexWithUV(var36, (double)(par3 + 1), var50, var26, var28); + var6.addVertexWithUV(var36, (double)(par3 + 1), var50, var24, var28); + var6.addVertexWithUV(var36, (double)(par3 + 0), var50, var24, var32); + var6.addVertexWithUV(var36, (double)(par3 + 0), var52, var26, var32); + var6.addVertexWithUV(var36, (double)(par3 + 1), var52, var26, var28); + } + + if (var58 || par3 < var5 - 1 && this.blockAccess.isAirBlock(par2 - 1, par3 + 1, par4)) + { + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var52, var26, var30); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var52, var26, var32); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var50, var24, var32); + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var50, var24, var30); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var52, var26, var30); + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var52, var26, var32); + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var50, var24, var32); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var50, var24, var30); + } + + if (var59 || par3 > 1 && this.blockAccess.isAirBlock(par2 - 1, par3 - 1, par4)) + { + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var52, var26, var30); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var52, var26, var32); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var50, var24, var32); + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var50, var24, var30); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var52, var26, var30); + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var52, var26, var32); + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var50, var24, var32); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var50, var24, var30); + } + } + else if (!var56 && var57) + { + var6.addVertexWithUV(var36, (double)(par3 + 1), var42, var16, var20); + var6.addVertexWithUV(var36, (double)(par3 + 0), var42, var16, var22); + var6.addVertexWithUV(var38, (double)(par3 + 0), var42, var18, var22); + var6.addVertexWithUV(var38, (double)(par3 + 1), var42, var18, var20); + var6.addVertexWithUV(var38, (double)(par3 + 1), var42, var16, var20); + var6.addVertexWithUV(var38, (double)(par3 + 0), var42, var16, var22); + var6.addVertexWithUV(var36, (double)(par3 + 0), var42, var18, var22); + var6.addVertexWithUV(var36, (double)(par3 + 1), var42, var18, var20); + + if (!var55 && !var54) + { + var6.addVertexWithUV(var36, (double)(par3 + 1), var50, var24, var28); + var6.addVertexWithUV(var36, (double)(par3 + 0), var50, var24, var32); + var6.addVertexWithUV(var36, (double)(par3 + 0), var52, var26, var32); + var6.addVertexWithUV(var36, (double)(par3 + 1), var52, var26, var28); + var6.addVertexWithUV(var36, (double)(par3 + 1), var52, var24, var28); + var6.addVertexWithUV(var36, (double)(par3 + 0), var52, var24, var32); + var6.addVertexWithUV(var36, (double)(par3 + 0), var50, var26, var32); + var6.addVertexWithUV(var36, (double)(par3 + 1), var50, var26, var28); + } + + if (var58 || par3 < var5 - 1 && this.blockAccess.isAirBlock(par2 + 1, par3 + 1, par4)) + { + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var52, var26, var28); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var52, var26, var30); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var50, var24, var30); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var50, var24, var28); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var52, var26, var28); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var52, var26, var30); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var50, var24, var30); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var50, var24, var28); + } + + if (var59 || par3 > 1 && this.blockAccess.isAirBlock(par2 + 1, par3 - 1, par4)) + { + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var52, var26, var28); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var52, var26, var30); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var50, var24, var30); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var50, var24, var28); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var52, var26, var28); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var52, var26, var30); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var50, var24, var30); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var50, var24, var28); + } + } + } + else + { + var6.addVertexWithUV(var34, (double)(par3 + 1), var42, var67, var20); + var6.addVertexWithUV(var34, (double)(par3 + 0), var42, var67, var22); + var6.addVertexWithUV(var38, (double)(par3 + 0), var42, var18, var22); + var6.addVertexWithUV(var38, (double)(par3 + 1), var42, var18, var20); + var6.addVertexWithUV(var38, (double)(par3 + 1), var42, var67, var20); + var6.addVertexWithUV(var38, (double)(par3 + 0), var42, var67, var22); + var6.addVertexWithUV(var34, (double)(par3 + 0), var42, var18, var22); + var6.addVertexWithUV(var34, (double)(par3 + 1), var42, var18, var20); + + if (var58) + { + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var52, var26, var32); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var52, var26, var28); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var50, var24, var28); + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var50, var24, var32); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var52, var26, var32); + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var52, var26, var28); + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var50, var24, var28); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var50, var24, var32); + } + else + { + if (par3 < var5 - 1 && this.blockAccess.isAirBlock(par2 - 1, par3 + 1, par4)) + { + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var52, var26, var30); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var52, var26, var32); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var50, var24, var32); + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var50, var24, var30); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var52, var26, var30); + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var52, var26, var32); + var6.addVertexWithUV(var34, (double)(par3 + 1) + 0.01D, var50, var24, var32); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var50, var24, var30); + } + + if (par3 < var5 - 1 && this.blockAccess.isAirBlock(par2 + 1, par3 + 1, par4)) + { + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var52, var26, var28); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var52, var26, var30); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var50, var24, var30); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var50, var24, var28); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var52, var26, var28); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var52, var26, var30); + var6.addVertexWithUV(var36, (double)(par3 + 1) + 0.01D, var50, var24, var30); + var6.addVertexWithUV(var38, (double)(par3 + 1) + 0.01D, var50, var24, var28); + } + } + + if (var59) + { + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var52, var26, var32); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var52, var26, var28); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var50, var24, var28); + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var50, var24, var32); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var52, var26, var32); + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var52, var26, var28); + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var50, var24, var28); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var50, var24, var32); + } + else + { + if (par3 > 1 && this.blockAccess.isAirBlock(par2 - 1, par3 - 1, par4)) + { + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var52, var26, var30); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var52, var26, var32); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var50, var24, var32); + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var50, var24, var30); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var52, var26, var30); + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var52, var26, var32); + var6.addVertexWithUV(var34, (double)par3 - 0.01D, var50, var24, var32); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var50, var24, var30); + } + + if (par3 > 1 && this.blockAccess.isAirBlock(par2 + 1, par3 - 1, par4)) + { + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var52, var26, var28); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var52, var26, var30); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var50, var24, var30); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var50, var24, var28); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var52, var26, var28); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var52, var26, var30); + var6.addVertexWithUV(var36, (double)par3 - 0.01D, var50, var24, var30); + var6.addVertexWithUV(var38, (double)par3 - 0.01D, var50, var24, var28); + } + } + } + + if ((!var54 || !var55) && (var56 || var57 || var54 || var55)) + { + if (var54 && !var55) + { + var6.addVertexWithUV(var36, (double)(par3 + 1), var40, var67, var20); + var6.addVertexWithUV(var36, (double)(par3 + 0), var40, var67, var22); + var6.addVertexWithUV(var36, (double)(par3 + 0), var42, var16, var22); + var6.addVertexWithUV(var36, (double)(par3 + 1), var42, var16, var20); + var6.addVertexWithUV(var36, (double)(par3 + 1), var42, var67, var20); + var6.addVertexWithUV(var36, (double)(par3 + 0), var42, var67, var22); + var6.addVertexWithUV(var36, (double)(par3 + 0), var40, var16, var22); + var6.addVertexWithUV(var36, (double)(par3 + 1), var40, var16, var20); + + if (!var57 && !var56) + { + var6.addVertexWithUV(var46, (double)(par3 + 1), var42, var24, var28); + var6.addVertexWithUV(var46, (double)(par3 + 0), var42, var24, var32); + var6.addVertexWithUV(var48, (double)(par3 + 0), var42, var26, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1), var42, var26, var28); + var6.addVertexWithUV(var48, (double)(par3 + 1), var42, var24, var28); + var6.addVertexWithUV(var48, (double)(par3 + 0), var42, var24, var32); + var6.addVertexWithUV(var46, (double)(par3 + 0), var42, var26, var32); + var6.addVertexWithUV(var46, (double)(par3 + 1), var42, var26, var28); + } + + if (var58 || par3 < var5 - 1 && this.blockAccess.isAirBlock(par2, par3 + 1, par4 - 1)) + { + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var40, var26, var28); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var42, var26, var30); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var42, var24, var30); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var40, var24, var28); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var42, var26, var28); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var40, var26, var30); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var40, var24, var30); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var42, var24, var28); + } + + if (var59 || par3 > 1 && this.blockAccess.isAirBlock(par2, par3 - 1, par4 - 1)) + { + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var40, var26, var28); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var42, var26, var30); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var42, var24, var30); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var40, var24, var28); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var42, var26, var28); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var40, var26, var30); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var40, var24, var30); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var42, var24, var28); + } + } + else if (!var54 && var55) + { + var6.addVertexWithUV(var36, (double)(par3 + 1), var42, var16, var20); + var6.addVertexWithUV(var36, (double)(par3 + 0), var42, var16, var22); + var6.addVertexWithUV(var36, (double)(par3 + 0), var44, var18, var22); + var6.addVertexWithUV(var36, (double)(par3 + 1), var44, var18, var20); + var6.addVertexWithUV(var36, (double)(par3 + 1), var44, var16, var20); + var6.addVertexWithUV(var36, (double)(par3 + 0), var44, var16, var22); + var6.addVertexWithUV(var36, (double)(par3 + 0), var42, var18, var22); + var6.addVertexWithUV(var36, (double)(par3 + 1), var42, var18, var20); + + if (!var57 && !var56) + { + var6.addVertexWithUV(var48, (double)(par3 + 1), var42, var24, var28); + var6.addVertexWithUV(var48, (double)(par3 + 0), var42, var24, var32); + var6.addVertexWithUV(var46, (double)(par3 + 0), var42, var26, var32); + var6.addVertexWithUV(var46, (double)(par3 + 1), var42, var26, var28); + var6.addVertexWithUV(var46, (double)(par3 + 1), var42, var24, var28); + var6.addVertexWithUV(var46, (double)(par3 + 0), var42, var24, var32); + var6.addVertexWithUV(var48, (double)(par3 + 0), var42, var26, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1), var42, var26, var28); + } + + if (var58 || par3 < var5 - 1 && this.blockAccess.isAirBlock(par2, par3 + 1, par4 + 1)) + { + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var42, var24, var30); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var44, var24, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var44, var26, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var42, var26, var30); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var44, var24, var30); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var42, var24, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var42, var26, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var44, var26, var30); + } + + if (var59 || par3 > 1 && this.blockAccess.isAirBlock(par2, par3 - 1, par4 + 1)) + { + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var42, var24, var30); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var44, var24, var32); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var44, var26, var32); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var42, var26, var30); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var44, var24, var30); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var42, var24, var32); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var42, var26, var32); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var44, var26, var30); + } + } + } + else + { + var6.addVertexWithUV(var36, (double)(par3 + 1), var44, var67, var20); + var6.addVertexWithUV(var36, (double)(par3 + 0), var44, var67, var22); + var6.addVertexWithUV(var36, (double)(par3 + 0), var40, var18, var22); + var6.addVertexWithUV(var36, (double)(par3 + 1), var40, var18, var20); + var6.addVertexWithUV(var36, (double)(par3 + 1), var40, var67, var20); + var6.addVertexWithUV(var36, (double)(par3 + 0), var40, var67, var22); + var6.addVertexWithUV(var36, (double)(par3 + 0), var44, var18, var22); + var6.addVertexWithUV(var36, (double)(par3 + 1), var44, var18, var20); + + if (var58) + { + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var44, var26, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var40, var26, var28); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var40, var24, var28); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var44, var24, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var40, var26, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var44, var26, var28); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var44, var24, var28); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var40, var24, var32); + } + else + { + if (par3 < var5 - 1 && this.blockAccess.isAirBlock(par2, par3 + 1, par4 - 1)) + { + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var40, var26, var28); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var42, var26, var30); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var42, var24, var30); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var40, var24, var28); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var42, var26, var28); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var40, var26, var30); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var40, var24, var30); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var42, var24, var28); + } + + if (par3 < var5 - 1 && this.blockAccess.isAirBlock(par2, par3 + 1, par4 + 1)) + { + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var42, var24, var30); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var44, var24, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var44, var26, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var42, var26, var30); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var44, var24, var30); + var6.addVertexWithUV(var46, (double)(par3 + 1) + 0.005D, var42, var24, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var42, var26, var32); + var6.addVertexWithUV(var48, (double)(par3 + 1) + 0.005D, var44, var26, var30); + } + } + + if (var59) + { + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var44, var26, var32); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var40, var26, var28); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var40, var24, var28); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var44, var24, var32); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var40, var26, var32); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var44, var26, var28); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var44, var24, var28); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var40, var24, var32); + } + else + { + if (par3 > 1 && this.blockAccess.isAirBlock(par2, par3 - 1, par4 - 1)) + { + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var40, var26, var28); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var42, var26, var30); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var42, var24, var30); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var40, var24, var28); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var42, var26, var28); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var40, var26, var30); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var40, var24, var30); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var42, var24, var28); + } + + if (par3 > 1 && this.blockAccess.isAirBlock(par2, par3 - 1, par4 + 1)) + { + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var42, var24, var30); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var44, var24, var32); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var44, var26, var32); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var42, var26, var30); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var44, var24, var30); + var6.addVertexWithUV(var46, (double)par3 - 0.005D, var42, var24, var32); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var42, var26, var32); + var6.addVertexWithUV(var48, (double)par3 - 0.005D, var44, var26, var30); + } + } + } + + return true; + } + + /** + * Renders any block requiring croseed squares such as reeds, flowers, and mushrooms + */ + public boolean renderCrossedSquares(Block par1Block, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var6 = 1.0F; + int var7 = par1Block.colorMultiplier(this.blockAccess, par2, par3, par4); + float var8 = (float)(var7 >> 16 & 255) / 255.0F; + float var9 = (float)(var7 >> 8 & 255) / 255.0F; + float var10 = (float)(var7 & 255) / 255.0F; + + if (EntityRenderer.anaglyphEnable) + { + float var11 = (var8 * 30.0F + var9 * 59.0F + var10 * 11.0F) / 100.0F; + float var12 = (var8 * 30.0F + var9 * 70.0F) / 100.0F; + float var13 = (var8 * 30.0F + var10 * 70.0F) / 100.0F; + var8 = var11; + var9 = var12; + var10 = var13; + } + + var5.setColorOpaque_F(var6 * var8, var6 * var9, var6 * var10); + double var19 = (double)par2; + double var20 = (double)par3; + double var15 = (double)par4; + + if (par1Block == Block.tallGrass) + { + long var17 = (long)(par2 * 3129871) ^ (long)par4 * 116129781L ^ (long)par3; + var17 = var17 * var17 * 42317861L + var17 * 11L; + var19 += ((double)((float)(var17 >> 16 & 15L) / 15.0F) - 0.5D) * 0.5D; + var20 += ((double)((float)(var17 >> 20 & 15L) / 15.0F) - 1.0D) * 0.2D; + var15 += ((double)((float)(var17 >> 24 & 15L) / 15.0F) - 0.5D) * 0.5D; + } + + this.drawCrossedSquares(par1Block, this.blockAccess.getBlockMetadata(par2, par3, par4), var19, var20, var15, 1.0F); + return true; + } + + /** + * Render block stem + */ + public boolean renderBlockStem(Block par1Block, int par2, int par3, int par4) + { + BlockStem var5 = (BlockStem)par1Block; + Tessellator var6 = Tessellator.instance; + var6.setBrightness(var5.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var7 = 1.0F; + int var8 = var5.colorMultiplier(this.blockAccess, par2, par3, par4); + float var9 = (float)(var8 >> 16 & 255) / 255.0F; + float var10 = (float)(var8 >> 8 & 255) / 255.0F; + float var11 = (float)(var8 & 255) / 255.0F; + + if (EntityRenderer.anaglyphEnable) + { + float var12 = (var9 * 30.0F + var10 * 59.0F + var11 * 11.0F) / 100.0F; + float var13 = (var9 * 30.0F + var10 * 70.0F) / 100.0F; + float var14 = (var9 * 30.0F + var11 * 70.0F) / 100.0F; + var9 = var12; + var10 = var13; + var11 = var14; + } + + var6.setColorOpaque_F(var7 * var9, var7 * var10, var7 * var11); + var5.setBlockBoundsBasedOnState(this.blockAccess, par2, par3, par4); + int var15 = var5.getState(this.blockAccess, par2, par3, par4); + + if (var15 < 0) + { + this.renderBlockStemSmall(var5, this.blockAccess.getBlockMetadata(par2, par3, par4), this.renderMaxY, (double)par2, (double)((float)par3 - 0.0625F), (double)par4); + } + else + { + this.renderBlockStemSmall(var5, this.blockAccess.getBlockMetadata(par2, par3, par4), 0.5D, (double)par2, (double)((float)par3 - 0.0625F), (double)par4); + this.renderBlockStemBig(var5, this.blockAccess.getBlockMetadata(par2, par3, par4), var15, this.renderMaxY, (double)par2, (double)((float)par3 - 0.0625F), (double)par4); + } + + return true; + } + + /** + * Render block crops + */ + public boolean renderBlockCrops(Block par1Block, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + var5.setColorOpaque_F(1.0F, 1.0F, 1.0F); + this.renderBlockCropsImpl(par1Block, this.blockAccess.getBlockMetadata(par2, par3, par4), (double)par2, (double)((float)par3 - 0.0625F), (double)par4); + return true; + } + + /** + * Renders a torch at the given coordinates, with the base slanting at the given delta + */ + public void renderTorchAtAngle(Block par1Block, double par2, double par4, double par6, double par8, double par10, int par12) + { + Tessellator var13 = Tessellator.instance; + Icon var14 = this.getBlockIconFromSideAndMetadata(par1Block, 0, par12); + + if (this.hasOverrideBlockTexture()) + { + var14 = this.overrideBlockTexture; + } + + double var15 = (double)var14.getMinU(); + double var17 = (double)var14.getMinV(); + double var19 = (double)var14.getMaxU(); + double var21 = (double)var14.getMaxV(); + double var23 = (double)var14.getInterpolatedU(7.0D); + double var25 = (double)var14.getInterpolatedV(6.0D); + double var27 = (double)var14.getInterpolatedU(9.0D); + double var29 = (double)var14.getInterpolatedV(8.0D); + double var31 = (double)var14.getInterpolatedU(7.0D); + double var33 = (double)var14.getInterpolatedV(13.0D); + double var35 = (double)var14.getInterpolatedU(9.0D); + double var37 = (double)var14.getInterpolatedV(15.0D); + par2 += 0.5D; + par6 += 0.5D; + double var39 = par2 - 0.5D; + double var41 = par2 + 0.5D; + double var43 = par6 - 0.5D; + double var45 = par6 + 0.5D; + double var47 = 0.0625D; + double var49 = 0.625D; + var13.addVertexWithUV(par2 + par8 * (1.0D - var49) - var47, par4 + var49, par6 + par10 * (1.0D - var49) - var47, var23, var25); + var13.addVertexWithUV(par2 + par8 * (1.0D - var49) - var47, par4 + var49, par6 + par10 * (1.0D - var49) + var47, var23, var29); + var13.addVertexWithUV(par2 + par8 * (1.0D - var49) + var47, par4 + var49, par6 + par10 * (1.0D - var49) + var47, var27, var29); + var13.addVertexWithUV(par2 + par8 * (1.0D - var49) + var47, par4 + var49, par6 + par10 * (1.0D - var49) - var47, var27, var25); + var13.addVertexWithUV(par2 + var47 + par8, par4, par6 - var47 + par10, var35, var33); + var13.addVertexWithUV(par2 + var47 + par8, par4, par6 + var47 + par10, var35, var37); + var13.addVertexWithUV(par2 - var47 + par8, par4, par6 + var47 + par10, var31, var37); + var13.addVertexWithUV(par2 - var47 + par8, par4, par6 - var47 + par10, var31, var33); + var13.addVertexWithUV(par2 - var47, par4 + 1.0D, var43, var15, var17); + var13.addVertexWithUV(par2 - var47 + par8, par4 + 0.0D, var43 + par10, var15, var21); + var13.addVertexWithUV(par2 - var47 + par8, par4 + 0.0D, var45 + par10, var19, var21); + var13.addVertexWithUV(par2 - var47, par4 + 1.0D, var45, var19, var17); + var13.addVertexWithUV(par2 + var47, par4 + 1.0D, var45, var15, var17); + var13.addVertexWithUV(par2 + par8 + var47, par4 + 0.0D, var45 + par10, var15, var21); + var13.addVertexWithUV(par2 + par8 + var47, par4 + 0.0D, var43 + par10, var19, var21); + var13.addVertexWithUV(par2 + var47, par4 + 1.0D, var43, var19, var17); + var13.addVertexWithUV(var39, par4 + 1.0D, par6 + var47, var15, var17); + var13.addVertexWithUV(var39 + par8, par4 + 0.0D, par6 + var47 + par10, var15, var21); + var13.addVertexWithUV(var41 + par8, par4 + 0.0D, par6 + var47 + par10, var19, var21); + var13.addVertexWithUV(var41, par4 + 1.0D, par6 + var47, var19, var17); + var13.addVertexWithUV(var41, par4 + 1.0D, par6 - var47, var15, var17); + var13.addVertexWithUV(var41 + par8, par4 + 0.0D, par6 - var47 + par10, var15, var21); + var13.addVertexWithUV(var39 + par8, par4 + 0.0D, par6 - var47 + par10, var19, var21); + var13.addVertexWithUV(var39, par4 + 1.0D, par6 - var47, var19, var17); + } + + /** + * Utility function to draw crossed swuares + */ + public void drawCrossedSquares(Block par1Block, int par2, double par3, double par5, double par7, float par9) + { + Tessellator var10 = Tessellator.instance; + Icon var11 = this.getBlockIconFromSideAndMetadata(par1Block, 0, par2); + + if (this.hasOverrideBlockTexture()) + { + var11 = this.overrideBlockTexture; + } + + double var12 = (double)var11.getMinU(); + double var14 = (double)var11.getMinV(); + double var16 = (double)var11.getMaxU(); + double var18 = (double)var11.getMaxV(); + double var20 = 0.45D * (double)par9; + double var22 = par3 + 0.5D - var20; + double var24 = par3 + 0.5D + var20; + double var26 = par7 + 0.5D - var20; + double var28 = par7 + 0.5D + var20; + var10.addVertexWithUV(var22, par5 + (double)par9, var26, var12, var14); + var10.addVertexWithUV(var22, par5 + 0.0D, var26, var12, var18); + var10.addVertexWithUV(var24, par5 + 0.0D, var28, var16, var18); + var10.addVertexWithUV(var24, par5 + (double)par9, var28, var16, var14); + var10.addVertexWithUV(var24, par5 + (double)par9, var28, var12, var14); + var10.addVertexWithUV(var24, par5 + 0.0D, var28, var12, var18); + var10.addVertexWithUV(var22, par5 + 0.0D, var26, var16, var18); + var10.addVertexWithUV(var22, par5 + (double)par9, var26, var16, var14); + var10.addVertexWithUV(var22, par5 + (double)par9, var28, var12, var14); + var10.addVertexWithUV(var22, par5 + 0.0D, var28, var12, var18); + var10.addVertexWithUV(var24, par5 + 0.0D, var26, var16, var18); + var10.addVertexWithUV(var24, par5 + (double)par9, var26, var16, var14); + var10.addVertexWithUV(var24, par5 + (double)par9, var26, var12, var14); + var10.addVertexWithUV(var24, par5 + 0.0D, var26, var12, var18); + var10.addVertexWithUV(var22, par5 + 0.0D, var28, var16, var18); + var10.addVertexWithUV(var22, par5 + (double)par9, var28, var16, var14); + } + + /** + * Render block stem small + */ + public void renderBlockStemSmall(Block par1Block, int par2, double par3, double par5, double par7, double par9) + { + Tessellator var11 = Tessellator.instance; + Icon var12 = this.getBlockIconFromSideAndMetadata(par1Block, 0, par2); + + if (this.hasOverrideBlockTexture()) + { + var12 = this.overrideBlockTexture; + } + + double var13 = (double)var12.getMinU(); + double var15 = (double)var12.getMinV(); + double var17 = (double)var12.getMaxU(); + double var19 = (double)var12.getInterpolatedV(par3 * 16.0D); + double var21 = par5 + 0.5D - 0.44999998807907104D; + double var23 = par5 + 0.5D + 0.44999998807907104D; + double var25 = par9 + 0.5D - 0.44999998807907104D; + double var27 = par9 + 0.5D + 0.44999998807907104D; + var11.addVertexWithUV(var21, par7 + par3, var25, var13, var15); + var11.addVertexWithUV(var21, par7 + 0.0D, var25, var13, var19); + var11.addVertexWithUV(var23, par7 + 0.0D, var27, var17, var19); + var11.addVertexWithUV(var23, par7 + par3, var27, var17, var15); + var11.addVertexWithUV(var23, par7 + par3, var27, var13, var15); + var11.addVertexWithUV(var23, par7 + 0.0D, var27, var13, var19); + var11.addVertexWithUV(var21, par7 + 0.0D, var25, var17, var19); + var11.addVertexWithUV(var21, par7 + par3, var25, var17, var15); + var11.addVertexWithUV(var21, par7 + par3, var27, var13, var15); + var11.addVertexWithUV(var21, par7 + 0.0D, var27, var13, var19); + var11.addVertexWithUV(var23, par7 + 0.0D, var25, var17, var19); + var11.addVertexWithUV(var23, par7 + par3, var25, var17, var15); + var11.addVertexWithUV(var23, par7 + par3, var25, var13, var15); + var11.addVertexWithUV(var23, par7 + 0.0D, var25, var13, var19); + var11.addVertexWithUV(var21, par7 + 0.0D, var27, var17, var19); + var11.addVertexWithUV(var21, par7 + par3, var27, var17, var15); + } + + /** + * Render BlockLilyPad + */ + public boolean renderBlockLilyPad(Block par1Block, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + Icon var6 = this.getBlockIconFromSide(par1Block, 1); + + if (this.hasOverrideBlockTexture()) + { + var6 = this.overrideBlockTexture; + } + + float var7 = 0.015625F; + double var8 = (double)var6.getMinU(); + double var10 = (double)var6.getMinV(); + double var12 = (double)var6.getMaxU(); + double var14 = (double)var6.getMaxV(); + long var16 = (long)(par2 * 3129871) ^ (long)par4 * 116129781L ^ (long)par3; + var16 = var16 * var16 * 42317861L + var16 * 11L; + int var18 = (int)(var16 >> 16 & 3L); + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var19 = (float)par2 + 0.5F; + float var20 = (float)par4 + 0.5F; + float var21 = (float)(var18 & 1) * 0.5F * (float)(1 - var18 / 2 % 2 * 2); + float var22 = (float)(var18 + 1 & 1) * 0.5F * (float)(1 - (var18 + 1) / 2 % 2 * 2); + var5.setColorOpaque_I(par1Block.getBlockColor()); + var5.addVertexWithUV((double)(var19 + var21 - var22), (double)((float)par3 + var7), (double)(var20 + var21 + var22), var8, var10); + var5.addVertexWithUV((double)(var19 + var21 + var22), (double)((float)par3 + var7), (double)(var20 - var21 + var22), var12, var10); + var5.addVertexWithUV((double)(var19 - var21 + var22), (double)((float)par3 + var7), (double)(var20 - var21 - var22), var12, var14); + var5.addVertexWithUV((double)(var19 - var21 - var22), (double)((float)par3 + var7), (double)(var20 + var21 - var22), var8, var14); + var5.setColorOpaque_I((par1Block.getBlockColor() & 16711422) >> 1); + var5.addVertexWithUV((double)(var19 - var21 - var22), (double)((float)par3 + var7), (double)(var20 + var21 - var22), var8, var14); + var5.addVertexWithUV((double)(var19 - var21 + var22), (double)((float)par3 + var7), (double)(var20 - var21 - var22), var12, var14); + var5.addVertexWithUV((double)(var19 + var21 + var22), (double)((float)par3 + var7), (double)(var20 - var21 + var22), var12, var10); + var5.addVertexWithUV((double)(var19 + var21 - var22), (double)((float)par3 + var7), (double)(var20 + var21 + var22), var8, var10); + return true; + } + + /** + * Render block stem big + */ + public void renderBlockStemBig(BlockStem par1BlockStem, int par2, int par3, double par4, double par6, double par8, double par10) + { + Tessellator var12 = Tessellator.instance; + Icon var13 = par1BlockStem.getStemIcon(); + + if (this.hasOverrideBlockTexture()) + { + var13 = this.overrideBlockTexture; + } + + double var14 = (double)var13.getMinU(); + double var16 = (double)var13.getMinV(); + double var18 = (double)var13.getMaxU(); + double var20 = (double)var13.getMaxV(); + double var22 = par6 + 0.5D - 0.5D; + double var24 = par6 + 0.5D + 0.5D; + double var26 = par10 + 0.5D - 0.5D; + double var28 = par10 + 0.5D + 0.5D; + double var30 = par6 + 0.5D; + double var32 = par10 + 0.5D; + + if ((par3 + 1) / 2 % 2 == 1) + { + double var34 = var18; + var18 = var14; + var14 = var34; + } + + if (par3 < 2) + { + var12.addVertexWithUV(var22, par8 + par4, var32, var14, var16); + var12.addVertexWithUV(var22, par8 + 0.0D, var32, var14, var20); + var12.addVertexWithUV(var24, par8 + 0.0D, var32, var18, var20); + var12.addVertexWithUV(var24, par8 + par4, var32, var18, var16); + var12.addVertexWithUV(var24, par8 + par4, var32, var18, var16); + var12.addVertexWithUV(var24, par8 + 0.0D, var32, var18, var20); + var12.addVertexWithUV(var22, par8 + 0.0D, var32, var14, var20); + var12.addVertexWithUV(var22, par8 + par4, var32, var14, var16); + } + else + { + var12.addVertexWithUV(var30, par8 + par4, var28, var14, var16); + var12.addVertexWithUV(var30, par8 + 0.0D, var28, var14, var20); + var12.addVertexWithUV(var30, par8 + 0.0D, var26, var18, var20); + var12.addVertexWithUV(var30, par8 + par4, var26, var18, var16); + var12.addVertexWithUV(var30, par8 + par4, var26, var18, var16); + var12.addVertexWithUV(var30, par8 + 0.0D, var26, var18, var20); + var12.addVertexWithUV(var30, par8 + 0.0D, var28, var14, var20); + var12.addVertexWithUV(var30, par8 + par4, var28, var14, var16); + } + } + + /** + * Render block crops implementation + */ + public void renderBlockCropsImpl(Block par1Block, int par2, double par3, double par5, double par7) + { + Tessellator var9 = Tessellator.instance; + Icon var10 = this.getBlockIconFromSideAndMetadata(par1Block, 0, par2); + + if (this.hasOverrideBlockTexture()) + { + var10 = this.overrideBlockTexture; + } + + double var11 = (double)var10.getMinU(); + double var13 = (double)var10.getMinV(); + double var15 = (double)var10.getMaxU(); + double var17 = (double)var10.getMaxV(); + double var19 = par3 + 0.5D - 0.25D; + double var21 = par3 + 0.5D + 0.25D; + double var23 = par7 + 0.5D - 0.5D; + double var25 = par7 + 0.5D + 0.5D; + var9.addVertexWithUV(var19, par5 + 1.0D, var23, var11, var13); + var9.addVertexWithUV(var19, par5 + 0.0D, var23, var11, var17); + var9.addVertexWithUV(var19, par5 + 0.0D, var25, var15, var17); + var9.addVertexWithUV(var19, par5 + 1.0D, var25, var15, var13); + var9.addVertexWithUV(var19, par5 + 1.0D, var25, var11, var13); + var9.addVertexWithUV(var19, par5 + 0.0D, var25, var11, var17); + var9.addVertexWithUV(var19, par5 + 0.0D, var23, var15, var17); + var9.addVertexWithUV(var19, par5 + 1.0D, var23, var15, var13); + var9.addVertexWithUV(var21, par5 + 1.0D, var25, var11, var13); + var9.addVertexWithUV(var21, par5 + 0.0D, var25, var11, var17); + var9.addVertexWithUV(var21, par5 + 0.0D, var23, var15, var17); + var9.addVertexWithUV(var21, par5 + 1.0D, var23, var15, var13); + var9.addVertexWithUV(var21, par5 + 1.0D, var23, var11, var13); + var9.addVertexWithUV(var21, par5 + 0.0D, var23, var11, var17); + var9.addVertexWithUV(var21, par5 + 0.0D, var25, var15, var17); + var9.addVertexWithUV(var21, par5 + 1.0D, var25, var15, var13); + var19 = par3 + 0.5D - 0.5D; + var21 = par3 + 0.5D + 0.5D; + var23 = par7 + 0.5D - 0.25D; + var25 = par7 + 0.5D + 0.25D; + var9.addVertexWithUV(var19, par5 + 1.0D, var23, var11, var13); + var9.addVertexWithUV(var19, par5 + 0.0D, var23, var11, var17); + var9.addVertexWithUV(var21, par5 + 0.0D, var23, var15, var17); + var9.addVertexWithUV(var21, par5 + 1.0D, var23, var15, var13); + var9.addVertexWithUV(var21, par5 + 1.0D, var23, var11, var13); + var9.addVertexWithUV(var21, par5 + 0.0D, var23, var11, var17); + var9.addVertexWithUV(var19, par5 + 0.0D, var23, var15, var17); + var9.addVertexWithUV(var19, par5 + 1.0D, var23, var15, var13); + var9.addVertexWithUV(var21, par5 + 1.0D, var25, var11, var13); + var9.addVertexWithUV(var21, par5 + 0.0D, var25, var11, var17); + var9.addVertexWithUV(var19, par5 + 0.0D, var25, var15, var17); + var9.addVertexWithUV(var19, par5 + 1.0D, var25, var15, var13); + var9.addVertexWithUV(var19, par5 + 1.0D, var25, var11, var13); + var9.addVertexWithUV(var19, par5 + 0.0D, var25, var11, var17); + var9.addVertexWithUV(var21, par5 + 0.0D, var25, var15, var17); + var9.addVertexWithUV(var21, par5 + 1.0D, var25, var15, var13); + } + + /** + * Renders a block based on the BlockFluids class at the given coordinates + */ + public boolean renderBlockFluids(Block par1Block, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + int var6 = par1Block.colorMultiplier(this.blockAccess, par2, par3, par4); + float var7 = (float)(var6 >> 16 & 255) / 255.0F; + float var8 = (float)(var6 >> 8 & 255) / 255.0F; + float var9 = (float)(var6 & 255) / 255.0F; + boolean var10 = par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1); + boolean var11 = par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0); + boolean[] var12 = new boolean[] {par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2), par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3), par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4), par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5)}; + + if (!var10 && !var11 && !var12[0] && !var12[1] && !var12[2] && !var12[3]) + { + return false; + } + else + { + boolean var13 = false; + float var14 = 0.5F; + float var15 = 1.0F; + float var16 = 0.8F; + float var17 = 0.6F; + double var18 = 0.0D; + double var20 = 1.0D; + Material var22 = par1Block.blockMaterial; + int var23 = this.blockAccess.getBlockMetadata(par2, par3, par4); + double var24 = (double)this.getFluidHeight(par2, par3, par4, var22); + double var26 = (double)this.getFluidHeight(par2, par3, par4 + 1, var22); + double var28 = (double)this.getFluidHeight(par2 + 1, par3, par4 + 1, var22); + double var30 = (double)this.getFluidHeight(par2 + 1, par3, par4, var22); + double var32 = 0.0010000000474974513D; + float var52; + float var53; + float var54; + + if (this.renderAllFaces || var10) + { + var13 = true; + Icon var34 = this.getBlockIconFromSideAndMetadata(par1Block, 1, var23); + float var35 = (float)BlockFluid.getFlowDirection(this.blockAccess, par2, par3, par4, var22); + + if (var35 > -999.0F) + { + var34 = this.getBlockIconFromSideAndMetadata(par1Block, 2, var23); + } + + var24 -= var32; + var26 -= var32; + var28 -= var32; + var30 -= var32; + double var36; + double var38; + double var40; + double var42; + double var44; + double var46; + double var48; + double var50; + + if (var35 < -999.0F) + { + var36 = (double)var34.getInterpolatedU(0.0D); + var44 = (double)var34.getInterpolatedV(0.0D); + var38 = var36; + var46 = (double)var34.getInterpolatedV(16.0D); + var40 = (double)var34.getInterpolatedU(16.0D); + var48 = var46; + var42 = var40; + var50 = var44; + } + else + { + var52 = MathHelper.sin(var35) * 0.25F; + var53 = MathHelper.cos(var35) * 0.25F; + var54 = 8.0F; + var36 = (double)var34.getInterpolatedU((double)(8.0F + (-var53 - var52) * 16.0F)); + var44 = (double)var34.getInterpolatedV((double)(8.0F + (-var53 + var52) * 16.0F)); + var38 = (double)var34.getInterpolatedU((double)(8.0F + (-var53 + var52) * 16.0F)); + var46 = (double)var34.getInterpolatedV((double)(8.0F + (var53 + var52) * 16.0F)); + var40 = (double)var34.getInterpolatedU((double)(8.0F + (var53 + var52) * 16.0F)); + var48 = (double)var34.getInterpolatedV((double)(8.0F + (var53 - var52) * 16.0F)); + var42 = (double)var34.getInterpolatedU((double)(8.0F + (var53 - var52) * 16.0F)); + var50 = (double)var34.getInterpolatedV((double)(8.0F + (-var53 - var52) * 16.0F)); + } + + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + var52 = 1.0F; + var5.setColorOpaque_F(var15 * var52 * var7, var15 * var52 * var8, var15 * var52 * var9); + var5.addVertexWithUV((double)(par2 + 0), (double)par3 + var24, (double)(par4 + 0), var36, var44); + var5.addVertexWithUV((double)(par2 + 0), (double)par3 + var26, (double)(par4 + 1), var38, var46); + var5.addVertexWithUV((double)(par2 + 1), (double)par3 + var28, (double)(par4 + 1), var40, var48); + var5.addVertexWithUV((double)(par2 + 1), (double)par3 + var30, (double)(par4 + 0), var42, var50); + } + + if (this.renderAllFaces || var11) + { + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4)); + float var57 = 1.0F; + var5.setColorOpaque_F(var14 * var57, var14 * var57, var14 * var57); + this.renderFaceYNeg(par1Block, (double)par2, (double)par3 + var32, (double)par4, this.getBlockIconFromSide(par1Block, 0)); + var13 = true; + } + + for (int var59 = 0; var59 < 4; ++var59) + { + int var58 = par2; + int var37 = par4; + + if (var59 == 0) + { + var37 = par4 - 1; + } + + if (var59 == 1) + { + ++var37; + } + + if (var59 == 2) + { + var58 = par2 - 1; + } + + if (var59 == 3) + { + ++var58; + } + + Icon var60 = this.getBlockIconFromSideAndMetadata(par1Block, var59 + 2, var23); + + if (this.renderAllFaces || var12[var59]) + { + double var39; + double var41; + double var43; + double var45; + double var47; + double var49; + + if (var59 == 0) + { + var39 = var24; + var41 = var30; + var43 = (double)par2; + var47 = (double)(par2 + 1); + var45 = (double)par4 + var32; + var49 = (double)par4 + var32; + } + else if (var59 == 1) + { + var39 = var28; + var41 = var26; + var43 = (double)(par2 + 1); + var47 = (double)par2; + var45 = (double)(par4 + 1) - var32; + var49 = (double)(par4 + 1) - var32; + } + else if (var59 == 2) + { + var39 = var26; + var41 = var24; + var43 = (double)par2 + var32; + var47 = (double)par2 + var32; + var45 = (double)(par4 + 1); + var49 = (double)par4; + } + else + { + var39 = var30; + var41 = var28; + var43 = (double)(par2 + 1) - var32; + var47 = (double)(par2 + 1) - var32; + var45 = (double)par4; + var49 = (double)(par4 + 1); + } + + var13 = true; + float var51 = var60.getInterpolatedU(0.0D); + var52 = var60.getInterpolatedU(8.0D); + var53 = var60.getInterpolatedV((1.0D - var39) * 16.0D * 0.5D); + var54 = var60.getInterpolatedV((1.0D - var41) * 16.0D * 0.5D); + float var55 = var60.getInterpolatedV(8.0D); + var5.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, var58, par3, var37)); + float var56 = 1.0F; + + if (var59 < 2) + { + var56 *= var16; + } + else + { + var56 *= var17; + } + + var5.setColorOpaque_F(var15 * var56 * var7, var15 * var56 * var8, var15 * var56 * var9); + var5.addVertexWithUV(var43, (double)par3 + var39, var45, (double)var51, (double)var53); + var5.addVertexWithUV(var47, (double)par3 + var41, var49, (double)var52, (double)var54); + var5.addVertexWithUV(var47, (double)(par3 + 0), var49, (double)var52, (double)var55); + var5.addVertexWithUV(var43, (double)(par3 + 0), var45, (double)var51, (double)var55); + } + } + + this.renderMinY = var18; + this.renderMaxY = var20; + return var13; + } + } + + /** + * Get fluid height + */ + private float getFluidHeight(int par1, int par2, int par3, Material par4Material) + { + int var5 = 0; + float var6 = 0.0F; + + for (int var7 = 0; var7 < 4; ++var7) + { + int var8 = par1 - (var7 & 1); + int var10 = par3 - (var7 >> 1 & 1); + + if (this.blockAccess.getBlockMaterial(var8, par2 + 1, var10) == par4Material) + { + return 1.0F; + } + + Material var11 = this.blockAccess.getBlockMaterial(var8, par2, var10); + + if (var11 == par4Material) + { + int var12 = this.blockAccess.getBlockMetadata(var8, par2, var10); + + if (var12 >= 8 || var12 == 0) + { + var6 += BlockFluid.getFluidHeightPercent(var12) * 10.0F; + var5 += 10; + } + + var6 += BlockFluid.getFluidHeightPercent(var12); + ++var5; + } + else if (!var11.isSolid()) + { + ++var6; + ++var5; + } + } + + return 1.0F - var6 / (float)var5; + } + + /** + * Renders a falling sand block + */ + public void renderBlockSandFalling(Block par1Block, World par2World, int par3, int par4, int par5, int par6) + { + float var7 = 0.5F; + float var8 = 1.0F; + float var9 = 0.8F; + float var10 = 0.6F; + Tessellator var11 = Tessellator.instance; + var11.startDrawingQuads(); + var11.setBrightness(par1Block.getMixedBrightnessForBlock(par2World, par3, par4, par5)); + float var12 = 1.0F; + float var13 = 1.0F; + + if (var13 < var12) + { + var13 = var12; + } + + var11.setColorOpaque_F(var7 * var13, var7 * var13, var7 * var13); + this.renderFaceYNeg(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 0, par6)); + var13 = 1.0F; + + if (var13 < var12) + { + var13 = var12; + } + + var11.setColorOpaque_F(var8 * var13, var8 * var13, var8 * var13); + this.renderFaceYPos(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 1, par6)); + var13 = 1.0F; + + if (var13 < var12) + { + var13 = var12; + } + + var11.setColorOpaque_F(var9 * var13, var9 * var13, var9 * var13); + this.renderFaceZNeg(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 2, par6)); + var13 = 1.0F; + + if (var13 < var12) + { + var13 = var12; + } + + var11.setColorOpaque_F(var9 * var13, var9 * var13, var9 * var13); + this.renderFaceZPos(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 3, par6)); + var13 = 1.0F; + + if (var13 < var12) + { + var13 = var12; + } + + var11.setColorOpaque_F(var10 * var13, var10 * var13, var10 * var13); + this.renderFaceXNeg(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 4, par6)); + var13 = 1.0F; + + if (var13 < var12) + { + var13 = var12; + } + + var11.setColorOpaque_F(var10 * var13, var10 * var13, var10 * var13); + this.renderFaceXPos(par1Block, -0.5D, -0.5D, -0.5D, this.getBlockIconFromSideAndMetadata(par1Block, 5, par6)); + var11.draw(); + } + + /** + * Renders a standard cube block at the given coordinates + */ + public boolean renderStandardBlock(Block par1Block, int par2, int par3, int par4) + { + int var5 = par1Block.colorMultiplier(this.blockAccess, par2, par3, par4); + float var6 = (float)(var5 >> 16 & 255) / 255.0F; + float var7 = (float)(var5 >> 8 & 255) / 255.0F; + float var8 = (float)(var5 & 255) / 255.0F; + + if (EntityRenderer.anaglyphEnable) + { + float var9 = (var6 * 30.0F + var7 * 59.0F + var8 * 11.0F) / 100.0F; + float var10 = (var6 * 30.0F + var7 * 70.0F) / 100.0F; + float var11 = (var6 * 30.0F + var8 * 70.0F) / 100.0F; + var6 = var9; + var7 = var10; + var8 = var11; + } + + return Minecraft.isAmbientOcclusionEnabled() && Block.lightValue[par1Block.blockID] == 0 ? (this.partialRenderBounds ? this.renderStandardBlockWithAmbientOcclusionPartial(par1Block, par2, par3, par4, var6, var7, var8) : this.renderStandardBlockWithAmbientOcclusion(par1Block, par2, par3, par4, var6, var7, var8)) : this.renderStandardBlockWithColorMultiplier(par1Block, par2, par3, par4, var6, var7, var8); + } + + /** + * Renders a log block at the given coordinates + */ + public boolean renderBlockLog(Block par1Block, int par2, int par3, int par4) + { + int var5 = this.blockAccess.getBlockMetadata(par2, par3, par4); + int var6 = var5 & 12; + + if (var6 == 4) + { + this.uvRotateEast = 1; + this.uvRotateWest = 1; + this.uvRotateTop = 1; + this.uvRotateBottom = 1; + } + else if (var6 == 8) + { + this.uvRotateSouth = 1; + this.uvRotateNorth = 1; + } + + boolean var7 = this.renderStandardBlock(par1Block, par2, par3, par4); + this.uvRotateSouth = 0; + this.uvRotateEast = 0; + this.uvRotateWest = 0; + this.uvRotateNorth = 0; + this.uvRotateTop = 0; + this.uvRotateBottom = 0; + return var7; + } + + public boolean renderBlockQuartz(Block par1Block, int par2, int par3, int par4) + { + int var5 = this.blockAccess.getBlockMetadata(par2, par3, par4); + + if (var5 == 3) + { + this.uvRotateEast = 1; + this.uvRotateWest = 1; + this.uvRotateTop = 1; + this.uvRotateBottom = 1; + } + else if (var5 == 4) + { + this.uvRotateSouth = 1; + this.uvRotateNorth = 1; + } + + boolean var6 = this.renderStandardBlock(par1Block, par2, par3, par4); + this.uvRotateSouth = 0; + this.uvRotateEast = 0; + this.uvRotateWest = 0; + this.uvRotateNorth = 0; + this.uvRotateTop = 0; + this.uvRotateBottom = 0; + return var6; + } + + public boolean renderStandardBlockWithAmbientOcclusion(Block par1Block, int par2, int par3, int par4, float par5, float par6, float par7) + { + this.enableAO = true; + boolean var8 = false; + float var9 = 0.0F; + float var10 = 0.0F; + float var11 = 0.0F; + float var12 = 0.0F; + boolean var13 = true; + int var14 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4); + Tessellator var15 = Tessellator.instance; + var15.setBrightness(983055); + + if (this.getBlockIcon(par1Block).getIconName().equals("grass_top")) + { + var13 = false; + } + else if (this.hasOverrideBlockTexture()) + { + var13 = false; + } + + boolean var16; + boolean var17; + boolean var18; + boolean var19; + int var20; + float var21; + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0)) + { + if (this.renderMinY <= 0.0D) + { + --par3; + } + + this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4); + this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1); + this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1); + this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4); + this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4); + this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1); + this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1); + this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 - 1, par4)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 - 1, par4)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 + 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 - 1)]; + + if (!var19 && !var17) + { + this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; + this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; + } + else + { + this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 - 1); + this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 - 1); + } + + if (!var18 && !var17) + { + this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXYNN; + this.aoBrightnessXYZNNP = this.aoBrightnessXYNN; + } + else + { + this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 + 1); + this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 + 1); + } + + if (!var19 && !var16) + { + this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXYPN; + this.aoBrightnessXYZPNN = this.aoBrightnessXYPN; + } + else + { + this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 - 1); + this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 - 1); + } + + if (!var18 && !var16) + { + this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXYPN; + this.aoBrightnessXYZPNP = this.aoBrightnessXYPN; + } + else + { + this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 + 1); + this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 + 1); + } + + if (this.renderMinY <= 0.0D) + { + ++par3; + } + + var20 = var14; + + if (this.renderMinY <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3 - 1, par4)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4); + var9 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXYNN + this.aoLightValueScratchYZNP + var21) / 4.0F; + var12 = (this.aoLightValueScratchYZNP + var21 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXYPN) / 4.0F; + var11 = (var21 + this.aoLightValueScratchYZNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNN) / 4.0F; + var10 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNN + var21 + this.aoLightValueScratchYZNN) / 4.0F; + this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXYNN, this.aoBrightnessYZNP, var20); + this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXYPN, var20); + this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYPN, this.aoBrightnessXYZPNN, var20); + this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNN, this.aoBrightnessYZNN, var20); + + if (var13) + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.5F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.5F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.5F; + } + else + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.5F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.5F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.5F; + } + + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + this.renderFaceYNeg(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0)); + var8 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1)) + { + if (this.renderMaxY >= 1.0D) + { + ++par3; + } + + this.aoBrightnessXYNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4); + this.aoBrightnessXYPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4); + this.aoBrightnessYZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1); + this.aoBrightnessYZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1); + this.aoLightValueScratchXYNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4); + this.aoLightValueScratchXYPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4); + this.aoLightValueScratchYZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1); + this.aoLightValueScratchYZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 + 1, par4)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 + 1, par4)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 + 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 - 1)]; + + if (!var19 && !var17) + { + this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXYNP; + this.aoBrightnessXYZNPN = this.aoBrightnessXYNP; + } + else + { + this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 - 1); + this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 - 1); + } + + if (!var19 && !var16) + { + this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXYPP; + this.aoBrightnessXYZPPN = this.aoBrightnessXYPP; + } + else + { + this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 - 1); + this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 - 1); + } + + if (!var18 && !var17) + { + this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXYNP; + this.aoBrightnessXYZNPP = this.aoBrightnessXYNP; + } + else + { + this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 + 1); + this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 + 1); + } + + if (!var18 && !var16) + { + this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXYPP; + this.aoBrightnessXYZPPP = this.aoBrightnessXYPP; + } + else + { + this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 + 1); + this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 + 1); + } + + if (this.renderMaxY >= 1.0D) + { + --par3; + } + + var20 = var14; + + if (this.renderMaxY >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3 + 1, par4)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4); + var12 = (this.aoLightValueScratchXYZNPP + this.aoLightValueScratchXYNP + this.aoLightValueScratchYZPP + var21) / 4.0F; + var9 = (this.aoLightValueScratchYZPP + var21 + this.aoLightValueScratchXYZPPP + this.aoLightValueScratchXYPP) / 4.0F; + var10 = (var21 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPN) / 4.0F; + var11 = (this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPN + var21 + this.aoLightValueScratchYZPN) / 4.0F; + this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessXYZNPP, this.aoBrightnessXYNP, this.aoBrightnessYZPP, var20); + this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXYZPPP, this.aoBrightnessXYPP, var20); + this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXYPP, this.aoBrightnessXYZPPN, var20); + this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessXYNP, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, var20); + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7; + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + this.renderFaceYPos(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1)); + var8 = true; + } + + Icon var22; + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2)) + { + if (this.renderMinZ <= 0.0D) + { + --par4; + } + + this.aoLightValueScratchXZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4); + this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4); + this.aoLightValueScratchYZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4); + this.aoLightValueScratchXZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4); + this.aoBrightnessXZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4); + this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4); + this.aoBrightnessYZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4); + this.aoBrightnessXZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 - 1)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 - 1)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 - 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 - 1)]; + + if (!var17 && !var19) + { + this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN; + this.aoBrightnessXYZNNN = this.aoBrightnessXZNN; + } + else + { + this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 - 1, par4); + this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 - 1, par4); + } + + if (!var17 && !var18) + { + this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN; + this.aoBrightnessXYZNPN = this.aoBrightnessXZNN; + } + else + { + this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 + 1, par4); + this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 + 1, par4); + } + + if (!var16 && !var19) + { + this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN; + this.aoBrightnessXYZPNN = this.aoBrightnessXZPN; + } + else + { + this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 - 1, par4); + this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 - 1, par4); + } + + if (!var16 && !var18) + { + this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN; + this.aoBrightnessXYZPPN = this.aoBrightnessXZPN; + } + else + { + this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 + 1, par4); + this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 + 1, par4); + } + + if (this.renderMinZ <= 0.0D) + { + ++par4; + } + + var20 = var14; + + if (this.renderMinZ <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3, par4 - 1)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1); + var9 = (this.aoLightValueScratchXZNN + this.aoLightValueScratchXYZNPN + var21 + this.aoLightValueScratchYZPN) / 4.0F; + var10 = (var21 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXZPN + this.aoLightValueScratchXYZPPN) / 4.0F; + var11 = (this.aoLightValueScratchYZNN + var21 + this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXZPN) / 4.0F; + var12 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXZNN + this.aoLightValueScratchYZNN + var21) / 4.0F; + this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, var20); + this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, var20); + this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYZPNN, this.aoBrightnessXZPN, var20); + this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXZNN, this.aoBrightnessYZNN, var20); + + if (var13) + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.8F; + } + else + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F; + } + + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var22 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2); + this.renderFaceZNeg(par1Block, (double)par2, (double)par3, (double)par4, var22); + + if (fancyGrass && var22.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; + this.colorRedBottomRight *= par5; + this.colorRedTopRight *= par5; + this.colorGreenTopLeft *= par6; + this.colorGreenBottomLeft *= par6; + this.colorGreenBottomRight *= par6; + this.colorGreenTopRight *= par6; + this.colorBlueTopLeft *= par7; + this.colorBlueBottomLeft *= par7; + this.colorBlueBottomRight *= par7; + this.colorBlueTopRight *= par7; + this.renderFaceZNeg(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var8 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3)) + { + if (this.renderMaxZ >= 1.0D) + { + ++par4; + } + + this.aoLightValueScratchXZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4); + this.aoLightValueScratchXZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4); + this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4); + this.aoLightValueScratchYZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4); + this.aoBrightnessXZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4); + this.aoBrightnessXZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4); + this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4); + this.aoBrightnessYZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 + 1)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 + 1)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 + 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 + 1)]; + + if (!var17 && !var19) + { + this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP; + this.aoBrightnessXYZNNP = this.aoBrightnessXZNP; + } + else + { + this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 - 1, par4); + this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 - 1, par4); + } + + if (!var17 && !var18) + { + this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP; + this.aoBrightnessXYZNPP = this.aoBrightnessXZNP; + } + else + { + this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 + 1, par4); + this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 + 1, par4); + } + + if (!var16 && !var19) + { + this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP; + this.aoBrightnessXYZPNP = this.aoBrightnessXZPP; + } + else + { + this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 - 1, par4); + this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 - 1, par4); + } + + if (!var16 && !var18) + { + this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP; + this.aoBrightnessXYZPPP = this.aoBrightnessXZPP; + } + else + { + this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 + 1, par4); + this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 + 1, par4); + } + + if (this.renderMaxZ >= 1.0D) + { + --par4; + } + + var20 = var14; + + if (this.renderMaxZ >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3, par4 + 1)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1); + var9 = (this.aoLightValueScratchXZNP + this.aoLightValueScratchXYZNPP + var21 + this.aoLightValueScratchYZPP) / 4.0F; + var12 = (var21 + this.aoLightValueScratchYZPP + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYZPPP) / 4.0F; + var11 = (this.aoLightValueScratchYZNP + var21 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXZPP) / 4.0F; + var10 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXZNP + this.aoLightValueScratchYZNP + var21) / 4.0F; + this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYZNPP, this.aoBrightnessYZPP, var20); + this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXZPP, this.aoBrightnessXYZPPP, var20); + this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, var20); + this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, this.aoBrightnessYZNP, var20); + + if (var13) + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.8F; + } + else + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F; + } + + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var22 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3); + this.renderFaceZPos(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3)); + + if (fancyGrass && var22.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; + this.colorRedBottomRight *= par5; + this.colorRedTopRight *= par5; + this.colorGreenTopLeft *= par6; + this.colorGreenBottomLeft *= par6; + this.colorGreenBottomRight *= par6; + this.colorGreenTopRight *= par6; + this.colorBlueTopLeft *= par7; + this.colorBlueBottomLeft *= par7; + this.colorBlueBottomRight *= par7; + this.colorBlueTopRight *= par7; + this.renderFaceZPos(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var8 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4)) + { + if (this.renderMinX <= 0.0D) + { + --par2; + } + + this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4); + this.aoLightValueScratchXZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1); + this.aoLightValueScratchXZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1); + this.aoLightValueScratchXYNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4); + this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4); + this.aoBrightnessXZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1); + this.aoBrightnessXZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1); + this.aoBrightnessXYNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 + 1, par4)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 - 1, par4)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 - 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 + 1)]; + + if (!var18 && !var17) + { + this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN; + this.aoBrightnessXYZNNN = this.aoBrightnessXZNN; + } + else + { + this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 - 1); + this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 - 1); + } + + if (!var19 && !var17) + { + this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP; + this.aoBrightnessXYZNNP = this.aoBrightnessXZNP; + } + else + { + this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 + 1); + this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 + 1); + } + + if (!var18 && !var16) + { + this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN; + this.aoBrightnessXYZNPN = this.aoBrightnessXZNN; + } + else + { + this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 - 1); + this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 - 1); + } + + if (!var19 && !var16) + { + this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP; + this.aoBrightnessXYZNPP = this.aoBrightnessXZNP; + } + else + { + this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 + 1); + this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 + 1); + } + + if (this.renderMinX <= 0.0D) + { + ++par2; + } + + var20 = var14; + + if (this.renderMinX <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2 - 1, par3, par4)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4); + var12 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNP + var21 + this.aoLightValueScratchXZNP) / 4.0F; + var9 = (var21 + this.aoLightValueScratchXZNP + this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPP) / 4.0F; + var10 = (this.aoLightValueScratchXZNN + var21 + this.aoLightValueScratchXYZNPN + this.aoLightValueScratchXYNP) / 4.0F; + var11 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXYNN + this.aoLightValueScratchXZNN + var21) / 4.0F; + this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, var20); + this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYNP, this.aoBrightnessXYZNPP, var20); + this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessXYNP, var20); + this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXYNN, this.aoBrightnessXZNN, var20); + + if (var13) + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.6F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.6F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.6F; + } + else + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F; + } + + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var22 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4); + this.renderFaceXNeg(par1Block, (double)par2, (double)par3, (double)par4, var22); + + if (fancyGrass && var22.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; + this.colorRedBottomRight *= par5; + this.colorRedTopRight *= par5; + this.colorGreenTopLeft *= par6; + this.colorGreenBottomLeft *= par6; + this.colorGreenBottomRight *= par6; + this.colorGreenTopRight *= par6; + this.colorBlueTopLeft *= par7; + this.colorBlueBottomLeft *= par7; + this.colorBlueBottomRight *= par7; + this.colorBlueTopRight *= par7; + this.renderFaceXNeg(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var8 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5)) + { + if (this.renderMaxX >= 1.0D) + { + ++par2; + } + + this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4); + this.aoLightValueScratchXZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1); + this.aoLightValueScratchXZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1); + this.aoLightValueScratchXYPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4); + this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4); + this.aoBrightnessXZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1); + this.aoBrightnessXZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1); + this.aoBrightnessXYPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 + 1, par4)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 - 1, par4)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 + 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 - 1)]; + + if (!var17 && !var19) + { + this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN; + this.aoBrightnessXYZPNN = this.aoBrightnessXZPN; + } + else + { + this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 - 1); + this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 - 1); + } + + if (!var17 && !var18) + { + this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP; + this.aoBrightnessXYZPNP = this.aoBrightnessXZPP; + } + else + { + this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 + 1); + this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 + 1); + } + + if (!var16 && !var19) + { + this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN; + this.aoBrightnessXYZPPN = this.aoBrightnessXZPN; + } + else + { + this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 - 1); + this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 - 1); + } + + if (!var16 && !var18) + { + this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP; + this.aoBrightnessXYZPPP = this.aoBrightnessXZPP; + } + else + { + this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 + 1); + this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 + 1); + } + + if (this.renderMaxX >= 1.0D) + { + --par2; + } + + var20 = var14; + + if (this.renderMaxX >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2 + 1, par3, par4)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4); + var9 = (this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNP + var21 + this.aoLightValueScratchXZPP) / 4.0F; + var10 = (this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXZPN + var21) / 4.0F; + var11 = (this.aoLightValueScratchXZPN + var21 + this.aoLightValueScratchXYZPPN + this.aoLightValueScratchXYPP) / 4.0F; + var12 = (var21 + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPP) / 4.0F; + this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXYPN, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, var20); + this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessXZPP, this.aoBrightnessXYPP, this.aoBrightnessXYZPPP, var20); + this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, this.aoBrightnessXYPP, var20); + this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessXYZPNN, this.aoBrightnessXYPN, this.aoBrightnessXZPN, var20); + + if (var13) + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.6F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.6F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.6F; + } + else + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F; + } + + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var22 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5); + this.renderFaceXPos(par1Block, (double)par2, (double)par3, (double)par4, var22); + + if (fancyGrass && var22.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; + this.colorRedBottomRight *= par5; + this.colorRedTopRight *= par5; + this.colorGreenTopLeft *= par6; + this.colorGreenBottomLeft *= par6; + this.colorGreenBottomRight *= par6; + this.colorGreenTopRight *= par6; + this.colorBlueTopLeft *= par7; + this.colorBlueBottomLeft *= par7; + this.colorBlueBottomRight *= par7; + this.colorBlueTopRight *= par7; + this.renderFaceXPos(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var8 = true; + } + + this.enableAO = false; + return var8; + } + + /** + * Renders non-full-cube block with ambient occusion. Args: block, x, y, z, red, green, blue (lighting) + */ + public boolean renderStandardBlockWithAmbientOcclusionPartial(Block par1Block, int par2, int par3, int par4, float par5, float par6, float par7) + { + this.enableAO = true; + boolean var8 = false; + float var9 = 0.0F; + float var10 = 0.0F; + float var11 = 0.0F; + float var12 = 0.0F; + boolean var13 = true; + int var14 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4); + Tessellator var15 = Tessellator.instance; + var15.setBrightness(983055); + + if (this.getBlockIcon(par1Block).getIconName().equals("grass_top")) + { + var13 = false; + } + else if (this.hasOverrideBlockTexture()) + { + var13 = false; + } + + boolean var16; + boolean var17; + boolean var18; + boolean var19; + int var20; + float var21; + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0)) + { + if (this.renderMinY <= 0.0D) + { + --par3; + } + + this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4); + this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1); + this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1); + this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4); + this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4); + this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1); + this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1); + this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 - 1, par4)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 - 1, par4)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 + 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 - 1)]; + + if (!var19 && !var17) + { + this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXYNN; + this.aoBrightnessXYZNNN = this.aoBrightnessXYNN; + } + else + { + this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 - 1); + this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 - 1); + } + + if (!var18 && !var17) + { + this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXYNN; + this.aoBrightnessXYZNNP = this.aoBrightnessXYNN; + } + else + { + this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 + 1); + this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 + 1); + } + + if (!var19 && !var16) + { + this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXYPN; + this.aoBrightnessXYZPNN = this.aoBrightnessXYPN; + } + else + { + this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 - 1); + this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 - 1); + } + + if (!var18 && !var16) + { + this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXYPN; + this.aoBrightnessXYZPNP = this.aoBrightnessXYPN; + } + else + { + this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 + 1); + this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 + 1); + } + + if (this.renderMinY <= 0.0D) + { + ++par3; + } + + var20 = var14; + + if (this.renderMinY <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3 - 1, par4)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4); + var9 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXYNN + this.aoLightValueScratchYZNP + var21) / 4.0F; + var12 = (this.aoLightValueScratchYZNP + var21 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXYPN) / 4.0F; + var11 = (var21 + this.aoLightValueScratchYZNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNN) / 4.0F; + var10 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNN + var21 + this.aoLightValueScratchYZNN) / 4.0F; + this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXYNN, this.aoBrightnessYZNP, var20); + this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXYPN, var20); + this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYPN, this.aoBrightnessXYZPNN, var20); + this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNN, this.aoBrightnessYZNN, var20); + + if (var13) + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.5F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.5F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.5F; + } + else + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.5F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.5F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.5F; + } + + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + this.renderFaceYNeg(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0)); + var8 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1)) + { + if (this.renderMaxY >= 1.0D) + { + ++par3; + } + + this.aoBrightnessXYNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4); + this.aoBrightnessXYPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4); + this.aoBrightnessYZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1); + this.aoBrightnessYZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1); + this.aoLightValueScratchXYNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4); + this.aoLightValueScratchXYPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4); + this.aoLightValueScratchYZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1); + this.aoLightValueScratchYZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 + 1, par4)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 + 1, par4)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 + 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 - 1)]; + + if (!var19 && !var17) + { + this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXYNP; + this.aoBrightnessXYZNPN = this.aoBrightnessXYNP; + } + else + { + this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 - 1); + this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 - 1); + } + + if (!var19 && !var16) + { + this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXYPP; + this.aoBrightnessXYZPPN = this.aoBrightnessXYPP; + } + else + { + this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 - 1); + this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 - 1); + } + + if (!var18 && !var17) + { + this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXYNP; + this.aoBrightnessXYZNPP = this.aoBrightnessXYNP; + } + else + { + this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4 + 1); + this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4 + 1); + } + + if (!var18 && !var16) + { + this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXYPP; + this.aoBrightnessXYZPPP = this.aoBrightnessXYPP; + } + else + { + this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4 + 1); + this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4 + 1); + } + + if (this.renderMaxY >= 1.0D) + { + --par3; + } + + var20 = var14; + + if (this.renderMaxY >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3 + 1, par4)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4); + var12 = (this.aoLightValueScratchXYZNPP + this.aoLightValueScratchXYNP + this.aoLightValueScratchYZPP + var21) / 4.0F; + var9 = (this.aoLightValueScratchYZPP + var21 + this.aoLightValueScratchXYZPPP + this.aoLightValueScratchXYPP) / 4.0F; + var10 = (var21 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPN) / 4.0F; + var11 = (this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPN + var21 + this.aoLightValueScratchYZPN) / 4.0F; + this.brightnessTopRight = this.getAoBrightness(this.aoBrightnessXYZNPP, this.aoBrightnessXYNP, this.aoBrightnessYZPP, var20); + this.brightnessTopLeft = this.getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXYZPPP, this.aoBrightnessXYPP, var20); + this.brightnessBottomLeft = this.getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXYPP, this.aoBrightnessXYZPPN, var20); + this.brightnessBottomRight = this.getAoBrightness(this.aoBrightnessXYNP, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, var20); + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7; + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + this.renderFaceYPos(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1)); + var8 = true; + } + + float var22; + float var23; + float var24; + float var25; + int var26; + int var27; + int var28; + int var29; + Icon var30; + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2)) + { + if (this.renderMinZ <= 0.0D) + { + --par4; + } + + this.aoLightValueScratchXZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4); + this.aoLightValueScratchYZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4); + this.aoLightValueScratchYZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4); + this.aoLightValueScratchXZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4); + this.aoBrightnessXZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4); + this.aoBrightnessYZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4); + this.aoBrightnessYZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4); + this.aoBrightnessXZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 - 1)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 - 1)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 - 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 - 1)]; + + if (!var17 && !var19) + { + this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN; + this.aoBrightnessXYZNNN = this.aoBrightnessXZNN; + } + else + { + this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 - 1, par4); + this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 - 1, par4); + } + + if (!var17 && !var18) + { + this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN; + this.aoBrightnessXYZNPN = this.aoBrightnessXZNN; + } + else + { + this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 + 1, par4); + this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 + 1, par4); + } + + if (!var16 && !var19) + { + this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN; + this.aoBrightnessXYZPNN = this.aoBrightnessXZPN; + } + else + { + this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 - 1, par4); + this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 - 1, par4); + } + + if (!var16 && !var18) + { + this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN; + this.aoBrightnessXYZPPN = this.aoBrightnessXZPN; + } + else + { + this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 + 1, par4); + this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 + 1, par4); + } + + if (this.renderMinZ <= 0.0D) + { + ++par4; + } + + var20 = var14; + + if (this.renderMinZ <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3, par4 - 1)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1); + var22 = (this.aoLightValueScratchXZNN + this.aoLightValueScratchXYZNPN + var21 + this.aoLightValueScratchYZPN) / 4.0F; + var23 = (var21 + this.aoLightValueScratchYZPN + this.aoLightValueScratchXZPN + this.aoLightValueScratchXYZPPN) / 4.0F; + var24 = (this.aoLightValueScratchYZNN + var21 + this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXZPN) / 4.0F; + var25 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXZNN + this.aoLightValueScratchYZNN + var21) / 4.0F; + var9 = (float)((double)var22 * this.renderMaxY * (1.0D - this.renderMinX) + (double)var23 * this.renderMinY * this.renderMinX + (double)var24 * (1.0D - this.renderMaxY) * this.renderMinX + (double)var25 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinX)); + var10 = (float)((double)var22 * this.renderMaxY * (1.0D - this.renderMaxX) + (double)var23 * this.renderMaxY * this.renderMaxX + (double)var24 * (1.0D - this.renderMaxY) * this.renderMaxX + (double)var25 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX)); + var11 = (float)((double)var22 * this.renderMinY * (1.0D - this.renderMaxX) + (double)var23 * this.renderMinY * this.renderMaxX + (double)var24 * (1.0D - this.renderMinY) * this.renderMaxX + (double)var25 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxX)); + var12 = (float)((double)var22 * this.renderMinY * (1.0D - this.renderMinX) + (double)var23 * this.renderMinY * this.renderMinX + (double)var24 * (1.0D - this.renderMinY) * this.renderMinX + (double)var25 * (1.0D - this.renderMinY) * (1.0D - this.renderMinX)); + var26 = this.getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessYZPN, var20); + var27 = this.getAoBrightness(this.aoBrightnessYZPN, this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, var20); + var28 = this.getAoBrightness(this.aoBrightnessYZNN, this.aoBrightnessXYZPNN, this.aoBrightnessXZPN, var20); + var29 = this.getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXZNN, this.aoBrightnessYZNN, var20); + this.brightnessTopLeft = this.mixAoBrightness(var26, var27, var28, var29, this.renderMaxY * (1.0D - this.renderMinX), this.renderMaxY * this.renderMinX, (1.0D - this.renderMaxY) * this.renderMinX, (1.0D - this.renderMaxY) * (1.0D - this.renderMinX)); + this.brightnessBottomLeft = this.mixAoBrightness(var26, var27, var28, var29, this.renderMaxY * (1.0D - this.renderMaxX), this.renderMaxY * this.renderMaxX, (1.0D - this.renderMaxY) * this.renderMaxX, (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX)); + this.brightnessBottomRight = this.mixAoBrightness(var26, var27, var28, var29, this.renderMinY * (1.0D - this.renderMaxX), this.renderMinY * this.renderMaxX, (1.0D - this.renderMinY) * this.renderMaxX, (1.0D - this.renderMinY) * (1.0D - this.renderMaxX)); + this.brightnessTopRight = this.mixAoBrightness(var26, var27, var28, var29, this.renderMinY * (1.0D - this.renderMinX), this.renderMinY * this.renderMinX, (1.0D - this.renderMinY) * this.renderMinX, (1.0D - this.renderMinY) * (1.0D - this.renderMinX)); + + if (var13) + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.8F; + } + else + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F; + } + + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var30 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2); + this.renderFaceZNeg(par1Block, (double)par2, (double)par3, (double)par4, var30); + + if (fancyGrass && var30.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; + this.colorRedBottomRight *= par5; + this.colorRedTopRight *= par5; + this.colorGreenTopLeft *= par6; + this.colorGreenBottomLeft *= par6; + this.colorGreenBottomRight *= par6; + this.colorGreenTopRight *= par6; + this.colorBlueTopLeft *= par7; + this.colorBlueBottomLeft *= par7; + this.colorBlueBottomRight *= par7; + this.colorBlueTopRight *= par7; + this.renderFaceZNeg(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var8 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3)) + { + if (this.renderMaxZ >= 1.0D) + { + ++par4; + } + + this.aoLightValueScratchXZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4); + this.aoLightValueScratchXZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4); + this.aoLightValueScratchYZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4); + this.aoLightValueScratchYZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4); + this.aoBrightnessXZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4); + this.aoBrightnessXZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4); + this.aoBrightnessYZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4); + this.aoBrightnessYZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 + 1)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 + 1)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 + 1, par4 + 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2, par3 - 1, par4 + 1)]; + + if (!var17 && !var19) + { + this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP; + this.aoBrightnessXYZNNP = this.aoBrightnessXZNP; + } + else + { + this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 - 1, par4); + this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 - 1, par4); + } + + if (!var17 && !var18) + { + this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP; + this.aoBrightnessXYZNPP = this.aoBrightnessXZNP; + } + else + { + this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3 + 1, par4); + this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3 + 1, par4); + } + + if (!var16 && !var19) + { + this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP; + this.aoBrightnessXYZPNP = this.aoBrightnessXZPP; + } + else + { + this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 - 1, par4); + this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 - 1, par4); + } + + if (!var16 && !var18) + { + this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP; + this.aoBrightnessXYZPPP = this.aoBrightnessXZPP; + } + else + { + this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3 + 1, par4); + this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3 + 1, par4); + } + + if (this.renderMaxZ >= 1.0D) + { + --par4; + } + + var20 = var14; + + if (this.renderMaxZ >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2, par3, par4 + 1)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1); + var22 = (this.aoLightValueScratchXZNP + this.aoLightValueScratchXYZNPP + var21 + this.aoLightValueScratchYZPP) / 4.0F; + var23 = (var21 + this.aoLightValueScratchYZPP + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYZPPP) / 4.0F; + var24 = (this.aoLightValueScratchYZNP + var21 + this.aoLightValueScratchXYZPNP + this.aoLightValueScratchXZPP) / 4.0F; + var25 = (this.aoLightValueScratchXYZNNP + this.aoLightValueScratchXZNP + this.aoLightValueScratchYZNP + var21) / 4.0F; + var9 = (float)((double)var22 * this.renderMaxY * (1.0D - this.renderMinX) + (double)var23 * this.renderMaxY * this.renderMinX + (double)var24 * (1.0D - this.renderMaxY) * this.renderMinX + (double)var25 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinX)); + var10 = (float)((double)var22 * this.renderMinY * (1.0D - this.renderMinX) + (double)var23 * this.renderMinY * this.renderMinX + (double)var24 * (1.0D - this.renderMinY) * this.renderMinX + (double)var25 * (1.0D - this.renderMinY) * (1.0D - this.renderMinX)); + var11 = (float)((double)var22 * this.renderMinY * (1.0D - this.renderMaxX) + (double)var23 * this.renderMinY * this.renderMaxX + (double)var24 * (1.0D - this.renderMinY) * this.renderMaxX + (double)var25 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxX)); + var12 = (float)((double)var22 * this.renderMaxY * (1.0D - this.renderMaxX) + (double)var23 * this.renderMaxY * this.renderMaxX + (double)var24 * (1.0D - this.renderMaxY) * this.renderMaxX + (double)var25 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX)); + var26 = this.getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYZNPP, this.aoBrightnessYZPP, var20); + var27 = this.getAoBrightness(this.aoBrightnessYZPP, this.aoBrightnessXZPP, this.aoBrightnessXYZPPP, var20); + var28 = this.getAoBrightness(this.aoBrightnessYZNP, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, var20); + var29 = this.getAoBrightness(this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, this.aoBrightnessYZNP, var20); + this.brightnessTopLeft = this.mixAoBrightness(var26, var29, var28, var27, this.renderMaxY * (1.0D - this.renderMinX), (1.0D - this.renderMaxY) * (1.0D - this.renderMinX), (1.0D - this.renderMaxY) * this.renderMinX, this.renderMaxY * this.renderMinX); + this.brightnessBottomLeft = this.mixAoBrightness(var26, var29, var28, var27, this.renderMinY * (1.0D - this.renderMinX), (1.0D - this.renderMinY) * (1.0D - this.renderMinX), (1.0D - this.renderMinY) * this.renderMinX, this.renderMinY * this.renderMinX); + this.brightnessBottomRight = this.mixAoBrightness(var26, var29, var28, var27, this.renderMinY * (1.0D - this.renderMaxX), (1.0D - this.renderMinY) * (1.0D - this.renderMaxX), (1.0D - this.renderMinY) * this.renderMaxX, this.renderMinY * this.renderMaxX); + this.brightnessTopRight = this.mixAoBrightness(var26, var29, var28, var27, this.renderMaxY * (1.0D - this.renderMaxX), (1.0D - this.renderMaxY) * (1.0D - this.renderMaxX), (1.0D - this.renderMaxY) * this.renderMaxX, this.renderMaxY * this.renderMaxX); + + if (var13) + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.8F; + } + else + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.8F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.8F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.8F; + } + + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var30 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3); + this.renderFaceZPos(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3)); + + if (fancyGrass && var30.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; + this.colorRedBottomRight *= par5; + this.colorRedTopRight *= par5; + this.colorGreenTopLeft *= par6; + this.colorGreenBottomLeft *= par6; + this.colorGreenBottomRight *= par6; + this.colorGreenTopRight *= par6; + this.colorBlueTopLeft *= par7; + this.colorBlueBottomLeft *= par7; + this.colorBlueBottomRight *= par7; + this.colorBlueTopRight *= par7; + this.renderFaceZPos(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var8 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4)) + { + if (this.renderMinX <= 0.0D) + { + --par2; + } + + this.aoLightValueScratchXYNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4); + this.aoLightValueScratchXZNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1); + this.aoLightValueScratchXZNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1); + this.aoLightValueScratchXYNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4); + this.aoBrightnessXYNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4); + this.aoBrightnessXZNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1); + this.aoBrightnessXZNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1); + this.aoBrightnessXYNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 + 1, par4)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3 - 1, par4)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 - 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 - 1, par3, par4 + 1)]; + + if (!var18 && !var17) + { + this.aoLightValueScratchXYZNNN = this.aoLightValueScratchXZNN; + this.aoBrightnessXYZNNN = this.aoBrightnessXZNN; + } + else + { + this.aoLightValueScratchXYZNNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 - 1); + this.aoBrightnessXYZNNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 - 1); + } + + if (!var19 && !var17) + { + this.aoLightValueScratchXYZNNP = this.aoLightValueScratchXZNP; + this.aoBrightnessXYZNNP = this.aoBrightnessXZNP; + } + else + { + this.aoLightValueScratchXYZNNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 + 1); + this.aoBrightnessXYZNNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 + 1); + } + + if (!var18 && !var16) + { + this.aoLightValueScratchXYZNPN = this.aoLightValueScratchXZNN; + this.aoBrightnessXYZNPN = this.aoBrightnessXZNN; + } + else + { + this.aoLightValueScratchXYZNPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 - 1); + this.aoBrightnessXYZNPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 - 1); + } + + if (!var19 && !var16) + { + this.aoLightValueScratchXYZNPP = this.aoLightValueScratchXZNP; + this.aoBrightnessXYZNPP = this.aoBrightnessXZNP; + } + else + { + this.aoLightValueScratchXYZNPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 + 1); + this.aoBrightnessXYZNPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 + 1); + } + + if (this.renderMinX <= 0.0D) + { + ++par2; + } + + var20 = var14; + + if (this.renderMinX <= 0.0D || !this.blockAccess.isBlockOpaqueCube(par2 - 1, par3, par4)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 - 1, par3, par4); + var22 = (this.aoLightValueScratchXYNN + this.aoLightValueScratchXYZNNP + var21 + this.aoLightValueScratchXZNP) / 4.0F; + var23 = (var21 + this.aoLightValueScratchXZNP + this.aoLightValueScratchXYNP + this.aoLightValueScratchXYZNPP) / 4.0F; + var24 = (this.aoLightValueScratchXZNN + var21 + this.aoLightValueScratchXYZNPN + this.aoLightValueScratchXYNP) / 4.0F; + var25 = (this.aoLightValueScratchXYZNNN + this.aoLightValueScratchXYNN + this.aoLightValueScratchXZNN + var21) / 4.0F; + var9 = (float)((double)var23 * this.renderMaxY * this.renderMaxZ + (double)var24 * this.renderMaxY * (1.0D - this.renderMaxZ) + (double)var25 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ) + (double)var22 * (1.0D - this.renderMaxY) * this.renderMaxZ); + var10 = (float)((double)var23 * this.renderMaxY * this.renderMinZ + (double)var24 * this.renderMaxY * (1.0D - this.renderMinZ) + (double)var25 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ) + (double)var22 * (1.0D - this.renderMaxY) * this.renderMinZ); + var11 = (float)((double)var23 * this.renderMinY * this.renderMinZ + (double)var24 * this.renderMinY * (1.0D - this.renderMinZ) + (double)var25 * (1.0D - this.renderMinY) * (1.0D - this.renderMinZ) + (double)var22 * (1.0D - this.renderMinY) * this.renderMinZ); + var12 = (float)((double)var23 * this.renderMinY * this.renderMaxZ + (double)var24 * this.renderMinY * (1.0D - this.renderMaxZ) + (double)var25 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ) + (double)var22 * (1.0D - this.renderMinY) * this.renderMaxZ); + var26 = this.getAoBrightness(this.aoBrightnessXYNN, this.aoBrightnessXYZNNP, this.aoBrightnessXZNP, var20); + var27 = this.getAoBrightness(this.aoBrightnessXZNP, this.aoBrightnessXYNP, this.aoBrightnessXYZNPP, var20); + var28 = this.getAoBrightness(this.aoBrightnessXZNN, this.aoBrightnessXYZNPN, this.aoBrightnessXYNP, var20); + var29 = this.getAoBrightness(this.aoBrightnessXYZNNN, this.aoBrightnessXYNN, this.aoBrightnessXZNN, var20); + this.brightnessTopLeft = this.mixAoBrightness(var27, var28, var29, var26, this.renderMaxY * this.renderMaxZ, this.renderMaxY * (1.0D - this.renderMaxZ), (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ), (1.0D - this.renderMaxY) * this.renderMaxZ); + this.brightnessBottomLeft = this.mixAoBrightness(var27, var28, var29, var26, this.renderMaxY * this.renderMinZ, this.renderMaxY * (1.0D - this.renderMinZ), (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ), (1.0D - this.renderMaxY) * this.renderMinZ); + this.brightnessBottomRight = this.mixAoBrightness(var27, var28, var29, var26, this.renderMinY * this.renderMinZ, this.renderMinY * (1.0D - this.renderMinZ), (1.0D - this.renderMinY) * (1.0D - this.renderMinZ), (1.0D - this.renderMinY) * this.renderMinZ); + this.brightnessTopRight = this.mixAoBrightness(var27, var28, var29, var26, this.renderMinY * this.renderMaxZ, this.renderMinY * (1.0D - this.renderMaxZ), (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ), (1.0D - this.renderMinY) * this.renderMaxZ); + + if (var13) + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.6F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.6F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.6F; + } + else + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F; + } + + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var30 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4); + this.renderFaceXNeg(par1Block, (double)par2, (double)par3, (double)par4, var30); + + if (fancyGrass && var30.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; + this.colorRedBottomRight *= par5; + this.colorRedTopRight *= par5; + this.colorGreenTopLeft *= par6; + this.colorGreenBottomLeft *= par6; + this.colorGreenBottomRight *= par6; + this.colorGreenTopRight *= par6; + this.colorBlueTopLeft *= par7; + this.colorBlueBottomLeft *= par7; + this.colorBlueBottomRight *= par7; + this.colorBlueTopRight *= par7; + this.renderFaceXNeg(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var8 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5)) + { + if (this.renderMaxX >= 1.0D) + { + ++par2; + } + + this.aoLightValueScratchXYPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4); + this.aoLightValueScratchXZPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 - 1); + this.aoLightValueScratchXZPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3, par4 + 1); + this.aoLightValueScratchXYPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4); + this.aoBrightnessXYPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4); + this.aoBrightnessXZPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1); + this.aoBrightnessXZPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1); + this.aoBrightnessXYPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4); + var16 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 + 1, par4)]; + var17 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3 - 1, par4)]; + var18 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 + 1)]; + var19 = Block.canBlockGrass[this.blockAccess.getBlockId(par2 + 1, par3, par4 - 1)]; + + if (!var17 && !var19) + { + this.aoLightValueScratchXYZPNN = this.aoLightValueScratchXZPN; + this.aoBrightnessXYZPNN = this.aoBrightnessXZPN; + } + else + { + this.aoLightValueScratchXYZPNN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 - 1); + this.aoBrightnessXYZPNN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 - 1); + } + + if (!var17 && !var18) + { + this.aoLightValueScratchXYZPNP = this.aoLightValueScratchXZPP; + this.aoBrightnessXYZPNP = this.aoBrightnessXZPP; + } + else + { + this.aoLightValueScratchXYZPNP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 - 1, par4 + 1); + this.aoBrightnessXYZPNP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4 + 1); + } + + if (!var16 && !var19) + { + this.aoLightValueScratchXYZPPN = this.aoLightValueScratchXZPN; + this.aoBrightnessXYZPPN = this.aoBrightnessXZPN; + } + else + { + this.aoLightValueScratchXYZPPN = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 - 1); + this.aoBrightnessXYZPPN = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 - 1); + } + + if (!var16 && !var18) + { + this.aoLightValueScratchXYZPPP = this.aoLightValueScratchXZPP; + this.aoBrightnessXYZPPP = this.aoBrightnessXZPP; + } + else + { + this.aoLightValueScratchXYZPPP = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2, par3 + 1, par4 + 1); + this.aoBrightnessXYZPPP = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4 + 1); + } + + if (this.renderMaxX >= 1.0D) + { + --par2; + } + + var20 = var14; + + if (this.renderMaxX >= 1.0D || !this.blockAccess.isBlockOpaqueCube(par2 + 1, par3, par4)) + { + var20 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4); + } + + var21 = par1Block.getAmbientOcclusionLightValue(this.blockAccess, par2 + 1, par3, par4); + var22 = (this.aoLightValueScratchXYPN + this.aoLightValueScratchXYZPNP + var21 + this.aoLightValueScratchXZPP) / 4.0F; + var23 = (this.aoLightValueScratchXYZPNN + this.aoLightValueScratchXYPN + this.aoLightValueScratchXZPN + var21) / 4.0F; + var24 = (this.aoLightValueScratchXZPN + var21 + this.aoLightValueScratchXYZPPN + this.aoLightValueScratchXYPP) / 4.0F; + var25 = (var21 + this.aoLightValueScratchXZPP + this.aoLightValueScratchXYPP + this.aoLightValueScratchXYZPPP) / 4.0F; + var9 = (float)((double)var22 * (1.0D - this.renderMinY) * this.renderMaxZ + (double)var23 * (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ) + (double)var24 * this.renderMinY * (1.0D - this.renderMaxZ) + (double)var25 * this.renderMinY * this.renderMaxZ); + var10 = (float)((double)var22 * (1.0D - this.renderMinY) * this.renderMinZ + (double)var23 * (1.0D - this.renderMinY) * (1.0D - this.renderMinZ) + (double)var24 * this.renderMinY * (1.0D - this.renderMinZ) + (double)var25 * this.renderMinY * this.renderMinZ); + var11 = (float)((double)var22 * (1.0D - this.renderMaxY) * this.renderMinZ + (double)var23 * (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ) + (double)var24 * this.renderMaxY * (1.0D - this.renderMinZ) + (double)var25 * this.renderMaxY * this.renderMinZ); + var12 = (float)((double)var22 * (1.0D - this.renderMaxY) * this.renderMaxZ + (double)var23 * (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ) + (double)var24 * this.renderMaxY * (1.0D - this.renderMaxZ) + (double)var25 * this.renderMaxY * this.renderMaxZ); + var26 = this.getAoBrightness(this.aoBrightnessXYPN, this.aoBrightnessXYZPNP, this.aoBrightnessXZPP, var20); + var27 = this.getAoBrightness(this.aoBrightnessXZPP, this.aoBrightnessXYPP, this.aoBrightnessXYZPPP, var20); + var28 = this.getAoBrightness(this.aoBrightnessXZPN, this.aoBrightnessXYZPPN, this.aoBrightnessXYPP, var20); + var29 = this.getAoBrightness(this.aoBrightnessXYZPNN, this.aoBrightnessXYPN, this.aoBrightnessXZPN, var20); + this.brightnessTopLeft = this.mixAoBrightness(var26, var29, var28, var27, (1.0D - this.renderMinY) * this.renderMaxZ, (1.0D - this.renderMinY) * (1.0D - this.renderMaxZ), this.renderMinY * (1.0D - this.renderMaxZ), this.renderMinY * this.renderMaxZ); + this.brightnessBottomLeft = this.mixAoBrightness(var26, var29, var28, var27, (1.0D - this.renderMinY) * this.renderMinZ, (1.0D - this.renderMinY) * (1.0D - this.renderMinZ), this.renderMinY * (1.0D - this.renderMinZ), this.renderMinY * this.renderMinZ); + this.brightnessBottomRight = this.mixAoBrightness(var26, var29, var28, var27, (1.0D - this.renderMaxY) * this.renderMinZ, (1.0D - this.renderMaxY) * (1.0D - this.renderMinZ), this.renderMaxY * (1.0D - this.renderMinZ), this.renderMaxY * this.renderMinZ); + this.brightnessTopRight = this.mixAoBrightness(var26, var29, var28, var27, (1.0D - this.renderMaxY) * this.renderMaxZ, (1.0D - this.renderMaxY) * (1.0D - this.renderMaxZ), this.renderMaxY * (1.0D - this.renderMaxZ), this.renderMaxY * this.renderMaxZ); + + if (var13) + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = par5 * 0.6F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = par6 * 0.6F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = par7 * 0.6F; + } + else + { + this.colorRedTopLeft = this.colorRedBottomLeft = this.colorRedBottomRight = this.colorRedTopRight = 0.6F; + this.colorGreenTopLeft = this.colorGreenBottomLeft = this.colorGreenBottomRight = this.colorGreenTopRight = 0.6F; + this.colorBlueTopLeft = this.colorBlueBottomLeft = this.colorBlueBottomRight = this.colorBlueTopRight = 0.6F; + } + + this.colorRedTopLeft *= var9; + this.colorGreenTopLeft *= var9; + this.colorBlueTopLeft *= var9; + this.colorRedBottomLeft *= var10; + this.colorGreenBottomLeft *= var10; + this.colorBlueBottomLeft *= var10; + this.colorRedBottomRight *= var11; + this.colorGreenBottomRight *= var11; + this.colorBlueBottomRight *= var11; + this.colorRedTopRight *= var12; + this.colorGreenTopRight *= var12; + this.colorBlueTopRight *= var12; + var30 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5); + this.renderFaceXPos(par1Block, (double)par2, (double)par3, (double)par4, var30); + + if (fancyGrass && var30.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + this.colorRedTopLeft *= par5; + this.colorRedBottomLeft *= par5; + this.colorRedBottomRight *= par5; + this.colorRedTopRight *= par5; + this.colorGreenTopLeft *= par6; + this.colorGreenBottomLeft *= par6; + this.colorGreenBottomRight *= par6; + this.colorGreenTopRight *= par6; + this.colorBlueTopLeft *= par7; + this.colorBlueBottomLeft *= par7; + this.colorBlueBottomRight *= par7; + this.colorBlueTopRight *= par7; + this.renderFaceXPos(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var8 = true; + } + + this.enableAO = false; + return var8; + } + + /** + * Get ambient occlusion brightness + */ + private int getAoBrightness(int par1, int par2, int par3, int par4) + { + if (par1 == 0) + { + par1 = par4; + } + + if (par2 == 0) + { + par2 = par4; + } + + if (par3 == 0) + { + par3 = par4; + } + + return par1 + par2 + par3 + par4 >> 2 & 16711935; + } + + private int mixAoBrightness(int par1, int par2, int par3, int par4, double par5, double par7, double par9, double par11) + { + int var13 = (int)((double)(par1 >> 16 & 255) * par5 + (double)(par2 >> 16 & 255) * par7 + (double)(par3 >> 16 & 255) * par9 + (double)(par4 >> 16 & 255) * par11) & 255; + int var14 = (int)((double)(par1 & 255) * par5 + (double)(par2 & 255) * par7 + (double)(par3 & 255) * par9 + (double)(par4 & 255) * par11) & 255; + return var13 << 16 | var14; + } + + /** + * Renders a standard cube block at the given coordinates, with a given color ratio. Args: block, x, y, z, r, g, b + */ + public boolean renderStandardBlockWithColorMultiplier(Block par1Block, int par2, int par3, int par4, float par5, float par6, float par7) + { + this.enableAO = false; + Tessellator var8 = Tessellator.instance; + boolean var9 = false; + float var10 = 0.5F; + float var11 = 1.0F; + float var12 = 0.8F; + float var13 = 0.6F; + float var14 = var11 * par5; + float var15 = var11 * par6; + float var16 = var11 * par7; + float var17 = var10; + float var18 = var12; + float var19 = var13; + float var20 = var10; + float var21 = var12; + float var22 = var13; + float var23 = var10; + float var24 = var12; + float var25 = var13; + + if (par1Block != Block.grass) + { + var17 = var10 * par5; + var18 = var12 * par5; + var19 = var13 * par5; + var20 = var10 * par6; + var21 = var12 * par6; + var22 = var13 * par6; + var23 = var10 * par7; + var24 = var12 * par7; + var25 = var13 * par7; + } + + int var26 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4); + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0)) + { + var8.setBrightness(this.renderMinY > 0.0D ? var26 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4)); + var8.setColorOpaque_F(var17, var20, var23); + this.renderFaceYNeg(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0)); + var9 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1)) + { + var8.setBrightness(this.renderMaxY < 1.0D ? var26 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4)); + var8.setColorOpaque_F(var14, var15, var16); + this.renderFaceYPos(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1)); + var9 = true; + } + + Icon var28; + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 - 1, 2)) + { + var8.setBrightness(this.renderMinZ > 0.0D ? var26 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1)); + var8.setColorOpaque_F(var18, var21, var24); + var28 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2); + this.renderFaceZNeg(par1Block, (double)par2, (double)par3, (double)par4, var28); + + if (fancyGrass && var28.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + var8.setColorOpaque_F(var18 * par5, var21 * par6, var24 * par7); + this.renderFaceZNeg(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var9 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3, par4 + 1, 3)) + { + var8.setBrightness(this.renderMaxZ < 1.0D ? var26 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1)); + var8.setColorOpaque_F(var18, var21, var24); + var28 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3); + this.renderFaceZPos(par1Block, (double)par2, (double)par3, (double)par4, var28); + + if (fancyGrass && var28.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + var8.setColorOpaque_F(var18 * par5, var21 * par6, var24 * par7); + this.renderFaceZPos(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var9 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 - 1, par3, par4, 4)) + { + var8.setBrightness(this.renderMinX > 0.0D ? var26 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4)); + var8.setColorOpaque_F(var19, var22, var25); + var28 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4); + this.renderFaceXNeg(par1Block, (double)par2, (double)par3, (double)par4, var28); + + if (fancyGrass && var28.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + var8.setColorOpaque_F(var19 * par5, var22 * par6, var25 * par7); + this.renderFaceXNeg(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var9 = true; + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2 + 1, par3, par4, 5)) + { + var8.setBrightness(this.renderMaxX < 1.0D ? var26 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4)); + var8.setColorOpaque_F(var19, var22, var25); + var28 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5); + this.renderFaceXPos(par1Block, (double)par2, (double)par3, (double)par4, var28); + + if (fancyGrass && var28.getIconName().equals("grass_side") && !this.hasOverrideBlockTexture()) + { + var8.setColorOpaque_F(var19 * par5, var22 * par6, var25 * par7); + this.renderFaceXPos(par1Block, (double)par2, (double)par3, (double)par4, BlockGrass.getIconSideOverlay()); + } + + var9 = true; + } + + return var9; + } + + /** + * Renders a Cocoa block at the given coordinates + */ + private boolean renderBlockCocoa(BlockCocoa par1BlockCocoa, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + var5.setBrightness(par1BlockCocoa.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + var5.setColorOpaque_F(1.0F, 1.0F, 1.0F); + int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); + int var7 = BlockDirectional.getDirection(var6); + int var8 = BlockCocoa.func_72219_c(var6); + Icon var9 = par1BlockCocoa.getCocoaIcon(var8); + int var10 = 4 + var8 * 2; + int var11 = 5 + var8 * 2; + double var12 = 15.0D - (double)var10; + double var14 = 15.0D; + double var16 = 4.0D; + double var18 = 4.0D + (double)var11; + double var20 = (double)var9.getInterpolatedU(var12); + double var22 = (double)var9.getInterpolatedU(var14); + double var24 = (double)var9.getInterpolatedV(var16); + double var26 = (double)var9.getInterpolatedV(var18); + double var28 = 0.0D; + double var30 = 0.0D; + + switch (var7) + { + case 0: + var28 = 8.0D - (double)(var10 / 2); + var30 = 15.0D - (double)var10; + break; + + case 1: + var28 = 1.0D; + var30 = 8.0D - (double)(var10 / 2); + break; + + case 2: + var28 = 8.0D - (double)(var10 / 2); + var30 = 1.0D; + break; + + case 3: + var28 = 15.0D - (double)var10; + var30 = 8.0D - (double)(var10 / 2); + } + + double var32 = (double)par2 + var28 / 16.0D; + double var34 = (double)par2 + (var28 + (double)var10) / 16.0D; + double var36 = (double)par3 + (12.0D - (double)var11) / 16.0D; + double var38 = (double)par3 + 0.75D; + double var40 = (double)par4 + var30 / 16.0D; + double var42 = (double)par4 + (var30 + (double)var10) / 16.0D; + var5.addVertexWithUV(var32, var36, var40, var20, var26); + var5.addVertexWithUV(var32, var36, var42, var22, var26); + var5.addVertexWithUV(var32, var38, var42, var22, var24); + var5.addVertexWithUV(var32, var38, var40, var20, var24); + var5.addVertexWithUV(var34, var36, var42, var20, var26); + var5.addVertexWithUV(var34, var36, var40, var22, var26); + var5.addVertexWithUV(var34, var38, var40, var22, var24); + var5.addVertexWithUV(var34, var38, var42, var20, var24); + var5.addVertexWithUV(var34, var36, var40, var20, var26); + var5.addVertexWithUV(var32, var36, var40, var22, var26); + var5.addVertexWithUV(var32, var38, var40, var22, var24); + var5.addVertexWithUV(var34, var38, var40, var20, var24); + var5.addVertexWithUV(var32, var36, var42, var20, var26); + var5.addVertexWithUV(var34, var36, var42, var22, var26); + var5.addVertexWithUV(var34, var38, var42, var22, var24); + var5.addVertexWithUV(var32, var38, var42, var20, var24); + int var44 = var10; + + if (var8 >= 2) + { + var44 = var10 - 1; + } + + var20 = (double)var9.getMinU(); + var22 = (double)var9.getInterpolatedU((double)var44); + var24 = (double)var9.getMinV(); + var26 = (double)var9.getInterpolatedV((double)var44); + var5.addVertexWithUV(var32, var38, var42, var20, var26); + var5.addVertexWithUV(var34, var38, var42, var22, var26); + var5.addVertexWithUV(var34, var38, var40, var22, var24); + var5.addVertexWithUV(var32, var38, var40, var20, var24); + var5.addVertexWithUV(var32, var36, var40, var20, var24); + var5.addVertexWithUV(var34, var36, var40, var22, var24); + var5.addVertexWithUV(var34, var36, var42, var22, var26); + var5.addVertexWithUV(var32, var36, var42, var20, var26); + var20 = (double)var9.getInterpolatedU(12.0D); + var22 = (double)var9.getMaxU(); + var24 = (double)var9.getMinV(); + var26 = (double)var9.getInterpolatedV(4.0D); + var28 = 8.0D; + var30 = 0.0D; + double var45; + + switch (var7) + { + case 0: + var28 = 8.0D; + var30 = 12.0D; + var45 = var20; + var20 = var22; + var22 = var45; + break; + + case 1: + var28 = 0.0D; + var30 = 8.0D; + break; + + case 2: + var28 = 8.0D; + var30 = 0.0D; + break; + + case 3: + var28 = 12.0D; + var30 = 8.0D; + var45 = var20; + var20 = var22; + var22 = var45; + } + + var32 = (double)par2 + var28 / 16.0D; + var34 = (double)par2 + (var28 + 4.0D) / 16.0D; + var36 = (double)par3 + 0.75D; + var38 = (double)par3 + 1.0D; + var40 = (double)par4 + var30 / 16.0D; + var42 = (double)par4 + (var30 + 4.0D) / 16.0D; + + if (var7 != 2 && var7 != 0) + { + if (var7 == 1 || var7 == 3) + { + var5.addVertexWithUV(var34, var36, var40, var20, var26); + var5.addVertexWithUV(var32, var36, var40, var22, var26); + var5.addVertexWithUV(var32, var38, var40, var22, var24); + var5.addVertexWithUV(var34, var38, var40, var20, var24); + var5.addVertexWithUV(var32, var36, var40, var22, var26); + var5.addVertexWithUV(var34, var36, var40, var20, var26); + var5.addVertexWithUV(var34, var38, var40, var20, var24); + var5.addVertexWithUV(var32, var38, var40, var22, var24); + } + } + else + { + var5.addVertexWithUV(var32, var36, var40, var22, var26); + var5.addVertexWithUV(var32, var36, var42, var20, var26); + var5.addVertexWithUV(var32, var38, var42, var20, var24); + var5.addVertexWithUV(var32, var38, var40, var22, var24); + var5.addVertexWithUV(var32, var36, var42, var20, var26); + var5.addVertexWithUV(var32, var36, var40, var22, var26); + var5.addVertexWithUV(var32, var38, var40, var22, var24); + var5.addVertexWithUV(var32, var38, var42, var20, var24); + } + + return true; + } + + /** + * Renders beacon block + */ + private boolean renderBlockBeacon(BlockBeacon par1BlockBeacon, int par2, int par3, int par4) + { + float var5 = 0.1875F; + this.setOverrideBlockTexture(this.getBlockIcon(Block.glass)); + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + this.renderStandardBlock(par1BlockBeacon, par2, par3, par4); + this.renderAllFaces = true; + this.setOverrideBlockTexture(this.getBlockIcon(Block.obsidian)); + this.setRenderBounds(0.125D, 0.0062500000931322575D, 0.125D, 0.875D, (double)var5, 0.875D); + this.renderStandardBlock(par1BlockBeacon, par2, par3, par4); + this.setOverrideBlockTexture(this.getBlockIcon(Block.beacon)); + this.setRenderBounds(0.1875D, (double)var5, 0.1875D, 0.8125D, 0.875D, 0.8125D); + this.renderStandardBlock(par1BlockBeacon, par2, par3, par4); + this.renderAllFaces = false; + this.clearOverrideBlockTexture(); + return true; + } + + /** + * Renders a cactus block at the given coordinates + */ + public boolean renderBlockCactus(Block par1Block, int par2, int par3, int par4) + { + int var5 = par1Block.colorMultiplier(this.blockAccess, par2, par3, par4); + float var6 = (float)(var5 >> 16 & 255) / 255.0F; + float var7 = (float)(var5 >> 8 & 255) / 255.0F; + float var8 = (float)(var5 & 255) / 255.0F; + + if (EntityRenderer.anaglyphEnable) + { + float var9 = (var6 * 30.0F + var7 * 59.0F + var8 * 11.0F) / 100.0F; + float var10 = (var6 * 30.0F + var7 * 70.0F) / 100.0F; + float var11 = (var6 * 30.0F + var8 * 70.0F) / 100.0F; + var6 = var9; + var7 = var10; + var8 = var11; + } + + return this.renderBlockCactusImpl(par1Block, par2, par3, par4, var6, var7, var8); + } + + /** + * Render block cactus implementation + */ + public boolean renderBlockCactusImpl(Block par1Block, int par2, int par3, int par4, float par5, float par6, float par7) + { + Tessellator var8 = Tessellator.instance; + boolean var9 = false; + float var10 = 0.5F; + float var11 = 1.0F; + float var12 = 0.8F; + float var13 = 0.6F; + float var14 = var10 * par5; + float var15 = var11 * par5; + float var16 = var12 * par5; + float var17 = var13 * par5; + float var18 = var10 * par6; + float var19 = var11 * par6; + float var20 = var12 * par6; + float var21 = var13 * par6; + float var22 = var10 * par7; + float var23 = var11 * par7; + float var24 = var12 * par7; + float var25 = var13 * par7; + float var26 = 0.0625F; + int var27 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4); + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0)) + { + var8.setBrightness(this.renderMinY > 0.0D ? var27 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4)); + var8.setColorOpaque_F(var14, var18, var22); + this.renderFaceYNeg(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0)); + } + + if (this.renderAllFaces || par1Block.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1)) + { + var8.setBrightness(this.renderMaxY < 1.0D ? var27 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4)); + var8.setColorOpaque_F(var15, var19, var23); + this.renderFaceYPos(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1)); + } + + var8.setBrightness(var27); + var8.setColorOpaque_F(var16, var20, var24); + var8.addTranslation(0.0F, 0.0F, var26); + this.renderFaceZNeg(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2)); + var8.addTranslation(0.0F, 0.0F, -var26); + var8.addTranslation(0.0F, 0.0F, -var26); + this.renderFaceZPos(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3)); + var8.addTranslation(0.0F, 0.0F, var26); + var8.setColorOpaque_F(var17, var21, var25); + var8.addTranslation(var26, 0.0F, 0.0F); + this.renderFaceXNeg(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4)); + var8.addTranslation(-var26, 0.0F, 0.0F); + var8.addTranslation(-var26, 0.0F, 0.0F); + this.renderFaceXPos(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5)); + var8.addTranslation(var26, 0.0F, 0.0F); + return true; + } + + public boolean renderBlockFence(BlockFence par1BlockFence, int par2, int par3, int par4) + { + boolean var5 = false; + float var6 = 0.375F; + float var7 = 0.625F; + this.setRenderBounds((double)var6, 0.0D, (double)var6, (double)var7, 1.0D, (double)var7); + this.renderStandardBlock(par1BlockFence, par2, par3, par4); + var5 = true; + boolean var8 = false; + boolean var9 = false; + + if (par1BlockFence.canConnectFenceTo(this.blockAccess, par2 - 1, par3, par4) || par1BlockFence.canConnectFenceTo(this.blockAccess, par2 + 1, par3, par4)) + { + var8 = true; + } + + if (par1BlockFence.canConnectFenceTo(this.blockAccess, par2, par3, par4 - 1) || par1BlockFence.canConnectFenceTo(this.blockAccess, par2, par3, par4 + 1)) + { + var9 = true; + } + + boolean var10 = par1BlockFence.canConnectFenceTo(this.blockAccess, par2 - 1, par3, par4); + boolean var11 = par1BlockFence.canConnectFenceTo(this.blockAccess, par2 + 1, par3, par4); + boolean var12 = par1BlockFence.canConnectFenceTo(this.blockAccess, par2, par3, par4 - 1); + boolean var13 = par1BlockFence.canConnectFenceTo(this.blockAccess, par2, par3, par4 + 1); + + if (!var8 && !var9) + { + var8 = true; + } + + var6 = 0.4375F; + var7 = 0.5625F; + float var14 = 0.75F; + float var15 = 0.9375F; + float var16 = var10 ? 0.0F : var6; + float var17 = var11 ? 1.0F : var7; + float var18 = var12 ? 0.0F : var6; + float var19 = var13 ? 1.0F : var7; + + if (var8) + { + this.setRenderBounds((double)var16, (double)var14, (double)var6, (double)var17, (double)var15, (double)var7); + this.renderStandardBlock(par1BlockFence, par2, par3, par4); + var5 = true; + } + + if (var9) + { + this.setRenderBounds((double)var6, (double)var14, (double)var18, (double)var7, (double)var15, (double)var19); + this.renderStandardBlock(par1BlockFence, par2, par3, par4); + var5 = true; + } + + var14 = 0.375F; + var15 = 0.5625F; + + if (var8) + { + this.setRenderBounds((double)var16, (double)var14, (double)var6, (double)var17, (double)var15, (double)var7); + this.renderStandardBlock(par1BlockFence, par2, par3, par4); + var5 = true; + } + + if (var9) + { + this.setRenderBounds((double)var6, (double)var14, (double)var18, (double)var7, (double)var15, (double)var19); + this.renderStandardBlock(par1BlockFence, par2, par3, par4); + var5 = true; + } + + par1BlockFence.setBlockBoundsBasedOnState(this.blockAccess, par2, par3, par4); + return var5; + } + + /** + * Renders wall block + */ + public boolean renderBlockWall(BlockWall par1BlockWall, int par2, int par3, int par4) + { + boolean var5 = par1BlockWall.canConnectWallTo(this.blockAccess, par2 - 1, par3, par4); + boolean var6 = par1BlockWall.canConnectWallTo(this.blockAccess, par2 + 1, par3, par4); + boolean var7 = par1BlockWall.canConnectWallTo(this.blockAccess, par2, par3, par4 - 1); + boolean var8 = par1BlockWall.canConnectWallTo(this.blockAccess, par2, par3, par4 + 1); + boolean var9 = var7 && var8 && !var5 && !var6; + boolean var10 = !var7 && !var8 && var5 && var6; + boolean var11 = this.blockAccess.isAirBlock(par2, par3 + 1, par4); + + if ((var9 || var10) && var11) + { + if (var9) + { + this.setRenderBounds(0.3125D, 0.0D, 0.0D, 0.6875D, 0.8125D, 1.0D); + this.renderStandardBlock(par1BlockWall, par2, par3, par4); + } + else + { + this.setRenderBounds(0.0D, 0.0D, 0.3125D, 1.0D, 0.8125D, 0.6875D); + this.renderStandardBlock(par1BlockWall, par2, par3, par4); + } + } + else + { + this.setRenderBounds(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D); + this.renderStandardBlock(par1BlockWall, par2, par3, par4); + + if (var5) + { + this.setRenderBounds(0.0D, 0.0D, 0.3125D, 0.25D, 0.8125D, 0.6875D); + this.renderStandardBlock(par1BlockWall, par2, par3, par4); + } + + if (var6) + { + this.setRenderBounds(0.75D, 0.0D, 0.3125D, 1.0D, 0.8125D, 0.6875D); + this.renderStandardBlock(par1BlockWall, par2, par3, par4); + } + + if (var7) + { + this.setRenderBounds(0.3125D, 0.0D, 0.0D, 0.6875D, 0.8125D, 0.25D); + this.renderStandardBlock(par1BlockWall, par2, par3, par4); + } + + if (var8) + { + this.setRenderBounds(0.3125D, 0.0D, 0.75D, 0.6875D, 0.8125D, 1.0D); + this.renderStandardBlock(par1BlockWall, par2, par3, par4); + } + } + + par1BlockWall.setBlockBoundsBasedOnState(this.blockAccess, par2, par3, par4); + return true; + } + + public boolean renderBlockDragonEgg(BlockDragonEgg par1BlockDragonEgg, int par2, int par3, int par4) + { + boolean var5 = false; + int var6 = 0; + + for (int var7 = 0; var7 < 8; ++var7) + { + byte var8 = 0; + byte var9 = 1; + + if (var7 == 0) + { + var8 = 2; + } + + if (var7 == 1) + { + var8 = 3; + } + + if (var7 == 2) + { + var8 = 4; + } + + if (var7 == 3) + { + var8 = 5; + var9 = 2; + } + + if (var7 == 4) + { + var8 = 6; + var9 = 3; + } + + if (var7 == 5) + { + var8 = 7; + var9 = 5; + } + + if (var7 == 6) + { + var8 = 6; + var9 = 2; + } + + if (var7 == 7) + { + var8 = 3; + } + + float var10 = (float)var8 / 16.0F; + float var11 = 1.0F - (float)var6 / 16.0F; + float var12 = 1.0F - (float)(var6 + var9) / 16.0F; + var6 += var9; + this.setRenderBounds((double)(0.5F - var10), (double)var12, (double)(0.5F - var10), (double)(0.5F + var10), (double)var11, (double)(0.5F + var10)); + this.renderStandardBlock(par1BlockDragonEgg, par2, par3, par4); + } + + var5 = true; + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + return var5; + } + + /** + * Render block fence gate + */ + public boolean renderBlockFenceGate(BlockFenceGate par1BlockFenceGate, int par2, int par3, int par4) + { + boolean var5 = true; + int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); + boolean var7 = BlockFenceGate.isFenceGateOpen(var6); + int var8 = BlockDirectional.getDirection(var6); + float var9 = 0.375F; + float var10 = 0.5625F; + float var11 = 0.75F; + float var12 = 0.9375F; + float var13 = 0.3125F; + float var14 = 1.0F; + + if ((var8 == 2 || var8 == 0) && this.blockAccess.getBlockId(par2 - 1, par3, par4) == Block.cobblestoneWall.blockID && this.blockAccess.getBlockId(par2 + 1, par3, par4) == Block.cobblestoneWall.blockID || (var8 == 3 || var8 == 1) && this.blockAccess.getBlockId(par2, par3, par4 - 1) == Block.cobblestoneWall.blockID && this.blockAccess.getBlockId(par2, par3, par4 + 1) == Block.cobblestoneWall.blockID) + { + var9 -= 0.1875F; + var10 -= 0.1875F; + var11 -= 0.1875F; + var12 -= 0.1875F; + var13 -= 0.1875F; + var14 -= 0.1875F; + } + + this.renderAllFaces = true; + float var15; + float var16; + float var17; + float var18; + + if (var8 != 3 && var8 != 1) + { + var15 = 0.0F; + var16 = 0.125F; + var17 = 0.4375F; + var18 = 0.5625F; + this.setRenderBounds((double)var15, (double)var13, (double)var17, (double)var16, (double)var14, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + var15 = 0.875F; + var16 = 1.0F; + this.setRenderBounds((double)var15, (double)var13, (double)var17, (double)var16, (double)var14, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + } + else + { + this.uvRotateTop = 1; + var15 = 0.4375F; + var16 = 0.5625F; + var17 = 0.0F; + var18 = 0.125F; + this.setRenderBounds((double)var15, (double)var13, (double)var17, (double)var16, (double)var14, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + var17 = 0.875F; + var18 = 1.0F; + this.setRenderBounds((double)var15, (double)var13, (double)var17, (double)var16, (double)var14, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.uvRotateTop = 0; + } + + if (var7) + { + if (var8 == 2 || var8 == 0) + { + this.uvRotateTop = 1; + } + + float var19; + float var20; + float var21; + + if (var8 == 3) + { + var15 = 0.0F; + var16 = 0.125F; + var17 = 0.875F; + var18 = 1.0F; + var19 = 0.5625F; + var20 = 0.8125F; + var21 = 0.9375F; + this.setRenderBounds(0.8125D, (double)var9, 0.0D, 0.9375D, (double)var12, 0.125D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.8125D, (double)var9, 0.875D, 0.9375D, (double)var12, 1.0D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.5625D, (double)var9, 0.0D, 0.8125D, (double)var10, 0.125D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.5625D, (double)var9, 0.875D, 0.8125D, (double)var10, 1.0D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.5625D, (double)var11, 0.0D, 0.8125D, (double)var12, 0.125D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.5625D, (double)var11, 0.875D, 0.8125D, (double)var12, 1.0D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + } + else if (var8 == 1) + { + var15 = 0.0F; + var16 = 0.125F; + var17 = 0.875F; + var18 = 1.0F; + var19 = 0.0625F; + var20 = 0.1875F; + var21 = 0.4375F; + this.setRenderBounds(0.0625D, (double)var9, 0.0D, 0.1875D, (double)var12, 0.125D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.0625D, (double)var9, 0.875D, 0.1875D, (double)var12, 1.0D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.1875D, (double)var9, 0.0D, 0.4375D, (double)var10, 0.125D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.1875D, (double)var9, 0.875D, 0.4375D, (double)var10, 1.0D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.1875D, (double)var11, 0.0D, 0.4375D, (double)var12, 0.125D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.1875D, (double)var11, 0.875D, 0.4375D, (double)var12, 1.0D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + } + else if (var8 == 0) + { + var15 = 0.0F; + var16 = 0.125F; + var17 = 0.875F; + var18 = 1.0F; + var19 = 0.5625F; + var20 = 0.8125F; + var21 = 0.9375F; + this.setRenderBounds(0.0D, (double)var9, 0.8125D, 0.125D, (double)var12, 0.9375D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.875D, (double)var9, 0.8125D, 1.0D, (double)var12, 0.9375D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.0D, (double)var9, 0.5625D, 0.125D, (double)var10, 0.8125D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.875D, (double)var9, 0.5625D, 1.0D, (double)var10, 0.8125D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.0D, (double)var11, 0.5625D, 0.125D, (double)var12, 0.8125D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.875D, (double)var11, 0.5625D, 1.0D, (double)var12, 0.8125D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + } + else if (var8 == 2) + { + var15 = 0.0F; + var16 = 0.125F; + var17 = 0.875F; + var18 = 1.0F; + var19 = 0.0625F; + var20 = 0.1875F; + var21 = 0.4375F; + this.setRenderBounds(0.0D, (double)var9, 0.0625D, 0.125D, (double)var12, 0.1875D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.875D, (double)var9, 0.0625D, 1.0D, (double)var12, 0.1875D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.0D, (double)var9, 0.1875D, 0.125D, (double)var10, 0.4375D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.875D, (double)var9, 0.1875D, 1.0D, (double)var10, 0.4375D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.0D, (double)var11, 0.1875D, 0.125D, (double)var12, 0.4375D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds(0.875D, (double)var11, 0.1875D, 1.0D, (double)var12, 0.4375D); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + } + } + else if (var8 != 3 && var8 != 1) + { + var15 = 0.375F; + var16 = 0.5F; + var17 = 0.4375F; + var18 = 0.5625F; + this.setRenderBounds((double)var15, (double)var9, (double)var17, (double)var16, (double)var12, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + var15 = 0.5F; + var16 = 0.625F; + this.setRenderBounds((double)var15, (double)var9, (double)var17, (double)var16, (double)var12, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + var15 = 0.625F; + var16 = 0.875F; + this.setRenderBounds((double)var15, (double)var9, (double)var17, (double)var16, (double)var10, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds((double)var15, (double)var11, (double)var17, (double)var16, (double)var12, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + var15 = 0.125F; + var16 = 0.375F; + this.setRenderBounds((double)var15, (double)var9, (double)var17, (double)var16, (double)var10, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds((double)var15, (double)var11, (double)var17, (double)var16, (double)var12, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + } + else + { + this.uvRotateTop = 1; + var15 = 0.4375F; + var16 = 0.5625F; + var17 = 0.375F; + var18 = 0.5F; + this.setRenderBounds((double)var15, (double)var9, (double)var17, (double)var16, (double)var12, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + var17 = 0.5F; + var18 = 0.625F; + this.setRenderBounds((double)var15, (double)var9, (double)var17, (double)var16, (double)var12, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + var17 = 0.625F; + var18 = 0.875F; + this.setRenderBounds((double)var15, (double)var9, (double)var17, (double)var16, (double)var10, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds((double)var15, (double)var11, (double)var17, (double)var16, (double)var12, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + var17 = 0.125F; + var18 = 0.375F; + this.setRenderBounds((double)var15, (double)var9, (double)var17, (double)var16, (double)var10, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + this.setRenderBounds((double)var15, (double)var11, (double)var17, (double)var16, (double)var12, (double)var18); + this.renderStandardBlock(par1BlockFenceGate, par2, par3, par4); + } + + this.renderAllFaces = false; + this.uvRotateTop = 0; + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + return var5; + } + + private boolean renderBlockHopper(BlockHopper par1BlockHopper, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + var5.setBrightness(par1BlockHopper.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var6 = 1.0F; + int var7 = par1BlockHopper.colorMultiplier(this.blockAccess, par2, par3, par4); + float var8 = (float)(var7 >> 16 & 255) / 255.0F; + float var9 = (float)(var7 >> 8 & 255) / 255.0F; + float var10 = (float)(var7 & 255) / 255.0F; + + if (EntityRenderer.anaglyphEnable) + { + float var11 = (var8 * 30.0F + var9 * 59.0F + var10 * 11.0F) / 100.0F; + float var12 = (var8 * 30.0F + var9 * 70.0F) / 100.0F; + float var13 = (var8 * 30.0F + var10 * 70.0F) / 100.0F; + var8 = var11; + var9 = var12; + var10 = var13; + } + + var5.setColorOpaque_F(var6 * var8, var6 * var9, var6 * var10); + return this.renderBlockHopperMetadata(par1BlockHopper, par2, par3, par4, this.blockAccess.getBlockMetadata(par2, par3, par4), false); + } + + private boolean renderBlockHopperMetadata(BlockHopper par1BlockHopper, int par2, int par3, int par4, int par5, boolean par6) + { + Tessellator var7 = Tessellator.instance; + int var8 = BlockHopper.getDirectionFromMetadata(par5); + double var9 = 0.625D; + this.setRenderBounds(0.0D, var9, 0.0D, 1.0D, 1.0D, 1.0D); + + if (par6) + { + var7.startDrawingQuads(); + var7.setNormal(0.0F, -1.0F, 0.0F); + this.renderFaceYNeg(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 0, par5)); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 1, par5)); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(0.0F, 0.0F, -1.0F); + this.renderFaceZNeg(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 2, par5)); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(0.0F, 0.0F, 1.0F); + this.renderFaceZPos(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 3, par5)); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(-1.0F, 0.0F, 0.0F); + this.renderFaceXNeg(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 4, par5)); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(1.0F, 0.0F, 0.0F); + this.renderFaceXPos(par1BlockHopper, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1BlockHopper, 5, par5)); + var7.draw(); + } + else + { + this.renderStandardBlock(par1BlockHopper, par2, par3, par4); + } + + float var13; + + if (!par6) + { + var7.setBrightness(par1BlockHopper.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4)); + float var11 = 1.0F; + int var12 = par1BlockHopper.colorMultiplier(this.blockAccess, par2, par3, par4); + var13 = (float)(var12 >> 16 & 255) / 255.0F; + float var14 = (float)(var12 >> 8 & 255) / 255.0F; + float var15 = (float)(var12 & 255) / 255.0F; + + if (EntityRenderer.anaglyphEnable) + { + float var16 = (var13 * 30.0F + var14 * 59.0F + var15 * 11.0F) / 100.0F; + float var17 = (var13 * 30.0F + var14 * 70.0F) / 100.0F; + float var18 = (var13 * 30.0F + var15 * 70.0F) / 100.0F; + var13 = var16; + var14 = var17; + var15 = var18; + } + + var7.setColorOpaque_F(var11 * var13, var11 * var14, var11 * var15); + } + + Icon var24 = BlockHopper.getHopperIcon("hopper_outside"); + Icon var25 = BlockHopper.getHopperIcon("hopper_inside"); + var13 = 0.125F; + + if (par6) + { + var7.startDrawingQuads(); + var7.setNormal(1.0F, 0.0F, 0.0F); + this.renderFaceXPos(par1BlockHopper, (double)(-1.0F + var13), 0.0D, 0.0D, var24); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(-1.0F, 0.0F, 0.0F); + this.renderFaceXNeg(par1BlockHopper, (double)(1.0F - var13), 0.0D, 0.0D, var24); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(0.0F, 0.0F, 1.0F); + this.renderFaceZPos(par1BlockHopper, 0.0D, 0.0D, (double)(-1.0F + var13), var24); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(0.0F, 0.0F, -1.0F); + this.renderFaceZNeg(par1BlockHopper, 0.0D, 0.0D, (double)(1.0F - var13), var24); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1BlockHopper, 0.0D, -1.0D + var9, 0.0D, var25); + var7.draw(); + } + else + { + this.renderFaceXPos(par1BlockHopper, (double)((float)par2 - 1.0F + var13), (double)par3, (double)par4, var24); + this.renderFaceXNeg(par1BlockHopper, (double)((float)par2 + 1.0F - var13), (double)par3, (double)par4, var24); + this.renderFaceZPos(par1BlockHopper, (double)par2, (double)par3, (double)((float)par4 - 1.0F + var13), var24); + this.renderFaceZNeg(par1BlockHopper, (double)par2, (double)par3, (double)((float)par4 + 1.0F - var13), var24); + this.renderFaceYPos(par1BlockHopper, (double)par2, (double)((float)par3 - 1.0F) + var9, (double)par4, var25); + } + + this.setOverrideBlockTexture(var24); + double var26 = 0.25D; + double var27 = 0.25D; + this.setRenderBounds(var26, var27, var26, 1.0D - var26, var9 - 0.002D, 1.0D - var26); + + if (par6) + { + var7.startDrawingQuads(); + var7.setNormal(1.0F, 0.0F, 0.0F); + this.renderFaceXPos(par1BlockHopper, 0.0D, 0.0D, 0.0D, var24); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(-1.0F, 0.0F, 0.0F); + this.renderFaceXNeg(par1BlockHopper, 0.0D, 0.0D, 0.0D, var24); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(0.0F, 0.0F, 1.0F); + this.renderFaceZPos(par1BlockHopper, 0.0D, 0.0D, 0.0D, var24); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(0.0F, 0.0F, -1.0F); + this.renderFaceZNeg(par1BlockHopper, 0.0D, 0.0D, 0.0D, var24); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1BlockHopper, 0.0D, 0.0D, 0.0D, var24); + var7.draw(); + var7.startDrawingQuads(); + var7.setNormal(0.0F, -1.0F, 0.0F); + this.renderFaceYNeg(par1BlockHopper, 0.0D, 0.0D, 0.0D, var24); + var7.draw(); + } + else + { + this.renderStandardBlock(par1BlockHopper, par2, par3, par4); + } + + if (!par6) + { + double var20 = 0.375D; + double var22 = 0.25D; + this.setOverrideBlockTexture(var24); + + if (var8 == 0) + { + this.setRenderBounds(var20, 0.0D, var20, 1.0D - var20, 0.25D, 1.0D - var20); + this.renderStandardBlock(par1BlockHopper, par2, par3, par4); + } + + if (var8 == 2) + { + this.setRenderBounds(var20, var27, 0.0D, 1.0D - var20, var27 + var22, var26); + this.renderStandardBlock(par1BlockHopper, par2, par3, par4); + } + + if (var8 == 3) + { + this.setRenderBounds(var20, var27, 1.0D - var26, 1.0D - var20, var27 + var22, 1.0D); + this.renderStandardBlock(par1BlockHopper, par2, par3, par4); + } + + if (var8 == 4) + { + this.setRenderBounds(0.0D, var27, var20, var26, var27 + var22, 1.0D - var20); + this.renderStandardBlock(par1BlockHopper, par2, par3, par4); + } + + if (var8 == 5) + { + this.setRenderBounds(1.0D - var26, var27, var20, 1.0D, var27 + var22, 1.0D - var20); + this.renderStandardBlock(par1BlockHopper, par2, par3, par4); + } + } + + this.clearOverrideBlockTexture(); + return true; + } + + /** + * Renders a stair block at the given coordinates + */ + public boolean renderBlockStairs(BlockStairs par1BlockStairs, int par2, int par3, int par4) + { + par1BlockStairs.func_82541_d(this.blockAccess, par2, par3, par4); + this.setRenderBoundsFromBlock(par1BlockStairs); + this.renderStandardBlock(par1BlockStairs, par2, par3, par4); + boolean var5 = par1BlockStairs.func_82542_g(this.blockAccess, par2, par3, par4); + this.setRenderBoundsFromBlock(par1BlockStairs); + this.renderStandardBlock(par1BlockStairs, par2, par3, par4); + + if (var5 && par1BlockStairs.func_82544_h(this.blockAccess, par2, par3, par4)) + { + this.setRenderBoundsFromBlock(par1BlockStairs); + this.renderStandardBlock(par1BlockStairs, par2, par3, par4); + } + + return true; + } + + /** + * Renders a door block at the given coordinates + */ + public boolean renderBlockDoor(Block par1Block, int par2, int par3, int par4) + { + Tessellator var5 = Tessellator.instance; + int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4); + + if ((var6 & 8) != 0) + { + if (this.blockAccess.getBlockId(par2, par3 - 1, par4) != par1Block.blockID) + { + return false; + } + } + else if (this.blockAccess.getBlockId(par2, par3 + 1, par4) != par1Block.blockID) + { + return false; + } + + boolean var7 = false; + float var8 = 0.5F; + float var9 = 1.0F; + float var10 = 0.8F; + float var11 = 0.6F; + int var12 = par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4); + var5.setBrightness(this.renderMinY > 0.0D ? var12 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 - 1, par4)); + var5.setColorOpaque_F(var8, var8, var8); + this.renderFaceYNeg(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0)); + var7 = true; + var5.setBrightness(this.renderMaxY < 1.0D ? var12 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4)); + var5.setColorOpaque_F(var9, var9, var9); + this.renderFaceYPos(par1Block, (double)par2, (double)par3, (double)par4, this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1)); + var7 = true; + var5.setBrightness(this.renderMinZ > 0.0D ? var12 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 - 1)); + var5.setColorOpaque_F(var10, var10, var10); + Icon var14 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 2); + this.renderFaceZNeg(par1Block, (double)par2, (double)par3, (double)par4, var14); + var7 = true; + this.flipTexture = false; + var5.setBrightness(this.renderMaxZ < 1.0D ? var12 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3, par4 + 1)); + var5.setColorOpaque_F(var10, var10, var10); + var14 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 3); + this.renderFaceZPos(par1Block, (double)par2, (double)par3, (double)par4, var14); + var7 = true; + this.flipTexture = false; + var5.setBrightness(this.renderMinX > 0.0D ? var12 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 - 1, par3, par4)); + var5.setColorOpaque_F(var11, var11, var11); + var14 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 4); + this.renderFaceXNeg(par1Block, (double)par2, (double)par3, (double)par4, var14); + var7 = true; + this.flipTexture = false; + var5.setBrightness(this.renderMaxX < 1.0D ? var12 : par1Block.getMixedBrightnessForBlock(this.blockAccess, par2 + 1, par3, par4)); + var5.setColorOpaque_F(var11, var11, var11); + var14 = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 5); + this.renderFaceXPos(par1Block, (double)par2, (double)par3, (double)par4, var14); + var7 = true; + this.flipTexture = false; + return var7; + } + + /** + * Renders the given texture to the bottom face of the block. Args: block, x, y, z, texture + */ + public void renderFaceYNeg(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + { + Tessellator var9 = Tessellator.instance; + + if (this.hasOverrideBlockTexture()) + { + par8Icon = this.overrideBlockTexture; + } + + double var10 = (double)par8Icon.getInterpolatedU(this.renderMinX * 16.0D); + double var12 = (double)par8Icon.getInterpolatedU(this.renderMaxX * 16.0D); + double var14 = (double)par8Icon.getInterpolatedV(this.renderMinZ * 16.0D); + double var16 = (double)par8Icon.getInterpolatedV(this.renderMaxZ * 16.0D); + + if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) + { + var10 = (double)par8Icon.getMinU(); + var12 = (double)par8Icon.getMaxU(); + } + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) + { + var14 = (double)par8Icon.getMinV(); + var16 = (double)par8Icon.getMaxV(); + } + + double var18 = var12; + double var20 = var10; + double var22 = var14; + double var24 = var16; + + if (this.uvRotateBottom == 2) + { + var10 = (double)par8Icon.getInterpolatedU(this.renderMinZ * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(this.renderMaxZ * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinX * 16.0D); + var22 = var14; + var24 = var16; + var18 = var10; + var20 = var12; + var14 = var16; + var16 = var22; + } + else if (this.uvRotateBottom == 1) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(this.renderMinX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(this.renderMaxX * 16.0D); + var18 = var12; + var20 = var10; + var10 = var12; + var12 = var20; + var22 = var16; + var24 = var14; + } + else if (this.uvRotateBottom == 3) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); + var18 = var12; + var20 = var10; + var22 = var14; + var24 = var16; + } + + double var26 = par2 + this.renderMinX; + double var28 = par2 + this.renderMaxX; + double var30 = par4 + this.renderMinY; + double var32 = par6 + this.renderMinZ; + double var34 = par6 + this.renderMaxZ; + + if (this.enableAO) + { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.setBrightness(this.brightnessTopLeft); + var9.addVertexWithUV(var26, var30, var34, var20, var24); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.setBrightness(this.brightnessBottomLeft); + var9.addVertexWithUV(var26, var30, var32, var10, var14); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.setBrightness(this.brightnessBottomRight); + var9.addVertexWithUV(var28, var30, var32, var18, var22); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.setBrightness(this.brightnessTopRight); + var9.addVertexWithUV(var28, var30, var34, var12, var16); + } + else + { + var9.addVertexWithUV(var26, var30, var34, var20, var24); + var9.addVertexWithUV(var26, var30, var32, var10, var14); + var9.addVertexWithUV(var28, var30, var32, var18, var22); + var9.addVertexWithUV(var28, var30, var34, var12, var16); + } + } + + /** + * Renders the given texture to the top face of the block. Args: block, x, y, z, texture + */ + public void renderFaceYPos(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + { + Tessellator var9 = Tessellator.instance; + + if (this.hasOverrideBlockTexture()) + { + par8Icon = this.overrideBlockTexture; + } + + double var10 = (double)par8Icon.getInterpolatedU(this.renderMinX * 16.0D); + double var12 = (double)par8Icon.getInterpolatedU(this.renderMaxX * 16.0D); + double var14 = (double)par8Icon.getInterpolatedV(this.renderMinZ * 16.0D); + double var16 = (double)par8Icon.getInterpolatedV(this.renderMaxZ * 16.0D); + + if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) + { + var10 = (double)par8Icon.getMinU(); + var12 = (double)par8Icon.getMaxU(); + } + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) + { + var14 = (double)par8Icon.getMinV(); + var16 = (double)par8Icon.getMaxV(); + } + + double var18 = var12; + double var20 = var10; + double var22 = var14; + double var24 = var16; + + if (this.uvRotateTop == 1) + { + var10 = (double)par8Icon.getInterpolatedU(this.renderMinZ * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(this.renderMaxZ * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinX * 16.0D); + var22 = var14; + var24 = var16; + var18 = var10; + var20 = var12; + var14 = var16; + var16 = var22; + } + else if (this.uvRotateTop == 2) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(this.renderMinX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(this.renderMaxX * 16.0D); + var18 = var12; + var20 = var10; + var10 = var12; + var12 = var20; + var22 = var16; + var24 = var14; + } + else if (this.uvRotateTop == 3) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); + var18 = var12; + var20 = var10; + var22 = var14; + var24 = var16; + } + + double var26 = par2 + this.renderMinX; + double var28 = par2 + this.renderMaxX; + double var30 = par4 + this.renderMaxY; + double var32 = par6 + this.renderMinZ; + double var34 = par6 + this.renderMaxZ; + + if (this.enableAO) + { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.setBrightness(this.brightnessTopLeft); + var9.addVertexWithUV(var28, var30, var34, var12, var16); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.setBrightness(this.brightnessBottomLeft); + var9.addVertexWithUV(var28, var30, var32, var18, var22); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.setBrightness(this.brightnessBottomRight); + var9.addVertexWithUV(var26, var30, var32, var10, var14); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.setBrightness(this.brightnessTopRight); + var9.addVertexWithUV(var26, var30, var34, var20, var24); + } + else + { + var9.addVertexWithUV(var28, var30, var34, var12, var16); + var9.addVertexWithUV(var28, var30, var32, var18, var22); + var9.addVertexWithUV(var26, var30, var32, var10, var14); + var9.addVertexWithUV(var26, var30, var34, var20, var24); + } + } + + /** + * Renders the given texture to the north (z-negative) face of the block. Args: block, x, y, z, texture + */ + public void renderFaceZNeg(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + { + Tessellator var9 = Tessellator.instance; + + if (this.hasOverrideBlockTexture()) + { + par8Icon = this.overrideBlockTexture; + } + + double var10 = (double)par8Icon.getInterpolatedU(this.renderMinX * 16.0D); + double var12 = (double)par8Icon.getInterpolatedU(this.renderMaxX * 16.0D); + double var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + double var18; + + if (this.flipTexture) + { + var18 = var10; + var10 = var12; + var12 = var18; + } + + if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) + { + var10 = (double)par8Icon.getMinU(); + var12 = (double)par8Icon.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) + { + var14 = (double)par8Icon.getMinV(); + var16 = (double)par8Icon.getMaxV(); + } + + var18 = var12; + double var20 = var10; + double var22 = var14; + double var24 = var16; + + if (this.uvRotateEast == 2) + { + var10 = (double)par8Icon.getInterpolatedU(this.renderMinY * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(this.renderMaxY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); + var22 = var14; + var24 = var16; + var18 = var10; + var20 = var12; + var14 = var16; + var16 = var22; + } + else if (this.uvRotateEast == 1) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(this.renderMaxX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(this.renderMinX * 16.0D); + var18 = var12; + var20 = var10; + var10 = var12; + var12 = var20; + var22 = var16; + var24 = var14; + } + else if (this.uvRotateEast == 3) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(this.renderMaxY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(this.renderMinY * 16.0D); + var18 = var12; + var20 = var10; + var22 = var14; + var24 = var16; + } + + double var26 = par2 + this.renderMinX; + double var28 = par2 + this.renderMaxX; + double var30 = par4 + this.renderMinY; + double var32 = par4 + this.renderMaxY; + double var34 = par6 + this.renderMinZ; + + if (this.enableAO) + { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.setBrightness(this.brightnessTopLeft); + var9.addVertexWithUV(var26, var32, var34, var18, var22); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.setBrightness(this.brightnessBottomLeft); + var9.addVertexWithUV(var28, var32, var34, var10, var14); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.setBrightness(this.brightnessBottomRight); + var9.addVertexWithUV(var28, var30, var34, var20, var24); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.setBrightness(this.brightnessTopRight); + var9.addVertexWithUV(var26, var30, var34, var12, var16); + } + else + { + var9.addVertexWithUV(var26, var32, var34, var18, var22); + var9.addVertexWithUV(var28, var32, var34, var10, var14); + var9.addVertexWithUV(var28, var30, var34, var20, var24); + var9.addVertexWithUV(var26, var30, var34, var12, var16); + } + } + + /** + * Renders the given texture to the south (z-positive) face of the block. Args: block, x, y, z, texture + */ + public void renderFaceZPos(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + { + Tessellator var9 = Tessellator.instance; + + if (this.hasOverrideBlockTexture()) + { + par8Icon = this.overrideBlockTexture; + } + + double var10 = (double)par8Icon.getInterpolatedU(this.renderMinX * 16.0D); + double var12 = (double)par8Icon.getInterpolatedU(this.renderMaxX * 16.0D); + double var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + double var18; + + if (this.flipTexture) + { + var18 = var10; + var10 = var12; + var12 = var18; + } + + if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) + { + var10 = (double)par8Icon.getMinU(); + var12 = (double)par8Icon.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) + { + var14 = (double)par8Icon.getMinV(); + var16 = (double)par8Icon.getMaxV(); + } + + var18 = var12; + double var20 = var10; + double var22 = var14; + double var24 = var16; + + if (this.uvRotateWest == 1) + { + var10 = (double)par8Icon.getInterpolatedU(this.renderMinY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(this.renderMaxY * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); + var22 = var14; + var24 = var16; + var18 = var10; + var20 = var12; + var14 = var16; + var16 = var22; + } + else if (this.uvRotateWest == 2) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(this.renderMinX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(this.renderMaxX * 16.0D); + var18 = var12; + var20 = var10; + var10 = var12; + var12 = var20; + var22 = var16; + var24 = var14; + } + else if (this.uvRotateWest == 3) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinX * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(this.renderMaxY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(this.renderMinY * 16.0D); + var18 = var12; + var20 = var10; + var22 = var14; + var24 = var16; + } + + double var26 = par2 + this.renderMinX; + double var28 = par2 + this.renderMaxX; + double var30 = par4 + this.renderMinY; + double var32 = par4 + this.renderMaxY; + double var34 = par6 + this.renderMaxZ; + + if (this.enableAO) + { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.setBrightness(this.brightnessTopLeft); + var9.addVertexWithUV(var26, var32, var34, var10, var14); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.setBrightness(this.brightnessBottomLeft); + var9.addVertexWithUV(var26, var30, var34, var20, var24); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.setBrightness(this.brightnessBottomRight); + var9.addVertexWithUV(var28, var30, var34, var12, var16); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.setBrightness(this.brightnessTopRight); + var9.addVertexWithUV(var28, var32, var34, var18, var22); + } + else + { + var9.addVertexWithUV(var26, var32, var34, var10, var14); + var9.addVertexWithUV(var26, var30, var34, var20, var24); + var9.addVertexWithUV(var28, var30, var34, var12, var16); + var9.addVertexWithUV(var28, var32, var34, var18, var22); + } + } + + /** + * Renders the given texture to the west (x-negative) face of the block. Args: block, x, y, z, texture + */ + public void renderFaceXNeg(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + { + Tessellator var9 = Tessellator.instance; + + if (this.hasOverrideBlockTexture()) + { + par8Icon = this.overrideBlockTexture; + } + + double var10 = (double)par8Icon.getInterpolatedU(this.renderMinZ * 16.0D); + double var12 = (double)par8Icon.getInterpolatedU(this.renderMaxZ * 16.0D); + double var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + double var18; + + if (this.flipTexture) + { + var18 = var10; + var10 = var12; + var12 = var18; + } + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) + { + var10 = (double)par8Icon.getMinU(); + var12 = (double)par8Icon.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) + { + var14 = (double)par8Icon.getMinV(); + var16 = (double)par8Icon.getMaxV(); + } + + var18 = var12; + double var20 = var10; + double var22 = var14; + double var24 = var16; + + if (this.uvRotateNorth == 1) + { + var10 = (double)par8Icon.getInterpolatedU(this.renderMinY * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(this.renderMaxY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); + var22 = var14; + var24 = var16; + var18 = var10; + var20 = var12; + var14 = var16; + var16 = var22; + } + else if (this.uvRotateNorth == 2) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(this.renderMinZ * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(this.renderMaxZ * 16.0D); + var18 = var12; + var20 = var10; + var10 = var12; + var12 = var20; + var22 = var16; + var24 = var14; + } + else if (this.uvRotateNorth == 3) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(this.renderMaxY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(this.renderMinY * 16.0D); + var18 = var12; + var20 = var10; + var22 = var14; + var24 = var16; + } + + double var26 = par2 + this.renderMinX; + double var28 = par4 + this.renderMinY; + double var30 = par4 + this.renderMaxY; + double var32 = par6 + this.renderMinZ; + double var34 = par6 + this.renderMaxZ; + + if (this.enableAO) + { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.setBrightness(this.brightnessTopLeft); + var9.addVertexWithUV(var26, var30, var34, var18, var22); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.setBrightness(this.brightnessBottomLeft); + var9.addVertexWithUV(var26, var30, var32, var10, var14); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.setBrightness(this.brightnessBottomRight); + var9.addVertexWithUV(var26, var28, var32, var20, var24); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.setBrightness(this.brightnessTopRight); + var9.addVertexWithUV(var26, var28, var34, var12, var16); + } + else + { + var9.addVertexWithUV(var26, var30, var34, var18, var22); + var9.addVertexWithUV(var26, var30, var32, var10, var14); + var9.addVertexWithUV(var26, var28, var32, var20, var24); + var9.addVertexWithUV(var26, var28, var34, var12, var16); + } + } + + /** + * Renders the given texture to the east (x-positive) face of the block. Args: block, x, y, z, texture + */ + public void renderFaceXPos(Block par1Block, double par2, double par4, double par6, Icon par8Icon) + { + Tessellator var9 = Tessellator.instance; + + if (this.hasOverrideBlockTexture()) + { + par8Icon = this.overrideBlockTexture; + } + + double var10 = (double)par8Icon.getInterpolatedU(this.renderMinZ * 16.0D); + double var12 = (double)par8Icon.getInterpolatedU(this.renderMaxZ * 16.0D); + double var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + double var18; + + if (this.flipTexture) + { + var18 = var10; + var10 = var12; + var12 = var18; + } + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) + { + var10 = (double)par8Icon.getMinU(); + var12 = (double)par8Icon.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) + { + var14 = (double)par8Icon.getMinV(); + var16 = (double)par8Icon.getMaxV(); + } + + var18 = var12; + double var20 = var10; + double var22 = var14; + double var24 = var16; + + if (this.uvRotateSouth == 2) + { + var10 = (double)par8Icon.getInterpolatedU(this.renderMinY * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(this.renderMaxY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); + var22 = var14; + var24 = var16; + var18 = var10; + var20 = var12; + var14 = var16; + var16 = var22; + } + else if (this.uvRotateSouth == 1) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(this.renderMaxZ * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(this.renderMinZ * 16.0D); + var18 = var12; + var20 = var10; + var10 = var12; + var12 = var20; + var22 = var16; + var24 = var14; + } + else if (this.uvRotateSouth == 3) + { + var10 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); + var12 = (double)par8Icon.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); + var14 = (double)par8Icon.getInterpolatedV(this.renderMaxY * 16.0D); + var16 = (double)par8Icon.getInterpolatedV(this.renderMinY * 16.0D); + var18 = var12; + var20 = var10; + var22 = var14; + var24 = var16; + } + + double var26 = par2 + this.renderMaxX; + double var28 = par4 + this.renderMinY; + double var30 = par4 + this.renderMaxY; + double var32 = par6 + this.renderMinZ; + double var34 = par6 + this.renderMaxZ; + + if (this.enableAO) + { + var9.setColorOpaque_F(this.colorRedTopLeft, this.colorGreenTopLeft, this.colorBlueTopLeft); + var9.setBrightness(this.brightnessTopLeft); + var9.addVertexWithUV(var26, var28, var34, var20, var24); + var9.setColorOpaque_F(this.colorRedBottomLeft, this.colorGreenBottomLeft, this.colorBlueBottomLeft); + var9.setBrightness(this.brightnessBottomLeft); + var9.addVertexWithUV(var26, var28, var32, var12, var16); + var9.setColorOpaque_F(this.colorRedBottomRight, this.colorGreenBottomRight, this.colorBlueBottomRight); + var9.setBrightness(this.brightnessBottomRight); + var9.addVertexWithUV(var26, var30, var32, var18, var22); + var9.setColorOpaque_F(this.colorRedTopRight, this.colorGreenTopRight, this.colorBlueTopRight); + var9.setBrightness(this.brightnessTopRight); + var9.addVertexWithUV(var26, var30, var34, var10, var14); + } + else + { + var9.addVertexWithUV(var26, var28, var34, var20, var24); + var9.addVertexWithUV(var26, var28, var32, var12, var16); + var9.addVertexWithUV(var26, var30, var32, var18, var22); + var9.addVertexWithUV(var26, var30, var34, var10, var14); + } + } + + /** + * Is called to render the image of a block on an inventory, as a held item, or as a an item on the ground + */ + public void renderBlockAsItem(Block par1Block, int par2, float par3) + { + Tessellator var4 = Tessellator.instance; + boolean var5 = par1Block.blockID == Block.grass.blockID; + + if (par1Block == Block.dispenser || par1Block == Block.dropper || par1Block == Block.furnaceIdle) + { + par2 = 3; + } + + int var6; + float var7; + float var8; + float var9; + + if (this.useInventoryTint) + { + var6 = par1Block.getRenderColor(par2); + + if (var5) + { + var6 = 16777215; + } + + var7 = (float)(var6 >> 16 & 255) / 255.0F; + var8 = (float)(var6 >> 8 & 255) / 255.0F; + var9 = (float)(var6 & 255) / 255.0F; + GL11.glColor4f(var7 * par3, var8 * par3, var9 * par3, 1.0F); + } + + var6 = par1Block.getRenderType(); + this.setRenderBoundsFromBlock(par1Block); + int var14; + + if (var6 != 0 && var6 != 31 && var6 != 39 && var6 != 16 && var6 != 26) + { + if (var6 == 1) + { + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.drawCrossedSquares(par1Block, par2, -0.5D, -0.5D, -0.5D, 1.0F); + var4.draw(); + } + else if (var6 == 19) + { + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + par1Block.setBlockBoundsForItemRender(); + this.renderBlockStemSmall(par1Block, par2, this.renderMaxY, -0.5D, -0.5D, -0.5D); + var4.draw(); + } + else if (var6 == 23) + { + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + par1Block.setBlockBoundsForItemRender(); + var4.draw(); + } + else if (var6 == 13) + { + par1Block.setBlockBoundsForItemRender(); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var7 = 0.0625F; + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderFaceYNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 0)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 1)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, -1.0F); + var4.addTranslation(0.0F, 0.0F, var7); + this.renderFaceZNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 2)); + var4.addTranslation(0.0F, 0.0F, -var7); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, 1.0F); + var4.addTranslation(0.0F, 0.0F, -var7); + this.renderFaceZPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 3)); + var4.addTranslation(0.0F, 0.0F, var7); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(-1.0F, 0.0F, 0.0F); + var4.addTranslation(var7, 0.0F, 0.0F); + this.renderFaceXNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 4)); + var4.addTranslation(-var7, 0.0F, 0.0F); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(1.0F, 0.0F, 0.0F); + var4.addTranslation(-var7, 0.0F, 0.0F); + this.renderFaceXPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 5)); + var4.addTranslation(var7, 0.0F, 0.0F); + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + else if (var6 == 22) + { + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + ChestItemRenderHelper.instance.renderChest(par1Block, par2, par3); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + } + else if (var6 == 6) + { + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderBlockCropsImpl(par1Block, par2, -0.5D, -0.5D, -0.5D); + var4.draw(); + } + else if (var6 == 2) + { + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderTorchAtAngle(par1Block, -0.5D, -0.5D, -0.5D, 0.0D, 0.0D, 0); + var4.draw(); + } + else if (var6 == 10) + { + for (var14 = 0; var14 < 2; ++var14) + { + if (var14 == 0) + { + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.5D); + } + + if (var14 == 1) + { + this.setRenderBounds(0.0D, 0.0D, 0.5D, 1.0D, 0.5D, 1.0D); + } + + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderFaceYNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 0)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 1)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, -1.0F); + this.renderFaceZNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, 1.0F); + this.renderFaceZPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 3)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(-1.0F, 0.0F, 0.0F); + this.renderFaceXNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 4)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(1.0F, 0.0F, 0.0F); + this.renderFaceXPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 5)); + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + } + else if (var6 == 27) + { + var14 = 0; + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var4.startDrawingQuads(); + + for (int var15 = 0; var15 < 8; ++var15) + { + byte var16 = 0; + byte var17 = 1; + + if (var15 == 0) + { + var16 = 2; + } + + if (var15 == 1) + { + var16 = 3; + } + + if (var15 == 2) + { + var16 = 4; + } + + if (var15 == 3) + { + var16 = 5; + var17 = 2; + } + + if (var15 == 4) + { + var16 = 6; + var17 = 3; + } + + if (var15 == 5) + { + var16 = 7; + var17 = 5; + } + + if (var15 == 6) + { + var16 = 6; + var17 = 2; + } + + if (var15 == 7) + { + var16 = 3; + } + + float var11 = (float)var16 / 16.0F; + float var12 = 1.0F - (float)var14 / 16.0F; + float var13 = 1.0F - (float)(var14 + var17) / 16.0F; + var14 += var17; + this.setRenderBounds((double)(0.5F - var11), (double)var13, (double)(0.5F - var11), (double)(0.5F + var11), (double)var12, (double)(0.5F + var11)); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderFaceYNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 0)); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 1)); + var4.setNormal(0.0F, 0.0F, -1.0F); + this.renderFaceZNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 2)); + var4.setNormal(0.0F, 0.0F, 1.0F); + this.renderFaceZPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 3)); + var4.setNormal(-1.0F, 0.0F, 0.0F); + this.renderFaceXNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 4)); + var4.setNormal(1.0F, 0.0F, 0.0F); + this.renderFaceXPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 5)); + } + + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + } + else if (var6 == 11) + { + for (var14 = 0; var14 < 4; ++var14) + { + var8 = 0.125F; + + if (var14 == 0) + { + this.setRenderBounds((double)(0.5F - var8), 0.0D, 0.0D, (double)(0.5F + var8), 1.0D, (double)(var8 * 2.0F)); + } + + if (var14 == 1) + { + this.setRenderBounds((double)(0.5F - var8), 0.0D, (double)(1.0F - var8 * 2.0F), (double)(0.5F + var8), 1.0D, 1.0D); + } + + var8 = 0.0625F; + + if (var14 == 2) + { + this.setRenderBounds((double)(0.5F - var8), (double)(1.0F - var8 * 3.0F), (double)(-var8 * 2.0F), (double)(0.5F + var8), (double)(1.0F - var8), (double)(1.0F + var8 * 2.0F)); + } + + if (var14 == 3) + { + this.setRenderBounds((double)(0.5F - var8), (double)(0.5F - var8 * 3.0F), (double)(-var8 * 2.0F), (double)(0.5F + var8), (double)(0.5F - var8), (double)(1.0F + var8 * 2.0F)); + } + + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderFaceYNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 0)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 1)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, -1.0F); + this.renderFaceZNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, 1.0F); + this.renderFaceZPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 3)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(-1.0F, 0.0F, 0.0F); + this.renderFaceXNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 4)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(1.0F, 0.0F, 0.0F); + this.renderFaceXPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 5)); + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + } + else if (var6 == 21) + { + for (var14 = 0; var14 < 3; ++var14) + { + var8 = 0.0625F; + + if (var14 == 0) + { + this.setRenderBounds((double)(0.5F - var8), 0.30000001192092896D, 0.0D, (double)(0.5F + var8), 1.0D, (double)(var8 * 2.0F)); + } + + if (var14 == 1) + { + this.setRenderBounds((double)(0.5F - var8), 0.30000001192092896D, (double)(1.0F - var8 * 2.0F), (double)(0.5F + var8), 1.0D, 1.0D); + } + + var8 = 0.0625F; + + if (var14 == 2) + { + this.setRenderBounds((double)(0.5F - var8), 0.5D, 0.0D, (double)(0.5F + var8), (double)(1.0F - var8), 1.0D); + } + + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderFaceYNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 0)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 1)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, -1.0F); + this.renderFaceZNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, 1.0F); + this.renderFaceZPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 3)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(-1.0F, 0.0F, 0.0F); + this.renderFaceXNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 4)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(1.0F, 0.0F, 0.0F); + this.renderFaceXPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSide(par1Block, 5)); + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + } + else if (var6 == 32) + { + for (var14 = 0; var14 < 2; ++var14) + { + if (var14 == 0) + { + this.setRenderBounds(0.0D, 0.0D, 0.3125D, 1.0D, 0.8125D, 0.6875D); + } + + if (var14 == 1) + { + this.setRenderBounds(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D); + } + + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderFaceYNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 0, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 1, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, -1.0F); + this.renderFaceZNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 2, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, 1.0F); + this.renderFaceZPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 3, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(-1.0F, 0.0F, 0.0F); + this.renderFaceXNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 4, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(1.0F, 0.0F, 0.0F); + this.renderFaceXPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 5, par2)); + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + } + else if (var6 == 35) + { + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + this.renderBlockAnvilOrient((BlockAnvil)par1Block, 0, 0, 0, par2 << 2, true); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + else if (var6 == 34) + { + for (var14 = 0; var14 < 3; ++var14) + { + if (var14 == 0) + { + this.setRenderBounds(0.125D, 0.0D, 0.125D, 0.875D, 0.1875D, 0.875D); + this.setOverrideBlockTexture(this.getBlockIcon(Block.obsidian)); + } + else if (var14 == 1) + { + this.setRenderBounds(0.1875D, 0.1875D, 0.1875D, 0.8125D, 0.875D, 0.8125D); + this.setOverrideBlockTexture(this.getBlockIcon(Block.beacon)); + } + else if (var14 == 2) + { + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + this.setOverrideBlockTexture(this.getBlockIcon(Block.glass)); + } + + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderFaceYNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 0, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 1, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, -1.0F); + this.renderFaceZNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 2, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, 1.0F); + this.renderFaceZPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 3, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(-1.0F, 0.0F, 0.0F); + this.renderFaceXNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 4, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(1.0F, 0.0F, 0.0F); + this.renderFaceXPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 5, par2)); + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + + this.setRenderBounds(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); + this.clearOverrideBlockTexture(); + } + else if (var6 == 38) + { + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + this.renderBlockHopperMetadata((BlockHopper)par1Block, 0, 0, 0, 0, true); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + } + else + { + if (var6 == 16) + { + par2 = 1; + } + + par1Block.setBlockBoundsForItemRender(); + this.setRenderBoundsFromBlock(par1Block); + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + var4.startDrawingQuads(); + var4.setNormal(0.0F, -1.0F, 0.0F); + this.renderFaceYNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 0, par2)); + var4.draw(); + + if (var5 && this.useInventoryTint) + { + var14 = par1Block.getRenderColor(par2); + var8 = (float)(var14 >> 16 & 255) / 255.0F; + var9 = (float)(var14 >> 8 & 255) / 255.0F; + float var10 = (float)(var14 & 255) / 255.0F; + GL11.glColor4f(var8 * par3, var9 * par3, var10 * par3, 1.0F); + } + + var4.startDrawingQuads(); + var4.setNormal(0.0F, 1.0F, 0.0F); + this.renderFaceYPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 1, par2)); + var4.draw(); + + if (var5 && this.useInventoryTint) + { + GL11.glColor4f(par3, par3, par3, 1.0F); + } + + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, -1.0F); + this.renderFaceZNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 2, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(0.0F, 0.0F, 1.0F); + this.renderFaceZPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 3, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(-1.0F, 0.0F, 0.0F); + this.renderFaceXNeg(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 4, par2)); + var4.draw(); + var4.startDrawingQuads(); + var4.setNormal(1.0F, 0.0F, 0.0F); + this.renderFaceXPos(par1Block, 0.0D, 0.0D, 0.0D, this.getBlockIconFromSideAndMetadata(par1Block, 5, par2)); + var4.draw(); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + } + } + + /** + * Checks to see if the item's render type indicates that it should be rendered as a regular block or not. + */ + public static boolean renderItemIn3d(int par0) + { + return par0 == 0 ? true : (par0 == 31 ? true : (par0 == 39 ? true : (par0 == 13 ? true : (par0 == 10 ? true : (par0 == 11 ? true : (par0 == 27 ? true : (par0 == 22 ? true : (par0 == 21 ? true : (par0 == 16 ? true : (par0 == 26 ? true : (par0 == 32 ? true : (par0 == 34 ? true : par0 == 35)))))))))))); + } + + public Icon getBlockIcon(Block par1Block, IBlockAccess par2IBlockAccess, int par3, int par4, int par5, int par6) + { + return this.getIconSafe(par1Block.getBlockTexture(par2IBlockAccess, par3, par4, par5, par6)); + } + + public Icon getBlockIconFromSideAndMetadata(Block par1Block, int par2, int par3) + { + return this.getIconSafe(par1Block.getIcon(par2, par3)); + } + + public Icon getBlockIconFromSide(Block par1Block, int par2) + { + return this.getIconSafe(par1Block.getBlockTextureFromSide(par2)); + } + + public Icon getBlockIcon(Block par1Block) + { + return this.getIconSafe(par1Block.getBlockTextureFromSide(1)); + } + + public Icon getIconSafe(Icon par1Icon) + { + if (par1Icon == null) + { + par1Icon = ((TextureMap)Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno"); + } + + return (Icon)par1Icon; + } +} diff --git a/src/main/java/net/minecraft/src/RenderBoat.java b/src/main/java/net/minecraft/src/RenderBoat.java new file mode 100644 index 0000000..3a6d003 --- /dev/null +++ b/src/main/java/net/minecraft/src/RenderBoat.java @@ -0,0 +1,71 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderBoat extends Render +{ + private static final ResourceLocation boatTextures = new ResourceLocation("textures/entity/boat.png"); + + /** instance of ModelBoat for rendering */ + protected ModelBase modelBoat; + + public RenderBoat() + { + this.shadowSize = 0.5F; + this.modelBoat = new ModelBoat(); + } + + /** + * The render method used in RenderBoat that renders the boat model. + */ + public void renderBoat(EntityBoat par1EntityBoat, double par2, double par4, double par6, float par8, float par9) + { + GL11.glPushMatrix(); + GL11.glTranslatef((float)par2, (float)par4, (float)par6); + GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F); + float var10 = (float)par1EntityBoat.getTimeSinceHit() - par9; + float var11 = par1EntityBoat.getDamageTaken() - par9; + + if (var11 < 0.0F) + { + var11 = 0.0F; + } + + if (var10 > 0.0F) + { + GL11.glRotatef(MathHelper.sin(var10) * var10 * var11 / 10.0F * (float)par1EntityBoat.getForwardDirection(), 1.0F, 0.0F, 0.0F); + } + + float var12 = 0.75F; + GL11.glScalef(var12, var12, var12); + GL11.glScalef(1.0F / var12, 1.0F / var12, 1.0F / var12); + this.bindEntityTexture(par1EntityBoat); + GL11.glScalef(-1.0F, -1.0F, 1.0F); + this.modelBoat.render(par1EntityBoat, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); + GL11.glPopMatrix(); + } + + protected ResourceLocation getBoatTextures(EntityBoat par1EntityBoat) + { + return boatTextures; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity par1Entity) + { + return this.getBoatTextures((EntityBoat)par1Entity); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render 1.0F) + { + var3 = 1.0F; + } + + var3 *= var3; + var3 *= var3; + float var5 = (1.0F + var3 * 0.4F) * var4; + float var6 = (1.0F + var3 * 0.1F) / var4; + GL11.glScalef(var5, var6, var5); + } + + /** + * Updates color multiplier based on creeper state called by getColorMultiplier + */ + protected int updateCreeperColorMultiplier(EntityCreeper par1EntityCreeper, float par2, float par3) + { + float var4 = par1EntityCreeper.getCreeperFlashIntensity(par3); + + if ((int)(var4 * 10.0F) % 2 == 0) + { + return 0; + } + else + { + int var5 = (int)(var4 * 0.2F * 255.0F); + + if (var5 < 0) + { + var5 = 0; + } + + if (var5 > 255) + { + var5 = 255; + } + + short var6 = 255; + short var7 = 255; + short var8 = 255; + return var5 << 24 | var6 << 16 | var7 << 8 | var8; + } + } + + /** + * A method used to render a creeper's powered form as a pass model. + */ + protected int renderCreeperPassModel(EntityCreeper par1EntityCreeper, int par2, float par3) + { + if (par1EntityCreeper.getPowered()) + { + if (par1EntityCreeper.isInvisible()) + { + GL11.glDepthMask(false); + } + else + { + GL11.glDepthMask(true); + } + + if (par2 == 1) + { + float var4 = (float)par1EntityCreeper.ticksExisted + par3; + this.bindTexture(armoredCreeperTextures); + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glLoadIdentity(); + float var5 = var4 * 0.01F; + float var6 = var4 * 0.01F; + GL11.glTranslatef(var5, var6, 0.0F); + this.setRenderPassModel(this.creeperModel); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glEnable(GL11.GL_BLEND); + float var7 = 0.5F; + GL11.glColor4f(var7, var7, var7, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + return 1; + } + + if (par2 == 2) + { + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glLoadIdentity(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + } + } + + return -1; + } + + protected int func_77061_b(EntityCreeper par1EntityCreeper, int par2, float par3) + { + return -1; + } + + protected ResourceLocation getCreeperTextures(EntityCreeper par1EntityCreeper) + { + return creeperTextures; + } + + /** + * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: + * entityLiving, partialTickTime + */ + protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2) + { + this.updateCreeperScale((EntityCreeper)par1EntityLivingBase, par2); + } + + /** + * Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime + */ + protected int getColorMultiplier(EntityLivingBase par1EntityLivingBase, float par2, float par3) + { + return this.updateCreeperColorMultiplier((EntityCreeper)par1EntityLivingBase, par2, par3); + } + + /** + * Queries whether should render the specified pass or not. + */ + protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3) + { + return this.renderCreeperPassModel((EntityCreeper)par1EntityLivingBase, par2, par3); + } + + protected int inheritRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3) + { + return this.func_77061_b((EntityCreeper)par1EntityLivingBase, par2, par3); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity par1Entity) + { + return this.getCreeperTextures((EntityCreeper)par1Entity); + } +} diff --git a/src/main/java/net/minecraft/src/RenderDragon.java b/src/main/java/net/minecraft/src/RenderDragon.java new file mode 100644 index 0000000..11b01e4 --- /dev/null +++ b/src/main/java/net/minecraft/src/RenderDragon.java @@ -0,0 +1,289 @@ +package net.minecraft.src; + +import java.util.Random; +import org.lwjgl.opengl.GL11; + +public class RenderDragon extends RenderLiving +{ + private static final ResourceLocation enderDragonExplodingTextures = new ResourceLocation("textures/entity/enderdragon/dragon_exploding.png"); + private static final ResourceLocation enderDragonCrystalBeamTextures = new ResourceLocation("textures/entity/endercrystal/endercrystal_beam.png"); + private static final ResourceLocation enderDragonEyesTextures = new ResourceLocation("textures/entity/enderdragon/dragon_eyes.png"); + private static final ResourceLocation enderDragonTextures = new ResourceLocation("textures/entity/enderdragon/dragon.png"); + + /** An instance of the dragon model in RenderDragon */ + protected ModelDragon modelDragon; + + public RenderDragon() + { + super(new ModelDragon(0.0F), 0.5F); + this.modelDragon = (ModelDragon)this.mainModel; + this.setRenderPassModel(this.mainModel); + } + + /** + * Used to rotate the dragon as a whole in RenderDragon. It's called in the rotateCorpse method. + */ + protected void rotateDragonBody(EntityDragon par1EntityDragon, float par2, float par3, float par4) + { + float var5 = (float)par1EntityDragon.getMovementOffsets(7, par4)[0]; + float var6 = (float)(par1EntityDragon.getMovementOffsets(5, par4)[1] - par1EntityDragon.getMovementOffsets(10, par4)[1]); + GL11.glRotatef(-var5, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(var6 * 10.0F, 1.0F, 0.0F, 0.0F); + GL11.glTranslatef(0.0F, 0.0F, 1.0F); + + if (par1EntityDragon.deathTime > 0) + { + float var7 = ((float)par1EntityDragon.deathTime + par4 - 1.0F) / 20.0F * 1.6F; + var7 = MathHelper.sqrt_float(var7); + + if (var7 > 1.0F) + { + var7 = 1.0F; + } + + GL11.glRotatef(var7 * this.getDeathMaxRotation(par1EntityDragon), 0.0F, 0.0F, 1.0F); + } + } + + /** + * Renders the dragon model. Called by renderModel. + */ + protected void renderDragonModel(EntityDragon par1EntityDragon, float par2, float par3, float par4, float par5, float par6, float par7) + { + if (par1EntityDragon.deathTicks > 0) + { + float var8 = (float)par1EntityDragon.deathTicks / 200.0F; + GL11.glDepthFunc(GL11.GL_LEQUAL); + GL11.glEnable(GL11.GL_ALPHA_TEST); + GL11.glAlphaFunc(GL11.GL_GREATER, var8); + this.bindTexture(enderDragonExplodingTextures); + this.mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + GL11.glDepthFunc(GL11.GL_EQUAL); + } + + this.bindEntityTexture(par1EntityDragon); + this.mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7); + + if (par1EntityDragon.hurtTime > 0) + { + GL11.glDepthFunc(GL11.GL_EQUAL); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F); + this.mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_BLEND); + GL11.glDepthFunc(GL11.GL_LEQUAL); + } + } + + /** + * Renders the dragon, along with its dying animation + */ + public void renderDragon(EntityDragon par1EntityDragon, double par2, double par4, double par6, float par8, float par9) + { + BossStatus.setBossStatus(par1EntityDragon, false); + super.doRenderLiving(par1EntityDragon, par2, par4, par6, par8, par9); + + if (par1EntityDragon.healingEnderCrystal != null) + { + float var10 = (float)par1EntityDragon.healingEnderCrystal.innerRotation + par9; + float var11 = MathHelper.sin(var10 * 0.2F) / 2.0F + 0.5F; + var11 = (var11 * var11 + var11) * 0.2F; + float var12 = (float)(par1EntityDragon.healingEnderCrystal.posX - par1EntityDragon.posX - (par1EntityDragon.prevPosX - par1EntityDragon.posX) * (double)(1.0F - par9)); + float var13 = (float)((double)var11 + par1EntityDragon.healingEnderCrystal.posY - 1.0D - par1EntityDragon.posY - (par1EntityDragon.prevPosY - par1EntityDragon.posY) * (double)(1.0F - par9)); + float var14 = (float)(par1EntityDragon.healingEnderCrystal.posZ - par1EntityDragon.posZ - (par1EntityDragon.prevPosZ - par1EntityDragon.posZ) * (double)(1.0F - par9)); + float var15 = MathHelper.sqrt_float(var12 * var12 + var14 * var14); + float var16 = MathHelper.sqrt_float(var12 * var12 + var13 * var13 + var14 * var14); + GL11.glPushMatrix(); + GL11.glTranslatef((float)par2, (float)par4 + 2.0F, (float)par6); + GL11.glRotatef((float)(-Math.atan2((double)var14, (double)var12)) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef((float)(-Math.atan2((double)var15, (double)var13)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F); + Tessellator var17 = Tessellator.instance; + RenderHelper.disableStandardItemLighting(); + GL11.glDisable(GL11.GL_CULL_FACE); + this.bindTexture(enderDragonCrystalBeamTextures); + GL11.glShadeModel(GL11.GL_SMOOTH); + float var18 = 0.0F - ((float)par1EntityDragon.ticksExisted + par9) * 0.01F; + float var19 = MathHelper.sqrt_float(var12 * var12 + var13 * var13 + var14 * var14) / 32.0F - ((float)par1EntityDragon.ticksExisted + par9) * 0.01F; + var17.startDrawing(5); + byte var20 = 8; + + for (int var21 = 0; var21 <= var20; ++var21) + { + float var22 = MathHelper.sin((float)(var21 % var20) * (float)Math.PI * 2.0F / (float)var20) * 0.75F; + float var23 = MathHelper.cos((float)(var21 % var20) * (float)Math.PI * 2.0F / (float)var20) * 0.75F; + float var24 = (float)(var21 % var20) * 1.0F / (float)var20; + var17.setColorOpaque_I(0); + var17.addVertexWithUV((double)(var22 * 0.2F), (double)(var23 * 0.2F), 0.0D, (double)var24, (double)var19); + var17.setColorOpaque_I(16777215); + var17.addVertexWithUV((double)var22, (double)var23, (double)var16, (double)var24, (double)var18); + } + + var17.draw(); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glShadeModel(GL11.GL_FLAT); + RenderHelper.enableStandardItemLighting(); + GL11.glPopMatrix(); + } + } + + protected ResourceLocation getEnderDragonTextures(EntityDragon par1EntityDragon) + { + return enderDragonTextures; + } + + /** + * Renders the animation for when an enderdragon dies + */ + protected void renderDragonDying(EntityDragon par1EntityDragon, float par2) + { + super.renderEquippedItems(par1EntityDragon, par2); + Tessellator var3 = Tessellator.instance; + + if (par1EntityDragon.deathTicks > 0) + { + RenderHelper.disableStandardItemLighting(); + float var4 = ((float)par1EntityDragon.deathTicks + par2) / 200.0F; + float var5 = 0.0F; + + if (var4 > 0.8F) + { + var5 = (var4 - 0.8F) / 0.2F; + } + + Random var6 = new Random(432L); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glEnable(GL11.GL_CULL_FACE); + GL11.glDepthMask(false); + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, -1.0F, -2.0F); + + for (int var7 = 0; (float)var7 < (var4 + var4 * var4) / 2.0F * 60.0F; ++var7) + { + GL11.glRotatef(var6.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var6.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(var6.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(var6.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(var6.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(var6.nextFloat() * 360.0F + var4 * 90.0F, 0.0F, 0.0F, 1.0F); + var3.startDrawing(6); + float var8 = var6.nextFloat() * 20.0F + 5.0F + var5 * 10.0F; + float var9 = var6.nextFloat() * 2.0F + 1.0F + var5 * 2.0F; + var3.setColorRGBA_I(16777215, (int)(255.0F * (1.0F - var5))); + var3.addVertex(0.0D, 0.0D, 0.0D); + var3.setColorRGBA_I(16711935, 0); + var3.addVertex(-0.866D * (double)var9, (double)var8, (double)(-0.5F * var9)); + var3.addVertex(0.866D * (double)var9, (double)var8, (double)(-0.5F * var9)); + var3.addVertex(0.0D, (double)var8, (double)(1.0F * var9)); + var3.addVertex(-0.866D * (double)var9, (double)var8, (double)(-0.5F * var9)); + var3.draw(); + } + + GL11.glPopMatrix(); + GL11.glDepthMask(true); + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_BLEND); + GL11.glShadeModel(GL11.GL_FLAT); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_ALPHA_TEST); + RenderHelper.enableStandardItemLighting(); + } + } + + /** + * Renders the overlay for glowing eyes and the mouth. Called by shouldRenderPass. + */ + protected int renderGlow(EntityDragon par1EntityDragon, int par2, float par3) + { + if (par2 == 1) + { + GL11.glDepthFunc(GL11.GL_LEQUAL); + } + + if (par2 != 0) + { + return -1; + } + else + { + this.bindTexture(enderDragonEyesTextures); + float var4 = 1.0F; + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDepthFunc(GL11.GL_EQUAL); + char var5 = 61680; + int var6 = var5 % 65536; + int var7 = var5 / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)var6 / 1.0F, (float)var7 / 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glColor4f(1.0F, 1.0F, 1.0F, var4); + return 1; + } + } + + public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) + { + this.renderDragon((EntityDragon)par1EntityLiving, par2, par4, par6, par8, par9); + } + + /** + * Queries whether should render the specified pass or not. + */ + protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3) + { + return this.renderGlow((EntityDragon)par1EntityLivingBase, par2, par3); + } + + protected void renderEquippedItems(EntityLivingBase par1EntityLivingBase, float par2) + { + this.renderDragonDying((EntityDragon)par1EntityLivingBase, par2); + } + + protected void rotateCorpse(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4) + { + this.rotateDragonBody((EntityDragon)par1EntityLivingBase, par2, par3, par4); + } + + /** + * Renders the model in RenderLiving + */ + protected void renderModel(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4, float par5, float par6, float par7) + { + this.renderDragonModel((EntityDragon)par1EntityLivingBase, par2, par3, par4, par5, par6, par7); + } + + public void renderPlayer(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9) + { + this.renderDragon((EntityDragon)par1EntityLivingBase, par2, par4, par6, par8, par9); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity par1Entity) + { + return this.getEnderDragonTextures((EntityDragon)par1Entity); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render= (float)Math.PI; var10 -= ((float)Math.PI * 2F)) + { + ; + } + + while (var10 < -(float)Math.PI) + { + var10 += ((float)Math.PI * 2F); + } + + float var11 = par1TileEntityEnchantmentTable.bookRotationPrev + var10 * par8; + GL11.glRotatef(-var11 * 180.0F / (float)Math.PI, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(80.0F, 0.0F, 0.0F, 1.0F); + this.bindTexture(enchantingTableBookTextures); + float var12 = par1TileEntityEnchantmentTable.pageFlipPrev + (par1TileEntityEnchantmentTable.pageFlip - par1TileEntityEnchantmentTable.pageFlipPrev) * par8 + 0.25F; + float var13 = par1TileEntityEnchantmentTable.pageFlipPrev + (par1TileEntityEnchantmentTable.pageFlip - par1TileEntityEnchantmentTable.pageFlipPrev) * par8 + 0.75F; + var12 = (var12 - (float)MathHelper.truncateDoubleToInt((double)var12)) * 1.6F - 0.3F; + var13 = (var13 - (float)MathHelper.truncateDoubleToInt((double)var13)) * 1.6F - 0.3F; + + if (var12 < 0.0F) + { + var12 = 0.0F; + } + + if (var13 < 0.0F) + { + var13 = 0.0F; + } + + if (var12 > 1.0F) + { + var12 = 1.0F; + } + + if (var13 > 1.0F) + { + var13 = 1.0F; + } + + float var14 = par1TileEntityEnchantmentTable.bookSpreadPrev + (par1TileEntityEnchantmentTable.bookSpread - par1TileEntityEnchantmentTable.bookSpreadPrev) * par8; + GL11.glEnable(GL11.GL_CULL_FACE); + this.enchantmentBook.render((Entity)null, var9, var12, var13, var14, 0.0F, 0.0625F); + GL11.glPopMatrix(); + } + + public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) + { + this.renderTileEntityEnchantmentTableAt((TileEntityEnchantmentTable)par1TileEntity, par2, par4, par6, par8); + } +} diff --git a/src/main/java/net/minecraft/src/RenderEndPortal.java b/src/main/java/net/minecraft/src/RenderEndPortal.java new file mode 100644 index 0000000..d982527 --- /dev/null +++ b/src/main/java/net/minecraft/src/RenderEndPortal.java @@ -0,0 +1,124 @@ +package net.minecraft.src; + +import java.nio.FloatBuffer; +import java.util.Random; +import org.lwjgl.opengl.GL11; + +public class RenderEndPortal extends TileEntitySpecialRenderer +{ + private static final ResourceLocation enderPortalEndSkyTextures = new ResourceLocation("textures/environment/end_sky.png"); + private static final ResourceLocation endPortalTextures = new ResourceLocation("textures/entity/end_portal.png"); + private static final Random field_110644_e = new Random(31100L); + FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16); + + /** + * Renders the End Portal. + */ + public void renderEndPortalTileEntity(TileEntityEndPortal par1TileEntityEndPortal, double par2, double par4, double par6, float par8) + { + float var9 = (float)this.tileEntityRenderer.playerX; + float var10 = (float)this.tileEntityRenderer.playerY; + float var11 = (float)this.tileEntityRenderer.playerZ; + GL11.glDisable(GL11.GL_LIGHTING); + field_110644_e.setSeed(31100L); + float var12 = 0.75F; + + for (int var13 = 0; var13 < 16; ++var13) + { + GL11.glPushMatrix(); + float var14 = (float)(16 - var13); + float var15 = 0.0625F; + float var16 = 1.0F / (var14 + 1.0F); + + if (var13 == 0) + { + this.bindTexture(enderPortalEndSkyTextures); + var16 = 0.1F; + var14 = 65.0F; + var15 = 0.125F; + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + } + + if (var13 == 1) + { + this.bindTexture(endPortalTextures); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + var15 = 0.5F; + } + + float var17 = (float)(-(par4 + (double)var12)); + float var18 = var17 + ActiveRenderInfo.objectY; + float var19 = var17 + var14 + ActiveRenderInfo.objectY; + float var20 = var18 / var19; + var20 += (float)(par4 + (double)var12); + GL11.glTranslatef(var9, var20, var11); + GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); + GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); + GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR); + GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR); + GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.func_76907_a(1.0F, 0.0F, 0.0F, 0.0F)); + GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.func_76907_a(0.0F, 0.0F, 1.0F, 0.0F)); + GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.func_76907_a(0.0F, 0.0F, 0.0F, 1.0F)); + GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, this.func_76907_a(0.0F, 1.0F, 0.0F, 0.0F)); + GL11.glEnable(GL11.GL_TEXTURE_GEN_S); + GL11.glEnable(GL11.GL_TEXTURE_GEN_T); + GL11.glEnable(GL11.GL_TEXTURE_GEN_R); + GL11.glEnable(GL11.GL_TEXTURE_GEN_Q); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_TEXTURE); + GL11.glPushMatrix(); + GL11.glLoadIdentity(); + GL11.glTranslatef(0.0F, (float)(Minecraft.getSystemTime() % 700000L) / 700000.0F, 0.0F); + GL11.glScalef(var15, var15, var15); + GL11.glTranslatef(0.5F, 0.5F, 0.0F); + GL11.glRotatef((float)(var13 * var13 * 4321 + var13 * 9) * 2.0F, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(-0.5F, -0.5F, 0.0F); + GL11.glTranslatef(-var9, -var11, -var10); + var18 = var17 + ActiveRenderInfo.objectY; + GL11.glTranslatef(ActiveRenderInfo.objectX * var14 / var18, ActiveRenderInfo.objectZ * var14 / var18, -var10); + Tessellator var23 = Tessellator.instance; + var23.startDrawingQuads(); + var20 = field_110644_e.nextFloat() * 0.5F + 0.1F; + float var21 = field_110644_e.nextFloat() * 0.5F + 0.4F; + float var22 = field_110644_e.nextFloat() * 0.5F + 0.5F; + + if (var13 == 0) + { + var22 = 1.0F; + var21 = 1.0F; + var20 = 1.0F; + } + + var23.setColorRGBA_F(var20 * var16, var21 * var16, var22 * var16, 1.0F); + var23.addVertex(par2, par4 + (double)var12, par6); + var23.addVertex(par2, par4 + (double)var12, par6 + 1.0D); + var23.addVertex(par2 + 1.0D, par4 + (double)var12, par6 + 1.0D); + var23.addVertex(par2 + 1.0D, par4 + (double)var12, par6); + var23.draw(); + GL11.glPopMatrix(); + GL11.glMatrixMode(GL11.GL_MODELVIEW); + } + + GL11.glDisable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_TEXTURE_GEN_S); + GL11.glDisable(GL11.GL_TEXTURE_GEN_T); + GL11.glDisable(GL11.GL_TEXTURE_GEN_R); + GL11.glDisable(GL11.GL_TEXTURE_GEN_Q); + GL11.glEnable(GL11.GL_LIGHTING); + } + + private FloatBuffer func_76907_a(float par1, float par2, float par3, float par4) + { + this.field_76908_a.clear(); + this.field_76908_a.put(par1).put(par2).put(par3).put(par4); + this.field_76908_a.flip(); + return this.field_76908_a; + } + + public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8) + { + this.renderEndPortalTileEntity((TileEntityEndPortal)par1TileEntity, par2, par4, par6, par8); + } +} diff --git a/src/main/java/net/minecraft/src/RenderEnderCrystal.java b/src/main/java/net/minecraft/src/RenderEnderCrystal.java new file mode 100644 index 0000000..b1036b1 --- /dev/null +++ b/src/main/java/net/minecraft/src/RenderEnderCrystal.java @@ -0,0 +1,54 @@ +package net.minecraft.src; + +import org.lwjgl.opengl.GL11; + +public class RenderEnderCrystal extends Render +{ + private static final ResourceLocation enderCrystalTextures = new ResourceLocation("textures/entity/endercrystal/endercrystal.png"); + private ModelBase field_76995_b; + + public RenderEnderCrystal() + { + this.shadowSize = 0.5F; + this.field_76995_b = new ModelEnderCrystal(0.0F, true); + } + + /** + * Renders the Ender Crystal. + */ + public void doRenderEnderCrystal(EntityEnderCrystal par1EntityEnderCrystal, double par2, double par4, double par6, float par8, float par9) + { + float var10 = (float)par1EntityEnderCrystal.innerRotation + par9; + GL11.glPushMatrix(); + GL11.glTranslatef((float)par2, (float)par4, (float)par6); + this.bindTexture(enderCrystalTextures); + float var11 = MathHelper.sin(var10 * 0.2F) / 2.0F + 0.5F; + var11 += var11 * var11; + this.field_76995_b.render(par1EntityEnderCrystal, 0.0F, var10 * 3.0F, var11 * 0.2F, 0.0F, 0.0F, 0.0625F); + GL11.glPopMatrix(); + } + + protected ResourceLocation getEnderCrystalTextures(EntityEnderCrystal par1EntityEnderCrystal) + { + return enderCrystalTextures; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity par1Entity) + { + return this.getEnderCrystalTextures((EntityEnderCrystal)par1Entity); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render 0; + this.endermanModel.isAttacking = par1EntityEnderman.isScreaming(); + + if (par1EntityEnderman.isScreaming()) + { + double var10 = 0.02D; + par2 += this.rnd.nextGaussian() * var10; + par6 += this.rnd.nextGaussian() * var10; + } + + super.doRenderLiving(par1EntityEnderman, par2, par4, par6, par8, par9); + } + + protected ResourceLocation getEndermanTextures(EntityEnderman par1EntityEnderman) + { + return endermanTextures; + } + + /** + * Render the block an enderman is carrying + */ + protected void renderCarrying(EntityEnderman par1EntityEnderman, float par2) + { + super.renderEquippedItems(par1EntityEnderman, par2); + + if (par1EntityEnderman.getCarried() > 0) + { + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glPushMatrix(); + float var3 = 0.5F; + GL11.glTranslatef(0.0F, 0.6875F, -0.75F); + var3 *= 1.0F; + GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL11.glScalef(-var3, -var3, var3); + int var4 = par1EntityEnderman.getBrightnessForRender(par2); + int var5 = var4 % 65536; + int var6 = var4 / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)var5 / 1.0F, (float)var6 / 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + this.bindTexture(TextureMap.locationBlocksTexture); + this.renderBlocks.renderBlockAsItem(Block.blocksList[par1EntityEnderman.getCarried()], par1EntityEnderman.getCarryingData(), 1.0F); + GL11.glPopMatrix(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + } + } + + /** + * Render the endermans eyes + */ + protected int renderEyes(EntityEnderman par1EntityEnderman, int par2, float par3) + { + if (par2 != 0) + { + return -1; + } + else + { + this.bindTexture(endermanEyesTexture); + float var4 = 1.0F; + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); + GL11.glDisable(GL11.GL_LIGHTING); + + if (par1EntityEnderman.isInvisible()) + { + GL11.glDepthMask(false); + } + else + { + GL11.glDepthMask(true); + } + + char var5 = 61680; + int var6 = var5 % 65536; + int var7 = var5 / 65536; + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)var6 / 1.0F, (float)var7 / 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glColor4f(1.0F, 1.0F, 1.0F, var4); + return 1; + } + } + + public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) + { + this.renderEnderman((EntityEnderman)par1EntityLiving, par2, par4, par6, par8, par9); + } + + /** + * Queries whether should render the specified pass or not. + */ + protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3) + { + return this.renderEyes((EntityEnderman)par1EntityLivingBase, par2, par3); + } + + protected void renderEquippedItems(EntityLivingBase par1EntityLivingBase, float par2) + { + this.renderCarrying((EntityEnderman)par1EntityLivingBase, par2); + } + + public void renderPlayer(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9) + { + this.renderEnderman((EntityEnderman)par1EntityLivingBase, par2, par4, par6, par8, par9); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity par1Entity) + { + return this.getEndermanTextures((EntityEnderman)par1Entity); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render 0 || par1EntityFishHook.angler != Minecraft.getMinecraft().thePlayer) + { + float var31 = (par1EntityFishHook.angler.prevRenderYawOffset + (par1EntityFishHook.angler.renderYawOffset - par1EntityFishHook.angler.prevRenderYawOffset) * par9) * (float)Math.PI / 180.0F; + double var32 = (double)MathHelper.sin(var31); + double var34 = (double)MathHelper.cos(var31); + var23 = par1EntityFishHook.angler.prevPosX + (par1EntityFishHook.angler.posX - par1EntityFishHook.angler.prevPosX) * (double)par9 - var34 * 0.35D - var32 * 0.85D; + var25 = par1EntityFishHook.angler.prevPosY + var29 + (par1EntityFishHook.angler.posY - par1EntityFishHook.angler.prevPosY) * (double)par9 - 0.45D; + var27 = par1EntityFishHook.angler.prevPosZ + (par1EntityFishHook.angler.posZ - par1EntityFishHook.angler.prevPosZ) * (double)par9 - var32 * 0.35D + var34 * 0.85D; + } + + double var46 = par1EntityFishHook.prevPosX + (par1EntityFishHook.posX - par1EntityFishHook.prevPosX) * (double)par9; + double var33 = par1EntityFishHook.prevPosY + (par1EntityFishHook.posY - par1EntityFishHook.prevPosY) * (double)par9 + 0.25D; + double var35 = par1EntityFishHook.prevPosZ + (par1EntityFishHook.posZ - par1EntityFishHook.prevPosZ) * (double)par9; + double var37 = (double)((float)(var23 - var46)); + double var39 = (double)((float)(var25 - var33)); + double var41 = (double)((float)(var27 - var35)); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + var10.startDrawing(3); + var10.setColorOpaque_I(0); + byte var43 = 16; + + for (int var44 = 0; var44 <= var43; ++var44) + { + float var45 = (float)var44 / (float)var43; + var10.addVertex(par2 + var37 * (double)var45, par4 + var39 * (double)(var45 * var45 + var45) * 0.5D + 0.25D, par6 + var41 * (double)var45); + } + + var10.draw(); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + } + + protected ResourceLocation func_110791_a(EntityFishHook par1EntityFishHook) + { + return field_110792_a; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity par1Entity) + { + return this.func_110791_a((EntityFishHook)par1Entity); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render