mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 02:55:17 +00:00
1 parent
6eebea0896
commit
bdc856edf5
6 files changed
+99
-5
No files matched your search
@@ -5,6 +5,7 @@
|
||||
|
||||
package net.minecraftforge.common.extensions;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.vehicle.Boat;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
@@ -37,4 +38,17 @@ public interface IForgeBoat
|
||||
{
|
||||
return type.supportsBoating(self());
|
||||
}
|
||||
|
||||
/**
|
||||
* When {@code false}, the fluid will no longer update its height value while
|
||||
* within a boat while it is not within a fluid ({@link Boat#isUnderWater()}.
|
||||
*
|
||||
* @param state the state of the fluid the rider is within
|
||||
* @param rider the rider of the boat
|
||||
* @return {@code true} if the fluid height should be updated, {@code false} otherwise
|
||||
*/
|
||||
default boolean shouldUpdateFluidWhileRiding(FluidState state, Entity rider)
|
||||
{
|
||||
return state.shouldUpdateWhileBoating(self(), rider);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.vehicle.Boat;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@@ -424,4 +425,17 @@ public interface IForgeEntity extends ICapabilitySerializable<CompoundTag>
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* When {@code false}, the fluid will no longer update its height value while
|
||||
* within a boat while it is not within a fluid ({@link Boat#isUnderWater()}.
|
||||
*
|
||||
* @param state the state of the fluid the rider is within
|
||||
* @param boat the boat the rider is within that is not inside a fluid
|
||||
* @return {@code true} if the fluid height should be updated, {@code false} otherwise
|
||||
*/
|
||||
default boolean shouldUpdateFluidWhileBoating(FluidState state, Boat boat)
|
||||
{
|
||||
return boat.shouldUpdateFluidWhileRiding(state, self());
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
package net.minecraftforge.common.extensions;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.vehicle.Boat;
|
||||
@@ -94,6 +95,20 @@ public interface IForgeFluid
|
||||
return getFluidType().supportsBoating(state, boat);
|
||||
}
|
||||
|
||||
/**
|
||||
* When {@code false}, the fluid will no longer update its height value while
|
||||
* within a boat while it is not within a fluid ({@link Boat#isUnderWater()}.
|
||||
*
|
||||
* @param state the state of the fluid the rider is within
|
||||
* @param boat the boat the rider is within that is not inside a fluid
|
||||
* @param rider the rider of the boat
|
||||
* @return {@code true} if the fluid height should be updated, {@code false} otherwise
|
||||
*/
|
||||
default boolean shouldUpdateWhileBoating(FluidState state, Boat boat, Entity rider)
|
||||
{
|
||||
return getFluidType().shouldUpdateWhileBoating(state, boat, rider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the path type of this fluid when an entity is pathfinding. When
|
||||
* {@code null}, uses vanilla behavior.
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package net.minecraftforge.common.extensions;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.vehicle.Boat;
|
||||
@@ -88,6 +89,19 @@ public interface IForgeFluidState
|
||||
return self().getType().supportsBoating(self(), boat);
|
||||
}
|
||||
|
||||
/**
|
||||
* When {@code false}, the fluid will no longer update its height value while
|
||||
* within a boat while it is not within a fluid ({@link Boat#isUnderWater()}.
|
||||
*
|
||||
* @param boat the boat the rider is within that is not inside a fluid
|
||||
* @param rider the rider of the boat
|
||||
* @return {@code true} if the fluid height should be updated, {@code false} otherwise
|
||||
*/
|
||||
default boolean shouldUpdateWhileBoating(Boat boat, Entity rider)
|
||||
{
|
||||
return self().getType().shouldUpdateWhileBoating(self(), boat, rider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the path type of this fluid when an entity is pathfinding. When
|
||||
* {@code null}, uses vanilla behavior.
|
||||
|
||||
@@ -355,6 +355,20 @@ public class FluidType
|
||||
return this.supportsBoating(boat);
|
||||
}
|
||||
|
||||
/**
|
||||
* When {@code false}, the fluid will no longer update its height value while
|
||||
* within a boat while it is not within a fluid ({@link Boat#isUnderWater()}.
|
||||
*
|
||||
* @param state the state of the fluid the rider is within
|
||||
* @param boat the boat the rider is within that is not inside a fluid
|
||||
* @param rider the rider of the boat
|
||||
* @return {@code true} if the fluid height should be updated, {@code false} otherwise
|
||||
*/
|
||||
public boolean shouldUpdateWhileBoating(FluidState state, Boat boat, Entity rider)
|
||||
{
|
||||
return !this.supportsBoating(state, boat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the entity can ride in this vehicle under the fluid.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user