Skip to content

Instantly share code, notes, and snippets.

@amadornes
Created May 2, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amadornes/17f9d65b9d0e365990ff to your computer and use it in GitHub Desktop.
Save amadornes/17f9d65b9d0e365990ff to your computer and use it in GitHub Desktop.
Micro Builder's Wand part handler
package com.amadornes.microtools.api;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import codechicken.lib.raytracer.ExtendedMOP;
import codechicken.lib.vec.BlockCoord;
import codechicken.multipart.TMultiPart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Part handler for the Micro Builder's Wand. Implement this interface to add handling for your own type of multiparts.
*/
public interface IBuildersWandPartHandler extends IPartHandler {
/**
* Checks whether or not the specified player has the item(s) needed to place the multipart. Hit data is also provided in case it's required.
*/
public boolean hasItem(TMultiPart part, ExtendedMOP hit, EntityPlayer player);
/**
* Checks whether or not a copy of the specified part can be placed at those coordinates. Hit data is also provided in case it's required.<br />
* This gets checked if {@link IBuildersWandPartHandler#hasItem(TMultiPart, ExtendedMOP, EntityPlayer)} returned true.
*/
public boolean canPlaceCopy(TMultiPart part, ExtendedMOP hit, World world, BlockCoord pos, PlacementModifiers keys);
/**
* Consumes the item(s) used to place this part from the player's inventory. Hit data is also provided in case it's required.<br />
* This gets called after checking that {@link IBuildersWandPartHandler#canPlaceCopy(TMultiPart, ExtendedMOP, World, int, int, int)} returns true.
*/
public void consumeItem(TMultiPart part, ExtendedMOP hit, EntityPlayer player);
/**
* Places a copy of the specified part at those coordinates. Hit data is also provided in case it's required.<br />
* This gets called after consuming the item.
*/
public void placeCopy(TMultiPart part, ExtendedMOP hit, World world, BlockCoord pos, PlacementModifiers keys);
/**
* Renders the placement of a copy of the specified part that would be placed at those coordinates. Hit data is also provided in case it's
* required.<br />
* Return true if something was rendered, false if nothing was.
*/
@SideOnly(Side.CLIENT)
public boolean renderPlacement(TMultiPart part, ExtendedMOP hit, World world, BlockCoord pos, PlacementModifiers keys);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment