├── settings.gradle ├── libs ├── PlayerAPI-1.12.2-1.0.jar └── RenderPlayerAPI-1.12.2-1.0.jar ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── SmartRender ├── libs │ ├── PlayerAPI-1.12.2-1.0.jar │ └── RenderPlayerAPI-1.12.2-1.0.jar ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.properties ├── gradle.properties ├── .gitignore ├── src │ └── main │ │ ├── java │ │ └── net │ │ │ └── smart │ │ │ ├── utilities │ │ │ ├── SoundUtil.java │ │ │ ├── BlockWallUtil.java │ │ │ └── Name.java │ │ │ └── render │ │ │ ├── statistics │ │ │ ├── IEntityPlayerSP.java │ │ │ ├── SmartStatisticsOther.java │ │ │ ├── SmartStatisticsContext.java │ │ │ ├── playerapi │ │ │ │ ├── SmartStatistics.java │ │ │ │ ├── SmartStatisticsFactory.java │ │ │ │ └── SmartStatisticsPlayerBase.java │ │ │ ├── SmartStatisticsData.java │ │ │ ├── SmartStatisticsDatas.java │ │ │ └── SmartStatisticsFactory.java │ │ │ ├── render │ │ │ ├── SRLayerCustomHead.java │ │ │ ├── SRRenderData.java │ │ │ ├── IRenderPlayer.java │ │ │ ├── SRLayerEntityOnShoulder.java │ │ │ ├── SRLayerElytra.java │ │ │ └── SRRenderPlayer.java │ │ │ ├── SRInfo.java │ │ │ ├── SRContext.java │ │ │ ├── model │ │ │ ├── SRModelSpecialRenderer.java │ │ │ ├── SRModelEarsRenderer.java │ │ │ ├── SRModelCapeRenderer.java │ │ │ ├── SRModelElytra.java │ │ │ └── IModelPlayer.java │ │ │ ├── SRInstall.java │ │ │ ├── SRMod.java │ │ │ └── SRUtilities.java │ │ └── resources │ │ ├── license.txt │ │ ├── pack.mcmeta │ │ └── mcmod.info ├── build.gradle ├── gradlew.bat └── gradlew ├── src └── main │ ├── resources │ ├── assets │ │ └── smartmoving │ │ │ ├── gui │ │ │ └── icons.png │ │ │ └── lang │ │ │ ├── pt_br.lang │ │ │ ├── en_us.lang │ │ │ ├── nl_nl.lang │ │ │ └── ru_ru.lang │ ├── license.txt │ ├── pack.mcmeta │ └── mcmod.info │ └── java │ └── net │ └── smart │ ├── utilities │ ├── SoundUtil.java │ └── BlockWallUtil.java │ └── moving │ ├── ILocalUserNameProvider.java │ ├── IPacketSender.java │ ├── ISMSelf.java │ ├── ISMClient.java │ ├── SMClimbGap.java │ ├── SMInfo.java │ ├── SMLocalUserNameProvider.java │ ├── packet │ ├── ConfigChangePacket.java │ ├── HungerChangePacket.java │ ├── StatePacket.java │ ├── ConfigInfoPacket.java │ ├── SpeedChangePacket.java │ ├── SoundPacket.java │ └── ConfigContentPacket.java │ ├── IPacketReceiver.java │ ├── render │ ├── IRenderPlayer.java │ ├── SMRenderPlayer.java │ └── SMRenderPlayerBase.java │ ├── config │ ├── SMServerConfig.java │ └── SMProperties.java │ ├── IEntityPlayerSP.java │ ├── SMButton.java │ ├── IEntityPlayerMP.java │ ├── SMClient.java │ ├── SMInstall.java │ ├── SMServerComm.java │ ├── model │ └── IModelPlayer.java │ ├── SMContext.java │ ├── SMHandsClimbing.java │ ├── SMOther.java │ ├── SMFeetClimbing.java │ ├── SMFactory.java │ ├── SMPacketHandler.java │ └── SMMod.java ├── gradle.properties ├── .gitignore ├── LICENSE-Paulscode IBXM Library.txt ├── forge-1.12.2-14.23.5.2768-changelog.txt ├── gradlew.bat ├── LICENSE-Paulscode SoundSystem CodecIBXM.txt ├── README.txt ├── CREDITS.txt └── gradlew /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':SmartRender' 2 | -------------------------------------------------------------------------------- /libs/PlayerAPI-1.12.2-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elveskevtar/SmartMoving/HEAD/libs/PlayerAPI-1.12.2-1.0.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elveskevtar/SmartMoving/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /libs/RenderPlayerAPI-1.12.2-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elveskevtar/SmartMoving/HEAD/libs/RenderPlayerAPI-1.12.2-1.0.jar -------------------------------------------------------------------------------- /SmartRender/libs/PlayerAPI-1.12.2-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elveskevtar/SmartMoving/HEAD/SmartRender/libs/PlayerAPI-1.12.2-1.0.jar -------------------------------------------------------------------------------- /SmartRender/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elveskevtar/SmartMoving/HEAD/SmartRender/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /SmartRender/libs/RenderPlayerAPI-1.12.2-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elveskevtar/SmartMoving/HEAD/SmartRender/libs/RenderPlayerAPI-1.12.2-1.0.jar -------------------------------------------------------------------------------- /SmartRender/build.properties: -------------------------------------------------------------------------------- 1 | minecraft.version=1.12.2 2 | minecraft.mappings=snapshot_20171003 3 | forge.version=14.23.5.2768 4 | smartrender.version=3.0-RC1 5 | -------------------------------------------------------------------------------- /src/main/resources/assets/smartmoving/gui/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elveskevtar/SmartMoving/HEAD/src/main/resources/assets/smartmoving/gui/icons.png -------------------------------------------------------------------------------- /src/main/resources/assets/smartmoving/lang/pt_br.lang: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elveskevtar/SmartMoving/HEAD/src/main/resources/assets/smartmoving/lang/pt_br.lang -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Sets default memory used for gradle commands. Can be overridden by user or command line properties. 2 | # This is required to provide enough memory for the Minecraft decompilation process. 3 | org.gradle.jvmargs=-Xmx3G 4 | -------------------------------------------------------------------------------- /SmartRender/gradle.properties: -------------------------------------------------------------------------------- 1 | # Sets default memory used for gradle commands. Can be overridden by user or command line properties. 2 | # This is required to provide enough memory for the Minecraft decompilation process. 3 | org.gradle.jvmargs=-Xmx3G 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # eclipse 2 | bin 3 | *.launch 4 | .settings 5 | .metadata 6 | .classpath 7 | .project 8 | 9 | # idea 10 | out 11 | *.ipr 12 | *.iws 13 | *.iml 14 | .idea 15 | 16 | # gradle 17 | build 18 | .gradle 19 | 20 | # other 21 | eclipse 22 | run 23 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Sep 14 12:28:28 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip 7 | -------------------------------------------------------------------------------- /SmartRender/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Sep 14 12:28:28 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip 7 | -------------------------------------------------------------------------------- /SmartRender/.gitignore: -------------------------------------------------------------------------------- 1 | # Gradle 2 | /.gradle 3 | /build 4 | classes/ 5 | 6 | # Eclipse 7 | /.classpath 8 | /.project 9 | /.settings 10 | /bin 11 | 12 | # IntelliJ IDEA 13 | /*.iml 14 | /*.ipr 15 | /*.iws 16 | /.idea 17 | /out 18 | 19 | # Debugging 20 | /eclipse 21 | /run 22 | 23 | # OS X 24 | .DS_Store 25 | -------------------------------------------------------------------------------- /src/main/java/net/smart/utilities/SoundUtil.java: -------------------------------------------------------------------------------- 1 | package net.smart.utilities; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | import net.minecraft.util.SoundEvent; 5 | 6 | public class SoundUtil { 7 | public static SoundEvent getSoundEvent(String id) { 8 | return SoundEvent.REGISTRY.getObject(new ResourceLocation(id)); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/utilities/SoundUtil.java: -------------------------------------------------------------------------------- 1 | package net.smart.utilities; 2 | 3 | import net.minecraft.util.ResourceLocation; 4 | import net.minecraft.util.SoundEvent; 5 | 6 | public class SoundUtil { 7 | public static SoundEvent getSoundEvent(String id) { 8 | return SoundEvent.REGISTRY.getObject(new ResourceLocation(id)); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/resources/license.txt: -------------------------------------------------------------------------------- 1 | This minecraft mod, Smart Moving, including all parts herein, 2 | is licensed under the GNU General Public License Version 3 or later. 3 | 4 | Homepage: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1274224 5 | 6 | You should have received a copy of the GNU General Public License along with Smart Moving. 7 | If not, see . -------------------------------------------------------------------------------- /SmartRender/src/main/resources/license.txt: -------------------------------------------------------------------------------- 1 | This minecraft mod, Smart Render, including all parts herein, 2 | is licensed under the GNU General Public License Version 3 or later. 3 | 4 | Homepage: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1274224 5 | 6 | You should have received a copy of the GNU General Public License along with Smart Render. 7 | If not, see . -------------------------------------------------------------------------------- /src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "examplemod resources", 4 | "pack_format": 3, 5 | "_comment": "A pack_format of 3 should be used starting with Minecraft 1.11. All resources, including language files, should be lowercase (eg: en_us.lang). A pack_format of 2 will load your mod resources with LegacyV2Adapter, which requires language files to have uppercase letters (eg: en_US.lang)." 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /SmartRender/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "examplemod resources", 4 | "pack_format": 3, 5 | "_comment": "A pack_format of 3 should be used starting with Minecraft 1.11. All resources, including language files, should be lowercase (eg: en_us.lang). A pack_format of 2 will load your mod resources with LegacyV2Adapter, which requires language files to have uppercase letters (eg: en_US.lang)." 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /SmartRender/src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [{ 2 | "modid": "smartrender", 3 | "name": "Smart Render", 4 | "version": "${version}", 5 | "mcversion": "${mcversion}", 6 | "description": "Replaces the vanilla render model for the player with a much more useable one:\n\n * implement better animations with less code\n * attach additional renderers wherever you want\n * only worry about the animations of your own renderers", 7 | "credits": "", 8 | "requiredMods": [ "Forge@[12.18.1.2011,)" ], 9 | "url": "https://github.com/JonnyNova/SmartRender", 10 | "authors": [ "Divisor", "JonnyNova" ] 11 | }] -------------------------------------------------------------------------------- /src/main/java/net/smart/utilities/BlockWallUtil.java: -------------------------------------------------------------------------------- 1 | package net.smart.utilities; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.block.BlockFenceGate; 5 | import net.minecraft.block.BlockWall; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.block.state.IBlockState; 8 | import net.minecraft.init.Blocks; 9 | import net.minecraft.util.math.BlockPos; 10 | import net.minecraft.world.IBlockAccess; 11 | 12 | public class BlockWallUtil { 13 | /** 14 | * This has become private in {@link BlockWall}, duplicate the logic here. 15 | */ 16 | public static boolean canConnectTo(Block wall, IBlockAccess worldIn, BlockPos pos) { 17 | IBlockState iblockstate = worldIn.getBlockState(pos); 18 | Material otherMaterial = iblockstate.getMaterial(); 19 | Block other = iblockstate.getBlock(); 20 | return (other != Blocks.BARRIER && other != wall && !(other instanceof BlockFenceGate)) 21 | && (otherMaterial.isOpaque() && iblockstate.isFullCube()) && otherMaterial != Material.GOURD; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/utilities/BlockWallUtil.java: -------------------------------------------------------------------------------- 1 | package net.smart.utilities; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.block.BlockFenceGate; 5 | import net.minecraft.block.BlockWall; 6 | import net.minecraft.block.material.Material; 7 | import net.minecraft.block.state.IBlockState; 8 | import net.minecraft.init.Blocks; 9 | import net.minecraft.util.math.BlockPos; 10 | import net.minecraft.world.IBlockAccess; 11 | 12 | public class BlockWallUtil { 13 | /** 14 | * This has become private in {@link BlockWall}, duplicate the logic here. 15 | */ 16 | public static boolean canConnectTo(Block wall, IBlockAccess worldIn, BlockPos pos) { 17 | IBlockState iblockstate = worldIn.getBlockState(pos); 18 | Material otherMaterial = iblockstate.getMaterial(); 19 | Block other = iblockstate.getBlock(); 20 | return (other != Blocks.BARRIER && other != wall && !(other instanceof BlockFenceGate)) 21 | && (otherMaterial.isOpaque() && iblockstate.isFullCube()) && otherMaterial != Material.GOURD; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [{ 2 | "modid": "smartmoving", 3 | "name": "Smart Moving", 4 | "version": "${version}", 5 | "mcversion": "${mcversion}", 6 | "description": "The Smart Moving mod provides various additional moving possibilities:\n\n * Climbing only via gaps in the walls\n * Climbing ladders with different speeds depending on ladder coverage and/or neighbour blocks\n * Alternative animations for flying and falling\n * Climbing along ceilings and up vines\n * Jumping up & back while climbing\n * Configurable sneaking\n * Alternative swimming\n * Alternative diving\n * Alternative flying\n * Faster sprinting\n * Side & Back jumps\n * Charged jumps\n * Wall jumping\n * Head jumps\n * Crawling\n * Sliding", 7 | "credits": "_DarKShaM_, Cassiobsk8, Dunncann for translations", 8 | "url": "https://github.com/JonnyNova/SmartMoving.git", 9 | "authors": [ "Divisor", "JonnyNova" ], 10 | "dependencies": [ "PlayerAPI", "Smart Render", "SmartCore" ], 11 | "requiredMods": [ "Forge@[12.18.1.2011,)", "Smart Render@[2.3-RC1,)", "PlayerAPI@[1.1,)" ] 12 | }] -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/statistics/IEntityPlayerSP.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.statistics; 19 | 20 | public interface IEntityPlayerSP { 21 | SmartStatistics getStatistics(); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/ILocalUserNameProvider.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | public interface ILocalUserNameProvider { 21 | String getLocalConfigUserName(); 22 | 23 | String getLocalSpeedUserName(); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/IPacketSender.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 21 | 22 | public interface IPacketSender { 23 | void sendPacket(IMessage message); 24 | } 25 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/render/SRLayerCustomHead.java: -------------------------------------------------------------------------------- 1 | package net.smart.render.render; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import net.minecraft.client.model.ModelRenderer; 6 | import net.minecraft.client.renderer.entity.layers.LayerCustomHead; 7 | import net.minecraft.entity.EntityLivingBase; 8 | 9 | public class SRLayerCustomHead extends LayerCustomHead { 10 | private ModelRenderer head; 11 | 12 | public SRLayerCustomHead(ModelRenderer p_i46120_1_) { 13 | super(p_i46120_1_); 14 | this.head = p_i46120_1_; 15 | } 16 | 17 | @Override 18 | public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, 19 | float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { 20 | GL11.glPushMatrix(); 21 | GL11.glRotatef(head.rotateAngleX, 1.0F, 0.0F, 0.0F); 22 | GL11.glRotatef(head.rotateAngleY, 0.0F, 1.0F, 0.0F); 23 | GL11.glRotatef(head.rotateAngleZ, 0.0F, 0.0F, 1.0F); 24 | super.doRenderLayer(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, 25 | headPitch, scale); 26 | GL11.glPopMatrix(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/statistics/SmartStatisticsOther.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.statistics; 19 | 20 | import net.minecraft.client.entity.EntityOtherPlayerMP; 21 | 22 | public class SmartStatisticsOther extends SmartStatistics { 23 | public boolean foundAlive; 24 | 25 | public SmartStatisticsOther(EntityOtherPlayerMP sp) { 26 | super(sp); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/SRInfo.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render; 19 | 20 | import net.minecraftforge.fml.common.Mod; 21 | 22 | public class SRInfo { 23 | private static final Mod Mod = SRMod.class.getAnnotation(Mod.class); 24 | 25 | public static final String ModId = Mod.modid(); 26 | public static final String ModName = Mod.name(); 27 | public static final String ModVersion = Mod.version(); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/ISMSelf.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | public interface ISMSelf { 21 | float getExhaustion(); 22 | 23 | float getUpJumpCharge(); 24 | 25 | float getHeadJumpCharge(); 26 | 27 | void addExhaustion(float factor); 28 | 29 | void setMaxExhaustionForAction(float maxExhaustionForAction); 30 | 31 | void setMaxExhaustionToStartAction(float maxExhaustionToStartAction); 32 | } 33 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/SRContext.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render; 19 | 20 | import api.player.model.IModelPlayerAPI; 21 | import net.smart.render.model.SRModelPlayerBase; 22 | 23 | public class SRContext { 24 | public static SRModelPlayerBase getPlayerBase(net.minecraft.client.model.ModelBiped modelPlayer) { 25 | return (SRModelPlayerBase) ((IModelPlayerAPI) modelPlayer).getModelPlayerBase(SRInfo.ModName); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/render/SRRenderData.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.render; 19 | 20 | public class SRRenderData { 21 | public float offsetX; 22 | public float offsetY; 23 | public float offsetZ; 24 | public float rotateAngleX; 25 | public float rotateAngleY; 26 | public float rotateAngleZ; 27 | public float rotationPointX; 28 | public float rotationPointY; 29 | public float rotationPointZ; 30 | public float totalTime = Float.MIN_VALUE; 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/ISMClient.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | public interface ISMClient { 21 | float getMaximumExhaustion(); 22 | 23 | float getMaximumUpJumpCharge(); 24 | 25 | float getMaximumHeadJumpCharge(); 26 | 27 | void setMaximumExhaustionValue(String key, float value); 28 | 29 | float getMaximumExhaustionValue(String key); 30 | 31 | boolean removeMaximumExhaustionValue(String key); 32 | 33 | void setNativeUserInterfaceDrawing(boolean value); 34 | 35 | boolean getNativeUserInterfaceDrawing(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMClimbGap.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import net.minecraft.block.Block; 21 | 22 | public class SMClimbGap { 23 | public Block Block; 24 | public int Meta; 25 | public boolean CanStand; 26 | public boolean MustCrawl; 27 | public SMOrientation Direction; 28 | public boolean SkipGaps; 29 | 30 | public SMClimbGap() { 31 | reset(); 32 | } 33 | 34 | public void reset() { 35 | Block = null; 36 | Meta = -1; 37 | CanStand = false; 38 | MustCrawl = false; 39 | Direction = null; 40 | SkipGaps = false; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE-Paulscode IBXM Library.txt: -------------------------------------------------------------------------------- 1 | IBXM is copyright (c) 2007, Martin Cameron, and is licensed under the BSD License. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | Neither the name of mumart nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 10 | 11 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/statistics/SmartStatisticsContext.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.statistics; 19 | 20 | import net.minecraft.client.Minecraft; 21 | 22 | public abstract class SmartStatisticsContext { 23 | protected static boolean calculateHorizontalStats = false; 24 | 25 | public static void setCalculateHorizontalStats(boolean flag) { 26 | calculateHorizontalStats = flag; 27 | } 28 | 29 | public static void onTickInGame() { 30 | Minecraft minecraft = Minecraft.getMinecraft(); 31 | 32 | if (minecraft.world != null && minecraft.world.isRemote) 33 | SmartStatisticsFactory.handleMultiPlayerTick(minecraft); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMInfo.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import net.minecraftforge.fml.common.Mod; 21 | 22 | public class SMInfo { 23 | private static final Mod Mod = SMMod.class.getAnnotation(Mod.class); 24 | 25 | public static final String ModId = Mod.modid(); 26 | public static final String ModName = Mod.name(); 27 | public static final String ModVersion = Mod.version(); 28 | public static final String ModComVersion = SMMod.ModComVersion; 29 | 30 | public static final String ModComMessage = ModName + " uses communication protocol " + ModComVersion; 31 | public static final String ModComId = ModName.replace(" ", "") + " " + ModComVersion; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMLocalUserNameProvider.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import net.minecraft.client.Minecraft; 21 | 22 | public class SMLocalUserNameProvider implements ILocalUserNameProvider { 23 | @Override 24 | public String getLocalConfigUserName() { 25 | return SMContext.Options._localUserHasChangeConfigRight.value 26 | ? Minecraft.getMinecraft().player.getGameProfile().getName() 27 | : null; 28 | } 29 | 30 | @Override 31 | public String getLocalSpeedUserName() { 32 | return SMContext.Options._localUserHasChangeSpeedRight.value 33 | ? Minecraft.getMinecraft().player.getGameProfile().getName() 34 | : null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/utilities/Name.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render and Smart Moving. 3 | // 4 | // Smart Render and Smart Moving is free software: you can 5 | // redistribute it and/or modify it under the terms of the GNU General 6 | // Public Licenses published by the Free Software Foundation, either 7 | // version 3 of the License, or (at your option) any later version. 8 | // 9 | // Smart Render and Smart Moving is distributed in the hope that it 10 | // will be useful, but WITHOUT ANY WARRANTY; without even the implied 11 | // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | // See the GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render and Smart Moving. If not, see 16 | // . 17 | // ================================================================== 18 | 19 | package net.smart.utilities; 20 | 21 | public class Name { 22 | public final String obfuscated; 23 | public final String forgefuscated; 24 | public final String deobfuscated; 25 | 26 | public Name(String name) { 27 | this(name, null); 28 | } 29 | 30 | public Name(String deobfuscatedName, String obfuscatedName) { 31 | this(deobfuscatedName, null, obfuscatedName); 32 | } 33 | 34 | public Name(String deobfuscatedName, String forgefuscatedName, String obfuscatedName) { 35 | deobfuscated = deobfuscatedName; 36 | forgefuscated = forgefuscatedName; 37 | obfuscated = obfuscatedName; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/packet/ConfigChangePacket.java: -------------------------------------------------------------------------------- 1 | package net.smart.moving.packet; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 5 | import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; 6 | import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; 7 | import net.smart.moving.SMComm; 8 | import net.smart.moving.SMPacketHandler; 9 | import net.smart.moving.SMServerComm; 10 | import net.smart.moving.SMServerPlayerBase; 11 | 12 | public class ConfigChangePacket implements IMessage { 13 | 14 | public static final byte PacketId = 3; 15 | 16 | public ConfigChangePacket() {} 17 | 18 | @Override 19 | public void fromBytes(ByteBuf buf) {} 20 | 21 | @Override 22 | public void toBytes(ByteBuf buf) {} 23 | 24 | public static class ClientHandler implements IMessageHandler { 25 | 26 | public ClientHandler() {} 27 | 28 | @Override 29 | public IMessage onMessage(ConfigChangePacket message, MessageContext ctx) { 30 | SMPacketHandler.receivePacket(message, SMComm.instance, null); 31 | return null; 32 | } 33 | } 34 | 35 | public static class ServerHandler implements IMessageHandler { 36 | 37 | public ServerHandler() {} 38 | 39 | @Override 40 | public IMessage onMessage(ConfigChangePacket message, MessageContext ctx) { 41 | SMServerPlayerBase serverPlayer = SMServerPlayerBase.getPlayerBase(ctx.getServerHandler().player); 42 | SMPacketHandler.receivePacket(message, SMServerComm.instance, serverPlayer); 43 | return null; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/statistics/playerapi/SmartStatistics.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.statistics.playerapi; 19 | 20 | import api.player.client.ClientPlayerAPI; 21 | import api.player.client.IClientPlayerAPI; 22 | import net.minecraft.client.entity.EntityPlayerSP; 23 | import net.minecraft.entity.player.EntityPlayer; 24 | import net.smart.render.SRInfo; 25 | import net.smart.render.statistics.IEntityPlayerSP; 26 | 27 | public abstract class SmartStatistics { 28 | public final static String ID = SRInfo.ModName; 29 | 30 | public static void register() { 31 | ClientPlayerAPI.register(ID, SmartStatisticsPlayerBase.class); 32 | } 33 | 34 | public static IEntityPlayerSP getPlayerBase(EntityPlayer entityPlayer) { 35 | if (entityPlayer instanceof EntityPlayerSP) 36 | return (SmartStatisticsPlayerBase) ((IClientPlayerAPI) entityPlayer).getClientPlayerBase(ID); 37 | return null; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/statistics/playerapi/SmartStatisticsFactory.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.statistics.playerapi; 19 | 20 | import net.minecraft.entity.player.EntityPlayer; 21 | import net.smart.render.statistics.IEntityPlayerSP; 22 | 23 | public class SmartStatisticsFactory extends net.smart.render.statistics.SmartStatisticsFactory { 24 | public static void initialize() { 25 | if (!isInitialized()) 26 | new SmartStatisticsFactory(); 27 | } 28 | 29 | @Override 30 | protected net.smart.render.statistics.SmartStatistics doGetInstance(EntityPlayer entityPlayer) { 31 | net.smart.render.statistics.SmartStatistics statistics = super.doGetInstance(entityPlayer); 32 | if (statistics != null) 33 | return statistics; 34 | 35 | IEntityPlayerSP playerBase = SmartStatistics.getPlayerBase(entityPlayer); 36 | if (playerBase != null) 37 | return playerBase.getStatistics(); 38 | 39 | return null; 40 | } 41 | } -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/model/SRModelSpecialRenderer.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.model; 19 | 20 | import org.lwjgl.opengl.GL11; 21 | 22 | import net.minecraft.client.model.ModelBase; 23 | 24 | public class SRModelSpecialRenderer extends SRModelRotationRenderer { 25 | public boolean doPopPush; 26 | 27 | public SRModelSpecialRenderer(ModelBase modelBase, int i, int j, SRModelRotationRenderer baseRenderer) { 28 | super(modelBase, i, j, baseRenderer); 29 | ignoreRender = true; 30 | } 31 | 32 | public void beforeRender(boolean popPush) { 33 | doPopPush = popPush; 34 | ignoreRender = false; 35 | } 36 | 37 | @Override 38 | public void doRender(float f, boolean useParentTransformations) { 39 | if (doPopPush) { 40 | GL11.glPopMatrix(); 41 | GL11.glPushMatrix(); 42 | } 43 | super.doRender(f, true); 44 | } 45 | 46 | public void afterRender() { 47 | ignoreRender = true; 48 | doPopPush = false; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/IPacketReceiver.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 21 | 22 | public interface IPacketReceiver { 23 | boolean processStatePacket(IMessage message, IEntityPlayerMP player, int entityId, long state); 24 | 25 | boolean processConfigInfoPacket(IMessage message, IEntityPlayerMP player, String info); 26 | 27 | boolean processConfigContentPacket(IMessage message, IEntityPlayerMP player, String[] content, 28 | String username); 29 | 30 | boolean processConfigChangePacket(IMessage message, IEntityPlayerMP player); 31 | 32 | boolean processSpeedChangePacket(IMessage message, IEntityPlayerMP player, int difference, String username); 33 | 34 | boolean processHungerChangePacket(IMessage message, IEntityPlayerMP player, float hunger); 35 | 36 | boolean processSoundPacket(IMessage message, IEntityPlayerMP player, String soundId, float distance, 37 | float pitch); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/packet/HungerChangePacket.java: -------------------------------------------------------------------------------- 1 | package net.smart.moving.packet; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 5 | import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; 6 | import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; 7 | import net.smart.moving.SMComm; 8 | import net.smart.moving.SMPacketHandler; 9 | import net.smart.moving.SMServerComm; 10 | import net.smart.moving.SMServerPlayerBase; 11 | 12 | public class HungerChangePacket implements IMessage { 13 | 14 | public static final byte PacketId = 5; 15 | 16 | public HungerChangePacket() {} 17 | 18 | public float hunger; 19 | 20 | public HungerChangePacket(float hunger) { 21 | this.hunger = hunger; 22 | } 23 | 24 | @Override 25 | public void fromBytes(ByteBuf buf) { 26 | hunger = buf.readFloat(); 27 | } 28 | 29 | @Override 30 | public void toBytes(ByteBuf buf) { 31 | buf.writeFloat(hunger); 32 | } 33 | 34 | public static class ClientHandler implements IMessageHandler { 35 | 36 | public ClientHandler() {} 37 | 38 | @Override 39 | public IMessage onMessage(HungerChangePacket message, MessageContext ctx) { 40 | SMPacketHandler.receivePacket(message, SMComm.instance, null); 41 | return null; 42 | } 43 | } 44 | 45 | public static class ServerHandler implements IMessageHandler { 46 | 47 | public ServerHandler() {} 48 | 49 | @Override 50 | public IMessage onMessage(HungerChangePacket message, MessageContext ctx) { 51 | SMServerPlayerBase serverPlayer = SMServerPlayerBase.getPlayerBase(ctx.getServerHandler().player); 52 | SMPacketHandler.receivePacket(message, SMServerComm.instance, serverPlayer); 53 | return null; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/render/IRenderPlayer.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving.render; 19 | 20 | import net.minecraft.client.entity.AbstractClientPlayer; 21 | import net.minecraft.client.renderer.entity.RenderManager; 22 | import net.smart.moving.model.IModelPlayer; 23 | 24 | public interface IRenderPlayer { 25 | void superRenderDoRender(AbstractClientPlayer entityplayer, double d, double d1, double d2, float f, 26 | float renderPartialTicks); 27 | 28 | void superRenderRotateCorpse(AbstractClientPlayer entityplayer, float totalTime, float actualRotation, float f2); 29 | 30 | void superRenderRenderLivingAt(AbstractClientPlayer entityplayer, double d, double d1, double d2); 31 | 32 | void superRenderRenderName(AbstractClientPlayer par1EntityPlayer, double par2, double par4, double par6); 33 | 34 | RenderManager getMovingRenderManager(); 35 | 36 | IModelPlayer getMovingModelBipedMain(); 37 | 38 | IModelPlayer getMovingModelArmor(); 39 | 40 | IModelPlayer[] getMovingModels(); 41 | } -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/statistics/playerapi/SmartStatisticsPlayerBase.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.statistics.playerapi; 19 | 20 | import api.player.client.ClientPlayerAPI; 21 | import api.player.client.ClientPlayerBase; 22 | import net.smart.render.statistics.IEntityPlayerSP; 23 | 24 | public class SmartStatisticsPlayerBase extends ClientPlayerBase implements IEntityPlayerSP { 25 | public SmartStatisticsPlayerBase(ClientPlayerAPI playerApi) { 26 | super(playerApi); 27 | statistics = new net.smart.render.statistics.SmartStatistics(player); 28 | } 29 | 30 | @Override 31 | public void afterMoveEntityWithHeading(float f, float f1, float f2) { 32 | statistics.calculateAllStats(false); 33 | } 34 | 35 | @Override 36 | public void afterUpdateRidden() { 37 | statistics.calculateRiddenStats(); 38 | } 39 | 40 | @Override 41 | public net.smart.render.statistics.SmartStatistics getStatistics() { 42 | return statistics; 43 | } 44 | 45 | public net.smart.render.statistics.SmartStatistics statistics; 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/packet/StatePacket.java: -------------------------------------------------------------------------------- 1 | package net.smart.moving.packet; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 5 | import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; 6 | import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; 7 | import net.smart.moving.SMComm; 8 | import net.smart.moving.SMPacketHandler; 9 | import net.smart.moving.SMServerComm; 10 | import net.smart.moving.SMServerPlayerBase; 11 | 12 | public class StatePacket implements IMessage { 13 | 14 | public static final byte PacketId = 0; 15 | 16 | public StatePacket() {} 17 | 18 | public int entityId; 19 | public long state; 20 | 21 | public StatePacket(int entityId, long state) { 22 | this.entityId = entityId; 23 | this.state = state; 24 | } 25 | 26 | @Override 27 | public void fromBytes(ByteBuf buf) { 28 | entityId = buf.readInt(); 29 | state = buf.readLong(); 30 | } 31 | 32 | @Override 33 | public void toBytes(ByteBuf buf) { 34 | buf.writeInt(entityId); 35 | buf.writeLong(state); 36 | } 37 | 38 | public static class ClientHandler implements IMessageHandler { 39 | 40 | public ClientHandler() {} 41 | 42 | @Override 43 | public IMessage onMessage(StatePacket message, MessageContext ctx) { 44 | SMPacketHandler.receivePacket(message, SMComm.instance, null); 45 | return null; 46 | } 47 | } 48 | 49 | public static class ServerHandler implements IMessageHandler { 50 | 51 | public ServerHandler() {} 52 | 53 | @Override 54 | public IMessage onMessage(StatePacket message, MessageContext ctx) { 55 | SMServerPlayerBase serverPlayer = SMServerPlayerBase.getPlayerBase(ctx.getServerHandler().player); 56 | SMPacketHandler.receivePacket(message, SMServerComm.instance, serverPlayer); 57 | return null; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/statistics/SmartStatisticsData.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.statistics; 19 | 20 | import net.minecraft.entity.player.EntityPlayer; 21 | 22 | public class SmartStatisticsData { 23 | public float prevLegYaw; 24 | public float legYaw; 25 | public float total; 26 | 27 | public float getCurrentSpeed(float renderPartialTicks) { 28 | return Math.min(1.0F, prevLegYaw + (legYaw - prevLegYaw) * renderPartialTicks); 29 | } 30 | 31 | public float getTotalDistance(float renderPartialTicks) { 32 | return total - legYaw * (1.0F - renderPartialTicks); 33 | } 34 | 35 | public void initialize(SmartStatisticsData previous) { 36 | prevLegYaw = previous.legYaw; 37 | legYaw = previous.legYaw; 38 | total = previous.total; 39 | } 40 | 41 | public float calculate(float distance) { 42 | distance = distance * 4F; 43 | 44 | legYaw += (distance - legYaw) * 0.4F; 45 | total += legYaw; 46 | 47 | return distance; 48 | } 49 | 50 | public void apply(EntityPlayer sp) { 51 | sp.prevLimbSwingAmount = prevLegYaw; 52 | sp.limbSwingAmount = legYaw; 53 | sp.limbSwing = total; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/packet/ConfigInfoPacket.java: -------------------------------------------------------------------------------- 1 | package net.smart.moving.packet; 2 | 3 | import java.nio.charset.StandardCharsets; 4 | 5 | import io.netty.buffer.ByteBuf; 6 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 7 | import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; 8 | import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; 9 | import net.smart.moving.SMComm; 10 | import net.smart.moving.SMPacketHandler; 11 | import net.smart.moving.SMServerComm; 12 | import net.smart.moving.SMServerPlayerBase; 13 | 14 | public class ConfigInfoPacket implements IMessage { 15 | 16 | public static final byte PacketId = 1; 17 | 18 | public ConfigInfoPacket() {} 19 | 20 | public String info; 21 | 22 | public ConfigInfoPacket(String info) { 23 | this.info = info; 24 | } 25 | 26 | @Override 27 | public void fromBytes(ByteBuf buf) { 28 | int infoLength = buf.readInt(); 29 | info = buf.readCharSequence(infoLength, StandardCharsets.UTF_8).toString(); 30 | } 31 | 32 | @Override 33 | public void toBytes(ByteBuf buf) { 34 | buf.writeInt(info.length()); 35 | buf.writeCharSequence(info, StandardCharsets.UTF_8); 36 | } 37 | 38 | public static class ClientHandler implements IMessageHandler { 39 | 40 | public ClientHandler() {} 41 | 42 | @Override 43 | public IMessage onMessage(ConfigInfoPacket message, MessageContext ctx) { 44 | SMPacketHandler.receivePacket(message, SMComm.instance, null); 45 | return null; 46 | } 47 | } 48 | 49 | public static class ServerHandler implements IMessageHandler { 50 | 51 | public ServerHandler() {} 52 | 53 | @Override 54 | public IMessage onMessage(ConfigInfoPacket message, MessageContext ctx) { 55 | SMServerPlayerBase serverPlayer = SMServerPlayerBase.getPlayerBase(ctx.getServerHandler().player); 56 | SMPacketHandler.receivePacket(message, SMServerComm.instance, serverPlayer); 57 | return null; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/config/SMServerConfig.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving.config; 19 | 20 | import java.util.Iterator; 21 | 22 | import net.smart.properties.Properties; 23 | 24 | public class SMServerConfig extends SMClientConfig { 25 | private Properties properties = new Properties(); 26 | private Properties topProperties = new Properties(); 27 | 28 | public void loadFromProperties(String[] propertyArray, boolean top) { 29 | for (int i = 0; i < propertyArray.length - 1; i += 2) { 30 | String key = propertyArray[i]; 31 | String value = propertyArray[i + 1]; 32 | properties.put(key, value); 33 | if (top) 34 | topProperties.put(key, value); 35 | } 36 | 37 | load(top); 38 | } 39 | 40 | public void load(boolean top) { 41 | if (!top && !topProperties.isEmpty()) { 42 | Iterator iterator = topProperties.keySet().iterator(); 43 | while (iterator.hasNext()) { 44 | Object topKey = iterator.next(); 45 | properties.put(topKey, topProperties.get(topKey)); 46 | } 47 | } 48 | super.loadFromProperties(properties); 49 | } 50 | 51 | public void reset() { 52 | properties.clear(); 53 | topProperties.clear(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/render/IRenderPlayer.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.render; 19 | 20 | import net.minecraft.client.entity.AbstractClientPlayer; 21 | import net.minecraft.client.model.ModelBiped; 22 | import net.minecraft.client.model.ModelPlayer; 23 | import net.minecraft.client.renderer.entity.RenderManager; 24 | import net.smart.render.model.IModelPlayer; 25 | 26 | public interface IRenderPlayer { 27 | IModelPlayer createModel(ModelBiped existing, float f, boolean b); 28 | 29 | void initialize(ModelPlayer modelBipedMain, ModelBiped mb); 30 | 31 | void superDoRender(AbstractClientPlayer entityplayer, double d, double d1, double d2, float f, 32 | float renderPartialTicks); 33 | 34 | void superRotateCorpse(AbstractClientPlayer entityplayer, float totalTime, float actualRotation, float f2); 35 | 36 | void superRenderSpecials(AbstractClientPlayer entityPlayer, float f1, float f2, float f3, float f4, float f5, 37 | float f6, float f7); 38 | 39 | RenderManager getRenderRenderManager(); 40 | 41 | ModelPlayer getModelBipedMain(); 42 | 43 | ModelBiped getModelArmor(); 44 | 45 | boolean getSmallArms(); 46 | 47 | IModelPlayer[] getRenderModels(); 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/IEntityPlayerSP.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import net.minecraft.block.material.Material; 21 | import net.minecraft.client.Minecraft; 22 | import net.minecraft.entity.MoverType; 23 | import net.minecraft.entity.player.EntityPlayer; 24 | import net.minecraft.nbt.NBTTagCompound; 25 | 26 | public interface IEntityPlayerSP { 27 | SMBase getMoving(); 28 | 29 | boolean getSleepingField(); 30 | 31 | boolean getIsJumpingField(); 32 | 33 | boolean getIsInWebField(); 34 | 35 | void setIsInWebField(boolean b); 36 | 37 | Minecraft getMcField(); 38 | 39 | void setMoveForwardField(float f); 40 | 41 | void setMoveStrafingField(float f); 42 | 43 | void setIsJumpingField(boolean flag); 44 | 45 | void localMoveEntity(MoverType mover, double d, double d1, double d2); 46 | 47 | EntityPlayer.SleepResult localSleepInBedAt(int i, int j, int k); 48 | 49 | float localGetBrightness(); 50 | 51 | int localGetBrightnessForRender(); 52 | 53 | void localUpdateEntityActionState(); 54 | 55 | boolean localIsInsideOfMaterial(Material material); 56 | 57 | void localWriteEntityToNBT(NBTTagCompound nBTTagCompound); 58 | 59 | boolean localIsSneaking(); 60 | 61 | float localGetFOVMultiplier(); 62 | } 63 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/SRInstall.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render; 19 | 20 | import net.smart.utilities.Name; 21 | 22 | public class SRInstall { 23 | public final static Name ModelRenderer_compiled = new Name("compiled", "field_78812_q", "t"); 24 | public final static Name ModelRenderer_compileDisplayList = new Name("compileDisplayList", "func_78788_d", "d"); 25 | public final static Name ModelRenderer_displayList = new Name("displayList", "field_78811_r", "u"); 26 | public final static Name ModelRenderer_textureOffsetX = new Name("textureOffsetX", "field_78803_o", "r"); 27 | public final static Name ModelRenderer_textureOffsetY = new Name("textureOffsetY", "field_78813_p", "s"); 28 | 29 | public final static Name RenderPlayer_smallArms = new Name("smallArms", "field_177140_a", "a"); 30 | public final static Name RenderLivingBase_layerRenderers = new Name("layerRenderers", "field_177097_h", "h"); 31 | public final static Name LayerCustomHead_playerHead = new Name("field_177209_a", "field_177209_a", "a"); 32 | public final static Name LayerArmorBase_modelArmor = new Name("modelArmor", "field_177189_c", "c"); 33 | 34 | public final static Name ModelPlayer_bipedCape = new Name("bipedCape", "field_178729_w", "w"); 35 | public final static Name ModelPlayer_bipedDeadmau5Head = new Name("bipedDeadmau5Head", "field_178736_x", "x"); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/packet/SpeedChangePacket.java: -------------------------------------------------------------------------------- 1 | package net.smart.moving.packet; 2 | 3 | import java.nio.charset.StandardCharsets; 4 | 5 | import io.netty.buffer.ByteBuf; 6 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 7 | import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; 8 | import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; 9 | import net.smart.moving.SMComm; 10 | import net.smart.moving.SMPacketHandler; 11 | import net.smart.moving.SMServerComm; 12 | import net.smart.moving.SMServerPlayerBase; 13 | 14 | public class SpeedChangePacket implements IMessage { 15 | 16 | public static final byte PacketId = 4; 17 | 18 | public SpeedChangePacket() {} 19 | 20 | public int difference; 21 | public String username; 22 | 23 | public SpeedChangePacket(int difference, String username) { 24 | this.difference = difference; 25 | this.username = username; 26 | } 27 | 28 | @Override 29 | public void fromBytes(ByteBuf buf) { 30 | difference = buf.readInt(); 31 | int usernameLength = buf.readInt(); 32 | username = buf.readCharSequence(usernameLength, StandardCharsets.UTF_8).toString(); 33 | } 34 | 35 | @Override 36 | public void toBytes(ByteBuf buf) { 37 | buf.writeInt(difference); 38 | buf.writeInt(username.length()); 39 | buf.writeCharSequence(username, StandardCharsets.UTF_8); 40 | } 41 | 42 | public static class ClientHandler implements IMessageHandler { 43 | 44 | public ClientHandler() {} 45 | 46 | @Override 47 | public IMessage onMessage(SpeedChangePacket message, MessageContext ctx) { 48 | SMPacketHandler.receivePacket(message, SMComm.instance, null); 49 | return null; 50 | } 51 | } 52 | 53 | public static class ServerHandler implements IMessageHandler { 54 | 55 | public ServerHandler() {} 56 | 57 | @Override 58 | public IMessage onMessage(SpeedChangePacket message, MessageContext ctx) { 59 | SMServerPlayerBase serverPlayer = SMServerPlayerBase.getPlayerBase(ctx.getServerHandler().player); 60 | SMPacketHandler.receivePacket(message, SMServerComm.instance, serverPlayer); 61 | return null; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /SmartRender/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | maven { url = "http://files.minecraftforge.net/maven" } 5 | } 6 | dependencies { 7 | classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' 8 | } 9 | } 10 | apply plugin: 'net.minecraftforge.gradle.forge' 11 | 12 | file "build.properties" withReader { 13 | def prop = new Properties() 14 | prop.load(it) 15 | ext.config = new ConfigSlurper().parse prop 16 | } 17 | 18 | version = "${config.smartrender.version}" 19 | group = "net.smart" 20 | archivesBaseName = "SmartRender" 21 | 22 | ext.simpleVersion = version 23 | version = "${config.minecraft.version}-${project.version}" 24 | 25 | sourceCompatibility = targetCompatibility = '1.8' 26 | compileJava { 27 | sourceCompatibility = targetCompatibility = '1.8' 28 | } 29 | 30 | configurations { 31 | provided 32 | embedded 33 | compile.extendsFrom provided, embedded 34 | } 35 | 36 | dependencies { 37 | provided files("libs/PlayerAPI-1.12.2-1.0.jar") 38 | provided files("libs/RenderPlayerAPI-1.12.2-1.0.jar") 39 | } 40 | 41 | idea.module.scopes.PROVIDED.plus += [configurations.provided] 42 | 43 | minecraft { 44 | version = "${config.minecraft.version}-${config.forge.version}" 45 | runDir = "run" 46 | 47 | mappings = "${config.minecraft.mappings}" 48 | 49 | replace "@VERSION@", project.simpleVersion 50 | replace "/*@MCVERSIONDEP@*/", ", acceptedMinecraftVersions = \"[${config.minecraft.version},${config.minecraft.version}+)\"" 51 | } 52 | 53 | processResources { 54 | from(sourceSets.main.resources.srcDirs) { 55 | include 'mcmod.info' 56 | expand 'version': project.simpleVersion, 'mcversion': config.minecraft.version 57 | } 58 | from(sourceSets.main.resources.srcDirs) { 59 | include 'application.conf' 60 | filter { line -> 61 | line.replaceAll("@VERSION@", project.simpleVersion) 62 | } 63 | } 64 | from(sourceSets.main.resources.srcDirs) { 65 | exclude 'mcmod.info' 66 | exclude 'application.conf' 67 | } 68 | } 69 | 70 | jar { 71 | configurations.embedded.each { dep -> 72 | from(project.zipTree(dep)) { 73 | exclude 'META-INF', 'META-INF/**' 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /forge-1.12.2-14.23.5.2768-changelog.txt: -------------------------------------------------------------------------------- 1 | Changelog: 2 | Build 2768: 3 | LexManos: Bump version number for RB. 4 | 5 | Build 2767: 6 | LexManos: 7 | Change biome spawn list entries to use factory method where possible 8 | (#5075) 9 | LexManos: Prevent some texture loading errors from crashing the game (#5121) 10 | LexManos: Patch PotionHelper to use registry delegates (#5142) 11 | LexManos: Add a notification event for handling game rule changes (#5152) 12 | 13 | Build 2766: 14 | LexManos: 15 | Change universal bucket support to use fluid names instead of instances 16 | (#5031) 17 | 18 | Build 2765: 19 | LexManos: Fix NPE on clientside entities constructed with null world (#5170) 20 | 21 | Build 2764: 22 | tterrag: Fix patches from #5160 running on the client and causing stutter 23 | 24 | Build 2763: 25 | LexManos: 26 | Class transformer optimizations (#5159) 27 | * Filter packages for deobf transformation 28 | * Only serialize transformed class with TerminalTransformer if bytecode 29 | changed 30 | 31 | Build 2762: 32 | github: Update github stale so issues can be Assigned 33 | 34 | Build 2761: 35 | LexManos: 36 | Fix MC-136995 - Chunk loading and unloading issue with entities placed 37 | in exact positions. (#5160) 38 | Scatter gun patches to improve entity tracking and position tracking. 39 | Provided by Aikar through the Paper project, this commit of patches 40 | combines the following patches: 41 | 42 | https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0306-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch 43 | 44 | https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0315-Always-process-chunk-registration-after-moving.patch 45 | 46 | https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0335-Ensure-chunks-are-always-loaded-on-hard-position-set.patch 47 | 48 | https://github.com/PaperMC/Paper/blob/fd1bd5223a461b6d98280bb8f2d67280a30dd24a/Spigot-Server-Patches/0378-Sync-Player-Position-to-Vehicles.patch 49 | 50 | Build 2760: 51 | LexManos: Fix --mods and --modListFile arguments not making it past LaunchWrapper. 52 | 53 | Build 2759: 54 | LexManos: Remove BlamingTransformer (#5115) 55 | 56 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/packet/SoundPacket.java: -------------------------------------------------------------------------------- 1 | package net.smart.moving.packet; 2 | 3 | import java.nio.charset.StandardCharsets; 4 | 5 | import io.netty.buffer.ByteBuf; 6 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 7 | import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; 8 | import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; 9 | import net.smart.moving.SMComm; 10 | import net.smart.moving.SMPacketHandler; 11 | import net.smart.moving.SMServerComm; 12 | import net.smart.moving.SMServerPlayerBase; 13 | 14 | public class SoundPacket implements IMessage { 15 | 16 | public static final byte PacketId = 6; 17 | 18 | public SoundPacket() {} 19 | 20 | public String soundId; 21 | public float volume; 22 | public float pitch; 23 | 24 | public SoundPacket(String soundId, float volume, float pitch) { 25 | this.soundId = soundId; 26 | this.volume = volume; 27 | this.pitch = pitch; 28 | } 29 | 30 | @Override 31 | public void fromBytes(ByteBuf buf) { 32 | int soundIdLength = buf.readInt(); 33 | soundId = buf.readCharSequence(soundIdLength, StandardCharsets.UTF_8).toString(); 34 | volume = buf.readFloat(); 35 | pitch = buf.readFloat(); 36 | } 37 | 38 | @Override 39 | public void toBytes(ByteBuf buf) { 40 | buf.writeInt(soundId.length()); 41 | buf.writeCharSequence(soundId, StandardCharsets.UTF_8); 42 | buf.writeFloat(volume); 43 | buf.writeFloat(pitch); 44 | } 45 | 46 | public static class ClientHandler implements IMessageHandler { 47 | 48 | public ClientHandler() {} 49 | 50 | @Override 51 | public IMessage onMessage(SoundPacket message, MessageContext ctx) { 52 | SMPacketHandler.receivePacket(message, SMComm.instance, null); 53 | return null; 54 | } 55 | } 56 | 57 | public static class ServerHandler implements IMessageHandler { 58 | 59 | public ServerHandler() {} 60 | 61 | @Override 62 | public IMessage onMessage(SoundPacket message, MessageContext ctx) { 63 | SMServerPlayerBase serverPlayer = SMServerPlayerBase.getPlayerBase(ctx.getServerHandler().player); 64 | SMPacketHandler.receivePacket(message, SMServerComm.instance, serverPlayer); 65 | return null; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMButton.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import org.lwjgl.input.Keyboard; 21 | import org.lwjgl.input.Mouse; 22 | 23 | import net.minecraft.client.Minecraft; 24 | import net.minecraft.client.gui.GuiScreen; 25 | import net.minecraft.client.settings.KeyBinding; 26 | 27 | public class SMButton { 28 | public boolean Pressed; 29 | public boolean WasPressed; 30 | 31 | public boolean StartPressed; 32 | public boolean StopPressed; 33 | 34 | public void update(KeyBinding binding) { 35 | update(Minecraft.getMinecraft().inGameHasFocus && isKeyDown(binding)); 36 | } 37 | 38 | public void update(boolean pressed) { 39 | WasPressed = Pressed; 40 | Pressed = pressed; 41 | 42 | StartPressed = !WasPressed && Pressed; 43 | StopPressed = WasPressed && !Pressed; 44 | } 45 | 46 | private static boolean isKeyDown(KeyBinding keyBinding) { 47 | return isKeyDown(keyBinding, keyBinding.isPressed()); 48 | } 49 | 50 | private static boolean isKeyDown(KeyBinding keyBinding, boolean wasDown) { 51 | GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen; 52 | if (currentScreen == null || currentScreen.allowUserInput) 53 | return isKeyDown(keyBinding.getKeyCode()); 54 | return wasDown; 55 | } 56 | 57 | private static boolean isKeyDown(int keyCode) { 58 | if (keyCode >= 0) 59 | return Keyboard.isKeyDown(keyCode); 60 | return Mouse.isButtonDown(keyCode + 100); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/IEntityPlayerMP.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import java.util.List; 21 | 22 | import net.minecraft.entity.Entity; 23 | import net.minecraft.entity.player.EntityPlayerMP; 24 | import net.minecraft.util.math.AxisAlignedBB; 25 | import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; 26 | 27 | public interface IEntityPlayerMP extends IPacketSender { 28 | void sendPacketToTrackedPlayers(FMLProxyPacket packet); 29 | 30 | EntityPlayerMP getEntityPlayerMP(); 31 | 32 | String getUsername(); 33 | 34 | void resetFallDistance(); 35 | 36 | void resetTicksForFloatKick(); 37 | 38 | void setHeight(float height); 39 | 40 | double getMinY(); 41 | 42 | float getHeight(); 43 | 44 | void setMaxY(double maxY); 45 | 46 | boolean localIsEntityInsideOpaqueBlock(); 47 | 48 | SMServer getMoving(); 49 | 50 | float doGetHealth(); 51 | 52 | AxisAlignedBB getBox(); 53 | 54 | AxisAlignedBB expandBox(AxisAlignedBB box, double x, double y, double z); 55 | 56 | List getEntitiesExcludingPlayer(AxisAlignedBB box); 57 | 58 | boolean isDeadEntity(Entity entity); 59 | 60 | void onCollideWithPlayer(Entity entity); 61 | 62 | void localAddExhaustion(float exhaustion); 63 | 64 | void localAddMovementStat(double x, double y, double z); 65 | 66 | void localPlaySound(String soundId, float volume, float pitch); 67 | 68 | boolean localIsSneaking(); 69 | 70 | int getItemInUseCount(); 71 | } 72 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/model/SRModelEarsRenderer.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.model; 19 | 20 | import org.lwjgl.opengl.GL11; 21 | 22 | import net.minecraft.client.entity.EntityPlayerSP; 23 | import net.minecraft.client.model.ModelBase; 24 | import net.minecraft.entity.player.EntityPlayer; 25 | 26 | public class SRModelEarsRenderer extends SRModelSpecialRenderer { 27 | private int _i = 0; 28 | private EntityPlayer entityplayer; 29 | 30 | public SRModelEarsRenderer(ModelBase modelBase, int i, int j, SRModelRotationRenderer baseRenderer) { 31 | super(modelBase, i, j, baseRenderer); 32 | } 33 | 34 | public void beforeRender(EntityPlayer entityplayer) { 35 | super.beforeRender(true); 36 | this.entityplayer = entityplayer; 37 | } 38 | 39 | @Override 40 | public void doRender(float f, boolean useParentTransformations) { 41 | reset(); 42 | super.doRender(f, useParentTransformations); 43 | } 44 | 45 | @Override 46 | public void preTransform(float factor, boolean push) { 47 | if (entityplayer.isSneaking()) 48 | GL11.glTranslated(0.0F, 49 | 0.2F * (entityplayer instanceof EntityPlayerSP 50 | ? Math.cos(entityplayer.rotationPitch / RadiantToAngle) 51 | : 1), 52 | 0.0F); 53 | 54 | super.preTransform(factor, push); 55 | 56 | int i = _i++ % 2; 57 | GL11.glTranslatef(0.375F * (i * 2 - 1), 0.0F, 0.0F); 58 | GL11.glTranslatef(0.0F, -0.375F, 0.0F); 59 | GL11.glScalef(1.333333F, 1.333333F, 1.333333F); 60 | } 61 | 62 | @Override 63 | public boolean canBeRandomBoxSource() { 64 | return false; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/statistics/SmartStatisticsDatas.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.statistics; 19 | 20 | public class SmartStatisticsDatas { 21 | public final SmartStatisticsData horizontal = new SmartStatisticsData(); 22 | public final SmartStatisticsData vertical = new SmartStatisticsData(); 23 | public final SmartStatisticsData all = new SmartStatisticsData(); 24 | 25 | private float renderPartialTicks; 26 | 27 | public float getTotalHorizontalDistance() { 28 | return horizontal.getTotalDistance(renderPartialTicks); 29 | } 30 | 31 | public float getTotalVerticalDistance() { 32 | return vertical.getTotalDistance(renderPartialTicks); 33 | } 34 | 35 | public float getTotalDistance() { 36 | return all.getTotalDistance(renderPartialTicks); 37 | } 38 | 39 | public float getCurrentHorizontalSpeed() { 40 | return horizontal.getCurrentSpeed(renderPartialTicks); 41 | } 42 | 43 | public float getCurrentVerticalSpeed() { 44 | return vertical.getCurrentSpeed(renderPartialTicks); 45 | } 46 | 47 | public float getCurrentSpeed() { 48 | return all.getCurrentSpeed(renderPartialTicks); 49 | } 50 | 51 | public void setReady(float renderPartialTicks) { 52 | this.renderPartialTicks = renderPartialTicks; 53 | } 54 | 55 | public boolean isReady() { 56 | return !Float.isNaN(renderPartialTicks); 57 | } 58 | 59 | public void initialize(SmartStatisticsDatas previous) { 60 | renderPartialTicks = Float.NaN; 61 | 62 | horizontal.initialize(previous.horizontal); 63 | vertical.initialize(previous.vertical); 64 | all.initialize(previous.all); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMClient.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import java.util.HashMap; 21 | import java.util.Iterator; 22 | import java.util.Map; 23 | 24 | public class SMClient implements ISMClient { 25 | private final Map maximumExhaustionValues = new HashMap(); 26 | private boolean nativeUserInterfaceDrawing = true; 27 | 28 | @Override 29 | public float getMaximumExhaustion() { 30 | float maxExhaustion = SMContext.Config.getMaxExhaustion(); 31 | if (maximumExhaustionValues.size() > 0) { 32 | Iterator iterator = maximumExhaustionValues.values().iterator(); 33 | while (iterator.hasNext()) 34 | maxExhaustion = Math.max(iterator.next(), maxExhaustion); 35 | } 36 | return maxExhaustion; 37 | } 38 | 39 | @Override 40 | public float getMaximumUpJumpCharge() { 41 | return SMContext.Config._jumpChargeMaximum.value; 42 | } 43 | 44 | @Override 45 | public float getMaximumHeadJumpCharge() { 46 | return SMContext.Config._headJumpChargeMaximum.value; 47 | } 48 | 49 | @Override 50 | public void setMaximumExhaustionValue(String key, float value) { 51 | maximumExhaustionValues.put(key, value); 52 | } 53 | 54 | @Override 55 | public float getMaximumExhaustionValue(String key) { 56 | return maximumExhaustionValues.get(key); 57 | } 58 | 59 | @Override 60 | public boolean removeMaximumExhaustionValue(String key) { 61 | return maximumExhaustionValues.remove(key) != null; 62 | } 63 | 64 | @Override 65 | public void setNativeUserInterfaceDrawing(boolean value) { 66 | nativeUserInterfaceDrawing = value; 67 | } 68 | 69 | @Override 70 | public boolean getNativeUserInterfaceDrawing() { 71 | return nativeUserInterfaceDrawing; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMInstall.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import net.smart.utilities.Name; 21 | 22 | public class SMInstall { 23 | public final static Name RopesPlusCore = new Name("atomicstryker.ropesplus.common.RopesPlusCore"); 24 | public final static Name ModBlockFence = new Name("net.minecraft.src.modBlockFence", "modBlockFence"); 25 | public final static Name MacroModCore = new Name("net.eq2online.macros.core.MacroModCore"); 26 | public final static Name BlockSturdyLadder = new Name("mods.chupmacabre.ladderKit.sturdyLadders.BlockSturdyLadder"); 27 | public final static Name BlockRopeLadder = new Name("mods.chupmacabre.ladderKit.ropeLadders.BlockRopeLadder"); 28 | 29 | public final static Name RopesPlusClient = new Name("atomicstryker.ropesplus.client.RopesPlusClient"); 30 | public final static Name RopesPlusClient_onZipLine = new Name("onZipLine"); 31 | 32 | public final static Name CarpentersBlockLadder = new Name("carpentersblocks.block.BlockCarpentersLadder"); 33 | public final static Name CarpentersBlockProperties = new Name("carpentersblocks.util.BlockProperties"); 34 | public final static Name CarpentersTEBaseBlock = new Name("carpentersblocks.tileentity.TEBase"); 35 | public final static Name CarpentersBlockProperties_getMetadata = new Name("getMetadata"); 36 | 37 | public final static Name NetServerHandler_ticksForFloatKick = new Name("floatingTickCount", "field_147365_f", "f"); 38 | public final static Name GuiNewChat_chatMessageList = new Name("chatLines", "field_146252_h", "h"); 39 | public final static Name PlayerControllerMP_currentGameType = new Name("currentGameType", "field_78779_k", "k"); 40 | public final static Name ModifiableAttributeInstance_attributeValue = new Name("cachedValue", "field_111139_h", 41 | "h"); 42 | } 43 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/SRMod.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render; 19 | 20 | import api.player.model.IModelPlayerAPI; 21 | import api.player.model.ModelPlayerAPI; 22 | import api.player.render.RenderPlayerAPI; 23 | import net.minecraftforge.common.MinecraftForge; 24 | import net.minecraftforge.fml.common.Mod; 25 | import net.minecraftforge.fml.common.Mod.EventHandler; 26 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 27 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; 28 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 29 | import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; 30 | import net.smart.render.model.SRModelPlayerBase; 31 | import net.smart.render.render.SRRenderPlayerBase; 32 | import net.smart.render.statistics.SmartStatisticsContext; 33 | import net.smart.render.statistics.playerapi.SmartStatistics; 34 | import net.smart.render.statistics.playerapi.SmartStatisticsFactory; 35 | 36 | @Mod(modid = SRMod.ID, name = SRMod.NAME, version = SRMod.VERSION, useMetadata = true, clientSideOnly = true) 37 | public class SRMod { 38 | static final String ID = "smartrender"; 39 | static final String NAME = "Smart Render"; 40 | static final String VERSION = "@VERSION@"; 41 | 42 | @EventHandler 43 | public void preInit(FMLPreInitializationEvent event) { 44 | RenderPlayerAPI.register(SRInfo.ModName, SRRenderPlayerBase.class); 45 | ModelPlayerAPI.register(SRInfo.ModName, SRModelPlayerBase.class); 46 | } 47 | 48 | @EventHandler 49 | public void init(FMLInitializationEvent event) { 50 | SmartStatistics.register(); 51 | SmartStatisticsFactory.initialize(); 52 | MinecraftForge.EVENT_BUS.register(this); 53 | } 54 | 55 | @SubscribeEvent 56 | public void tickStart(ClientTickEvent event) { 57 | SmartStatisticsContext.onTickInGame(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /SmartRender/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /LICENSE-Paulscode SoundSystem CodecIBXM.txt: -------------------------------------------------------------------------------- 1 | SoundSystem CodecIBXM Class License: 2 | 3 | You are free to use this class for any purpose, commercial or otherwise. 4 | You may modify this class or source code, and distribute it any way you 5 | like, provided the following conditions are met: 6 | 7 | 1) You may not falsely claim to be the author of this class or any 8 | unmodified portion of it. 9 | 2) You may not copyright this class or a modified version of it and then 10 | sue me for copyright infringement. 11 | 3) If you modify the source code, you must clearly document the changes 12 | made before redistributing the modified source code, so other users know 13 | it is not the original code. 14 | 4) You are not required to give me credit for this class in any derived 15 | work, but if you do, you must also mention my website: 16 | http://www.paulscode.com 17 | 5) I the author will not be responsible for any damages (physical, 18 | financial, or otherwise) caused by the use if this class or any 19 | portion of it. 20 | 6) I the author do not guarantee, warrant, or make any representations, 21 | either expressed or implied, regarding the use of this class or any 22 | portion of it. 23 | 24 | Author: Paul Lamb 25 | http://www.paulscode.com 26 | 27 | 28 | This software is based on or using the IBXM library available from 29 | http://www.geocities.com/sunet2000/ 30 | 31 | 32 | IBXM is copyright (c) 2007, Martin Cameron, and is licensed under the BSD License. 33 | All rights reserved. 34 | 35 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 36 | 37 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 38 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 39 | Neither the name of mumart nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 40 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/packet/ConfigContentPacket.java: -------------------------------------------------------------------------------- 1 | package net.smart.moving.packet; 2 | 3 | import java.io.ByteArrayInputStream; 4 | import java.io.ByteArrayOutputStream; 5 | import java.io.IOException; 6 | import java.io.ObjectInputStream; 7 | import java.io.ObjectOutputStream; 8 | 9 | import io.netty.buffer.ByteBuf; 10 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 11 | import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; 12 | import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; 13 | import net.smart.moving.SMComm; 14 | import net.smart.moving.SMPacketHandler; 15 | import net.smart.moving.SMServerComm; 16 | import net.smart.moving.SMServerPlayerBase; 17 | 18 | public class ConfigContentPacket implements IMessage { 19 | 20 | public static final byte PacketId = 2; 21 | 22 | public String username; 23 | public String[] content; 24 | 25 | public ConfigContentPacket() {} 26 | 27 | public ConfigContentPacket(String username, String[] content) { 28 | this.username = username; 29 | this.content = content; 30 | } 31 | 32 | @Override 33 | public void fromBytes(ByteBuf buf) { 34 | try { 35 | byte[] inputBytes = new byte[buf.readableBytes()]; 36 | buf.readBytes(inputBytes); 37 | ByteArrayInputStream bais = new ByteArrayInputStream(inputBytes); 38 | ObjectInputStream ois = new ObjectInputStream(bais); 39 | username = (String) ois.readObject(); 40 | content = (String[]) ois.readObject(); 41 | ois.close(); 42 | bais.close(); 43 | } catch (IOException | ClassNotFoundException e) { 44 | e.printStackTrace(); 45 | } 46 | } 47 | 48 | @Override 49 | public void toBytes(ByteBuf buf) { 50 | try { 51 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); 52 | ObjectOutputStream oos = new ObjectOutputStream(baos); 53 | oos.writeObject(username); 54 | oos.writeObject(content); 55 | buf.writeBytes(baos.toByteArray()); 56 | } catch (IOException e) { 57 | e.printStackTrace(); 58 | } 59 | } 60 | 61 | public static class ClientHandler implements IMessageHandler { 62 | 63 | public ClientHandler() {} 64 | 65 | @Override 66 | public IMessage onMessage(ConfigContentPacket message, MessageContext ctx) { 67 | SMPacketHandler.receivePacket(message, SMComm.instance, null); 68 | return null; 69 | } 70 | } 71 | 72 | public static class ServerHandler implements IMessageHandler { 73 | 74 | public ServerHandler() {} 75 | 76 | @Override 77 | public IMessage onMessage(ConfigContentPacket message, MessageContext ctx) { 78 | SMServerPlayerBase serverPlayer = SMServerPlayerBase.getPlayerBase(ctx.getServerHandler().player); 79 | SMPacketHandler.receivePacket(message, SMServerComm.instance, serverPlayer); 80 | return null; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMServerComm.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; 21 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 22 | 23 | public class SMServerComm implements IPacketReceiver { 24 | public static final SMServerComm instance = new SMServerComm(); 25 | public static ILocalUserNameProvider localUserNameProvider = null; 26 | 27 | @Override 28 | public boolean processStatePacket(IMessage message, IEntityPlayerMP player, int entityId, long state) { 29 | player.getMoving().processStatePacket(message, state); 30 | return true; 31 | } 32 | 33 | @Override 34 | public boolean processConfigInfoPacket(IMessage message, IEntityPlayerMP player, String info) { 35 | player.getMoving().processConfigPacket(info); 36 | return true; 37 | } 38 | 39 | @Override 40 | public boolean processConfigContentPacket(IMessage message, IEntityPlayerMP player, String[] content, 41 | String username) { 42 | return false; 43 | } 44 | 45 | @Override 46 | public boolean processConfigChangePacket(IMessage message, IEntityPlayerMP player) { 47 | player.getMoving().processConfigChangePacket( 48 | localUserNameProvider != null ? localUserNameProvider.getLocalConfigUserName() : null); 49 | return true; 50 | } 51 | 52 | @Override 53 | public boolean processSpeedChangePacket(IMessage message, IEntityPlayerMP player, int difference, 54 | String username) { 55 | player.getMoving().processSpeedChangePacket(difference, 56 | localUserNameProvider != null ? localUserNameProvider.getLocalSpeedUserName() : null); 57 | return true; 58 | } 59 | 60 | @Override 61 | public boolean processHungerChangePacket(IMessage message, IEntityPlayerMP player, float hunger) { 62 | player.getMoving().processHungerChangePacket(hunger); 63 | return true; 64 | } 65 | 66 | @Override 67 | public boolean processSoundPacket(IMessage message, IEntityPlayerMP player, String soundId, float volume, 68 | float pitch) { 69 | player.getMoving().processSoundPacket(soundId, volume, pitch); 70 | return true; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/SRUtilities.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render; 19 | 20 | public class SRUtilities { 21 | public static final float Whole = (float) Math.PI * 2F; 22 | public static final float Half = (float) Math.PI; 23 | public static final float Quarter = Half / 2F; 24 | public static final float Eighth = Quarter / 2F; 25 | public static final float Sixteenth = Eighth / 2F; 26 | public static final float Thirtytwoth = Sixteenth / 2F; 27 | public static final float Sixtyfourth = Thirtytwoth / 2F; 28 | 29 | public static final float RadiantToAngle = 360F / Whole; 30 | 31 | public static float getHorizontalCollisionAngle(boolean isCollidedPositiveX, boolean isCollidedNegativeX, 32 | boolean isCollidedPositiveZ, boolean isCollidedNegativeZ) { 33 | if (isCollidedPositiveX) 34 | if (isCollidedNegativeX) 35 | if (isCollidedPositiveZ) 36 | if (isCollidedNegativeZ) 37 | ; 38 | else 39 | return 90F; 40 | else if (isCollidedNegativeZ) 41 | return 270F; 42 | else 43 | ; 44 | else if (isCollidedPositiveZ) 45 | if (isCollidedNegativeZ) 46 | return 0F; 47 | else 48 | return 45F; 49 | else if (isCollidedNegativeZ) 50 | return 315F; 51 | else 52 | return 0F; 53 | else if (isCollidedNegativeX) 54 | if (isCollidedPositiveZ) 55 | if (isCollidedNegativeZ) 56 | return 180F; 57 | else 58 | return 135F; 59 | else if (isCollidedNegativeZ) 60 | return 225F; 61 | else 62 | return 180F; 63 | else if (isCollidedPositiveZ) 64 | if (isCollidedNegativeZ) 65 | ; 66 | else 67 | return 90F; 68 | else if (isCollidedNegativeZ) 69 | return 270F; 70 | else 71 | ; 72 | 73 | return Float.NaN; 74 | } 75 | 76 | public static float getAngle(double x, double y) { 77 | if (x == 0) { 78 | if (y == 0) 79 | return Float.NaN; 80 | if (y < 0) 81 | return 270; 82 | return 90; 83 | } 84 | 85 | if (y == 0) { 86 | if (x < 0) 87 | return 180; 88 | return 0; 89 | } 90 | 91 | float angle = (float) Math.atan(y / x) * RadiantToAngle; 92 | if (x < 0) 93 | return 180F + angle; 94 | if (y < 0 && x > 0) 95 | return 360F + angle; 96 | return angle; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/model/IModelPlayer.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving.model; 19 | 20 | public interface IModelPlayer { 21 | SMModel getMovingModel(); 22 | 23 | void superAnimateHeadRotation(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 24 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 25 | 26 | void superAnimateSleeping(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 27 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 28 | 29 | void superAnimateArmSwinging(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 30 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 31 | 32 | void superAnimateRiding(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 33 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 34 | 35 | void superAnimateLeftArmItemHolding(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 36 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 37 | 38 | void superAnimateRightArmItemHolding(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 39 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 40 | 41 | void superAnimateWorkingBody(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 42 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 43 | 44 | void superAnimateWorkingArms(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 45 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 46 | 47 | void superAnimateSneaking(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 48 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 49 | 50 | void superApplyAnimationOffsets(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 51 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 52 | 53 | void superAnimateBowAiming(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 54 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 55 | } -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------- 2 | Source installation information for modders 3 | ------------------------------------------- 4 | This code follows the Minecraft Forge installation methodology. It will apply 5 | some small patches to the vanilla MCP source code, giving you and it access 6 | to some of the data and functions you need to build a successful mod. 7 | 8 | Note also that the patches are built against "unrenamed" MCP source code (aka 9 | srgnames) - this means that you will not be able to read them directly against 10 | normal code. 11 | 12 | Source pack installation information: 13 | 14 | Standalone source installation 15 | ============================== 16 | 17 | See the Forge Documentation online for more detailed instructions: 18 | http://mcforge.readthedocs.io/en/latest/gettingstarted/ 19 | 20 | Step 1: Open your command-line and browse to the folder where you extracted the zip file. 21 | 22 | Step 2: Once you have a command window up in the folder that the downloaded material was placed, type: 23 | 24 | Windows: "gradlew setupDecompWorkspace" 25 | Linux/Mac OS: "./gradlew setupDecompWorkspace" 26 | 27 | Step 3: After all that finished, you're left with a choice. 28 | For eclipse, run "gradlew eclipse" (./gradlew eclipse if you are on Mac/Linux) 29 | 30 | If you prefer to use IntelliJ, steps are a little different. 31 | 1. Open IDEA, and import project. 32 | 2. Select your build.gradle file and have it import. 33 | 3. Once it's finished you must close IntelliJ and run the following command: 34 | 35 | "gradlew genIntellijRuns" (./gradlew genIntellijRuns if you are on Mac/Linux) 36 | 37 | Step 4: The final step is to open Eclipse and switch your workspace to /eclipse/ (if you use IDEA, it should automatically start on your project) 38 | 39 | If at any point you are missing libraries in your IDE, or you've run into problems you can run "gradlew --refresh-dependencies" to refresh the local cache. "gradlew clean" to reset everything {this does not affect your code} and then start the processs again. 40 | 41 | Should it still not work, 42 | Refer to #ForgeGradle on EsperNet for more information about the gradle environment. 43 | 44 | Tip: 45 | If you do not care about seeing Minecraft's source code you can replace "setupDecompWorkspace" with one of the following: 46 | "setupDevWorkspace": Will patch, deobfuscate, and gather required assets to run minecraft, but will not generate human readable source code. 47 | "setupCIWorkspace": Same as Dev but will not download any assets. This is useful in build servers as it is the fastest because it does the least work. 48 | 49 | Tip: 50 | When using Decomp workspace, the Minecraft source code is NOT added to your workspace in a editable way. Minecraft is treated like a normal Library. Sources are there for documentation and research purposes and usually can be accessed under the 'referenced libraries' section of your IDE. 51 | 52 | Forge source installation 53 | ========================= 54 | MinecraftForge ships with this code and installs it as part of the forge 55 | installation process, no further action is required on your part. 56 | 57 | LexManos' Install Video 58 | ======================= 59 | https://www.youtube.com/watch?v=8VEdtQLuLO0&feature=youtu.be 60 | 61 | For more details update more often refer to the Forge Forums: 62 | http://www.minecraftforge.net/forum/index.php/topic,14048.0.html 63 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMContext.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import net.minecraft.block.state.IBlockState; 21 | import net.minecraft.client.Minecraft; 22 | import net.minecraft.server.MinecraftServer; 23 | import net.minecraft.util.math.BlockPos; 24 | import net.minecraft.world.World; 25 | import net.minecraftforge.fml.client.registry.ClientRegistry; 26 | import net.minecraftforge.fml.common.FMLCommonHandler; 27 | import net.smart.moving.config.SMClientConfig; 28 | import net.smart.moving.config.SMOptions; 29 | import net.smart.render.statistics.SmartStatisticsContext; 30 | 31 | public abstract class SMContext { 32 | public static final SMClient Client = new SMClient(); 33 | public static final SMOptions Options = new SMOptions(); 34 | public static SMClientConfig Config = Options; 35 | 36 | private static MinecraftServer lastMinecraftServer = null; 37 | 38 | private static boolean initialized; 39 | 40 | public static void onTickInGame() { 41 | Minecraft minecraft = Minecraft.getMinecraft(); 42 | 43 | if (minecraft.world != null && minecraft.world.isRemote) 44 | SMFactory.handleMultiPlayerTick(minecraft); 45 | 46 | Options.initializeForGameIfNeccessary(); 47 | 48 | initializeServerIfNecessary(); 49 | } 50 | 51 | public static void initialize() { 52 | if (!initialized) 53 | SmartStatisticsContext.setCalculateHorizontalStats(true); 54 | else 55 | return; 56 | 57 | ClientRegistry.registerKeyBinding(Options.keyBindGrab); 58 | ClientRegistry.registerKeyBinding(Options.keyBindConfigToggle); 59 | ClientRegistry.registerKeyBinding(Options.keyBindSpeedIncrease); 60 | ClientRegistry.registerKeyBinding(Options.keyBindSpeedDecrease); 61 | 62 | initialized = true; 63 | } 64 | 65 | public static void initializeServerIfNecessary() { 66 | MinecraftServer currentMinecraftServer = FMLCommonHandler.instance().getMinecraftServerInstance(); 67 | if (currentMinecraftServer != null && currentMinecraftServer != lastMinecraftServer) { 68 | int gameTypeID = currentMinecraftServer.getGameType().getID(); 69 | SMServer.initialize(SMOptions.optionsPath, gameTypeID, Options); 70 | } 71 | lastMinecraftServer = currentMinecraftServer; 72 | } 73 | 74 | public static IBlockState getState(World world, BlockPos blockPos) { 75 | return world.getBlockState(blockPos); 76 | } 77 | 78 | public static IBlockState getState(World world, int x, int y, int z) { 79 | return world.getBlockState(new BlockPos(x, y, z)); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /CREDITS.txt: -------------------------------------------------------------------------------- 1 | Minecraft Forge: Credits/Thank You 2 | 3 | Forge is a set of tools and modifications to the Minecraft base game code to assist 4 | mod developers in creating new and exciting content. It has been in development for 5 | several years now, but I would like to take this time thank a few people who have 6 | helped it along it's way. 7 | 8 | First, the people who originally created the Forge projects way back in Minecraft 9 | alpha. Eloraam of RedPower, and SpaceToad of Buildcraft, without their acceptiance 10 | of me taking over the project, who knows what Minecraft modding would be today. 11 | 12 | Secondly, someone who has worked with me, and developed some of the core features 13 | that allow modding to he as functional, and as simple as it is, cpw. For developing 14 | FML, which stabelized the client and server modding ecosystem. As well as the base 15 | loading system that allows us to modify Minecraft's code as elegently as possible. 16 | 17 | Mezz, who has stepped up as the issue and pull request manager. Helping to keep me 18 | sane as well as guiding the community into creating better additions to Forge. 19 | 20 | Searge, Bspks, Fesh0r, ProfMobious, and all the rest over on the MCP team {of which 21 | I am a part}. For creating some of the core tools needed to make Minecraft modding 22 | both possible, and as stable as can be. 23 | On that note, here is some specific information of the MCP data we use: 24 | * Minecraft Coder Pack (MCP) * 25 | Forge Mod Loader and Minecraft Forge have permission to distribute and automatically 26 | download components of MCP and distribute MCP data files. This permission is not 27 | transitive and others wishing to redistribute the Minecraft Forge source independently 28 | should seek permission of MCP or remove the MCP data files and request their users 29 | to download MCP separately. 30 | 31 | And lastly, the countless community members who have spent time submitting bug reports, 32 | pull requests, and just helping out the community in general. Thank you. 33 | 34 | --LexManos 35 | 36 | ========================================================================= 37 | 38 | This is Forge Mod Loader. 39 | 40 | You can find the source code at all times at https://github.com/MinecraftForge/MinecraftForge/tree/1.12.x/src/main/java/net/minecraftforge/fml 41 | 42 | This minecraft mod is a clean open source implementation of a mod loader for minecraft servers 43 | and minecraft clients. 44 | 45 | The code is authored by cpw. 46 | 47 | It began by partially implementing an API defined by the client side ModLoader, authored by Risugami. 48 | http://www.minecraftforum.net/topic/75440- 49 | This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader. 50 | 51 | It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge. 52 | http://www.minecraftforge.net/ 53 | 54 | Additionally, it contains an implementation of topological sort based on that 55 | published at http://keithschwarz.com/interesting/code/?dir=topological-sort 56 | 57 | It also contains code from the Maven project for performing versioned dependency 58 | resolution. http://maven.apache.org/ 59 | 60 | It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/ 61 | with credit to it's authors. 62 | 63 | Forge Mod Loader downloads components from the Minecraft Coder Pack 64 | (http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team. 65 | 66 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMHandsClimbing.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import java.io.PrintStream; 21 | 22 | public class SMHandsClimbing { 23 | public static final int MiddleGrab = 2; 24 | public static final int UpGrab = 1; 25 | public static final int NoGrab = 0; 26 | 27 | public static SMHandsClimbing None = new SMHandsClimbing(-3); 28 | public static SMHandsClimbing Sink = new SMHandsClimbing(-2); 29 | public static SMHandsClimbing TopHold = new SMHandsClimbing(-1); 30 | public static SMHandsClimbing BottomHold = new SMHandsClimbing(0); 31 | public static SMHandsClimbing Up = new SMHandsClimbing(1); 32 | public static SMHandsClimbing FastUp = new SMHandsClimbing(2); 33 | 34 | private int _value; 35 | 36 | private SMHandsClimbing(int value) { 37 | _value = value; 38 | } 39 | 40 | public boolean IsRelevant() { 41 | return _value > None._value; 42 | } 43 | 44 | public boolean IsUp() { 45 | return this == Up || this == FastUp; 46 | } 47 | 48 | public SMHandsClimbing ToUp() { 49 | if (this == BottomHold) 50 | return Up; 51 | return this; 52 | } 53 | 54 | public SMHandsClimbing ToDown() { 55 | if (this == TopHold) 56 | return Sink; 57 | return this; 58 | } 59 | 60 | public SMHandsClimbing max(SMHandsClimbing other, SMClimbGap inout_thisClimbGap, SMClimbGap otherClimbGap) { 61 | if (!otherClimbGap.SkipGaps) { 62 | inout_thisClimbGap.CanStand |= otherClimbGap.CanStand; 63 | inout_thisClimbGap.MustCrawl |= otherClimbGap.MustCrawl; 64 | } 65 | if (_value < other._value) { 66 | inout_thisClimbGap.Block = otherClimbGap.Block; 67 | inout_thisClimbGap.Meta = otherClimbGap.Meta; 68 | inout_thisClimbGap.Direction = otherClimbGap.Direction; 69 | } 70 | return get(Math.max(_value, other._value)); 71 | } 72 | 73 | @Override 74 | public String toString() { 75 | if (_value <= None._value) 76 | return "None"; 77 | if (_value == Sink._value) 78 | return "Sink"; 79 | if (_value == BottomHold._value) 80 | return "BottomHold"; 81 | if (_value == TopHold._value) 82 | return "TopHold"; 83 | if (_value == Up._value) 84 | return "Up"; 85 | return "FastUp"; 86 | } 87 | 88 | public void print(String name) { 89 | PrintStream stream = System.err; 90 | if (name != null) 91 | stream.print(name + " = "); 92 | stream.println(this); 93 | } 94 | 95 | private static SMHandsClimbing get(int value) { 96 | if (value <= None._value) 97 | return None; 98 | if (value == Sink._value) 99 | return Sink; 100 | if (value == BottomHold._value) 101 | return BottomHold; 102 | if (value == TopHold._value) 103 | return TopHold; 104 | if (value == Up._value) 105 | return Up; 106 | return FastUp; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMOther.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import net.minecraft.client.entity.EntityOtherPlayerMP; 21 | 22 | public class SMOther extends SMBase { 23 | public boolean foundAlive; 24 | 25 | private boolean _isJumping = false; 26 | private boolean _doFlyingAnimation = false; 27 | private boolean _doFallingAnimation = false; 28 | 29 | public SMOther(EntityOtherPlayerMP sp) { 30 | super(sp, null); 31 | } 32 | 33 | public void processStatePacket(long state) { 34 | actualFeetClimbType = (int) (state & 15); 35 | state >>>= 4; 36 | 37 | actualHandsClimbType = (int) (state & 15); 38 | state >>>= 4; 39 | 40 | _isJumping = (state & 1) != 0; 41 | state >>>= 1; 42 | 43 | isDiving = (state & 1) != 0; 44 | state >>>= 1; 45 | 46 | isDipping = (state & 1) != 0; 47 | state >>>= 1; 48 | 49 | isSwimming = (state & 1) != 0; 50 | state >>>= 1; 51 | 52 | isCrawlClimbing = (state & 1) != 0; 53 | state >>>= 1; 54 | 55 | isCrawling = (state & 1) != 0; 56 | state >>>= 1; 57 | 58 | isClimbing = (state & 1) != 0; 59 | state >>>= 1; 60 | 61 | boolean isSmall = (state & 1) != 0; 62 | heightOffset = isSmall ? -1 : 0; 63 | sp.height = 1.8F + heightOffset; 64 | state >>>= 1; 65 | 66 | _doFallingAnimation = (state & 1) != 0; 67 | state >>>= 1; 68 | 69 | _doFlyingAnimation = (state & 1) != 0; 70 | state >>>= 1; 71 | 72 | isCeilingClimbing = (state & 1) != 0; 73 | state >>>= 1; 74 | 75 | isLevitating = (state & 1) != 0; 76 | state >>>= 1; 77 | 78 | isHeadJumping = (state & 1) != 0; 79 | state >>>= 1; 80 | 81 | isSliding = (state & 1) != 0; 82 | state >>>= 1; 83 | 84 | angleJumpType = (int) (state & 7); 85 | state >>>= 3; 86 | 87 | isFeetVineClimbing = (state & 1) != 0; 88 | state >>>= 1; 89 | 90 | isHandsVineClimbing = (state & 1) != 0; 91 | state >>>= 1; 92 | 93 | isClimbJumping = (state & 1) != 0; 94 | state >>>= 1; 95 | 96 | boolean wasClimbBackJumping = isClimbBackJumping; 97 | isClimbBackJumping = (state & 1) != 0; 98 | if (!wasClimbBackJumping && isClimbBackJumping) 99 | onStartClimbBackJump(); 100 | state >>>= 1; 101 | 102 | isSlow = (state & 1) != 0; 103 | state >>>= 1; 104 | 105 | isFast = (state & 1) != 0; 106 | state >>>= 1; 107 | 108 | boolean wasWallJumping = isWallJumping; 109 | isWallJumping = (state & 1) != 0; 110 | if (!wasWallJumping && isWallJumping) 111 | onStartWallJump(null); 112 | state >>>= 1; 113 | 114 | isRopeSliding = (state & 1) != 0; 115 | } 116 | 117 | @Override 118 | public boolean isJumping() { 119 | return _isJumping; 120 | } 121 | 122 | @Override 123 | public boolean doFlyingAnimation() { 124 | return _doFlyingAnimation; 125 | } 126 | 127 | @Override 128 | public boolean doFallingAnimation() { 129 | return _doFallingAnimation; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /src/main/resources/assets/smartmoving/lang/en_us.lang: -------------------------------------------------------------------------------- 1 | #===========# 2 | # Key Names # 3 | #===========# 4 | 5 | key.climb=Grab 6 | key.config.toggle=Change Configuration 7 | key.speed.increase=Increase Speed 8 | key.speed.decrease=Decrease Speed 9 | key.categories.smartmoving=Smart Moving 10 | 11 | 12 | 13 | #====================================# 14 | # Configuration change chat messages # 15 | #====================================# 16 | 17 | # Used to announce whether a global or local Smart Moving configuration is used 18 | move.config.chat.server.global.unnamed=Using Smart Moving server configuration 19 | move.config.chat.server.global.named=Using Smart Moving server configuration '%s' 20 | move.config.chat.server.local=Using local Smart Moving configurations 21 | 22 | # Used when the Smart Moving configuration is changed by the server 23 | move.config.chat.server.disable=Smart Moving was disabled by the server configuration 24 | move.config.chat.server.update.named=Smart Moving server configuration was set to '%s' 25 | move.config.chat.server.update.unnamed=Smart Moving server configuration was updated 26 | move.config.chat.server.enable=Smart Moving was enabled by the server configuration 27 | 28 | # Used when the Smart Moving configuration is changed by another player 29 | move.config.chat.server.disable.user=Smart Moving disabled by '%s' 30 | move.config.chat.server.update.named.user=Smart Moving set to '%s' by '%s' 31 | move.config.chat.server.update.unnamed.user=Smart Moving server configuration was updated by '%s' 32 | move.config.chat.server.enable.user=Smart Moving enabled by '%s' 33 | 34 | # Used when a player with no rights tries to change the Smart Moving configuration 35 | move.config.chat.server.illegal.remote=You have no rights to change the Smart Moving configuration on the remote server. 36 | move.config.chat.server.illegal.local=You have no rights to change the Smart Moving configuration on your local server. 37 | 38 | # Used when a player changes the Smart Moving configuration for himself alone 39 | move.config.chat.client.disabled=Smart Moving disabled 40 | move.config.chat.client.enabled=Smart Moving enabled 41 | move.config.chat.client.unnamed=Smart Moving set to key '%s' 42 | move.config.chat.client.named=Smart Moving set to '%s' 43 | move.config.chat.client.help=(switch by pressing '%s') 44 | 45 | # Used when a player changes the Smart Moving configuration for everybody 46 | move.config.chat.client.everyone.disabled=Smart Moving disabled for all players 47 | move.config.chat.client.everyone.enabled=Smart Moving enabled for all players 48 | move.config.chat.client.everyone.unnamed=Smart Moving set to key '%s' for all players 49 | move.config.chat.client.everyone.named=Smart Moving set to '%s' for all players 50 | 51 | 52 | 53 | #============================# 54 | # Speed change chat messages # 55 | #============================# 56 | 57 | # Used when the Smart Moving speed is changed by another player 58 | move.speed.chat.server.change=Smart Moving speed changed to %s%% by '%s' 59 | move.speed.chat.server.reset=Smart Moving speed changed to 100%% by '%s' 60 | 61 | # Used when a player with no rights tries to change the Smart Moving speed 62 | move.speed.chat.server.illegal.remote=You have no rights to change the Smart Moving speed on the remote server. 63 | move.speed.chat.server.illegal.local=You have no rights to change the Smart Moving speed on your local server. 64 | 65 | # Used when a player changes the Smart Moving speed for himself alone 66 | move.speed.chat.client.init=Smart Moving speed is %s%% 67 | move.speed.chat.client.help=(increase speed by pressing '%s', decrease by pressing '%s') 68 | move.speed.chat.client.change=Smart Moving speed changed to %s%% 69 | move.speed.chat.client.reset=Smart Moving speed changed to 100%% 70 | 71 | # Used when a player changes the Smart Moving speed for everybody 72 | move.speed.chat.client.everyone.change=Smart Moving speed changed to %s%% for all players 73 | move.speed.chat.client.everyone.reset=Smart Moving speed changed to 100%% for all players -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMFeetClimbing.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import java.io.PrintStream; 21 | 22 | public class SMFeetClimbing { 23 | public static final int DownStep = 1; 24 | public static final int NoStep = 0; 25 | 26 | public static SMFeetClimbing None = new SMFeetClimbing(-3); 27 | public static SMFeetClimbing BaseHold = new SMFeetClimbing(-2); 28 | public static SMFeetClimbing BaseWithHands = new SMFeetClimbing(-1); 29 | public static SMFeetClimbing TopWithHands = new SMFeetClimbing(0); 30 | public static SMFeetClimbing SlowUpWithHoldWithoutHands = new SMFeetClimbing(1); 31 | public static SMFeetClimbing SlowUpWithSinkWithoutHands = new SMFeetClimbing(2); 32 | public static SMFeetClimbing FastUp = new SMFeetClimbing(3); 33 | 34 | private int _value; 35 | 36 | private SMFeetClimbing(int value) { 37 | _value = value; 38 | } 39 | 40 | public boolean IsRelevant() { 41 | return _value > None._value; 42 | } 43 | 44 | public boolean IsIndependentlyRelevant() { 45 | return _value > BaseWithHands._value; 46 | } 47 | 48 | public boolean IsUp() { 49 | return this == SlowUpWithHoldWithoutHands || this == SlowUpWithSinkWithoutHands || this == FastUp; 50 | } 51 | 52 | public SMFeetClimbing max(SMFeetClimbing other, SMClimbGap inout_thisClimbGap, SMClimbGap otherClimbGap) { 53 | if (!otherClimbGap.SkipGaps) { 54 | inout_thisClimbGap.CanStand |= otherClimbGap.CanStand; 55 | inout_thisClimbGap.MustCrawl |= otherClimbGap.MustCrawl; 56 | } 57 | if (_value < other._value) { 58 | inout_thisClimbGap.Block = otherClimbGap.Block; 59 | inout_thisClimbGap.Meta = otherClimbGap.Meta; 60 | inout_thisClimbGap.Direction = otherClimbGap.Direction; 61 | } 62 | return get(Math.max(_value, other._value)); 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | if (_value <= None._value) 68 | return "None"; 69 | if (_value == BaseHold._value) 70 | return "BaseHold"; 71 | if (_value == BaseWithHands._value) 72 | return "BaseWithHands"; 73 | if (_value == TopWithHands._value) 74 | return "TopWithHands"; 75 | if (_value == SlowUpWithHoldWithoutHands._value) 76 | return "SlowUpWithHoldWithoutHands"; 77 | if (_value == SlowUpWithSinkWithoutHands._value) 78 | return "SlowUpWithSinkWithoutHands"; 79 | return "FastUp"; 80 | } 81 | 82 | public void print(String name) { 83 | PrintStream stream = System.err; 84 | if (name != null) 85 | stream.print(name + " = "); 86 | stream.println(this); 87 | } 88 | 89 | private static SMFeetClimbing get(int value) { 90 | if (value <= None._value) 91 | return None; 92 | if (value == BaseHold._value) 93 | return BaseHold; 94 | if (value == BaseWithHands._value) 95 | return BaseWithHands; 96 | if (value == TopWithHands._value) 97 | return TopWithHands; 98 | if (value == SlowUpWithHoldWithoutHands._value) 99 | return SlowUpWithHoldWithoutHands; 100 | if (value == SlowUpWithSinkWithoutHands._value) 101 | return SlowUpWithSinkWithoutHands; 102 | return FastUp; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/render/SRLayerEntityOnShoulder.java: -------------------------------------------------------------------------------- 1 | package net.smart.render.render; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import net.minecraft.client.renderer.entity.RenderManager; 6 | import net.minecraft.client.renderer.entity.layers.LayerEntityOnShoulder; 7 | import net.minecraft.entity.EntityLivingBase; 8 | import net.minecraft.entity.player.EntityPlayer; 9 | import net.smart.render.SRContext; 10 | import net.smart.render.SRUtilities; 11 | import net.smart.render.model.SRModel; 12 | import net.smart.render.model.SRModelRotationRenderer; 13 | 14 | public class SRLayerEntityOnShoulder extends LayerEntityOnShoulder { 15 | private IRenderPlayer irp; 16 | 17 | private static float RadiantToAngle = SRUtilities.RadiantToAngle; 18 | private static int XYZ = SRModelRotationRenderer.XYZ; 19 | private static int XZY = SRModelRotationRenderer.XZY; 20 | private static int YXZ = SRModelRotationRenderer.YXZ; 21 | private static int YZX = SRModelRotationRenderer.YZX; 22 | private static int ZXY = SRModelRotationRenderer.ZXY; 23 | private static int ZYX = SRModelRotationRenderer.ZYX; 24 | 25 | public SRLayerEntityOnShoulder(RenderManager p_i47370_1_, IRenderPlayer irp) { 26 | super(p_i47370_1_); 27 | this.irp = irp; 28 | } 29 | 30 | @Override 31 | public void doRenderLayer(EntityPlayer entitylivingbaseIn, float limbSwing, float limbSwingAmount, 32 | float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { 33 | GL11.glPushMatrix(); 34 | 35 | SRModel currentModel = SRContext.getPlayerBase(irp.getModelBipedMain()).getRenderModel(); 36 | SRModelRotationRenderer biped = currentModel.bipedOuter; 37 | SRModelRotationRenderer body = currentModel.bipedBody; 38 | SRModelRotationRenderer torso = currentModel.bipedTorso; 39 | 40 | GL11.glTranslatef(biped.rotationPointX * scale, biped.rotationPointY * scale, biped.rotationPointZ * scale); 41 | rotate(biped.rotationOrder, biped.rotateAngleX, biped.rotateAngleY, biped.rotateAngleZ); 42 | GL11.glTranslatef(biped.offsetX, biped.offsetY, biped.offsetZ); 43 | 44 | GL11.glTranslatef(torso.rotationPointX * scale, torso.rotationPointY * scale, torso.rotationPointZ * scale); 45 | rotate(torso.rotationOrder, torso.rotateAngleX, torso.rotateAngleY, torso.rotateAngleZ); 46 | GL11.glTranslatef(torso.offsetX, torso.offsetY, torso.offsetZ); 47 | 48 | GL11.glTranslatef(body.rotationPointX * scale, body.rotationPointY * scale, body.rotationPointZ * scale); 49 | rotate(body.rotationOrder, body.rotateAngleX, body.rotateAngleY, body.rotateAngleZ); 50 | GL11.glTranslatef(body.offsetX, body.offsetY, body.offsetZ); 51 | 52 | super.doRenderLayer(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, 53 | headPitch, scale); 54 | GL11.glPopMatrix(); 55 | } 56 | 57 | private static void rotate(int rotationOrder, float rotateAngleX, float rotateAngleY, float rotateAngleZ) { 58 | if ((rotationOrder == ZXY) && rotateAngleY != 0.0F) 59 | GL11.glRotatef(rotateAngleY * RadiantToAngle, 0.0F, 1.0F, 0.0F); 60 | 61 | if ((rotationOrder == YXZ) && rotateAngleZ != 0.0F) 62 | GL11.glRotatef(rotateAngleZ * RadiantToAngle, 0.0F, 0.0F, 1.0F); 63 | 64 | if ((rotationOrder == YZX || rotationOrder == YXZ || rotationOrder == ZXY || rotationOrder == ZYX) 65 | && rotateAngleX != 0.0F) 66 | GL11.glRotatef(rotateAngleX * RadiantToAngle, 1.0F, 0.0F, 0.0F); 67 | 68 | if ((rotationOrder == XZY || rotationOrder == ZYX) && rotateAngleY != 0.0F) 69 | GL11.glRotatef(rotateAngleY * RadiantToAngle, 0.0F, 1.0F, 0.0F); 70 | 71 | if ((rotationOrder == XYZ || rotationOrder == XZY || rotationOrder == YZX || rotationOrder == ZXY 72 | || rotationOrder == ZYX) && rotateAngleZ != 0.0F) 73 | GL11.glRotatef(rotateAngleZ * RadiantToAngle, 0.0F, 0.0F, 1.0F); 74 | 75 | if ((rotationOrder == XYZ || rotationOrder == YXZ || rotationOrder == YZX) && rotateAngleY != 0.0F) 76 | GL11.glRotatef(rotateAngleY * RadiantToAngle, 0.0F, 1.0F, 0.0F); 77 | 78 | if ((rotationOrder == XYZ || rotationOrder == XZY) && rotateAngleX != 0.0F) 79 | GL11.glRotatef(rotateAngleX * RadiantToAngle, 1.0F, 0.0F, 0.0F); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/render/SRLayerElytra.java: -------------------------------------------------------------------------------- 1 | package net.smart.render.render; 2 | 3 | import org.lwjgl.opengl.GL11; 4 | 5 | import net.minecraft.client.renderer.GlStateManager; 6 | import net.minecraft.client.renderer.entity.RenderLivingBase; 7 | import net.minecraft.client.renderer.entity.layers.LayerElytra; 8 | import net.minecraft.entity.EntityLivingBase; 9 | import net.smart.render.SRContext; 10 | import net.smart.render.SRUtilities; 11 | import net.smart.render.model.SRModel; 12 | import net.smart.render.model.SRModelRotationRenderer; 13 | 14 | public class SRLayerElytra extends LayerElytra { 15 | private IRenderPlayer irp; 16 | 17 | private static float RadiantToAngle = SRUtilities.RadiantToAngle; 18 | private static int XYZ = SRModelRotationRenderer.XYZ; 19 | private static int XZY = SRModelRotationRenderer.XZY; 20 | private static int YXZ = SRModelRotationRenderer.YXZ; 21 | private static int YZX = SRModelRotationRenderer.YZX; 22 | private static int ZXY = SRModelRotationRenderer.ZXY; 23 | private static int ZYX = SRModelRotationRenderer.ZYX; 24 | 25 | public SRLayerElytra(RenderLivingBase p_i47185_1_, IRenderPlayer irp) { 26 | super(p_i47185_1_); 27 | this.irp = irp; 28 | } 29 | 30 | @Override 31 | public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, 32 | float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { 33 | GL11.glPushMatrix(); 34 | SRModel currentModel = SRContext.getPlayerBase(irp.getModelBipedMain()).getRenderModel(); 35 | SRModelRotationRenderer biped = currentModel.bipedOuter; 36 | SRModelRotationRenderer body = currentModel.bipedBody; 37 | SRModelRotationRenderer torso = currentModel.bipedTorso; 38 | 39 | GL11.glTranslatef(biped.rotationPointX * scale, biped.rotationPointY * scale, biped.rotationPointZ * scale); 40 | rotate(biped.rotationOrder, biped.rotateAngleX, biped.rotateAngleY, biped.rotateAngleZ); 41 | GL11.glTranslatef(biped.offsetX, biped.offsetY, biped.offsetZ); 42 | 43 | GL11.glTranslatef(torso.rotationPointX * scale, torso.rotationPointY * scale, torso.rotationPointZ * scale); 44 | rotate(torso.rotationOrder, torso.rotateAngleX, torso.rotateAngleY, torso.rotateAngleZ); 45 | GL11.glTranslatef(torso.offsetX, torso.offsetY, torso.offsetZ); 46 | 47 | GL11.glTranslatef(body.rotationPointX * scale, body.rotationPointY * scale, body.rotationPointZ * scale); 48 | rotate(body.rotationOrder, body.rotateAngleX, body.rotateAngleY, body.rotateAngleZ); 49 | GL11.glTranslatef(body.offsetX, body.offsetY, body.offsetZ); 50 | 51 | super.doRenderLayer(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, 52 | headPitch, scale); 53 | GL11.glPopMatrix(); 54 | } 55 | 56 | private static void rotate(int rotationOrder, float rotateAngleX, float rotateAngleY, float rotateAngleZ) { 57 | if ((rotationOrder == ZXY) && rotateAngleY != 0.0F) 58 | GL11.glRotatef(rotateAngleY * RadiantToAngle, 0.0F, 1.0F, 0.0F); 59 | 60 | if ((rotationOrder == YXZ) && rotateAngleZ != 0.0F) 61 | GL11.glRotatef(rotateAngleZ * RadiantToAngle, 0.0F, 0.0F, 1.0F); 62 | 63 | if ((rotationOrder == YZX || rotationOrder == YXZ || rotationOrder == ZXY || rotationOrder == ZYX) 64 | && rotateAngleX != 0.0F) 65 | GL11.glRotatef(rotateAngleX * RadiantToAngle, 1.0F, 0.0F, 0.0F); 66 | 67 | if ((rotationOrder == XZY || rotationOrder == ZYX) && rotateAngleY != 0.0F) 68 | GL11.glRotatef(rotateAngleY * RadiantToAngle, 0.0F, 1.0F, 0.0F); 69 | 70 | if ((rotationOrder == XYZ || rotationOrder == XZY || rotationOrder == YZX || rotationOrder == ZXY 71 | || rotationOrder == ZYX) && rotateAngleZ != 0.0F) 72 | GL11.glRotatef(rotateAngleZ * RadiantToAngle, 0.0F, 0.0F, 1.0F); 73 | 74 | if ((rotationOrder == XYZ || rotationOrder == YXZ || rotationOrder == YZX) && rotateAngleY != 0.0F) 75 | GL11.glRotatef(rotateAngleY * RadiantToAngle, 0.0F, 1.0F, 0.0F); 76 | 77 | if ((rotationOrder == XYZ || rotationOrder == XZY) && rotateAngleX != 0.0F) 78 | GL11.glRotatef(rotateAngleX * RadiantToAngle, 1.0F, 0.0F, 0.0F); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/resources/assets/smartmoving/lang/nl_nl.lang: -------------------------------------------------------------------------------- 1 | # Translated by Dunncann 2 | 3 | #===========# 4 | # Key Names # 5 | #===========# 6 | 7 | key.climb=Grijp 8 | key.config.toggle=Configuratie Aanpassen 9 | key.speed.increase=Sneller 10 | key.speed.decrease=Langzamer 11 | 12 | 13 | 14 | #====================================# 15 | # Configuration change chat messages # 16 | #====================================# 17 | 18 | # Used to announce whether a global or local Smart Moving configuration is used 19 | move.config.chat.server.global.unnamed=Smart Moving server-configuratie wordt gebruikt 20 | move.config.chat.server.global.named=Smart Moving server-configuratie '%s' wordt gebruikt 21 | move.config.chat.server.local=Locale Smart Moving configuraties worden gebruikt 22 | 23 | # Used when the Smart Moving configuration is changed by the server 24 | move.config.chat.server.disable=Smart Moving is uitgeschakeld door de server-configuratie 25 | move.config.chat.server.update.named=Smart Moving server configuratie is ingesteld op '%s' 26 | move.config.chat.server.update.unnamed=Smart Moving server configuratie is geupdate 27 | move.config.chat.server.enable=Smart Moving is ingeschakeld door de server-configuratie 28 | 29 | # Used when the Smart Moving configuration is changed by another player 30 | move.config.chat.server.disable.user=Smart Moving uitgeschakeld door '%s' 31 | move.config.chat.server.update.named.user=Smart Moving ingesteld op '%s' door '%s' 32 | move.config.chat.server.update.unnamed.user=Smart Moving server-configuratie is geupdate door '%s' 33 | move.config.chat.server.enable.user=Smart Moving ingeschakeld door '%s' 34 | 35 | # Used when a player with no rights tries to change the Smart Moving configuration 36 | move.config.chat.server.illegal.remote=Je hebt geen toestemming in de Smart Moving configuratie op de remote-server aan te passen. 37 | move.config.chat.server.illegal.local=Je hebt geen toestemming in de Smart Moving configuratie op de locale server aan te passen. 38 | 39 | # Used when a player changes the Smart Moving configuration for himself alone 40 | move.config.chat.client.disabled=Smart Moving uitgeschakeld 41 | move.config.chat.client.enabled=Smart Moving ingeschakeld 42 | move.config.chat.client.unnamed=Smart Moving ingesteld op de knop '%s' 43 | move.config.chat.client.named=Smart Moving veranderd naar '%s' 44 | move.config.chat.client.help=(pas aan d.m.v. '%s') 45 | 46 | # Used when a player changes the Smart Moving configuration for everybody 47 | move.config.chat.client.everyone.disabled=Smart Moving uitgeschakeld voor alle spelers 48 | move.config.chat.client.everyone.enabled=Smart Moving ingeschakeld voor alle spelers 49 | move.config.chat.client.everyone.unnamed=Smart Moving veranderd naar de knop '%s' voor alle spelers 50 | move.config.chat.client.everyone.named=Smart Moving veranderd naar '%s' voor alle spelers 51 | 52 | 53 | 54 | #============================# 55 | # Speed change chat messages # 56 | #============================# 57 | 58 | # Used when the Smart Moving speed is changed by another player 59 | move.speed.chat.server.change=Smart Moving snelheid veranderd naar %s%% door '%s' 60 | move.speed.chat.server.reset=Smart Moving snelheid veranderd naar 100%% door '%s' 61 | 62 | # Used when a player with no rights tries to change the Smart Moving speed 63 | move.speed.chat.server.illegal.remote=Je hebt geen toestemming om de Smart Moving snelheid op de remote server aan te passen. 64 | move.speed.chat.server.illegal.local=Je hebt geen toestemming om de Smart Moving snelheid op de locale server aan te passen. 65 | 66 | # Used when a player changes the Smart Moving speed for himself alone 67 | move.speed.chat.client.init=Smart Moving snelheid is %s%% 68 | move.speed.chat.client.help=(verhoog de snelheid met '%s', verminder de snelheid met '%s') 69 | move.speed.chat.client.change=Smart Moving snelheid veranderd naar %s%% 70 | move.speed.chat.client.reset=Smart Moving veranderd naar 100%% 71 | 72 | # Used when a player changes the Smart Moving speed for everybody 73 | move.speed.chat.client.everyone.change=Smart Moving snelheid veranderd naar %s%% voor alle spelers 74 | move.speed.chat.client.everyone.reset=Smart Moving snelheid veranderd naar 100%% voor alle spelers -------------------------------------------------------------------------------- /src/main/resources/assets/smartmoving/lang/ru_ru.lang: -------------------------------------------------------------------------------- 1 | # Translated by _DarKShaM_ 2 | 3 | #===========# 4 | # Key Names # 5 | #===========# 6 | 7 | key.climb=Захват 8 | key.config.toggle=Изменение Конфигурации 9 | key.speed.increase=Увеличение Скорости 10 | key.speed.decrease=Снижение Скорости 11 | 12 | #====================================# 13 | # Configuration change chat messages # 14 | #====================================# 15 | 16 | # Используется, для объявления, какая конфигурация используется - серверная или локальная 17 | move.config.chat.server.global.unnamed=Используется серверная конфигурация Smart Moving 18 | move.config.chat.server.global.named=Используется серверная конфигурация Smart Moving '%s' 19 | move.config.chat.server.local=Используется локальная конфигурация Smart Moving 20 | 21 | # Используется, когда конфигурацию Smart Moving будет изменена сервером 22 | move.config.chat.server.disable=Smart Moving отключен настройками сервера 23 | move.config.chat.server.update.named=Конфигурация сервера Smart Moving установлена на '%s' 24 | move.config.chat.server.update.unnamed=Конфигурация сервера Smart Moving обновлена 25 | move.config.chat.server.enable=Smart Moving включен настройками сервера 26 | 27 | # Используется, когда конфигурацию Smart Moving будет изменена игроком 28 | move.config.chat.server.disable.user=Smart Moving отключен пользователем '%s' 29 | move.config.chat.server.update.named.user=Конфигурация сервера Smart Moving установлена с '%s' на '%s' 30 | move.config.chat.server.update.unnamed.user=Конфигурация сервера Smart Moving была обновлена пользователем '%s' 31 | move.config.chat.server.enable.user=Smart Moving включен пользователем '%s' 32 | 33 | # Используется, когда игрок, не обладающий необходимыми правами, пытается изменить конфигурацию Smart Moving 34 | move.config.chat.server.illegal.remote=У вас нет прав для изменения конфигурации Smart Moving на удаленном сервере. 35 | move.config.chat.server.illegal.local=У вас нет прав для изменения конфигурации Smart Moving на локальном сервере. 36 | 37 | # Используется, когда игрок меняет конфигурацию Smart Moving только для себя 38 | move.config.chat.client.disabled=Smart Moving отключен 39 | move.config.chat.client.enabled=Smart Moving включен 40 | move.config.chat.client.unnamed=Smart Moving установлен на конфигурацию '%s' 41 | move.config.chat.client.named=Smart Moving установлен на '%s' 42 | move.config.chat.client.help=(переключать при помощи '%s') 43 | 44 | # Используется, когда игрок меняет конфигурацию Smart Moving для всех 45 | move.config.chat.client.everyone.disabled=Smart Moving отключен для всех игроков 46 | move.config.chat.client.everyone.enabled=Smart Moving включен для всех игроков 47 | move.config.chat.client.everyone.unnamed=Smart Moving установлен на конфигурацию '%s' для всех игроков 48 | move.config.chat.client.everyone.named=Smart Moving установлен на '%s' для всех игроков 49 | 50 | 51 | 52 | #============================# 53 | # Speed change chat messages # 54 | #============================# 55 | 56 | # Используется, когда скорость движения для Smart Moving изменяется другим игроком 57 | move.speed.chat.server.change=Скорость движения для Smart Moving установлена на %s%% игроком '%s' 58 | move.speed.chat.server.reset=Скорость движения для Smart Moving установлена на 100%% игроком '%s' 59 | 60 | # Используется, когда игрок, не обладающий необходимыми правами, пытается изменить скорость движения для Smart Moving 61 | move.speed.chat.server.illegal.remote=У вас нет прав для изменения скорости движения Smart Moving на удаленном сервере. 62 | move.speed.chat.server.illegal.local=У вас нет прав для изменения скорости движения Smart Moving на локальном сервере. 63 | 64 | # Используется, когда игрок меняет скорость Smart Moving только для себя 65 | move.speed.chat.client.init=Скорость движения Smart Moving %s%% 66 | move.speed.chat.client.help=(Что бы увеличить скорость, нажмите '%s', для уменьшения - '%s') 67 | move.speed.chat.client.change=Скорость движения Smart Moving установлена на %s%% 68 | move.speed.chat.client.reset=Скорость движения Smart Moving установлена на 100%% 69 | 70 | # Используется, когда игрок меняет скорость Smart Moving для всех 71 | move.speed.chat.client.everyone.change=Скорость движения Smart Moving установлена на %s%% для всех игроков 72 | move.speed.chat.client.everyone.reset=Скорость движения Smart Moving установлена на 100%% для всех игроков -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/model/SRModelCapeRenderer.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.model; 19 | 20 | import org.lwjgl.opengl.GL11; 21 | 22 | import net.minecraft.client.model.ModelBase; 23 | import net.minecraft.client.renderer.GlStateManager; 24 | import net.minecraft.entity.player.EntityPlayer; 25 | import net.minecraft.util.math.MathHelper; 26 | 27 | public class SRModelCapeRenderer extends SRModelSpecialRenderer { 28 | private final SRModelRotationRenderer outer; 29 | private EntityPlayer entityplayer; 30 | private float setFactor; 31 | 32 | public SRModelCapeRenderer(ModelBase modelBase, int i, int j, SRModelRotationRenderer baseRenderer, 33 | SRModelRotationRenderer outerRenderer) { 34 | super(modelBase, i, j, baseRenderer); 35 | outer = outerRenderer; 36 | } 37 | 38 | public void beforeRender(EntityPlayer entityplayer, float factor) { 39 | this.entityplayer = entityplayer; 40 | this.setFactor = factor; 41 | 42 | super.beforeRender(true); 43 | } 44 | 45 | @Override 46 | public void preTransform(float factor, boolean push) { 47 | if (entityplayer.isSneaking()) 48 | GL11.glTranslatef(0.0F, 0.2F, 0.0F); 49 | 50 | super.preTransform(factor, push); 51 | 52 | double d = (entityplayer.prevChasingPosX 53 | + (entityplayer.chasingPosX - entityplayer.prevChasingPosX) * setFactor) 54 | - (entityplayer.prevPosX + (entityplayer.posX - entityplayer.prevPosX) * setFactor); 55 | double d1 = (entityplayer.prevChasingPosY 56 | + (entityplayer.chasingPosY - entityplayer.prevChasingPosY) * setFactor) 57 | - (entityplayer.prevPosY + (entityplayer.posY - entityplayer.prevPosY) * setFactor); 58 | double d2 = (entityplayer.prevChasingPosZ 59 | + (entityplayer.chasingPosZ - entityplayer.prevChasingPosZ) * setFactor) 60 | - (entityplayer.prevPosZ + (entityplayer.posZ - entityplayer.prevPosZ) * setFactor); 61 | float f1 = entityplayer.prevRenderYawOffset 62 | + (entityplayer.renderYawOffset - entityplayer.prevRenderYawOffset) * setFactor; 63 | double d3 = MathHelper.sin((f1 * 3.141593F) / 180F); 64 | double d4 = -MathHelper.cos((f1 * 3.141593F) / 180F); 65 | float f2 = (float) d1 * 10F; 66 | if (f2 < -6F) { 67 | f2 = -6F; 68 | } 69 | if (f2 > 32F) { 70 | f2 = 32F; 71 | } 72 | float f3 = (float) (d * d3 + d2 * d4) * 100F; 73 | float f4 = (float) (d * d4 - d2 * d3) * 100F; 74 | if (f3 < 0.0F) { 75 | f3 = 0.0F; 76 | } 77 | float f5 = entityplayer.prevCameraYaw + (entityplayer.cameraYaw - entityplayer.prevCameraYaw) * setFactor; 78 | f2 += MathHelper.sin((entityplayer.prevDistanceWalkedModified 79 | + (entityplayer.distanceWalkedModified - entityplayer.prevDistanceWalkedModified) * setFactor) * 6F) 80 | * 32F * f5; 81 | 82 | if (entityplayer.isSneaking()) { 83 | GlStateManager.translate(0.0F, 0.009F, 0.044F); 84 | f2 -= 9.24F; 85 | } else 86 | f2 -= 5.62F; 87 | 88 | float localAngle = 6F + f3 / 2.0F + f2; 89 | float localAngleMax = Math.max(70.523F - outer.rotateAngleX * RadiantToAngle, 6F); 90 | float realLocalAngle = Math.min(localAngle, localAngleMax); 91 | 92 | GL11.glRotatef(realLocalAngle, 1.0F, 0.0F, 0.0F); 93 | GL11.glRotatef(f4 / 2.0F, 0.0F, 0.0F, 1.0F); 94 | GL11.glRotatef(-f4 / 2.0F, 0.0F, 1.0F, 0.0F); 95 | GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); 96 | } 97 | 98 | @Override 99 | public boolean canBeRandomBoxSource() { 100 | return false; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/model/SRModelElytra.java: -------------------------------------------------------------------------------- 1 | package net.smart.render.model; 2 | 3 | import net.minecraft.client.entity.AbstractClientPlayer; 4 | import net.minecraft.client.model.ModelBase; 5 | import net.minecraft.client.model.ModelRenderer; 6 | import net.minecraft.client.renderer.GlStateManager; 7 | import net.minecraft.entity.Entity; 8 | import net.minecraft.entity.EntityLivingBase; 9 | import net.minecraft.util.math.Vec3d; 10 | 11 | public class SRModelElytra extends ModelBase { 12 | private final ModelRenderer rightWing; 13 | private final ModelRenderer leftWing = new ModelRenderer(this, 22, 0); 14 | 15 | public SRModelElytra() { 16 | this.leftWing.addBox(-10.0F, 0.0F, 0.0F, 10, 20, 2, 1.0F); 17 | this.rightWing = new ModelRenderer(this, 22, 0); 18 | this.rightWing.mirror = true; 19 | this.rightWing.addBox(0.0F, 0.0F, 0.0F, 10, 20, 2, 1.0F); 20 | } 21 | 22 | /** 23 | * Sets the models various rotation angles then renders the model. 24 | */ 25 | public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, 26 | float headPitch, float scale) { 27 | GlStateManager.disableRescaleNormal(); 28 | GlStateManager.disableCull(); 29 | 30 | if (entityIn instanceof EntityLivingBase && ((EntityLivingBase) entityIn).isChild()) { 31 | GlStateManager.pushMatrix(); 32 | GlStateManager.scale(0.5F, 0.5F, 0.5F); 33 | GlStateManager.translate(0.0F, 1.5F, -0.1F); 34 | this.leftWing.render(scale); 35 | this.rightWing.render(scale); 36 | GlStateManager.popMatrix(); 37 | } else { 38 | this.leftWing.render(scale); 39 | this.rightWing.render(scale); 40 | } 41 | } 42 | 43 | /** 44 | * Sets the model's various rotation angles. For bipeds, par1 and par2 are used 45 | * for animating the movement of arms and legs, where par1 represents the 46 | * time(so that arms and legs swing back and forth) and par2 represents how 47 | * "far" arms and legs can swing at most. 48 | */ 49 | public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, 50 | float headPitch, float scaleFactor, Entity entityIn) { 51 | float f = 0.2617994F; 52 | float f1 = -0.2617994F; 53 | float f2 = 0.0F; 54 | float f3 = 0.0F; 55 | 56 | if (entityIn instanceof EntityLivingBase && ((EntityLivingBase) entityIn).isElytraFlying()) { 57 | float f4 = 1.0F; 58 | 59 | if (entityIn.motionY < 0.0D) { 60 | Vec3d vec3d = (new Vec3d(entityIn.motionX, entityIn.motionY, entityIn.motionZ)).normalize(); 61 | f4 = 1.0F - (float) Math.pow(-vec3d.y, 1.5D); 62 | } 63 | 64 | f = f4 * 0.34906584F + (1.0F - f4) * f; 65 | f1 = f4 * -((float) Math.PI / 2F) + (1.0F - f4) * f1; 66 | } else if (entityIn.isSneaking()) { 67 | f = ((float) Math.PI * 2F / 9F); 68 | f1 = -((float) Math.PI / 4F); 69 | f2 = 3.0F; 70 | f3 = 0.08726646F; 71 | } 72 | 73 | this.leftWing.rotationPointX = 5.0F; 74 | this.leftWing.rotationPointY = f2; 75 | 76 | if (entityIn instanceof AbstractClientPlayer) { 77 | AbstractClientPlayer abstractclientplayer = (AbstractClientPlayer) entityIn; 78 | abstractclientplayer.rotateElytraX = (float) ((double) abstractclientplayer.rotateElytraX 79 | + (double) (f - abstractclientplayer.rotateElytraX) * 0.1D); 80 | abstractclientplayer.rotateElytraY = (float) ((double) abstractclientplayer.rotateElytraY 81 | + (double) (f3 - abstractclientplayer.rotateElytraY) * 0.1D); 82 | abstractclientplayer.rotateElytraZ = (float) ((double) abstractclientplayer.rotateElytraZ 83 | + (double) (f1 - abstractclientplayer.rotateElytraZ) * 0.1D); 84 | this.leftWing.rotateAngleX = abstractclientplayer.rotateElytraX; 85 | this.leftWing.rotateAngleY = abstractclientplayer.rotateElytraY; 86 | this.leftWing.rotateAngleZ = abstractclientplayer.rotateElytraZ; 87 | } else { 88 | this.leftWing.rotateAngleX = f; 89 | this.leftWing.rotateAngleZ = f1; 90 | this.leftWing.rotateAngleY = f3; 91 | } 92 | 93 | this.rightWing.rotationPointX = -this.leftWing.rotationPointX; 94 | this.rightWing.rotateAngleY = -this.leftWing.rotateAngleY; 95 | this.rightWing.rotationPointY = this.leftWing.rotationPointY; 96 | this.rightWing.rotateAngleX = this.leftWing.rotateAngleX; 97 | this.rightWing.rotateAngleZ = -this.leftWing.rotateAngleZ; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/render/SMRenderPlayer.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving.render; 19 | 20 | import net.minecraft.client.entity.AbstractClientPlayer; 21 | import net.minecraft.client.model.ModelBiped; 22 | import net.minecraft.client.renderer.entity.RenderManager; 23 | import net.smart.moving.model.IModelPlayer; 24 | import net.smart.moving.model.SMModelBiped; 25 | import net.smart.moving.model.SMModelPlayer; 26 | import net.smart.render.render.SRRenderPlayer; 27 | 28 | public class SMRenderPlayer extends SRRenderPlayer implements IRenderPlayer { 29 | private IModelPlayer[] allIModelPlayers; 30 | private final SMRender render; 31 | 32 | public SMRenderPlayer(RenderManager renderManager) { 33 | this(renderManager, false); 34 | } 35 | 36 | public SMRenderPlayer(RenderManager renderManager, boolean b) { 37 | super(renderManager, b); 38 | render = new SMRender(this); 39 | } 40 | 41 | @Override 42 | public net.smart.render.model.IModelPlayer createModel(ModelBiped existing, float f, 43 | boolean b) { 44 | if (existing instanceof net.minecraft.client.model.ModelPlayer) 45 | return new SMModelPlayer(existing, f, b); 46 | return new SMModelBiped(existing, f); 47 | } 48 | 49 | @Override 50 | public void doRender(AbstractClientPlayer entityplayer, double d, double d1, double d2, float f, 51 | float renderPartialTicks) { 52 | render.doRender(entityplayer, d, d1, d2, f, renderPartialTicks); 53 | } 54 | 55 | @Override 56 | public void superRenderDoRender(AbstractClientPlayer entityplayer, double d, double d1, double d2, float f, 57 | float renderPartialTicks) { 58 | super.doRender(entityplayer, d, d1, d2, f, renderPartialTicks); 59 | } 60 | 61 | @Override 62 | protected void applyRotations(AbstractClientPlayer entityplayer, float totalTime, float actualRotation, float f2) { 63 | render.rotateCorpse(entityplayer, totalTime, actualRotation, f2); 64 | } 65 | 66 | @Override 67 | public void superRenderRotateCorpse(AbstractClientPlayer entityplayer, float totalTime, float actualRotation, 68 | float f2) { 69 | super.applyRotations(entityplayer, totalTime, actualRotation, f2); 70 | } 71 | 72 | @Override 73 | protected void renderLivingAt(AbstractClientPlayer entityplayer, double d, double d1, double d2) { 74 | render.renderLivingAt(entityplayer, d, d1, d2); 75 | } 76 | 77 | @Override 78 | public void superRenderRenderLivingAt(AbstractClientPlayer entityplayer, double d, double d1, double d2) { 79 | super.renderLivingAt(entityplayer, d, d1, d2); 80 | } 81 | 82 | @Override 83 | public void renderName(AbstractClientPlayer entityplayer, double par2, double par4, double par6) { 84 | render.renderName(entityplayer, par2, par4, par6); 85 | } 86 | 87 | @Override 88 | public void superRenderRenderName(AbstractClientPlayer entityplayer, double par2, double par4, double par6) { 89 | super.renderName(entityplayer, par2, par4, par6); 90 | } 91 | 92 | @Override 93 | public RenderManager getMovingRenderManager() { 94 | return renderManager; 95 | } 96 | 97 | @Override 98 | public IModelPlayer getMovingModelBipedMain() { 99 | return (IModelPlayer) super.getModelBipedMain(); 100 | } 101 | 102 | @Override 103 | public IModelPlayer getMovingModelArmor() { 104 | return (IModelPlayer) super.getModelArmor(); 105 | } 106 | 107 | @Override 108 | public IModelPlayer[] getMovingModels() { 109 | if (allIModelPlayers == null) 110 | allIModelPlayers = new IModelPlayer[] { getMovingModelBipedMain(), getMovingModelArmor() }; 111 | return allIModelPlayers; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMFactory.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import java.util.Hashtable; 21 | import java.util.Iterator; 22 | 23 | import net.minecraft.client.Minecraft; 24 | import net.minecraft.client.entity.EntityOtherPlayerMP; 25 | import net.minecraft.client.entity.EntityPlayerSP; 26 | import net.minecraft.entity.Entity; 27 | import net.minecraft.entity.player.EntityPlayer; 28 | 29 | public class SMFactory { 30 | private static SMFactory factory; 31 | 32 | private Hashtable otherSmartMovings; 33 | 34 | public SMFactory() { 35 | if (factory != null) 36 | throw new RuntimeException("FATAL: Can only create one instance of type 'SmartMovingFactory'"); 37 | factory = this; 38 | } 39 | 40 | protected static boolean isInitialized() { 41 | return factory != null; 42 | } 43 | 44 | public static void initialize() { 45 | if (!isInitialized()) 46 | new SMFactory(); 47 | } 48 | 49 | public static void handleMultiPlayerTick(Minecraft minecraft) { 50 | factory.doHandleMultiPlayerTick(minecraft); 51 | } 52 | 53 | public static SMBase getInstance(EntityPlayer entityPlayer) { 54 | return factory.doGetInstance(entityPlayer); 55 | } 56 | 57 | public static SMBase getOtherSmartMoving(int entityId) { 58 | return factory.doGetOtherSmartMoving(entityId); 59 | } 60 | 61 | public static SMOther getOtherSmartMoving(EntityOtherPlayerMP entity) { 62 | return factory.doGetOtherSmartMoving(entity); 63 | } 64 | 65 | protected void doHandleMultiPlayerTick(Minecraft minecraft) { 66 | Iterator others = minecraft.world.playerEntities.iterator(); 67 | while (others.hasNext()) { 68 | Entity player = (Entity) others.next(); 69 | if (player instanceof EntityOtherPlayerMP) { 70 | EntityOtherPlayerMP otherPlayer = (EntityOtherPlayerMP) player; 71 | SMOther moving = doGetOtherSmartMoving(otherPlayer); 72 | moving.spawnParticles(minecraft, otherPlayer.posX - otherPlayer.prevPosX, 73 | otherPlayer.posZ - otherPlayer.prevPosZ); 74 | moving.foundAlive = true; 75 | } 76 | } 77 | 78 | if (otherSmartMovings == null || otherSmartMovings.isEmpty()) 79 | return; 80 | 81 | Iterator entityIds = otherSmartMovings.keySet().iterator(); 82 | while (entityIds.hasNext()) { 83 | Integer entityId = entityIds.next(); 84 | SMOther moving = otherSmartMovings.get(entityId); 85 | if (moving.foundAlive) 86 | moving.foundAlive = false; 87 | else 88 | entityIds.remove(); 89 | } 90 | } 91 | 92 | protected SMBase doGetInstance(EntityPlayer entityPlayer) { 93 | if (entityPlayer instanceof EntityOtherPlayerMP) 94 | return doGetOtherSmartMoving(entityPlayer.getEntityId()); 95 | else if (entityPlayer instanceof IEntityPlayerSP) 96 | return ((IEntityPlayerSP) entityPlayer).getMoving(); 97 | if (entityPlayer instanceof EntityPlayerSP) 98 | return SMPlayerBase.getPlayerBase((EntityPlayerSP) entityPlayer).getMoving(); 99 | return null; 100 | } 101 | 102 | protected SMBase doGetOtherSmartMoving(int entityId) { 103 | SMBase moving = tryGetOtherSmartMoving(entityId); 104 | if (moving == null) { 105 | Entity entity = Minecraft.getMinecraft().world.getEntityByID(entityId); 106 | if (entity != null && entity instanceof EntityOtherPlayerMP) 107 | moving = addOtherSmartMoving((EntityOtherPlayerMP) entity); 108 | } 109 | return moving; 110 | } 111 | 112 | protected SMOther doGetOtherSmartMoving(EntityOtherPlayerMP entity) { 113 | SMOther moving = tryGetOtherSmartMoving(entity.getEntityId()); 114 | if (moving == null) 115 | moving = addOtherSmartMoving(entity); 116 | return moving; 117 | } 118 | 119 | protected final SMOther tryGetOtherSmartMoving(int entityId) { 120 | if (otherSmartMovings == null) 121 | otherSmartMovings = new Hashtable(); 122 | return otherSmartMovings.get(entityId); 123 | } 124 | 125 | protected final SMOther addOtherSmartMoving(EntityOtherPlayerMP entity) { 126 | SMOther moving = new SMOther(entity); 127 | otherSmartMovings.put(entity.getEntityId(), moving); 128 | return moving; 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/model/IModelPlayer.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.model; 19 | 20 | import net.minecraft.client.model.ModelRenderer; 21 | import net.minecraft.entity.Entity; 22 | 23 | public interface IModelPlayer { 24 | SRModel getRenderModel(); 25 | 26 | void initialize(SRModelRotationRenderer bipedBody, SRModelRotationRenderer bipedBodywear, 27 | SRModelRotationRenderer bipedHead, SRModelRotationRenderer bipedHeadwear, 28 | SRModelRotationRenderer bipedRightArm, SRModelRotationRenderer bipedRightArmwear, 29 | SRModelRotationRenderer bipedLeftArm, SRModelRotationRenderer bipedLeftArmwear, 30 | SRModelRotationRenderer bipedRightLeg, SRModelRotationRenderer bipedRightLegwear, 31 | SRModelRotationRenderer bipedLeftLeg, SRModelRotationRenderer bipedLeftLegwear, 32 | SRModelCapeRenderer bipedCloak, SRModelEarsRenderer bipedEars); 33 | 34 | void superRender(Entity entity, float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 35 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 36 | 37 | void superSetRotationAngles(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 38 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor, Entity entity); 39 | 40 | void superRenderCloak(float f); 41 | 42 | ModelRenderer getOuter(); 43 | 44 | ModelRenderer getTorso(); 45 | 46 | ModelRenderer getBody(); 47 | 48 | ModelRenderer getBreast(); 49 | 50 | ModelRenderer getNeck(); 51 | 52 | ModelRenderer getHead(); 53 | 54 | ModelRenderer getHeadwear(); 55 | 56 | ModelRenderer getRightShoulder(); 57 | 58 | ModelRenderer getRightArm(); 59 | 60 | ModelRenderer getLeftShoulder(); 61 | 62 | ModelRenderer getLeftArm(); 63 | 64 | ModelRenderer getPelvic(); 65 | 66 | ModelRenderer getRightLeg(); 67 | 68 | ModelRenderer getLeftLeg(); 69 | 70 | ModelRenderer getEars(); 71 | 72 | ModelRenderer getCloak(); 73 | 74 | void animateHeadRotation(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 75 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 76 | 77 | void animateSleeping(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 78 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 79 | 80 | void animateArmSwinging(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 81 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 82 | 83 | void animateRiding(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 84 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 85 | 86 | void animateLeftArmItemHolding(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 87 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 88 | 89 | void animateRightArmItemHolding(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 90 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 91 | 92 | void animateWorkingBody(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 93 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 94 | 95 | void animateWorkingArms(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 96 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 97 | 98 | void animateSneaking(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 99 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 100 | 101 | void animateArms(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 102 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 103 | 104 | void animateBowAiming(float totalHorizontalDistance, float currentHorizontalSpeed, float totalTime, 105 | float viewHorizontalAngelOffset, float viewVerticalAngelOffset, float factor); 106 | } 107 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/statistics/SmartStatisticsFactory.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.statistics; 19 | 20 | import java.util.Hashtable; 21 | import java.util.Iterator; 22 | 23 | import net.minecraft.client.Minecraft; 24 | import net.minecraft.client.entity.EntityOtherPlayerMP; 25 | import net.minecraft.entity.Entity; 26 | import net.minecraft.entity.player.EntityPlayer; 27 | 28 | public class SmartStatisticsFactory { 29 | private static SmartStatisticsFactory factory; 30 | 31 | private Hashtable otherStatistics; 32 | 33 | public SmartStatisticsFactory() { 34 | if (factory != null) 35 | throw new RuntimeException("FATAL: Can only create one instance of type 'StatisticsFactory'"); 36 | factory = this; 37 | } 38 | 39 | protected static boolean isInitialized() { 40 | return factory != null; 41 | } 42 | 43 | public static void initialize() { 44 | if (!isInitialized()) 45 | new SmartStatisticsFactory(); 46 | } 47 | 48 | public static void handleMultiPlayerTick(Minecraft minecraft) { 49 | factory.doHandleMultiPlayerTick(minecraft); 50 | } 51 | 52 | public static SmartStatistics getInstance(EntityPlayer entityPlayer) { 53 | return factory.doGetInstance(entityPlayer); 54 | } 55 | 56 | public static SmartStatisticsOther getOtherStatistics(int entityId) { 57 | return factory.doGetOtherStatistics(entityId); 58 | } 59 | 60 | public static SmartStatisticsOther getOtherStatistics(EntityOtherPlayerMP entity) { 61 | return factory.doGetOtherStatistics(entity); 62 | } 63 | 64 | protected void doHandleMultiPlayerTick(Minecraft minecraft) { 65 | Iterator others = minecraft.world.playerEntities.iterator(); 66 | while (others.hasNext()) { 67 | Entity player = (Entity) others.next(); 68 | if (player instanceof EntityOtherPlayerMP) { 69 | EntityOtherPlayerMP otherPlayer = (EntityOtherPlayerMP) player; 70 | SmartStatisticsOther statistics = doGetOtherStatistics(otherPlayer); 71 | statistics.calculateAllStats(true); 72 | statistics.foundAlive = true; 73 | } 74 | } 75 | 76 | if (otherStatistics == null || otherStatistics.isEmpty()) 77 | return; 78 | 79 | Iterator entityIds = otherStatistics.keySet().iterator(); 80 | while (entityIds.hasNext()) { 81 | Integer entityId = entityIds.next(); 82 | SmartStatisticsOther statistics = otherStatistics.get(entityId); 83 | if (statistics.foundAlive) 84 | statistics.foundAlive = false; 85 | else 86 | entityIds.remove(); 87 | } 88 | } 89 | 90 | protected SmartStatistics doGetInstance(EntityPlayer entityPlayer) { 91 | if (entityPlayer instanceof EntityOtherPlayerMP) 92 | return doGetOtherStatistics(entityPlayer.getEntityId()); 93 | else if (entityPlayer instanceof IEntityPlayerSP) 94 | return ((IEntityPlayerSP) entityPlayer).getStatistics(); 95 | return null; 96 | } 97 | 98 | protected SmartStatisticsOther doGetOtherStatistics(int entityId) { 99 | SmartStatisticsOther statistics = tryGetOtherStatistics(entityId); 100 | if (statistics == null) { 101 | Entity entity = Minecraft.getMinecraft().world.getEntityByID(entityId); 102 | if (entity != null && entity instanceof EntityOtherPlayerMP) 103 | statistics = addOtherStatistics((EntityOtherPlayerMP) entity); 104 | } 105 | return statistics; 106 | } 107 | 108 | protected SmartStatisticsOther doGetOtherStatistics(EntityOtherPlayerMP entity) { 109 | SmartStatisticsOther statistics = tryGetOtherStatistics(entity.getEntityId()); 110 | if (statistics == null) 111 | statistics = addOtherStatistics(entity); 112 | return statistics; 113 | } 114 | 115 | protected final SmartStatisticsOther tryGetOtherStatistics(int entityId) { 116 | if (otherStatistics == null) 117 | otherStatistics = new Hashtable(); 118 | return otherStatistics.get(entityId); 119 | } 120 | 121 | protected final SmartStatisticsOther addOtherStatistics(EntityOtherPlayerMP entity) { 122 | SmartStatisticsOther statistics = new SmartStatisticsOther(entity); 123 | otherStatistics.put(entity.getEntityId(), statistics); 124 | return statistics; 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/config/SMProperties.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving.config; 19 | 20 | import java.io.File; 21 | import java.io.FileOutputStream; 22 | import java.io.PrintWriter; 23 | import java.util.Iterator; 24 | import java.util.List; 25 | 26 | import net.smart.properties.Properties; 27 | import net.smart.properties.Property; 28 | 29 | public abstract class SMProperties extends Properties { 30 | public final static String Enabled = "enabled"; 31 | public final static String Disabled = "disabled"; 32 | private final static String[] _defaultKeys = new String[1]; 33 | 34 | private int toggler = -2; 35 | private String[] keys = _defaultKeys; 36 | 37 | public boolean enabled; 38 | 39 | protected void load(Properties... propertiesList) throws Exception { 40 | List> propertiesToLoad = getProperties(); 41 | if (toggler != -2) { 42 | Iterator> iterator = propertiesToLoad.iterator(); 43 | while (iterator.hasNext()) 44 | iterator.next().reset(); 45 | } 46 | 47 | while (propertiesToLoad.size() > 0) { 48 | Iterator> iterator = propertiesToLoad.iterator(); 49 | while (iterator.hasNext()) 50 | if (iterator.next().load(propertiesList)) 51 | iterator.remove(); 52 | } 53 | 54 | toggler = 0; 55 | update(); 56 | } 57 | 58 | protected void save(File file, String version, boolean header, boolean comments) throws Exception { 59 | List> propertiesToSave = getProperties(); 60 | 61 | FileOutputStream stream = new FileOutputStream(file); 62 | PrintWriter printer = new PrintWriter(stream); 63 | 64 | if (header) 65 | printHeader(printer); 66 | 67 | if (version != null) 68 | printVersion(printer, version, comments); 69 | 70 | for (int i = 0; i < propertiesToSave.size(); i++) 71 | if (propertiesToSave.get(i).print(printer, keys, version, comments) && i < propertiesToSave.size() - 1) 72 | printer.println(); 73 | 74 | printer.close(); 75 | } 76 | 77 | protected abstract void printVersion(PrintWriter printer, String version, boolean comments); 78 | 79 | protected abstract void printHeader(PrintWriter printer); 80 | 81 | public void toggle() { 82 | int length = keys == null ? 0 : keys.length; 83 | toggler++; 84 | if (toggler == length) 85 | toggler = -1; 86 | update(); 87 | } 88 | 89 | public void setKeys(String[] keys) { 90 | if (keys == null || keys.length == 0) 91 | keys = _defaultKeys; 92 | this.keys = keys; 93 | toggler = 0; 94 | update(); 95 | } 96 | 97 | public String getKey(int index) { 98 | if (keys[index] == null) 99 | return Enabled; 100 | return keys[index]; 101 | } 102 | 103 | public String getNextKey(String key) { 104 | if (key == null || key.equals("disabled")) 105 | return getKey(0); 106 | int index; 107 | for (index = 0; index < keys.length; index++) 108 | if (key.equals(keys[index])) 109 | break; 110 | index++; 111 | if (index < keys.length) 112 | return keys[index]; 113 | return Disabled; 114 | } 115 | 116 | public void setCurrentKey(String key) { 117 | if (key == null || key.equals(Disabled)) 118 | toggler = -1; 119 | else if (keys.length == 1 && keys[0] == null && key.equals(Enabled)) 120 | toggler = 0; 121 | else { 122 | for (toggler = 0; toggler < keys.length; toggler++) 123 | if (key.equals(keys[toggler])) 124 | break; 125 | 126 | if (toggler == keys.length) 127 | toggler = -1; 128 | } 129 | update(); 130 | } 131 | 132 | public String getCurrentKey() { 133 | if (toggler == -1) 134 | return Disabled; 135 | return keys[toggler]; 136 | } 137 | 138 | public boolean hasKey(String key) { 139 | if (Enabled.equals(key)) 140 | return keys[0] == null; 141 | if (Disabled.equals(key)) 142 | return true; 143 | 144 | for (int i = 0; i < keys.length; i++) 145 | if (key == null && keys[i] == null || key != null && key.equals(keys[i])) 146 | return true; 147 | return false; 148 | } 149 | 150 | public int getKeyCount() { 151 | return keys.length; 152 | } 153 | 154 | protected void update() { 155 | List> properties = getProperties(); 156 | Iterator> iterator = properties.iterator(); 157 | 158 | String currentKey = getCurrentKey(); 159 | while (iterator.hasNext()) 160 | iterator.next().update(currentKey); 161 | enabled = toggler != -1; 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/render/SMRenderPlayerBase.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving.render; 19 | 20 | import java.lang.reflect.Field; 21 | 22 | import api.player.model.IModelPlayerAPI; 23 | import api.player.render.RenderPlayerAPI; 24 | import api.player.render.RenderPlayerBase; 25 | import net.minecraft.client.entity.AbstractClientPlayer; 26 | import net.minecraft.client.model.ModelBiped; 27 | import net.minecraft.client.renderer.entity.RenderManager; 28 | import net.minecraft.client.renderer.entity.layers.LayerArmorBase; 29 | import net.smart.moving.SMInfo; 30 | import net.smart.moving.model.IModelPlayer; 31 | import net.smart.moving.model.SMModelPlayerBase; 32 | import net.smart.render.SRInstall; 33 | import net.smart.utilities.Reflect; 34 | 35 | public class SMRenderPlayerBase extends RenderPlayerBase implements IRenderPlayer { 36 | private net.minecraft.client.model.ModelBiped[] allModelPlayers; 37 | private IModelPlayer[] allIModelPlayers; 38 | 39 | private SMRender render; 40 | 41 | private final static Field _modelArmor = Reflect.GetField(LayerArmorBase.class, 42 | SRInstall.LayerArmorBase_modelArmor); 43 | 44 | public SMRenderPlayerBase(RenderPlayerAPI renderPlayerAPI) { 45 | super(renderPlayerAPI); 46 | } 47 | 48 | public SMRender getRenderModel() { 49 | if (render == null) 50 | render = new SMRender(this); 51 | return render; 52 | } 53 | 54 | @Override 55 | public void doRender(AbstractClientPlayer entityplayer, double d, double d1, double d2, float f, 56 | float renderPartialTicks) { 57 | getRenderModel().doRender(entityplayer, d, d1, d2, f, renderPartialTicks); 58 | } 59 | 60 | @Override 61 | public void superRenderDoRender(AbstractClientPlayer entityplayer, double d, double d1, double d2, float f, 62 | float renderPartialTicks) { 63 | super.doRender(entityplayer, d, d1, d2, f, renderPartialTicks); 64 | } 65 | 66 | @Override 67 | public void rotateCorpse(AbstractClientPlayer entityplayer, float totalTime, float actualRotation, float f2) { 68 | getRenderModel().rotateCorpse(entityplayer, totalTime, actualRotation, f2); 69 | } 70 | 71 | @Override 72 | public void superRenderRotateCorpse(AbstractClientPlayer entityplayer, float totalTime, float actualRotation, 73 | float f2) { 74 | super.rotateCorpse(entityplayer, totalTime, actualRotation, f2); 75 | } 76 | 77 | @Override 78 | public void renderLivingAt(AbstractClientPlayer entityplayer, double d, double d1, double d2) { 79 | getRenderModel().renderLivingAt(entityplayer, d, d1, d2); 80 | } 81 | 82 | @Override 83 | public void superRenderRenderLivingAt(AbstractClientPlayer entityplayer, double d, double d1, double d2) { 84 | super.renderLivingAt(entityplayer, d, d1, d2); 85 | } 86 | 87 | @Override 88 | public void renderName(AbstractClientPlayer entityplayer, double d, double d1, double d2) { 89 | getRenderModel().renderName(entityplayer, d, d1, d2); 90 | } 91 | 92 | @Override 93 | public void superRenderRenderName(AbstractClientPlayer entityplayer, double d, double d1, double d2) { 94 | super.renderName(entityplayer, d, d1, d2); 95 | } 96 | 97 | @Override 98 | public RenderManager getMovingRenderManager() { 99 | return renderPlayerAPI.getRenderManagerField(); 100 | } 101 | 102 | public boolean isRenderedWithBodyTopAlwaysInAccelerateDirection() { 103 | SMRender render = getRenderModel(); 104 | return render.modelBipedMain.isFlying || render.modelBipedMain.isSwim || render.modelBipedMain.isDive 105 | || render.modelBipedMain.isHeadJump; 106 | } 107 | 108 | @Override 109 | public IModelPlayer getMovingModelArmor() { 110 | return getPlayerBase(renderPlayer.getMainModel()); 111 | } 112 | 113 | @Override 114 | public IModelPlayer getMovingModelBipedMain() { 115 | for (Object layer : renderPlayerAPI.getLayerRenderersField()) 116 | if (layer instanceof LayerArmorBase) 117 | return getPlayerBase((ModelBiped) Reflect.GetField(_modelArmor, layer)); 118 | return null; 119 | } 120 | 121 | @Override 122 | public IModelPlayer[] getMovingModels() { 123 | net.minecraft.client.model.ModelBiped[] modelPlayers = api.player.model.ModelPlayerAPI.getAllInstances(); 124 | if (allModelPlayers != null 125 | && (allModelPlayers == modelPlayers || modelPlayers.length == 0 && allModelPlayers.length == 0)) 126 | return allIModelPlayers; 127 | 128 | allModelPlayers = modelPlayers; 129 | allIModelPlayers = new IModelPlayer[modelPlayers.length]; 130 | for (int i = 0; i < allIModelPlayers.length; i++) 131 | allIModelPlayers[i] = getPlayerBase(allModelPlayers[i]); 132 | return allIModelPlayers; 133 | } 134 | 135 | private static SMModelPlayerBase getPlayerBase(ModelBiped modelPlayer) { 136 | return (SMModelPlayerBase) ((IModelPlayerAPI) modelPlayer).getModelPlayerBase(SMInfo.ModName); 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /SmartRender/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMPacketHandler.java: -------------------------------------------------------------------------------- 1 | package net.smart.moving; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | import net.minecraftforge.fml.common.network.NetworkRegistry; 7 | import net.minecraftforge.fml.common.network.simpleimpl.IMessage; 8 | import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; 9 | import net.minecraftforge.fml.relauncher.Side; 10 | import net.smart.moving.packet.ConfigChangePacket; 11 | import net.smart.moving.packet.ConfigContentPacket; 12 | import net.smart.moving.packet.ConfigInfoPacket; 13 | import net.smart.moving.packet.HungerChangePacket; 14 | import net.smart.moving.packet.SoundPacket; 15 | import net.smart.moving.packet.SpeedChangePacket; 16 | import net.smart.moving.packet.StatePacket; 17 | 18 | public class SMPacketHandler { 19 | 20 | public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(SMInfo.ModComId); 21 | 22 | public static void registerPackets() { 23 | INSTANCE.registerMessage(StatePacket.ClientHandler.class, StatePacket.class, StatePacket.PacketId, Side.CLIENT); 24 | INSTANCE.registerMessage(StatePacket.ServerHandler.class, StatePacket.class, StatePacket.PacketId, Side.SERVER); 25 | INSTANCE.registerMessage(ConfigInfoPacket.ClientHandler.class, ConfigInfoPacket.class, ConfigInfoPacket.PacketId, Side.CLIENT); 26 | INSTANCE.registerMessage(ConfigInfoPacket.ServerHandler.class, ConfigInfoPacket.class, ConfigInfoPacket.PacketId, Side.SERVER); 27 | INSTANCE.registerMessage(ConfigContentPacket.ClientHandler.class, ConfigContentPacket.class, ConfigContentPacket.PacketId, Side.CLIENT); 28 | INSTANCE.registerMessage(ConfigContentPacket.ServerHandler.class, ConfigContentPacket.class, ConfigContentPacket.PacketId, Side.SERVER); 29 | INSTANCE.registerMessage(ConfigChangePacket.ClientHandler.class, ConfigChangePacket.class, ConfigChangePacket.PacketId, Side.CLIENT); 30 | INSTANCE.registerMessage(ConfigChangePacket.ServerHandler.class, ConfigChangePacket.class, ConfigChangePacket.PacketId, Side.SERVER); 31 | INSTANCE.registerMessage(SpeedChangePacket.ClientHandler.class, SpeedChangePacket.class, SpeedChangePacket.PacketId, Side.CLIENT); 32 | INSTANCE.registerMessage(SpeedChangePacket.ServerHandler.class, SpeedChangePacket.class, SpeedChangePacket.PacketId, Side.SERVER); 33 | INSTANCE.registerMessage(HungerChangePacket.ClientHandler.class, HungerChangePacket.class, HungerChangePacket.PacketId, Side.CLIENT); 34 | INSTANCE.registerMessage(HungerChangePacket.ServerHandler.class, HungerChangePacket.class, HungerChangePacket.PacketId, Side.SERVER); 35 | INSTANCE.registerMessage(SoundPacket.ClientHandler.class, SoundPacket.class, SoundPacket.PacketId, Side.CLIENT); 36 | INSTANCE.registerMessage(SoundPacket.ServerHandler.class, SoundPacket.class, SoundPacket.PacketId, Side.SERVER); 37 | } 38 | 39 | public static final Set errors = new HashSet(); 40 | 41 | public static void receivePacket(IMessage message, IPacketReceiver comm, IEntityPlayerMP player) { 42 | try { 43 | if (message instanceof StatePacket) { 44 | int entityId = ((StatePacket) message).entityId; 45 | long state = ((StatePacket) message).state; 46 | comm.processStatePacket(message, player, entityId, state); 47 | } else if (message instanceof ConfigInfoPacket) { 48 | String info = ((ConfigInfoPacket) message).info; 49 | comm.processConfigInfoPacket(message, player, info); 50 | } else if (message instanceof ConfigContentPacket) { 51 | String username = ((ConfigContentPacket) message).username; 52 | String[] content = ((ConfigContentPacket) message).content; 53 | comm.processConfigContentPacket(message, player, content, username); 54 | } else if (message instanceof ConfigChangePacket) { 55 | comm.processConfigChangePacket(message, player); 56 | } else if (message instanceof SpeedChangePacket) { 57 | int difference = ((SpeedChangePacket) message).difference; 58 | String username = ((SpeedChangePacket) message).username; 59 | comm.processSpeedChangePacket(message, player, difference, username); 60 | } else if (message instanceof HungerChangePacket) { 61 | float hunger = ((HungerChangePacket) message).hunger; 62 | comm.processHungerChangePacket(message, player, hunger); 63 | } else if (message instanceof SoundPacket) { 64 | String soundId = ((SoundPacket) message).soundId; 65 | float volume = ((SoundPacket) message).volume; 66 | float pitch = ((SoundPacket) message).pitch; 67 | comm.processSoundPacket(message, player, soundId, volume, pitch); 68 | } 69 | } catch (Throwable t) { 70 | if (errors.add(t.getStackTrace()[0])) 71 | t.printStackTrace(); 72 | else 73 | System.err.println(t.getClass().getName() + ": " + t.getMessage()); 74 | } 75 | } 76 | 77 | public static void sendState(IPacketSender comm, int entityId, long state) { 78 | comm.sendPacket(new StatePacket(entityId, state)); 79 | } 80 | 81 | public static void sendConfigInfo(IPacketSender comm, String info) { 82 | comm.sendPacket(new ConfigInfoPacket(info)); 83 | } 84 | 85 | public static void sendConfigContent(IPacketSender comm, String[] content, String username) { 86 | comm.sendPacket(new ConfigContentPacket(username, content)); 87 | } 88 | 89 | public static void sendConfigChange(IPacketSender comm) { 90 | comm.sendPacket(new ConfigChangePacket()); 91 | } 92 | 93 | public static void sendSpeedChange(IPacketSender comm, int difference, String username) { 94 | comm.sendPacket(new SpeedChangePacket(difference, username)); 95 | } 96 | 97 | public static void sendHungerChange(IPacketSender comm, float hunger) { 98 | comm.sendPacket(new HungerChangePacket(hunger)); 99 | } 100 | 101 | public static void sendSound(IPacketSender comm, String soundId, float volume, float pitch) { 102 | comm.sendPacket(new SoundPacket(soundId, volume, pitch)); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /SmartRender/src/main/java/net/smart/render/render/SRRenderPlayer.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Render. 3 | // 4 | // Smart Render is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Render is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Render. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.render.render; 19 | 20 | import java.lang.reflect.Field; 21 | 22 | import net.minecraft.client.entity.AbstractClientPlayer; 23 | import net.minecraft.client.model.ModelBiped; 24 | import net.minecraft.client.model.ModelPlayer; 25 | import net.minecraft.client.renderer.entity.RenderManager; 26 | import net.minecraft.client.renderer.entity.RenderPlayer; 27 | import net.minecraft.client.renderer.entity.layers.LayerArmorBase; 28 | import net.minecraft.client.renderer.entity.layers.LayerCustomHead; 29 | import net.smart.render.SRInstall; 30 | import net.smart.render.model.IModelPlayer; 31 | import net.smart.render.model.SRModelBiped; 32 | import net.smart.render.model.SRModelPlayer; 33 | import net.smart.utilities.Reflect; 34 | 35 | public class SRRenderPlayer extends RenderPlayer implements IRenderPlayer { 36 | private IModelPlayer[] allIModelPlayers; 37 | 38 | private final SRRenderer render; 39 | 40 | private final static Field _modelArmor = Reflect.GetField(LayerArmorBase.class, 41 | SRInstall.LayerArmorBase_modelArmor); 42 | private final static Field _playerHead = Reflect.GetField(LayerCustomHead.class, 43 | SRInstall.LayerCustomHead_playerHead); 44 | 45 | public SRRenderPlayer(RenderManager renderManager) { 46 | this(renderManager, false); 47 | } 48 | 49 | public SRRenderPlayer(RenderManager renderManager, boolean b) { 50 | super(renderManager, b); 51 | render = new SRRenderer(this); 52 | } 53 | 54 | @Override 55 | public IModelPlayer createModel(ModelBiped existing, float f, boolean b) { 56 | if (existing instanceof ModelPlayer) 57 | return new SRModelPlayer(existing, f, b); 58 | return new SRModelBiped(existing, f); 59 | } 60 | 61 | @Override 62 | public boolean getSmallArms() { 63 | return (Boolean) Reflect.GetField(RenderPlayer.class, this, SRInstall.RenderPlayer_smallArms); 64 | } 65 | 66 | @Override 67 | public void initialize(ModelPlayer modelBipedMain, ModelBiped modelArmor) { 68 | mainModel = modelBipedMain; 69 | 70 | for (Object layer : this.layerRenderers) { 71 | if (layer instanceof LayerArmorBase) 72 | Reflect.SetField(_modelArmor, layer, modelArmor); 73 | if (layer instanceof LayerCustomHead) 74 | Reflect.SetField(_playerHead, layer, modelBipedMain.bipedHead); 75 | } 76 | } 77 | 78 | @Override 79 | public void doRender(AbstractClientPlayer entityplayer, double d, double d1, double d2, float f, 80 | float renderPartialTicks) { 81 | render.doRender(entityplayer, d, d1, d2, f, renderPartialTicks); 82 | } 83 | 84 | @Override 85 | public void superDoRender(AbstractClientPlayer entityplayer, double d, double d1, double d2, float f, 86 | float renderPartialTicks) { 87 | super.doRender(entityplayer, d, d1, d2, f, renderPartialTicks); 88 | } 89 | 90 | @Override 91 | protected void applyRotations(AbstractClientPlayer entityplayer, float totalTime, float actualRotation, float f2) { 92 | render.rotateCorpse(entityplayer, totalTime, actualRotation, f2); 93 | } 94 | 95 | @Override 96 | public void superRotateCorpse(AbstractClientPlayer entityplayer, float totalTime, float actualRotation, float f2) { 97 | super.applyRotations(entityplayer, totalTime, actualRotation, f2); 98 | } 99 | 100 | @Override 101 | protected void renderLayers(AbstractClientPlayer entityPlayer, float f1, float f2, float f3, float f4, float f5, 102 | float f6, float f7) { 103 | render.renderSpecials(entityPlayer, f1, f2, f3, f4, f5, f6, f7); 104 | } 105 | 106 | @Override 107 | public void superRenderSpecials(AbstractClientPlayer entityPlayer, float f1, float f2, float f3, float f4, float f5, 108 | float f6, float f7) { 109 | super.renderLayers(entityPlayer, f1, f2, f3, f4, f5, f6, f7); 110 | } 111 | 112 | @Override 113 | protected float handleRotationFloat(AbstractClientPlayer entityPlayer, float f) { 114 | render.beforeHandleRotationFloat(entityPlayer, f); 115 | float result = super.handleRotationFloat(entityPlayer, f); 116 | render.afterHandleRotationFloat(entityPlayer, f); 117 | return result; 118 | } 119 | 120 | @Override 121 | public RenderManager getRenderRenderManager() { 122 | return renderManager; 123 | } 124 | 125 | @Override 126 | public ModelPlayer getModelBipedMain() { 127 | return this.getMainModel(); 128 | } 129 | 130 | @Override 131 | public ModelBiped getModelArmor() { 132 | for (Object layer : this.layerRenderers) 133 | if (layer instanceof LayerArmorBase) 134 | return (ModelBiped) Reflect.GetField(_modelArmor, layer); 135 | return null; 136 | } 137 | 138 | public IModelPlayer getRenderModelBipedMain() { 139 | return (IModelPlayer) getModelBipedMain(); 140 | } 141 | 142 | public IModelPlayer getRenderModelArmor() { 143 | return (IModelPlayer) getModelArmor(); 144 | } 145 | 146 | @Override 147 | public IModelPlayer[] getRenderModels() { 148 | if (allIModelPlayers == null) 149 | allIModelPlayers = new IModelPlayer[] { getRenderModelBipedMain(), getRenderModelArmor() }; 150 | return allIModelPlayers; 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /src/main/java/net/smart/moving/SMMod.java: -------------------------------------------------------------------------------- 1 | // ================================================================== 2 | // This file is part of Smart Moving. 3 | // 4 | // Smart Moving is free software: you can redistribute it and/or 5 | // modify it under the terms of the GNU General Public License as 6 | // published by the Free Software Foundation, either version 3 of the 7 | // License, or (at your option) any later version. 8 | // 9 | // Smart Moving is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with Smart Moving. If not, see . 16 | // ================================================================== 17 | 18 | package net.smart.moving; 19 | 20 | import java.io.File; 21 | import java.util.List; 22 | 23 | import api.player.model.ModelPlayerAPI; 24 | import api.player.model.ModelPlayerBaseSorting; 25 | import api.player.render.RenderPlayerAPI; 26 | import api.player.render.RenderPlayerBaseSorting; 27 | import net.minecraftforge.common.MinecraftForge; 28 | import net.minecraftforge.fml.common.FMLCommonHandler; 29 | import net.minecraftforge.fml.common.Loader; 30 | import net.minecraftforge.fml.common.Mod; 31 | import net.minecraftforge.fml.common.Mod.EventHandler; 32 | import net.minecraftforge.fml.common.ModContainer; 33 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 34 | import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; 35 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; 36 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 37 | import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; 38 | import net.smart.moving.config.SMConfig; 39 | import net.smart.moving.config.SMOptions; 40 | import net.smart.moving.model.SMModelPlayerBase; 41 | import net.smart.moving.render.SMRenderPlayerBase; 42 | import net.smart.render.SRInfo; 43 | import net.smart.utilities.Reflect; 44 | 45 | @Mod(modid = SMMod.ID, name = SMMod.NAME, version = SMMod.VERSION, useMetadata = true) 46 | public class SMMod { 47 | final static String ID = "smartmoving"; 48 | final static String NAME = "Smart Moving"; 49 | final static String VERSION = "@VERSION@"; 50 | 51 | protected static String ModComVersion = "2.4"; 52 | 53 | private final boolean isClient; 54 | 55 | private boolean hasRenderer = false; 56 | 57 | public SMMod() { 58 | isClient = FMLCommonHandler.instance().getSide().isClient(); 59 | } 60 | 61 | @EventHandler 62 | public void preInit(FMLPreInitializationEvent event) { 63 | if (isClient) 64 | register(); 65 | } 66 | 67 | @EventHandler 68 | public void init(FMLInitializationEvent event) { 69 | SMPacketHandler.registerPackets(); 70 | 71 | if (isClient) { 72 | SMPlayerBase.registerPlayerBase(); 73 | SMServerPlayerBase.registerPlayerBase(); 74 | SMServerComm.localUserNameProvider = new SMLocalUserNameProvider(); 75 | MinecraftForge.EVENT_BUS.register(this); 76 | SMFactory.initialize(); 77 | checkForMods(); 78 | SMContext.initialize(); 79 | } else 80 | SMServer.initialize(new File("."), 81 | FMLCommonHandler.instance().getMinecraftServerInstance().getGameType().getID(), new SMConfig()); 82 | } 83 | 84 | @EventHandler 85 | public void postInit(FMLPostInitializationEvent event) { 86 | if (!isClient) 87 | SMServerPlayerBase.registerPlayerBase(); 88 | } 89 | 90 | @SubscribeEvent 91 | public void tickStart(ClientTickEvent event) { 92 | SMContext.onTickInGame(); 93 | } 94 | 95 | private void register() { 96 | String[] inferiors = new String[] { SRInfo.ModName }; 97 | 98 | RenderPlayerBaseSorting renderSorting = new RenderPlayerBaseSorting(); 99 | renderSorting.setAfterLocalConstructingInferiors(inferiors); 100 | renderSorting.setOverrideDoRenderInferiors(inferiors); 101 | renderSorting.setOverrideRotateCorpseInferiors(inferiors); 102 | renderSorting.setOverrideRenderLivingAtInferiors(inferiors); 103 | RenderPlayerAPI.register(NAME, SMRenderPlayerBase.class, renderSorting); 104 | 105 | ModelPlayerBaseSorting modelSorting = new ModelPlayerBaseSorting(); 106 | modelSorting.setAfterLocalConstructingInferiors(inferiors); 107 | ModelPlayerAPI.register(NAME, SMModelPlayerBase.class, modelSorting); 108 | } 109 | 110 | private void checkForMods() { 111 | List modList = Loader.instance().getActiveModList(); 112 | boolean hasRedPowerWiring = false; 113 | boolean hasBuildCraftTransport = false; 114 | boolean hasFiniteLiquid = false; 115 | boolean hasBetterThanWolves = false; 116 | boolean hasSinglePlayerCommands = false; 117 | boolean hasRopesPlus = false; 118 | boolean hasASGrapplingHook = false; 119 | boolean hasBetterMisc = false; 120 | 121 | for (int i = 0; i < modList.size(); i++) { 122 | ModContainer mod = modList.get(i); 123 | String name = mod.getName(); 124 | 125 | if (name.contains("RedPowerWiring")) 126 | hasRedPowerWiring = true; 127 | else if (name.contains("BuildCraftTransport")) 128 | hasBuildCraftTransport = true; 129 | else if (name.contains("Liquid")) 130 | hasFiniteLiquid = true; 131 | else if (name.contains("FCBetterThanWolves")) 132 | hasBetterThanWolves = true; 133 | else if (name.contains("SinglePlayerCommands")) 134 | hasSinglePlayerCommands = true; 135 | else if (name.contains("ASGrapplingHook")) 136 | hasASGrapplingHook = true; 137 | else if (name.contains("BetterMisc")) 138 | hasBetterMisc = true; 139 | } 140 | 141 | hasRopesPlus = Reflect.CheckClasses(SMMod.class, SMInstall.RopesPlusCore); 142 | 143 | SMOptions.initialize(hasRedPowerWiring, hasBuildCraftTransport, hasFiniteLiquid, hasBetterThanWolves, 144 | hasSinglePlayerCommands, hasRopesPlus, hasASGrapplingHook, hasBetterMisc); 145 | } 146 | } 147 | --------------------------------------------------------------------------------