Jump to content

1.7.10 Custom Fluid


killerjdog51

Recommended Posts

Ok, so i wanted to see if it was possible to make a fluid in 1.7.10 and i used this forge tutorial to create it http://www.minecraftforge.net/wiki/Create_a_Fluid. Now i know the tutorial is for 1.7.2 and im using for 1.7.10, but i dont think thats the problem because i dont thing a whole lot has changed between the two. Now, my fluid works well, and im able to pick it up in a bucket. But the problem lies with placing the fluid from the bucket, im still able to place it from its "block" form but not from its "item/bucket" form. Here is my code and my crash report, usually i can understand what the crash report is saying if it errored at the forge code but this is erroring at mojang's code so im not sure what to do and thats why im posting here. I would really appreciate the help, sincerelly killerjdog51.

 

ExampleMod.class

 

package com.example.examplemod;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.fluids.Fluid;

import net.minecraftforge.fluids.FluidContainerRegistry;

import net.minecraftforge.fluids.FluidRegistry;

import cpw.mods.fml.client.registry.RenderingRegistry;

import cpw.mods.fml.common.Mod;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.event.FMLInitializationEvent;

import cpw.mods.fml.common.registry.GameRegistry;

 

@Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION)

public class ExampleMod

{

    public static final String MODID = "liquids";

    public static final String VERSION = "1.0";

   

    public Fluid yourFluid = new Fluid("fluidname");

    public static Block yourFluidBlock;

    public Item yourBucket = new ItemYourBucket(yourFluidBlock);

 

    @EventHandler

    public void init(FMLInitializationEvent event)

    {

    FluidRegistry.registerFluid(yourFluid);

        yourFluidBlock = new BlockYourFluid(yourFluid, Material.water).setBlockName("yourFluid");

        GameRegistry.registerBlock(yourFluidBlock, MODID + "_" + yourFluidBlock.getUnlocalizedName().substring(5));

        yourFluid.setUnlocalizedName(yourFluidBlock.getUnlocalizedName());

       

        yourBucket .setUnlocalizedName("yourBucket").setContainerItem(Items.bucket);

        GameRegistry.registerItem(yourBucket, "yourBucket");

        FluidContainerRegistry.registerFluidContainer(yourFluid, new ItemStack(yourBucket), new ItemStack(Items.bucket));

       

        BucketHandler.INSTANCE.buckets.put(yourFluidBlock, yourBucket);

        MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);

    }

}

 

 

 

BlockYourFluid

 

package com.example.examplemod;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.util.IIcon;

import net.minecraft.world.IBlockAccess;

import net.minecraft.world.World;

import net.minecraftforge.fluids.BlockFluidClassic;

import net.minecraftforge.fluids.Fluid;

 

public class BlockYourFluid extends BlockFluidClassic {

 

        @SideOnly(Side.CLIENT)

        protected IIcon stillIcon;

        @SideOnly(Side.CLIENT)

        protected IIcon flowingIcon;

       

        public BlockYourFluid(Fluid fluid, Material material) {

                super(fluid, material);

                setCreativeTab(CreativeTabs.tabMisc);

        }

       

        @Override

        public IIcon getIcon(int side, int meta) {

                return (side == 0 || side == 1)? stillIcon : flowingIcon;

        }

       

        @SideOnly(Side.CLIENT)

        @Override

        public void registerBlockIcons(IIconRegister register) {

                stillIcon = register.registerIcon("modid:fluidStill");

                flowingIcon = register.registerIcon("modid:fluidFlowing");

        }

       

        @Override

        public boolean canDisplace(IBlockAccess world, int x, int y, int z) {

                if (world.getBlock(x,  y,  z).getMaterial().isLiquid()) return false;

                return super.canDisplace(world, x, y, z);

        }

       

        @Override

        public boolean displaceIfPossible(World world, int x, int y, int z) {

                if (world.getBlock(x,  y,  z).getMaterial().isLiquid()) return false;

                return super.displaceIfPossible(world, x, y, z);

        }

       

}

 

 

ItemYourBucket

 

package com.example.examplemod;

 

