Skip to content

Commit

Permalink
Added an additional constructor to every implementation of IFluidBloc…
Browse files Browse the repository at this point in the history
…k. It is now possible to create a fluid block with a Fluid, Material and MapColor, so that the Material's MapColor isn't used for the blocks MapColor. (MinecraftForge#5293)
  • Loading branch information
oOMitchOo authored and tterrag1098 committed Jan 4, 2019
1 parent 4e11c95 commit 21f7c31
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/main/java/net/minecraftforge/fluids/BlockFluidBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.BlockStairs;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyInteger;
Expand Down Expand Up @@ -162,9 +163,9 @@ public UnlistedPropertyBool(String name)
*/
protected final Fluid definedFluid;

public BlockFluidBase(Fluid fluid, Material material)
public BlockFluidBase(Fluid fluid, Material material, MapColor mapColor)
{
super(material);
super(material, mapColor);
this.setTickRandomly(true);
this.disableStats();

Expand All @@ -181,6 +182,11 @@ public BlockFluidBase(Fluid fluid, Material material)
this.setDefaultState(blockState.getBaseState().withProperty(LEVEL, getMaxRenderHeightMeta()));
}

public BlockFluidBase(Fluid fluid, Material material)
{
this(fluid, material, material.getMaterialMapColor());
}

@Override
@Nonnull
protected BlockStateContainer createBlockState()
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/net/minecraftforge/fluids/BlockFluidClassic.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import com.google.common.primitives.Ints;

import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
Expand Down Expand Up @@ -55,12 +56,17 @@ public class BlockFluidClassic extends BlockFluidBase

protected FluidStack stack;

public BlockFluidClassic(Fluid fluid, Material material)
public BlockFluidClassic(Fluid fluid, Material material, MapColor mapColor)
{
super(fluid, material);
super(fluid, material, mapColor);
stack = new FluidStack(fluid, Fluid.BUCKET_VOLUME);
}

public BlockFluidClassic(Fluid fluid, Material material)
{
this(fluid, material, material.getMaterialMapColor());
}

public BlockFluidClassic setFluidStack(FluidStack stack)
{
this.stack = stack;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.util.Random;

import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
Expand All @@ -39,9 +40,14 @@
*/
public class BlockFluidFinite extends BlockFluidBase
{
public BlockFluidFinite(Fluid fluid, Material material, MapColor mapColor)
{
super(fluid, material, mapColor);
}

public BlockFluidFinite(Fluid fluid, Material material)
{
super(fluid, material);
this(fluid, material, material.getMaterialMapColor());
}

@Override
Expand Down

0 comments on commit 21f7c31

Please sign in to comment.