2018-09-21 22:50:37 +00:00
|
|
|
/*
|
|
|
|
* Minecraft Forge
|
2020-07-02 17:49:11 +00:00
|
|
|
* Copyright (c) 2016-2020.
|
2018-09-21 22:50:37 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation version 2.1
|
|
|
|
* of the License.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
package net.minecraftforge.common.extensions;
|
|
|
|
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
2019-02-14 23:08:53 +00:00
|
|
|
import net.minecraft.client.renderer.model.IBakedModel;
|
2018-09-21 22:50:37 +00:00
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
import net.minecraft.fluid.Fluid;
|
2020-06-19 14:58:45 +00:00
|
|
|
import net.minecraft.fluid.FluidState;
|
2018-09-21 22:50:37 +00:00
|
|
|
import net.minecraft.tags.Tag;
|
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
|
import net.minecraft.world.Explosion;
|
2020-06-24 00:56:24 +00:00
|
|
|
import net.minecraft.world.IBlockReader;
|
2018-09-21 22:50:37 +00:00
|
|
|
import net.minecraft.world.IWorldReader;
|
|
|
|
|
|
|
|
public interface IForgeFluidState
|
|
|
|
{
|
2020-06-19 14:58:45 +00:00
|
|
|
default FluidState getFluidState()
|
2018-09-21 22:50:37 +00:00
|
|
|
{
|
2020-06-19 14:58:45 +00:00
|
|
|
return (FluidState)this;
|
2018-09-21 22:50:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the entity is inside this block, may be used to determined if the entity can breathing,
|
|
|
|
* display material overlays, or if the entity can swim inside a block.
|
|
|
|
*
|
|
|
|
* @param world that is being tested.
|
|
|
|
* @param pos position thats being tested.
|
|
|
|
* @param entity that is being tested.
|
|
|
|
* @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height.
|
2020-06-19 14:58:45 +00:00
|
|
|
* @param tag to test for.
|
2018-09-21 22:50:37 +00:00
|
|
|
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
|
|
|
|
*/
|
|
|
|
default boolean isEntityInside(IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
|
|
|
|
{
|
2020-02-26 03:45:14 +00:00
|
|
|
// return ifluidstate.isTagged(p_213290_1_) && d0 < (double)((float)blockpos.getY() + ifluidstate.getActualHeight(this.world, blockpos) + 0.11111111F);
|
2018-09-22 10:40:22 +00:00
|
|
|
return getFluidState().getFluid().isEntityInside(getFluidState(), world, pos, entity, yToTest, tag, testingHead);
|
2018-09-21 22:50:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Location sensitive version of getExplosionResistance
|
|
|
|
*
|
|
|
|
* @param world The current world
|
|
|
|
* @param pos Block position in world
|
|
|
|
* @param explosion The explosion
|
|
|
|
* @return The amount of the explosion absorbed.
|
|
|
|
*/
|
2020-06-24 00:56:24 +00:00
|
|
|
default float getExplosionResistance(IBlockReader world, BlockPos pos, Explosion explosion)
|
2018-09-21 22:50:37 +00:00
|
|
|
{
|
2020-06-24 00:56:24 +00:00
|
|
|
return getFluidState().getFluid().getExplosionResistance(getFluidState(), world, pos, explosion);
|
2018-09-21 22:50:37 +00:00
|
|
|
}
|
2020-06-24 00:56:24 +00:00
|
|
|
|
2018-12-21 22:45:35 +00:00
|
|
|
/**
|
|
|
|
* Queries if this fluidstate should render in a given layer.
|
|
|
|
* A custom {@link IBakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer.
|
|
|
|
*/
|
2019-12-11 02:27:07 +00:00
|
|
|
/* TODO: reimplement
|
2018-12-21 22:45:35 +00:00
|
|
|
default boolean canRenderInLayer(BlockRenderLayer layer)
|
|
|
|
{
|
|
|
|
return getFluidState().getFluid().canRenderInLayer(getFluidState(), layer);
|
2019-12-11 02:27:07 +00:00
|
|
|
}*/
|
2018-09-21 22:50:37 +00:00
|
|
|
}
|