import net.minecraft.block.Block;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemBucket;

 

public class ItemYourBucket extends ItemBucket {

 

public ItemYourBucket(Block p_i45331_1_) {

super(ExampleMod.yourFluidBlock);

        this.setContainerItem(Items.bucket);

        this.maxStackSize = 1;

}

 

}

 

 

 

BucketHandler

 

/**

* Copyright © SpaceToad, 2011 http://www.mod-buildcraft.com

*

* BuildCraft is distributed under the terms of the Minecraft Mod Public License

* 1.0, or MMPL. Please check the contents of the license located in

* http://www.mod-buildcraft.com/MMPL-1.0.txt

*/

package com.example.examplemod;

 

import java.util.HashMap;

import java.util.Map;

 

import cpw.mods.fml.common.eventhandler.Event.Result;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

import net.minecraft.block.Block;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.util.MovingObjectPosition;

import net.minecraft.world.World;

import net.minecraftforge.event.entity.player.FillBucketEvent;

 

public class BucketHandler {

 

        public static BucketHandler INSTANCE = new BucketHandler();

        public Map<Block, Item> buckets = new HashMap<Block, Item>();

 

        private BucketHandler() {

        }

 

        @SubscribeEvent

        public void onBucketFill(FillBucketEvent event) {

 

                ItemStack result = fillCustomBucket(event.world, event.target);

 

                if (result == null)

                        return;

 

                event.result = result;

                event.setResult(Result.ALLOW);

        }

 

        private ItemStack fillCustomBucket(World world, MovingObjectPosition pos) {

 

                Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);

 

                Item bucket = buckets.get(block);

                if (bucket != null && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) {

                        world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);

                        return new ItemStack(bucket);

                } else

                        return null;

 

        }

}

 

 

Crash Report

 

---- Minecraft Crash Report ----

// Don't do that.

 

Time: 3/20/15 8:48 AM

Description: Unexpected error

 

java.lang.NullPointerException: Unexpected error

at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:86)

at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:653)

at net.minecraft.world.World.setBlock(World.java:511)

at net.minecraft.item.ItemBucket.tryPlaceContainedLiquid(ItemBucket.java:210)

at net.minecraft.item.ItemBucket.onItemRightClick(ItemBucket.java:142)

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:161)

at net.minecraft.client.multiplayer.PlayerControllerMP.sendUseItem(PlayerControllerMP.java:430)

at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1514)

at net.minecraft.client.Minecraft.runTick(Minecraft.java:1999)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:984)

at net.minecraft.client.Minecraft.run(Minecraft.java:900)

at net.minecraft.client.main.Main.main(Main.java:112)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:86)

at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:653)

at net.minecraft.world.World.setBlock(World.java:511)

at net.minecraft.item.ItemBucket.tryPlaceContainedLiquid(ItemBucket.java:210)

at net.minecraft.item.ItemBucket.onItemRightClick(ItemBucket.java:142)

at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:161)

at net.minecraft.client.multiplayer.PlayerControllerMP.sendUseItem(PlayerControllerMP.java:430)

at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1514)

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityClientPlayerMP['Player990'/295, l='MpServer', x=185.80, y=73.62, z=255.31]]

Chunk stats: MultiplayerChunkCache: 225, 225

Level seed: 0

Level generator: ID 00 - default, ver 1. Features enabled: false

Level generator options:

