Jump to content

Recommended Posts

Posted

I'm working with custom fluids for the first time, following the tutorial found here: http://www.minecraftforge.net/wiki/Create_a_Fluid

 

I realize it's a bit outdated since it's using Block#setUnlocalizedName, which no longer exists in 1.7.10, but I figured the differences were minor enough that I could change them as I ran into discrepancies. So I went to work following the tutorial, and I got to the part where it says "now you should be able to use the filled bucket to place your fluid in the world, but not pick it up"...and I can't place the fluid. Everything registers with no errors or warnings, the fluid bucket appears in the Creative menu like it should (barring the missing texture, which is fine for now), but when I right-click on a block with the bucket in hand, nothing happens. No fluid blocks placed, nothing.

 

Here's the code so far:

 

Chaotica.java (main class):

/* CONCEPT:
* You're controlling the innate probabilities of the universe, condensing probability and entropy itself into a form
* that can be handled more accessibly. It's inherently improbable, so everything that uses it has a "chaotic risk",
* a drawback that can be reduced with focusing "chaos core" upgrades.
*/

/* TODO:
* -Add Pure Chaos fluid
* --> When placed in world, touching it gives you a random status effect
* -Add Chaos Cores, generic machine upgrades
* --> Efficiency core
* --> Speed core
* --> Accuracy core
* --> Production core
* --> Range core
* -Add Chaotic Tank, a fluid storage container
* --> Risk: if you try to give it more liquid than it can hold, it'll dump the excess in the world
* --> Possible upgrades (right-click with a core on it; drops cores when broken):
* ----> Speed core = can accept more fluid per tick (it's rate-limited)
* ----> Production core = can hold more fluid
* ----> Efficiency core = reduces (or removes, if not stackable) loss (there's some loss on incoming fluid)
* ----> Accuracy core = reduces (or removes, if not stackable) chances of liquid dumps, opting for blocking instead
* ----> Range core = N/A
* ----> If upgrades are stackable, can apply multiple upgrades of a type to increase its number
* -Add Fluid/Item Tubes, generic pipes
* --> Attach to blocks like EnderIO conduits and can be set to push, pull, or push/pull
* --> At the very least, fluid pipes are needed to move liquid chaos around
* --> Possible upgrades
* -Add Chaos Purifier that makes liquid pure chaos based on block changes
* --> Track last 3 block changes, diminishing returns on same position or block IDs.
* --> Occasionally places liquid chaos blocks in the world instead of the machine
* ----> Checks for air at random spot in range. If not found, does a BFS until air is found and places there.
* --> Possible upgrades:
* ----> Speed core = faster checking for block changes
* ----> Production core = more chaos per change
* ----> Range core = detects changes in a larger radius
* ----> Efficiency core = less diminishing returns
* ----> Accuracy core = less chance of placing chaos outside machine
* -Add a Chaotic Destroyer that uses liquid chaos as fuel to break blocks
* --> Filter slot to specify only certain blocks to break
* --> Occasionally will center break somewhere other than the block in front of it (a little farther away)
* --> Possible upgrades:
* ----> Speed core = lower cooldown between breaks
* ----> Production core = very occasionally uses Fortune I, II, or III (if upgrades stack; else just Fortune I)
* ----> Range core = breaks a 3x3 instead of 1x1 (or also 5x5 if stackable)
* ----> Efficiency core = uses less chaos per break
* ----> Accuracy core = keeps breaks centered on block in front of it
* -Add a Chaotic Actualizer that uses liquid chaos as fuel to place blocks
* --> Occasionally will place blocks somewhere other than right in front of it
* --> Possible upgrades:
* ----> Speed core = lower cooldown between placement attempts
* ----> Production core = occasionally upgrades stone to ore and ore to better ore (only 1 level above; occasionally)
* ----> Range core = can place 3x3 (or also 5x5 if stackable)
* ----> Efficiency core = uses less chaos per placement
* ----> Accuracy core = keeps block placements centered in front of it
* -Add Chaotic Freezer that uses liquid chaos as fuel
* --> Freezes nearby water to ice
* --> Freezes nearby lava sources to obsidian and flowing lava to smoothstone
* --> Occasionally turns random blocks in range to ice
* --> Possible upgrades:
* ----> Speed core = lower cooldown between freezes
* ----> Production core = occasionally turns water into packed ice and flowing lava into obsidian
* ----> Range core = increase range of effect
* ----> Efficiency core = uses less chaos per freeze
* ----> Accuracy core = lowers chance of turning regular blocks to ice (or, if not stackable, prevents it altogether)
* -Add Entropic Absorber that soaks up liquid chaos to power items
* -Add Entropic Infuser to transfer liquid chaos into an absorber
* -Add Chaos Staff for spells using liquid chaos from absorber
* --> If possible, figure out the extra hotbar slot like 1.9, but not in 1.9...
* --> Otherwise, Shift+Right Click to set spell, right click to use
* --> Ender pearl = teleport short distances, through walls, in direction you're looking
* --> Blaze rod = set things around you on fire, but not you
* --> Ice = Inflict massive slowness on mobs around you
* --> Slime block = disarms mobs around you
* --> Feather = gust of wind blows mobs up high (~7 blocks) and drops them
* --> Spider eye = revealing = glow effect (only if can reproduce it)
* -Add Ender Diamonds, which can't be obtained naturally (only by Productive Chaotic Hubs; see below)
* --> Used in some recipes
* -Add a Chaotic Hub block that can be placed anywhere
* --> When you use the Chaotic Transporter, you can link it to a hub; you teleport within a range of it
* --> Has a cooldown time after teleporting where you are paralyzed
* --> Possible upgrades:
* ----> Speed core = lower paralyzation time after teleporting
* ----> Production core = occasionally drops an Ender Diamond upon teleporting
* ----> Efficiency core = uses less chaos on your transporter (i.e. gives you back a bit after)
* ----> Range core = lets you teleport from farther away (initially, must be within 100 blocks)
* ----> Accuracy core = reduces (or removes) random range of destination
* -Add a Chaotic Transporter that uses liquid chaos from absorber to teleport you to a hub
* --> Level 2 can go across dimensions
* -Add an Entropy Analyzer that you right-click on mobs to store their type
* -Add a Chaotic Spawner
* --> Takes Analyzer to set mob type and liquid chaos to spawn mobs
* --> Has a chance of spawning a different, random mob
* --> Possible upgrades:
* ----> Speed core = faster spawning (lower cooldown)
* ----> Production core = more mobs spawned each time
* ----> Efficiency core = less chaos used per spawn
* ----> Range core = smaller radius of spawning (if stackable, fully upgraded = spawns only in block above it)
* ----> Accuracy core = less chance of spawning wrong mob (if not stackable, prevents it altogether)
* -Add a Chaotic Transporter Pedestal
* --> Right-click empty pedestal with Chaotic Transporter to put it inside
* --> Right-click filled pedestal to activate the contained Transporter
* --> Shift+Right-click filled pedestal to remove the contained Transporter
* --> Can accept liquid chaos to use instead of requiring the Transporter to have any--does NOT charge it!
* -Add Chaotic Levitator boots that use liquid chaos to give you jetpack-like flight
* --> Can only reach a certain height; you can't rise forever
* --> Randomly stop working for a small period of time, possibly dropping you out of the sky
* --> Possible upgrades (combine with one in a crafting grid):
* ----> Speed core = you rise faster
* ----> Efficiency core = uses less chaos per tick while rising
* ----> Range core = lets you rise higher
* ----> Production core = (N/A)
* ----> Accuracy core = less chance (or no chance, if not stackable) of shutting off randomly
* -Add Chaotic Grinder, a mob grinder that uses chaos for fuel
* --> Occasionally will deal damage to every player on the server, no matter where they are
* --> Possible upgrades:
* ----> Speed core = kills mobs faster (lower cooldown)
* ----> Efficiency core = uses less chaos per kill
* ----> Range core = kills in a larger range
* ----> Production core = occasionally uses Looting I (or Looting II, III, etc. if stackable)
* ----> Accuracy core = less chance (or no chance, if not stackable) of hurting players
* -Add a Chaotic Yielder that uses chaos as fuel to harvest crops
* --> Occasionally will grow a large, artificial tree within a radius outside its range, replacing blocks
* --> Possible upgrades:
* ----> Speed core = faster harvesting (lower cooldown between block breaks)
* ----> Efficiency core = uses less chaos per harvest
* ----> Range core = harvests in a larger range
* ----> Accuracy core = lowers (or removes, if not stackable) chance of artificial tree growth
* ----> Production core = occasionally uses Fortune I on harvests (or II, III, etc. if stackable)
* -Add Chaos Root, a plant that causes Wither in a range and prevents other crops from growing in a range
* --> Drops itself and can be planted
* --> Withers you if you hold it, too
* --> If planted where there's already crops in its range, they will reverse their growth until at stage 0
* ----> Growth stage = metadata value
* -Add a Chaotic Planter that uses chaos as fuel to plant crops
* --> Occasionally plants, instead of your crops, Chaos Root
* --> Requires Chaos Root as a crafting ingredient
* --> Possible upgrades:
* ----> Speed core = faster planting (lower cooldown between plants)
* ----> Efficiency core = uses less chaos per plant
* ----> Range core = plants in a larger range
* ----> Production core = occasionally bonemeals a crop it's just planted
* ----> Accuracy core = lowers (or removes, if not stackable) chances of Chaos Root exceptions
* -Add a Chaotic Dispeller, which uses chaos to teleport non-player mobs out of its radius
* --> Occasionally spawns an Endermite or Silverfish
* --> Possible upgrades:
* ----> Speed core = faster response (lower delay between mob entering range and being teleported away)
* ----> Efficiency core = uses less chaos per teleportation
* ----> Range core = teleports mobs out of a larger radius
* ----> Accuracy core = lowers (or removes, if not stackable) chances of Endermite/Silverfish spawns
* ----> Production core = will only teleport hostile and neutral mobs, not passive ones
* -Add a Chaotic Lure, which uses chaos to attract nearby mobs to it
* --> Occasionally "lets go", letting all the attracted mobs free for a cooldown period, which means a group of mobs roaming around
* --> Possible upgrades:
* ----> Speed core = faster response (lower delay between mob entering range and being attracted)
* ----> Range core = attracts from larger radius
* ----> Efficiency core = uses less chaos per attracted mob per tick
* ----> Accuracy core = can now accept an Entropy Analyzer and will only attract that one mob type
* ----> Production core = occasionally spawns desired mob type (if no analyzer is in it, occasionally spawns a mob at random)
* -Add a Chaotic XP Bank, which lets you store and retrieve XP using chaos as fuel
* --> Occasionally ejects some XP as orbs
* --> Possible upgrades:
* ----> Speed core = transactions are faster (storing and retrieving increase/decrease per tick, not instantly)
* ----> Efficiency core = uses less chaos per transaction
* ----> Range core = N/A
* ----> Accuracy core = lowers (or removes) chance of ejecting XP orbs
* ----> Production core = occasionally stores more than 1 XP per XP stored
* -Add Corrosive Chaos liquid
* --> When placed in world, will slowly eat away adjacent non-tile-entity blocks based on hardness
* --> Touching it causes severe burns, i.e. massive fire damage
* ----> Enough to destroy items instantly, like lava
* -Add a Novice Chaos Purifier, the first-level purifier which actually creates Corrosive Chaos liquid instead
* --> Is used in recipe to upgrade to the normal Chaos Purifier
* --> Has the same upgrade possibilities as the Chaos Purifier
* -Add a Chaotic Collector, which collects drops from corroded blocks in range "before" they're destroyed
* --> Powered by Pure Chaos
* --> Chaotic risk: occasionally duplicates Corrosive Chaos sources in range to another random block
* --> Possible upgrades:
* ----> Speed core = causes Corrosive Chaos blocks in range to eat blocks faster
* ----> Efficiency core = uses less Pure Chaos per collection
* ----> Range core = increases range of collection and modification
* ----> Accuracy core = lowers (or removes) chance of randomly duplicating Corrosive Chaos sources
* ----> Production core = occasionally gets Fortune-style drops from the blocks
* -Add a guide book
* --> Tutorial is bookmarked in Firefox
* --> fontRendererObj is now mc.fontRenderer
* --> drawSplitString is for word-wrapped text; args = (str, x, y, max_len, color)
*/

package com.IceMetalPunk.chaotica;

import com.IceMetalPunk.chaotica.blocks.ChaoticaBlocks;
import com.IceMetalPunk.chaotica.items.ChaoticaItems;

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

@Mod(modid = Chaotica.MODID, version = Chaotica.VERSION)
public class Chaotica {
public static final String MODID = "chaotica";
public static final String VERSION = "1.0";

public static ChaoticaBlocks blockRegistry;
public static ChaoticaItems itemRegistry;

@EventHandler
public void init(FMLInitializationEvent event) {
	blockRegistry = new ChaoticaBlocks();
	itemRegistry = new ChaoticaItems();
}
}

 

ChaoticaBlocks.java (block registry class):

package com.IceMetalPunk.chaotica.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;

public class ChaoticaBlocks {
public Fluid pureChaos, corrosiveChaos;
public Block pureChaosBlock, corrosiveChaosBlock;

public ChaoticaBlocks() {
	registerFluids();
	registerBlocks();
}

private void registerFluids() {
	this.pureChaos = new Fluid("purechaos").setViscosity(4000);
	FluidRegistry.registerFluid(this.pureChaos);

	this.corrosiveChaos = new Fluid("corrosivechaos").setViscosity(4000);
	FluidRegistry.registerFluid(this.corrosiveChaos);
}

private void registerBlocks() {
	this.pureChaosBlock = new BlockPureChaos(this.pureChaos, Material.water).setBlockName("tile.purechaos");
}
}

 

