Jump to content

Recommended Posts

Posted (edited)

How do I make my Universal Bucket added by Forge have an overlay?

 

Fluid class

ublic class FluidEnchantedLiquid extends Fluid{
	
	 protected static int mapColor = 0xFFFFFFFF;
	    protected static float overlayAlpha = 0.2F;
	    protected static SoundEvent emptySound = SoundEvents.ITEM_BUCKET_EMPTY;
	    protected static SoundEvent fillSound = SoundEvents.ITEM_BUCKET_FILL;
	    protected static Material material = Material.WATER;
	 
	    public FluidEnchantedLiquid(String fluidName, ResourceLocation still, ResourceLocation flowing) 
	    {
	        super(fluidName, still, flowing);
	        ModFluids.FLUIDS.add(this);
	    }
	 
	    public FluidEnchantedLiquid(String fluidName, ResourceLocation still, ResourceLocation flowing, int mapColor) 
	    {
	        this(fluidName, still, flowing);
	        setColor(mapColor);
	        ModFluids.FLUIDS.add(this);
	    }
	 
	    public FluidEnchantedLiquid(String fluidName, ResourceLocation still, ResourceLocation flowing, int mapColor, float overlayAlpha) 
	    {
	        this(fluidName, still, flowing, mapColor);
	        setAlpha(overlayAlpha);
	        ModFluids.FLUIDS.add(this);
	    }
	 
	    @Override
	    public int getColor()
	    {
	        return mapColor;
	    }
	 
	    public FluidEnchantedLiquid setColor(int parColor)
	    {
	        mapColor = parColor;
	        return this;
	    }
	 
	    public float getAlpha()
	    {
	        return overlayAlpha;
	    }
	 
	    public FluidEnchantedLiquid setAlpha(float parOverlayAlpha)
	    {
	        overlayAlpha = parOverlayAlpha;
	        return this;
	    }
	 
	    @Override
	    public FluidEnchantedLiquid setEmptySound(SoundEvent parSound)
	    {
	        emptySound = parSound;
	        return this;
	    }
	 
	    @Override
	    public SoundEvent getEmptySound()
	    {
	        return emptySound;
	    }
	 
	    @Override
	    public FluidEnchantedLiquid setFillSound(SoundEvent parSound)
	    {
	        fillSound = parSound;
	        return this;
	    }
	 
	    @Override
	    public SoundEvent getFillSound()
	    {
	        return fillSound;
	    }
	 
	    public FluidEnchantedLiquid setMaterial(Material parMaterial)
	    {
	        material = parMaterial;
	        return this;
	    }
	 
	    public Material getMaterial()
	    {
	        return material;
	    }
	 
	    @Override
	    public boolean doesVaporize(FluidStack fluidStack)
	    {
	        if (block == null)
	            return false;
	        return block.getDefaultState().getMaterial() == getMaterial();
	    }
	
}

 

ModFluids class

public class ModFluids {
	
	public static List<Fluid> FLUIDS = new ArrayList<Fluid>();
	
	public static Fluid enchantedFluid = new FluidEnchantedLiquid("enchanted", new ResourceLocation(Reference.MOD_ID, "enchanted_still"), new ResourceLocation(Reference.MOD_ID, "enchanted_flow")).setMaterial(ModMaterials.ENCHANTED).setDensity(100).setGaseous(false).setLuminosity(2).setViscosity(25000).setTemperature(300);
	
}

 

How I registered my fluid:

public static void onBlockRegister(RegistryEvent.Register<Block> event) {
		event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0]));
		GameRegistry.registerTileEntity(((BlockRotatableBase) ModBlocks.enchanterGem).getTileEntityClass(),
				ModBlocks.enchanterGem.getRegistryName().toString());
		for (Fluid fluid : ModFluids.FLUIDS) {
			boolean done = FluidRegistry.registerFluid(fluid);
			FluidRegistry.addBucketForFluid(fluid);
			if(done) {
				Utils.getLogger().info("Succcessful!");
			}
		}
	}

 

So, How do I add an overlay to the universal bucket?

2018-10-05_09.57.09.png

Edited by DeathSpawn
Posted

 

43 minutes ago, jabelar said:

I am not positive but I think you have to create a fluid block as well. And the color/texture from that gets used. Or something like that.

You have to it seems. The texture changed as soon as I created a fluid block.

Posted
5 hours ago, DeathSpawn said:

You have to it seems.

You actually don't have to create a block to make your fluids have textures. The reason you don't see a texture without a fluid block is because it's not stitched to the texture atlas. Creating a block automatically stiches the texture and so you now have the ability to see it. However that is not the only way to do this and in fact is not the preffered way. Just stitch your fluid texture in the TextureStitchEvent.

  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.