Fix Bucket rendering and add sound (#2865)

* Adjust generated quads from texture to take texture size into account #2858

*  Fix universal bucket not passing through when rightclicking on a non-block
Add proper sound events when picking up modded fluids #2821

* Have FluidUtil execute properly on both sides and sync as expected. Add default sounds to interacting with tanks

* Save sound for filling/emptying in the fluid
This commit is contained in:
boni authored and LexManos committed 2016-05-16 13:20:31 -07:00
1 parent 87b0f7db99
commit 5d5c005aae
4 files changed
+210 -248

No files matched your search

@@ -2,6 +2,9 @@ package net.minecraftforge.fluids;
import java.util.Locale;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.util.ResourceLocation;
@@ -36,6 +39,9 @@ public class Fluid
protected final ResourceLocation still;
protected final ResourceLocation flowing;
private SoundEvent fillSound;
private SoundEvent emptySound;
/**
* The light level emitted by this fluid.
*
@@ -158,6 +164,18 @@ public class Fluid
return this;
}
public Fluid setFillSound(SoundEvent fillSound)
{
this.fillSound = fillSound;
return this;
}
public Fluid setEmptySound(SoundEvent emptySound)
{
this.emptySound = emptySound;
return this;
}
public final String getName()
{
return this.fluidName;
@@ -244,6 +262,40 @@ public class Fluid
return flowing;
}
public SoundEvent getFillSound()
{
if(fillSound == null)
{
if(getBlock() != null && getBlock().getDefaultState().getMaterial() == Material.lava)
{
fillSound = SoundEvents.item_bucket_fill_lava;
}
else
{
fillSound = SoundEvents.item_bucket_fill;
}
}
return fillSound;
}
public SoundEvent getEmptySound()
{
if(emptySound == null)
{
if(getBlock() != null && getBlock().getDefaultState().getMaterial() == Material.lava)
{
emptySound = SoundEvents.item_bucket_empty_lava;
}
else
{
emptySound = SoundEvents.item_bucket_empty;
}
}
return emptySound;
}
/* Stack-based Accessors */
public int getLuminosity(FluidStack stack){ return getLuminosity(); }
public int getDensity(FluidStack stack){ return getDensity(); }
@@ -254,6 +306,8 @@ public class Fluid
public int getColor(FluidStack stack){ return getColor(); }
public ResourceLocation getStill(FluidStack stack) { return getStill(); }
public ResourceLocation getFlowing(FluidStack stack) { return getFlowing(); }
public SoundEvent getFillSound(FluidStack stack) { return getFillSound(); }
public SoundEvent getEmptySound(FluidStack stack) { return getEmptySound(); }
/* World-based Accessors */
public int getLuminosity(World world, BlockPos pos){ return getLuminosity(); }
@@ -265,5 +319,7 @@ public class Fluid
public int getColor(World world, BlockPos pos){ return getColor(); }
public ResourceLocation getStill(World world, BlockPos pos) { return getStill(); }
public ResourceLocation getFlowing(World world, BlockPos pos) { return getFlowing(); }
public SoundEvent getFillSound(World world, BlockPos pos) { return getFillSound(); }
public SoundEvent getEmptySound(World world, BlockPos pos) { return getEmptySound(); }
}