Added some documentation to a few interfaces for the javadoc.

This commit is contained in:
Luis C.M committed 2022-05-17 05:24:57 -05:00
1 parent 648206f5ba
commit fd1aa40456
4 files changed
+111 -11

No files matched your search

@@ -62,8 +62,8 @@ public class ScriptBlock implements IBlock {
return this.block.isAir(this.world.getMCWorld(), getX(), getY(), getZ());
}
public ScriptBlock setBlock(String name) {
Block block = (Block)Block.blockRegistry.getObject(new ResourceLocation(name));
public ScriptBlock setBlock(String blockName) {
Block block = (Block)Block.blockRegistry.getObject(new ResourceLocation(blockName));
if(block == null) {
return this;
} else {
@@ -113,11 +113,11 @@ public class ScriptBlock implements IBlock {
return this.tile != null;
}
public ScriptTileEntity getTileEntity() {
public ITileEntity getTileEntity() {
return new ScriptTileEntity(this.tile);
}
public void setTileEntity(ScriptTileEntity tileEntity){
public void setTileEntity(ITileEntity tileEntity){
world.setTileEntity(pos.getX(),pos.getY(), pos.getZ(),tileEntity);
this.tile = tileEntity.getMCTileEntity();
}
@@ -7,7 +7,6 @@ package noppes.npcs.scripted.interfaces;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import noppes.npcs.scripted.ScriptTileEntity;
public interface IBlock {
int getX();
@@ -16,35 +15,92 @@ public interface IBlock {
int getZ();
/**
*
* @return Returns an IPos object with the block's XYZ position.
*/
IPos getPos();
/**
*
* @return Returns the block name as it appears in the block registry. Return example: "minecraft:stone"
*/
String getName();
/**
* Deletes the block, setting it to air.
*/
void remove();
boolean isAir();
IBlock setBlock(String var1);
/**
*
* @param blockName The name of the block to be set in place of this block.
* @return Returns the new block set in place of this block as an IBlock object.
*/
IBlock setBlock(String blockName);
IBlock setBlock(IBlock var1);
/**
*
* @param block Input IBlock object to replace this block.
* @return Returns the new block set in place of the previous block.
*/
IBlock setBlock(IBlock block);
/**
*
* @return Returns true if the block can contain items like a chest does.
*/
boolean isContainer();
/**
*
* @return Returns the container object of this block. If this block is not a container, an exception will be thrown.
*/
IContainer getContainer();
/**
*
* @return Returns an IWorld object of the world this block is in.
*/
IWorld getWorld();
/**
*
* @return Returns true if this block has a tile entity. Blocks with custom data like signs, player skulls, chests, etc. will have tile entities.
*/
boolean hasTileEntity();
ScriptTileEntity getTileEntity();
/**
*
* @return Returns an ITileEntity object which can modify this block's tile entity.
*/
ITileEntity getTileEntity();
void setTileEntity(ScriptTileEntity tileEntity);
/**
*
* @param tileEntity Replaces this block's tile entity based on the data given by this parameter.
*/
void setTileEntity(ITileEntity tileEntity);
/**
*
* @return Returns a non-script, obfuscated MC object for the block's tile entity.
*/
TileEntity getMCTileEntity();
/**
*
* @return Returns a non-script, obfuscated MC block object.
*/
Block getMCBlock();
String getDisplayName();
/**
*
* @return Returns an INbt object which can modify the block's tile entity's NBT data.
*/
INbt getTileEntityNBT();
}
@@ -13,18 +13,46 @@ import noppes.npcs.scripted.interfaces.item.IItemStack;
public interface IContainer {
int getSize();
IItemStack getSlot(int var1);
IItemStack getSlot(int slot);
/**
*
* @param slot The slot to be replaced
* @param item The item replacing the previous item in that slot, as an IItemStack object
*/
void setSlot(int slot, IItemStack item);
/**
*
* @return Returns a non-script, obfuscated MC inventory object.
*/
IInventory getMCInventory();
/**
*
* @return Returns a non-script, obfuscated MC container object.
*/
Container getMCContainer();
int count(IItemStack var1, boolean var2, boolean var3);
/**
*
* @param itemStack The item stack to be searched in the container
* @param ignoreDamage Whether damage should be ignored when searching
* @param ignoreNBT Whether NBT values should be ignored when searching
* @return Returns the amount of the item stack found, based on the flags given above.
*/
int count(IItemStack itemStack, boolean ignoreDamage, boolean ignoreNBT);
/**
*
* @return Returns a list of all item stacks in the container as a list of IItemStack objects.
*/
IItemStack[] getItems();
/**
*
* @return Returns true if this container belongs to a Custom GUI.
*/
boolean isCustomGUI();
void detectAndSendChanges();
@@ -9,15 +9,31 @@ import net.minecraft.util.DamageSource;
import noppes.npcs.scripted.interfaces.entity.IEntity;
public interface IDamageSource {
/**
*
* @return Returns the damage type of the damage source as a string. Ex: "lava", "explosion", "magic", "outOfWorld", etc.
*/
String getType();
boolean isUnblockable();
boolean isProjectile();
/**
*
* @return Returns the entity source of where the damage source originated. If a player was shot by an arrow from a skeleton, this would return an IEntity object of the skeleton.
*/
IEntity getTrueSource();
/**
*
* @return Returns the entity source of where the damage source originated. If a player was shot by an arrow from a skeleton, this would return an IEntity object of the arrow.
*/
IEntity getImmediateSource();
/**
*
* @return Returns a non-script, obfuscated MC damage source object.
*/
DamageSource getMCDamageSource();
}