Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ dependencies {
compileOnly('openperipheral:OpenPeripheralCore-API:3.4.1')
compileOnly('curse.maven:computercraft-67504:2269339')
compileOnly('com.github.GTNewHorizons:Mobs-Info:0.5.10-GTNH:dev')
compileOnly("com.github.GTNewHorizons:Backhand:1.8.8:dev") { transitive = false }
}
14 changes: 12 additions & 2 deletions src/main/java/openblocks/common/entity/EntityHangGlider.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.world.World;
import net.minecraft.world.gen.NoiseGeneratorPerlin;

import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
Expand All @@ -23,6 +24,7 @@
import openblocks.common.item.ItemHangGlider;
import openmods.Log;
import openmods.OpenMods;
import xonin.backhand.api.core.BackhandUtils;

public class EntityHangGlider extends Entity implements IEntityAdditionalSpawnData {

Expand All @@ -47,6 +49,8 @@ public class EntityHangGlider extends Entity implements IEntityAdditionalSpawnDa

private static final int PROPERTY_DEPLOYED = 17;

private static final boolean isBackhandLoaded = Loader.isModLoaded("backhand");

private static Map<EntityPlayer, EntityHangGlider> gliderMap = new HashMap<>();

private IVarioController varioControl = IVarioController.NULL;
Expand All @@ -69,10 +73,16 @@ private static boolean isGliderValid(EntityPlayer player, EntityHangGlider glide
if (player == null || player.isDead || glider == null || glider.isDead) return false;

ItemStack held = player.getHeldItem();
if (isBackhandLoaded) {
ItemStack offhand = BackhandUtils.getOffhandItem(player);
if (offhand != null && offhand.getItem() instanceof ItemHangGlider) {
held = offhand;
}
}

if (held == null || !(held.getItem() instanceof ItemHangGlider)) return false;
if (player.isRiding()) return false;
if (player.worldObj.provider.dimensionId != glider.worldObj.provider.dimensionId) return false;
return true;
return player.worldObj.provider.dimensionId == glider.worldObj.provider.dimensionId;
}

@SideOnly(Side.CLIENT)
Expand Down
Loading