mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
1 parent
07aba06d59
commit
cae822ced9
2 files changed
+16
-7
No files matched your search
@@ -225,7 +225,7 @@
|
||||
p_233627_1_ = (float)((double)p_233627_1_ * (1.0D - this.func_233637_b_(Attributes.field_233820_c_)));
|
||||
if (!(p_233627_1_ <= 0.0F)) {
|
||||
this.field_70160_al = true;
|
||||
@@ -1322,16 +_,7 @@
|
||||
@@ -1322,16 +_,9 @@
|
||||
} else {
|
||||
BlockPos blockpos = this.func_233580_cy_();
|
||||
BlockState blockstate = this.func_213339_cH();
|
||||
@@ -239,7 +239,9 @@
|
||||
- } else {
|
||||
- return false;
|
||||
- }
|
||||
+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(blockstate, field_70170_p, blockpos, this);
|
||||
+ Optional<BlockPos> ladderPos = net.minecraftforge.common.ForgeHooks.isLivingOnLadderPos(blockstate, field_70170_p, blockpos, this);
|
||||
+ if (ladderPos.isPresent()) this.field_233624_bE_ = ladderPos;
|
||||
+ return ladderPos.isPresent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -422,13 +422,20 @@ public class ForgeHooks
|
||||
return Math.max(0,event.getVisibilityModifier());
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link #isLivingOnLadderPos(BlockState, World, BlockPos, LivingEntity)} instead in 1.16. */
|
||||
@Deprecated
|
||||
public static boolean isLivingOnLadder(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull LivingEntity entity)
|
||||
{
|
||||
boolean isSpectator = (entity instanceof PlayerEntity && ((PlayerEntity)entity).isSpectator());
|
||||
if (isSpectator) return false;
|
||||
return isLivingOnLadderPos(state, world, pos, entity).isPresent();
|
||||
}
|
||||
|
||||
public static Optional<BlockPos> isLivingOnLadderPos(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull LivingEntity entity)
|
||||
{
|
||||
boolean isSpectator = (entity instanceof PlayerEntity && entity.isSpectator());
|
||||
if (isSpectator) return Optional.empty();
|
||||
if (!ForgeConfig.SERVER.fullBoundingBoxLadders.get())
|
||||
{
|
||||
return state.isLadder(world, pos, entity);
|
||||
return state.isLadder(world, pos, entity) ? Optional.of(pos) : Optional.empty();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -446,12 +453,12 @@ public class ForgeHooks
|
||||
state = world.getBlockState(tmp);
|
||||
if (state.isLadder(world, tmp, entity))
|
||||
{
|
||||
return true;
|
||||
return Optional.of(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user