Java Code Examples for net.minecraftforge.fml.common.Optional#Method

The following examples show how to use net.minecraftforge.fml.common.Optional#Method . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GPSTileEntity.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Callback
@Optional.Method(modid = "opencomputers")
public Object[] getPosition(Context context, Arguments args) {
    java.util.Optional<PhysicsObject> physicsObjectOptional = ValkyrienUtils
        .getPhysicsObject(getWorld(), getPos());
    if (physicsObjectOptional.isPresent()) {
        BlockPos pos = physicsObjectOptional.get()
            .getWrapperEntity()
            .getPosition();
        return new Object[]{pos.getX(), pos.getY(), pos.getZ()};
    }
    return null;
}
 
Example 2
Source File: ItemCapeBauble.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@Optional.Method(modid = "baubles")
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
	if (player.world.isRemote) return;

	tickCape(itemstack);
}
 
Example 3
Source File: BaublesSupport.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@Optional.Method(modid = "baubles")
public Iterable<ItemStack> getBaublesFallbackArmor(EntityLivingBase entity) {
	if (!(entity instanceof EntityPlayer)) return entity.getArmorInventoryList();
	if (BaublesApi.getBaublesHandler((EntityPlayer) entity) == null) return entity.getArmorInventoryList();

	ImmutableList.Builder<ItemStack> stacks = ImmutableList.builder();
	IBaublesItemHandler inv = BaublesApi.getBaublesHandler((EntityPlayer) entity);
	for (BaubleType type : BaubleType.values())
		for (int slot : type.getValidSlots()) {
			stacks.add(inv.getStackInSlot(slot));
		}
	return stacks.build();
}
 
Example 4
Source File: InjectorTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Optional.Method(modid = "opencomputers")
@Override
public String getComponentName() {
    return "etech_injector";
}
 
Example 5
Source File: FabricatorTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Callback
@Optional.Method(modid = "opencomputers")
public Object[] startPrint(Context context, Arguments args) {
    this.startPrinting();
    return new Object[] { "Printing started." };
}
 
Example 6
Source File: ItemCapeBauble.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Nonnull
@Override
@Optional.Method(modid = "baubles")
public BaubleType getBaubleType(ItemStack itemStack) {
	return BaubleType.BODY;
}
 
Example 7
Source File: DiffuserTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Optional.Method(modid = "opencomputers")
@Override
public String getComponentName() {
    return "etech_diffuser";
}
 
Example 8
Source File: InjectorTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Callback
@Optional.Method(modid = "opencomputers")
public Object[] getProgress(Context context, Arguments args) {
    int value = getProgress();
    return new Object[] { value };
}
 
Example 9
Source File: ScaffolderTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Callback
@Optional.Method(modid = "opencomputers")
public Object[] getProgress(Context context, Arguments args) {
    int value = getProgress();
    return new Object[] { value };
}
 
Example 10
Source File: ShredderTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Callback
@Optional.Method(modid = "opencomputers")
public Object[] getEnergyLevel(Context context, Arguments args) {
    int level = getEnergy();
    return new Object[] { level };
}
 
Example 11
Source File: TidalGeneratorTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Optional.Method(modid = "opencomputers")
@Override
public String getComponentName() {
    return "etech_tidal_generator";
}
 
Example 12
Source File: ScrubberTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Callback
@Optional.Method(modid = "opencomputers")
public Object[] getGas(Context context, Arguments args) {
    int value = getGas();
    return new Object[] { value };
}
 
Example 13
Source File: ScrubberTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Callback
@Optional.Method(modid = "opencomputers")
public Object[] getProgress(Context context, Arguments args) {
    int value = getProgress();
    return new Object[] { value };
}
 
Example 14
Source File: AlgaeBioreactorTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Optional.Method(modid = "opencomputers")
@Override
public String getComponentName() {
    return "etech_algaebioreactor";
}
 
Example 15
Source File: GTItemBaublesEnergyPack.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
@Optional.Method(modid = "baubles")
public boolean willAutoSync(ItemStack itemstack, EntityLivingBase player) {
	return true;
}
 
Example 16
Source File: ScrubberTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Optional.Method(modid = "opencomputers")
@Override
public String getComponentName() {
    return "etech_scrubber";
}
 
Example 17
Source File: BioreactorTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Optional.Method(modid = "opencomputers")
@Override
public String getComponentName() {
    return "etech_bioreactor";
}
 
Example 18
Source File: WindTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Optional.Method(modid = "opencomputers")
@Override
public String getComponentName() {
    return "etech_wind_generator";
}
 
Example 19
Source File: HydroponicTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Callback
@Optional.Method(modid = "opencomputers")
public Object[] getLightLevel(Context context, Arguments args) {
    int level = PlantHelper.getPlantLightAtPosition(world, pos);
    return new Object[] { level };
}
 
Example 20
Source File: HydroponicTileEntity.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Optional.Method(modid = "opencomputers")
@Override
public String getComponentName() {
    return "etech_grow_bed";
}