Level spawn location: World: (188,64,248), Chunk: (at 12,4,8 in 11,15; contains blocks 176,0,240 to 191,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

Level time: 1530 game time, 1530 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false

Forced entities: 71 total; [EntityZombie['Zombie'/137, l='MpServer', x=217.72, y=25.00, z=198.16], EntityZombie['Zombie'/136, l='MpServer', x=219.53, y=24.00, z=197.03], EntityPig['Pig'/139, l='MpServer', x=215.22, y=69.00, z=253.94], EntityPig['Pig'/138, l='MpServer', x=215.78, y=70.00, z=212.50], EntityPig['Pig'/141, l='MpServer', x=217.09, y=70.00, z=244.78], EntityPig['Pig'/140, l='MpServer', x=219.13, y=70.00, z=251.03], EntityCreeper['Creeper'/143, l='MpServer', x=221.59, y=15.00, z=319.00], EntityPig['Pig'/142, l='MpServer', x=214.38, y=70.00, z=256.19], EntityBat['Bat'/135, l='MpServer', x=223.51, y=42.00, z=184.51], EntityZombie['Zombie'/134, l='MpServer', x=220.97, y=24.00, z=190.25], EntityZombie['Zombie'/144, l='MpServer', x=227.38, y=11.39, z=314.13], EntityZombie['Zombie'/171, l='MpServer', x=227.44, y=23.00, z=264.06], EntityWitch['Witch'/170, l='MpServer', x=237.06, y=23.00, z=270.56], EntityEnderman['Enderman'/169, l='MpServer', x=235.56, y=23.00, z=266.03], EntitySkeleton['Skeleton'/168, l='MpServer', x=228.50, y=27.00, z=238.50], EntityItem['item.item.seeds'/175, l='MpServer', x=235.88, y=66.13, z=300.63], EntitySkeleton['Skeleton'/174, l='MpServer', x=232.44, y=30.00, z=282.06], EntitySkeleton['Skeleton'/173, l='MpServer', x=231.50, y=30.00, z=278.50], EntitySkeleton['Skeleton'/172, l='MpServer', x=229.50, y=31.00, z=277.88], EntityBat['Bat'/166, l='MpServer', x=235.08, y=55.28, z=184.34], EntitySpider['Spider'/164, l='MpServer', x=229.13, y=42.00, z=177.28], EntityCreeper['Creeper'/186, l='MpServer', x=254.41, y=12.00, z=196.00], EntitySkeleton['Skeleton'/187, l='MpServer', x=258.34, y=24.00, z=232.78], EntityZombie['Zombie'/185, l='MpServer', x=241.88, y=55.00, z=191.47], EntitySkeleton['Skeleton'/190, l='MpServer', x=249.31, y=27.00, z=232.25], EntitySkeleton['Skeleton'/191, l='MpServer', x=254.13, y=26.00, z=237.63], EntitySkeleton['Skeleton'/188, l='MpServer', x=251.50, y=27.00, z=231.50], EntitySkeleton['Skeleton'/189, l='MpServer', x=243.13, y=27.00, z=232.03], EntityClientPlayerMP['Player990'/295, l='MpServer', x=185.80, y=73.62, z=255.31], EntityZombie['Zombie'/178, l='MpServer', x=234.50, y=17.00, z=312.50], EntitySkeleton['Skeleton'/176, l='MpServer', x=224.56, y=14.00, z=308.56], EntitySkeleton['Skeleton'/177, l='MpServer', x=228.56, y=11.00, z=313.16], EntitySkeleton['Skeleton'/68, l='MpServer', x=109.13, y=36.00, z=180.53], EntitySkeleton['Skeleton'/69, l='MpServer', x=107.31, y=35.00, z=179.44], EntityEnderman['Enderman'/204, l='MpServer', x=261.84, y=12.00, z=193.31], EntityBat['Bat'/71, l='MpServer', x=111.75, y=29.10, z=200.44], EntityCreeper['Creeper'/203, l='MpServer', x=258.09, y=12.00, z=193.47], EntitySkeleton['Skeleton'/197, l='MpServer', x=251.50, y=28.00, z=299.47], EntityCreeper['Creeper'/77, l='MpServer', x=123.38, y=44.00, z=201.13], EntitySkeleton['Skeleton'/196, l='MpServer', x=255.50, y=29.00, z=302.50], EntityCreeper['Creeper'/78, l='MpServer', x=126.41, y=44.00, z=200.00], EntityEnderman['Enderman'/79, l='MpServer', x=118.75, y=21.00, z=212.34], EntityBat['Bat'/193, l='MpServer', x=247.16, y=27.41, z=251.06], EntitySkeleton['Skeleton'/192, l='MpServer', x=251.50, y=27.00, z=237.50], EntityWitch['Witch'/195, l='MpServer', x=248.30, y=11.16, z=282.30], EntityBat['Bat'/194, l='MpServer', x=253.53, y=27.90, z=256.25], EntityCreeper['Creeper'/85, l='MpServer', x=137.50, y=46.00, z=179.50], EntityBat['Bat'/87, l='MpServer', x=141.58, y=41.84, z=176.16], EntityZombie['Zombie'/86, l='MpServer', x=125.97, y=46.00, z=176.50], EntityBat['Bat'/81, l='MpServer', x=119.14, y=19.00, z=255.52], EntityCreeper['Creeper'/216, l='MpServer', x=258.47, y=19.00, z=332.03], EntityBat['Bat'/80, l='MpServer', x=122.08, y=20.76, z=254.02], EntityBat['Bat'/82, l='MpServer', x=124.09, y=22.10, z=256.47], EntityCreeper['Creeper'/212, l='MpServer', x=264.34, y=41.00, z=286.97], EntityCreeper['Creeper'/92, l='MpServer', x=140.50, y=14.00, z=274.50], EntityCow['Cow'/208, l='MpServer', x=262.84, y=68.00, z=210.81], EntityZombie['Zombie'/89, l='MpServer', x=128.50, y=44.00, z=202.50], EntitySkeleton['Skeleton'/209, l='MpServer', x=261.03, y=14.00, z=224.47], EntityCreeper['Creeper'/88, l='MpServer', x=130.38, y=44.00, z=207.00], EntityBat['Bat'/91, l='MpServer', x=135.88, y=20.00, z=257.34], EntityCreeper['Creeper'/211, l='MpServer', x=260.56, y=23.00, z=253.34], EntityCreeper['Creeper'/90, l='MpServer', x=145.69, y=30.00, z=241.78], EntityBat['Bat'/103, l='MpServer', x=167.38, y=22.17, z=232.23], EntitySkeleton['Skeleton'/98, l='MpServer', x=145.50, y=52.00, z=237.50], EntitySkeleton['Skeleton'/97, l='MpServer', x=144.50, y=31.00, z=238.50], EntitySkeleton['Skeleton'/104, l='MpServer', x=171.44, y=43.00, z=312.94], EntityZombie['Zombie'/118, l='MpServer', x=205.06, y=48.00, z=294.50], EntityZombie['Zombie'/117, l='MpServer', x=197.78, y=48.00, z=299.59], EntityPig['Pig'/116, l='MpServer', x=203.25, y=70.00, z=212.38], EntityPig['Pig'/115, l='MpServer', x=197.78, y=70.00, z=215.72], EntityPig['Pig'/114, l='MpServer', x=205.81, y=69.00, z=207.66]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:410)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2509)

at net.minecraft.client.Minecraft.run(Minecraft.java:929)

at net.minecraft.client.main.Main.main(Main.java:112)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

-- System Details --

Details:

Minecraft Version: 1.7.2

Operating System: Windows 8.1 (amd64) version 6.3

Java Version: 1.7.0_75, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 669112504 bytes (638 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 11558 (647248 bytes; 0 MB) allocated, 3 (168 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94

FML: MCP v9.03 FML v7.2.211.1121 Minecraft Forge 10.12.2.1121 4 mods loaded, 4 mods active

mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.2.211.1121} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.12.2.1121} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

liquids{1.0} [liquids] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Launched Version: 1.6

LWJGL: 2.9.0

OpenGL: Intel® HD Graphics 4400 GL version 4.2.0 - Build 10.18.10.3379, Intel

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: ~~ERROR~~ NullPointerException: null

Profiler Position: N/A (disabled)

Vec3 Pool Size: 1077 (60312 bytes; 0 MB) allocated, 34 (1904 bytes; 0 MB) used

Anisotropic Filtering: Off (1)

 

Link to comment
Share on other sites

Well if you look in the examplemod.class file i've provided you would know that i am indeed registering the fluid and block before the bucket or bucket registry. Because i create, define, and register everything in this order: fluid, fluid block, fluid container (bucket).

Link to comment
Share on other sites

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.