Class StructureLibAPI
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddThrottledChat(Object throttleKey, EntityPlayer player, IChatComponent text, short intervalRequired) Send chat to player, but throttled.static voidaddThrottledChat(Object throttleKey, EntityPlayer player, IChatComponent text, short intervalRequired, boolean forceUpdateLastSend) Send chat to player, but throttled.static voidStop instrumenting.static voidenableInstrument(Object identifier) Start instrumenting for the current thread only.static voidendHinting(World w) End current batch of hinting.static BlockGet the Block for StructureLib supplied hint block.static ItemGet the hologram item.static ItemGet the ItemBlock for StructureLib supplied hint block.static voidhintParticle(World w, int x, int y, int z, Block block, int meta) Generate a new hint particle on client side at given location using textures from given block.static voidhintParticle(World w, int x, int y, int z, IIcon[] icons) Generate a new hint particle on client side at given location using given textures.static voidhintParticleTinted(World w, int x, int y, int z, Block block, int meta, short[] RGBa) Generate a new hint particle on client side at given location using textures from given block with a tint.static voidhintParticleTinted(World w, int x, int y, int z, IIcon[] icons, short[] RGBa) Generate a new hint particle on client side at given location using given textures with a tint.static booleanisBlockTriviallyReplaceable(World w, int x, int y, int z, EntityPlayer actor) Determines if given block can be replaced without much effort.static booleanisBlockTriviallyReplaceable(World w, int x, int y, int z, EntityPlayerMP actor) Deprecated.static booleanCheck if structure debug mode is on.static booleanCheck if instrumenting is enabled.static booleanmarkHintParticleError(EntityPlayer player, World w, int x, int y, int z) Update the tint of given hint particle.static voidqueryAlignment(IAlignmentProvider provider) Query the ExtendedFacing of this tile entity from client side.static voidregisterChannelDescription(String channel, String modid, String description) Register a channel description here.static voidregisterChannelItem(String channel, String modid, int channelValue, ItemStack stack) Register an item stack as an indicator for a (channel, value) pair.static voidsendAlignment(IAlignmentProvider provider) Send the ExtendedFacing of this Tile Entity to all players.static voidsendAlignment(IAlignmentProvider provider, NetworkRegistry.TargetPoint targetPoint) Send the ExtendedFacing of this Tile Entity to all players around target point.static voidsendAlignment(IAlignmentProvider provider, EntityPlayerMP player) Send the ExtendedFacing of this Tile Entity to given player.static voidsendAlignment(IAlignmentProvider provider, World dimension) Send the ExtendedFacing of this Tile Entity to all players in that dimension.static voidsetDebugEnabled(boolean enabled) static voidStart a batch of hinting.static booleanupdateHintParticleTint(EntityPlayer player, World w, int x, int y, int z, short[] RGBa) Update the tint of given hint particle.
-
Field Details
-
MOD_ID
- See Also:
-
HINT_BLOCK_META_GENERIC_0
public static final int HINT_BLOCK_META_GENERIC_0- See Also:
-
HINT_BLOCK_META_GENERIC_1
public static final int HINT_BLOCK_META_GENERIC_1- See Also:
-
HINT_BLOCK_META_GENERIC_2
public static final int HINT_BLOCK_META_GENERIC_2- See Also:
-
HINT_BLOCK_META_GENERIC_3
public static final int HINT_BLOCK_META_GENERIC_3- See Also:
-
HINT_BLOCK_META_GENERIC_4
public static final int HINT_BLOCK_META_GENERIC_4- See Also:
-
HINT_BLOCK_META_GENERIC_5
public static final int HINT_BLOCK_META_GENERIC_5- See Also:
-
HINT_BLOCK_META_GENERIC_6
public static final int HINT_BLOCK_META_GENERIC_6- See Also:
-
HINT_BLOCK_META_GENERIC_7
public static final int HINT_BLOCK_META_GENERIC_7- See Also:
-
HINT_BLOCK_META_GENERIC_8
public static final int HINT_BLOCK_META_GENERIC_8- See Also:
-
HINT_BLOCK_META_GENERIC_9
public static final int HINT_BLOCK_META_GENERIC_9- See Also:
-
HINT_BLOCK_META_GENERIC_10
public static final int HINT_BLOCK_META_GENERIC_10- See Also:
-
HINT_BLOCK_META_GENERIC_11
public static final int HINT_BLOCK_META_GENERIC_11- See Also:
-
HINT_BLOCK_META_DEFAULT
public static final int HINT_BLOCK_META_DEFAULT- See Also:
-
HINT_BLOCK_META_AIR
public static final int HINT_BLOCK_META_AIR- See Also:
-
HINT_BLOCK_META_NOT_AIR
public static final int HINT_BLOCK_META_NOT_AIR- See Also:
-
HINT_BLOCK_META_ERROR
public static final int HINT_BLOCK_META_ERROR- See Also:
-
CHANNEL_SHOW_ERROR
- See Also:
-
-
Constructor Details
-
StructureLibAPI
public StructureLibAPI()
-
-
Method Details
-
enableInstrument
Start instrumenting for the current thread only. When instrumentation is enabled,IStructureDefinition's builtin iteration methods will sendStructureEventand its subclasses when appropriate. Otherwise, these events will not be sent at all, regardless of whether a listener for these events are registered.Identifiers are required to be value-comparable, i.e. overrides
Object.equals(Object). Suggested identifier includes- Mod Instance or
ModContainer IConstructableand its friends, if you are triggering structure check via this interface.ResourceLocation
It's an API abuse for normal
IStructureDefinitionusers to depend on this feature. They have full control and full knowledge of theIStructureDefinitionthey are using. Using events to instrument the structure check/autoplace is completely unnecessary and does nothing but add overhead.Instruments are required to call
disableInstrument()whenever it is done with its business, as there can be only one instrument for any given thread.- Parameters:
identifier- an identifier sent along the actual event.- Throws:
IllegalStateException- if instrument has already been enabled.
- Mod Instance or
-
disableInstrument
public static void disableInstrument()Stop instrumenting.- Throws:
IllegalStateException- if instrumenting hasn't been enabled.
-
isInstrumentEnabled
public static boolean isInstrumentEnabled()Check if instrumenting is enabled.- Returns:
- true if enabled, false otherwise
-
startHinting
Start a batch of hinting. All hints particles generated during one batch will be considered to belong to one hologram.You don't need to call this unless your constructable tool didn't call
ConstructableUtility.handle(ItemStack, EntityPlayer, World, int, int, int, int) -
endHinting
End current batch of hinting. All hints particles generated during one batch will be considered to belong to one hologram.You don't need to call this unless your constructable tool didn't call
ConstructableUtility.handle(ItemStack, EntityPlayer, World, int, int, int, int) -
hintParticleTinted
Generate a new hint particle on client side at given location using given textures with a tint.- Parameters:
w- World to spawn. Usually the client world.x- x coordy- y coordz- z coordicons- 6 texture. in forge direction order.RGBa- a 4 short array. tint in rgba form. currently alpha channel is ignored, but we might change this later on.
-
hintParticleTinted
public static void hintParticleTinted(World w, int x, int y, int z, Block block, int meta, short[] RGBa) Generate a new hint particle on client side at given location using textures from given block with a tint.- Parameters:
w- World to spawn. Usually the client world.x- x coordy- y coordz- z coordblock- block to take texture frommeta- the meta of block to take texture fromRGBa- a 4 short array. tint in rgba form. currently alpha channel is ignored, but we might change this later on.
-
hintParticle
-
hintParticle
Generate a new hint particle on client side at given location using textures from given block.- Parameters:
w- World to spawn. Usually the client world.x- x coordy- y coordz- z coordblock- block to take texture frommeta- the meta of block to take texture from
-
markHintParticleError
Update the tint of given hint particle. Do nothing if particle not found.Can be called on either client side or server side. Server side will schedule a network message to update it for this player only. Will do nothing if no hint particle is found at given location.
- Returns:
- false if nothing updated. true if updated or update instruction sent.
-
updateHintParticleTint
public static boolean updateHintParticleTint(EntityPlayer player, World w, int x, int y, int z, short[] RGBa) Update the tint of given hint particle. Do nothing if particle not found.- Returns:
- false if nothing updated. true if updated.
-
queryAlignment
Query the ExtendedFacing of this tile entity from client side. Can be sent only on client side. The ExtendedFacing will later be set onto given tile entity viaIAlignment.setExtendedFacing(ExtendedFacing)upon arrival of server reply.The server side will query the
ExtendedFacingof this provider usingIAlignment.getExtendedFacing()- Throws:
IllegalArgumentException- if is not tile entity or provided a null alignment
-
sendAlignment
Send the ExtendedFacing of this Tile Entity to all players. Can be called on server side only.The receiving tile entity will receive the
ExtendedFacingvia itsIAlignment.setExtendedFacing(ExtendedFacing)method.- Throws:
IllegalArgumentException- if is not tile entity or provided a null alignment
-
sendAlignment
Send the ExtendedFacing of this Tile Entity to given player. Can be called on server side only.The receiving tile entity will receive the
ExtendedFacingvia itsIAlignment.setExtendedFacing(ExtendedFacing)method.- Throws:
IllegalArgumentException- if is not tile entity or provided a null alignment
-
sendAlignment
public static void sendAlignment(IAlignmentProvider provider, NetworkRegistry.TargetPoint targetPoint) Send the ExtendedFacing of this Tile Entity to all players around target point. Can be called on server side only.The receiving tile entity will receive the
ExtendedFacingvia itsIAlignment.setExtendedFacing(ExtendedFacing)method.- Throws:
IllegalArgumentException- if is not tile entity or provided a null alignment
-
sendAlignment
Send the ExtendedFacing of this Tile Entity to all players in that dimension. Can be called on server side only.The receiving tile entity will receive the
ExtendedFacingvia itsIAlignment.setExtendedFacing(ExtendedFacing)method.- Throws:
IllegalArgumentException- if is not tile entity or provided a null alignment
-
getBlockHint
Get the Block for StructureLib supplied hint block. -
getItemBlockHint
Get the ItemBlock for StructureLib supplied hint block. -
getDefaultHologramItem
Get the hologram item. -
isDebugEnabled
public static boolean isDebugEnabled()Check if structure debug mode is on.- Returns:
- true if debug mode is on
-
setDebugEnabled
public static void setDebugEnabled(boolean enabled) -
isBlockTriviallyReplaceable
@Deprecated public static boolean isBlockTriviallyReplaceable(World w, int x, int y, int z, EntityPlayerMP actor) Deprecated.Determines if given block can be replaced without much effort. The exact predicate clauses is not stable and will be changed, but the general idea will always stay the same.Use this in your
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, AutoPlaceEnvironment) -
isBlockTriviallyReplaceable
Determines if given block can be replaced without much effort. The exact predicate clauses is not stable and will be changed, but the general idea will always stay the same.Use this in your
IStructureElement.survivalPlaceBlock(Object, World, int, int, int, ItemStack, AutoPlaceEnvironment) -
addThrottledChat
public static void addThrottledChat(Object throttleKey, EntityPlayer player, IChatComponent text, short intervalRequired) Send chat to player, but throttled.- Parameters:
throttleKey- throttle key. Must properly implementObject.hashCode()andObject.equals(Object)to handle value equality.player- player to send chat totext- chat to sendintervalRequired- interval required before last recorded time to actually send the message. unit in millisecond. we purposefully chose to not use a bigger data type to limit how long this interval can be
-
addThrottledChat
public static void addThrottledChat(Object throttleKey, EntityPlayer player, IChatComponent text, short intervalRequired, boolean forceUpdateLastSend) Send chat to player, but throttled.- Parameters:
throttleKey- throttle key. Must properly implementObject.hashCode()andObject.equals(Object)to handle value equality.player- player to send chat totext- chat to sendintervalRequired- interval required before last recorded time to actually send the message. unit in millisecond. we purposefully chose to not use a bigger data type to limit how long this interval can beforceUpdateLastSend- if true, always update the last send time, even if the message isn't actually sent.
-
registerChannelDescription
Register a channel description here. The description should describe how a channel will be used inside your mod.- Parameters:
channel- channel keymodid- your modiddescription- localization key for your description
-
registerChannelItem
public static void registerChannelItem(String channel, String modid, int channelValue, ItemStack stack) Register an item stack as an indicator for a (channel, value) pair.- Parameters:
channel- channel keymodid- your modidchannelValue- valuestack- item stack. having a metadata ofOreDictionary.WILDCARD_VALUEwill match without comparing NBT or metadata value. having a tag withtag.getBoolean("*") == truewill match without comparing NBT.
-