Jump to content

Recommended Posts

Posted

I have a huge castle I'm building with my son, and I thought it would be cool to bind a key to "draw" or fill the currently selected block type in the direction the player is facing, until it hits a wall.  Basically, to help quickly build floors and ceilings.

 

So, I manually create a 4 sided building.

When inside, I'd like to go to a corner, press a key and have my mod add that block continuously in the direction I'm facing, until it hits a wall.

 

Or, in a similar fashion, fill in an entire floor, so I'd draw/create those blocks any place that doesn't already contain a block in a growing rectangle around the player, again, until another block type is hit.

 

Can anyone point me in the right direction?

Posted

I have a huge castle I'm building with my son, and I thought it would be cool to bind a key to "draw" or fill the currently selected block type in the direction the player is facing, until it hits a wall.  Basically, to help quickly build floors and ceilings.

 

So, I manually create a 4 sided building.

When inside, I'd like to go to a corner, press a key and have my mod add that block continuously in the direction I'm facing, until it hits a wall.

 

Or, in a similar fashion, fill in an entire floor, so I'd draw/create those blocks any place that doesn't already contain a block in a growing rectangle around the player, again, until another block type is hit.

 

Can anyone point me in the right direction?

Posted

You are correct MateuszKam7 i did also think of this however this person seems rather new to modding so i thought i would show him the simplest method to his end. Also worldEdit is an ingame tool which he and his son could use in tandem as long as it is installed on both computers. Also MCEdit takes some time to learn whereas worldEdit just uses a very simple axe and other vanilla features ( +commands ).

Use examples, i have aspergers.

Examples make sense to me.

Posted

You are correct MateuszKam7 i did also think of this however this person seems rather new to modding so i thought i would show him the simplest method to his end. Also worldEdit is an ingame tool which he and his son could use in tandem as long as it is installed on both computers. Also MCEdit takes some time to learn whereas worldEdit just uses a very simple axe and other vanilla features ( +commands ).

Use examples, i have aspergers.

Examples make sense to me.

Posted

I have a huge castle I'm building with my son, and I thought it would be cool to bind a key to "draw" or fill the currently selected block type in the direction the player is facing, until it hits a wall.  Basically, to help quickly build floors and ceilings.

 

So, I manually create a 4 sided building.

When inside, I'd like to go to a corner, press a key and have my mod add that block continuously in the direction I'm facing, until it hits a wall.

 

Or, in a similar fashion, fill in an entire floor, so I'd draw/create those blocks any place that doesn't already contain a block in a growing rectangle around the player, again, until another block type is hit.

 

Can anyone point me in the right direction?

 

got nerved by the same thing and done this:

 

 

package buildhelper;

import java.util.HashMap;
import java.util.Map;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;

public abstract class ItemFlatWand extends Item
{
private class Pos
{
	public final int x;
	public final int y;
	public final int z;

	public Pos(int x, int y, int z)
	{
		this.x = x;
		this.y = y;
		this.z = z;
	}
}

Map<String, Pos> startPoint;

public ItemFlatWand(int itemId)
{
	super(itemId);
	this.maxStackSize = 1;
	this.setCreativeTab(CreativeTabs.tabTools);
	this.startPoint = new HashMap<String, ItemFlatWand.Pos>();
}

@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int posX, int posY, int posZ, int side, float par8, float par9, float par10)
{
	String username = player.username;

	if (Side.SERVER == FMLCommonHandler.instance().getEffectiveSide())
	{

		if(this.startPoint.containsKey(username))
		{
			Pos startPos = this.startPoint.get(username);

			if(this.pointsInDistanceLimit(startPos, posX, posY, posZ))
			{
				this.startPoint.remove(username);
				int startPosX = startPos.x < posX ? startPos.x : posX;
				int startPosY = startPos.y < posY ? startPos.y : posY;
				int startPosZ = startPos.z < posZ ? startPos.z : posZ;
				int endPosX = startPos.x > posX ? startPos.x : posX;
				int endPosY = startPos.y > posY ? startPos.y : posY;
				int endPosZ = startPos.z > posZ ? startPos.z : posZ;

				for(int x = startPosX; x <= endPosX; x++)
				{
					for(int y = startPosY; y <= endPosY; y++)
					{
						for(int z = startPosZ; z <= endPosZ; z++)
						{
							this.setBlock(world, x, y, z);
						}
					}
				}
				return true;
			}
		}
		else
		{
			Pos startPos = new Pos(posX, posY, posZ);
			this.startPoint.put(username, startPos);
			return true;
		}
	}
	return false;
}

protected abstract void setBlock(World world, int x, int y, int z);

private boolean pointsInDistanceLimit(Pos startPos, int endPosX, int endPosY, int endPosZ)
{
	int distX = Math.abs(startPos.x - endPosX);
	int distY = Math.abs(startPos.y - endPosY);
	int distZ = Math.abs(startPos.z - endPosZ);

	if(distX <= 15 && distY <= 5 && distZ <= 15)
	{
		return true;
	}
	return false;
}
}

 

package buildhelper;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.world.World;

public class ItemFlatWandCobble extends ItemFlatWand
{

public ItemFlatWandCobble(int itemId)
{
	super(itemId);
	// TODO Auto-generated constructor stub
}

@SideOnly(Side.CLIENT)
@Override
public void updateIcons(IconRegister iconRegister)
{
	this.iconIndex = iconRegister.registerIcon(Constants.TBH_MODID + ":" + Constants.KEY_COBBLE_FLAT_WAND);
}

@Override
protected void setBlock(World world, int x, int y, int z)
{
	world.setBlock(x, y, z, Block.cobblestone.blockID);
}
}

 

 

 

click one block with the wand and click another and ping you got the in between filled with cobble stone ... I have set a limit of 15x5x15 so I don't kill the system by overloading it in any way. But the first click is not forgotten if the second is outside of the limits, so the hole thing is very user unfriendly... have done it only for me to speed up building (got another wand for digging 3x3x3 holes and another one for dirt and a last one for filling water columns with sand (click next to water and the a sand column will appear falling into the water for fast filling of lakes ...) thought about making the cobble/dirt wand dynamic, but haven't found the time yet :D

 

now if you make the set block id dynamic instead of cobble you got what you're asking for (and wrap a basic mod structure around it of course :) )

 

ps: I can send you the mod if you like, I haven't published it yet since I don't think is very user friendly right now ...

 

btw, done something like this with it:

 

 

 

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

Posted

I have a huge castle I'm building with my son, and I thought it would be cool to bind a key to "draw" or fill the currently selected block type in the direction the player is facing, until it hits a wall.  Basically, to help quickly build floors and ceilings.

 

So, I manually create a 4 sided building.

When inside, I'd like to go to a corner, press a key and have my mod add that block continuously in the direction I'm facing, until it hits a wall.

 

Or, in a similar fashion, fill in an entire floor, so I'd draw/create those blocks any place that doesn't already contain a block in a growing rectangle around the player, again, until another block type is hit.

 

Can anyone point me in the right direction?

 

got nerved by the same thing and done this:

 

 

package buildhelper;

import java.util.HashMap;
import java.util.Map;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;

public abstract class ItemFlatWand extends Item
{
private class Pos
{
	public final int x;
	public final int y;
	public final int z;

	public Pos(int x, int y, int z)
	{
		this.x = x;
		this.y = y;
		this.z = z;
	}
}

Map<String, Pos> startPoint;

public ItemFlatWand(int itemId)
{
	super(itemId);
	this.maxStackSize = 1;
	this.setCreativeTab(CreativeTabs.tabTools);
	this.startPoint = new HashMap<String, ItemFlatWand.Pos>();
}

@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int posX, int posY, int posZ, int side, float par8, float par9, float par10)
{
	String username = player.username;

	if (Side.SERVER == FMLCommonHandler.instance().getEffectiveSide())
	{

		if(this.startPoint.containsKey(username))
		{
			Pos startPos = this.startPoint.get(username);

			if(this.pointsInDistanceLimit(startPos, posX, posY, posZ))
			{
				this.startPoint.remove(username);
				int startPosX = startPos.x < posX ? startPos.x : posX;
				int startPosY = startPos.y < posY ? startPos.y : posY;
				int startPosZ = startPos.z < posZ ? startPos.z : posZ;
				int endPosX = startPos.x > posX ? startPos.x : posX;
				int endPosY = startPos.y > posY ? startPos.y : posY;
				int endPosZ = startPos.z > posZ ? startPos.z : posZ;

				for(int x = startPosX; x <= endPosX; x++)
				{
					for(int y = startPosY; y <= endPosY; y++)
					{
						for(int z = startPosZ; z <= endPosZ; z++)
						{
							this.setBlock(world, x, y, z);
						}
					}
				}
				return true;
			}
		}
		else
		{
			Pos startPos = new Pos(posX, posY, posZ);
			this.startPoint.put(username, startPos);
			return true;
		}
	}
	return false;
}

protected abstract void setBlock(World world, int x, int y, int z);

private boolean pointsInDistanceLimit(Pos startPos, int endPosX, int endPosY, int endPosZ)
{
	int distX = Math.abs(startPos.x - endPosX);
	int distY = Math.abs(startPos.y - endPosY);
	int distZ = Math.abs(startPos.z - endPosZ);

	if(distX <= 15 && distY <= 5 && distZ <= 15)
	{
		return true;
	}
	return false;
}
}

 

package buildhelper;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.world.World;

public class ItemFlatWandCobble extends ItemFlatWand
{

public ItemFlatWandCobble(int itemId)
{
	super(itemId);
	// TODO Auto-generated constructor stub
}

@SideOnly(Side.CLIENT)
@Override
public void updateIcons(IconRegister iconRegister)
{
	this.iconIndex = iconRegister.registerIcon(Constants.TBH_MODID + ":" + Constants.KEY_COBBLE_FLAT_WAND);
}

@Override
protected void setBlock(World world, int x, int y, int z)
{
	world.setBlock(x, y, z, Block.cobblestone.blockID);
}
}

 

 

 

click one block with the wand and click another and ping you got the in between filled with cobble stone ... I have set a limit of 15x5x15 so I don't kill the system by overloading it in any way. But the first click is not forgotten if the second is outside of the limits, so the hole thing is very user unfriendly... have done it only for me to speed up building (got another wand for digging 3x3x3 holes and another one for dirt and a last one for filling water columns with sand (click next to water and the a sand column will appear falling into the water for fast filling of lakes ...) thought about making the cobble/dirt wand dynamic, but haven't found the time yet :D

 

now if you make the set block id dynamic instead of cobble you got what you're asking for (and wrap a basic mod structure around it of course :) )

 

ps: I can send you the mod if you like, I haven't published it yet since I don't think is very user friendly right now ...

 

btw, done something like this with it:

 

 

 

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

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.