diff --git a/dependencies.gradle b/dependencies.gradle index df8a1672b4..ed979a8e43 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,15 +1,15 @@ // Add your dependencies here dependencies { - compileOnlyApi('com.github.GTNewHorizons:Angelica:2.1.29:api') + compileOnlyApi('com.github.GTNewHorizons:Angelica:2.1.32:api') api("com.github.GTNewHorizons:Mantle:0.5.2:dev") api("com.github.GTNewHorizons:ForgeMultipart:1.7.10:dev") // gtnhlib is compileOnlyApi by us, but needed at runtime by nei, so require the correct version - api("com.github.GTNewHorizons:GTNHLib:0.11.4:dev") + api("com.github.GTNewHorizons:GTNHLib:0.11.6:dev") implementation("com.github.GTNewHorizons:NotEnoughItems:2.8.100-GTNH:dev") compileOnlyApi("curse.maven:cofh-core-69162:2388751") compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.7.1:api") - compileOnly("com.github.GTNewHorizons:waila:1.19.29:api") + compileOnly("com.github.GTNewHorizons:waila:1.19.30:api") compileOnly("com.github.GTNewHorizons:Battlegear2:1.4.3:api") compileOnly("curse.maven:minefactory-reloaded-66672:2366150") compileOnly("curse.maven:zelda-sword-skills-220540:2384889") @@ -22,7 +22,7 @@ dependencies { compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.21-GTNH:dev') compileOnly('com.github.GTNewHorizons:SpecialMobs:3.7.4') runtimeOnly('com.github.GTNewHorizons:TiC-Tooltips:1.4.1:dev'){transitive = false} - runtimeOnly("com.github.GTNewHorizons:ServerUtilities:2.2.37:dev") + runtimeOnly("com.github.GTNewHorizons:ServerUtilities:2.3.0:dev") // For testing scythe crop harvesting diff --git a/src/main/java/tconstruct/armor/player/TPlayerHandler.java b/src/main/java/tconstruct/armor/player/TPlayerHandler.java index 0414421fcc..188834168f 100644 --- a/src/main/java/tconstruct/armor/player/TPlayerHandler.java +++ b/src/main/java/tconstruct/armor/player/TPlayerHandler.java @@ -9,18 +9,24 @@ import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +import net.minecraft.block.Block; +import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; import net.minecraft.entity.Entity.EnumEntitySize; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; +import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.event.entity.player.PlayerDropsEvent; @@ -32,11 +38,13 @@ import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import mantle.player.PlayerUtils; import tconstruct.TConstruct; import tconstruct.compat.BaublesHelper; import tconstruct.compat.LoadedMods; import tconstruct.library.tools.AbilityHelper; +import tconstruct.smeltery.blocks.SpeedBlock; import tconstruct.tools.TinkerTools; import tconstruct.util.config.PHConstruct; @@ -389,5 +397,23 @@ public void playerDeathWrapper(LivingDeathEvent event) { public void playerDropsWrapper(PlayerDropsEvent evt) { TPlayerHandler.this.playerDrops(evt); } + + @SideOnly(Side.CLIENT) + @SubscribeEvent + public void playerUpdates(LivingEvent.LivingUpdateEvent event) { + final EntityLivingBase entity = event.entityLiving; + + // the player should handle its own movement, rest is handled by the server + if (entity instanceof EntityClientPlayerMP && entity.onGround) { + int tX = MathHelper.floor_double(entity.posX), + tY = MathHelper.floor_double(entity.boundingBox.minY - 0.001F), + tZ = MathHelper.floor_double(entity.posZ); + World world = entity.worldObj; + Block tBlock = world.getBlock(tX, tY, tZ); + if (tBlock instanceof SpeedBlock speedBlock) { + speedBlock.onWalkedOn(world, tX, tY, tZ, entity); + } + } + } } } diff --git a/src/main/java/tconstruct/smeltery/blocks/SpeedBlock.java b/src/main/java/tconstruct/smeltery/blocks/SpeedBlock.java index d6a4899c9b..f188f90e87 100644 --- a/src/main/java/tconstruct/smeltery/blocks/SpeedBlock.java +++ b/src/main/java/tconstruct/smeltery/blocks/SpeedBlock.java @@ -21,23 +21,25 @@ public class SpeedBlock extends TConstructBlock { public SpeedBlock() { super(Material.rock, 3.0f, textureNames); - // this.setBlockBounds(0f, 0f, 0f, 1.0f, 0.5f, 1.0f); } - @Override - public void onEntityWalking(World world, int x, int y, int z, Entity entity) { - double boost = 2.2D; - int metadata = world.getBlockMetadata(x, y, z); - if (metadata == 1 || metadata == 4) boost = 2.7D; + /// Invoked whenever the local player walks over this block. + /// Only invoked clientside. + public void onWalkedOn(World world, int x, int y, int z, Entity entity) { + if (entity.motionX == 0 && entity.motionZ == 0) return; + if (entity.isInWater()) return; + if (entity.isWet()) return; + if (entity.isSneaking()) return; - double mX = Math.abs(entity.motionX); - double mZ = Math.abs(entity.motionZ); - if (mX < 0.5D) { - entity.motionX *= boost; - } - if (mZ < 0.5D) { - entity.motionZ *= boost; + double tSpeed = 1.15; + + int metadata = world.getBlockMetadata(x, y, z); + if (metadata == 1 || metadata == 4) { + tSpeed = 1.3; } + + entity.motionX *= tSpeed; + entity.motionZ *= tSpeed; } @Override