BlockPureChaos.java (fluid source block):

package com.IceMetalPunk.chaotica.blocks;

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.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
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 BlockPureChaos extends BlockFluidClassic {

@SideOnly(Side.CLIENT)
protected IIcon stillIcon;
@SideOnly(Side.CLIENT)
protected IIcon flowingIcon;

public BlockPureChaos(Fluid fluid, Material material) {
	super(fluid, material);
}

@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity ent) {
	if (!(ent instanceof EntityLivingBase)) {
		return;
	}
	EntityLivingBase player = (EntityLivingBase) ent;
	int pot = world.rand.nextInt(Potion.potionTypes.length);
	Potion.potionTypes[pot].performEffect(player, 40);
}

@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("chaotica:pureChaosStill");
	flowingIcon = register.registerIcon("chaotica:pureChaosFlowing");
}

@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);
}

}

 

ChaoticaItems.java (item registry class):

package com.IceMetalPunk.chaotica.items;

import com.IceMetalPunk.chaotica.Chaotica;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;

public class ChaoticaItems {
public ItemPureChaosBucket pureChaosBucket;

public ChaoticaItems() {
	this.pureChaosBucket = (ItemPureChaosBucket) new ItemPureChaosBucket()
			.setUnlocalizedName("item.pureChaosBucket").setContainerItem(Items.bucket)
			.setCreativeTab(CreativeTabs.tabMisc);

	registerContainers();
}

private void registerContainers() {
	GameRegistry.registerItem(this.pureChaosBucket, "pureChaosBucket");
	FluidContainerRegistry.registerFluidContainer(Chaotica.blockRegistry.pureChaos,
			new ItemStack(this.pureChaosBucket), new ItemStack(Items.bucket));
}
}

 

ItemPureChaosBucket.java (fluid container):

package com.IceMetalPunk.chaotica.items;

import com.IceMetalPunk.chaotica.Chaotica;

import net.minecraft.item.ItemBucket;

public class ItemPureChaosBucket extends ItemBucket {

public ItemPureChaosBucket() {
	super(Chaotica.blockRegistry.pureChaosBlock);
}

}

 

Looking through the code, the inherited right click method from ItemBucket seems like it should place the source block just fine, and the tutorial says it should as well, yet...nothing happens. No source block of any kind is created, no errors or warnings are shown...I'm at a loss.

 

What's going wrong here?

 

*EDIT* Wait, wait...I may have made a *very* stupid mistake here. Before you facepalm and comment, give me a couple minutes to test >_<

 

*EDIT 2* Yep...yep...I was an idiot. For those wondering, I never actually registered the source block with the GameRegistry...I'mma pretend this never happened...

Whatever Minecraft needs, it is most likely not yet another tool tier.

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.